diff options
109 files changed, 2011 insertions, 789 deletions
diff --git a/backends/platform/symbian/AdaptAllMMPs.pl b/backends/platform/symbian/AdaptAllMMPs.pl index ffc4e88aff..2f76acf012 100644 --- a/backends/platform/symbian/AdaptAllMMPs.pl +++ b/backends/platform/symbian/AdaptAllMMPs.pl @@ -44,6 +44,15 @@ chdir("../../../"); "mmp/scummvm_toltecs.mmp", "mmp/scummvm_pegasus.mmp", "mmp/scummvm_wintermute.mmp", + # New engines + "mmp/scummvm_avalanche.mmp", + "mmp/scummvm_dreamweb.mmp", + "mmp/scummvm_fullpipe.mmp", + "mmp/scummvm_mortevielle.mmp", + "mmp/scummvm_neverhood.mmp", + "mmp/scummvm_sword25.mmp", + "mmp/scummvm_testbed.mmp", + "mmp/scummvm_zvision.mmp", # Target Platform Project Files "S60/ScummVM_S60.mmp", "S60v3/ScummVM_S60v3.mmp", @@ -79,10 +88,14 @@ Preparing to update all the Symbian MMP project files with objects from module.m # some modules.mk files have #ifndef ENABLE_XXXX blocks: my @section_empty = (""); # section standard: no #ifdef's in module.mk files -my @sections_scumm = ("", "ENABLE_SCUMM_7_8", "ENABLE_HE"); # special sections for engine SCUMM -my @sections_saga = ("", "ENABLE_IHNM", "ENABLE_SAGA2"); # special sections for engine SAGA -my @sections_kyra = ("", "ENABLE_LOL","ENABLE_EOB"); # special sections for engine KYRA my @sections_agos = ("", "ENABLE_AGOS2"); # special sections for engine AGOS +my @section_video = ("", "USE_BINK", "USE_MPEG2"); # special sections for engine VIDEO ###, "USE_THEORADEC" +my @sections_groovie = ("", "ENABLE_GROOVIE2"); # special sections for engine GROOVIE +my @sections_kyra = ("", "ENABLE_LOL","ENABLE_EOB"); # special sections for engine KYRA +my @sections_mohawk = ("", "ENABLE_CSTIME", "ENABLE_MYST", "ENABLE_RIVEN"); # special sections for engine MOHAWK +my @sections_saga = ("", "ENABLE_IHNM", "ENABLE_SAGA2"); # special sections for engine SAGA +my @sections_sci = ("", "ENABLE_SCI32"); # special sections for engine SCI +my @sections_scumm = ("", "ENABLE_SCUMM_7_8", "ENABLE_HE"); # special sections for engine SCUMM # files excluded from build, case insensitive, will be matched in filename string only my @excludes_snd = ( @@ -126,13 +139,13 @@ my @excludes_scumm = ( ); -#arseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray]) +#ParseModule(mmpStr, dirStr, ifdefArray, [exclusionsArray]) ParseModule("_base", "base", \@section_empty); # now in ./TRG/ScummVM_TRG.mmp, these never change anyways... ParseModule("_base", "common", \@section_empty); ParseModule("_base", "gui", \@section_empty, \@excludes_gui); ParseModule("_base", "graphics", \@section_empty, \@excludes_graphics); ParseModule("_base", "audio", \@section_empty, \@excludes_snd); -ParseModule("_base", "video", \@section_empty); +ParseModule("_base", "video", \@section_video); # chdir("engines/"); ParseModule("_scumm", "scumm", \@sections_scumm, \@excludes_scumm ); @@ -156,21 +169,30 @@ ParseModule("_drascula","drascula", \@section_empty); ParseModule("_made", "made", \@section_empty); ParseModule("_m4", "m4", \@section_empty); ParseModule("_tinsel", "tinsel", \@section_empty); -ParseModule("_groovie", "groovie", \@section_empty); +ParseModule("_groovie", "groovie", \@sections_groovie); ParseModule("_tucker", "tucker", \@section_empty); -ParseModule("_sci", "sci", \@section_empty); +ParseModule("_sci", "sci", \@sections_sci); ParseModule("_draci", "draci", \@section_empty); ParseModule("_teenagent","teenagent", \@section_empty); -ParseModule("_mohawk" ,"mohawk", \@section_empty); +ParseModule("_mohawk" ,"mohawk", \@sections_mohawk); ParseModule("_hugo" ,"hugo", \@section_empty); ParseModule("_toon" ,"toon", \@section_empty); ParseModule("_lastexpress","lastexpress", \@section_empty); ParseModule("_tsage","tsage", \@section_empty); -ParseModule("_tony","tony", \@section_empty); +ParseModule("_tony", "tony", \@section_empty); ParseModule("_toltecs","toltecs", \@section_empty); ParseModule("_hopkins","hopkins", \@section_empty); ParseModule("_pegasus","pegasus", \@section_empty); ParseModule("_wintermute","wintermute", \@section_empty); +##### new engines +ParseModule("_avalanche" ,"avalanche", \@section_empty); +ParseModule("_dreamweb" ,"dreamweb", \@section_empty); +ParseModule("_fullpipe" ,"fullpipe", \@section_empty); +ParseModule("_mortevielle" ,"mortevielle", \@section_empty); +ParseModule("_neverhood" ,"neverhood", \@section_empty); +ParseModule("_sword25" ,"sword25", \@section_empty); +ParseModule("_testbed" ,"testbed", \@section_empty); +ParseModule("_zvision" ,"zvision", \@section_empty); print " ======================================================================================= Done. Enjoy :P diff --git a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl index 3062068852..560439f4e1 100644 --- a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl +++ b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl @@ -1,6 +1,7 @@ use Cwd; use Switch; +#use feature "switch"; system("cls"); require "BuildPackageUpload_LocalSettings.pl"; @@ -59,9 +60,13 @@ $ftp_url = "FTP://$FTP_User\@$FTP_Host/$FTP_Dir/"; # these macros are always defined: $ExtraMacros = "MACRO NONSTANDARD_PORT\n"; -$ExtraMacros .= "MACRO ENABLE_VKEYBD\n"; +$ExtraMacros .= "MACRO ENABLE_VKEYBD\n"; $ExtraMacros .= "MACRO DISABLE_FANCY_THEMES\n"; $ExtraMacros .= "MACRO USE_TRANSLATION\n"; +$ExtraMacros .= "MACRO USE_BINK\n"; +$ExtraMacros .= "MACRO USE_MPEG2\n"; +# $ExtraMacros .= "MACRO \n"; +# candidates are : , USE_TIMIDITY, # prep nice list of SDKs #while( ($SDK, $RootDir) = each(%SDK_RootDirs) ) diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl index ded4ef198f..ba4b11cc48 100644 --- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl +++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl @@ -2,24 +2,33 @@ ################################################################################################################## @WorkingEngines = qw( - scumm agos sky queen gob groovie saga drascula - kyra lure agi touche parallaction cine - cruise made tinsel tucker sword1 sword2 draci sci teenagent mohawk hugo toon lastexpress tsage cge - composer toltecs tony wintermute pegasus + agos agi cine cge composer cruise draci + drascula hugo gob groovie kyra lastexpress + lure made mohawk parallaction pegasus queen + saga sci scumm sky sword1 sword2 teenagent tinsel + toltecs tony toon touche tsage tucker wintermute + dreamweb fullpipe hopkins mortevielle + neverhood testbed avalanche zvision ); +#### New engines +#### sword25 @WorkingEngines_1st = qw( - scumm queen groovie saga drascula - touche parallaction cine -? cruise made tucker lastexpress composer wintermute + cine composer cruise drascula groovie + lastexpress made parallaction queen + saga scumm touche tucker wintermute + avalanche zvision ); @WorkingEngines_2nd = qw( - agos sky gob kyra lure - agi tinsel sword1 sword2 - draci sci teenagent hugo toon - tsage cge toltecs tony pegasus + agi agos cge draci gob hopkins + hugo kyra lure mohawk pegasus sci + sky sword1 sword2 teenagent + tinsel tsage toltecs tony toon + dreamweb fullpipe mortevielle + neverhood testbed ); +#### sword25 @TestingEngines = qw( @@ -34,20 +43,31 @@ lol agos2 eob + cstime + myst + riven + saga2 + sci32 + groovie2 ); #disabled subengines lol saga2 personal nightmare + # see configure.engines %UseableFeatures = ( 'zlib' => 'zlib.lib', 'mad' => 'libmad.lib', 'tremor' => 'libtremor.lib', - 'flac' => 'libflac.lib' + 'flac' => 'libflacdec.lib', + 'freetype2' => 'freetype.lib', + 'faad' => 'libFAAD2.lib', ); + # 'mpeg2' => 'libmpeg2.lib' # these are normally enabled for each variation #$DefaultFeatures = qw(zlib,mad); - $DefaultFeatures = qw(zlib,mad,tremor,flac); + #$DefaultFeatures = qw(zlib,mad,tremor,); + $DefaultFeatures = qw(mad,tremor,faad,flac,freetype2,mpeg2,zlib,); ################################################################################################################## ## @@ -64,7 +84,8 @@ $HaltOnError = 0; $SkipExistingPackages = 0; $ReallyQuiet = 0; - $DevBase = "C:\\S"; + $DevBase = "D:\\Symbian"; + $Compiler = "D:\\Program/ Files\\CodeSourcery\\Sourcery/ G++ Lite"; # specify an optional FTP server to upload to after each Build+Package (can leave empty) #$FTP_Host = "host.com"; @@ -77,14 +98,14 @@ # Note1: the \epoc32 directory needs to be in these rootdirs # Note2: these paths do NOT end in a backslash! # $SDK_RootDirs{'UIQ2'} = "$DevBase\\UIQ_21"; - $SDK_RootDirs{'UIQ3'} = "$DevBase\\UIQ3"; + # $SDK_RootDirs{'UIQ3'} = "$DevBase\\UIQ3"; # $SDK_RootDirs{'S60v1'} = "$DevBase\\S60v1"; # $SDK_RootDirs{'S60v2'} = "$DevBase\\S60v2"; $SDK_RootDirs{'S60v3'} = "$DevBase\\S60v3"; # $SDK_RootDirs{'S80'} = "$DevBase\\S80"; # $SDK_RootDirs{'S90'} = "$DevBase\\S90"; - $SDK_ToolchainDirs{'S60v3'} = "$DevBase\\arm-symbianelf\\bin"; + $SDK_ToolchainDirs{'S60v3'} = "$Compiler\\arm-symbianelf\\bin"; $SDK_ToolchainDirs{'UIQ2'} = "$DevBase\\ECompXL\\bin"; # only needed for UIQ2/UIQ3 $SDK_ToolchainDirs{'UIQ3'} = "$DevBase\\ECompXL\\bin"; # only needed for UIQ2/UIQ3 @@ -94,7 +115,7 @@ { ## Standard libraries $SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "$DevBase\\zlib-1.2.2\\epoc"; - #$SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "$DevBase\\libmad-0.15.1b\\group"; + $SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "$DevBase\\libmad-0.15.1b\\group"; $SDK_LibraryDirs{'ALL'}{'libtremor.lib'}= "$DevBase\\tremor\\epoc"; ## SDL 1.2.12 / AnotherGuest / Symbian version @@ -186,7 +207,7 @@ # now you can add $VariationSets only built on this PC below this line :) } - elsif ($ENV{'COMPUTERNAME'} eq "EMBEDDEV-LAPE") ################################################################# + elsif ($ENV{'COMPUTERNAME'} eq "EMBEDDEV-VAIO2") ################################################################# { $Producer = "AnotherGuest"; $RedirectSTDERR = 1; @@ -206,7 +227,7 @@ $SDK_RootDirs{'S60v3'}= "G:\\S60v3"; #$SDK_RootDirs{'S80'}= "D:\\S80"; #$SDK_RootDirs{'S90'}= "D:\\S90"; - $ECompXL_BinDir= "D:\\ECompXL\\"; + #$ECompXL_BinDir= "D:\\ECompXL\\"; if (0) # so we can turn them on/off easily { # $SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "C:\\S\\zlib-1.2.2\\epoc"; @@ -223,38 +244,42 @@ # now you can add $VariationSets only built on this PC below this line :) } - elsif ($ENV{'COMPUTERNAME'} eq "EMBEDDEV_VAIO1") ################################################################# + elsif ($ENV{'COMPUTERNAME'} eq "PC-FOREVER1111") ################################################################# { - $Producer = "AnotherGuest"; + $Producer = "Fedor"; $RedirectSTDERR = 1; $HaltOnError = 0; - $SkipExistingPackages = 1; - $ReallyQuiet = 1; + $SkipExistingPackages = 0; + $ReallyQuiet = 0; + $Compiler = "D:\\Program/ Files\\CodeSourcery\\Sourcery/ G++ Lite"; #$FTP_Host = "host.com"; #$FTP_User = "ag@host.com"; #$FTP_Pass = "password"; #$FTP_Dir = "cvsbuilds"; - #$SDK_RootDirs{'UIQ2'}= "D:\\UIQ2"; - $SDK_RootDirs{'UIQ3'}= "G:\\UIQ3"; - #$SDK_RootDirs{'S60v1'}= "D:\\S60v1"; - #$SDK_RootDirs{'S60v2'}= "D:\\S60v2"; - $SDK_RootDirs{'S60v3'}= "G:\\S60v3"; - #$SDK_RootDirs{'S80'}= "D:\\S80"; - #$SDK_RootDirs{'S90'}= "D:\\S90"; - #$ECompXL_BinDir= "D:\\ECompXL\\"; + #$SDK_RootDirs{'UIQ2'}= "C:\\UIQ2"; + #$SDK_RootDirs{'UIQ3'}= "C:\\UIQ3"; + #$SDK_RootDirs{'S60v1'}= "C:\\S60v1"; + #$SDK_RootDirs{'S60v2'}= "C:\\S60v2"; + #$SDK_RootDirs{'S80'}= "C:\\S80"; + #$SDK_RootDirs{'S90'}= "C:\\S90"; + #$ECompXL_BinDir= "C:\\ECompXL\\"; + + $SDK_RootDirs{'S60v3'}= "D:\\Symbian\\S60_5th_Edition_SDK_v1.0"; + $SDK_ToolchainDirs{'S60v3'} = "$Compiler\\arm-symbianelf\\bin"; + + # these supporting libraries get built first, then all the Variations + # Note: the string {'xxx.lib'} is used in checking in build success: so needs to be accurate! if (0) # so we can turn them on/off easily { # $SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "C:\\S\\zlib-1.2.2\\epoc"; -# $SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "C:\\S\\libmad-0.15.1b\\group"; -# $SDK_LibraryDirs{'ALL'}{'libtremor.lib'}= "C:\\tremor\\epoc"; - $SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ"; - $SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60"; - $SDK_LibraryDirs{'S80'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S80"; - $SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90"; - $SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3"; - $SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3"; + $SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "D:\\Symbian\\Projects\\SDL\\libs\\libmad-0.15.1b\\epoc"; +# $SDK_LibraryDirs{'ALL'}{'libtremor.lib'}= "D:\\Symbian\\Projects\\SDL\\libs\\Tremor\\epoc"; +# $SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = $SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\UIQ"; +# $SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S60"; +# $SDK_LibraryDirs{'S80'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S80"; +# $SDK_LibraryDirs{'S90'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S90"; } # now you can add $VariationSets only built on this PC below this line :) @@ -298,8 +323,8 @@ # the first one includes all SDKs & release-ready engines $VariationSets{'ALL'}{'all'} = "$DefaultFeatures @WorkingEngines @EnablableSubEngines"; -# $VariationSets{'ALL'}{'1St'} = "$DefaultFeatures @WorkingEngines_1st @EnablableSubEngines"; -# $VariationSets{'ALL'}{'2nd'} = "$DefaultFeatures @WorkingEngines_2nd @EnablableSubEngines"; + # $VariationSets{'ALL'}{'1St'} = "$DefaultFeatures @WorkingEngines_1st @EnablableSubEngines"; + # $VariationSets{'ALL'}{'2nd'} = "$DefaultFeatures @WorkingEngines_2nd @EnablableSubEngines"; # now one for each ready-for-release engine if (0) { diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README index 58cbc7814a..ad3edc2b00 100644 --- a/backends/platform/symbian/README +++ b/backends/platform/symbian/README @@ -24,6 +24,15 @@ About ScummVM Jurgen and Lars have successfully transfered all needed changes into CVS/SVN, with additional helpful tools for Symbian OS Release History: +Release version: 1.7.0 + * Nothing significant in the Symbian port, except SDL improvements (new SDL version used) + +Release version: 1.6.0 + * Nothing significant in the Symbian port, except SDL improvements (new SDL version used) + + Release version: 1.5.0 + * Nothing significant in the Symbian port, except SDL improvements (new SDL version used) + Release version: 1.4.0 * Nothing significant in the Symbian port, except SDL improvements (new SDL version used) * See main readme for general ScummVM improvements, major update diff --git a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg index 4c6b1b05f8..4a9768ad07 100644 --- a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg +++ b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg @@ -33,7 +33,7 @@ :"ScummVM" ; UID is the app's UID -#{"ScummVM S60v3"},(0xA0000657),1,60,0 +#{"ScummVM S60v3"},(0xA0000657),1,70,0 ;Supports Series 60 v 3.0 [0x101F7961], 0, 0, 0, {"Series60ProductID"} diff --git a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg index d3fd0450fa..66ca0267f2 100644 --- a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg +++ b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg @@ -36,7 +36,7 @@ :"ScummVM" ; UID is the app's UID -#{"ScummVM S60v3"},(0xA0000657),1,60,0 +#{"ScummVM S60v3"},(0xA0000657),1,70,0 ;Supports Series 60 v 3.0 [0x101F7961], 0, 0, 0, {"Series60ProductID"} diff --git a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg index c62d25dafa..b4f1cfdd5c 100644 --- a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg +++ b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3.pkg @@ -32,7 +32,7 @@ :"ScummVM" ; UID is the app's UID -#{"ScummVM UIQ3"},(0xA0000657),1,60,0 +#{"ScummVM UIQ3"},(0xA0000657),1,70,0 ; ProductID for UIQ 3.0 ; Product/platform version UID, Major, Minor, Build, Product ID diff --git a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3_split.pkg b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3_split.pkg index a37e0b0533..722e23a1b8 100644 --- a/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3_split.pkg +++ b/backends/platform/symbian/UIQ3/scummvm-CVS-SymbianUIQ3_split.pkg @@ -35,7 +35,7 @@ :"ScummVM" ; UID is the app's UID -#{"ScummVM UIQ3"},(0xA0000657),1,60,0 +#{"ScummVM UIQ3"},(0xA0000657),1,70,0 ; ProductID for UIQ 3.0 ; Product/platform version UID, Major, Minor, Build, Product ID diff --git a/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in new file mode 100644 index 0000000000..12f157f1e7 --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in @@ -0,0 +1,62 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2013 Strizniou Fedor + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_avalanche.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\avalanche + +//START_AUTO_OBJECTS_AVALANCHE_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_AVALANCHE_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in index d6dfafd014..cd7d3e7e98 100644 --- a/backends/platform/symbian/mmp/scummvm_base.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in @@ -50,15 +50,16 @@ ALWAYS_BUILD_AS_ARM USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio USERINCLUDE ..\..\..\..\backends\fs ..\src ..\..\..\..\backends\platform\sdl +USERINCLUDE \epoc32\include\mpeg2dec //\epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\FLAC SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version SYSTEMINCLUDE \epoc32\include\libc SYSTEMINCLUDE \epoc32\include\tremor SYSTEMINCLUDE \epoc32\include -SYSTEMINCLUDE \epoc32\include\mw -SYSTEMINCLUDE \epoc32\include\platform -SYSTEMINCLUDE \epoc32\include\platform\mw SYSTEMINCLUDE ..\src // for portdefs.h // *** SOURCE files @@ -115,6 +116,9 @@ SOURCEPATH ..\..\..\..\video //STOP_AUTO_OBJECTS_VIDEO_// // add a few files manually, since they are not parsed from modules.mk files +SOURCE bink_decoder.cpp +SOURCE codecs\mpeg.cpp + SOURCEPATH ..\..\..\.. SOURCE backends\events\default\default-events.cpp SOURCE backends\timer\default\default-timer.cpp diff --git a/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in new file mode 100644 index 0000000000..b6369b7d2b --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in @@ -0,0 +1,62 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2013 Strizniou Fedor + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_dreamweb.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\dreamweb + +//START_AUTO_OBJECTS_DREAMWEB_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_DREAMWEB_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in new file mode 100644 index 0000000000..4a8f69f709 --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in @@ -0,0 +1,62 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2013 Strizniou Fedor + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_fullpipe.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\fullpipe + +//START_AUTO_OBJECTS_FULLPIPE_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_FULLPIPE_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in index 5772bfaad0..124f7c0dc3 100644 --- a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in @@ -59,6 +59,13 @@ SOURCEPATH ..\..\..\..\engines\kyra //STOP_AUTO_OBJECTS_KYRA_ENABLE_LOL// + +//START_AUTO_OBJECTS_KYRA_ENABLE_EOB// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_KYRA_ENABLE_EOB// + // *** Include paths USERINCLUDE ..\..\..\..\engines diff --git a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in index 5f7bd4e144..3fe9af68f6 100644 --- a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in @@ -53,6 +53,25 @@ SOURCEPATH ..\..\..\..\engines\mohawk //STOP_AUTO_OBJECTS_MOHAWK_// + +//START_AUTO_OBJECTS_MOHAWK_ENABLE_MYST// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_MOHAWK_ENABLE_MYST// + +//START_AUTO_OBJECTS_MOHAWK_ENABLE_RIVEN// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_MOHAWK_ENABLE_RIVEN// + +//START_AUTO_OBJECTS_MOHAWK_ENABLE_CSTIME// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_MOHAWK_ENABLE_CSTIME// + // *** Include paths USERINCLUDE ..\..\..\..\engines diff --git a/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in new file mode 100644 index 0000000000..3969a3af9c --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in @@ -0,0 +1,62 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2013 Strizniou Fedor + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_mortevielle.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\mortevielle + +//START_AUTO_OBJECTS_MORTEVIELLE_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_MORTEVIELLE_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in new file mode 100644 index 0000000000..3a49093c43 --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in @@ -0,0 +1,61 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_neverhood.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\neverhood + +//START_AUTO_OBJECTS_NEVERHOOD_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_NEVERHOOD_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/mmp/scummvm_sci.mmp.in b/backends/platform/symbian/mmp/scummvm_sci.mmp.in index 5749c66e10..333a6d43c2 100644 --- a/backends/platform/symbian/mmp/scummvm_sci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sci.mmp.in @@ -53,6 +53,14 @@ SOURCEPATH ..\..\..\..\engines\sci //STOP_AUTO_OBJECTS_SCI_// + +//START_AUTO_OBJECTS_SCI_ENABLE_SCI32// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_SCI_ENABLE_SCI32// + + // *** Include paths USERINCLUDE ..\..\..\..\engines diff --git a/backends/platform/symbian/mmp/scummvm_sword25.mmp.in b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in new file mode 100644 index 0000000000..e14501e42d --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in @@ -0,0 +1,63 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2013 Strizniou Fedor + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_sword25.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\sword25 + +//START_AUTO_OBJECTS_SWORD25_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_SWORD25_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +USERINCLUDE ..\..\..\..\engines\sword25\util\lua ..\..\..\..\engines\sword25\util\pluto +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/mmp/scummvm_testbed.mmp.in b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in new file mode 100644 index 0000000000..ce6a18508d --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in @@ -0,0 +1,62 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2013 Strizniou Fedor + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_testbed.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\testbed + +//START_AUTO_OBJECTS_TESTBED_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_TESTBED_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/mmp/scummvm_zvision.mmp.in b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in new file mode 100644 index 0000000000..3687b10fec --- /dev/null +++ b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in @@ -0,0 +1,62 @@ +/* ScummVM - Graphic Adventure Engine + * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL + * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System + * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer + * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2013 Strizniou Fedor + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +// +// EPOC MMP makefile project for ScummVM +// + +// *** Definitions + +TARGET scummvm_zvision.lib +TARGETTYPE lib +OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp +OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +ALWAYS_BUILD_AS_ARM + +//START_AUTO_MACROS_SLAVE// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_MACROS_SLAVE// + +// *** SOURCE files + +SOURCEPATH ..\..\..\..\engines\zvision + +//START_AUTO_OBJECTS_ZVISION_// + + // empty base file, will be updated by Perl build scripts + +//STOP_AUTO_OBJECTS_ZVISION_// + +// *** Include paths + +USERINCLUDE ..\..\..\..\engines +USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index b1bd976f9e..ead85a933e 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -197,3 +197,8 @@ void* scumm_bsearch(const void *key, const void *base, size_t nmemb, size_t size return NULL; } + +int remove(const char *path) +{ + return unlink(path); +} diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h index 1f9128a54f..f69a90e009 100644 --- a/backends/platform/symbian/src/portdefs.h +++ b/backends/platform/symbian/src/portdefs.h @@ -60,6 +60,8 @@ typedef signed long int int32; #define SMALL_SCREEN_DEVICE #define DISABLE_COMMAND_LINE +#define USE_RGB_COLOR +int remove(const char *path); #if defined(USE_TREMOR) && !defined(USE_VORBIS) #define USE_VORBIS // make sure this one is defined together with USE_TREMOR! diff --git a/common/module.mk b/common/module.mk index 1b34d151d0..67c498df00 100644 --- a/common/module.mk +++ b/common/module.mk @@ -35,6 +35,7 @@ MODULE_OBJS := \ translation.o \ unarj.o \ unzip.o \ + ustr.o \ util.o \ winexe.o \ winexe_ne.o \ diff --git a/common/str.h b/common/str.h index 6b4475e1c4..ea2db1d1d6 100644 --- a/common/str.h +++ b/common/str.h @@ -234,6 +234,13 @@ public: static String vformat(const char *fmt, va_list args); public: + typedef char value_type; + /** + * Unsigned version of the underlying type. This can be used to cast + * individual string characters to bigger integer types without sign + * extension happening. + */ + typedef unsigned char unsigned_type; typedef char * iterator; typedef const char * const_iterator; diff --git a/common/ustr.cpp b/common/ustr.cpp new file mode 100644 index 0000000000..fbc831cb56 --- /dev/null +++ b/common/ustr.cpp @@ -0,0 +1,329 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public 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/ustr.h" +#include "common/memorypool.h" +#include "common/util.h" + +namespace Common { + +extern MemoryPool *g_refCountPool; + +static uint32 computeCapacity(uint32 len) { + // By default, for the capacity we use the next multiple of 32 + return ((len + 32 - 1) & ~0x1F); +} + +U32String::U32String(const value_type *str) : _size(0), _str(_storage) { + if (str == 0) { + _storage[0] = 0; + _size = 0; + } else { + uint32 len = 0; + const value_type *s = str; + while (*s++) { + ++len; + } + initWithCStr(str, len); + } +} + +U32String::U32String(const value_type *str, uint32 len) : _size(0), _str(_storage) { + initWithCStr(str, len); +} + +U32String::U32String(const value_type *beginP, const value_type *endP) : _size(0), _str(_storage) { + assert(endP >= beginP); + initWithCStr(beginP, endP - beginP); +} + +U32String::U32String(const U32String &str) + : _size(str._size) { + if (str.isStorageIntern()) { + // String in internal storage: just copy it + memcpy(_storage, str._storage, _builtinCapacity * sizeof(value_type)); + _str = _storage; + } else { + // String in external storage: use refcount mechanism + str.incRefCount(); + _extern._refCount = str._extern._refCount; + _extern._capacity = str._extern._capacity; + _str = str._str; + } + assert(_str != 0); +} + +U32String::~U32String() { + decRefCount(_extern._refCount); +} + +U32String &U32String::operator=(const U32String &str) { + if (&str == this) + return *this; + + if (str.isStorageIntern()) { + decRefCount(_extern._refCount); + _size = str._size; + _str = _storage; + memcpy(_str, str._str, (_size + 1) * sizeof(value_type)); + } else { + str.incRefCount(); + decRefCount(_extern._refCount); + + _extern._refCount = str._extern._refCount; + _extern._capacity = str._extern._capacity; + _size = str._size; + _str = str._str; + } + + return *this; +} + +U32String &U32String::operator+=(const U32String &str) { + if (&str == this) { + return operator+=(U32String(str)); + } + + int len = str._size; + if (len > 0) { + ensureCapacity(_size + len, true); + + memcpy(_str + _size, str._str, (len + 1) * sizeof(value_type)); + _size += len; + } + return *this; +} + +U32String &U32String::operator+=(value_type c) { + ensureCapacity(_size + 1, true); + + _str[_size++] = c; + _str[_size] = 0; + + return *this; +} + +bool U32String::equals(const U32String &x) const { + if (this == &x || _str == x._str) { + return true; + } + + if (x.size() != _size) { + return false; + } + + return !memcmp(_str, x._str, _size * sizeof(value_type)); +} + +bool U32String::contains(value_type x) const { + for (uint32 i = 0; i < _size; ++i) { + if (_str[i] == x) { + return true; + } + } + + return false; +} + +void U32String::deleteChar(uint32 p) { + assert(p < _size); + + makeUnique(); + while (p++ < _size) + _str[p - 1] = _str[p]; + _size--; +} + +void U32String::clear() { + decRefCount(_extern._refCount); + + _size = 0; + _str = _storage; + _storage[0] = 0; +} + +void U32String::toLowercase() { + makeUnique(); + for (uint32 i = 0; i < _size; ++i) { + if (_str[i] < 128) { + _str[i] = tolower(_str[i]); + } + } +} + +void U32String::toUppercase() { + makeUnique(); + for (uint32 i = 0; i < _size; ++i) { + if (_str[i] < 128) { + _str[i] = toupper(_str[i]); + } + } +} + +uint32 U32String::find(const U32String &str, uint32 pos) const { + if (pos >= _size) { + return npos; + } + + const value_type *strP = str.c_str(); + + for (const_iterator cur = begin() + pos; *cur; ++cur) { + uint i = 0; + while (true) { + if (!strP[i]) { + return cur - begin(); + } + + if (cur[i] != strP[i]) { + break; + } + + ++i; + } + } + + return npos; +} + +void U32String::makeUnique() { + ensureCapacity(_size, true); +} + +void U32String::ensureCapacity(uint32 new_size, bool keep_old) { + bool isShared; + uint32 curCapacity, newCapacity; + value_type *newStorage; + int *oldRefCount = _extern._refCount; + + if (isStorageIntern()) { + isShared = false; + curCapacity = _builtinCapacity; + } else { + isShared = (oldRefCount && *oldRefCount > 1); + curCapacity = _extern._capacity; + } + + // Special case: If there is enough space, and we do not share + // the storage, then there is nothing to do. + if (!isShared && new_size < curCapacity) + return; + + if (isShared && new_size < _builtinCapacity) { + // We share the storage, but there is enough internal storage: Use that. + newStorage = _storage; + newCapacity = _builtinCapacity; + } else { + // We need to allocate storage on the heap! + + // Compute a suitable new capacity limit + // If the current capacity is sufficient we use the same capacity + if (new_size < curCapacity) + newCapacity = curCapacity; + else + newCapacity = MAX(curCapacity * 2, computeCapacity(new_size+1)); + + // Allocate new storage + newStorage = new value_type[newCapacity]; + assert(newStorage); + } + + // Copy old data if needed, elsewise reset the new storage. + if (keep_old) { + assert(_size < newCapacity); + memcpy(newStorage, _str, (_size + 1) * sizeof(value_type)); + } else { + _size = 0; + newStorage[0] = 0; + } + + // Release hold on the old storage ... + decRefCount(oldRefCount); + + // ... in favor of the new storage + _str = newStorage; + + if (!isStorageIntern()) { + // Set the ref count & capacity if we use an external storage. + // It is important to do this *after* copying any old content, + // else we would override data that has not yet been copied! + _extern._refCount = 0; + _extern._capacity = newCapacity; + } +} + +void U32String::incRefCount() const { + assert(!isStorageIntern()); + if (_extern._refCount == 0) { + if (g_refCountPool == 0) { + g_refCountPool = new MemoryPool(sizeof(int)); + assert(g_refCountPool); + } + + _extern._refCount = (int *)g_refCountPool->allocChunk(); + *_extern._refCount = 2; + } else { + ++(*_extern._refCount); + } +} + +void U32String::decRefCount(int *oldRefCount) { + if (isStorageIntern()) + return; + + if (oldRefCount) { + --(*oldRefCount); + } + if (!oldRefCount || *oldRefCount <= 0) { + // The ref count reached zero, so we free the string storage + // and the ref count storage. + if (oldRefCount) { + assert(g_refCountPool); + g_refCountPool->freeChunk(oldRefCount); + } + delete[] _str; + + // Even though _str points to a freed memory block now, + // we do not change its value, because any code that calls + // decRefCount will have to do this afterwards anyway. + } +} + +void U32String::initWithCStr(const value_type *str, uint32 len) { + assert(str); + + _storage[0] = 0; + + _size = len; + + if (len >= _builtinCapacity) { + // Not enough internal storage, so allocate more + _extern._capacity = computeCapacity(len+1); + _extern._refCount = 0; + _str = new value_type[_extern._capacity]; + assert(_str != 0); + } + + // Copy the string into the storage area + memmove(_str, str, len * sizeof(value_type)); + _str[len] = 0; +} + +} // End of namespace Common diff --git a/common/ustr.h b/common/ustr.h new file mode 100644 index 0000000000..ab9dac70de --- /dev/null +++ b/common/ustr.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 COMMON_USTR_H +#define COMMON_USTR_H + +#include "common/scummsys.h" + +namespace Common { + +/** + * Very simple string class for UTF-32 strings in ScummVM. The main intention + * behind this class is to feature a simple way of displaying UTF-32 strings + * through the Graphics::Font API. + * + * Please note that operations like equals, deleteCharacter, toUppercase, etc. + * are only very simplified convenience operations. They might not fully work + * as you would expect for a proper UTF-32 string class. + * + * The presence of \0 characters in the string will cause undefined + * behavior in some operations. + */ +class U32String { +public: + static const uint32 npos = 0xFFFFFFFF; + + typedef uint32 value_type; + typedef uint32 unsigned_type; +private: + /** + * The size of the internal storage. Increasing this means less heap + * allocations are needed, at the cost of more stack memory usage, + * and of course lots of wasted memory. + */ + static const uint32 _builtinCapacity = 32; + + /** + * Length of the string. + */ + uint32 _size; + + /** + * Pointer to the actual string storage. Either points to _storage, + * or to a block allocated on the heap via malloc. + */ + value_type *_str; + + + union { + /** + * Internal string storage. + */ + value_type _storage[_builtinCapacity]; + /** + * External string storage data -- the refcounter, and the + * capacity of the string _str points to. + */ + struct { + mutable int *_refCount; + uint32 _capacity; + } _extern; + }; + + inline bool isStorageIntern() const { + return _str == _storage; + } + +public: + /** Construct a new empty string. */ + U32String() : _size(0), _str(_storage) { _storage[0] = 0; } + + /** Construct a new string from the given NULL-terminated C string. */ + explicit U32String(const value_type *str); + + /** Construct a new string containing exactly len characters read from address str. */ + U32String(const value_type *str, uint32 len); + + /** Construct a new string containing the characters between beginP (including) and endP (excluding). */ + U32String(const value_type *beginP, const value_type *endP); + + /** Construct a copy of the given string. */ + U32String(const U32String &str); + + ~U32String(); + + U32String &operator=(const U32String &str); + U32String &operator+=(const U32String &str); + U32String &operator+=(value_type c); + + /** + * Equivalence comparison operator. + * @see equals + */ + bool operator==(const U32String &x) const { return equals(x); } + + /** + * Compares whether two U32String are the same based on memory comparison. + * This does *not* do comparison based on canonical equivalence. + */ + bool equals(const U32String &x) const; + + bool contains(value_type x) const; + + inline const value_type *c_str() const { return _str; } + inline uint32 size() const { return _size; } + + inline bool empty() const { return (_size == 0); } + + value_type operator[](int idx) const { + assert(_str && idx >= 0 && idx < (int)_size); + return _str[idx]; + } + + /** + * Removes the value at position p from the string. + * Using this on decomposed characters will not remove the whole + * character! + */ + void deleteChar(uint32 p); + + /** Clears the string, making it empty. */ + void clear(); + + /** + * Convert all characters in the string to lowercase. + * + * Be aware that this only affects the case of ASCII characters. All + * other characters will not be touched at all. + */ + void toLowercase(); + + /** + * Convert all characters in the string to uppercase. + * + * Be aware that this only affects the case of ASCII characters. All + * other characters will not be touched at all. + */ + void toUppercase(); + + uint32 find(const U32String &str, uint32 pos = 0) const; + + typedef value_type * iterator; + typedef const value_type * const_iterator; + + iterator begin() { + // Since the user could potentially + // change the string via the returned + // iterator we have to assure we are + // pointing to a unique storage. + makeUnique(); + + return _str; + } + + iterator end() { + return begin() + size(); + } + + const_iterator begin() const { + return _str; + } + + const_iterator end() const { + return begin() + size(); + } +private: + void makeUnique(); + void ensureCapacity(uint32 new_size, bool keep_old); + void incRefCount() const; + void decRefCount(int *oldRefCount); + void initWithCStr(const value_type *str, uint32 len); +}; + +} // End of namespace Common + +#endif diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp index 6d4192da2a..5647fece7e 100644 --- a/engines/agos/icons.cpp +++ b/engines/agos/icons.cpp @@ -1089,15 +1089,15 @@ bool AGOSEngine_PN::ifObjectInInv(uint16 a) { } bool AGOSEngine_PN::testContainer(uint16 a) { - return bitextract(_quickptr[1] + a * _quickshort[1], 0) != 0; + return bitextract(_quickptr[1] + a * _quickshort[1], 0) != 0; } bool AGOSEngine_PN::testObvious(uint16 a) { - return bitextract(_quickptr[1] + a * _quickshort[1], 4) != 0; + return bitextract(_quickptr[1] + a * _quickshort[1], 4) != 0; } bool AGOSEngine_PN::testSeen(uint16 a) { - return bitextract(_quickptr[1] + a * _quickshort[1], 3) != 0; + return bitextract(_quickptr[1] + a * _quickshort[1], 3) != 0; } void AGOSEngine_PN::printIcon(HitArea *ha, uint8 i, uint8 r) { diff --git a/engines/draci/barchive.cpp b/engines/draci/barchive.cpp index 31dfe62dee..584367fdfb 100644 --- a/engines/draci/barchive.cpp +++ b/engines/draci/barchive.cpp @@ -203,12 +203,12 @@ void BArchive::openArchive(const Common::String &path) { uint32 fileOffset; fileOffset = reader.readUint32LE(); - _f.seek(fileOffset); // Seek to next file in archive + _f.seek(fileOffset); // Seek to next file in archive - _files[i]._compLength = _f.readUint16LE(); // Compressed size + _files[i]._compLength = _f.readUint16LE(); // Compressed size // should be the same as uncompressed - _files[i]._length = _f.readUint16LE(); // Original size + _files[i]._length = _f.readUint16LE(); // Original size _files[i]._offset = fileOffset; // Offset of file from start @@ -216,9 +216,9 @@ void BArchive::openArchive(const Common::String &path) { assert(compressionType == 0 && "Compression type flag is non-zero (file is compressed)"); - _files[i]._crc = _f.readByte(); // CRC checksum of the file - _files[i]._data = NULL; // File data will be read in on demand - _files[i]._stopper = 0; // Dummy value; not used in BAR files, needed in DFW + _files[i]._crc = _f.readByte(); // CRC checksum of the file + _files[i]._data = NULL; // File data will be read in on demand + _files[i]._stopper = 0; // Dummy value; not used in BAR files, needed in DFW } // Last footer item should be equal to footerOffset diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index a5c8aa867f..009f1bb3d2 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -1410,7 +1410,7 @@ void Game::enterNewRoom() { // for the dragon in the persons array if (_newRoom == _info._mapRoom) { _persons[kDragonObject]._x = 160; - _persons[kDragonObject]._y = 0; + _persons[kDragonObject]._y = 0; } // Set the appropriate loop status before loading the room diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 8ff60033ed..504476869e 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -41,65 +41,65 @@ namespace Draci { void Script::setupCommandList() { /** A table of all the commands the game player uses */ static const GPL2Command gplCommands[] = { - { 0, 0, "gplend", 0, { }, NULL }, - { 0, 1, "exit", 0, { }, NULL }, - { 1, 1, "goto", 1, { kGPL2Ident }, &Script::c_Goto }, - { 2, 1, "Let", 2, { kGPL2Ident, kGPL2Math }, &Script::c_Let }, - { 3, 1, "if", 2, { kGPL2Math, kGPL2Ident }, &Script::c_If }, - { 4, 1, "Start", 2, { kGPL2Ident, kGPL2Str }, &Script::start }, - { 5, 1, "Load", 2, { kGPL2Ident, kGPL2Str }, &Script::load }, - { 5, 2, "StartPlay", 2, { kGPL2Ident, kGPL2Str }, &Script::startPlay }, - { 5, 3, "JustTalk", 0, { }, &Script::justTalk }, - { 5, 4, "JustStay", 0, { }, &Script::justStay }, - { 6, 1, "Talk", 2, { kGPL2Ident, kGPL2Str }, &Script::talk }, - { 7, 1, "ObjStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStat }, - { 7, 2, "ObjStat_On", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStatOn }, - { 8, 1, "IcoStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::icoStat }, - { 9, 1, "Dialogue", 1, { kGPL2Str }, &Script::dialogue }, - { 9, 2, "ExitDialogue", 0, { }, &Script::exitDialogue }, - { 9, 3, "ResetDialogue", 0, { }, &Script::resetDialogue }, - { 9, 4, "ResetDialogueFrom", 0, { }, &Script::resetDialogueFrom }, - { 9, 5, "ResetBlock", 1, { kGPL2Ident }, &Script::resetBlock }, - { 10, 1, "WalkOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOn }, - { 10, 2, "StayOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::stayOn }, - { 10, 3, "WalkOnPlay", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOnPlay }, - { 11, 1, "LoadPalette", 1, { kGPL2Str }, &Script::loadPalette }, - { 12, 1, "SetPalette", 0, { }, &Script::setPalette }, - { 12, 2, "BlackPalette", 0, { }, &Script::blackPalette }, - { 13, 1, "FadePalette", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalette }, - { 13, 2, "FadePalettePlay", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalettePlay }, - { 14, 1, "NewRoom", 2, { kGPL2Ident, kGPL2Num }, &Script::newRoom }, - { 15, 1, "ExecInit", 1, { kGPL2Ident }, &Script::execInit }, - { 15, 2, "ExecLook", 1, { kGPL2Ident }, &Script::execLook }, - { 15, 3, "ExecUse", 1, { kGPL2Ident }, &Script::execUse }, - { 18, 1, "LoadMusic", 1, { kGPL2Str }, &Script::loadMusic }, - { 18, 2, "StartMusic", 0, { }, &Script::startMusic }, - { 18, 3, "StopMusic", 0, { }, &Script::stopMusic }, - { 19, 1, "Mark", 0, { }, &Script::mark }, - { 19, 2, "Release", 0, { }, &Script::release }, - { 20, 1, "Play", 0, { }, &Script::play }, - { 21, 1, "LoadMap", 1, { kGPL2Str }, &Script::loadMap }, - { 21, 2, "RoomMap", 0, { }, &Script::roomMap }, - { 22, 1, "DisableQuickHero", 0, { }, &Script::disableQuickHero }, - { 22, 2, "EnableQuickHero", 0, { }, &Script::enableQuickHero }, - { 23, 1, "DisableSpeedText", 0, { }, &Script::disableSpeedText }, - { 23, 2, "EnableSpeedText", 0, { }, &Script::enableSpeedText }, - { 24, 1, "QuitGame", 0, { }, &Script::quitGame }, - { 25, 1, "PushNewRoom", 0, { }, &Script::pushNewRoom }, - { 25, 2, "PopNewRoom", 0, { }, &Script::popNewRoom }, + { 0, 0, "gplend", 0, { }, NULL }, + { 0, 1, "exit", 0, { }, NULL }, + { 1, 1, "goto", 1, { kGPL2Ident }, &Script::c_Goto }, + { 2, 1, "Let", 2, { kGPL2Ident, kGPL2Math }, &Script::c_Let }, + { 3, 1, "if", 2, { kGPL2Math, kGPL2Ident }, &Script::c_If }, + { 4, 1, "Start", 2, { kGPL2Ident, kGPL2Str }, &Script::start }, + { 5, 1, "Load", 2, { kGPL2Ident, kGPL2Str }, &Script::load }, + { 5, 2, "StartPlay", 2, { kGPL2Ident, kGPL2Str }, &Script::startPlay }, + { 5, 3, "JustTalk", 0, { }, &Script::justTalk }, + { 5, 4, "JustStay", 0, { }, &Script::justStay }, + { 6, 1, "Talk", 2, { kGPL2Ident, kGPL2Str }, &Script::talk }, + { 7, 1, "ObjStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStat }, + { 7, 2, "ObjStat_On", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStatOn }, + { 8, 1, "IcoStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::icoStat }, + { 9, 1, "Dialogue", 1, { kGPL2Str }, &Script::dialogue }, + { 9, 2, "ExitDialogue", 0, { }, &Script::exitDialogue }, + { 9, 3, "ResetDialogue", 0, { }, &Script::resetDialogue }, + { 9, 4, "ResetDialogueFrom", 0, { }, &Script::resetDialogueFrom }, + { 9, 5, "ResetBlock", 1, { kGPL2Ident }, &Script::resetBlock }, + { 10, 1, "WalkOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOn }, + { 10, 2, "StayOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::stayOn }, + { 10, 3, "WalkOnPlay", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOnPlay }, + { 11, 1, "LoadPalette", 1, { kGPL2Str }, &Script::loadPalette }, + { 12, 1, "SetPalette", 0, { }, &Script::setPalette }, + { 12, 2, "BlackPalette", 0, { }, &Script::blackPalette }, + { 13, 1, "FadePalette", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalette }, + { 13, 2, "FadePalettePlay", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalettePlay }, + { 14, 1, "NewRoom", 2, { kGPL2Ident, kGPL2Num }, &Script::newRoom }, + { 15, 1, "ExecInit", 1, { kGPL2Ident }, &Script::execInit }, + { 15, 2, "ExecLook", 1, { kGPL2Ident }, &Script::execLook }, + { 15, 3, "ExecUse", 1, { kGPL2Ident }, &Script::execUse }, + { 18, 1, "LoadMusic", 1, { kGPL2Str }, &Script::loadMusic }, + { 18, 2, "StartMusic", 0, { }, &Script::startMusic }, + { 18, 3, "StopMusic", 0, { }, &Script::stopMusic }, + { 19, 1, "Mark", 0, { }, &Script::mark }, + { 19, 2, "Release", 0, { }, &Script::release }, + { 20, 1, "Play", 0, { }, &Script::play }, + { 21, 1, "LoadMap", 1, { kGPL2Str }, &Script::loadMap }, + { 21, 2, "RoomMap", 0, { }, &Script::roomMap }, + { 22, 1, "DisableQuickHero", 0, { }, &Script::disableQuickHero }, + { 22, 2, "EnableQuickHero", 0, { }, &Script::enableQuickHero }, + { 23, 1, "DisableSpeedText", 0, { }, &Script::disableSpeedText }, + { 23, 2, "EnableSpeedText", 0, { }, &Script::enableSpeedText }, + { 24, 1, "QuitGame", 0, { }, &Script::quitGame }, + { 25, 1, "PushNewRoom", 0, { }, &Script::pushNewRoom }, + { 25, 2, "PopNewRoom", 0, { }, &Script::popNewRoom }, // The following commands are not used in the original game files. - { 16, 1, "RepaintInventory", 0, { }, NULL }, - { 16, 2, "ExitInventory", 0, { }, NULL }, - { 17, 1, "ExitMap", 0, { }, NULL }, - { 18, 4, "FadeOutMusic", 1, { kGPL2Num }, NULL }, - { 18, 5, "FadeInMusic", 1, { kGPL2Num }, NULL }, + { 16, 1, "RepaintInventory", 0, { }, NULL }, + { 16, 2, "ExitInventory", 0, { }, NULL }, + { 17, 1, "ExitMap", 0, { }, NULL }, + { 18, 4, "FadeOutMusic", 1, { kGPL2Num }, NULL }, + { 18, 5, "FadeInMusic", 1, { kGPL2Num }, NULL }, // The following commands are not even defined in the game // sources, but their numbers are allocated for internal // purposes of the old player. - { 26, 1, "ShowCheat", 0, { }, NULL }, - { 26, 2, "HideCheat", 0, { }, NULL }, - { 26, 3, "ClearCheat", 1, { kGPL2Num }, NULL }, - { 27, 1, "FeedPassword", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, NULL } + { 26, 1, "ShowCheat", 0, { }, NULL }, + { 26, 2, "HideCheat", 0, { }, NULL }, + { 26, 3, "ClearCheat", 1, { kGPL2Num }, NULL }, + { 27, 1, "FeedPassword", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, NULL } }; /** Operators used by the mathematical evaluator */ diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp index c7b526d2c1..c27f1082f5 100644 --- a/engines/fullpipe/behavior.cpp +++ b/engines/fullpipe/behavior.cpp @@ -185,6 +185,19 @@ bool BehaviorManager::setBehaviorEnabled(StaticANIObject *obj, int aniId, int qu return true; } +void BehaviorManager::setFlagByStaticAniObject(StaticANIObject *ani, int flag) { + for (uint i = 0; i < _behaviors.size(); i++) { + BehaviorInfo *beh = _behaviors[i]; + + if (ani == beh->_ani) { + if (flag) + beh->_flags &= 0xfe; + else + beh->_flags |= 1; + } + } +} + void BehaviorInfo::clear() { _ani = 0; _staticsId = 0; diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h index 4fd1454351..1ac0b5bbfe 100644 --- a/engines/fullpipe/behavior.h +++ b/engines/fullpipe/behavior.h @@ -79,6 +79,8 @@ class BehaviorManager : public CObject { void updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *beh); bool setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag); + + void setFlagByStaticAniObject(StaticANIObject *ani, int flag); }; } // End of namespace Fullpipe diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 087a768156..2e15423055 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -25,7 +25,9 @@ namespace Fullpipe { +#define ANI_BIGBALL 4923 #define ANI_BOOT_1 4231 +#define ANI_BUTTON 598 #define ANI_CLOCK 588 #define ANI_DOMINO_3 2732 #define ANI_DADAYASHIK 306 @@ -109,6 +111,9 @@ namespace Fullpipe { #define MV_KZW_JUMP 558 #define MV_KZW_JUMPROTATE 561 #define MV_BDG_OPEN 1379 +#define MV_BTN_CLICK 599 +#define MV_CLK_GO 589 +#define MV_HND_POINT 602 #define MV_MAN_GOD 481 #define MV_MAN_GOLADDER 451 #define MV_MAN_GOLADDER2 2844 @@ -189,6 +194,7 @@ namespace Fullpipe { #define QU_PNK_CLICK 550 #define QU_SC3_ENTERLIFT 2779 #define QU_SC3_EXITLIFT 2808 +#define QU_SC4_MANFROMBOTTLE 2851 #define SC_1 301 #define SC_10 653 #define SC_11 654 @@ -276,6 +282,7 @@ namespace Fullpipe { #define ST_LBN_9P 2778 #define ST_MAN_EMPTY 476 #define ST_MAN_RIGHT 325 +#define ST_MAN_SIT 1164 #define TrubaDown 697 #define TrubaLeft 474 #define TrubaRight 696 diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index dbcff07003..dab2131e04 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -216,13 +216,34 @@ void sceneHandlers_sub01(ExCommand *ex) { warning("sceneHandlers_sub01()"); } +void sceneHandler04_checkBigBallClick() { + StaticANIObject *ball = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BIGBALL, -1); + + if (ball) + for (uint i = 0; i < ball->_movements.size(); i++) + ((Movement *)ball->_movements[i])->_counterMax = 73; + + g_vars->scene04_var13 = 1; +} + void sceneHandler04_clickBottle() { if (!g_vars->scene04_var02) g_vars->scene04_var20 += 5; } void sceneHandler04_clickButton() { - warning("sceneHandler04_clickButton()"); + StaticANIObject *but = g_fullpipe->_currentScene->getStaticANIObject1ById(ANI_BUTTON, -1); + + if (but) { + if (!g_vars->scene04_clock->_movement || + (g_vars->scene04_clock->_movement->_id == MV_CLK_GO && g_vars->scene04_clock->_movement->_currDynamicPhaseIndex > 3 && + g_vars->scene04_clock->_movement->_currDynamicPhaseIndex < 105)) { + if (!g_vars->scene04_hand->_movement && !g_vars->scene04_var02) { + but->startAnim(MV_BTN_CLICK, 0, -1); + g_vars->scene04_hand->startAnim(MV_HND_POINT, 0, -1); + } + } + } } void sceneHandler04_clickLadder() { @@ -289,7 +310,21 @@ void sceneHandler04_stopSound() { } void sceneHandler04_sub1(ExCommand *ex) { - warning("sceneHandler04_sub1()"); + g_fullpipe->_aniMan->changeStatics2(ST_MAN_SIT); + + MessageQueue *mq = new MessageQueue(g_fullpipe->_currentScene->getMessageQueueById(QU_SC4_MANFROMBOTTLE), 0, 0); + + if (ex) { + ExCommand *newex = new ExCommand(ex); + + mq->_exCommands.push_back(newex); + } + + mq->_flags |= 1; + mq->chain(0); + + g_vars->scene04_var10 = 0; + g_fullpipe->_behaviorManager->setFlagByStaticAniObject(g_fullpipe->_aniMan, 1); } void sceneHandler04_sub3() { diff --git a/engines/groovie/font.cpp b/engines/groovie/font.cpp index d29c22dd02..a55d8fad95 100644 --- a/engines/groovie/font.cpp +++ b/engines/groovie/font.cpp @@ -112,7 +112,7 @@ bool T7GFont::load(Common::SeekableReadStream &stream) { return true; } -void T7GFont::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const { +void T7GFont::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const { // We ignore the color, as the font is already colored const Glyph *glyph = getGlyph(chr); const byte *src = glyph->pixels; @@ -125,7 +125,7 @@ void T7GFont::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 co } } -const T7GFont::Glyph *T7GFont::getGlyph(byte chr) const { +const T7GFont::Glyph *T7GFont::getGlyph(uint32 chr) const { assert (chr < 128); byte numGlyph = _mapChar2Glyph[chr]; diff --git a/engines/groovie/font.h b/engines/groovie/font.h index 20aaa4cf23..49cf4b7b06 100644 --- a/engines/groovie/font.h +++ b/engines/groovie/font.h @@ -37,8 +37,8 @@ public: int getFontHeight() const { return _maxHeight; } int getMaxCharWidth() const { return _maxWidth; } - int getCharWidth(byte chr) const { return getGlyph(chr)->width; } - void drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const; + int getCharWidth(uint32 chr) const { return getGlyph(chr)->width; } + void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const; private: int _maxHeight, _maxWidth; @@ -55,7 +55,7 @@ private: byte _mapChar2Glyph[128]; Glyph *_glyphs; - const Glyph *getGlyph(byte chr) const; + const Glyph *getGlyph(uint32 chr) const; }; } // End of Groovie namespace diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index 5aa7c1be5a..f3b57e7464 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -818,9 +818,9 @@ public: /** * Synchronizes a string. * - * @param s The Common::Serializer to use. - * @param string The string. - * @param length Length of the 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; @@ -921,7 +921,7 @@ protected: /** * Play sound * - * @param savepoint The savepoint + * @param savepoint The savepoint * - Sound filename * @param resetItem true to reset item. * @param flag sound flag @@ -931,9 +931,9 @@ protected: /** * Draws the entity * - * @param savepoint The savepoint - * - Sequence - * - ExcuseMe flag + * @param savepoint The savepoint + * - Sequence + * - ExcuseMe flag * @param handleExcuseMe true to handle excuseMeCath action */ void draw(const SavePoint &savepoint, bool handleExcuseMe = false); @@ -941,7 +941,7 @@ protected: /** * Draws the entity along with another one * - * @param savepoint The savepoint. + * @param savepoint The savepoint. * - Sequence 1 * - Sequence 2 * - EntityIndex @@ -976,23 +976,23 @@ protected: /** * Process callback action when the entity direction is not kDirectionRight * - * @param savepoint The savepoint. + * @param savepoint The savepoint. */ void callbackActionOnDirection(const SavePoint &savepoint); /** * Process callback action when somebody is standing in the restaurant or salon. * - * @param savepoint The savepoint. + * @param savepoint The savepoint. */ void callbackActionRestaurantOrSalon(const SavePoint &savepoint); /** * Updates the entity * - * @param savepoint The savepoint. - * - CarIndex - * - EntityPosition + * @param savepoint The savepoint. + * - CarIndex + * - EntityPosition * @param handleExcuseMe true to handle the kActionExcuseMe/kActionExcuseMeCath actions. */ void updateEntity(const SavePoint &savepoint, bool handleExcuseMe = false); @@ -1000,11 +1000,11 @@ protected: /** * Call a specific savepoint (or draw sequence in default case) * - * @param savepoint The savepoint. - * - Sequence to draw in default case - * - EntityIndex - * - ActionIndex - * - Sequence for the savepoint + * @param savepoint The savepoint. + * - Sequence to draw in default case + * - EntityIndex + * - ActionIndex + * - Sequence for the savepoint * @param handleExcuseMe true to handle excuse me. */ void callSavepoint(const SavePoint &savepoint, bool handleExcuseMe = false); @@ -1012,36 +1012,36 @@ protected: /** * Handles entering/exiting a compartment. * - * @param savepoint The savepoint. - * @param position1 The first position. - * @param position2 The second position. - * @param car The car. - * @param compartment The compartment. - * @param alternate true to use the alternate version of SceneManager::loadSceneFromObject() + * @param savepoint The savepoint. + * @param position1 The first position. + * @param position2 The second position. + * @param car The car. + * @param compartment The compartment. + * @param alternate true to use the alternate version of SceneManager::loadSceneFromObject() */ 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. + * @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. + * @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); diff --git a/engines/lastexpress/entities/servers0.cpp b/engines/lastexpress/entities/servers0.cpp index 73e0d34722..6323ef0ca8 100644 --- a/engines/lastexpress/entities/servers0.cpp +++ b/engines/lastexpress/entities/servers0.cpp @@ -115,7 +115,7 @@ IMPLEMENT_FUNCTION_NOSETUP(5, Servers0, callbackActionOnDirection) case kActionExitCompartment: callbackAction(); - break; + break; case kActionExcuseMeCath: if (!params->param1) { @@ -445,7 +445,7 @@ IMPLEMENT_FUNCTION(24, Servers0, chapter2Handler) HANDLE_TABLE(1, 3, 1, setup_function25); HANDLE_TABLE(1, 4, 2, setup_function26); - break; + break; case kActionCallback: if (getCallback() == 1) diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp index d9ddb0a4d1..68c0813013 100644 --- a/engines/lastexpress/entities/verges.cpp +++ b/engines/lastexpress/entities/verges.cpp @@ -105,7 +105,7 @@ IMPLEMENT_FUNCTION(3, Verges, callbackActionOnDirection) case kActionExitCompartment: callbackAction(); - break; + break; case kActionExcuseMeCath: if (!params->param1) { diff --git a/engines/lastexpress/game/entities.h b/engines/lastexpress/game/entities.h index 81aed627aa..cacbc408c9 100644 --- a/engines/lastexpress/game/entities.h +++ b/engines/lastexpress/game/entities.h @@ -110,7 +110,7 @@ public: * Query if 'entity' is inside a compartment * * @param entity The entity. - * @param car The car. + * @param car The car. * @param position The position. * * @return true if inside the compartment, false if not. @@ -247,7 +247,7 @@ public: /** * Query if nobody is in a compartment at that position. * - * @param car The car. + * @param car The car. * @param position The position. * * @return true if nobody is in a compartment, false if not. @@ -334,8 +334,8 @@ private: static const int _compartmentsCount = 16; static const int _positionsCount = 100 * 10; // 100 positions per train car - LastExpressEngine *_engine; - EntityData *_header; + LastExpressEngine *_engine; + EntityData *_header; Common::Array<Entity *> _entities; // Compartments & positions diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp index 09104d1bf9..d24fb9b598 100644 --- a/engines/lastexpress/game/logic.cpp +++ b/engines/lastexpress/game/logic.cpp @@ -413,8 +413,8 @@ void Logic::resetState() { /** * Handle game over * - * @param type The savegame type. - * @param value The value (event, time, index, ...) + * @param type The savegame type. + * @param value The value (event, time, index, ...) * @param sceneIndex Index of the scene to show. * @param showScene true to show a scene, false to return to menu directly */ diff --git a/engines/lastexpress/game/logic.h b/engines/lastexpress/game/logic.h index efb8f1e1a3..b2d08cb06f 100644 --- a/engines/lastexpress/game/logic.h +++ b/engines/lastexpress/game/logic.h @@ -54,7 +54,7 @@ public: void playFinalSequence() const; void updateCursor(bool redraw = true) const; - Action *getGameAction() { return _action; } + Action *getGameAction() { return _action; } Beetle *getGameBeetle() { return _beetle; } Entities *getGameEntities() { return _entities; } Fight *getGameFight() { return _fight; } diff --git a/engines/lastexpress/game/object.cpp b/engines/lastexpress/game/object.cpp index 48df91ea6d..2fcdde12b9 100644 --- a/engines/lastexpress/game/object.cpp +++ b/engines/lastexpress/game/object.cpp @@ -69,11 +69,12 @@ void Objects::update(ObjectIndex index, EntityIndex entity, ObjectLocation locat getFlags()->flag_3 = true; // Compartments - if (original_location != location && (original_location == kObjectLocation2 || location == kObjectLocation2)) + if (original_location != location && (original_location == kObjectLocation2 || location == kObjectLocation2)) { if ((index >= kObjectCompartment1 && index <= kObjectCompartment8) - || (index >= kObjectCompartmentA && index <= kObjectCompartmentF)) { - getScenes()->updateDoorsAndClock(); + || (index >= kObjectCompartmentA && index <= kObjectCompartmentF)) { + getScenes()->updateDoorsAndClock(); } + } } void Objects::updateLocation2(ObjectIndex index, ObjectLocation location2) { diff --git a/engines/lastexpress/game/savegame.h b/engines/lastexpress/game/savegame.h index 361957227e..257c005e4a 100644 --- a/engines/lastexpress/game/savegame.h +++ b/engines/lastexpress/game/savegame.h @@ -167,7 +167,7 @@ public: bool isGameFinished(uint32 menuIndex, uint32 savegameIndex); // Accessors - uint32 getTime(uint32 index) { return getEntry(index)->time; } + uint32 getTime(uint32 index) { return getEntry(index)->time; } ChapterIndex getChapter(uint32 index) { return getEntry(index)->chapter; } uint32 getValue(uint32 index) { return getEntry(index)->value; } uint32 getLastSavegameTicks() const { return _gameTicksLastSavegame; } diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h index 944f6d47b1..83d528d346 100644 --- a/engines/lastexpress/game/state.h +++ b/engines/lastexpress/game/state.h @@ -657,12 +657,12 @@ private: // Timer int _timer; - Flags *_flags; ///< Flags - Inventory *_inventory; ///< Inventory - Objects *_objects; ///< Objects - SavePoints *_savepoints; ///< SavePoints - GameState *_state; ///< State - Common::Point _coords; ///< Current coordinates + Flags *_flags; ///< Flags + Inventory *_inventory; ///< Inventory + Objects *_objects; ///< Objects + SavePoints *_savepoints; ///< SavePoints + GameState *_state; ///< State + Common::Point _coords; ///< Current coordinates }; } // End of namespace LastExpress diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp index e8b755cb40..c2c866ff34 100644 --- a/engines/made/detection.cpp +++ b/engines/made/detection.cpp @@ -211,77 +211,77 @@ static const MadeGameDescription gameDescriptions[] = { 3, }, - { - // Return to Zork - Italian CD version 1.2 3/31/95 (installed) + { + // Return to Zork - Italian CD version 1.2 3/31/95 (installed) // Patch #2685032 submitted by goodoldgeorg - { - "rtz", - "V1.2, 3/31/95, installed, CD", - AD_ENTRY1s("rtzcd.dat", "5b86035aed0277f96e3d173542b5364a", 523776), - Common::IT_ITA, - Common::kPlatformDOS, + { + "rtz", + "V1.2, 3/31/95, installed, CD", + AD_ENTRY1s("rtzcd.dat", "5b86035aed0277f96e3d173542b5364a", 523776), + Common::IT_ITA, + Common::kPlatformDOS, ADGF_CD, GUIO0() - }, - GID_RTZ, - 0, - GF_CD, - 3, - }, + }, + GID_RTZ, + 0, + GF_CD, + 3, + }, { - // Return to Zork - Italian CD version 1.2 3/31/95 + // Return to Zork - Italian CD version 1.2 3/31/95 // Patch #2685032 submitted by goodoldgeorg - { - "rtz", - "V1.2, 3/31/95, CD", - AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 354971), - Common::IT_ITA, - Common::kPlatformDOS, + { + "rtz", + "V1.2, 3/31/95, CD", + AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 354971), + Common::IT_ITA, + Common::kPlatformDOS, ADGF_CD, GUIO0() - }, - GID_RTZ, - 0, - GF_CD_COMPRESSED, - 3, - }, - - { - // Return to Zork - French CD version 1.2 5/13/95 (installed) + }, + GID_RTZ, + 0, + GF_CD_COMPRESSED, + 3, + }, + + { + // Return to Zork - French CD version 1.2 5/13/95 (installed) // Patch #2685032 submitted by goodoldgeorg - { - "rtz", - "V1.2, 5/13/95, installed, CD", - AD_ENTRY1s("rtzcd.dat", "bde8251a8e34e87c54e3f93147d56c9e", 523776), - Common::FR_FRA, - Common::kPlatformDOS, + { + "rtz", + "V1.2, 5/13/95, installed, CD", + AD_ENTRY1s("rtzcd.dat", "bde8251a8e34e87c54e3f93147d56c9e", 523776), + Common::FR_FRA, + Common::kPlatformDOS, ADGF_CD, GUIO0() - }, - GID_RTZ, - 0, - GF_CD, - 3, - }, - - { - // Return to Zork - French CD version 1.2 5/13/95 + }, + GID_RTZ, + 0, + GF_CD, + 3, + }, + + { + // Return to Zork - French CD version 1.2 5/13/95 // Patch #2685032 submitted by goodoldgeorg - { - "rtz", - "V1.2, 3/31/95, CD", - AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 354614), - Common::FR_FRA, - Common::kPlatformDOS, + { + "rtz", + "V1.2, 3/31/95, CD", + AD_ENTRY1s("rtzcd.red", "946997d8b0aa6cb4e848bad02a1fc3d2", 354614), + Common::FR_FRA, + Common::kPlatformDOS, ADGF_CD, GUIO0() - }, - GID_RTZ, - 0, - GF_CD_COMPRESSED, - 3, - }, + }, + GID_RTZ, + 0, + GF_CD_COMPRESSED, + 3, + }, { // Return to Zork - English floppy version diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp index d069308a4b..b89b3af802 100644 --- a/engines/made/screenfx.cpp +++ b/engines/made/screenfx.cpp @@ -165,7 +165,7 @@ void ScreenEffects::flash(int flashCount, byte *palette, int colorCount) { _screen->setRGBPalette(_fxPalette, 0, colorCount); _screen->updateScreenAndWait(20); _screen->setRGBPalette(palette, 0, colorCount); - _screen->updateScreenAndWait(20); + _screen->updateScreenAndWait(20); } } diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp index f73c580560..176f8688bd 100644 --- a/engines/made/sound.cpp +++ b/engines/made/sound.cpp @@ -228,7 +228,7 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou break; default: - return; + return; } diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index efd0699d58..e5486bbcf5 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -196,7 +196,7 @@ bool NeverhoodMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || + (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || (f == kSavesSupportPlayTime); diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 50c7c503d3..699df2ae7d 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -216,7 +216,7 @@ void GameModule::initRadioPuzzle() { setGlobalVar(V_RADIO_ROOM_LEFT_DOOR, 1); setGlobalVar(V_RADIO_ROOM_RIGHT_DOOR, 0); setSubVar(VA_IS_PUZZLE_INIT, 0x08C80800, 1); - } + } } void GameModule::initTestTubes1Puzzle() { diff --git a/engines/parallaction/exec.h b/engines/parallaction/exec.h index b966d677cd..5968954ba0 100644 --- a/engines/parallaction/exec.h +++ b/engines/parallaction/exec.h @@ -62,7 +62,7 @@ struct ProgramContext { AnimationPtr _anim; ProgramPtr _program; InstructionPtr _inst; - uint32 _ip; + uint32 _ip; uint16 _modCounter; bool _suspend; }; diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp index ea3c394684..ae32a416e3 100644 --- a/engines/parallaction/gui_ns.cpp +++ b/engines/parallaction/gui_ns.cpp @@ -415,7 +415,7 @@ class SelectCharacterInputState_NS : public MenuInputState { #define CHAR_DONNA 1 #define CHAR_DOUGH 2 - Common::Rect _codeSelectBlocks[9]; + Common::Rect _codeSelectBlocks[9]; Common::Rect _codeTrueBlocks[9]; Parallaction_ns *_vm; diff --git a/engines/parallaction/input.h b/engines/parallaction/input.h index a815469ec3..a303eb96c8 100644 --- a/engines/parallaction/input.h +++ b/engines/parallaction/input.h @@ -114,7 +114,7 @@ public: void trackMouse(ZonePtr z); void waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1); uint32 getLastButtonEvent() { return _mouseButtons; } - bool getLastKeyDown(uint16 &ascii); + bool getLastKeyDown(uint16 &ascii); void stopHovering(); diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h index 81761b2c6b..89e8134431 100644 --- a/engines/parallaction/objects.h +++ b/engines/parallaction/objects.h @@ -147,7 +147,7 @@ typedef Common::List<CommandPtr> CommandList; struct Answer { Common::String _text; uint16 _mood; - Common::String _followingName; + Common::String _followingName; CommandList _commands; uint32 _noFlags; @@ -188,7 +188,7 @@ struct Dialogue { ~Dialogue(); }; -#define MAX_WALKPOINT_LISTS 20 +#define MAX_WALKPOINT_LISTS 20 #define FREE_HEAR_CHANNEL -1 #define MUSIC_HEAR_CHANNEL -2 @@ -452,7 +452,7 @@ struct Program { uint16 _numLocals; uint32 _ip; - uint32 _loopStart; + uint32 _loopStart; InstructionList _instructions; uint32 _status; diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 2dbb0227d6..203a0168ea 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -360,7 +360,7 @@ public: uint32 getLocationFlags(); bool checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y); bool checkZoneBox(ZonePtr z, uint32 type, uint x, uint y); - bool checkZoneType(ZonePtr z, uint32 type); + bool checkZoneType(ZonePtr z, uint32 type); bool checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y); ZonePtr hitZone(uint32 type, uint16 x, uint16 y); void runZone(ZonePtr z); @@ -579,7 +579,7 @@ private: void freeLocation(bool removeAll); void loadProgram(AnimationPtr a, const char *filename); void startGui(bool showSplash); - void startIngameMenu(); + void startIngameMenu(); void freeCharacter(); typedef void (Parallaction_br::*Callable)(void *); diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index e55df686e0..622e507aad 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -297,7 +297,7 @@ public: virtual void parseGetData(ZonePtr z); virtual void parseDoorData(ZonePtr z); virtual void parseHearData(ZonePtr z); - virtual void parseNoneData(ZonePtr z); + virtual void parseNoneData(ZonePtr z); protected: void parseAnswerCounter(Answer *answer); virtual Answer *parseAnswer(); diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h index e12e50e278..e8dde78ddc 100644 --- a/engines/parallaction/sound.h +++ b/engines/parallaction/sound.h @@ -103,7 +103,7 @@ protected: Audio::Mixer *_mixer; char _musicFile[PATH_LEN]; - bool _sfxLooping; + bool _sfxLooping; int _sfxVolume; int _sfxRate; uint _sfxChannel; @@ -156,7 +156,7 @@ class AmigaSoundMan_ns : public SoundMan_ns { Audio::AudioStream *_musicStream; Audio::SoundHandle _musicHandle; - uint32 beepSoundBufferSize; + uint32 beepSoundBufferSize; int8 *beepSoundBuffer; Channel _channels[NUM_SFX_CHANNELS]; @@ -188,7 +188,7 @@ protected: Common::String _musicFile; - bool _sfxLooping; + bool _sfxLooping; int _sfxVolume; int _sfxRate; uint _sfxChannel; diff --git a/engines/pegasus/timers.cpp b/engines/pegasus/timers.cpp index 8463d866e8..5fb2551e7a 100644 --- a/engines/pegasus/timers.cpp +++ b/engines/pegasus/timers.cpp @@ -333,6 +333,7 @@ void TimeBaseCallBack::releaseCallBack() { void TimeBaseCallBack::disposeCallBack() { _timeBase = 0; + _trigger = kTriggerNone; _hasBeenTriggered = false; } diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 01cab21f5d..645e1c30d0 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -138,7 +138,7 @@ enum GameFileTypes { enum GameFeatures { GF_ITE_FLOPPY = 1 << 0, #if 0 - GF_OLD_ITE_DOS = 1 << 1, // Currently unused + GF_OLD_ITE_DOS = 1 << 1, // Currently unused #endif GF_EXTRA_ITE_CREDITS = 1 << 2, GF_8BIT_UNSIGNED_PCM = 1 << 3 diff --git a/engines/sword25/gfx/image/art.cpp b/engines/sword25/gfx/image/art.cpp index 9c4b9fe8bd..e2eeaca33f 100644 --- a/engines/sword25/gfx/image/art.cpp +++ b/engines/sword25/gfx/image/art.cpp @@ -424,8 +424,7 @@ static void art_vpath_render_bez(ArtVpath **p_vpath, int *pn, int *pn_max, x_m, y_m, xb1, yb1, xb2, yb2, x3, y3, flatness); } else { // don't subdivide - art_vpath_add_point(p_vpath, pn, pn_max, - ART_LINETO, x3, y3); + art_vpath_add_point(p_vpath, pn, pn_max, ART_LINETO, x3, y3); } } diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp index 57c8ec318f..bc7dd02636 100644 --- a/engines/sword25/gfx/renderobjectmanager.cpp +++ b/engines/sword25/gfx/renderobjectmanager.cpp @@ -103,13 +103,16 @@ bool RenderObjectManager::render() { _uta->clear(); // Add rectangles of objects which don't exist in this frame any more - for (RenderObjectQueue::iterator it = _prevQueue->begin(); it != _prevQueue->end(); ++it) - if (!_currQueue->exists(*it)) - _uta->addRect((*it)._bbox); - // Add rectangles of objects which are different from the previous frame - for (RenderObjectQueue::iterator it = _currQueue->begin(); it != _currQueue->end(); ++it) - if (!_prevQueue->exists(*it)) - _uta->addRect((*it)._bbox); + for (RenderObjectQueue::iterator it = _prevQueue->begin(); it != _prevQueue->end(); ++it) { + if (!_currQueue->exists(*it)) + _uta->addRect((*it)._bbox); + } + + // Add rectangles of objects which are different from the previous frame + for (RenderObjectQueue::iterator it = _currQueue->begin(); it != _currQueue->end(); ++it) { + if (!_prevQueue->exists(*it)) + _uta->addRect((*it)._bbox); + } RectangleList *updateRects = _uta->getRectangles(); Common::Array<int> updateRectsMinZ; diff --git a/engines/sword25/util/lua/lopcodes.cpp b/engines/sword25/util/lua/lopcodes.cpp index 9d76862ae2..8b0a3ab330 100644 --- a/engines/sword25/util/lua/lopcodes.cpp +++ b/engines/sword25/util/lua/lopcodes.cpp @@ -61,7 +61,7 @@ const char *const luaP_opnames[NUM_OPCODES+1] = { const lu_byte luaP_opmodes[NUM_OPCODES] = { /* T A B C mode opcode */ - opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ diff --git a/engines/sword25/util/lua/lua.h b/engines/sword25/util/lua/lua.h index a3b7573ca5..4f557e462b 100644 --- a/engines/sword25/util/lua/lua.h +++ b/engines/sword25/util/lua/lua.h @@ -22,7 +22,7 @@ #define LUA_RELEASE "Lua 5.1.3" #define LUA_VERSION_NUM 501 #define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" -#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" /* mark for precompiled code (`<esc>Lua') */ diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index 3144ea7f94..bf7257f876 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -91,28 +91,29 @@ static const int enhancedAudioGRAVersion[] = { }; static const int enhancedAudioSCNVersion[] = { - 301, 302, 2, 1, 1, 301, 302, 3, 3, 4, // 1-10 - 4, 5, 6, 1, 7, 8, 9, 10, 8, 11, // 11-20 - 11, 12, 13, 13, 13, 13, 13, 14, 13, 13, // 21-30 - 15, 16, 17, 15, 18, 19, 20, 338, 21, 21, // 31-40 - 341, 342, 22, 22, 23, 24, 25, 26, 27, 28, // 41-50 - 29, 30, 31, 32, 33, 34, 35, 35, 36, 37, // 51-60 - 38, 39, 39, 39, 39, 40, 39, 41, 41, 42, // 61-70 - 43, 42, 44, 45, 41, 46, 48, 47, 48, 49, // 71-80 - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, // 81-90 - 60, 61, 62, 63, 61, 64, 65, 66, 67, 68, // 91-100 - 69, 70, 68, 71, 72, 73, 74, 75, 12, 76, // 101-110 - 77, 78, 79, 80, 4, 4, 82, 83, 77, 4, // 111-120 - 84, 85, 86, 3124, 88, 89, 90, 88, 2, 2, // 121-130 - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 131-140 - 3142, 91, 92, 93, 94, 94, 95, 96, 52, 4, // 141-150 - 97, 98, 99, 99 // 151-154 + 301, 302, 2, 1, 1, 301, 302, 3, 3, 4, // 1-10 + 4, 5, 6, 1, 7, 8, 9, 10, 8, 11, // 11-20 + 11, 12, 13, 13, 13, 13, 13, 14, 13, 13, // 21-30 + 15, 16, 17, 15, 18, 19, 20, 338, 21, 21, // 31-40 + 341, 342, 22, 22, 23, 24, 25, 26, 27, 28, // 41-50 + 29, 30, 31, 32, 33, 34, 35, 35, 36, 37, // 51-60 + 38, 39, 39, 39, 39, 40, 39, 41, 41, 42, // 61-70 + 43, 42, 44, 45, 41, 46, 48, 47, 48, 49, // 71-80 + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, // 81-90 + 60, 61, 62, 63, 61, 64, 65, 66, 67, 68, // 91-100 + 69, 70, 68, 71, 72, 73, 74, 75, 12, 76, // 101-110 + 77, 78, 79, 80, 4, 4, 82, 83, 77, 4, // 111-120 + 84, 85, 86, 3124, 88, 89, 90, 88, 2, 2, // 121-130 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 131-140 + 3142, 91, 92, 93, 94, 94, 95, 96, 52, 4, // 141-150 + 97, 98, 99, 99 // 151-154 }; int GetTrackNumber(SCNHANDLE hMidi) { - for (int i = 0; i < ARRAYSIZE(g_midiOffsets); i++) + for (int i = 0; i < ARRAYSIZE(g_midiOffsets); i++) { if (g_midiOffsets[i] == hMidi) return i; + } return -1; } diff --git a/engines/toltecs/render.cpp b/engines/toltecs/render.cpp index 4c41e6ce00..ae458d40a3 100644 --- a/engines/toltecs/render.cpp +++ b/engines/toltecs/render.cpp @@ -156,7 +156,7 @@ void RenderQueue::update() { byte *srcp = _vm->_screen->_backScreen + _vm->_cameraX + _vm->_cameraY * _vm->_sceneWidth; int16 w = MIN<int16>(640, _vm->_sceneWidth); int16 h = MIN<int16>(400, _vm->_cameraHeight); - while (h--) { + while (h--) { memcpy(destp, srcp, w); destp += 640; srcp += _vm->_sceneWidth; diff --git a/engines/toltecs/saveload.cpp b/engines/toltecs/saveload.cpp index 6c195a34c2..4edcc601b8 100644 --- a/engines/toltecs/saveload.cpp +++ b/engines/toltecs/saveload.cpp @@ -183,7 +183,7 @@ void ToltecsEngine::loadgame(const char *filename) { _mouseDisabled = in->readUint16LE(); _system->warpMouse(_mouseX, _mouseY); - _system->showMouse(_mouseDisabled == 0); + _system->showMouse(_mouseDisabled == 0); _palette->loadState(in); _script->loadState(in); diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index 1eb2f41fd2..dd418be71f 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -599,7 +599,7 @@ int16 Screen::drawString(int16 x, int16 y, byte color, uint fontResIndex, const if (ywobble) yadd = *ywobble; - while (len--) { + while (len--) { byte ch = *text++; if (ch <= 0x20) { x += font.getWidth(); @@ -634,7 +634,7 @@ void Screen::drawChar(const Font &font, byte *dest, int16 x, int16 y, byte ch, b byte flags = charData[0] & 0xF0; charData++; if ((flags & 0x80) == 0) { - if (flags & 0x10) { + if (flags & 0x10) { memset(dest, color, count); } else if (outline) { memset(dest, 0, count); diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 476c3a4fcf..83c4ef15fe 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -65,7 +65,7 @@ ScriptInterpreter::ScriptInterpreter(ToltecsEngine *vm) : _vm(vm) { _savedSp = 0; _slots[kMaxScriptSlots - 1].size = 1024; - _slots[kMaxScriptSlots - 1].data = new byte[_slots[kMaxScriptSlots - 1].size]; + _slots[kMaxScriptSlots - 1].data = new byte[_slots[kMaxScriptSlots - 1].size]; setupScriptFunctions(); @@ -184,11 +184,11 @@ void ScriptInterpreter::loadScript(uint resIndex, uint slotIndex) { delete[] _slots[slotIndex].data; - _slots[slotIndex].resIndex = resIndex; + _slots[slotIndex].resIndex = resIndex; Resource *scriptResource = _vm->_res->load(resIndex); _slots[slotIndex].size = scriptResource->size; - _slots[slotIndex].data = new byte[_slots[slotIndex].size]; - memcpy(_slots[slotIndex].data, scriptResource->data, _slots[slotIndex].size); + _slots[slotIndex].data = new byte[_slots[slotIndex].size]; + memcpy(_slots[slotIndex].data, scriptResource->data, _slots[slotIndex].size); } void ScriptInterpreter::setMainScript(uint slotIndex) { @@ -852,7 +852,7 @@ void ScriptInterpreter::sfFindMouseInRectIndex2() { } void ScriptInterpreter::sfDrawGuiImage() { - _vm->_screen->drawGuiImage(arg16(5), arg16(3), arg16(7)); + _vm->_screen->drawGuiImage(arg16(5), arg16(3), arg16(7)); } void ScriptInterpreter::sfAddAnimatedSpriteNoLoop() { diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index 188facd63c..8bd824cfee 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -235,7 +235,7 @@ void ToltecsEngine::loadScene(uint resIndex) { byte *source = scene + 392; byte *destp = _screen->_backScreen; byte *destEnd = destp + _sceneWidth * _sceneHeight; - while (destp < destEnd) { + while (destp < destEnd) { int count = 1; byte pixel = *source++; if (pixel & 0x80) { @@ -250,7 +250,7 @@ void ToltecsEngine::loadScene(uint resIndex) { debug(0, "_sceneWidth = %d; _sceneHeight = %d", _sceneWidth, _sceneHeight); // Load scene segmap - _segmap->load(scene + imageSize + 4); + _segmap->load(scene + imageSize + 4); _screen->_fullRefresh = true; _screen->_renderQueue->clear(); @@ -574,9 +574,9 @@ void ToltecsEngine::walk(byte *walkData) { if (ydelta > ABS(walkInfo.x1 - walkInfo.x2) * _walkSpeedX) { v10 = 100 - walkInfo.scaling; v11 = v8; - } else { + } else { v10 = v8; - v11 = 100 - walkInfo.scaling; + v11 = 100 - walkInfo.scaling; } walkInfo.yerror += walkInfo.mulValue * v10; diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 5674773177..be5fb4c7b7 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -648,8 +648,6 @@ void FocusObject::postInit(SceneObjectList *OwnerList) { _lookLineNum = 43; _talkLineNum = 44; _useLineNum = -1; - _v90 = 0; - _v92 = 1; SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; scene->_focusObject = this; @@ -658,8 +656,11 @@ void FocusObject::postInit(SceneObjectList *OwnerList) { void FocusObject::synchronize(Serializer &s) { NamedObject::synchronize(s); - s.syncAsSint16LE(_v90); - s.syncAsSint16LE(_v92); + if (s.getVersion() < 12) { + int useless = 0; + s.syncAsSint16LE(useless); + s.syncAsSint16LE(useless); + } } void FocusObject::remove() { @@ -705,7 +706,6 @@ SceneExt::SceneExt(): Scene() { _stripManager._onBegin = SceneExt::startStrip; _stripManager._onEnd = SceneExt::endStrip; - _field372 = _field37A = 0; _savedPlayerEnabled = false; _savedUiEnabled = false; _savedCanWalk = false; @@ -748,6 +748,7 @@ void SceneExt::process(Event &event) { void SceneExt::dispatch() { _timerList.dispatch(); + /* if (_field37A) { if ((--_field37A == 0) && BF_GLOBALS._dayNumber) { if (T2_GLOBALS._uiElements._active && BF_GLOBALS._player._enabled) { @@ -757,6 +758,7 @@ void SceneExt::dispatch() { _field37A = 0; } } + */ Scene::dispatch(); } @@ -764,8 +766,6 @@ void SceneExt::dispatch() { void SceneExt::loadScene(int sceneNum) { Scene::loadScene(sceneNum); - _v51C34.top = 0; - _v51C34.bottom = 300; BF_GLOBALS._sceneHandler->_delayTicks = 1; } @@ -833,7 +833,6 @@ void SceneExt::gunDisplay() { void SceneExt::startStrip() { SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - scene->_field372 = 1; scene->_savedPlayerEnabled = BF_GLOBALS._player._enabled; if (scene->_savedPlayerEnabled) { @@ -848,7 +847,6 @@ void SceneExt::startStrip() { void SceneExt::endStrip() { SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - scene->_field372 = 0; if (scene->_savedPlayerEnabled) { BF_GLOBALS._player.enableControl(); @@ -867,23 +865,23 @@ void SceneExt::clearScreen() { /*--------------------------------------------------------------------------*/ PalettedScene::PalettedScene(): SceneExt() { - _field794 = 0; + _hasFader = false; } void PalettedScene::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field794); + s.syncAsSint16LE(_hasFader); } void PalettedScene::postInit(SceneObjectList *OwnerList) { - _field794 = 0; + _hasFader = false; _palette._field412 = 1; SceneExt::postInit(OwnerList); } void PalettedScene::remove() { SceneExt::remove(); - if (_field794 == 1) { + if (_hasFader) { for (SynchronizedList<SceneObject *>::iterator i = BF_GLOBALS._sceneObjects->begin(); i != BF_GLOBALS._sceneObjects->end(); ++i) (*i)->remove(); @@ -897,7 +895,7 @@ void PalettedScene::remove() { } PaletteFader *PalettedScene::addFader(const byte *arrBufferRGB, int step, Action *action) { - _field794 = 1; + _hasFader = true; return BF_GLOBALS._scenePalette.addFader(arrBufferRGB, 1, step, action); } diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 59bc2b7a51..c6c6dc6315 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -139,14 +139,17 @@ public: class NamedObject2: public NamedObject { public: - int _v1, _v2; + int _talkCount; - NamedObject2() { _v1 = _v2 = 0; } + NamedObject2() { _talkCount = 0; } virtual Common::String getClassName() { return "NamedObject2"; } virtual void synchronize(Serializer &s) { NamedObject::synchronize(s); - s.syncAsSint16LE(_v1); - s.syncAsSint16LE(_v2); + if (s.getVersion() < 11) { + int useless = 0; + s.syncAsSint16LE(useless); + } + s.syncAsSint16LE(_talkCount); } }; @@ -177,7 +180,6 @@ public: class FocusObject: public NamedObject { public: - int _v90, _v92; GfxSurface _img; FocusObject(); @@ -196,16 +198,12 @@ private: static void endStrip(); public: AObjectArray _timerList, _objArray2; - int _field372; bool _savedPlayerEnabled; bool _savedUiEnabled; bool _savedCanWalk; - int _field37A; EventHandler *_focusObject; Visage _cursorVisage; - - Rect _v51C34; public: SceneExt(); @@ -228,7 +226,7 @@ public: class PalettedScene: public SceneExt { public: ScenePalette _palette; - int _field794; + bool _hasFader; public: PalettedScene(); diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp index 2bf4a82180..feaf789392 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.cpp +++ b/engines/tsage/blue_force/blueforce_scenes3.cpp @@ -1978,12 +1978,7 @@ void Scene340::Action8::signal() { setDelay(6); break; - case 4: - remove(); - break; default: - // This is present in the original game - warning("Bugs"); remove(); break; } @@ -2873,9 +2868,9 @@ void Scene350::checkGun() { void Scene355::Doorway::synchronize(Serializer &s) { NamedObject::synchronize(s); - s.syncAsSint16LE(_v1); - s.syncAsSint16LE(_v2); - s.syncAsSint16LE(_v3); + s.syncAsSint16LE(_mode1356Count); + s.syncAsSint16LE(_talkCount); + s.syncAsSint16LE(_onDuty); } bool Scene355::Doorway::startAction(CursorType action, Event &event) { @@ -2895,9 +2890,9 @@ bool Scene355::Doorway::startAction(CursorType action, Event &event) { return true; case CURSOR_TALK: if (BF_GLOBALS._dayNumber >= 5) { - switch (_v2) { + switch (_talkCount) { case 0: - ++_v2; + ++_talkCount; BF_GLOBALS._sound1.play(109); BF_GLOBALS._player.disableControl(); scene->_sceneMode = 0; @@ -2925,7 +2920,7 @@ bool Scene355::Doorway::startAction(CursorType action, Event &event) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 3562; scene->setAction(&scene->_sequenceManager, scene, 3562, &BF_GLOBALS._player, NULL); - _v3 = !_v3 ? 1 : 0; + _onDuty = !_onDuty; return true; default: break; @@ -3360,14 +3355,14 @@ bool Scene355::Item11::startAction(CursorType action, Event &event) { return true; case CURSOR_TALK: if (BF_GLOBALS._dayNumber == 5) { - switch (scene->_doorway._v2) { + switch (scene->_doorway._talkCount) { case 0: BF_GLOBALS._player.disableControl(); scene->_sceneMode = 0; BF_GLOBALS.setFlag(fTookTrailerAmmo); scene->_stripManager.start(3575, scene); scene->_lyle._flag = 1; - scene->_doorway._v2 = 1; + scene->_doorway._talkCount = 1; break; case 1: BF_GLOBALS._player.disableControl(); @@ -3539,28 +3534,28 @@ void Scene355::postInit(SceneObjectList *OwnerList) { _doorway.setVisage(355); _doorway.setPosition(Common::Point(193, 105)); _doorway.fixPriority(18); - _doorway._v1 = 0; - _doorway._v3 = 0; + _doorway._mode1356Count = 0; + _doorway._onDuty = false; BF_GLOBALS._sceneItems.push_back(&_doorway); switch (BF_GLOBALS._dayNumber) { case 1: if (!BF_GLOBALS.getFlag(onDuty)) - _doorway._v3 = 1; + _doorway._onDuty = true; else if (BF_INVENTORY.getObjectScene(INV_GREENS_GUN) == 320) - _doorway._v3 = 1; + _doorway._onDuty = true; break; case 2: case 3: case 4: - _doorway._v3 = 1; + _doorway._onDuty = true; break; default: break; } if (BF_GLOBALS._dayNumber == 5) - _doorway._v2 = BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 1 : 0; + _doorway._talkCount = BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 1 : 0; _object8.postInit(); _object8.setVisage(355); @@ -3619,8 +3614,8 @@ void Scene355::postInit(SceneObjectList *OwnerList) { _object11.animate(ANIM_MODE_2); _doorway.setPosition(Common::Point(146, 107)); - _doorway._v3 = 0; - _doorway._v2 = 2; + _doorway._onDuty = false; + _doorway._talkCount = 2; _lyle._flag = 2; _green.postInit(); @@ -3718,16 +3713,16 @@ void Scene355::signal() { _stripManager.start(BF_GLOBALS.getFlag(fBackupIn350) ? 3559 : 3554, this); break; case 1356: - switch (_doorway._v1) { + switch (_doorway._mode1356Count) { case 0: - ++_doorway._v1; + ++_doorway._mode1356Count; _sceneMode = 9999; _stripManager.start(3550, this); break; case 1: _sceneMode = 9999; _stripManager.start(3551, this); - ++_doorway._v1; + ++_doorway._mode1356Count; break; default: break; @@ -3792,7 +3787,7 @@ void Scene355::signal() { T2_GLOBALS._uiElements.addScore(10); } - SceneItem::display2(355, !_doorway._v3 ? 24 : 25); + SceneItem::display2(355, !_doorway._onDuty ? 24 : 25); BF_GLOBALS._player.enableControl(); break; case 4550: @@ -3801,8 +3796,8 @@ void Scene355::signal() { BF_GLOBALS._sound1.play(90); BF_GLOBALS._player._regionBitList |= 0x10; - _doorway._v3 = 0; - _doorway._v2 = 2; + _doorway._onDuty = false; + _doorway._talkCount = 2; _lyle._flag = 2; BF_GLOBALS._player.enableControl(); break; @@ -3872,13 +3867,13 @@ void Scene355::signal() { case 9984: if (BF_GLOBALS._dayNumber == 5) { _sceneMode = 0; - switch (_doorway._v2) { + switch (_doorway._talkCount) { case 0: BF_GLOBALS._sound1.play(109); BF_GLOBALS.setFlag(fTookTrailerAmmo); _stripManager.start(3575, this); _lyle._flag = 1; - ++_doorway._v2; + ++_doorway._talkCount; break; case 1: _stripManager.start(3573, this); @@ -3889,7 +3884,7 @@ void Scene355::signal() { break; } } else if (BF_GLOBALS.getFlag(greenTaken) || (BF_GLOBALS._dayNumber > 1)) { - if (_doorway._v3) { + if (_doorway._onDuty) { SceneItem::display2(355, 23); _sceneMode = 0; signal(); @@ -4014,14 +4009,14 @@ void Scene355::signal() { } case 9997: _sceneMode = 9999; - _doorway._v1 = 2; + _doorway._mode1356Count = 2; _stripManager.start(3562, this); break; case 9998: error("Talkdoor state"); break; case 9999: - if (_doorway._v1 != 2) { + if (_doorway._mode1356Count != 2) { BF_GLOBALS._player.enableControl(); BF_GLOBALS._player._canWalk = false; } else if (BF_GLOBALS.getFlag(gunDrawn)) { @@ -4656,10 +4651,10 @@ bool Scene370::Green::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_LOOK: - SceneItem::display2(370, (_v2 < 3) ? 10 : 0); + SceneItem::display2(370, (_talkCount < 3) ? 10 : 0); return true; case CURSOR_USE: - if (_v2 != 3) + if (_talkCount != 3) SceneItem::display2(370, 1); else if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1) SceneItem::display2(370, 26); @@ -4675,14 +4670,14 @@ bool Scene370::Green::startAction(CursorType action, Event &event) { return true; case CURSOR_TALK: BF_GLOBALS._player.disableControl(); - switch (_v2) { + switch (_talkCount) { case 0: - ++_v2; + ++_talkCount; scene->_sceneMode = 3706; scene->setAction(&scene->_sequenceManager, scene, 3706, NULL); break; case 1: - ++_v2; + ++_talkCount; scene->_sceneMode = 3707; scene->_object5.postInit(); @@ -4694,7 +4689,7 @@ bool Scene370::Green::startAction(CursorType action, Event &event) { scene->setAction(&scene->_sequenceManager, scene, 3707, &scene->_harrison, &scene->_object5, NULL); break; case 2: - ++_v2; + ++_talkCount; scene->_sceneMode = 3708; scene->setAction(&scene->_sequenceManager, scene, 3708, this, &scene->_laura, &scene->_harrison, &scene->_object5, &scene->_greensGun, NULL); @@ -4720,7 +4715,7 @@ bool Scene370::Green::startAction(CursorType action, Event &event) { } return true; case INV_HANDCUFFS: - if (_v2 != 3) + if (_talkCount != 3) SceneItem::display2(370, 2); else { T2_GLOBALS._uiElements.addScore(50); @@ -4757,7 +4752,7 @@ bool Scene370::Harrison::startAction(CursorType action, Event &event) { SceneItem::display2(370, 8); return true; case CURSOR_TALK: - if (scene->_green._v2 != 3) { + if (scene->_green._talkCount != 3) { scene->_sceneMode = 3; scene->_stripManager.start(3714, scene); } else if ((BF_INVENTORY.getObjectScene(INV_GREENS_KNIFE) == 1) || diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h index d9f0d32edc..894c3e5ffd 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.h +++ b/engines/tsage/blue_force/blueforce_scenes3.h @@ -493,9 +493,10 @@ class Scene355: public PalettedScene { /* Objects */ class Doorway: public NamedObject { public: - int _v1, _v2, _v3; + int _mode1356Count, _talkCount; + bool _onDuty; - Doorway() { _v1 = _v2 = _v3 = 0; } + Doorway() { _mode1356Count = _talkCount = 0; _onDuty = false; } virtual Common::String getClassName() { return "Scene355_Doorway"; } virtual void synchronize(Serializer &s); virtual bool startAction(CursorType action, Event &event); diff --git a/engines/tsage/blue_force/blueforce_scenes5.cpp b/engines/tsage/blue_force/blueforce_scenes5.cpp index ebaa3e372e..101a39c4b7 100644 --- a/engines/tsage/blue_force/blueforce_scenes5.cpp +++ b/engines/tsage/blue_force/blueforce_scenes5.cpp @@ -1909,7 +1909,7 @@ bool Scene570::Icon::startAction(CursorType action, Event &event) { } } -void Scene570::Icon::setDetails(int iconId, int folderId, int parentFolderId, int unused, const Common::String &msg) { +void Scene570::Icon::setDetails(int iconId, int folderId, int parentFolderId, const Common::String &msg) { Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene; NamedObject::postInit(); @@ -2076,23 +2076,23 @@ void Scene570::signal() { _printerIcon.setDetails(570, 14, 15, -1, 2, (SceneItem *)NULL); _iconManager.setup(2); - _folder1.setDetails(1, 1, 0, 2, SCENE570_C_DRIVE); - _folder2.setDetails(1, 2, 1, 2, SCENE570_RING); - _folder3.setDetails(1, 3, 1, 2, SCENE570_PROTO); - _folder4.setDetails(1, 4, 1, 2, SCENE570_WACKY); + _folder1.setDetails(1, 1, 0, SCENE570_C_DRIVE); + _folder2.setDetails(1, 2, 1, SCENE570_RING); + _folder3.setDetails(1, 3, 1, SCENE570_PROTO); + _folder4.setDetails(1, 4, 1, SCENE570_WACKY); if (!BF_GLOBALS.getFlag(fDecryptedBluePrints)) - _icon1.setDetails(3, 5, 0, 2, SCENE570_COBB); - _icon2.setDetails(2, 7, 0, 2, SCENE570_LETTER); + _icon1.setDetails(3, 5, 0, SCENE570_COBB); + _icon2.setDetails(2, 7, 0, SCENE570_LETTER); if (BF_GLOBALS.getFlag(fDecryptedBluePrints)) - _icon3.setDetails(7, 6, 0, 2, SCENE570_COBB); + _icon3.setDetails(7, 6, 0, SCENE570_COBB); - _icon4.setDetails(6, 8, 1, 2, SCENE570_RINGEXE); - _icon5.setDetails(5, 9, 1, 2, SCENE570_RINGDATA); - _icon6.setDetails(6, 10, 2, 2, SCENE570_PROTOEXE); - _icon7.setDetails(5, 11, 2, 2, SCENE570_PROTODATA); - _icon8.setDetails(6, 12, 3, 2, SCENE570_WACKYEXE); - _icon9.setDetails(5, 13, 3, 2, SCENE570_WACKYDATA); + _icon4.setDetails(6, 8, 1, SCENE570_RINGEXE); + _icon5.setDetails(5, 9, 1, SCENE570_RINGDATA); + _icon6.setDetails(6, 10, 2, SCENE570_PROTOEXE); + _icon7.setDetails(5, 11, 2, SCENE570_PROTODATA); + _icon8.setDetails(6, 12, 3, SCENE570_WACKYEXE); + _icon9.setDetails(5, 13, 3, SCENE570_WACKYDATA); _iconManager.refreshList(); BF_GLOBALS._player.enableControl(); @@ -2107,7 +2107,7 @@ void Scene570::signal() { _object3.setFrame(1); _object3.fixPriority(1); - _icon3.setDetails(7, 6, 0, 2, SCENE570_COBB); + _icon3.setDetails(7, 6, 0, SCENE570_COBB); _iconManager.refreshList(); T2_GLOBALS._uiElements._active = true; T2_GLOBALS._uiElements.show(); diff --git a/engines/tsage/blue_force/blueforce_scenes5.h b/engines/tsage/blue_force/blueforce_scenes5.h index 5337b6426b..71c7f3d8f1 100644 --- a/engines/tsage/blue_force/blueforce_scenes5.h +++ b/engines/tsage/blue_force/blueforce_scenes5.h @@ -266,7 +266,7 @@ class Scene570: public SceneExt { virtual void remove(); virtual bool startAction(CursorType action, Event &event); - void setDetails(int iconId, int folderId, int parentFolderId, int unused, const Common::String &msg); + void setDetails(int iconId, int folderId, int parentFolderId, const Common::String &msg); }; class IconManager: public EventHandler { public: diff --git a/engines/tsage/blue_force/blueforce_scenes7.cpp b/engines/tsage/blue_force/blueforce_scenes7.cpp index 4cdd2f3f15..2f52c4df95 100644 --- a/engines/tsage/blue_force/blueforce_scenes7.cpp +++ b/engines/tsage/blue_force/blueforce_scenes7.cpp @@ -148,7 +148,7 @@ void Scene710::postInit(SceneObjectList *OwnerList) { BF_GLOBALS._sound1.fadeSound(14); _soundExt1.fadeSound(48); - _v51C34.set(40, 0, 280, 240); + BF_GLOBALS._player.postInit(); BF_GLOBALS._player.hide(); BF_GLOBALS._player._moveDiff = Common::Point(4, 2); diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp index 867b6a9f6e..f78a332be9 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.cpp +++ b/engines/tsage/blue_force/blueforce_scenes8.cpp @@ -1958,7 +1958,7 @@ void Scene840::BoatKeysInset::postInit(SceneObjectList *OwnerList) { _waveKeys.setDetails(840, 53, 8, -1, 2, (SceneItem *)NULL); } - _v1B4 = _v1B6 = 0; + _usedRentalKeys = _usedWaveKeys = false; } void Scene840::BoatKeysInset::remove() { @@ -2067,7 +2067,7 @@ bool Scene840::BoatKeysInset::RentalKeys::startAction(CursorType action, Event & BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 1); T2_GLOBALS._uiElements.addScore(30); - scene->_boatKeysInset._v1B4 = 1; + scene->_boatKeysInset._usedRentalKeys = true; remove(); } return true; @@ -2085,7 +2085,7 @@ bool Scene840::BoatKeysInset::WaveKeys::startAction(CursorType action, Event &ev SceneItem::display2(840, 56); BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 1); T2_GLOBALS._uiElements.addScore(50); - scene->_boatKeysInset._v1B6 = 1; + scene->_boatKeysInset._usedWaveKeys = true; remove(); } else { SceneItem::display2(840, 9); @@ -2096,6 +2096,15 @@ bool Scene840::BoatKeysInset::WaveKeys::startAction(CursorType action, Event &ev } } +void Scene840::BoatKeysInset::synchronize(Serializer &s) { + FocusObject::synchronize(s); + + if (s.getVersion() >= 12) { + s.syncAsSint16LE(_usedWaveKeys); + s.syncAsSint16LE(_usedRentalKeys); + } +} + bool Scene840::BoatKeys::startAction(CursorType action, Event &event) { Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene; @@ -2467,10 +2476,10 @@ void Scene840::signal() { _boatKeysInset.setDetails(840, 50, 8, 51); break; case 8412: - if (_boatKeysInset._v1B6) { + if (_boatKeysInset._usedWaveKeys) { _sceneMode = 8409; setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_doors, NULL); - } else if (!_boatKeysInset._v1B4) { + } else if (!_boatKeysInset._usedRentalKeys) { BF_GLOBALS._player.enableControl(); } else { _sceneMode = 3; diff --git a/engines/tsage/blue_force/blueforce_scenes8.h b/engines/tsage/blue_force/blueforce_scenes8.h index ef5ef81563..b9e6ebd640 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.h +++ b/engines/tsage/blue_force/blueforce_scenes8.h @@ -348,8 +348,9 @@ class Scene840: public PalettedScene { public: RentalKeys _rentalKeys; WaveKeys _waveKeys; - int _v1B4, _v1B6; + bool _usedRentalKeys,_usedWaveKeys; + virtual void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); virtual void process(Event &event); diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 2298d28e0d..f7c1dd24e6 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -451,6 +451,13 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { draw(); g_globals->_events.showCursor(); + // WORKAROUND: On-screen dialogs are really meant to use a GfxManager instance + // for their lifetime, which prevents saving or loading. Since I don't want to spend a lot + // of time refactoring this already working dialog, fake it by putting a dummy gfxmanager at + // the end of the gfx manager list so as to prevent saving or loading + GfxManager gfxManager; + GLOBALS._gfxManagers.push_back(&gfxManager); + // Event handling loop Event event; while (!g_vm->shouldQuit()) { @@ -502,6 +509,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { // Remove the dialog remove(); + GLOBALS._gfxManagers.remove(&gfxManager); return _selectedIndex; } diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 320d3ddd2c..88f2c85ffd 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1153,6 +1153,13 @@ void PaletteRotation::signal() { if (flag) _currIndex = _start; } + + // Added in Return to Ringworld + if (_currIndex < _start) { + flag = decDuration(); + if (flag) + _currIndex = _end; + } break; case 2: _currIndex += _idxChange; @@ -1538,7 +1545,11 @@ void ScenePalette::synchronize(Serializer &s) { s.syncAsSint32LE(_colors.foreground); s.syncAsSint32LE(_colors.background); - s.syncAsSint32LE(_field412); + if (s.getVersion() < 12) { + int useless = 0; + s.syncAsSint16LE(useless); + } + s.syncAsByte(_redColor); s.syncAsByte(_greenColor); s.syncAsByte(_blueColor); @@ -2103,7 +2114,7 @@ SceneObject::SceneObject() : SceneHotspot() { _shade = _oldShade = 0; _linkedActor = NULL; - _field8A = Common::Point(0, 0); + _actorDestPos = Common::Point(0, 0); _angle = 0; _xs = 0; _xe = 0; @@ -2497,8 +2508,8 @@ void SceneObject::synchronize(Serializer &s) { s.syncAsSint16LE(_moveDiff.x); s.syncAsSint16LE(_moveDiff.y); s.syncAsSint32LE(_moveRate); if (g_vm->getGameID() == GType_Ringworld2) { - s.syncAsSint16LE(_field8A.x); - s.syncAsSint16LE(_field8A.y); + s.syncAsSint16LE(_actorDestPos.x); + s.syncAsSint16LE(_actorDestPos.y); } SYNC_POINTER(_endAction); s.syncAsUint32LE(_regionBitList); diff --git a/engines/tsage/core.h b/engines/tsage/core.h index f86172f6a1..3286ee1448 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -549,7 +549,7 @@ public: EventHandler *_mover; Common::Point _moveDiff; int _moveRate; - Common::Point _field8A; + Common::Point _actorDestPos; Action *_endAction; uint32 _regionBitList; diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 33ddb8bcec..fa3ed33302 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1245,8 +1245,9 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { } void GfxDialog::setPalette() { - if (g_vm->getGameID() == GType_BlueForce) { - g_globals->_scenePalette.loadPalette(2); + if (g_vm->getGameID() != GType_Ringworld) { + if (g_vm->getGameID() == GType_BlueForce) + g_globals->_scenePalette.loadPalette(2); g_globals->_scenePalette.setPalette(0, 1); g_globals->_scenePalette.setPalette(g_globals->_gfxColors.background, 1); g_globals->_scenePalette.setPalette(g_globals->_gfxColors.foreground, 1); diff --git a/engines/tsage/ringworld/ringworld_scenes1.h b/engines/tsage/ringworld/ringworld_scenes1.h index 5dd882af93..d52d4fb6ec 100644 --- a/engines/tsage/ringworld/ringworld_scenes1.h +++ b/engines/tsage/ringworld/ringworld_scenes1.h @@ -315,8 +315,6 @@ public: Action1 _action1; Action2 _action2; Action3 _action3; - // CHECKME: Object1 looks useless - Object1 _object1; LeftFlyCycle _leftFlyCycle; CenterFlyCycle _centerFlyCycle; RightFlyCycle _rightFlyCycle; @@ -324,10 +322,7 @@ public: SpeakerSText _speakerSText; SpeakerQText _speakerQText; DisplayHotspot _background; - - //CHECKME: Useless Hotspot, never initialized DisplayHotspot _item1; - //CHECKME: Useless Hotspot, never initialized DisplayHotspot _entrance; DisplayHotspot _bulwark; DisplayHotspot _tree; diff --git a/engines/tsage/ringworld/ringworld_scenes10.cpp b/engines/tsage/ringworld/ringworld_scenes10.cpp index f9a8e7996a..eac181e350 100644 --- a/engines/tsage/ringworld/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld/ringworld_scenes10.cpp @@ -1870,7 +1870,7 @@ void Scene9900::signal() { setAction(&_sequenceManager, this, 9908, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6); break; case 162: - warning("TBC: shutdown();"); + // shutdown(); g_globals->_game->quitGame(); break; case 9901: diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index 12147f7ee5..a0675bc292 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -50,6 +50,7 @@ RightClickDialog::RightClickDialog() : GfxDialog() { _btnList[5] = Common::Point(83, 47); // Set the palette and change the cursor + _previousCursor = R2_GLOBALS._events.getCursor(); R2_GLOBALS._events.setCursor(CURSOR_ARROW); setPalette(); @@ -136,7 +137,7 @@ bool RightClickDialog::process(Event &event) { return false; } -void RightClickDialog::execute() { +int RightClickDialog::execute() { // Draw the dialog draw(); @@ -157,7 +158,8 @@ void RightClickDialog::execute() { } // Execute the specified action - CursorType cursorNum = CURSOR_NONE; + CursorType cursorNum = _previousCursor; + int result = -1; switch (_selectedAction) { case 0: // Look action @@ -177,17 +179,18 @@ void RightClickDialog::execute() { break; case 4: // Change player - CharacterDialog::show(); + result = 0; break; case 5: // Options dialog + result = 1; break; } - if (cursorNum != CURSOR_NONE) - R2_GLOBALS._events.setCursor(cursorNum); - + R2_GLOBALS._events.setCursor(cursorNum); _gfxManager.deactivate(); + + return result; } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.h b/engines/tsage/ringworld2/ringworld2_dialogs.h index 02a1aed81c..0c19ae4371 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.h +++ b/engines/tsage/ringworld2/ringworld2_dialogs.h @@ -50,13 +50,14 @@ private: int _highlightedAction; int _selectedAction; + CursorType _previousCursor; public: RightClickDialog(); ~RightClickDialog(); virtual void draw(); virtual bool process(Event &event); - void execute(); + int execute(); }; class CharacterDialog: public GfxDialog { diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 67bd84a247..3f1cecc301 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -371,12 +371,13 @@ void SceneExt::postInit(SceneObjectList *OwnerList) { _field12 = 0; _sceneMode = 0; + static_cast<SceneHandlerExt *>(R2_GLOBALS._sceneHandler)->setupPaletteMaps(); + int prevScene = R2_GLOBALS._sceneManager._previousScene; int sceneNumber = R2_GLOBALS._sceneManager._sceneNumber; if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) || (sceneNumber == 50) || ((sceneNumber == 100) && (prevScene == 0 || prevScene == 180 || prevScene == 205))) { - static_cast<SceneHandlerExt *>(R2_GLOBALS._sceneHandler)->setupPaletteMaps(); R2_GLOBALS._uiElements._active = true; R2_GLOBALS._uiElements.show(); } else { @@ -400,19 +401,6 @@ void SceneExt::process(Event &event) { } void SceneExt::dispatch() { -/* - _timerList.dispatch(); - - if (_field37A) { - if ((--_field37A == 0) && R2_GLOBALS._dayNumber) { - if (R2_GLOBALS._uiElements._active && R2_GLOBALS._player._enabled) { - R2_GLOBALS._uiElements.show(); - } - - _field37A = 0; - } - } -*/ Scene::dispatch(); } @@ -1237,8 +1225,13 @@ void Ringworld2Game::processEvent(Event &event) { void Ringworld2Game::rightClick() { RightClickDialog *dlg = new RightClickDialog(); - dlg->execute(); + int option = dlg->execute(); delete dlg; + + if (option == 0) + CharacterDialog::show(); + else if (option == 1) + HelpDialog::show(); } /*--------------------------------------------------------------------------*/ @@ -1502,7 +1495,7 @@ MazeUI::MazeUI() { _cellSize.x = _cellSize.y = 0; _mapOffset.x = _mapOffset.y = 0; _resNum = _cellsResNum = 0; - _frameCount = _resCount = _mapImagePitch = _unused = 0; + _frameCount = _resCount = _mapImagePitch = 0; } MazeUI::~MazeUI() { @@ -1518,7 +1511,9 @@ void MazeUI::synchronize(Serializer &s) { s.syncAsSint16LE(_mapOffset.x); s.syncAsSint16LE(_mapOffset.y); - s.syncAsSint16LE(_unused); + + int dummy = 0; + s.syncAsSint16LE(dummy); } void MazeUI::load(int resNum) { @@ -1861,6 +1856,10 @@ bool AnimationPlayer::load(int animId, Action *endAction) { _frameDelay = (60 / _subData._frameRate); _gameFrame = R2_GLOBALS._events.getFrameNumber(); + // WORKAROUND: Slow down the title sequences to better match the original + if (animId <= 4 || animId == 15) + _frameDelay *= 8; + if (_subData._totalSize) { _dataNeeded = _subData._totalSize; } else { diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 41ddb277de..c9695c921d 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -307,7 +307,6 @@ public: int _frameCount; int _resCount; int _mapImagePitch; - int _unused; public: MazeUI(); virtual ~MazeUI(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index d0fe284cc6..ef4136a343 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -6435,7 +6435,7 @@ void Scene1337::subD02CA() { _item6._object1._mover = _arrunkObj1337[2]._arr1[di]._object1._mover; _item6._object1._moveDiff = _arrunkObj1337[2]._arr1[di]._object1._moveDiff; _item6._object1._moveRate = _arrunkObj1337[2]._arr1[di]._object1._moveRate; - _item6._object1._field8A = _arrunkObj1337[2]._arr1[di]._object1._field8A; + _item6._object1._actorDestPos = _arrunkObj1337[2]._arr1[di]._object1._actorDestPos; _item6._object1._endAction = _arrunkObj1337[2]._arr1[di]._object1._endAction; _item6._object1._regionBitList = _arrunkObj1337[2]._arr1[di]._object1._regionBitList; // _item6._object1._actorName = _arrunkObj1337[2]._arr1[di]._object1._actorName; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 167fb72956..732add03ec 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -2821,7 +2821,7 @@ void Scene3400::remove() { void Scene3400::signal() { switch (_sceneMode) { case 3305: { - // Removed (useless ?) call to sub_1D227 + // First part of discussion _tealSpeaker._object1.hide(); _teal.show(); _teal.setStrip(1); @@ -2833,6 +2833,7 @@ void Scene3400::signal() { } break; case 3306: + // Teal picks up the sapphire R2_GLOBALS._sound2.play(318); _companion1.setStrip(2); R2_GLOBALS._player.setStrip(6); @@ -2843,15 +2844,16 @@ void Scene3400::signal() { _stripManager.start(3307, this); if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _sceneMode = 3400; - R2_GLOBALS._player.setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_teal, &_actor8, NULL); + R2_GLOBALS._player.setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_teal, &_sapphire, NULL); } else { _sceneMode = 3408; - _companion1.setAction(&_sequenceManager, this, 3408, &_companion1, &_teal, &_actor8, NULL); + _companion1.setAction(&_sequenceManager, this, 3408, &_companion1, &_teal, &_sapphire, NULL); } break; case 3307: case 3404: case 3408: + // A tasp! if (!_soundFaded) { R2_GLOBALS._sound2.fadeOut2(NULL); _soundFaded = true; @@ -2861,7 +2863,7 @@ void Scene3400::signal() { } break; case 3308: - // Removed (useless ?) call to sub_1D227 + // Characters teleport one after the other _companion1.setStrip(2); R2_GLOBALS._player.setStrip(6); _companion2.setStrip(6); @@ -2874,7 +2876,7 @@ void Scene3400::signal() { setAction(&_sequenceManager, this, 3403, &_companion1, &_webbster, &_manholeCover, NULL); break; case 3309: - // Removed (useless ?) call to sub_1D227 + // Miranda teleports away _teal.setStrip(1); _sceneMode = 3405; if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) @@ -2883,7 +2885,7 @@ void Scene3400::signal() { setAction(&_sequenceManager, this, 3405, &_companion2, &_manholeCover, NULL); break; case 3310: - // Removed (useless ?) call to sub_1D227 + // Quinn teleports away _teal.setStrip(1); _sceneMode = 3406; if (R2_GLOBALS._player._characterIndex == R2_QUINN) @@ -2894,7 +2896,7 @@ void Scene3400::signal() { setAction(&_sequenceManager, this, 3406, &_companion2, &_manholeCover, NULL); break; case 3311: - // Removed (useless ?) call to sub_1D227 + // Teal teleports away _tealSpeaker._object1.hide(); _teal.show(); _teal.setStrip(1); @@ -2902,8 +2904,9 @@ void Scene3400::signal() { setAction(&_sequenceManager, this, 3407, &_teal, &_manholeCover, NULL); break; case 3400: { - _actor8.postInit(); - _actor8.hide(); + // Teal enters the room + _sapphire.postInit(); + _sapphire.hide(); _teal.postInit(); _teal._numFrames = 7; _teal._moveDiff = Common::Point(3, 2); @@ -2923,30 +2926,37 @@ void Scene3400::signal() { } break; case 3401: + // Teal first speech _sceneMode = 3305; _stripManager.start(3305, this); break; case 3402: + // Betrayal of Webbster _sceneMode = 3306; _stripManager.start(3306, this); break; case 3403: + // Teal: "Miranda..." R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; _sceneMode = 3309; _stripManager.start(3309, this); break; case 3405: + // Teal: "And Quinn..." _sceneMode = 3310; _stripManager.start(3310, this); break; case 3406: + // Teal final sentence before teleporting _sceneMode = 3311; _stripManager.start(3311, this); break; case 3407: + // End of scene R2_GLOBALS._sceneManager.changeScene(3600); break; default: + // Unexpected scene mode R2_GLOBALS._player.enableControl(); break; } @@ -4335,7 +4345,7 @@ void Scene3600::Action2::signal() { scene->_protector.setup(3127, 2, 1); scene->_protector.animate(ANIM_MODE_1, NULL); NpcMover *mover = new NpcMover(); - scene->_protector.addMover(mover, &scene->_protector._field8A, scene); + scene->_protector.addMover(mover, &scene->_protector._actorDestPos, scene); } break; default: @@ -4554,7 +4564,7 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { if (!R2_GLOBALS.getFlag(71)) { _protector.postInit(); _protector._state = 0; - _protector._field8A = Common::Point(226, 152); + _protector._actorDestPos = Common::Point(226, 152); _protector._moveDiff = Common::Point(3, 2); _protector.setPosition(Common::Point(284, 152)); _protector.setup(3127, 2, 1); @@ -4630,7 +4640,7 @@ void Scene3600::remove() { void Scene3600::signal() { switch (_sceneMode) { case 3320: - // Removed (useless ?) call to sub_1D227 + // Move to the console R2_GLOBALS._walkRegions.disableRegion(14); R2_GLOBALS._scrollFollower = &_seeker; _tealSpeaker._object1.hide(); @@ -4646,7 +4656,7 @@ void Scene3600::signal() { &_miranda, &_webbster, &_teal, NULL); break; case 3321: - // Removed (useless ?) call to sub_1D227 + // Teal activates console R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; _tealSpeaker.stopSpeaking(); _teal.show(); @@ -4657,7 +4667,7 @@ void Scene3600::signal() { &_quinn, &_seeker, &_miranda, &_webbster, NULL); break; case 3322: - // Removed (useless ?) call to sub_1D227 + // Teal walks toward the teleport pod, the goule protector appears _quinnSpeaker.stopSpeaking(); _quinnSpeaker._displayMode = 1; _tealSpeaker.stopSpeaking(); @@ -4667,10 +4677,11 @@ void Scene3600::signal() { setAction(&_sequenceManager1, this, _sceneMode, &_teal, &_protector, &_steppingDisk, NULL); break; case 3323: + // Goule protector eats Teal guts then moves + if (!_tealDead) _tealDead = true; else { - // Removed (useless ?) call to sub_1D227 _protectorSpeaker.stopSpeaking(); _protector.show(); _protector.setup(3258, 6, 1); @@ -4709,6 +4720,7 @@ void Scene3600::signal() { _sceneMode = 3623; break; case 3450: + // Speech of Teal and Quinn R2_GLOBALS._sound1.stop(); _protector3400.hide(); _door3400.hide(); @@ -4731,7 +4743,7 @@ void Scene3600::signal() { _protector.postInit(); _protector._state = 0; - _protector._field8A = Common::Point(226, 152); + _protector._actorDestPos = Common::Point(226, 152); _protector._moveDiff = Common::Point(5, 3); _protector.setup(3403, 7, 1); _protector.setPosition(Common::Point(405, 155)); @@ -4773,6 +4785,7 @@ void Scene3600::signal() { R2_GLOBALS._sound2.play(329); break; case 3600: + // First speech by Teal _sceneMode = 3320; _stripManager.start(3320, this); break; @@ -4781,6 +4794,7 @@ void Scene3600::signal() { case 3602: // No break on purpose case 3603: + // Teal speech near the console R2_GLOBALS._walkRegions.disableRegion(2); R2_GLOBALS._walkRegions.disableRegion(7); _tealSpeaker._displayMode = 1; @@ -4788,6 +4802,7 @@ void Scene3600::signal() { _stripManager.start(3321, this); break; case 3604: + // Goule Protector forces the door R2_GLOBALS._sound2.fadeOut2(NULL); R2_GLOBALS._sound1.stop(); R2_GLOBALS._walkRegions.enableRegion(2); @@ -4825,6 +4840,7 @@ void Scene3600::signal() { setAction(&_sequenceManager1, this, 3450, &_protector3400, &_door3400, NULL); break; case 3605: + // Goule protector jumps on Teal _protector.setup(3258, 4, 1); _protector.setAction(&_sequenceManager1, this, 3606, &_teal, &_protector, &_steppingDisk, NULL); @@ -4954,6 +4970,7 @@ void Scene3600::dispatch() { void Scene3700::postInit(SceneObjectList *OwnerList) { loadScene(3700); R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._uiElements._visible = false; SceneExt::postInit(); R2_GLOBALS._interfaceY = SCREEN_HEIGHT; @@ -5000,7 +5017,6 @@ void Scene3700::signal() { case 3328: // No break on purpose case 3329: - // Removed (useless ?) call to sub_1D227 _sceneMode = 3701; setAction(&_sequenceManager, this, 3701, &_seeker, &_miranda, &_webbster, NULL); break; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 9e93a61665..398d09a01e 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -550,7 +550,7 @@ public: SceneActor _teal; SceneActor _door; SceneActor _manholeCover; - SceneActor _actor8; + SceneActor _sapphire; SequenceManager _sequenceManager; bool _soundFaded; diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index 0d0457981f..32da6ee7f4 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -33,7 +33,7 @@ namespace TsAGE { typedef void (*SaveNotifierFn)(bool postFlag); -#define TSAGE_SAVEGAME_VERSION 11 +#define TSAGE_SAVEGAME_VERSION 12 class SavedObject; diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index e2fe21c6d7..6633d15c26 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2734,8 +2734,6 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() { _masterVolume = 0; _groupData._groupMask = 9; - _groupData._v1 = 0x46; - _groupData._v2 = 0; _groupData._pData = &adlib_group_data[0]; _mixer = g_vm->_mixer; @@ -3053,8 +3051,6 @@ SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() { _masterVolume = 0; _groupData._groupMask = 1; - _groupData._v1 = 0x3E; - _groupData._v2 = 0; static byte const group_data[] = { 3, 1, 1, 0, 0xff }; _groupData._pData = group_data; diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 3f039ff9e9..fefe8ad101 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -63,8 +63,6 @@ public: struct GroupData { uint32 _groupMask; - byte _v1; - byte _v2; const byte *_pData; }; diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index d6f09141c9..b879e789e3 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -121,7 +121,7 @@ int BaseFontTT::getTextWidth(const byte *text, int maxLength) { } if (maxLength >= 0 && textStr.size() > (uint32)maxLength) { - textStr = Common::String(textStr.c_str(), (uint32)maxLength); + textStr = WideString(textStr.c_str(), (uint32)maxLength); } //text = text.substr(0, MaxLength); // TODO: Remove @@ -155,19 +155,19 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign return; } - WideString textStr = (const char *)text; + WideString textStr; // 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);*/ // HACK: J.U.L.I.A. uses CP1252, we need to fix that, // And we still don't have any UTF8-support. - if (_gameRef->_textEncoding != TEXT_UTF8) { + if (_gameRef->_textEncoding == TEXT_UTF8) { + textStr = StringUtil::utf8ToWide((const char *)text); + } else { textStr = StringUtil::ansiToWide((const char *)text); } if (maxLength >= 0 && textStr.size() > (uint32)maxLength) { - textStr = Common::String(textStr.c_str(), (uint32)maxLength); + textStr = WideString(textStr.c_str(), (uint32)maxLength); } //text = text.substr(0, MaxLength); // TODO: Remove @@ -248,7 +248,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, //TextLineList lines; // TODO: Use WideString-conversion here. //WrapText(text, width, maxHeight, lines); - Common::Array<Common::String> lines; + Common::Array<WideString> lines; _font->wordWrapText(text, width, lines); while (maxHeight > 0 && lines.size() * _lineHeight > maxHeight) { @@ -267,7 +267,8 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, 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)); + // TODO: This debug call does not work with WideString because text.c_str() returns an uint32 array. + //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 @@ -276,7 +277,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, 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; + Common::Array<WideString>::iterator it; int heightOffset = 0; for (it = lines.begin(); it != lines.end(); ++it) { _font->drawString(surface, *it, 0, heightOffset, width, useColor, alignment); @@ -647,9 +648,9 @@ void BaseFontTT::measureText(const WideString &text, int maxWidth, int maxHeight //TextLineList lines; if (maxWidth >= 0) { - Common::Array<Common::String> lines; + Common::Array<WideString> lines; _font->wordWrapText(text, maxWidth, lines); - Common::Array<Common::String>::iterator it; + Common::Array<WideString>::iterator it; textWidth = 0; for (it = lines.begin(); it != lines.end(); ++it) { textWidth = MAX(textWidth, _font->getStringWidth(*it)); diff --git a/engines/wintermute/base/font/base_font_truetype.h b/engines/wintermute/base/font/base_font_truetype.h index 7a96cdf1b7..edb41a155f 100644 --- a/engines/wintermute/base/font/base_font_truetype.h +++ b/engines/wintermute/base/font/base_font_truetype.h @@ -56,9 +56,8 @@ private: bool _marked; uint32 _lastUsed; - BaseCachedTTFontText() { + BaseCachedTTFontText() : _text() { //_text = L""; - _text = ""; _width = _maxHeight = _maxLength = -1; _align = TAL_LEFT; _surface = nullptr; diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index b6d284442d..65bec03bc1 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.cpp +++ b/engines/wintermute/base/scriptables/script_ext_string.cpp @@ -298,21 +298,13 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack uint32 start = 0; for(uint32 i = 0; i < str.size() + 1; i++) { - char ch = str.c_str()[i]; - if(ch=='\0' || delims.contains(ch)) - { - char *part = new char[i - start + 1]; - if(i != start) { - Common::strlcpy(part, str.c_str() + start, i - start + 1); - part[i - start] = '\0'; + uint32 ch = str[i]; + if (ch =='\0' || delims.contains(ch)) { + if (i != start) { + parts.push_back(WideString(str.c_str() + start, i - start + 1)); } else { - part[0] = '\0'; + parts.push_back(WideString()); } - val = new ScValue(_gameRef, part); - array->push(val); - delete[] part; - delete val; - val = nullptr; start = i + 1; } } diff --git a/engines/wintermute/dctypes.h b/engines/wintermute/dctypes.h index b40322147f..4371ee4889 100644 --- a/engines/wintermute/dctypes.h +++ b/engines/wintermute/dctypes.h @@ -31,6 +31,7 @@ #include "common/str.h" +#include "common/ustr.h" #include "common/list.h" #include "common/array.h" @@ -41,7 +42,7 @@ namespace Wintermute { //typedef std::wstring WideString; typedef Common::String AnsiString; typedef Common::String Utf8String; -typedef Common::String WideString; // NB: Not actually true I presume. +typedef Common::U32String WideString; typedef Common::List<WideString> WideStringList; typedef Common::List<AnsiString> AnsiStringList; diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp index d5d6c7f702..702dd04c27 100644 --- a/engines/wintermute/utils/string_util.cpp +++ b/engines/wintermute/utils/string_util.cpp @@ -48,201 +48,96 @@ bool StringUtil::compareNoCase(const AnsiString &str1, const AnsiString &str2) { return (str1lc == str2lc); }*/ -Common::String StringUtil::substituteUtf8Characters(Common::String &str) { - uint strSize = str.size(); - Common::String punctuation("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"); - - if (isAscii(str)) - return str; - - for (uint32 i = 0; i < strSize; i++) { - if (!Common::isAlnum(str[i]) && str[i] != ' ' && !punctuation.contains(str[i])) { - // Replace some UTF-8 characters with (almost) equivalent ANSII ones - if ((byte)str[i] == 0xc2 && i + 1 < str.size() && (byte)str[i + 1] == 0xa9) { - // UTF-8 copyright character, substitute with 'c' - str.deleteChar(i); - str.setChar('c', i); - strSize--; - } - } - } - - return str; -} - -bool StringUtil::isAscii(const Common::String &str) { - Common::String punctuation("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"); - - for (uint32 i = 0; i < str.size(); i++) { - if (!Common::isAlnum(str[i]) && str[i] != ' ' && !punctuation.contains(str[i])) - return false; - } - - return true; -} - ////////////////////////////////////////////////////////////////////////// WideString StringUtil::utf8ToWide(const Utf8String &Utf8Str) { - // WORKAROUND: Since wide strings aren't supported yet, we make this function - // work at least with ASCII strings. This should cover all English versions. - Common::String asciiString = Utf8Str; - asciiString = substituteUtf8Characters(asciiString); - if (isAscii(asciiString)) { - // No special (UTF-8) characters found, just return the string - return asciiString; - } else { - warning("String contains special (UTF-8) characters: '%s'", Utf8Str.c_str()); - } - - error("StringUtil::Utf8ToWide - WideString not supported yet for UTF-8 characters"); - - /* 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; + size_t wideSize = Utf8Str.size(); - UTF16 *TargetStart = reinterpret_cast<UTF16 *>(WideStringNative); - UTF16 *TargetEnd = TargetStart + WideSize + 1; + uint32 *wideStringNative = new uint32[wideSize + 1]; - ConversionResult res = ConvertUTF8toUTF16(&SourceStart, SourceEnd, &TargetStart, TargetEnd, strictConversion); - if (res != conversionOK) { - delete[] WideStringNative; - return L""; - } - *TargetStart = 0; - WideString ResultString(WideStringNative); - delete[] WideStringNative; + const UTF8 *sourceStart = reinterpret_cast<const UTF8 *>(Utf8Str.c_str()); + const UTF8 *sourceEnd = sourceStart + wideSize; - return ResultString; - } else if (sizeof(wchar_t) == 4) { - wchar_t *WideStringNative = new wchar_t[WideSize + 1]; + UTF32 *targetStart = reinterpret_cast<UTF32 *>(wideStringNative); + UTF32 *targetEnd = targetStart + wideSize; - 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 ""; + ConversionResult res = ConvertUTF8toUTF32(&sourceStart, sourceEnd, &targetStart, targetEnd, strictConversion); + if (res != conversionOK) { + delete[] wideStringNative; + return WideString(); + } + *targetStart = 0; + WideString resultString(wideStringNative); + delete[] wideStringNative; + return resultString; } ////////////////////////////////////////////////////////////////////////// Utf8String StringUtil::wideToUtf8(const WideString &WideStr) { - // WORKAROUND: Since UTF-8 strings aren't supported yet, we make this function - // work at least with ASCII strings. This should cover all English versions. - Common::String asciiString = WideStr; - asciiString = substituteUtf8Characters(asciiString); - if (isAscii(asciiString)) { - // No special (UTF-8) characters found, just return the string - return asciiString; - } else { - warning("String contains special (UTF-8) characters: '%s'", WideStr.c_str()); - } + size_t wideSize = WideStr.size(); - error("StringUtil::wideToUtf8 - WideString not supported yet for UTF-8 characters"); - - /* size_t WideSize = WideStr.length(); + size_t utf8Size = 4 * wideSize + 1; + char *utf8StringNative = new char[utf8Size]; - if (sizeof(wchar_t) == 2) { - size_t utf8Size = 3 * WideSize + 1; - char *utf8StringNative = new char[Utf8Size]; + const UTF32 *sourceStart = reinterpret_cast<const UTF32 *>(WideStr.c_str()); + const UTF32 *sourceEnd = sourceStart + wideSize; - 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; - 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 ""; + ConversionResult res = ConvertUTF32toUTF8(&sourceStart, sourceEnd, &targetStart, targetEnd, strictConversion); + if (res != conversionOK) { + delete[] utf8StringNative; + return Utf8String(); + } + *targetStart = 0; + Utf8String resultString(utf8StringNative); + delete[] utf8StringNative; + return resultString; } ////////////////////////////////////////////////////////////////////////// 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()) { - byte c = str[index]; - if (c == 146) { - converted += (char)39; // Replace right-quote with apostrophe - } else if (c == 133) { - converted += Common::String("..."); // Replace ...-symbol with ... + WideString result; + for (AnsiString::const_iterator i = str.begin(), end = str.end(); i != end; ++i) { + const byte c = *i; + if (c < 0x80 || c >= 0xA0) { + result += c; } else { - converted += c; + uint32 utf32 = _ansiToUTF32[c - 0x80]; + if (utf32) { + result += utf32; + } else { + // It's an invalid CP1252 character... + } } - 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(converted); + return result; } ////////////////////////////////////////////////////////////////////////// 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); + AnsiString result; + for (WideString::const_iterator i = wstr.begin(), end = wstr.end(); i != end; ++i) { + const uint32 c = *i; + if (c < 0x80 || (c >= 0xA0 && c <= 0xFF)) { + result += c; + } else { + uint32 ansi = 0xFFFFFFFF; + for (uint j = 0; j < ARRAYSIZE(_ansiToUTF32); ++j) { + if (_ansiToUTF32[j] == c) { + ansi = j + 0x80; + break; + } + } + + if (ansi != 0xFFFFFFFF) { + result += ansi; + } else { + // There's no valid CP1252 code for this character... + } + } + } + return result; } ////////////////////////////////////////////////////////////////////////// @@ -256,12 +151,7 @@ bool StringUtil::isUtf8BOM(const byte *buffer, uint32 bufferSize) { ////////////////////////////////////////////////////////////////////////// int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t startFrom) { - const char *index = strstr(str.c_str(), toFind.c_str()); - if (index == nullptr) { - return -1; - } else { - return index - str.c_str(); - } + return str.find(toFind, startFrom); } Common::String StringUtil::encodeSetting(const Common::String &str) { @@ -282,5 +172,10 @@ AnsiString StringUtil::toString(int val) { return Common::String::format("%d", val); } +// Mapping of CP1252 characters 0x80...0x9F into UTF-32 +uint32 StringUtil::_ansiToUTF32[32] = { + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178 +}; } // End of namespace Wintermute diff --git a/engines/wintermute/utils/string_util.h b/engines/wintermute/utils/string_util.h index 05931beb79..14c40fcb2b 100644 --- a/engines/wintermute/utils/string_util.h +++ b/engines/wintermute/utils/string_util.h @@ -37,8 +37,6 @@ class StringUtil { public: static bool compareNoCase(const AnsiString &str1, const AnsiString &str2); //static bool compareNoCase(const WideString &str1, const WideString &str2); - static bool isAscii(const Common::String &str); - static Common::String substituteUtf8Characters(Common::String &str); static WideString utf8ToWide(const Utf8String &Utf8Str); static Utf8String wideToUtf8(const WideString &WideStr); static WideString ansiToWide(const AnsiString &str); @@ -51,6 +49,9 @@ public: static Common::String decodeSetting(const Common::String &str); static AnsiString toString(int val); + +private: + static uint32 _ansiToUTF32[32]; }; } // End of namespace Wintermute diff --git a/graphics/font.cpp b/graphics/font.cpp index a852274b06..e9f139c478 100644 --- a/graphics/font.cpp +++ b/graphics/font.cpp @@ -26,93 +26,32 @@ namespace Graphics { -int Font::getKerningOffset(byte left, byte right) const { +int Font::getKerningOffset(uint32 left, uint32 right) const { return 0; } -int Font::getStringWidth(const Common::String &str) const { +namespace { + +template<class StringType> +int getStringWidthImpl(const Font &font, const StringType &str) { int space = 0; - uint last = 0; + typename StringType::unsigned_type last = 0; for (uint i = 0; i < str.size(); ++i) { - const uint cur = str[i]; - space += getCharWidth(cur) + getKerningOffset(last, cur); + const typename StringType::unsigned_type cur = str[i]; + space += font.getCharWidth(cur) + font.getKerningOffset(last, cur); last = cur; } return space; } -void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, int w, uint32 color, TextAlign align, int deltax, bool useEllipsis) const { +template<class StringType> +void drawStringImpl(const Font &font, Surface *dst, const StringType &str, int x, int y, int w, uint32 color, TextAlign align, int deltax) { assert(dst != 0); - const int leftX = x, rightX = x + w; - uint i; - Common::String s = sOld; - int width = getStringWidth(s); - Common::String str; - - if (useEllipsis && width > w && s.hasSuffix("...")) { - // String is too wide. Check whether it ends in an ellipsis - // ("..."). If so, remove that and try again! - s.deleteLastChar(); - s.deleteLastChar(); - s.deleteLastChar(); - width = getStringWidth(s); - } - - if (useEllipsis && width > w) { - // String is too wide. So we shorten it "intelligently" by - // replacing parts of the string by an ellipsis. There are - // three possibilities for this: replace the start, the end, or - // the middle of the string. What is best really depends on the - // context; but unless we want to make this configurable, - // replacing the middle seems to be a good compromise. - - const int ellipsisWidth = getStringWidth("..."); - - // SLOW algorithm to remove enough of the middle. But it is good enough - // for now. - const int halfWidth = (w - ellipsisWidth) / 2; - int w2 = 0; - uint last = 0; - - for (i = 0; i < s.size(); ++i) { - const uint cur = s[i]; - int charWidth = getCharWidth(cur) + getKerningOffset(last, cur); - if (w2 + charWidth > halfWidth) - break; - last = cur; - w2 += charWidth; - str += cur; - } - - // At this point we know that the first 'i' chars are together 'w2' - // pixels wide. We took the first i-1, and add "..." to them. - str += "..."; - last = '.'; - // The original string is width wide. Of those we already skipped past - // w2 pixels, which means (width - w2) remain. - // The new str is (w2+ellipsisWidth) wide, so we can accommodate about - // (w - (w2+ellipsisWidth)) more pixels. - // Thus we skip ((width - w2) - (w - (w2+ellipsisWidth))) = - // (width + ellipsisWidth - w) - int skip = width + ellipsisWidth - w; - for (; i < s.size() && skip > 0; ++i) { - const uint cur = s[i]; - skip -= getCharWidth(cur) + getKerningOffset(last, cur); - last = cur; - } - - // Append the remaining chars, if any - for (; i < s.size(); ++i) { - str += s[i]; - } - - width = getStringWidth(str); - } else { - str = s; - } + const int leftX = x, rightX = x + w; + int width = font.getStringWidth(str); if (align == kTextAlignCenter) x = x + (w - width)/2; @@ -120,29 +59,29 @@ void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, in x = x + w - width; x += deltax; - uint last = 0; - for (i = 0; i < str.size(); ++i) { - const uint cur = str[i]; - x += getKerningOffset(last, cur); + typename StringType::unsigned_type last = 0; + for (typename StringType::const_iterator i = str.begin(), end = str.end(); i != end; ++i) { + const typename StringType::unsigned_type cur = *i; + x += font.getKerningOffset(last, cur); last = cur; - w = getCharWidth(cur); + w = font.getCharWidth(cur); if (x+w > rightX) break; if (x+w >= leftX) - drawChar(dst, str[i], x, y, color); + font.drawChar(dst, cur, x, y, color); x += w; } } - +template<class StringType> struct WordWrapper { - Common::Array<Common::String> &lines; + Common::Array<StringType> &lines; int actualMaxLineWidth; - WordWrapper(Common::Array<Common::String> &l) : lines(l), actualMaxLineWidth(0) { + WordWrapper(Common::Array<StringType> &l) : lines(l), actualMaxLineWidth(0) { } - void add(Common::String &line, int &w) { + void add(StringType &line, int &w) { if (actualMaxLineWidth < w) actualMaxLineWidth = w; @@ -153,10 +92,11 @@ struct WordWrapper { } }; -int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines) const { - WordWrapper wrapper(lines); - Common::String line; - Common::String tmpStr; +template<class StringType> +int wordWrapTextImpl(const Font &font, const StringType &str, int maxWidth, Common::Array<StringType> &lines) { + WordWrapper<StringType> wrapper(lines); + StringType line; + StringType tmpStr; int lineWidth = 0; int tmpWidth = 0; @@ -173,10 +113,10 @@ int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Co // of a line. If we encounter such a word, we have to wrap it over multiple // lines. - uint last = 0; - for (Common::String::const_iterator x = str.begin(); x != str.end(); ++x) { - const byte c = *x; - const int w = getCharWidth(c) + getKerningOffset(last, c); + typename StringType::unsigned_type last = 0; + for (typename StringType::const_iterator x = str.begin(); x != str.end(); ++x) { + const typename StringType::unsigned_type c = *x; + const int w = font.getCharWidth(c) + font.getKerningOffset(last, c); last = c; const bool wouldExceedWidth = (lineWidth + tmpWidth + w > maxWidth); @@ -212,7 +152,7 @@ int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Co tmpStr.deleteChar(0); // This is not very fast, but it is the simplest way to // assure we do not mess something up because of kerning. - tmpWidth = getStringWidth(tmpStr); + tmpWidth = font.getStringWidth(tmpStr); } } else { wrapper.add(tmpStr, tmpWidth); @@ -232,5 +172,98 @@ int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Co return wrapper.actualMaxLineWidth; } +} // End of anonymous namespace + +int Font::getStringWidth(const Common::String &str) const { + return getStringWidthImpl(*this, str); +} + +int Font::getStringWidth(const Common::U32String &str) const { + return getStringWidthImpl(*this, str); +} + +void Font::drawString(Surface *dst, const Common::String &sOld, int x, int y, int w, uint32 color, TextAlign align, int deltax, bool useEllipsis) const { + Common::String s = sOld; + int width = getStringWidth(s); + Common::String str; + + if (useEllipsis && width > w && s.hasSuffix("...")) { + // String is too wide. Check whether it ends in an ellipsis + // ("..."). If so, remove that and try again! + s.deleteLastChar(); + s.deleteLastChar(); + s.deleteLastChar(); + width = getStringWidth(s); + } + + if (useEllipsis && width > w) { + // String is too wide. So we shorten it "intelligently" by + // replacing parts of the string by an ellipsis. There are + // three possibilities for this: replace the start, the end, or + // the middle of the string. What is best really depends on the + // context; but unless we want to make this configurable, + // replacing the middle seems to be a good compromise. + + const int ellipsisWidth = getStringWidth("..."); + + // SLOW algorithm to remove enough of the middle. But it is good enough + // for now. + const int halfWidth = (w - ellipsisWidth) / 2; + int w2 = 0; + Common::String::unsigned_type last = 0; + uint i; + + for (i = 0; i < s.size(); ++i) { + const Common::String::unsigned_type cur = s[i]; + int charWidth = getCharWidth(cur) + getKerningOffset(last, cur); + if (w2 + charWidth > halfWidth) + break; + last = cur; + w2 += charWidth; + str += cur; + } + + // At this point we know that the first 'i' chars are together 'w2' + // pixels wide. We took the first i-1, and add "..." to them. + str += "..."; + last = '.'; + + // The original string is width wide. Of those we already skipped past + // w2 pixels, which means (width - w2) remain. + // The new str is (w2+ellipsisWidth) wide, so we can accommodate about + // (w - (w2+ellipsisWidth)) more pixels. + // Thus we skip ((width - w2) - (w - (w2+ellipsisWidth))) = + // (width + ellipsisWidth - w) + int skip = width + ellipsisWidth - w; + for (; i < s.size() && skip > 0; ++i) { + const Common::String::unsigned_type cur = s[i]; + skip -= getCharWidth(cur) + getKerningOffset(last, cur); + last = cur; + } + + // Append the remaining chars, if any + for (; i < s.size(); ++i) { + str += s[i]; + } + + width = getStringWidth(str); + } else { + str = s; + } + + drawStringImpl(*this, dst, str, x, y, w, color, align, deltax); +} + +void Font::drawString(Surface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, TextAlign align) const { + drawStringImpl(*this, dst, str, x, y, w, color, align, 0); +} + +int Font::wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines) const { + return wordWrapTextImpl(*this, str, maxWidth, lines); +} + +int Font::wordWrapText(const Common::U32String &str, int maxWidth, Common::Array<Common::U32String> &lines) const { + return wordWrapTextImpl(*this, str, maxWidth, lines); +} } // End of namespace Graphics diff --git a/graphics/font.h b/graphics/font.h index 6819b42f52..77b7623a85 100644 --- a/graphics/font.h +++ b/graphics/font.h @@ -23,6 +23,7 @@ #define GRAPHICS_FONT_H #include "common/str.h" +#include "common/ustr.h" namespace Common { template<class T> class Array; @@ -70,7 +71,7 @@ public: * @param chr The character to query the width of. * @return The character's width. */ - virtual int getCharWidth(byte chr) const = 0; + virtual int getCharWidth(uint32 chr) const = 0; /** * Query the kerning offset between two characters. @@ -79,7 +80,7 @@ public: * @param right The right character. May be 0. * @return The horizontal displacement. */ - virtual int getKerningOffset(byte left, byte right) const; + virtual int getKerningOffset(uint32 left, uint32 right) const; /** * Draw a character at a specific point on a surface. @@ -96,15 +97,17 @@ public: * @param y The y coordinate where to draw the character. * @param color The color of the character. */ - virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const = 0; + virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const = 0; // TODO: Add doxygen comments to this 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; + void drawString(Surface *dst, const Common::U32String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft) const; /** * Compute and return the width the string str has when rendered using this font. */ int getStringWidth(const Common::String &str) const; + int getStringWidth(const Common::U32String &str) const; /** * Take a text (which may contain newline characters) and word wrap it so that @@ -120,6 +123,7 @@ public: * @return the maximal width of any of the lines added to lines */ int wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines) const; + int wordWrapText(const Common::U32String &str, int maxWidth, Common::Array<Common::U32String> &lines) const; }; } // End of namespace Graphics diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp index e523a36ad5..7b2290cc3a 100644 --- a/graphics/fonts/bdf.cpp +++ b/graphics/fonts/bdf.cpp @@ -51,7 +51,7 @@ int BdfFont::getMaxCharWidth() const { return _data.maxAdvance; } -int BdfFont::getCharWidth(byte chr) const { +int BdfFont::getCharWidth(uint32 chr) const { // In case all font have the same advance value, we use the maximum. if (!_data.advances) return _data.maxAdvance; @@ -85,9 +85,9 @@ void drawCharIntern(byte *ptr, uint pitch, const byte *src, int h, int width, in } } -int BdfFont::mapToIndex(byte ch) const { +int BdfFont::mapToIndex(uint32 ch) const { // Check whether the character is included - if (_data.firstCharacter <= ch && ch <= _data.firstCharacter + _data.numCharacters) { + if (_data.firstCharacter <= (int)ch && (int)ch <= _data.firstCharacter + _data.numCharacters) { if (_data.bitmaps[ch - _data.firstCharacter]) return ch - _data.firstCharacter; } @@ -95,7 +95,7 @@ int BdfFont::mapToIndex(byte ch) const { return _data.defaultCharacter - _data.firstCharacter; } -void BdfFont::drawChar(Surface *dst, byte chr, const int tx, const int ty, const uint32 color) const { +void BdfFont::drawChar(Surface *dst, uint32 chr, const int tx, const int ty, const uint32 color) const { assert(dst != 0); // TODO: Where is the relation between the max advance being smaller or diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h index b0166a2095..842e54f851 100644 --- a/graphics/fonts/bdf.h +++ b/graphics/fonts/bdf.h @@ -61,14 +61,14 @@ public: virtual int getFontHeight() const; virtual int getMaxCharWidth() const; - virtual int getCharWidth(byte chr) const; - virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const; + virtual int getCharWidth(uint32 chr) const; + virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const; static BdfFont *loadFont(Common::SeekableReadStream &stream); static bool cacheFontData(const BdfFont &font, const Common::String &filename); static BdfFont *loadFromCache(Common::SeekableReadStream &stream); private: - int mapToIndex(byte ch) const; + int mapToIndex(uint32 ch) const; const BdfFontData _data; const DisposeAfterUse::Flag _dispose; diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp index b9e9610d77..be3cd94efa 100644 --- a/graphics/fonts/ttf.cpp +++ b/graphics/fonts/ttf.cpp @@ -107,11 +107,11 @@ public: virtual int getMaxCharWidth() const; - virtual int getCharWidth(byte chr) const; + virtual int getCharWidth(uint32 chr) const; - virtual int getKerningOffset(byte left, byte right) const; + virtual int getKerningOffset(uint32 left, uint32 right) const; - virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const; + virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const; private: bool _initialized; FT_Face _face; @@ -126,13 +126,14 @@ private: Surface image; int xOffset, yOffset; int advance; + FT_UInt slot; }; - bool cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr); - typedef Common::HashMap<byte, Glyph> GlyphCache; - GlyphCache _glyphs; - - FT_UInt _glyphSlots[256]; + bool cacheGlyph(Glyph &glyph, uint32 chr) const; + typedef Common::HashMap<uint32, Glyph> GlyphCache; + mutable GlyphCache _glyphs; + bool _allowLateCaching; + void assureCached(uint32 chr) const; bool _monochrome; bool _hasKerning; @@ -140,7 +141,7 @@ private: TTFFont::TTFFont() : _initialized(false), _face(), _ttfFile(0), _size(0), _width(0), _height(0), _ascent(0), - _descent(0), _glyphs(), _glyphSlots(), _monochrome(false), _hasKerning(false) { + _descent(0), _glyphs(), _monochrome(false), _hasKerning(false) { } TTFFont::~TTFFont() { @@ -212,19 +213,26 @@ bool TTFFont::load(Common::SeekableReadStream &stream, int size, uint dpi, bool _height = _ascent - _descent + 1; if (!mapping) { + // Allow loading of all unicode characters. + _allowLateCaching = true; + // Load all ISO-8859-1 characters. for (uint i = 0; i < 256; ++i) { - if (!cacheGlyph(_glyphs[i], _glyphSlots[i], i)) - _glyphSlots[i] = 0; + if (!cacheGlyph(_glyphs[i], i)) { + _glyphs.erase(i); + } } } else { + // We have a fixed map of characters do not load more later. + _allowLateCaching = false; + for (uint i = 0; i < 256; ++i) { const uint32 unicode = mapping[i] & 0x7FFFFFFF; const bool isRequired = (mapping[i] & 0x80000000) != 0; // Check whether loading an important glyph fails and error out if // that is the case. - if (!cacheGlyph(_glyphs[i], _glyphSlots[i], unicode)) { - _glyphSlots[i] = 0; + if (!cacheGlyph(_glyphs[i], unicode)) { + _glyphs.erase(i); if (isRequired) return false; } @@ -243,7 +251,8 @@ int TTFFont::getMaxCharWidth() const { return _width; } -int TTFFont::getCharWidth(byte chr) const { +int TTFFont::getCharWidth(uint32 chr) const { + assureCached(chr); GlyphCache::const_iterator glyphEntry = _glyphs.find(chr); if (glyphEntry == _glyphs.end()) return 0; @@ -251,12 +260,29 @@ int TTFFont::getCharWidth(byte chr) const { return glyphEntry->_value.advance; } -int TTFFont::getKerningOffset(byte left, byte right) const { +int TTFFont::getKerningOffset(uint32 left, uint32 right) const { if (!_hasKerning) return 0; - FT_UInt leftGlyph = _glyphSlots[left]; - FT_UInt rightGlyph = _glyphSlots[right]; + assureCached(left); + assureCached(right); + + FT_UInt leftGlyph, rightGlyph; + GlyphCache::const_iterator glyphEntry; + + glyphEntry = _glyphs.find(left); + if (glyphEntry != _glyphs.end()) { + leftGlyph = glyphEntry->_value.slot; + } else { + return 0; + } + + glyphEntry = _glyphs.find(right); + if (glyphEntry != _glyphs.end()) { + rightGlyph = glyphEntry->_value.slot; + } else { + return 0; + } if (!leftGlyph || !rightGlyph) return 0; @@ -304,7 +330,8 @@ void renderGlyph(uint8 *dstPos, const int dstPitch, const uint8 *srcPos, const i } // End of anonymous namespace -void TTFFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const { +void TTFFont::drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const { + assureCached(chr); GlyphCache::const_iterator glyphEntry = _glyphs.find(chr); if (glyphEntry == _glyphs.end()) return; @@ -376,11 +403,13 @@ void TTFFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const } } -bool TTFFont::cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr) { - slot = FT_Get_Char_Index(_face, chr); +bool TTFFont::cacheGlyph(Glyph &glyph, uint32 chr) const { + FT_UInt slot = FT_Get_Char_Index(_face, chr); if (!slot) return false; + glyph.slot = slot; + // We use the light target and render mode to improve the looks of the // glyphs. It is most noticable in FreeSansBold.ttf, where otherwise the // 't' glyph looks like it is cut off on the right side. @@ -456,12 +485,24 @@ bool TTFFont::cacheGlyph(Glyph &glyph, FT_UInt &slot, uint chr) { default: warning("TTFFont::cacheGlyph: Unsupported pixel mode %d", bitmap.pixel_mode); + glyph.image.free(); return false; } return true; } +void TTFFont::assureCached(uint32 chr) const { + if (!chr || !_allowLateCaching || _glyphs.contains(chr)) { + return; + } + + Glyph newGlyph; + if (cacheGlyph(newGlyph, chr)) { + _glyphs[chr] = newGlyph; + } +} + Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi, bool monochrome, const uint32 *mapping) { TTFFont *font = new TTFFont(); diff --git a/graphics/fonts/winfont.cpp b/graphics/fonts/winfont.cpp index 3bad92236d..c0ebab19ba 100644 --- a/graphics/fonts/winfont.cpp +++ b/graphics/fonts/winfont.cpp @@ -200,7 +200,7 @@ char WinFont::indexToCharacter(uint16 index) const { return index + _firstChar; } -uint16 WinFont::characterToIndex(byte character) const { +uint16 WinFont::characterToIndex(uint32 character) const { // Go to the default character if we didn't find a mapping if (character < _firstChar || character > _lastChar) character = _defaultChar; @@ -208,7 +208,7 @@ uint16 WinFont::characterToIndex(byte character) const { return character - _firstChar; } -int WinFont::getCharWidth(byte chr) const { +int WinFont::getCharWidth(uint32 chr) const { return _glyphs[characterToIndex(chr)].charWidth; } @@ -324,7 +324,7 @@ bool WinFont::loadFromFNT(Common::SeekableReadStream &stream) { return true; } -void WinFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const { +void WinFont::drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const { assert(dst); assert(dst->format.bytesPerPixel == 1 || dst->format.bytesPerPixel == 2 || dst->format.bytesPerPixel == 4); assert(_glyphs); diff --git a/graphics/fonts/winfont.h b/graphics/fonts/winfont.h index 4382d7ed6b..2c7ba07b41 100644 --- a/graphics/fonts/winfont.h +++ b/graphics/fonts/winfont.h @@ -62,8 +62,8 @@ public: // Font API int getFontHeight() const { return _pixHeight; } int getMaxCharWidth() const { return _maxWidth; } - int getCharWidth(byte chr) const; - void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const; + int getCharWidth(uint32 chr) const; + void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const; private: bool loadFromPE(const Common::String &fileName, const WinFontDirEntry &dirEntry); @@ -72,7 +72,7 @@ private: uint32 getFontIndex(Common::SeekableReadStream &stream, const WinFontDirEntry &dirEntry); bool loadFromFNT(Common::SeekableReadStream &stream); char indexToCharacter(uint16 index) const; - uint16 characterToIndex(byte character) const; + uint16 characterToIndex(uint32 character) const; uint16 _pixHeight; uint16 _maxWidth; diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index eb5a71cdbe..36fe83fa19 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -69,6 +69,7 @@ namespace Video { #define ID_ISFT MKTAG('I','S','F','T') #define ID_DISP MKTAG('D','I','S','P') #define ID_PRMI MKTAG('P','R','M','I') +#define ID_STRN MKTAG('s','t','r','n') // Codec tags #define ID_RLE MKTAG('R','L','E',' ') @@ -109,6 +110,7 @@ void AVIDecoder::initCommon() { _decodedHeader = false; _foundMovieList = false; _movieListStart = 0; + _movieListEnd = 0; _fileStream = 0; memset(&_header, 0, sizeof(_header)); } @@ -155,6 +157,7 @@ bool AVIDecoder::parseNextChunk() { case ID_JUNK: // Alignment bytes, should be ignored case ID_ISFT: // Metadata, safe to ignore case ID_DISP: // Metadata, should be safe to ignore + case ID_STRN: // Metadata, safe to ignore skipChunk(size); break; case ID_IDX1: @@ -184,6 +187,7 @@ void AVIDecoder::handleList(uint32 listSize) { // We found the movie block _foundMovieList = true; _movieListStart = curPos; + _movieListEnd = _movieListStart + listSize + (listSize & 1); _fileStream->skip(listSize); return; case ID_HDRL: // Header List @@ -344,17 +348,27 @@ void AVIDecoder::close() { _decodedHeader = false; _foundMovieList = false; _movieListStart = 0; + _movieListEnd = 0; _indexEntries.clear(); memset(&_header, 0, sizeof(_header)); } void AVIDecoder::readNextPacket() { + if ((uint32)_fileStream->pos() >= _movieListEnd) { + // Ugh, reached the end premature. + forceVideoEnd(); + return; + } + uint32 nextTag = _fileStream->readUint32BE(); uint32 size = _fileStream->readUint32LE(); - if (_fileStream->eos()) + if (_fileStream->eos()) { + // Also premature end. + forceVideoEnd(); return; + } if (nextTag == ID_LIST) { // A list of audio/video chunks @@ -636,6 +650,7 @@ void AVIDecoder::readOldIndex(uint32 size) { if (!isAbsolute) firstEntry.offset += _movieListStart - 4; + debug(0, "Index 0: Tag '%s', Offset = %d, Size = %d (Flags = %d)", tag2str(firstEntry.id), firstEntry.offset, firstEntry.size, firstEntry.flags); _indexEntries.push_back(firstEntry); for (uint32 i = 1; i < entryCount; i++) { @@ -654,6 +669,16 @@ void AVIDecoder::readOldIndex(uint32 size) { } } +void AVIDecoder::forceVideoEnd() { + // Horrible AVI video has a premature end + // Force the frame to be the last frame + debug(0, "Forcing end of AVI video"); + + for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo) + ((AVIVideoTrack *)*it)->forceTrackEnd(); +} + AVIDecoder::AVIVideoTrack::AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader, byte *initialPalette) : _frameCount(frameCount), _vidsHeader(streamHeader), _bmInfo(bitmapInfoHeader), _initialPalette(initialPalette) { _videoCodec = createCodec(); @@ -756,6 +781,10 @@ Codec *AVIDecoder::AVIVideoTrack::createCodec() { return 0; } +void AVIDecoder::AVIVideoTrack::forceTrackEnd() { + _curFrame = _frameCount - 1; +} + AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) : _audsHeader(streamHeader), _wvInfo(waveFormat), _soundType(soundType) { _audStream = createAudioStream(); diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 9f28196177..882cce30de 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -166,6 +166,7 @@ protected: ~AVIVideoTrack(); void decodeFrame(Common::SeekableReadStream *stream); + void forceTrackEnd(); uint16 getWidth() const { return _bmInfo.width; } uint16 getHeight() const { return _bmInfo.height; } @@ -238,7 +239,7 @@ protected: Common::SeekableReadStream *_fileStream; bool _decodedHeader; bool _foundMovieList; - uint32 _movieListStart; + uint32 _movieListStart, _movieListEnd; Audio::Mixer::SoundType _soundType; Common::Rational _frameRateOverride; @@ -250,6 +251,7 @@ protected: void handleStreamHeader(uint32 size); uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; } byte getStreamIndex(uint32 tag) const; + void forceVideoEnd(); public: virtual AVIAudioTrack *createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo); |