[Scummvm-cvs-logs] SF.net SVN: scummvm: [32667] scummvm/branches/gsoc2008-rtl
cpage88 at users.sourceforge.net
cpage88 at users.sourceforge.net
Wed Jun 11 19:36:22 CEST 2008
Revision: 32667
http://scummvm.svn.sourceforge.net/scummvm/?rev=32667&view=rev
Author: cpage88
Date: 2008-06-11 10:36:21 -0700 (Wed, 11 Jun 2008)
Log Message:
-----------
Merged revisions 32564-32565,32567-32575,32577,32579-32594,32596-32603,32605-32639,32644-32646,32648-32666 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
Modified Paths:
--------------
scummvm/branches/gsoc2008-rtl/Makefile.common
scummvm/branches/gsoc2008-rtl/backends/platform/wii/Makefile
scummvm/branches/gsoc2008-rtl/backends/platform/wii/main.cpp
scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.cpp
scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.h
scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem_events.cpp
scummvm/branches/gsoc2008-rtl/backends/plugins/dynamic-plugin.h
scummvm/branches/gsoc2008-rtl/common/advancedDetector.cpp
scummvm/branches/gsoc2008-rtl/common/file.cpp
scummvm/branches/gsoc2008-rtl/common/hash-str.h
scummvm/branches/gsoc2008-rtl/common/system.cpp
scummvm/branches/gsoc2008-rtl/common/unarj.cpp
scummvm/branches/gsoc2008-rtl/configure
scummvm/branches/gsoc2008-rtl/dists/msvc7/drascula.vcproj
scummvm/branches/gsoc2008-rtl/dists/msvc71/drascula.vcproj
scummvm/branches/gsoc2008-rtl/dists/msvc8/drascula.vcproj
scummvm/branches/gsoc2008-rtl/dists/msvc9/drascula.vcproj
scummvm/branches/gsoc2008-rtl/dists/wii/icon.png
scummvm/branches/gsoc2008-rtl/engines/agi/detection.cpp
scummvm/branches/gsoc2008-rtl/engines/cine/cine.h
scummvm/branches/gsoc2008-rtl/engines/cine/gfx.cpp
scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp
scummvm/branches/gsoc2008-rtl/engines/cine/texte.cpp
scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp
scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h
scummvm/branches/gsoc2008-rtl/engines/drascula/animation.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/drascula.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/drascula.h
scummvm/branches/gsoc2008-rtl/engines/drascula/module.mk
scummvm/branches/gsoc2008-rtl/engines/drascula/rooms.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/talk.cpp
scummvm/branches/gsoc2008-rtl/engines/kyra/resource.cpp
scummvm/branches/gsoc2008-rtl/engines/kyra/staticres.cpp
scummvm/branches/gsoc2008-rtl/engines/m4/converse.cpp
scummvm/branches/gsoc2008-rtl/engines/m4/converse.h
scummvm/branches/gsoc2008-rtl/engines/m4/font.cpp
scummvm/branches/gsoc2008-rtl/engines/parallaction/font.cpp
scummvm/branches/gsoc2008-rtl/graphics/fontman.h
scummvm/branches/gsoc2008-rtl/gui/eval.h
scummvm/branches/gsoc2008-rtl/gui/launcher.cpp
scummvm/branches/gsoc2008-rtl/gui/massadd.cpp
scummvm/branches/gsoc2008-rtl/gui/massadd.h
scummvm/branches/gsoc2008-rtl/sound/mixer.h
Added Paths:
-----------
scummvm/branches/gsoc2008-rtl/dists/engine-data/drascula.dat
scummvm/branches/gsoc2008-rtl/engines/drascula/actors.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/converse.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/graphics.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/interface.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/objects.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/palette.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/saveload.cpp
scummvm/branches/gsoc2008-rtl/engines/drascula/sound.cpp
scummvm/branches/gsoc2008-rtl/tools/create_drascula/
scummvm/branches/gsoc2008-rtl/tools/create_drascula/Makefile
scummvm/branches/gsoc2008-rtl/tools/create_drascula/create_drascula.cpp
scummvm/branches/gsoc2008-rtl/tools/create_drascula/create_drascula.h
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8/
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8/create_drascula.sln
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8/create_drascula.vcproj
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8_to_msvc9.bat
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9/
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9/create_drascula.sln
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9/create_drascula.vcproj
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9_to_msvc8.bat
scummvm/branches/gsoc2008-rtl/tools/create_drascula/module.mk
scummvm/branches/gsoc2008-rtl/tools/create_drascula/staticdata.h
Removed Paths:
-------------
scummvm/branches/gsoc2008-rtl/engines/drascula/staticdata.h
scummvm/branches/gsoc2008-rtl/tools/create_drascula/Makefile
scummvm/branches/gsoc2008-rtl/tools/create_drascula/create_drascula.cpp
scummvm/branches/gsoc2008-rtl/tools/create_drascula/create_drascula.h
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8/
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8/create_drascula.sln
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8/create_drascula.vcproj
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc8_to_msvc9.bat
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9/
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9/create_drascula.sln
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9/create_drascula.vcproj
scummvm/branches/gsoc2008-rtl/tools/create_drascula/dists/msvc9_to_msvc8.bat
scummvm/branches/gsoc2008-rtl/tools/create_drascula/module.mk
scummvm/branches/gsoc2008-rtl/tools/create_drascula/staticdata.h
Property Changed:
----------------
scummvm/branches/gsoc2008-rtl/
Property changes on: scummvm/branches/gsoc2008-rtl
___________________________________________________________________
Name: svnmerge-integrated
- /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-32562
+ /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-32666
Modified: scummvm/branches/gsoc2008-rtl/Makefile.common
===================================================================
--- scummvm/branches/gsoc2008-rtl/Makefile.common 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/Makefile.common 2008-06-11 17:36:21 UTC (rev 32667)
@@ -182,6 +182,9 @@
# Engine data files
DIST_FILES_ENGINEDATA=
+ifdef ENABLE_DRASCULA
+DIST_FILES_ENGINEDATA+=drascula.dat
+endif
ifdef ENABLE_IGOR
DIST_FILES_ENGINEDATA+=igor.tbl
endif
Modified: scummvm/branches/gsoc2008-rtl/backends/platform/wii/Makefile
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/wii/Makefile 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/wii/Makefile 2008-06-11 17:36:21 UTC (rev 32667)
@@ -62,8 +62,8 @@
INCDIR = $(srcdir) . $(srcdir)/engines/ $(DEVKITPRO)/libogc/include
LIBDIR = $(DEVKITPRO)/libogc/lib/wii
-CXXFLAGS = -g -Os -Wall $(MACHDEP) -D__WII__ \
- -Wno-multichar -fno-exceptions -fno-rtti
+CXXFLAGS = -g -Os -Wall $(MACHDEP) -D__WII__ -Wno-multichar -Wno-long-long \
+ -Wno-unknown-pragmas -Wno-reorder -fno-exceptions -fno-rtti
CXXFLAGS += $(addprefix -I,$(INCDIR))
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(TARGET).elf.map
Modified: scummvm/branches/gsoc2008-rtl/backends/platform/wii/main.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/wii/main.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/wii/main.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -36,6 +36,17 @@
extern "C" {
#endif
+bool reset_btn_pressed = false;
+bool power_btn_pressed = false;
+
+void reset_cb(void) {
+ reset_btn_pressed = true;
+}
+
+void power_cb(void) {
+ power_btn_pressed = true;
+}
+
int main(int argc, char *argv[]) {
s32 res;
@@ -50,6 +61,9 @@
printf("startup\n");
+ SYS_SetResetCallback(reset_cb);
+ SYS_SetPowerCallback(power_cb);
+
if (!fatInitDefault()) {
printf("fatInitDefault failed\n");
} else {
@@ -77,6 +91,11 @@
fatUnsafeUnmount(PI_DEFAULT);
}
+ if (power_btn_pressed) {
+ printf("shutting down\n");
+ SYS_ResetSystem(SYS_POWEROFF, 0, 0);
+ }
+
printf("reloading\n");
return res;
Modified: scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -63,6 +63,8 @@
_mouseKeyColor(0),
_mouseCursor(NULL),
+ _event_quit(false),
+
_savefile(NULL),
_mixer(NULL),
_timer(NULL) {
Modified: scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.h 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem.h 2008-06-11 17:36:21 UTC (rev 32667)
@@ -37,6 +37,17 @@
#include <gccore.h>
#include <ogcsys.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern bool reset_btn_pressed;
+extern bool power_btn_pressed;
+
+#ifdef __cplusplus
+}
+#endif
+
class OSystem_Wii : public OSystem {
private:
s64 _startup_time;
@@ -69,6 +80,8 @@
u8 _mouseKeyColor;
u8 *_mouseCursor;
+ bool _event_quit;
+
u32 _lastPadCheck;
void initGfx();
Modified: scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem_events.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem_events.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/backends/platform/wii/osystem_events.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -140,6 +140,15 @@
} while (0)
bool OSystem_Wii::pollEvent(Common::Event &event) {
+ if ((reset_btn_pressed || power_btn_pressed) && !_event_quit) {
+ _event_quit = true;
+ event.type = Common::EVENT_QUIT;
+
+ printf("quit event\n");
+
+ return true;
+ }
+
u32 bd, bh, bu;
PAD_ScanPads();
Modified: scummvm/branches/gsoc2008-rtl/backends/plugins/dynamic-plugin.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/plugins/dynamic-plugin.h 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/backends/plugins/dynamic-plugin.h 2008-06-11 17:36:21 UTC (rev 32667)
@@ -46,6 +46,7 @@
return false;
}
if (verFunc() != PLUGIN_VERSION) {
+ warning("Plugin uses a different API version (you have: '%d', needed is: '%d')", verFunc(), PLUGIN_VERSION);
unloadPlugin();
return false;
}
@@ -58,6 +59,7 @@
}
_type = (PluginType)typeFunc();
if (_type >= PLUGIN_TYPE_MAX) {
+ warning("Plugin type unknown: %d", _type);
unloadPlugin();
return false;
}
@@ -69,6 +71,7 @@
return false;
}
if (typeVerFunc() != pluginTypeVersions[_type]) {
+ warning("Plugin uses a different type API version (you have: '%d', needed is: '%d')", typeVerFunc(), pluginTypeVersions[_type]);
unloadPlugin();
return false;
}
@@ -83,6 +86,7 @@
// Get the plugin object
_pluginObject = getObject();
if (!_pluginObject) {
+ warning("Couldn't get the plugin object");
unloadPlugin();
return false;
}
Modified: scummvm/branches/gsoc2008-rtl/common/advancedDetector.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/advancedDetector.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/common/advancedDetector.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -268,7 +268,10 @@
return kNoError;
}
-static void reportUnknown(StringMap &filesMD5, HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> &filesSize) {
+typedef HashMap<String, bool> StringSet;
+typedef HashMap<String, int32> IntMap;
+
+static void reportUnknown(StringMap &filesMD5, IntMap &filesSize) {
// TODO: This message should be cleaned up / made more specific.
// For example, we should specify at least which engine triggered this.
//
@@ -285,11 +288,8 @@
}
static ADGameDescList detectGame(const FSList *fslist, const Common::ADParams ¶ms, Language language, Platform platform, const Common::String extra) {
- typedef HashMap<String, bool, CaseSensitiveString_Hash, CaseSensitiveString_EqualTo> StringSet;
StringSet filesList;
- typedef StringMap StringMap;
- typedef HashMap<String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> IntMap;
StringMap filesMD5;
IntMap filesSize;
IntMap allFiles;
Modified: scummvm/branches/gsoc2008-rtl/common/file.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/file.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/common/file.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -136,7 +136,7 @@
namespace Common {
-typedef HashMap<String, int, CaseSensitiveString_Hash, CaseSensitiveString_EqualTo> StringIntMap;
+typedef HashMap<String, int> StringIntMap;
// The following two objects could be turned into static members of class
// File. However, then we would be forced to #include hashmap in file.h
Modified: scummvm/branches/gsoc2008-rtl/common/hash-str.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/hash-str.h 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/common/hash-str.h 2008-06-11 17:36:21 UTC (rev 32667)
@@ -57,11 +57,12 @@
-typedef HashMap<String, String, IgnoreCase_Hash, IgnoreCase_EqualTo> StringMap;
-
-
-#if 0
// Specalization of the Hash functor for String objects.
+// We do case sensitve hashing here, because that is what
+// the default EqualTo is compatible with. If one wants to use
+// case insensitve hashing, then only because one wants to use
+// IgnoreCase_EqualTo, and then one has to specify a custom
+// hash anyway.
template <>
struct Hash<String> {
uint operator()(const String& s) const {
@@ -75,9 +76,12 @@
return hashit(s);
}
};
-#endif
+// String map -- by default case insensitive
+typedef HashMap<String, String, IgnoreCase_Hash, IgnoreCase_EqualTo> StringMap;
+
+
} // End of namespace Common
Modified: scummvm/branches/gsoc2008-rtl/common/system.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/system.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/common/system.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -128,9 +128,7 @@
* TODO: Remove these gradually and move the getFilesystemFactory() implementations
* to the respective backends. Then turn it into a pure virtual method of OSystem.
*/
-#if defined(__DS__)
- #include "backends/fs/ds/ds-fs-factory.h"
-#elif defined(PALMOS_MODE)
+#if defined(PALMOS_MODE)
#include "backends/fs/palmos/palmos-fs-factory.h"
#elif defined(__PLAYSTATION2__)
#include "backends/fs/ps2/ps2-fs-factory.h"
Modified: scummvm/branches/gsoc2008-rtl/common/unarj.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/unarj.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/common/unarj.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -289,6 +289,9 @@
}
void ArjFile::close() {
+ if (!_isOpen)
+ return;
+
_isOpen = false;
if (_fallBack) {
Modified: scummvm/branches/gsoc2008-rtl/configure
===================================================================
--- scummvm/branches/gsoc2008-rtl/configure 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/configure 2008-06-11 17:36:21 UTC (rev 32667)
@@ -125,9 +125,12 @@
_srcdir=`dirname $0`
-# TODO: We should really use mktemp(1) to determine a random tmp file name.
-# However, that tool might not be available everywhere.
-TMPO=${_srcdir}/scummvm-conf
+# Determine a tmp file name, using mktemp(1) when available.
+if type mktemp > /dev/null 2>&1 ; then
+ TMPO=`mktemp`
+else
+ TMPO=${_srcdir}/scummvm-conf
+fi
TMPC=${TMPO}.cpp
TMPLOG=${_srcdir}/config.log
@@ -159,7 +162,7 @@
'"$1"
}
-# Add a line of data to h.mk.
+# Add a line of data to config.h.
add_line_to_config_h() {
_config_h_data="$_config_h_data"'
'"$1"
@@ -218,7 +221,7 @@
# In cross-compiling mode, we cannot run the result
eval "$1 $CXXFLAGS $LDFLAGS -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
else
- eval "$1 $CXXFLAGS $LDFLAGS -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && eval "./tmp_cxx_compiler 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
+ eval "$1 $CXXFLAGS $LDFLAGS -o tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && eval "./tmp_cxx_compiler$EXEEXT 2> /dev/null" && rm -f tmp_cxx_compiler$EXEEXT tmp_cxx_compiler.cpp
fi
}
@@ -381,7 +384,7 @@
fi
if test "$opt" = "static" -o "$opt" = "dynamic" -o "$opt" = "yes" ; then
- if test "`get_engine_name ${engine}`" != "" -a "`get_engine_build ${engine}`" != "$opt" ; then
+ if test "`get_engine_name ${engine}`" != "" ; then
eval _engine_${engine}_build=$opt
else
option_error
@@ -400,7 +403,7 @@
fi
engine=`echo $1 | sed 's/-/_/g'`
- if test "`get_engine_name ${engine}`" != "" -a "`get_engine_build $engine`" != "no" ; then
+ if test "`get_engine_name ${engine}`" != "" ; then
eval _engine_${engine}_build=no
else
option_error
@@ -579,7 +582,7 @@
Configuration:
-h, --help display this help and exit
- --backend=BACKEND backend to build (sdl, x11, morphos, dc, gp32, gp2x, iphone, null) [sdl]
+ --backend=BACKEND backend to build (sdl, x11, morphos, dc, gp2x, iphone, null) [sdl]
Installation directories:
--prefix=DIR use this prefix for installing ScummVM [/usr/local]
@@ -1089,7 +1092,7 @@
;;
arm-linux|arm*-linux-gnueabi|arm-*-linux|*-angstrom-linux)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
- DEFINES="$DEFINES -DUNIX -DUSE_ARM_SOUND_ASM -DUSE_ARM_SMUSH_ASM"
+ DEFINES="$DEFINES -DUNIX -DUSE_ARM_SMUSH_ASM"
#not true for all ARM systems, but the interesting ones are all LE. Most (if not all) BE arm devices don't have a screen
_endian=little
_need_memalign=yes
@@ -1104,7 +1107,7 @@
;;
gp2x)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
- DEFINES="$DEFINES -DUNIX -DGP2X -DUSE_ARM_SOUND_ASM -DUSE_ARM_SMUSH_ASM"
+ DEFINES="$DEFINES -DUNIX -DGP2X -DUSE_ARM_SMUSH_ASM"
_endian=little
_need_memalign=yes
type_1_byte='char'
@@ -1113,7 +1116,6 @@
add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
_backend="gp2x"
- _mak_hq_scalers='DISABLE_HQ_SCALERS = 1'
_build_hq_scalers="no"
;;
ppc-amigaos)
@@ -1151,7 +1153,7 @@
;;
iphone)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
- DEFINES="$DEFINES -DIPHONE -DUNIX -DUSE_ARM_SOUND_ASM -DUSE_ARM_SMUSH_ASM"
+ DEFINES="$DEFINES -DIPHONE -DUNIX -DUSE_ARM_SMUSH_ASM"
_endian=little
_need_memalign=yes
type_1_byte='char'
@@ -1160,7 +1162,6 @@
add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
_backend="iphone"
- _mak_hq_scalers='DISABLE_HQ_SCALERS = 1'
_build_hq_scalers="no"
;;
*)
@@ -1211,7 +1212,7 @@
}
EOF
_need_memalign=yes
- cc_check && $TMPO && _need_memalign=no
+ cc_check && $TMPO$EXEEXT && _need_memalign=no
;;
esac
echo "$_need_memalign"
@@ -1520,7 +1521,7 @@
# don't execute while cross compiling
cc_check $LDFLAGS $CXXFLAGS $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && _mpeg2=yes
else
- cc_check $LDFLAGS $CXXFLAGS $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && $TMPO && _mpeg2=yes
+ cc_check $LDFLAGS $CXXFLAGS $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && $TMPO$EXEEXT && _mpeg2=yes
fi
fi
if test "$_mpeg2" = yes ; then
Copied: scummvm/branches/gsoc2008-rtl/dists/engine-data/drascula.dat (from rev 32666, scummvm/trunk/dists/engine-data/drascula.dat)
===================================================================
(Binary files differ)
Modified: scummvm/branches/gsoc2008-rtl/dists/msvc7/drascula.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc7/drascula.vcproj 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc7/drascula.vcproj 2008-06-11 17:36:21 UTC (rev 32667)
@@ -97,9 +97,15 @@
</Configurations>
<Files>
<File
+ RelativePath="..\..\engines\drascula\actors.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\animation.cpp">
</File>
<File
+ RelativePath="..\..\engines\drascula\converse.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\detection.cpp">
</File>
<File
@@ -109,12 +115,27 @@
RelativePath="..\..\engines\drascula\drascula.h">
</File>
<File
+ RelativePath="..\..\engines\drascula\graphics.cpp">
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\interface.cpp">
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\objects.cpp">
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\palette.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\rooms.cpp">
</File>
<File
- RelativePath="..\..\engines\drascula\staticdata.h">
+ RelativePath="..\..\engines\drascula\saveload.cpp">
</File>
<File
+ RelativePath="..\..\engines\drascula\sound.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\talk.cpp">
</File>
</Files>
Modified: scummvm/branches/gsoc2008-rtl/dists/msvc71/drascula.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc71/drascula.vcproj 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc71/drascula.vcproj 2008-06-11 17:36:21 UTC (rev 32667)
@@ -111,9 +111,15 @@
</References>
<Files>
<File
+ RelativePath="..\..\engines\drascula\actors.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\animation.cpp">
</File>
<File
+ RelativePath="..\..\engines\drascula\converse.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\detection.cpp">
</File>
<File
@@ -123,12 +129,27 @@
RelativePath="..\..\engines\drascula\drascula.h">
</File>
<File
+ RelativePath="..\..\engines\drascula\graphics.cpp">
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\interface.cpp">
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\objects.cpp">
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\palette.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\rooms.cpp">
</File>
<File
- RelativePath="..\..\engines\drascula\staticdata.h">
+ RelativePath="..\..\engines\drascula\saveload.cpp">
</File>
<File
+ RelativePath="..\..\engines\drascula\sound.cpp">
+ </File>
+ <File
RelativePath="..\..\engines\drascula\talk.cpp">
</File>
</Files>
Modified: scummvm/branches/gsoc2008-rtl/dists/msvc8/drascula.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc8/drascula.vcproj 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc8/drascula.vcproj 2008-06-11 17:36:21 UTC (rev 32667)
@@ -161,10 +161,18 @@
</References>
<Files>
<File
+ RelativePath="..\..\engines\drascula\actors.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\animation.cpp"
>
</File>
<File
+ RelativePath="..\..\engines\drascula\converse.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\detection.cpp"
>
</File>
@@ -177,14 +185,34 @@
>
</File>
<File
+ RelativePath="..\..\engines\drascula\graphics.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\interface.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\objects.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\palette.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\rooms.cpp"
>
</File>
<File
- RelativePath="..\..\engines\drascula\staticdata.h"
+ RelativePath="..\..\engines\drascula\saveload.cpp"
>
</File>
<File
+ RelativePath="..\..\engines\drascula\sound.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\talk.cpp"
>
</File>
Modified: scummvm/branches/gsoc2008-rtl/dists/msvc9/drascula.vcproj
===================================================================
--- scummvm/branches/gsoc2008-rtl/dists/msvc9/drascula.vcproj 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/dists/msvc9/drascula.vcproj 2008-06-11 17:36:21 UTC (rev 32667)
@@ -162,10 +162,18 @@
</References>
<Files>
<File
+ RelativePath="..\..\engines\drascula\actors.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\animation.cpp"
>
</File>
<File
+ RelativePath="..\..\engines\drascula\converse.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\detection.cpp"
>
</File>
@@ -178,14 +186,34 @@
>
</File>
<File
+ RelativePath="..\..\engines\drascula\graphics.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\interface.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\objects.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\drascula\palette.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\rooms.cpp"
>
</File>
<File
- RelativePath="..\..\engines\drascula\staticdata.h"
+ RelativePath="..\..\engines\drascula\saveload.cpp"
>
</File>
<File
+ RelativePath="..\..\engines\drascula\sound.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\drascula\talk.cpp"
>
</File>
Modified: scummvm/branches/gsoc2008-rtl/dists/wii/icon.png
===================================================================
(Binary files differ)
Modified: scummvm/branches/gsoc2008-rtl/engines/agi/detection.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/detection.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/detection.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -2148,7 +2148,7 @@
}
const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const FSList *fslist) const {
- typedef Common::HashMap<Common::String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> IntMap;
+ typedef Common::HashMap<Common::String, int32> IntMap;
IntMap allFiles;
bool matchedUsingFilenames = false;
bool matchedUsingWag = false;
Modified: scummvm/branches/gsoc2008-rtl/engines/cine/cine.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/cine.h 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/cine.h 2008-06-11 17:36:21 UTC (rev 32667)
@@ -64,7 +64,7 @@
struct CINEGameDescription;
-typedef Common::HashMap<Common::String, const char *, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> StringPtrHashMap;
+typedef Common::HashMap<Common::String, const char *> StringPtrHashMap;
class CineEngine : public Engine {
Modified: scummvm/branches/gsoc2008-rtl/engines/cine/gfx.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/gfx.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/gfx.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -335,8 +335,8 @@
if (character == ' ') {
x += 5;
- } else if ((width = fontParamTable[character].characterWidth)) {
- idx = fontParamTable[character].characterIdx;
+ } else if ((width = fontParamTable[(unsigned char)character].characterWidth)) {
+ idx = fontParamTable[(unsigned char)character].characterIdx;
drawSpriteRaw(textTable[idx][0], textTable[idx][1], 16, 8, _backBuffer, x, y);
x += width + 1;
}
@@ -936,8 +936,8 @@
if (character == ' ') {
x += 5;
- } else if ((width = fontParamTable[character].characterWidth)) {
- idx = fontParamTable[character].characterIdx;
+ } else if ((width = fontParamTable[(unsigned char)character].characterWidth)) {
+ idx = fontParamTable[(unsigned char)character].characterIdx;
drawSpriteRaw2(textTable[idx][0], 0, 16, 8, _backBuffer, x, y);
x += width + 1;
}
Modified: scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/part.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -70,25 +70,41 @@
// TODO
}
-static void fixVolCnfFileName(char *dst, const uint8 *src) {
- memcpy(dst, src, 8);
- src += 8;
- dst[8] = 0;
+static Common::String fixVolCnfFileName(const uint8 *src, uint len) {
+ assert(len == 11 || len == 13);
+ // Copy source to a temporary buffer and force a trailing zero for string manipulation
+ char tmp[14];
+ memcpy(tmp, src, len);
+ tmp[len] = 0;
- char *ext = strchr(dst, ' ');
- if (!ext) {
- ext = &dst[8];
- }
- if (*src == ' ') {
- *ext = 0;
+ if (len == 11) {
+ // Filenames of length 11 have no separation of the extension and the basename
+ // so that's why we have to convert them first. There's no trailing zero in them
+ // either and they're always of the full length 11 with padding spaces. Extension
+ // can be always found at offset 8 onwards.
+ //
+ // Examples of filename mappings:
+ // "AEROPORTMSG" -> "AEROPORT.MSG"
+ // "MITRAILLHP " -> "MITRAILL.HP" (Notice the trailing space after the extension)
+ // "BOND10 " -> "BOND10"
+ // "GIRL SET" -> "GIRL.SET"
+
+ // Replace all space characters with zeroes
+ for (uint i = 0; i < len; i++)
+ if (tmp[i] == ' ')
+ tmp[i] = 0;
+ // Extract the filename's extension
+ Common::String extension(tmp + 8);
+ tmp[8] = 0; // Force separation of extension and basename
+ Common::String basename(tmp);
+ if (extension.empty()) {
+ return basename;
+ } else {
+ return basename + "." + extension;
+ }
} else {
- *ext++ = '.';
- memcpy(ext, src, 3);
- char *end = strchr(ext, ' ');
- if (!end) {
- end = &ext[3];
- }
- *end = 0;
+ // Filenames of length 13 are okay as they are, no need for conversion
+ return Common::String(tmp);
}
}
@@ -97,30 +113,25 @@
if (!f.open("vol.cnf")) {
error("Unable to open 'vol.cnf'");
}
- bool abaseHeader = false;
uint32 unpackedSize, packedSize;
char hdr[8];
f.read(hdr, 8);
- if (memcmp(hdr, "ABASECP", 7) == 0) {
- abaseHeader = true;
+ bool compressed = (memcmp(hdr, "ABASECP", 7) == 0);
+ if (compressed) {
unpackedSize = f.readUint32BE();
packedSize = f.readUint32BE();
} else {
f.seek(0);
unpackedSize = packedSize = f.size();
}
- uint8 *buf = (uint8 *)malloc(unpackedSize);
- if (!buf) {
- error("Unable to allocate %d bytes", unpackedSize);
- }
+ uint8 *buf = new uint8[unpackedSize];
f.read(buf, packedSize);
if (packedSize != unpackedSize) {
- bool b = delphineUnpack(buf, buf, packedSize);
- if (!b) {
+ CineUnpacker cineUnpacker;
+ if (!cineUnpacker.unpack(buf, buf, packedSize)) {
error("Error while unpacking 'vol.cnf' data");
}
}
- const int fileNameLength = abaseHeader ? 11 : 13;
uint8 *p = buf;
int resourceFilesCount = READ_BE_UINT16(p); p += 2;
int entrySize = READ_BE_UINT16(p); p += 2;
@@ -132,31 +143,48 @@
p += entrySize;
}
- int volumeEntriesCount = 0;
+ // Check file name blocks' sizes
+ bool fileNameLenMod11, fileNameLenMod13;
+ fileNameLenMod11 = fileNameLenMod13 = true;
for (int i = 0; i < resourceFilesCount; ++i) {
int size = READ_BE_UINT32(p); p += 4;
- assert((size % fileNameLength) == 0);
- volumeEntriesCount += size / fileNameLength;
+ fileNameLenMod11 &= ((size % 11) == 0);
+ fileNameLenMod13 &= ((size % 13) == 0);
p += size;
}
+ // Make sure at least one of the candidates for file name length fits the data
+ assert(fileNameLenMod11 || fileNameLenMod13);
+ // File name length used to be deduced from the fact whether the file
+ // was compressed or not. Compressed files used file name length 11,
+ // uncompressed files used file name length 13. It worked almost always,
+ // but not with the game entry that's detected as the Operation Stealth's
+ // US Amiga release. It uses a compressed 'vol.cnf' file but still uses
+ // file names of length 13. So we try to deduce the file name length from
+ // the data in the 'vol.cnf' file.
+ int fileNameLength;
+ if (fileNameLenMod11 != fileNameLenMod13) {
+ // All file name blocks' sizes were divisible by either 11 or 13, but not with both.
+ fileNameLength = (fileNameLenMod11 ? 11 : 13);
+ } else {
+ warning("Couldn't deduce file name length from data in 'vol.cnf', using a backup deduction scheme.");
+ // Here we use the former file name length detection method
+ // if we couldn't deduce the file name length from the data.
+ fileNameLength = (compressed ? 11 : 13);
+ }
+
p = buf + 4 + resourceFilesCount * entrySize;
for (int i = 0; i < resourceFilesCount; ++i) {
int count = READ_BE_UINT32(p) / fileNameLength; p += 4;
while (count--) {
- char volumeEntryName[13];
- if (abaseHeader) {
- fixVolCnfFileName(volumeEntryName, p);
- } else {
- memcpy(volumeEntryName, p, fileNameLength);
- }
+ Common::String volumeEntryName = fixVolCnfFileName(p, fileNameLength);
_volumeEntriesMap.setVal(volumeEntryName, _volumeResourceFiles[i].c_str());
- debugC(5, kCineDebugPart, "Added volume entry name '%s' resource file '%s'", volumeEntryName, _volumeResourceFiles[i].c_str());
+ debugC(5, kCineDebugPart, "Added volume entry name '%s' resource file '%s'", volumeEntryName.c_str(), _volumeResourceFiles[i].c_str());
p += fileNameLength;
}
}
- free(buf);
+ delete[] buf;
}
int16 findFileInBundle(const char *fileName) {
@@ -197,7 +225,8 @@
if (partBuffer[foundFileIdx].unpackedSize != partBuffer[foundFileIdx].packedSize) {
byte *unpackBuffer = (byte *)malloc(partBuffer[foundFileIdx].packedSize);
readFromPart(foundFileIdx, unpackBuffer);
- delphineUnpack(dataPtr, unpackBuffer, partBuffer[foundFileIdx].packedSize);
+ CineUnpacker cineUnpacker;
+ cineUnpacker.unpack(dataPtr, unpackBuffer, partBuffer[foundFileIdx].packedSize);
free(unpackBuffer);
} else {
readFromPart(foundFileIdx, dataPtr);
Modified: scummvm/branches/gsoc2008-rtl/engines/cine/texte.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/texte.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/texte.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -635,7 +635,7 @@
bkpWidth = width;
bkpLen = i + 1;
} else {
- charWidth = fontParamTable[str[i]].characterWidth + 1;
+ charWidth = fontParamTable[(unsigned char)str[i]].characterWidth + 1;
width += charWidth;
}
Modified: scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/unpack.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -30,94 +30,101 @@
namespace Cine {
-struct UnpackCtx {
- int size, datasize;
- uint32 crc;
- uint32 chk;
- byte *dst;
- const byte *src;
-};
+uint32 CineUnpacker::readSource() {
+ uint32 value = READ_BE_UINT32(_src);
+ _src -= 4;
+ return value;
+}
-static int rcr(UnpackCtx *uc, int CF) {
- int rCF = (uc->chk & 1);
- uc->chk >>= 1;
- if (CF) {
- uc->chk |= 0x80000000;
+int CineUnpacker::rcr(int inputCarry) {
+ int outputCarry = (_chunk32b & 1);
+ _chunk32b >>= 1;
+ if (inputCarry) {
+ _chunk32b |= 0x80000000;
}
- return rCF;
+ return outputCarry;
}
-static int nextChunk(UnpackCtx *uc) {
- int CF = rcr(uc, 0);
- if (uc->chk == 0) {
- uc->chk = READ_BE_UINT32(uc->src); uc->src -= 4;
- uc->crc ^= uc->chk;
- CF = rcr(uc, 1);
+int CineUnpacker::nextBit() {
+ int carry = rcr(0);
+ // Normally if the chunk becomes zero then the carry is one as
+ // the end of chunk marker is always the last to be shifted out.
+ if (_chunk32b == 0) {
+ _chunk32b = readSource();
+ _crc ^= _chunk32b;
+ carry = rcr(1); // Put the end of chunk marker in the most significant bit
}
- return CF;
+ return carry;
}
-static uint16 getCode(UnpackCtx *uc, byte numChunks) {
+uint16 CineUnpacker::getBits(byte numBits) {
uint16 c = 0;
- while (numChunks--) {
+ while (numBits--) {
c <<= 1;
- if (nextChunk(uc)) {
- c |= 1;
- }
+ c |= nextBit();
}
return c;
}
-static void unpackHelper1(UnpackCtx *uc, byte numChunks, byte addCount) {
- uint16 count = getCode(uc, numChunks) + addCount + 1;
- uc->datasize -= count;
- while (count--) {
- *uc->dst = (byte)getCode(uc, 8);
- --uc->dst;
+void CineUnpacker::unpackRawBytes(uint16 numBytes) {
+ _datasize -= numBytes;
+ while (numBytes--) {
+ *_dst = (byte)getBits(8);
+ --_dst;
}
}
-static void unpackHelper2(UnpackCtx *uc, byte numChunks) {
- uint16 i = getCode(uc, numChunks);
- uint16 count = uc->size + 1;
- uc->datasize -= count;
- while (count--) {
- *uc->dst = *(uc->dst + i);
- --uc->dst;
+void CineUnpacker::copyRelocatedBytes(uint16 offset, uint16 numBytes) {
+ _datasize -= numBytes;
+ while (numBytes--) {
+ *_dst = *(_dst + offset);
+ --_dst;
}
}
-bool delphineUnpack(byte *dst, const byte *src, int len) {
- UnpackCtx uc;
- uc.src = src + len - 4;
- uc.datasize = READ_BE_UINT32(uc.src); uc.src -= 4;
- uc.dst = dst + uc.datasize - 1;
- uc.size = 0;
- uc.crc = READ_BE_UINT32(uc.src); uc.src -= 4;
- uc.chk = READ_BE_UINT32(uc.src); uc.src -= 4;
- uc.crc ^= uc.chk;
+bool CineUnpacker::unpack(byte *dst, const byte *src, int srcLen) {
+ _src = src + srcLen - 4;
+ _datasize = readSource(); // Unpacked length in bytes
+ _dst = dst + _datasize - 1;
+ _crc = readSource();
+ _chunk32b = readSource();
+ _crc ^= _chunk32b;
do {
- if (!nextChunk(&uc)) {
- uc.size = 1;
- if (!nextChunk(&uc)) {
- unpackHelper1(&uc, 3, 0);
- } else {
- unpackHelper2(&uc, 8);
+ /*
+ Bits => Action:
+ 0 0 => unpackRawBytes(3 bits + 1) i.e. unpackRawBytes(1..9)
+ 1 1 1 => unpackRawBytes(8 bits + 9) i.e. unpackRawBytes(9..264)
+ 0 1 => copyRelocatedBytes(8 bits, 2) i.e. copyRelocatedBytes(0..255, 2)
+ 1 0 0 => copyRelocatedBytes(9 bits, 3) i.e. copyRelocatedBytes(0..511, 3)
+ 1 0 1 => copyRelocatedBytes(10 bits, 4) i.e. copyRelocatedBytes(0..1023, 4)
+ 1 1 0 => copyRelocatedBytes(12 bits, 8 bits + 1) i.e. copyRelocatedBytes(0..4095, 1..256)
+ */
+ if (!nextBit()) { // 0...
+ if (!nextBit()) { // 0 0
+ uint16 numBytes = getBits(3) + 1;
+ unpackRawBytes(numBytes);
+ } else { // 0 1
+ uint16 numBytes = 2;
+ uint16 offset = getBits(8);
+ copyRelocatedBytes(offset, numBytes);
}
- } else {
- uint16 c = getCode(&uc, 2);
- if (c == 3) {
- unpackHelper1(&uc, 8, 8);
- } else if (c < 2) {
- uc.size = c + 2;
- unpackHelper2(&uc, c + 9);
- } else {
- uc.size = getCode(&uc, 8);
- unpackHelper2(&uc, 12);
+ } else { // 1...
+ uint16 c = getBits(2);
+ if (c == 3) { // 1 1 1
+ uint16 numBytes = getBits(8) + 9;
+ unpackRawBytes(numBytes);
+ } else if (c < 2) { // 1 0 x
+ uint16 numBytes = c + 3;
+ uint16 offset = getBits(c + 9);
+ copyRelocatedBytes(offset, numBytes);
+ } else { // 1 1 0
+ uint16 numBytes = getBits(8) + 1;
+ uint16 offset = getBits(12);
+ copyRelocatedBytes(offset, numBytes);
}
}
- } while (uc.datasize > 0 && uc.src >= src - 4);
- return uc.crc == 0;
+ } while (_datasize > 0 && _src >= src - 4);
+ return _crc == 0;
}
} // End of namespace Cine
Modified: scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/unpack.h 2008-06-11 17:36:21 UTC (rev 32667)
@@ -31,8 +31,51 @@
namespace Cine {
-bool delphineUnpack(byte *dst, const byte *src, int len);
+/**
+ * A LZ77 style decompressor for Delphine's data files
+ * used in at least Future Wars and Operation Stealth.
+ * @note Works backwards in the source and destination buffers.
+ * @note Can work with source and destination in the same buffer if there's space.
+ */
+class CineUnpacker {
+public:
+ /** Returns true if unpacking was successful, otherwise false. */
+ bool unpack(byte *dst, const byte *src, int srcLen);
+private:
+ /** Reads a single big endian 32-bit integer from the source and goes backwards 4 bytes. */
+ uint32 readSource();
+ /**
+ * Shifts the current internal 32-bit chunk to the right by one.
+ * Puts input carry into internal chunk's topmost (i.e. leftmost) bit.
+ * Returns the least significant bit that was shifted out.
+ */
+ int rcr(int inputCarry);
+ int nextBit();
+ uint16 getBits(byte numBits);
+
+ /**
+ * Copy raw bytes from the input stream and write them to the destination stream.
+ * This is used when no adequately long match is found in the sliding window.
+ * @param numBytes Amount of bytes to copy from the input stream
+ */
+ void unpackRawBytes(uint16 numBytes);
+
+ /**
+ * Copy bytes from the sliding window in the destination buffer.
+ * This is used when a match of two bytes or longer is found.
+ * @param offset Offset in the sliding window
+ * @param numBytes Amount of bytes to copy
+ */
+ void copyRelocatedBytes(uint16 offset, uint16 numBytes);
+private:
+ int _datasize; //!< Bytes left to write into the unpacked data stream
+ uint32 _crc; //!< Error-detecting code
+ uint32 _chunk32b; //!< The current internal 32-bit chunk
+ byte *_dst; //!< Destination buffer pointer
+ const byte *_src; //!< Source buffer pointer
+};
+
} // End of namespace Cine
#endif
Copied: scummvm/branches/gsoc2008-rtl/engines/drascula/actors.cpp (from rev 32666, scummvm/trunk/engines/drascula/actors.cpp)
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/drascula/actors.cpp (rev 0)
+++ scummvm/branches/gsoc2008-rtl/engines/drascula/actors.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -0,0 +1,462 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "drascula/drascula.h"
+
+namespace Drascula {
+
+void DrasculaEngine::placeIgor() {
+ int pos_igor[6] = { 1, 0, igorX, igorY, 54, 61 };
+
+ if (currentChapter == 4) {
+ pos_igor[1] = 138;
+ } else {
+ if (trackIgor == 3)
+ pos_igor[1] = 138;
+ else if (trackIgor == 1)
+ pos_igor[1] = 76;
+ }
+
+ copyRectClip(pos_igor, frontSurface, screenSurface);
+}
+
+void DrasculaEngine::placeDrascula() {
+ int pos_dr[6] = { 0, 122, drasculaX, drasculaY, 45, 77 };
+
+ if (trackDrascula == 1)
+ pos_dr[0] = 47;
+ else if (trackDrascula == 0)
+ pos_dr[0] = 1;
+ else if (trackDrascula == 3 && currentChapter == 1)
+ pos_dr[0] = 93;
+
+ if (currentChapter == 6)
+ copyRectClip(pos_dr, drawSurface2, screenSurface);
+ else
+ copyRectClip(pos_dr, backSurface, screenSurface);
+}
+
+void DrasculaEngine::placeBJ() {
+ int pos_bj[6] = { 0, 99, bjX, bjY, 26, 76 };
+
+ if (trackBJ == 3)
+ pos_bj[0] = 10;
+ else if (trackBJ == 0)
+ pos_bj[0] = 37;
+
+ copyRectClip(pos_bj, drawSurface3, screenSurface);
+}
+
+void DrasculaEngine::hiccup(int counter) {
+ int y = 0, trackCharacter = 0;
+ if (currentChapter == 3)
+ y = -1;
+
+ do {
+ counter--;
+
+ updateRoom();
+ if (currentChapter == 3)
+ updateScreen(0, 0, 0, y, 320, 200, screenSurface);
+ else
+ updateScreen(0, 1, 0, y, 320, 198, screenSurface);
+
+ if (trackCharacter == 0)
+ y++;
+ else
+ y--;
+
+ if (currentChapter == 3) {
+ if (y == 1)
+ trackCharacter = 1;
+ if (y == -1)
+ trackCharacter = 0;
+ } else {
+ if (y == 2)
+ trackCharacter = 1;
+ if (y == 0)
+ trackCharacter = 0;
+ }
+ } while (counter > 0);
+
+ updateRoom();
+ updateScreen();
+}
+
+void DrasculaEngine::startWalking() {
+ characterMoved = 1;
+
+ stepX = STEP_X;
+ stepY = STEP_Y;
+
+ if (currentChapter == 2) {
+ if ((roomX < curX) && (roomY <= (curY + curHeight)))
+ quadrant_1();
+ else if ((roomX < curX) && (roomY > (curY + curHeight)))
+ quadrant_3();
+ else if ((roomX > curX + curWidth) && (roomY <= (curY + curHeight)))
+ quadrant_2();
+ else if ((roomX > curX + curWidth) && (roomY > (curY + curHeight)))
+ quadrant_4();
+ else if (roomY < curY + curHeight)
+ walkUp();
+ else if (roomY > curY + curHeight)
+ walkDown();
+ } else {
+ if ((roomX < curX + curWidth / 2 ) && (roomY <= (curY + curHeight)))
+ quadrant_1();
+ else if ((roomX < curX + curWidth / 2) && (roomY > (curY + curHeight)))
+ quadrant_3();
+ else if ((roomX > curX + curWidth / 2) && (roomY <= (curY + curHeight)))
+ quadrant_2();
+ else if ((roomX > curX + curWidth / 2) && (roomY > (curY + curHeight)))
+ quadrant_4();
+ else
+ characterMoved = 0;
+ }
+ startTime = getTime();
+}
+
+void DrasculaEngine::moveCharacters() {
+ int curPos[6];
+ int r;
+
+ if (characterMoved == 1 && stepX == STEP_X) {
+ for (r = 0; r < stepX; r++) {
+ if (currentChapter != 2) {
+ if (trackProtagonist == 0 && roomX - r == curX + curWidth / 2) {
+ characterMoved = 0;
+ stepX = STEP_X;
+ stepY = STEP_Y;
+ }
+ if (trackProtagonist == 1 && roomX + r == curX + curWidth / 2) {
+ characterMoved = 0;
+ stepX = STEP_X;
+ stepY = STEP_Y;
+ curX = roomX - curWidth / 2;
+ curY = roomY - curHeight;
+ }
+ } else if (currentChapter == 2) {
+ if (trackProtagonist == 0 && roomX - r == curX) {
+ characterMoved = 0;
+ stepX = STEP_X;
+ stepY = STEP_Y;
+ }
+ if (trackProtagonist == 1 && roomX + r == curX + curWidth) {
+ characterMoved = 0;
+ stepX = STEP_X;
+ stepY = STEP_Y;
+ curX = roomX - curWidth + 4;
+ curY = roomY - curHeight;
+ }
+ }
+ }
+ }
+ if (characterMoved == 1 && stepY == STEP_Y) {
+ for (r = 0; r < stepY; r++) {
+ if (trackProtagonist == 2 && roomY - r == curY + curHeight) {
+ characterMoved = 0;
+ stepX = STEP_X;
+ stepY = STEP_Y;
+ }
+ if (trackProtagonist == 3 && roomY + r == curY + curHeight) {
+ characterMoved = 0;
+ stepX = STEP_X;
+ stepY = STEP_Y;
+ }
+ }
+ }
+
+ if (currentChapter == 1 || currentChapter == 4 || currentChapter == 5 || currentChapter == 6) {
+ if (hare_se_ve == 0) {
+ increaseFrameNum();
+ return;
+ }
+ }
+
+ if (characterMoved == 0) {
+ curPos[0] = 0;
+ curPos[1] = DIF_MASK_HARE;
+ curPos[2] = curX;
+ curPos[3] = curY;
+ if (currentChapter == 2) {
+ curPos[4] = curWidth;
+ curPos[5] = curHeight;
+ } else {
+ curPos[4] = CHARACTER_WIDTH;
+ curPos[5] = CHARACTER_HEIGHT;
+ }
+
+ if (trackProtagonist == 0) {
+ curPos[1] = 0;
+ if (currentChapter == 2)
+ copyRectClip(curPos, extraSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], extraSurface, screenSurface);
+ } else if (trackProtagonist == 1) {
+ if (currentChapter == 2)
+ copyRectClip(curPos, extraSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], extraSurface, screenSurface);
+ } else if (trackProtagonist == 2) {
+ if (currentChapter == 2)
+ copyRectClip(curPos, backSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], backSurface, screenSurface);
+ } else {
+ if (currentChapter == 2)
+ copyRectClip(curPos, frontSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], frontSurface, screenSurface);
+ }
+ } else if (characterMoved == 1) {
+ curPos[0] = _frameX[num_frame];
+ curPos[1] = frame_y + DIF_MASK_HARE;
+ curPos[2] = curX;
+ curPos[3] = curY;
+ if (currentChapter == 2) {
+ curPos[4] = curWidth;
+ curPos[5] = curHeight;
+ } else {
+ curPos[4] = CHARACTER_WIDTH;
+ curPos[5] = CHARACTER_HEIGHT;
+ }
+ if (trackProtagonist == 0) {
+ curPos[1] = 0;
+ if (currentChapter == 2)
+ copyRectClip(curPos, extraSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], extraSurface, screenSurface);
+ } else if (trackProtagonist == 1) {
+ if (currentChapter == 2)
+ copyRectClip(curPos, extraSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], extraSurface, screenSurface);
+ } else if (trackProtagonist == 2) {
+ if (currentChapter == 2)
+ copyRectClip(curPos, backSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], backSurface, screenSurface);
+ } else {
+ if (currentChapter == 2)
+ copyRectClip(curPos, frontSurface, screenSurface);
+ else
+ reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ factor_red[curY + curHeight], frontSurface, screenSurface);
+ }
+ increaseFrameNum();
+ }
+}
+
+void DrasculaEngine::quadrant_1() {
+ float distanceX, distanceY;
+
+ if (currentChapter == 2)
+ distanceX = curX - roomX;
+ else
+ distanceX = curX + curWidth / 2 - roomX;
+
+ distanceY = (curY + curHeight) - roomY;
+
+ if (distanceX < distanceY) {
+ curDirection = 0;
+ trackProtagonist = 2;
+ stepX = (int)(distanceX / (distanceY / STEP_Y));
+ } else {
+ curDirection = 7;
+ trackProtagonist = 0;
+ stepY = (int)(distanceY / (distanceX / STEP_X));
+ }
+}
+
+void DrasculaEngine::quadrant_2() {
+ float distanceX, distanceY;
+
+ if (currentChapter == 2)
+ distanceX = abs(curX + curWidth - roomX);
+ else
+ distanceX = abs(curX + curWidth / 2 - roomX);
+
+ distanceY = (curY + curHeight) - roomY;
+
+ if (distanceX < distanceY) {
+ curDirection = 1;
+ trackProtagonist = 2;
+ stepX = (int)(distanceX / (distanceY / STEP_Y));
+ } else {
+ curDirection = 2;
+ trackProtagonist = 1;
+ stepY = (int)(distanceY / (distanceX / STEP_X));
+ }
+}
+
+void DrasculaEngine::quadrant_3() {
+ float distanceX, distanceY;
+
+ if (currentChapter == 2)
+ distanceX = curX - roomX;
+ else
+ distanceX = curX + curWidth / 2 - roomX;
+
+ distanceY = roomY - (curY + curHeight);
+
+ if (distanceX < distanceY) {
+ curDirection = 5;
+ trackProtagonist = 3;
+ stepX = (int)(distanceX / (distanceY / STEP_Y));
+ } else {
+ curDirection = 6;
+ trackProtagonist = 0;
+ stepY = (int)(distanceY / (distanceX / STEP_X));
+ }
+}
+
+void DrasculaEngine::quadrant_4() {
+ float distanceX, distanceY;
+
+ if (currentChapter == 2)
+ distanceX = abs(curX + curWidth - roomX);
+ else
+ distanceX = abs(curX + curWidth / 2 - roomX);
+
+ distanceY = roomY - (curY + curHeight);
+
+ if (distanceX < distanceY) {
+ curDirection = 4;
+ trackProtagonist = 3;
+ stepX = (int)(distanceX / (distanceY / STEP_Y));
+ } else {
+ curDirection = 3;
+ trackProtagonist = 1;
+ stepY = (int)(distanceY / (distanceX / STEP_X));
+ }
+}
+
+void DrasculaEngine::increaseFrameNum() {
+ timeDiff = getTime() - startTime;
+
+ if (timeDiff >= 6) {
+ startTime = getTime();
+ num_frame++;
+ if (num_frame == 6)
+ num_frame = 0;
+
+ if (curDirection == 0 || curDirection == 7) {
+ curX -= stepX;
+ curY -= stepY;
+ } else if (curDirection == 1 || curDirection == 2) {
+ curX += stepX;
+ curY -= stepY;
+ } else if (curDirection == 3 || curDirection == 4) {
+ curX += stepX;
+ curY += stepY;
+ } else if (curDirection == 5 || curDirection == 6) {
+ curX -= stepX;
+ curY += stepY;
+ }
+ }
+
+ if (currentChapter != 2) {
+ curY += (int)(curHeight - newHeight);
+ curX += (int)(curWidth - newWidth);
+ curHeight = (int)newHeight;
+ curWidth = (int)newWidth;
+ }
+}
+
+void DrasculaEngine::walkDown() {
+ curDirection = 4;
+ trackProtagonist = 3;
+ stepX = 0;
+}
+
+void DrasculaEngine::walkUp() {
+ curDirection = 0;
+ trackProtagonist = 2;
+ stepX = 0;
+}
+
+void DrasculaEngine::moveVonBraun() {
+ int pos_vb[6];
+
+ if (vonBraunHasMoved == 0) {
+ pos_vb[0] = 256;
+ pos_vb[1] = 129;
+ pos_vb[2] = vonBraunX;
+ pos_vb[3] = 66;
+ pos_vb[4] = 33;
+ pos_vb[5] = 69;
+ if (trackVonBraun == 0)
+ pos_vb[0] = 222;
+ else if (trackVonBraun == 1)
+ pos_vb[0] = 188;
+ } else {
+ pos_vb[0] = actorFrames[kFrameVonBraun];
+ pos_vb[1] = (trackVonBraun == 0) ? 62 : 131;
+ pos_vb[2] = vonBraunX;
+ pos_vb[3] = 66;
+ pos_vb[4] = 28;
+ pos_vb[5] = 68;
+
+ actorFrames[kFrameVonBraun] += 29;
+ if (actorFrames[kFrameVonBraun] > 146)
+ actorFrames[kFrameVonBraun] = 1;
+ }
+
+ copyRectClip(pos_vb, frontSurface, screenSurface);
+}
+
+void DrasculaEngine::placeVonBraun(int pointX) {
+ trackVonBraun = (pointX < vonBraunX) ? 0 : 1;
+ vonBraunHasMoved = 1;
+
+ for (;;) {
+ updateRoom();
+ updateScreen();
+ if (trackVonBraun == 0) {
+ vonBraunX = vonBraunX - 5;
+ if (vonBraunX <= pointX)
+ break;
+ } else {
+ vonBraunX = vonBraunX + 5;
+ if (vonBraunX >= pointX)
+ break;
+ }
+ pause(5);
+ }
+
+ vonBraunHasMoved = 0;
+}
+
+
+
+} // End of namespace Drascula
Modified: scummvm/branches/gsoc2008-rtl/engines/drascula/animation.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/drascula/animation.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/drascula/animation.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -44,7 +44,7 @@
for (int n = 0; n < count; n++) {
x++;
- copyBackground(px, py, px, py, width, height, drawSurface1, screenSurface);
+ copyBackground(px, py, px, py, width, height, bgSurface, screenSurface);
copyRect(x, y, px, py, width, height, src, screenSurface);
updateScreen(px, py, px, py, width, height, screenSurface);
x = x + width;
@@ -52,6 +52,7 @@
}
}
+// This is the game's introduction sequence
void DrasculaEngine::animation_1_1() {
int l, l2, p;
int pixelPos[6];
@@ -120,7 +121,7 @@
clearRoom();
loadPic(96, frontSurface, COMPLETE_PAL);
- loadPic(103, drawSurface1, HALF_PAL);
+ loadPic(103, bgSurface, HALF_PAL);
loadPic(104, drawSurface3);
loadPic("aux104.alg", drawSurface2);
@@ -133,7 +134,7 @@
for (l2 = 0; l2 < 3; l2++)
for (l = 0; l < 7; l++) {
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
copyBackground(interf_x[l], interf_y[l], 156, 45, 63, 31, drawSurface2, screenSurface);
updateScreen();
if (getScan() == Common::KEYCODE_ESCAPE) {
@@ -152,7 +153,7 @@
for (l = 0; l < 180; l++) {
copyBackground(0, 0, 320 - l, 0, l, 200, drawSurface3, screenSurface);
- copyBackground(l, 0, 0, 0, 320 - l, 200, drawSurface1, screenSurface);
+ copyBackground(l, 0, 0, 0, 320 - l, 200, bgSurface, screenSurface);
pixelPos[0] = interf_x[l2];
pixelPos[1] = interf_y[l2];
@@ -174,7 +175,7 @@
}
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
- copyBackground(0, 0, 0, 0, 320, 200, screenSurface, drawSurface1);
+ copyBackground(0, 0, 0, 0, 320, 200, screenSurface, bgSurface);
talk_dr_grande(1);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
@@ -182,24 +183,24 @@
clearRoom();
- loadPic(100, drawSurface1, HALF_PAL);
+ loadPic(100, bgSurface, HALF_PAL);
loadPic("auxigor.alg", frontSurface);
loadPic("auxdr.alg", backSurface);
trackDrascula = 0;
- x_dr = 129;
- y_dr = 95;
+ drasculaX = 129;
+ drasculaY = 95;
trackIgor = 1;
igorX = 66;
igorY = 97;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
talk_igor(8, kIgorDch);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
@@ -252,7 +253,7 @@
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
clearRoom();
- loadPic(100, drawSurface1, HALF_PAL);
+ loadPic(100, bgSurface, HALF_PAL);
MusicFadeout();
stopMusic();
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
@@ -296,13 +297,13 @@
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
trackDrascula = 3;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
pause(1);
trackDrascula = 0;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
@@ -310,13 +311,13 @@
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
trackDrascula = 3;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
pause(1);
trackDrascula = 1;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
@@ -328,13 +329,13 @@
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
trackDrascula = 3;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
pause(1);
trackDrascula = 0;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
placeIgor();
placeDrascula();
updateScreen();
@@ -381,6 +382,7 @@
loadPic(99, backSurface);
}
+// John falls in love with BJ, who is then abducted by Drascula
void DrasculaEngine::animation_2_1() {
int l;
@@ -448,7 +450,7 @@
break;
clearRoom();
- loadPic(16, drawSurface1, HALF_PAL);
+ loadPic(16, bgSurface, HALF_PAL);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
loadPic("auxbj.alg", drawSurface3);
@@ -461,8 +463,8 @@
break;
for (l = 0; l < 200; l++)
factor_red[l] = 99;
- x_bj = 170;
- y_bj = 90;
+ bjX = 170;
+ bjY = 90;
trackBJ = 0;
curX = 91;
curY = 95;
@@ -674,14 +676,14 @@
void DrasculaEngine::animation_2_2() {
trackProtagonist = 0;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
moveCharacters();
updateRefresh();
updateScreen();
loadPic("an2_1.alg", frontSurface);
loadPic("an2_2.alg", extraSurface);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
copyBackground(1, 1, 201, 87, 50, 52, frontSurface, screenSurface);
updateScreen();
@@ -695,7 +697,7 @@
updateAnim(55, 201, 87, 50, 52, 6, extraSurface);
updateAnim(109, 201, 87, 50, 52, 2, extraSurface);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
finishSound();
@@ -722,7 +724,7 @@
pause(8);
clearRoom();
- loadPic("ciego1.alg", drawSurface1, HALF_PAL); // ciego = blind
+ loadPic("ciego1.alg", bgSurface, HALF_PAL); // ciego = blind
loadPic("ciego2.alg", drawSurface3);
loadPic("ciego3.alg", extraSurface);
loadPic("ciego4.alg", backSurface);
@@ -731,37 +733,37 @@
if (_lang == kSpanish)
textSurface = frontSurface;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
pause(10);
talk_blind(1);
pause(5);
- talk_hacker(_textd[_lang][57], "d57.als");
+ talk_hacker(57);
pause(6);
talk_blind(2);
pause(4);
- talk_hacker(_textd[_lang][58],"d58.als");
+ talk_hacker(58);
talk_blind(3);
delay(14);
- talk_hacker(_textd[_lang][59],"d59.als");
+ talk_hacker(59);
talk_blind(4);
- talk_hacker(_textd[_lang][60],"d60.als");
+ talk_hacker(60);
talk_blind(5);
- talk_hacker(_textd[_lang][61],"d61.als");
+ talk_hacker(61);
talk_blind(6);
- talk_hacker(_textd[_lang][62],"d62.als");
+ talk_hacker(62);
talk_blind(7);
- talk_hacker(_textd[_lang][63],"d63.als");
+ talk_hacker(63);
talk_blind(8);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
_system->delayMillis(1000);
- talk_hacker(_textd[_lang][64], "d64.als");
+ talk_hacker(64);
talk_blind(9);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
pause(14);
@@ -769,7 +771,7 @@
clearRoom();
playMusic(roomMusic);
- loadPic(9, drawSurface1, HALF_PAL);
+ loadPic(9, bgSurface, HALF_PAL);
loadPic("aux9.alg", drawSurface3);
loadPic(96, frontSurface);
loadPic(97, extraSurface);
@@ -810,33 +812,26 @@
}
void DrasculaEngine::animation_14_2() {
- int n, pos_cabina[6];
+ int cabinPos[6] = { 150, 6, 69, -160, 158, 161 };
int l = 0;
loadPic("an14_2.alg", backSurface);
- pos_cabina[0] = 150;
- pos_cabina[1] = 6;
- pos_cabina[2] = 69;
- pos_cabina[3] = -160;
- pos_cabina[4] = 158;
- pos_cabina[5] = 161;
-
- for (n = -160; n <= 0; n = n + 5 + l) {
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ for (int n = -160; n <= 0; n = n + 5 + l) {
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateRefresh_pre();
moveCharacters();
- moveVB();
- pos_cabina[3] = n;
- copyRectClip(pos_cabina, backSurface, screenSurface);
+ moveVonBraun();
+ cabinPos[3] = n;
+ copyRectClip(cabinPos, backSurface, screenSurface);
updateRefresh();
updateScreen();
- l = l + 1;
+ l++;
}
flags[24] = 1;
- memcpy(drawSurface1, screenSurface, 64000);
+ memcpy(bgSurface, screenSurface, 64000);
playSound(7);
hiccup(15);
@@ -855,8 +850,6 @@
}
void DrasculaEngine::animation_16_2() {
- int l;
-
talk_drunk(12);
talk(371);
@@ -874,12 +867,12 @@
if (_lang != kSpanish)
color_abc(kColorDarkGreen);
- loadPic("his1.alg", drawSurface1, HALF_PAL);
+ loadPic("his1.alg", bgSurface, HALF_PAL);
if (_lang == kSpanish)
black();
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
if (_lang != kSpanish)
centerText(_texthis[_lang][1], 180, 180);
@@ -908,8 +901,8 @@
goto asco;
clearRoom();
- loadPic("his2.alg", drawSurface1, HALF_PAL);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ loadPic("his2.alg", bgSurface, HALF_PAL);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
if (_lang != kSpanish)
centerText(_texthis[_lang][2], 180, 180);
@@ -934,8 +927,8 @@
goto asco;
clearRoom();
- loadPic("his3.alg", drawSurface1, HALF_PAL);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ loadPic("his3.alg", bgSurface, HALF_PAL);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
if (_lang != kSpanish)
centerText(_texthis[_lang][3], 180, 180);
@@ -957,7 +950,7 @@
fadeToBlack(1);
clearRoom();
- loadPic("his4_1.alg", drawSurface1, HALF_PAL);
+ loadPic("his4_1.alg", bgSurface, HALF_PAL);
loadPic("his4_2.alg", drawSurface3);
copyBackground(0, 0, 0, 0, 320, 200, drawSurface3, screenSurface);
@@ -979,9 +972,9 @@
if (key != 0)
goto asco;
- for (l = 1; l < 200; l++) {
+ for (int l = 1; l < 200; l++) {
copyBackground(0, 0, 0, l, 320, 200 - l, drawSurface3, screenSurface);
- copyBackground(0, 200 - l, 0, 0, 320, l, drawSurface1, screenSurface);
+ copyBackground(0, 200 - l, 0, 0, 320, l, bgSurface, screenSurface);
updateScreen();
key = getScan();
if (key != 0)
@@ -994,7 +987,7 @@
asco:
loadPic(roomDisk, drawSurface3);
- loadPic(roomNumber, drawSurface1, HALF_PAL);
+ loadPic(roomNumber, bgSurface, HALF_PAL);
black();
updateRoom();
updateScreen();
@@ -1012,24 +1005,24 @@
}
void DrasculaEngine::animation_19_2() {
- talk_vbpuerta(5);
+ talk_vonBraunpuerta(5);
}
void DrasculaEngine::animation_20_2() {
- talk_vbpuerta(7);
- talk_vbpuerta(8);
+ talk_vonBraunpuerta(7);
+ talk_vonBraunpuerta(8);
talk(383);
- talk_vbpuerta(9);
+ talk_vonBraunpuerta(9);
talk(384);
- talk_vbpuerta(10);
+ talk_vonBraunpuerta(10);
talk(385);
- talk_vbpuerta(11);
+ talk_vonBraunpuerta(11);
if (flags[23] == 0) {
talk(350);
- talk_vbpuerta(57);
+ talk_vonBraunpuerta(57);
} else {
talk(386);
- talk_vbpuerta(12);
+ talk_vonBraunpuerta(12);
flags[18] = 0;
flags[14] = 1;
openDoor(15, 1);
@@ -1038,15 +1031,15 @@
exitRoom(0);
flags[21] = 0;
flags[24] = 0;
- trackVB = 1;
- vbX = 120;
+ trackVonBraun = 1;
+ vonBraunX = 120;
breakOut = 1;
}
}
void DrasculaEngine::animation_21_2() {
- talk_vbpuerta(6);
+ talk_vonBraunpuerta(6);
}
void DrasculaEngine::animation_23_2() {
@@ -1055,40 +1048,40 @@
flags[21] = 1;
if (flags[25] == 0) {
- talk_vb(13);
- talk_vb(14);
+ talk_vonBraun(13);
+ talk_vonBraun(14);
pause(10);
talk(387);
}
- talk_vb(15);
- placeVB(42);
- trackVB = 1;
- talk_vb(16);
- trackVB = 2;
+ talk_vonBraun(15);
+ placeVonBraun(42);
+ trackVonBraun = 1;
+ talk_vonBraun(16);
+ trackVonBraun = 2;
gotoObject(157, 147);
gotoObject(131, 149);
trackProtagonist = 0;
animation_14_2();
if (flags[25] == 0)
- talk_vb(17);
+ talk_vonBraun(17);
pause(8);
- trackVB = 1;
- talk_vb(18);
+ trackVonBraun = 1;
+ talk_vonBraun(18);
if (flags[29] == 0)
animation_23_joined();
else
animation_23_joined2();
- trackVB = 2;
+ trackVonBraun = 2;
animation_25_2();
- placeVB(99);
+ placeVonBraun(99);
if (flags[29] == 0) {
- talk_vb(19);
+ talk_vonBraun(19);
if (flags[25] == 0) {
- talk_vb(20);
+ talk_vonBraun(20);
if (removeObject(kItemMoney) == 0)
flags[30] = 1;
if (removeObject(kItemTwoCoins) == 0)
@@ -1096,7 +1089,7 @@
if (removeObject(kItemOneCoin) == 0)
flags[32] = 1;
}
- talk_vb(21);
+ talk_vonBraun(21);
} else
animation_27_2();
@@ -1105,7 +1098,7 @@
}
void DrasculaEngine::animation_23_joined() {
- int n, p_x = curX + 2, p_y = curY - 3;
+ int p_x = curX + 2, p_y = curY - 3;
int x[] = {1, 38, 75, 112, 75, 112, 75, 112, 149, 112, 149, 112, 149, 186, 223, 260,
1, 38, 75, 112, 149, 112, 149, 112, 149, 112, 149, 186, 223, 260, 260, 260, 260, 223};
int y[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 76, 76, 76, 76, 76, 76, 76,
@@ -1113,8 +1106,8 @@
loadPic("an23.alg", backSurface);
- for (n = 0; n < 34; n++) {
- copyRect(p_x, p_y, p_x, p_y, 36, 74, drawSurface1, screenSurface);
+ for (int n = 0; n < 34; n++) {
+ copyRect(p_x, p_y, p_x, p_y, 36, 74, bgSurface, screenSurface);
copyRect(x[n], y[n], p_x, p_y, 36, 74, backSurface, screenSurface);
updateRefresh();
updateScreen(p_x, p_y, p_x, p_y, 36, 74, screenSurface);
@@ -1125,7 +1118,7 @@
}
void DrasculaEngine::animation_23_joined2() {
- int n, p_x = curX + 4, p_y = curY;
+ int p_x = curX + 4, p_y = curY;
int x[] = {1, 35, 69, 103, 137, 171, 205, 239, 273, 1, 35, 69, 103, 137};
int y[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 73, 73, 73, 73, 73};
@@ -1133,8 +1126,8 @@
loadPic("an23_2.alg", backSurface);
- for (n = 0; n < 14; n++) {
- copyRect(p_x, p_y, p_x, p_y, 33, 71, drawSurface1, screenSurface);
+ for (int n = 0; n < 14; n++) {
+ copyRect(p_x, p_y, p_x, p_y, 33, 71, bgSurface, screenSurface);
copyRect(x[n], y[n], p_x, p_y, 33, 71, backSurface, screenSurface);
updateRefresh();
updateScreen(p_x,p_y, p_x,p_y, 33,71, screenSurface);
@@ -1145,32 +1138,25 @@
}
void DrasculaEngine::animation_25_2() {
- int n, pos_cabina[6];
+ int cabinPos[6] = { 150, 6, 69, 0, 158, 161 };
loadPic("an14_2.alg", backSurface);
- loadPic(18, drawSurface1);
+ loadPic(18, bgSurface);
- pos_cabina[0] = 150;
- pos_cabina[1] = 6;
- pos_cabina[2] = 69;
- pos_cabina[3] = 0;
- pos_cabina[4] = 158;
- pos_cabina[5] = 161;
-
flags[24] = 0;
playSound(6);
- for (n = 0; n >= -160; n = n - 8) {
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ for (int n = 0; n >= -160; n = n - 8) {
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateRefresh_pre();
moveCharacters();
- moveVB();
+ moveVonBraun();
- pos_cabina[3] = n;
+ cabinPos[3] = n;
- copyRectClip(pos_cabina, backSurface, screenSurface);
+ copyRectClip(cabinPos, backSurface, screenSurface);
updateRefresh();
updateScreen();
@@ -1188,46 +1174,46 @@
removeObject(kItemEarWithEarPlug);
addObject(kItemEarplugs);
- talk_vb(23);
- talk_vb(24);
+ talk_vonBraun(23);
+ talk_vonBraun(24);
if (flags[30] == 1)
addObject(kItemMoney);
if (flags[31] == 1)
addObject(kItemTwoCoins);
if (flags[32] == 1)
addObject(kItemOneCoin);
- talk_vb(25);
- talk_vb(26);
+ talk_vonBraun(25);
+ talk_vonBraun(26);
}
void DrasculaEngine::animation_28_2() {
for(int i = 27; i <= 30; i++)
- talk_vb(i);
+ talk_vonBraun(i);
}
void DrasculaEngine::animation_29_2() {
if (flags[33] == 0) {
- talk_vb(32);
+ talk_vonBraun(32);
talk(398);
- talk_vb(33);
+ talk_vonBraun(33);
talk(399);
- talk_vb(34);
- talk_vb(35);
+ talk_vonBraun(34);
+ talk_vonBraun(35);
talk(400);
- talk_vb(36);
- talk_vb(37);
+ talk_vonBraun(36);
+ talk_vonBraun(37);
talk(386);
- talk_vb(38);
- talk_vb(39);
+ talk_vonBraun(38);
+ talk_vonBraun(39);
talk(401);
- talk_vb(40);
- talk_vb(41);
+ talk_vonBraun(40);
+ talk_vonBraun(41);
flags[33] = 1;
} else
- talk_vb(43);
+ talk_vonBraun(43);
talk(402);
- talk_vb(42);
+ talk_vonBraun(42);
if (flags[38] == 0) {
talk(403);
@@ -1237,13 +1223,13 @@
}
void DrasculaEngine::animation_30_2() {
- talk_vb(31);
+ talk_vonBraun(31);
talk(396);
}
void DrasculaEngine::animation_31_2() {
- talk_vb(44);
- placeVB(-50);
+ talk_vonBraun(44);
+ placeVonBraun(-50);
pause(15);
gotoObject(159, 140);
loadPic(99, backSurface);
@@ -1256,24 +1242,24 @@
updateScreen();
pause(22);
talk(406);
- placeVB(98);
- talk_vb(45);
- talk_vb(46);
- talk_vb(47);
+ placeVonBraun(98);
+ talk_vonBraun(45);
+ talk_vonBraun(46);
+ talk_vonBraun(47);
talk(407);
- talk_vb(48);
- talk_vb(49);
+ talk_vonBraun(48);
+ talk_vonBraun(49);
talk(408);
- talk_vb(50);
- talk_vb(51);
+ talk_vonBraun(50);
+ talk_vonBraun(51);
talk(409);
- talk_vb(52);
- talk_vb(53);
+ talk_vonBraun(52);
+ talk_vonBraun(53);
pause(12);
- talk_vb(54);
- talk_vb(55);
+ talk_vonBraun(54);
+ talk_vonBraun(55);
talk(410);
- talk_vb(56);
+ talk_vonBraun(56);
breakOut = 1;
@@ -1303,7 +1289,7 @@
updateAnim(1, 70, 90, 46, 80, 6, frontSurface);
updateAnim(82, 70, 90, 46, 80, 2, frontSurface);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
@@ -1406,7 +1392,7 @@
for (frame = 0; frame < 6; frame++) {
pause(3);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
copyRect(yoda_x[frame], yoda_y[frame], px, py, 78, 90, frontSurface, screenSurface);
updateScreen(px, py, px, py, 78, 90, screenSurface);
}
@@ -1423,7 +1409,7 @@
loadPic("anr_1.alg", frontSurface, HALF_PAL);
loadPic("anr_2.alg", extraSurface);
loadPic("anr_3.alg", backSurface);
- loadPic("anr_4.alg", drawSurface1);
+ loadPic("anr_4.alg", bgSurface);
loadPic("anr_5.alg", drawSurface3);
updateScreen(0, 0, 0, 0, 320, 200, frontSurface);
@@ -1436,7 +1422,7 @@
pause(3);
updateScreen(0, 0, 0, 0, 320, 200, backSurface);
pause(3);
- updateScreen(0, 0, 0, 0, 320, 200, drawSurface1);
+ updateScreen(0, 0, 0, 0, 320, 200, bgSurface);
pause(3);
updateScreen(0, 0, 0, 0, 320, 200, backSurface);
pause(3);
@@ -1537,20 +1523,20 @@
updateRoom();
updateScreen();
talk(228);
- talk_wolf(1);
- talk_wolf(2);
+ talk_werewolf(1);
+ talk_werewolf(2);
pause(23);
talk(229);
- talk_wolf(3);
- talk_wolf(4);
+ talk_werewolf(3);
+ talk_werewolf(4);
talk(230);
- talk_wolf(5);
+ talk_werewolf(5);
talk(231);
- talk_wolf(6);
- talk_wolf(7);
+ talk_werewolf(6);
+ talk_werewolf(7);
pause(33);
talk(232);
- talk_wolf(8);
+ talk_werewolf(8);
}
void DrasculaEngine::animation_5_5(){
@@ -1574,7 +1560,7 @@
for (frame = 0; frame < 9; frame++) {
pause(3);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, backSurface, screenSurface);
updateScreen(pixelX, pixelY, pixelX,pixelY, 97,64, screenSurface);
}
@@ -1584,7 +1570,7 @@
for (frame = 0; frame < 9; frame++) {
pause(3);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, frontSurface, screenSurface);
updateScreen(pixelX, pixelY, pixelX,pixelY, 97, 64, screenSurface);
}
@@ -1599,11 +1585,11 @@
updateScreen();
- loadPic(101, drawSurface1, HALF_PAL);
+ loadPic(101, bgSurface, HALF_PAL);
loadPic("3an5_3.alg", backSurface);
loadPic("3an5_4.alg", extraSurface);
- updateScreen(0, 0, 0, 0, 320, 200, drawSurface1);
+ updateScreen(0, 0, 0, 0, 320, 200, bgSurface);
pause(9);
for (frame = 0; frame < 5; frame++) {
pause(3);
@@ -1615,7 +1601,7 @@
copyBackground(flyX[frame], 1, 174, 79, 61, 109, extraSurface, screenSurface);
updateScreen(174, 79, 174, 79, 61, 109, screenSurface);
}
- updateScreen(0, 0, 0, 0, 320, 200, drawSurface1);
+ updateScreen(0, 0, 0, 0, 320, 200, bgSurface);
playSound(1);
finishSound();
@@ -1625,28 +1611,28 @@
clearRoom();
- loadPic(49, drawSurface1, HALF_PAL);
+ loadPic(49, bgSurface, HALF_PAL);
}
void DrasculaEngine::animation_6_5() {
- talk_wolf(9);
+ talk_werewolf(9);
talk(234);
}
void DrasculaEngine::animation_7_5() {
- talk_wolf(10);
+ talk_werewolf(10);
talk(236);
- talk_wolf(11);
- talk_wolf(12);
- talk_wolf(13);
+ talk_werewolf(11);
+ talk_werewolf(12);
+ talk_werewolf(13);
pause(34);
- talk_wolf(14);
+ talk_werewolf(14);
}
void DrasculaEngine::animation_8_5() {
- talk_wolf(15);
+ talk_werewolf(15);
talk(238);
- talk_wolf(16);
+ talk_werewolf(16);
}
void DrasculaEngine::animation_9_5() {
@@ -1705,22 +1691,16 @@
bgPalette3[color][component] = gamePalette[color][component];
}
- for (fade = 1; fade >= 0; fade--) {
- for (color = 0; color < 128; color++)
- for (component = 0; component < 3; component++)
- bgPalette1[color][component] = adjustToVGA(bgPalette1[color][component] - 8 + fade);
- }
-
- for (fade = 2; fade >= 0; fade--) {
- for (color = 0; color < 128; color++)
- for (component = 0; component < 3; component++)
- bgPalette2[color][component] = adjustToVGA(bgPalette2[color][component] - 8 + fade);
- }
-
for (fade = 3; fade >= 0; fade--) {
- for (color = 0; color < 128; color++)
- for (component = 0; component < 3; component++)
+ for (color = 0; color < 128; color++) {
+ for (component = 0; component < 3; component++) {
bgPalette3[color][component] = adjustToVGA(bgPalette3[color][component] - 8 + fade);
+ if (fade <= 2)
+ bgPalette2[color][component] = adjustToVGA(bgPalette2[color][component] - 8 + fade);
+ if (fade <= 1)
+ bgPalette1[color][component] = adjustToVGA(bgPalette1[color][component] - 8 + fade);
+ }
+ }
}
loadPic("3an11_1.alg", backSurface);
@@ -1790,16 +1770,10 @@
int frame = 0;
int frus_x[] = {1, 46, 91, 136, 181, 226, 271};
int frus_y[] = {1, 1, 1, 1, 1, 1, 1, 89};
- int pos_frusky[6];
+ int pos_frusky[6] = { 1, 1, frank_x, 81, 44, 87 };
loadPic("auxfr.alg", backSurface);
- pos_frusky[3] = 81;
- pos_frusky[4] = 44;
- pos_frusky[5] = 87;
- pos_frusky[0] = 1;
- pos_frusky[1] = 1;
- pos_frusky[2] = frank_x;
updateRoom();
copyRectClip(pos_frusky, backSurface, screenSurface);
updateScreen();
@@ -1814,7 +1788,7 @@
pos_frusky[2] = frank_x;
copyRectClip( pos_frusky, backSurface, screenSurface);
updateScreen();
- frank_x = frank_x - 5;
+ frank_x -= 5;
frame++;
if (frank_x <= -45)
break;
@@ -1866,13 +1840,11 @@
}
void DrasculaEngine::animation_1_6() {
- int l;
-
trackProtagonist = 0;
curX = 103;
curY = 108;
flags[0] = 1;
- for (l = 0; l < 200; l++)
+ for (int l = 0; l < 200; l++)
factor_red[l] = 98;
loadPic("auxig2.alg", frontSurface);
@@ -1954,19 +1926,12 @@
}
void DrasculaEngine::animation_5_6() {
- int n, pos_pen[6];
+ int pos_pen[6] = { 1, 29, 204, -125, 18, 125 };
- pos_pen[0] = 1;
- pos_pen[1] = 29;
- pos_pen[2] = 204;
- pos_pen[3] = -125;
- pos_pen[4] = 18;
- pos_pen[5] = 125;
-
animate("man.bin", 14);
- for (n = -125; n <= 0; n = n + 2) {
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ for (int n = -125; n <= 0; n = n + 2) {
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateRefresh_pre();
pos_pen[3] = n;
copyRectClip(pos_pen, drawSurface3, screenSurface);
@@ -2029,7 +1994,7 @@
// Also check animation_2_1(), where the same hack was used
// by the original
roomNumber = -1;
- loadPic("nota2.alg", drawSurface1, HALF_PAL);
+ loadPic("nota2.alg", bgSurface, HALF_PAL);
black();
trackProtagonist = 1;
curX -= 21;
@@ -2043,7 +2008,7 @@
updateScreen();
playMusic(9);
clearRoom();
- loadPic("nota.alg", drawSurface1, COMPLETE_PAL);
+ loadPic("nota.alg", bgSurface, COMPLETE_PAL);
color_abc(kColorWhite);
talk_solo(_textbj[_lang][24], "bj24.als");
talk_solo(_textbj[_lang][25], "bj25.als");
@@ -2053,7 +2018,7 @@
trackProtagonist = 3;
clearRoom();
loadPic(96, frontSurface, COMPLETE_PAL);
- loadPic("nota2.alg", drawSurface1, HALF_PAL);
+ loadPic("nota2.alg", bgSurface, HALF_PAL);
talk(296);
talk(297);
talk(298);
@@ -2061,17 +2026,17 @@
talk(299);
talk(300);
updateRoom();
- copyBackground(0, 0, 0, 0, 320, 200, screenSurface, drawSurface1);
+ copyBackground(0, 0, 0, 0, 320, 200, screenSurface, bgSurface);
updateScreen();
color_abc(kColorLightGreen);
- talk_solo("GOOOOOOOOOOOOOOOL", "s15.als");
- loadPic("nota2.alg", drawSurface1);
+ talk_solo(_textmisc[_lang][2], "s15.als");
+ loadPic("nota2.alg", bgSurface);
trackProtagonist = 0;
updateRoom();
updateScreen();
talk(301);
v_cd = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16;
- v_cd = v_cd + 4;
+ v_cd += 4;
playMusic(17);
fadeToBlack(1);
clearRoom();
@@ -2087,7 +2052,7 @@
void DrasculaEngine::animation_10_6() {
playSound(14);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateRefresh_pre();
copyBackground(164, 85, 155, 48, 113, 114, drawSurface3, screenSurface);
updateScreen();
@@ -2132,7 +2097,7 @@
}
void DrasculaEngine::animation_19_6() {
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
copyBackground(140, 23, 161, 69, 35, 80, drawSurface3, screenSurface);
updateRefresh_pre();
@@ -2289,7 +2254,7 @@
void DrasculaEngine::animation_18_2() {
talk(378);
- talk_vbpuerta(4);
+ talk_vonBraunpuerta(4);
converse(3);
}
@@ -2303,11 +2268,11 @@
finishSound();
trackProtagonist = 1;
- talk_vbpuerta(1);
+ talk_vonBraunpuerta(1);
talk(375);
- talk_vbpuerta(2);
+ talk_vonBraunpuerta(2);
talk(376);
- talk_vbpuerta(3);
+ talk_vonBraunpuerta(3);
flags[18] = 1;
}
@@ -2328,7 +2293,7 @@
flags[21] = 1;
- talk_vb(22);
+ talk_vonBraun(22);
if (flags[22] == 0)
converse(4);
@@ -2338,8 +2303,8 @@
exitRoom(0);
flags[21] = 0;
flags[24] = 0;
- trackVB = 1;
- vbX = 120;
+ trackVonBraun = 1;
+ vonBraunX = 120;
}
void DrasculaEngine::animation_32_2() {
@@ -2416,9 +2381,9 @@
loadPic("an7_3.alg", frontSurface);
if (flags[3] == 1)
- copyBackground(258, 110, 85, 44, 23, 53, drawSurface3, drawSurface1);
+ copyBackground(258, 110, 85, 44, 23, 53, drawSurface3, bgSurface);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
@@ -2451,7 +2416,7 @@
updateAnim2(75, 80, 64, 51, 73, 6, backSurface);
updateAnim2(1, 80, 64, 51, 73, 6, extraSurface);
- copyBackground(80, 64, 80, 64, 51, 73, drawSurface1, screenSurface);
+ copyBackground(80, 64, 80, 64, 51, 73, bgSurface, screenSurface);
copyRect(1, 75, 80, 64, 51, 73, extraSurface, screenSurface);
updateScreen(80, 64, 80, 64, 51, 73, screenSurface);
@@ -2510,25 +2475,25 @@
textSurface = frontSurface;
clearRoom();
- loadPic("ciego1.alg", drawSurface1, HALF_PAL); // ciego = blind
+ loadPic("ciego1.alg", bgSurface, HALF_PAL); // ciego = blind
loadPic("ciego2.alg", drawSurface3);
loadPic("ciego3.alg", extraSurface);
loadPic("ciego4.alg", backSurface);
loadPic("ciego5.alg", frontSurface);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
pause(1);
if (flags[4] == 1)
- talk_hacker(_textd[_lang][66], "d66.als");
+ talk_hacker(66);
pause(6);
talk_blind(11);
pause(4);
- talk_hacker(_textd[_lang][67], "d67.als");
+ talk_hacker(67);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
pause(10);
@@ -2536,7 +2501,7 @@
clearRoom();
playMusic(roomMusic);
- loadPic(9, drawSurface1, HALF_PAL);
+ loadPic(9, bgSurface, HALF_PAL);
loadPic("aux9.alg", drawSurface3);
loadPic(96, frontSurface);
loadPic(97, extraSurface);
@@ -2558,7 +2523,7 @@
pause(8);
clearRoom();
- loadPic("ciego1.alg", drawSurface1, HALF_PAL); // ciego = blind
+ loadPic("ciego1.alg", bgSurface, HALF_PAL); // ciego = blind
loadPic("ciego2.alg", drawSurface3);
loadPic("ciego3.alg", extraSurface);
loadPic("ciego4.alg", backSurface);
@@ -2567,20 +2532,20 @@
if (_lang == kSpanish)
textSurface = frontSurface;
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
pause(10);
talk_blind(1);
pause(5);
- talk_hacker(_textd[_lang][57], "d57.als");
+ talk_hacker(57);
pause(6);
_system->delayMillis(1000);
talk_blind(10);
- talk_hacker(_textd[_lang][65], "d65.als");
+ talk_hacker(65);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
updateScreen();
pause(14);
@@ -2588,7 +2553,7 @@
clearRoom();
playMusic(roomMusic);
- loadPic(9, drawSurface1, HALF_PAL);
+ loadPic(9, bgSurface, HALF_PAL);
loadPic("aux9.alg", drawSurface3);
loadPic(96, frontSurface);
loadPic(97, extraSurface);
@@ -2691,10 +2656,10 @@
roomNumber = 26;
clearRoom();
- loadPic(26, drawSurface1, HALF_PAL);
+ loadPic(26, bgSurface, HALF_PAL);
loadPic("aux26.alg", drawSurface3);
loadPic("auxigor.alg", frontSurface);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
update_26_pre();
igorX = 104;
igorY = 71;
@@ -2706,21 +2671,20 @@
clearRoom();
loadPic(96, frontSurface);
loadPic(roomDisk, drawSurface3);
- loadPic(roomNumber, drawSurface1, HALF_PAL);
+ loadPic(roomNumber, bgSurface, HALF_PAL);
withoutVerb();
updateRoom();
}
void DrasculaEngine::animation_8_4() {
- int frame;
- int estanteria_x[] = {1, 75, 149, 223, 1, 75, 149, 223, 149, 223, 149, 223, 149, 223};
- int estanteria_y[] = {1, 1, 1, 1, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74};
+ int bookcaseX[] = {1, 75, 149, 223, 1, 75, 149, 223, 149, 223, 149, 223, 149, 223};
+ int bookcaseY[] = {1, 1, 1, 1, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74};
loadPic("an_8.alg", frontSurface);
- for (frame = 0; frame < 14; frame++) {
+ for (int frame = 0; frame < 14; frame++) {
pause(2);
- copyBackground(estanteria_x[frame], estanteria_y[frame], 77, 45, 73, 72, frontSurface, screenSurface);
+ copyBackground(bookcaseX[frame], bookcaseY[frame], 77, 45, 73, 72, frontSurface, screenSurface);
updateScreen(77, 45, 77, 45, 73, 72, screenSurface);
}
@@ -2733,5 +2697,18 @@
fadeToBlack(1);
}
+void DrasculaEngine::activatePendulum() {
+ flags[1] = 2;
+ hare_se_ve = 0;
+ roomNumber = 102;
+ loadPic(102, bgSurface, HALF_PAL);
+ loadPic("an_p1.alg", drawSurface3);
+ loadPic("an_p2.alg", extraSurface);
+ loadPic("an_p3.alg", frontSurface);
+ copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3);
+
+ savedTime = getTime();
+}
+
} // End of namespace Drascula
Copied: scummvm/branches/gsoc2008-rtl/engines/drascula/converse.cpp (from rev 32666, scummvm/trunk/engines/drascula/converse.cpp)
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/drascula/converse.cpp (rev 0)
+++ scummvm/branches/gsoc2008-rtl/engines/drascula/converse.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -0,0 +1,297 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "drascula/drascula.h"
+
+namespace Drascula {
+
+void DrasculaEngine::converse(int index) {
+ char fileName[20];
+ sprintf(fileName, "op_%d.cal", index);
+ uint h;
+ int game1 = 1, game2 = 1, game3 = 1, game4 = 1;
+ char phrase1[78];
+ char phrase2[78];
+ char phrase3[87];
+ char phrase4[78];
+ char sound1[13];
+ char sound2[13];
+ char sound3[13];
+ char sound4[13];
+ int answer1;
+ int answer2;
+ int answer3;
+ int used1 = 0;
+ int used2 = 0;
+ int used3 = 0;
+ char buffer[256];
+ uint len;
+
+ breakOut = 0;
+
+ if (currentChapter == 5)
+ withoutVerb();
+
+ _arj.open(fileName);
+ if (!_arj.isOpen()) {
+ error("missing data file %s", fileName);
+ }
+ int size = _arj.size();
+
+ getStringFromLine(buffer, size, phrase1);
+ getStringFromLine(buffer, size, phrase2);
+ getStringFromLine(buffer, size, phrase3);
+ getStringFromLine(buffer, size, phrase4);
+ getStringFromLine(buffer, size, sound1);
+ getStringFromLine(buffer, size, sound2);
+ getStringFromLine(buffer, size, sound3);
+ getStringFromLine(buffer, size, sound4);
+ getIntFromLine(buffer, size, &answer1);
+ getIntFromLine(buffer, size, &answer2);
+ getIntFromLine(buffer, size, &answer3);
+
+ _arj.close();
+
+ if (currentChapter == 2 && !strcmp(fileName, "op_5.cal") && flags[38] == 1 && flags[33] == 1) {
+ strcpy(phrase3, _text[_lang][405]);
+ strcpy(sound3, "405.als");
+ answer3 = 31;
+ }
+
+ if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[7] == 1) {
+ strcpy(phrase3, _text[_lang][273]);
+ strcpy(sound3, "273.als");
+ answer3 = 14;
+ }
+
+ if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[10] == 1) {
+ strcpy(phrase3, _text[_lang][274]);
+ strcpy(sound3, "274.als");
+ answer3 = 15;
+ }
+
+ len = strlen(phrase1);
+ for (h = 0; h < len; h++)
+ if (phrase1[h] == (char)0xa7)
+ phrase1[h] = ' ';
+
+ len = strlen(phrase2);
+ for (h = 0; h < len; h++)
+ if (phrase2[h] == (char)0xa7)
+ phrase2[h] = ' ';
+
+ len = strlen(phrase3);
+ for (h = 0; h < len; h++)
+ if (phrase3[h] == (char)0xa7)
+ phrase3[h] = ' ';
+
+ len = strlen(phrase4);
+ for (h = 0; h < len; h++)
+ if (phrase4[h] == (char)0xa7)
+ phrase4[h] = ' ';
+
+ loadPic("car.alg", backSurface);
+ // TODO code here should limit y position for mouse in dialog menu,
+ // but we can't implement this due lack backend functionality
+ // from 1(top) to 31
+ color_abc(kColorLightGreen);
+
+ while (breakOut == 0) {
+ updateRoom();
+
+ if (currentChapter == 1 || currentChapter == 4 || currentChapter == 6) {
+ if (musicStatus() == 0 && flags[11] == 0)
+ playMusic(roomMusic);
+ } else if (currentChapter == 2) {
+ if (musicStatus() == 0 && flags[11] == 0 && roomMusic != 0)
+ playMusic(roomMusic);
+ } else if (currentChapter == 3 || currentChapter == 5) {
+ if (musicStatus() == 0)
+ playMusic(roomMusic);
+ }
+
+ updateEvents();
+
+ if (mouseY > 0 && mouseY < 9) {
+ if (used1 == 1 && _color != kColorWhite)
+ color_abc(kColorWhite);
+ else if (used1 == 0 && _color != kColorLightGreen)
+ color_abc(kColorLightGreen);
+ } else if (mouseY > 8 && mouseY < 17) {
+ if (used2 == 1 && _color != kColorWhite)
+ color_abc(kColorWhite);
+ else if (used2 == 0 && _color != kColorLightGreen)
+ color_abc(kColorLightGreen);
+ } else if (mouseY > 16 && mouseY < 25) {
+ if (used3 == 1 && _color != kColorWhite)
+ color_abc(kColorWhite);
+ else if (used3 == 0 && _color != kColorLightGreen)
+ color_abc(kColorLightGreen);
+ } else if (_color != kColorLightGreen)
+ color_abc(kColorLightGreen);
+
+ if (mouseY > 0 && mouseY < 9)
+ game1 = 2;
+ else if (mouseY > 8 && mouseY < 17)
+ game2 = 2;
+ else if (mouseY > 16 && mouseY < 25)
+ game3 = 2;
+ else if (mouseY > 24 && mouseY < 33)
+ game4 = 2;
+
+ print_abc_opc(phrase1, 1, 2, game1);
+ print_abc_opc(phrase2, 1, 10, game2);
+ print_abc_opc(phrase3, 1, 18, game3);
+ print_abc_opc(phrase4, 1, 26, game4);
+
+ updateScreen();
+
+ if ((leftMouseButton == 1) && (game1 == 2)) {
+ delay(100);
+ used1 = 1;
+ talk(phrase1, sound1);
+ if (currentChapter == 3)
+ grr();
+ else
+ response(answer1);
+ } else if ((leftMouseButton == 1) && (game2 == 2)) {
+ delay(100);
+ used2 = 1;
+ talk(phrase2, sound2);
+ if (currentChapter == 3)
+ grr();
+ else
+ response(answer2);
+ } else if ((leftMouseButton == 1) && (game3 == 2)) {
+ delay(100);
+ used3 = 1;
+ talk(phrase3, sound3);
+ if (currentChapter == 3)
+ grr();
+ else
+ response(answer3);
+ } else if ((leftMouseButton == 1) && (game4 == 2)) {
+ delay(100);
+ talk(phrase4, sound4);
+ breakOut = 1;
+ }
+
+ if (leftMouseButton == 1) {
+ delay(100);
+ color_abc(kColorLightGreen);
+ }
+
+ game1 = (used1 == 0) ? 1 : 3;
+ game2 = (used2 == 0) ? 1 : 3;
+ game3 = (used3 == 0) ? 1 : 3;
+ game4 = 1;
+ } // while (breakOut == 0)
+
+ if (currentChapter == 2)
+ loadPic(menuBackground, backSurface);
+ else
+ loadPic(99, backSurface);
+ if (currentChapter != 5)
+ withoutVerb();
+}
+
+void DrasculaEngine::response(int function) {
+ if (currentChapter == 1) {
+ if (function >= 10 && function <= 12)
+ talk_drunk(function - 9);
+ } else if (currentChapter == 2) {
+ if (function == 8)
+ animation_8_2();
+ else if (function == 9)
+ animation_9_2();
+ else if (function == 10)
+ animation_10_2();
+ else if (function == 15)
+ animation_15_2();
+ else if (function == 16)
+ animation_16_2();
+ else if (function == 17)
+ animation_17_2();
+ else if (function == 19)
+ animation_19_2();
+ else if (function == 20)
+ animation_20_2();
+ else if (function == 21)
+ animation_21_2();
+ else if (function == 23)
+ animation_23_2();
+ else if (function == 28)
+ animation_28_2();
+ else if (function == 29)
+ animation_29_2();
+ else if (function == 30)
+ animation_30_2();
+ else if (function == 31)
+ animation_31_2();
+ } else if (currentChapter == 4) {
+ if (function == 2)
+ animation_2_4();
+ else if (function == 3)
+ animation_3_4();
+ else if (function == 4)
+ animation_4_4();
+ } else if (currentChapter == 5) {
+ if (function == 2)
+ animation_2_5();
+ else if (function == 3)
+ animation_3_5();
+ else if (function == 6)
+ animation_6_5();
+ else if (function == 7)
+ animation_7_5();
+ else if (function == 8)
+ animation_8_5();
+ else if (function == 15)
+ animation_15_5();
+ else if (function == 16)
+ animation_16_5();
+ else if (function == 17)
+ animation_17_5();
+ } else if (currentChapter == 6) {
+ if (function == 2)
+ animation_2_6();
+ else if (function == 3)
+ animation_3_6();
+ else if (function == 4)
+ animation_4_6();
+ else if (function == 11)
+ animation_11_6();
+ else if (function == 12)
+ animation_12_6();
+ else if (function == 13)
+ animation_13_6();
+ else if (function == 14)
+ animation_14_6();
+ else if (function == 15)
+ animation_15_6();
+ }
+}
+
+} // End of namespace Drascula
Modified: scummvm/branches/gsoc2008-rtl/engines/drascula/drascula.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/drascula/drascula.cpp 2008-06-11 11:29:34 UTC (rev 32666)
+++ scummvm/branches/gsoc2008-rtl/engines/drascula/drascula.cpp 2008-06-11 17:36:21 UTC (rev 32667)
@@ -70,6 +70,37 @@
DrasculaEngine::~DrasculaEngine() {
delete _rnd;
+
+ free(_charMap);
+ free(_itemLocations);
+ free(_polX);
+ free(_polY);
+ free(_verbBarX);
+ free(_x1d_menu);
+ free(_y1d_menu);
+ free(_frameX);
+ free(_candleX);
+ free(_candleY);
+ free(_pianistX);
+ free(_drunkX);
+ free(_roomPreUpdates);
+ free(_roomUpdates);
+ free(_roomActions);
+ freeTexts(_text);
+ freeTexts(_textd);
+ freeTexts(_textb);
+ freeTexts(_textbj);
+ freeTexts(_texte);
+ freeTexts(_texti);
+ freeTexts(_textl);
+ freeTexts(_textp);
+ freeTexts(_textt);
+ freeTexts(_textvb);
+ freeTexts(_textsys);
+ freeTexts(_texthis);
+ freeTexts(_textverbs);
+ freeTexts(_textmisc);
+ freeTexts(_textd1);
}
int DrasculaEngine::init() {
@@ -100,6 +131,40 @@
_lang = 0;
}
+ _charMap = 0;
+ _itemLocations = 0;
+ _polX = 0;
+ _polY = 0;
+ _verbBarX = 0;
+ _x1d_menu = 0;
+ _y1d_menu = 0;
+ _frameX = 0;
+ _candleX = 0;
+ _candleY = 0;
+ _pianistX = 0;
+ _drunkX = 0;
+ _roomPreUpdates = 0;
+ _roomUpdates = 0;
+ _roomActions = 0;
+ _text = 0;
+ _textd = 0;
+ _textb = 0;
+ _textbj = 0;
+ _texte = 0;
+ _texti = 0;
+ _textl = 0;
+ _textp = 0;
+ _textt = 0;
+ _textvb = 0;
+ _textsys = 0;
+ _texthis = 0;
+ _textverbs = 0;
+ _textmisc = 0;
+ _textd1 = 0;
+
+ if (!loadDrasculaDat())
+ return 1;
+
setupRoomsTable();
loadArchives();
@@ -130,22 +195,21 @@
savedTime = 0;
changeColor = 0;
breakOut = 0;
- vbX = 120; trackVB = 1; vbHasMoved = 0; frame_vb = 1;
- frame_piano = 0;
- frame_drunk = 0;
- frame_candles = 0;
- cont_sv = 0;
+ vonBraunX = 120; trackVonBraun = 1; vonBraunHasMoved = 0;
+ framesWithoutAction = 0;
term_int = 0;
musicStopped = 0;
selectionMade = 0;
UsingMem = 0;
globalSpeed = 0;
- frame_blind = 0;
- frame_snore = 0;
- frame_bat = 0;
curExcuseLook = 0;
curExcuseAction = 0;
+ roomNumber = 0;
+ for (i = 0; i < 8; i++)
+ actorFrames[i] = 0;
+ actorFrames[kFrameVonBraun] = 1;
+
allocMemory();
withVoices = 0;
@@ -162,7 +226,7 @@
loadPic(96, frontSurface, COMPLETE_PAL);
loadPic("pts.alg", drawSurface2);
} else if (currentChapter == 3) {
- loadPic("aux13.alg", drawSurface1, COMPLETE_PAL);
+ loadPic("aux13.alg", bgSurface, COMPLETE_PAL);
loadPic(96, frontSurface);
loadPic(97, extraSurface);
loadPic(99, backSurface);
@@ -180,12 +244,10 @@
loadPic(99, backSurface);
} else if (currentChapter == 6) {
igorX = 105, igorY = 85, trackIgor = 1;
- x_dr = 62, y_dr = 99, trackDrascula = 1;
- frame_pen = 0;
+ drasculaX = 62, drasculaY = 99, trackDrascula = 1;
+ actorFrames[kFramePendulum] = 0;
flag_tv = 0;
- pendulumSurface = drawSurface3;
-
loadPic(96, frontSurface, COMPLETE_PAL);
loadPic(99, backSurface);
loadPic(97, extraSurface);
@@ -198,10 +260,10 @@
assignDefaultPalette();
if (!runCurrentChapter()) {
- quitGame();
+ endChapter();
break;
}
- quitGame();
+ endChapter();
if (currentChapter == 6)
break;
@@ -211,7 +273,7 @@
return 0;
}
-void DrasculaEngine::quitGame() {
+void DrasculaEngine::endChapter() {
stopSound();
clearRoom();
black();
@@ -221,184 +283,6 @@
free(VGA);
}
-void DrasculaEngine::allocMemory() {
- screenSurface = (byte *)malloc(64000);
- assert(screenSurface);
- frontSurface = (byte *)malloc(64000);
- assert(frontSurface);
- backSurface = (byte *)malloc(64000);
- assert(backSurface);
- drawSurface1 = (byte *)malloc(64000);
- assert(drawSurface1);
- drawSurface2 = (byte *)malloc(64000);
- assert(drawSurface2);
- drawSurface3 = (byte *)malloc(64000);
- assert(drawSurface3);
- tableSurface = (byte *)malloc(64000);
- assert(tableSurface);
- extraSurface = (byte *)malloc(64000);
- assert(extraSurface);
-}
-
-void DrasculaEngine::freeMemory() {
- free(screenSurface);
- free(drawSurface1);
- free(backSurface);
- free(drawSurface2);
- free(tableSurface);
- free(drawSurface3);
- free(extraSurface);
- free(frontSurface);
-}
-
-void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int colorCount) {
- unsigned int con, x = 0;
- unsigned int fExit = 0;
- byte ch, rep;
- byte *auxPun;
-
- _arj.open(NamePcc);
- if (!_arj.isOpen())
- error("missing game data %s %c", NamePcc, 7);
-
- pcxBuffer = (byte *)malloc(65000);
- auxPun = pcxBuffer;
- _arj.seek(128);
- while (!fExit) {
- ch = _arj.readByte();
- rep = 1;
- if ((ch & 192) == 192) {
- rep = (ch & 63);
- ch = _arj.readByte();
- }
- for (con = 0; con < rep; con++) {
- *auxPun++ = ch;
- x++;
- if (x > 64000)
- fExit = 1;
- }
- }
-
- _arj.read(cPal, 768);
- _arj.close();
-
- memcpy(targetSurface, pcxBuffer, 64000);
- free(pcxBuffer);
- setRGB((byte *)cPal, colorCount);
-}
-
-void DrasculaEngine::setRGB(byte *dir_lectura, int plt) {
- int x, cnt = 0;
-
- for (x = 0; x < plt; x++) {
- gamePalette[x][0] = dir_lectura[cnt++] / 4;
- gamePalette[x][1] = dir_lectura[cnt++] / 4;
- gamePalette[x][2] = dir_lectura[cnt++] / 4;
- }
- setPalette((byte *)&gamePalette);
-}
-
-void DrasculaEngine::black() {
- int color, component;
- DacPalette256 palNegra;
-
- for (color = 0; color < 256; color++)
- for (component = 0; component < 3; component++)
- palNegra[color][component] = 0;
-
- palNegra[254][0] = 0x3F;
- palNegra[254][1] = 0x3F;
- palNegra[254][2] = 0x15;
-
- setPalette((byte *)&palNegra);
-}
-
-void DrasculaEngine::setPalette(byte *PalBuf) {
- byte pal[256 * 4];
- int i;
-
- for (i = 0; i < 256; i++) {
- pal[i * 4 + 0] = PalBuf[i * 3 + 0] * 4;
- pal[i * 4 + 1] = PalBuf[i * 3 + 1] * 4;
- pal[i * 4 + 2] = PalBuf[i * 3 + 2] * 4;
- pal[i * 4 + 3] = 0;
- }
- _system->setPalette(pal, 0, 256);
- _system->updateScreen();
-}
-
-void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int width,
- int height, byte *src, byte *dest) {
- dest += xdes + ydes * 320;
- src += xorg + yorg * 320;
- for (int x = 0; x < height; x++) {
- memcpy(dest, src, width);
- dest += 320;
- src += 320;
- }
-}
-
-void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width,
- int height, byte *src, byte *dest) {
- int y, x;
-
- dest += xdes + ydes * 320;
- src += xorg + yorg * 320;
-
- for (y = 0; y < height; y++)
- for (x = 0; x < width; x++)
- if (src[x + y * 320] != 255)
- dest[x + y * 320] = src[x + y * 320];
-}
-
-void DrasculaEngine::copyRectClip(int *Array, byte *src, byte *dest) {
- int y, x;
- int xorg = Array[0];
- int yorg = Array[1];
- int xdes = Array[2];
- int ydes = Array[3];
- int width = Array[4];
- int height = Array[5];
-
- if (ydes < 0) {
- yorg += -ydes;
- height += ydes;
- ydes = 0;
- }
- if (xdes < 0) {
- xorg += -xdes;
- width += xdes;
- xdes = 0;
- }
- if ((xdes + width) > 319)
- width -= (xdes + width) - 320;
- if ((ydes + height) > 199)
- height -= (ydes + height) - 200;
-
- dest += xdes + ydes * 320;
- src += xorg + yorg * 320;
-
- for (y = 0; y < height; y++)
- for (x = 0; x < width; x++)
- if (src[x + y * 320] != 255)
- dest[x + y * 320] = src[x + y * 320];
-}
-
-void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) {
- byte *ptr = VGA;
-
- ptr += xdes + ydes * 320;
- buffer += xorg + yorg * 320;
- for (int x = 0; x < height; x++) {
- memcpy(ptr, buffer, width);
- ptr += 320;
- buffer += 320;
- }
-
- _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
- _system->updateScreen();
-}
-
bool DrasculaEngine::runCurrentChapter() {
int n;
@@ -413,7 +297,7 @@
int soc = 0;
for (n = 0; n < 6; n++) {
soc = soc + CHARACTER_WIDTH;
- frame_x[n] = soc;
+ _frameX[n] = soc;
}
}
@@ -545,12 +429,21 @@
}
if (currentChapter == 2) {
- if (roomNumber == 3 && (curX == 279) && (curY + curHeight == 101))
+ // NOTE: the checks for room number 14 below are a hack used in the original
+ // game, and move the character to a place where his feet are not drawn above
+ // the pianist's head. Originally, walkToObject was not updated properly, which
+ // lead to an incorrect setting of the protagonist's tracking flag (above). This
+ // made the character start walking off screen, as his actual position was
+ // different than the displayed one
+ if (roomNumber == 3 && (curX == 279) && (curY + curHeight == 101)) {
animation_1_2();
- else if (roomNumber == 14 && (curX == 214) && (curY + curHeight == 121))
+ } else if (roomNumber == 14 && (curX == 214) && (curY + curHeight == 121)) {
+ walkToObject = 1;
gotoObject(190, 130);
- else if (roomNumber == 14 && (curX == 246) && (curY + curHeight == 112))
+ } else if (roomNumber == 14 && (curX == 246) && (curY + curHeight == 112)) {
+ walkToObject = 1;
gotoObject(190, 130);
+ }
}
moveCursor();
@@ -568,7 +461,7 @@
if (menuScreen == 0 && takeObject == 1)
checkObjects();
-
+
if (rightMouseButton == 1 && menuScreen == 1) {
delay(100);
if (currentChapter == 2)
@@ -578,8 +471,6 @@
setPalette((byte *)&gamePalette);
menuScreen = 0;
updateEvents();
- if (currentChapter != 3)
- cont_sv = 0;
}
if (rightMouseButton == 1 && menuScreen == 0) {
delay(100);
@@ -597,26 +488,18 @@
menuScreen = 1;
updateEvents();
withoutVerb();
- if (currentChapter != 3)
- cont_sv = 0;
}
if (leftMouseButton == 1 && menuBar == 1) {
delay(100);
selectVerbFromBar();
- if (currentChapter != 3)
- cont_sv = 0;
} else if (leftMouseButton == 1 && takeObject == 0) {
delay(100);
if (verify1())
return true;
- if (currentChapter != 3)
- cont_sv = 0;
} else if (leftMouseButton == 1 && takeObject == 1) {
if (verify2())
return true;
- if (currentChapter != 3)
- cont_sv = 0;
}
menuBar = (mouseY < 24 && menuScreen == 0) ? 1 : 0;
@@ -624,131 +507,56 @@
Common::KeyCode key = getScan();
if (key == Common::KEYCODE_F1 && menuScreen == 0) {
selectVerb(1);
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_F2 && menuScreen == 0) {
selectVerb(2);
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_F3 && menuScreen == 0) {
selectVerb(3);
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_F4 && menuScreen == 0) {
selectVerb(4);
- cont_sv = 0;
} else if (key == Common::KEYCODE_F5 && menuScreen == 0) {
selectVerb(5);
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_F6 && menuScreen == 0) {
selectVerb(6);
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_F9) {
- volumeControls();
- if (currentChapter != 3)
- cont_sv = 0;
+ volumeControls();
} else if (key == Common::KEYCODE_F10) {
if (!saveLoadScreen())
return true;
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_F8) {
withoutVerb();
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_v) {
withVoices = 1;
print_abc(_textsys[_lang][2], 96, 86);
updateScreen();
delay(1410);
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_t) {
withVoices = 0;
print_abc(_textsys[_lang][3], 94, 86);
updateScreen();
delay(1460);
- if (currentChapter != 3)
- cont_sv = 0;
} else if (key == Common::KEYCODE_ESCAPE) {
if (!confirmExit())
return false;
- if (currentChapter != 3)
- cont_sv = 0;
} else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) {
- loadPic("alcbar.alg", drawSurface1, 255);
- } else if (cont_sv == 15000) {
+ loadPic("alcbar.alg", bgSurface, 255);
+ }
+
+ if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0)
+ if (currentChapter != 3)
+ framesWithoutAction = 0;
+
+ if (framesWithoutAction == 15000) {
screenSaver();
if (currentChapter != 3)
- cont_sv = 0;
- } else {
- if (currentChapter != 3)
- cont_sv++;
+ framesWithoutAction = 0;
}
- }
-}
-void DrasculaEngine::pickObject(int objeto) {
- if (currentChapter == 6)
- loadPic("iconsp.alg", backSurface);
- else if (currentChapter == 4)
- loadPic("icons2.alg", backSurface);
- else if (currentChapter == 5)
- loadPic("icons3.alg", backSurface);
- else
- loadPic("icons.alg", backSurface);
- chooseObject(objeto);
- if (currentChapter == 2)
- loadPic(menuBackground, backSurface);
- else
- loadPic(99, backSurface);
-}
+ if (currentChapter != 3)
+ framesWithoutAction++;
-void DrasculaEngine::chooseObject(int objeto) {
- if (currentChapter == 5) {
- if (takeObject == 1 && menuScreen == 0 && pickedObject != 16)
- addObject(pickedObject);
- } else {
- if (takeObject == 1 && menuScreen == 0)
- addObject(pickedObject);
}
- copyBackground(x1d_menu[objeto], y1d_menu[objeto], 0, 0, OBJWIDTH,OBJHEIGHT, backSurface, drawSurface3);
- takeObject = 1;
- pickedObject = objeto;
}
-int DrasculaEngine::removeObject(int obj) {
- int result = 1;
-
- for (int h = 1; h < 43; h++) {
- if (inventoryObjects[h] == obj) {
- inventoryObjects[h] = 0;
- result = 0;
- break;
- }
- }
-
- return result;
-}
-
-void DrasculaEngine::withoutVerb() {
- int c = (menuScreen == 1) ? 0 : 171;
-
- if (currentChapter == 5) {
- if (takeObject == 1 && pickedObject != 16)
- addObject(pickedObject);
- } else {
- if (takeObject == 1)
- addObject(pickedObject);
- }
- copyBackground(0, c, 0, 0, OBJWIDTH,OBJHEIGHT, backSurface, drawSurface3);
-
- takeObject = 0;
- hasName = 0;
-}
-
char *DrasculaEngine::getLine(char *buf, int len) {
byte c;
char *b;
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list