diff options
63 files changed, 5892 insertions, 4217 deletions
diff --git a/Makefile.common b/Makefile.common index 5a443644f2..c2704f2219 100644 --- a/Makefile.common +++ b/Makefile.common @@ -182,6 +182,9 @@ DIST_FILES_THEMES:=$(addprefix $(srcdir)/gui/themes/,modern.ini modern.zip class # Engine data files DIST_FILES_ENGINEDATA= +ifdef ENABLE_DRASCULA +DIST_FILES_ENGINEDATA+=drascula.dat +endif ifdef ENABLE_IGOR DIST_FILES_ENGINEDATA+=igor.tbl endif diff --git a/backends/platform/wii/Makefile b/backends/platform/wii/Makefile index 0654fa254d..a52ceb1774 100644 --- a/backends/platform/wii/Makefile +++ b/backends/platform/wii/Makefile @@ -62,8 +62,8 @@ MACHDEP = -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float \ 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 diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp index 7529df6de3..5753ecefe4 100644 --- a/backends/platform/wii/main.cpp +++ b/backends/platform/wii/main.cpp @@ -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 @@ int main(int argc, char *argv[]) { printf("startup\n"); + SYS_SetResetCallback(reset_cb); + SYS_SetPowerCallback(power_cb); + if (!fatInitDefault()) { printf("fatInitDefault failed\n"); } else { @@ -77,6 +91,11 @@ int main(int argc, char *argv[]) { fatUnsafeUnmount(PI_DEFAULT); } + if (power_btn_pressed) { + printf("shutting down\n"); + SYS_ResetSystem(SYS_POWEROFF, 0, 0); + } + printf("reloading\n"); return res; diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp index 97bee24d0f..2667ecb69d 100644 --- a/backends/platform/wii/osystem.cpp +++ b/backends/platform/wii/osystem.cpp @@ -63,6 +63,8 @@ OSystem_Wii::OSystem_Wii() : _mouseKeyColor(0), _mouseCursor(NULL), + _event_quit(false), + _savefile(NULL), _mixer(NULL), _timer(NULL) { diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index f65310bada..2a168fd0b7 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -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 @@ private: u8 _mouseKeyColor; u8 *_mouseCursor; + bool _event_quit; + u32 _lastPadCheck; void initGfx(); diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp index 09dfb5e96b..2d7c2d9c18 100644 --- a/backends/platform/wii/osystem_events.cpp +++ b/backends/platform/wii/osystem_events.cpp @@ -140,6 +140,15 @@ void OSystem_Wii::updateEventScreenResolution() { } 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(); diff --git a/backends/plugins/dynamic-plugin.h b/backends/plugins/dynamic-plugin.h index 4771f1c086..ec051c4ed7 100644 --- a/backends/plugins/dynamic-plugin.h +++ b/backends/plugins/dynamic-plugin.h @@ -46,6 +46,7 @@ public: 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 @@ public: } _type = (PluginType)typeFunc(); if (_type >= PLUGIN_TYPE_MAX) { + warning("Plugin type unknown: %d", _type); unloadPlugin(); return false; } @@ -69,6 +71,7 @@ public: 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 @@ public: // Get the plugin object _pluginObject = getObject(); if (!_pluginObject) { + warning("Couldn't get the plugin object"); unloadPlugin(); return false; } diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp index 8999a60942..4387bd199e 100644 --- a/common/advancedDetector.cpp +++ b/common/advancedDetector.cpp @@ -268,7 +268,10 @@ PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) c 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 void reportUnknown(StringMap &filesMD5, HashMap<String, int32, Common::Ca } 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; diff --git a/common/file.cpp b/common/file.cpp index 4a7aed0e3d..386777e2c5 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -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 diff --git a/common/hash-str.h b/common/hash-str.h index 5575735f1d..f64b62daed 100644 --- a/common/hash-str.h +++ b/common/hash-str.h @@ -57,11 +57,12 @@ struct IgnoreCase_Hash { -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,7 +76,10 @@ struct Hash<const char *> { return hashit(s); } }; -#endif + +// String map -- by default case insensitive +typedef HashMap<String, String, IgnoreCase_Hash, IgnoreCase_EqualTo> StringMap; + } // End of namespace Common diff --git a/common/system.cpp b/common/system.cpp index 015f246b7a..327b7246e2 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -128,9 +128,7 @@ void OSystem::clearScreen() { * 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" diff --git a/common/unarj.cpp b/common/unarj.cpp index 942e659caa..f3ac20c285 100644 --- a/common/unarj.cpp +++ b/common/unarj.cpp @@ -289,6 +289,9 @@ bool ArjFile::open(const Common::String &filename, AccessMode mode) { } void ArjFile::close() { + if (!_isOpen) + return; + _isOpen = false; if (_fallBack) { @@ -125,9 +125,12 @@ _prefix=/usr/local _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 @@ add_line_to_config_mk() { '"$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 @@ if test -n "$_host"; then # 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 @@ engine_enable() { 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 @@ engine_disable() { 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 @@ Usage: $0 [OPTIONS]... 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 @@ if test -n "$_host"; then ;; 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 @@ if test -n "$_host"; then ;; 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 @@ if test -n "$_host"; then 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 @@ if test -n "$_host"; then ;; 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 @@ if test -n "$_host"; then 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 @@ int main(int argc, char **argv) } 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 @@ EOF # 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 diff --git a/dists/engine-data/drascula.dat b/dists/engine-data/drascula.dat Binary files differnew file mode 100644 index 0000000000..321e63c277 --- /dev/null +++ b/dists/engine-data/drascula.dat diff --git a/dists/msvc7/drascula.vcproj b/dists/msvc7/drascula.vcproj index 3bf3cf94ea..2d23296dbc 100644 --- a/dists/msvc7/drascula.vcproj +++ b/dists/msvc7/drascula.vcproj @@ -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,10 +115,25 @@ 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"> diff --git a/dists/msvc71/drascula.vcproj b/dists/msvc71/drascula.vcproj index 10a7a52185..9160a02bbf 100644 --- a/dists/msvc71/drascula.vcproj +++ b/dists/msvc71/drascula.vcproj @@ -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,10 +129,25 @@ 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"> diff --git a/dists/msvc8/drascula.vcproj b/dists/msvc8/drascula.vcproj index 830eb8afe1..0867377f31 100644 --- a/dists/msvc8/drascula.vcproj +++ b/dists/msvc8/drascula.vcproj @@ -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,11 +185,31 @@ > </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 diff --git a/dists/msvc9/drascula.vcproj b/dists/msvc9/drascula.vcproj index 3bcda49e5d..45a75cb7a2 100644 --- a/dists/msvc9/drascula.vcproj +++ b/dists/msvc9/drascula.vcproj @@ -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,11 +186,31 @@ > </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 diff --git a/dists/wii/icon.png b/dists/wii/icon.png Binary files differindex dc873e66f2..0a3264377f 100644 --- a/dists/wii/icon.png +++ b/dists/wii/icon.png diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index f526c51a27..cd6942f9c0 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -2148,7 +2148,7 @@ bool AgiMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common: } 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; diff --git a/engines/cine/cine.h b/engines/cine/cine.h index 7ce5231446..710840c17e 100644 --- a/engines/cine/cine.h +++ b/engines/cine/cine.h @@ -64,7 +64,7 @@ enum CineGameFeatures { 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 { diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index aa457fe4f9..47446f2410 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -335,8 +335,8 @@ int FWRenderer::drawChar(char character, int x, int y) { 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 @@ int OSRenderer::drawChar(char character, int x, int y) { 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; } diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 43656460c5..535bf841d5 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -70,25 +70,41 @@ void closePart(void) { // TODO } -static void fixVolCnfFileName(char *dst, const uint8 *src) { - memcpy(dst, src, 8); - src += 8; - dst[8] = 0; - - char *ext = strchr(dst, ' '); - if (!ext) { - ext = &dst[8]; - } - if (*src == ' ') { - *ext = 0; - } else { - *ext++ = '.'; - memcpy(ext, src, 3); - char *end = strchr(ext, ' '); - if (!end) { - end = &ext[3]; +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; + + 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; } - *end = 0; + } else { + // Filenames of length 13 are okay as they are, no need for conversion + return Common::String(tmp); } } @@ -97,30 +113,25 @@ void CineEngine::readVolCnf() { 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 @@ void CineEngine::readVolCnf() { 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 @@ byte *readBundleFile(int16 foundFileIdx) { 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); diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp index 91a209074d..9b4b83f420 100644 --- a/engines/cine/texte.cpp +++ b/engines/cine/texte.cpp @@ -635,7 +635,7 @@ int fitLine(const char *str, int maxWidth, int &words, int &width) { bkpWidth = width; bkpLen = i + 1; } else { - charWidth = fontParamTable[str[i]].characterWidth + 1; + charWidth = fontParamTable[(unsigned char)str[i]].characterWidth + 1; width += charWidth; } diff --git a/engines/cine/unpack.cpp b/engines/cine/unpack.cpp index 4409af4b07..364331e439 100644 --- a/engines/cine/unpack.cpp +++ b/engines/cine/unpack.cpp @@ -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 diff --git a/engines/cine/unpack.h b/engines/cine/unpack.h index 5f57a3531b..f0a7ee3804 100644 --- a/engines/cine/unpack.h +++ b/engines/cine/unpack.h @@ -31,7 +31,50 @@ 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 diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp new file mode 100644 index 0000000000..10ce415c2c --- /dev/null +++ b/engines/drascula/actors.cpp @@ -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 diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 13425f7250..feb6cb93ca 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -44,7 +44,7 @@ void DrasculaEngine::updateAnim2(int y, int px, int py, int width, int height, i 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 @@ void DrasculaEngine::updateAnim2(int y, int px, int py, int width, int height, i } } +// This is the game's introduction sequence void DrasculaEngine::animation_1_1() { int l, l2, p; int pixelPos[6]; @@ -120,7 +121,7 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { } 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_1_1() { 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 @@ void DrasculaEngine::animation_2_1() { 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 @@ void DrasculaEngine::animation_2_1() { 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_1_2() { 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 @@ void DrasculaEngine::animation_2_2() { 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 @@ void DrasculaEngine::animation_4_2() { 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 @@ void DrasculaEngine::animation_4_2() { 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 @@ void DrasculaEngine::animation_4_2() { 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_10_2() { } 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_15_2() { } void DrasculaEngine::animation_16_2() { - int l; - talk_drunk(12); talk(371); @@ -874,12 +867,12 @@ void DrasculaEngine::animation_16_2() { 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 @@ void DrasculaEngine::animation_16_2() { 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 @@ void DrasculaEngine::animation_16_2() { 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 @@ void DrasculaEngine::animation_16_2() { 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 @@ void DrasculaEngine::animation_16_2() { 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 @@ void DrasculaEngine::animation_16_2() { asco: loadPic(roomDisk, drawSurface3); - loadPic(roomNumber, drawSurface1, HALF_PAL); + loadPic(roomNumber, bgSurface, HALF_PAL); black(); updateRoom(); updateScreen(); @@ -1012,24 +1005,24 @@ void DrasculaEngine::animation_17_2() { } 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 @@ void DrasculaEngine::animation_20_2() { 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 @@ void DrasculaEngine::animation_23_2() { 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 @@ void DrasculaEngine::animation_23_2() { 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_2() { } 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 @@ void DrasculaEngine::animation_23_joined() { 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_joined() { } 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 @@ void DrasculaEngine::animation_23_joined2() { 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_23_joined2() { } 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); - - pos_cabina[0] = 150; - pos_cabina[1] = 6; - pos_cabina[2] = 69; - pos_cabina[3] = 0; - pos_cabina[4] = 158; - pos_cabina[5] = 161; + loadPic(18, bgSurface); 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 @@ void DrasculaEngine::animation_27_2() { 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_29_2() { } 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 @@ void DrasculaEngine::animation_31_2() { 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 @@ void DrasculaEngine::animation_35_2() { 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 @@ void DrasculaEngine::animation_6_3() { 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 @@ void DrasculaEngine::animation_ray() { 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 @@ void DrasculaEngine::animation_ray() { 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 @@ void DrasculaEngine::animation_4_5() { 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 @@ void DrasculaEngine::animation_5_5(){ 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 @@ void DrasculaEngine::animation_5_5(){ 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 @@ void DrasculaEngine::animation_5_5(){ 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 @@ void DrasculaEngine::animation_5_5(){ 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 @@ void DrasculaEngine::animation_5_5(){ 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 @@ void DrasculaEngine::animation_12_5() { 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 @@ void DrasculaEngine::animation_13_5() { 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 @@ void DrasculaEngine::animation_13_5() { 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_17_5() { } 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_4_6() { } void DrasculaEngine::animation_5_6() { - int n, pos_pen[6]; - - pos_pen[0] = 1; - pos_pen[1] = 29; - pos_pen[2] = 204; - pos_pen[3] = -125; - pos_pen[4] = 18; - pos_pen[5] = 125; + int pos_pen[6] = { 1, 29, 204, -125, 18, 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 @@ void DrasculaEngine::animation_9_6() { // 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 @@ void DrasculaEngine::animation_9_6() { 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 @@ void DrasculaEngine::animation_9_6() { 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 @@ void DrasculaEngine::animation_9_6() { 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_9_6() { 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_18_6() { } 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_13_2() { void DrasculaEngine::animation_18_2() { talk(378); - talk_vbpuerta(4); + talk_vonBraunpuerta(4); converse(3); } @@ -2303,11 +2268,11 @@ void DrasculaEngine::animation_22_2() { 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 @@ void DrasculaEngine::animation_24_2() { flags[21] = 1; - talk_vb(22); + talk_vonBraun(22); if (flags[22] == 0) converse(4); @@ -2338,8 +2303,8 @@ void DrasculaEngine::animation_24_2() { 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 @@ void DrasculaEngine::animation_7_2() { 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 @@ void DrasculaEngine::animation_7_2() { 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 @@ void DrasculaEngine::animation_6_2() { 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 @@ void DrasculaEngine::animation_6_2() { 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 @@ void DrasculaEngine::animation_33_2() { 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 @@ void DrasculaEngine::animation_33_2() { 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 @@ void DrasculaEngine::animation_33_2() { 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 @@ void DrasculaEngine::animation_6_4() { 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 @@ void DrasculaEngine::animation_6_4() { 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 @@ void DrasculaEngine::animation_9_4() { 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 diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp new file mode 100644 index 0000000000..1c3831e4ca --- /dev/null +++ b/engines/drascula/converse.cpp @@ -0,0 +1,297 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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 diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index f9ca3b4aa6..1cbe2ae0e1 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -70,6 +70,37 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam 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 @@ int DrasculaEngine::init() { _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,21 +195,20 @@ int DrasculaEngine::go() { 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(); @@ -162,7 +226,7 @@ int DrasculaEngine::go() { 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 @@ int DrasculaEngine::go() { 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 @@ int DrasculaEngine::go() { assignDefaultPalette(); if (!runCurrentChapter()) { - quitGame(); + endChapter(); break; } - quitGame(); + endChapter(); if (currentChapter == 6) break; @@ -211,7 +273,7 @@ int DrasculaEngine::go() { return 0; } -void DrasculaEngine::quitGame() { +void DrasculaEngine::endChapter() { stopSound(); clearRoom(); black(); @@ -221,184 +283,6 @@ void DrasculaEngine::quitGame() { 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 @@ bool DrasculaEngine::runCurrentChapter() { int soc = 0; for (n = 0; n < 6; n++) { soc = soc + CHARACTER_WIDTH; - frame_x[n] = soc; + _frameX[n] = soc; } } @@ -545,12 +429,21 @@ bool DrasculaEngine::runCurrentChapter() { } 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 @@ bool DrasculaEngine::runCurrentChapter() { if (menuScreen == 0 && takeObject == 1) checkObjects(); - + if (rightMouseButton == 1 && menuScreen == 1) { delay(100); if (currentChapter == 2) @@ -578,8 +471,6 @@ bool DrasculaEngine::runCurrentChapter() { setPalette((byte *)&gamePalette); menuScreen = 0; updateEvents(); - if (currentChapter != 3) - cont_sv = 0; } if (rightMouseButton == 1 && menuScreen == 0) { delay(100); @@ -597,26 +488,18 @@ bool DrasculaEngine::runCurrentChapter() { 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,129 +507,54 @@ bool DrasculaEngine::runCurrentChapter() { 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) { - screenSaver(); - if (currentChapter != 3) - cont_sv = 0; - } else { - if (currentChapter != 3) - cont_sv++; + loadPic("alcbar.alg", bgSurface, 255); } - } -} - -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); -} - -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; + + if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0) + if (currentChapter != 3) + framesWithoutAction = 0; - for (int h = 1; h < 43; h++) { - if (inventoryObjects[h] == obj) { - inventoryObjects[h] = 0; - result = 0; - break; + if (framesWithoutAction == 15000) { + screenSaver(); + if (currentChapter != 3) + framesWithoutAction = 0; } - } - return result; -} - -void DrasculaEngine::withoutVerb() { - int c = (menuScreen == 1) ? 0 : 171; + if (currentChapter != 3) + framesWithoutAction++; - 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) { @@ -782,339 +590,6 @@ void DrasculaEngine::getStringFromLine(char *buf, int len, char* result) { sscanf(buf, "%s", result); } -void DrasculaEngine::enterRoom(int roomIndex) { - debug(2, "Entering room %d", roomIndex); - - char fileName[20]; - sprintf(fileName, "%d.ald", roomIndex); - int soc, l, martin = 0, objIsExit = 0; - float chiquez = 0, pequegnez = 0; - char pant1[20], pant2[20], pant3[20], pant4[20]; - char buffer[256]; - int palLevel = 0; - - hasName = 0; - - strcpy(currentData, fileName); - - _arj.open(fileName); - if (!_arj.isOpen()) { - error("missing data file %s", fileName); - } - int size = _arj.size(); - - getIntFromLine(buffer, size, &roomNumber); - getIntFromLine(buffer, size, &roomMusic); - getStringFromLine(buffer, size, roomDisk); - getIntFromLine(buffer, size, &palLevel); - - if (currentChapter == 2) - getIntFromLine(buffer, size, &martin); - - if (currentChapter == 2 && martin != 0) { - curWidth = martin; - getIntFromLine(buffer, size, &curHeight); - getIntFromLine(buffer, size, &feetHeight); - getIntFromLine(buffer, size, &stepX); - getIntFromLine(buffer, size, &stepY); - - getStringFromLine(buffer, size, pant1); - getStringFromLine(buffer, size, pant2); - getStringFromLine(buffer, size, pant3); - getStringFromLine(buffer, size, pant4); - - strcpy(menuBackground, pant4); - } - - getIntFromLine(buffer, size, &numRoomObjs); - - for (l = 0; l < numRoomObjs; l++) { - getIntFromLine(buffer, size, &objectNum[l]); - getStringFromLine(buffer, size, objName[l]); - getIntFromLine(buffer, size, &x1[l]); - getIntFromLine(buffer, size, &y1[l]); - getIntFromLine(buffer, size, &x2[l]); - getIntFromLine(buffer, size, &y2[l]); - getIntFromLine(buffer, size, &roomObjX[l]); - getIntFromLine(buffer, size, &roomObjY[l]); - getIntFromLine(buffer, size, &trackObj[l]); - getIntFromLine(buffer, size, &visible[l]); - getIntFromLine(buffer, size, &isDoor[l]); - if (isDoor[l] != 0) { - getStringFromLine(buffer, size, _targetSurface[l]); - getIntFromLine(buffer, size, &_destX[l]); - getIntFromLine(buffer, size, &_destY[l]); - getIntFromLine(buffer, size, &trackCharacter_alkeva[l]); - getIntFromLine(buffer, size, &alapuertakeva[l]); - updateDoor(l); - } - } - - getIntFromLine(buffer, size, &floorX1); - getIntFromLine(buffer, size, &floorY1); - getIntFromLine(buffer, size, &floorX2); - getIntFromLine(buffer, size, &floorY2); - - if (currentChapter != 2) { - getIntFromLine(buffer, size, &far); - getIntFromLine(buffer, size, &near); - } - _arj.close(); - - if (currentChapter == 2 && martin != 0) { - loadPic(pant2, extraSurface); - loadPic(pant1, frontSurface); - loadPic(pant4, backSurface); - } - - if (currentChapter == 2) { - if (martin == 0) { - stepX = STEP_X; - stepY = STEP_Y; - curHeight = CHARACTER_HEIGHT; - curWidth = CHARACTER_WIDTH; - feetHeight = FEET_HEIGHT; - loadPic(97, extraSurface); - loadPic(96, frontSurface); - loadPic(99, backSurface); - - strcpy(menuBackground, "99.alg"); - } - } - - for (l = 0; l < numRoomObjs; l++) { - if (objectNum[l] == objExit) - objIsExit = l; - } - - if (currentChapter == 2) { - if (curX == -1) { - curX = _destX[objIsExit]; - curY = _destY[objIsExit] - curHeight; - } - characterMoved = 0; - } - - loadPic(roomDisk, drawSurface3); - loadPic(roomNumber, drawSurface1, HALF_PAL); - - copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3); - - setDefaultPalette(); - if (palLevel != 0) - setPaletteBase(palLevel); - assignBrightPalette(); - setDefaultPalette(); - setPaletteBase(palLevel + 2); - assignDarkPalette(); - - setBrightPalette(); - changeColor = -1; - - if (currentChapter == 2) - color_abc(kColorLightGreen); - - if (currentChapter != 2) { - for (l = 0; l <= floorY1; l++) - factor_red[l] = far; - for (l = floorY1; l <= 201; l++) - factor_red[l] = near; - - chiquez = (float)(near - far) / (float)(floorY2 - floorY1); - for (l = floorY1; l <= floorY2; l++) { - factor_red[l] = (int)(far + pequegnez); - pequegnez = pequegnez + chiquez; - } - } - - if (roomNumber == 24) { - for (l = floorY1 - 1; l > 74; l--) { - factor_red[l] = (int)(far - pequegnez); - pequegnez = pequegnez + chiquez; - } - } - - if (currentChapter == 5 && roomNumber == 54) { - for (l = floorY1 - 1; l > 84; l--) { - factor_red[l] = (int)(far - pequegnez); - pequegnez = pequegnez + chiquez; - } - } - - if (currentChapter != 2) { - if (curX == -1) { - curX = _destX[objIsExit]; - curY = _destY[objIsExit]; - curHeight = (CHARACTER_HEIGHT * factor_red[curY]) / 100; - curWidth = (CHARACTER_WIDTH * factor_red[curY]) / 100; - curY = curY - curHeight; - } else { - curHeight = (CHARACTER_HEIGHT * factor_red[curY]) / 100; - curWidth = (CHARACTER_WIDTH * factor_red[curY]) / 100; - } - characterMoved = 0; - } - - if (currentChapter == 2) { - soc = 0; - for (l = 0; l < 6; l++) { - soc += curWidth; - frame_x[l] = soc; - } - } - - if (currentChapter == 5) - hare_se_ve = 1; - - updateVisible(); - - if (currentChapter == 1) - isDoor[7] = 0; - - if (currentChapter == 2) { - if (roomNumber == 14 && flags[39] == 1) - roomMusic = 16; - else if (roomNumber == 15 && flags[39] == 1) - roomMusic = 16; - if (roomNumber == 14 && flags[5] == 1) - roomMusic = 0; - else if (roomNumber == 15 && flags[5] == 1) - roomMusic = 0; - - if (previousMusic != roomMusic && roomMusic != 0) - playMusic(roomMusic); - if (roomMusic == 0) - stopMusic(); - } else { - if (previousMusic != roomMusic && roomMusic != 0) - playMusic(roomMusic); - } - - if (currentChapter == 2) { - if (roomNumber == 9 || roomNumber == 2 || roomNumber == 14 || roomNumber == 18) - savedTime = getTime(); - } - if (currentChapter == 4) { - if (roomNumber == 26) - savedTime = getTime(); - } - - if (currentChapter == 4 && roomNumber == 24 && flags[29] == 1) - animation_7_4(); - - if (currentChapter == 5) { - if (roomNumber == 45) - hare_se_ve = 0; - if (roomNumber == 49 && flags[7] == 0) - animation_4_5(); - } - - updateRoom(); -} - -void DrasculaEngine::clearRoom() { - memset(VGA, 0, 64000); - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - _system->updateScreen(); -} - -void DrasculaEngine::gotoObject(int pointX, int pointY) { - if (currentChapter == 5 || currentChapter == 6) { - if (hare_se_ve == 0) { - curX = roomX; - curY = roomY; - updateRoom(); - updateScreen(); - return; - } - } - roomX = pointX; - roomY = pointY; - startWalking(); - - for (;;) { - updateRoom(); - updateScreen(); - if (characterMoved == 0) - break; - } - - if (walkToObject == 1) { - walkToObject = 0; - trackProtagonist = trackFinal; - } - updateRoom(); - updateScreen(); -} - -void DrasculaEngine::moveCursor() { - int cursorPos[8]; - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); - moveCharacters(); - updateRefresh(); - - if (!strcmp(textName, "hacker") && hasName == 1) { - if (_color != kColorRed && menuScreen == 0) - color_abc(kColorRed); - } else if (menuScreen == 0 && _color != kColorLightGreen) - color_abc(kColorLightGreen); - if (hasName == 1 && menuScreen == 0) - centerText(textName, mouseX, mouseY); - if (menuScreen == 1) - showMenu(); - else if (menuBar == 1) - clearMenu(); - - cursorPos[0] = 0; - cursorPos[1] = 0; - cursorPos[2] = mouseX - 20; - cursorPos[3] = mouseY - 17; - cursorPos[4] = OBJWIDTH; - cursorPos[5] = OBJHEIGHT; - copyRectClip(cursorPos, drawSurface3, screenSurface); -} - -void DrasculaEngine::checkObjects() { - int l, veo = 0; - - for (l = 0; l < numRoomObjs; l++) { - if (mouseX > x1[l] && mouseY > y1[l] - && mouseX < x2[l] && mouseY < y2[l] - && visible[l] == 1 && isDoor[l] == 0) { - strcpy(textName, objName[l]); - hasName = 1; - veo = 1; - } - } - - if (mouseX > curX + 2 && mouseY > curY + 2 - && mouseX < curX + curWidth - 2 && mouseY < curY + curHeight - 2) { - if (currentChapter == 2 || veo == 0) { - strcpy(textName, "hacker"); - hasName = 1; - veo = 1; - } - } - - if (veo == 0) - hasName = 0; -} - -void DrasculaEngine::selectVerbFromBar() { - for (int n = 0; n < 7; n++) { - if (mouseX > verbBarX[n] && mouseX < verbBarX[n + 1] && n > 0) { - selectVerb(n); - return; - } - } - - // no verb selected - withoutVerb(); -} - bool DrasculaEngine::verify1() { int l; @@ -1225,8 +700,8 @@ void DrasculaEngine::updateEvents() { break; case Common::EVENT_QUIT: // TODO - quitGame(); - exit(0); + endChapter(); + _system->quit(); break; default: break; @@ -1234,1594 +709,14 @@ void DrasculaEngine::updateEvents() { } } -void DrasculaEngine::selectVerb(int verbo) { - int c = (menuScreen == 1) ? 0 : 171; - - if (currentChapter == 5) { - if (takeObject == 1 && pickedObject != 16) - addObject(pickedObject); - } else { - if (takeObject == 1) - addObject(pickedObject); - } - - copyBackground(OBJWIDTH * verbo, c, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3); - - takeObject = 1; - pickedObject = verbo; -} - -void DrasculaEngine::updateVolume(Audio::Mixer::SoundType soundType, int prevVolume) { - int vol = _mixer->getVolumeForSoundType(soundType) / 16; - if (mouseY < prevVolume && vol < 15) - vol++; - if (mouseY > prevVolume && vol > 0) - vol--; - _mixer->setVolumeForSoundType(soundType, vol * 16); -} - -void DrasculaEngine::volumeControls() { - int masterVolume, voiceVolume, musicVolume; - - copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); - updateScreen(73, 63, 73, 63, 177, 97, screenSurface); - - masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4); - voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4); - musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4); - - for (;;) { - updateRoom(); - - copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); - - copyBackground(183, 56, 82, masterVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4), tableSurface, screenSurface); - copyBackground(183, 56, 138, voiceVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4), tableSurface, screenSurface); - copyBackground(183, 56, 194, musicVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4), tableSurface, screenSurface); - - setCursorTable(); - - updateScreen(); - - updateEvents(); - - if (rightMouseButton == 1) { - delay(100); - break; - } - if (leftMouseButton == 1) { - delay(100); - if (mouseX > 80 && mouseX < 121) { - updateVolume(Audio::Mixer::kPlainSoundType, mouseY); - masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4); - } - - if (mouseX > 136 && mouseX < 178) { - updateVolume(Audio::Mixer::kSFXSoundType, mouseY); - voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4); - } - - if (mouseX > 192 && mouseX < 233) { - updateVolume(Audio::Mixer::kMusicSoundType, mouseY); - musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4); - } - } - - } - - updateEvents(); -} - -bool DrasculaEngine::saveLoadScreen() { - char names[10][23]; - char file[50]; - char fileEpa[50]; - int n, n2, num_sav = 0, y = 27; - Common::InSaveFile *sav; - - clearRoom(); - - snprintf(fileEpa, 50, "%s.epa", _targetName.c_str()); - if (!(sav = _saveFileMan->openForLoading(fileEpa))) { - Common::OutSaveFile *epa; - if (!(epa = _saveFileMan->openForSaving(fileEpa))) - error("Can't open %s file", fileEpa); - for (n = 0; n < NUM_SAVES; n++) - epa->writeString("*\n"); - epa->finalize(); - delete epa; - if (!(sav = _saveFileMan->openForLoading(fileEpa))) { - error("Can't open %s file", fileEpa); - } - } - for (n = 0; n < NUM_SAVES; n++) - sav->readLine(names[n], 23); - delete sav; - - loadPic("savescr.alg", drawSurface1, HALF_PAL); - - color_abc(kColorLightGreen); - - select[0] = 0; - - for (;;) { - y = 27; - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - for (n = 0; n < NUM_SAVES; n++) { - print_abc(names[n], 116, y); - y = y + 9; - } - print_abc(select, 117, 15); - setCursorTable(); - updateScreen(); - y = 27; - - updateEvents(); - - if (leftMouseButton == 1) { - delay(50); - for (n = 0; n < NUM_SAVES; n++) { - if (mouseX > 115 && mouseY > y + (9 * n) && mouseX < 115 + 175 && mouseY < y + 10 + (9 * n)) { - strcpy(select, names[n]); - - if (strcmp(select, "*")) - selectionMade = 1; - else { - enterName(); - strcpy(names[n], select); - if (selectionMade == 1) { - snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); - saveGame(file); - Common::OutSaveFile *tsav; - if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { - error("Can't open %s file", fileEpa); - } - for (n = 0; n < NUM_SAVES; n++) { - tsav->writeString(names[n]); - tsav->writeString("\n"); - } - tsav->finalize(); - delete tsav; - } - } - - print_abc(select, 117, 15); - y = 27; - for (n2 = 0; n2 < NUM_SAVES; n2++) { - print_abc(names[n2], 116, y); - y = y + 9; - } - if (selectionMade == 1) { - snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); - } - num_sav = n; - } - } - - if (mouseX > 117 && mouseY > 15 && mouseX < 295 && mouseY < 24 && selectionMade == 1) { - enterName(); - strcpy(names[num_sav], select); - print_abc(select, 117, 15); - y = 27; - for (n2 = 0; n2 < NUM_SAVES; n2++) { - print_abc(names[n2], 116, y); - y = y + 9; - } - } - - if (mouseX > 125 && mouseY > 123 && mouseX < 199 && mouseY < 149 && selectionMade == 1) { - if (!loadGame(file)) - return false; - break; - } else if (mouseX > 208 && mouseY > 123 && mouseX < 282 && mouseY < 149 && selectionMade == 1) { - saveGame(file); - Common::OutSaveFile *tsav; - if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { - error("Can't open %s file", fileEpa); - } - for (n = 0; n < NUM_SAVES; n++) { - tsav->writeString(names[n]); - tsav->writeString("\n"); - } - tsav->finalize(); - delete tsav; - } else if (mouseX > 168 && mouseY > 154 && mouseX < 242 && mouseY < 180) - break; - else if (selectionMade == 0) { - print_abc("elige una partida", 117, 15); - } - updateScreen(); - delay(200); - } - y = 26; - - delay(5); - } - - clearRoom(); - loadPic(roomNumber, drawSurface1, HALF_PAL); - selectionMade = 0; - - return true; -} - -void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) { - int textPos[8]; - int letterY = 0, letterX = 0, h, length; - length = strlen(said); - - for (h = 0; h < length; h++) { - int c = toupper(said[h]); - - for (int i = 0; i < CHARMAP_SIZE; i++) { - if (c == charMap[i].inChar) { - letterX = charMap[i].mappedChar; - - switch (charMap[i].charType) { - case 0: // letters - letterY = (_lang == kSpanish) ? 149 : 158; - break; - case 1: // signs - letterY = (_lang == kSpanish) ? 160 : 169; - break; - case 2: // accented - letterY = 180; - break; - } // switch - break; - } // if - } // for - - textPos[0] = letterX; - textPos[1] = letterY; - textPos[2] = screenX; - textPos[3] = screenY; - textPos[4] = CHAR_WIDTH; - textPos[5] = CHAR_HEIGHT; - - copyRectClip(textPos, textSurface, screenSurface); - - screenX = screenX + CHAR_WIDTH; - if (screenX > 317) { - screenX = 0; - screenY = screenY + CHAR_HEIGHT + 2; - } - } // for -} - -void DrasculaEngine::print_abc_opc(const char *said, int screenX, int screenY, int game) { - int textPos[6]; - int signY, letterY, letterX = 0, h, length; - length = strlen(said); - - for (h = 0; h < length; h++) { - if (game == 1) { - letterY = 6; - signY = 15; - } else if (game == 3) { - letterY = 56; - signY = 65; - } else { - letterY = 31; - signY = 40; - } - - int c = toupper(said[h]); - - for (int i = 0; i < CHARMAP_SIZE; i++) { - if (c == charMap[i].inChar) { - // Convert the mapped char of the normal font to the - // mapped char of the dialogue font - - int multiplier = (charMap[i].mappedChar - 6) / 9; - - letterX = multiplier * 7 + 10; - - if (charMap[i].charType > 0) - letterY = signY; - break; - } // if - } // for - - textPos[0] = letterX; - textPos[1] = letterY; - textPos[2] = screenX; - textPos[3] = screenY; - textPos[4] = CHAR_WIDTH_OPC; - textPos[5] = CHAR_HEIGHT_OPC; - - copyRectClip(textPos, backSurface, screenSurface); - - screenX = screenX + CHAR_WIDTH_OPC; - } -} - void DrasculaEngine::delay(int ms) { _system->delayMillis(ms * 2); // originaly was 1 } -bool DrasculaEngine::confirmExit() { - byte key; - - color_abc(kColorRed); - updateRoom(); - centerText(_textsys[_lang][1], 160, 87); - updateScreen(); - - delay(100); - for (;;) { - key = getScan(); - if (key != 0) - break; - } - - if (key == Common::KEYCODE_ESCAPE) { - stopMusic(); - return false; - } - - return true; -} - -void DrasculaEngine::screenSaver() { - int xr, yr; - byte *copia, *ghost; - float coeff = 0, coeff2 = 0; - int count = 0; - int count2 = 0; - int tempLine[320]; - int tempRow[200]; - - clearRoom(); - - loadPic("sv.alg", drawSurface1, HALF_PAL); - - // inicio_ghost(); - copia = (byte *)malloc(64000); - ghost = (byte *)malloc(65536); - - // carga_ghost(); - _arj.open("ghost.drv"); - if (!_arj.isOpen()) - error("Cannot open file ghost.drv"); - - _arj.read(ghost, 65536); - _arj.close(); - - updateEvents(); - xr = mouseX; - yr = mouseY; - - for (;;) { - // efecto(drawSurface1); - - memcpy(copia, drawSurface1, 64000); - coeff += 0.1f; - coeff2 = coeff; - - if (++count > 319) - count = 0; - - for (int i = 0; i < 320; i++) { - tempLine[i] = (int)(sin(coeff2) * 16); - coeff2 += 0.02f; - tempLine[i] = checkWrapY(tempLine[i]); - } - - coeff2 = coeff; - for (int i = 0; i < 200; i++) { - tempRow[i] = (int)(sin(coeff2) * 16); - coeff2 += 0.02f; - tempRow[i] = checkWrapX(tempRow[i]); - } - - if (++count2 > 199) - count2 = 0; - - int x1_, y1_, off1, off2; - - for (int i = 0; i < 200; i++) { - for (int j = 0; j < 320; j++) { - x1_ = j + tempRow[i]; - x1_ = checkWrapX(x1_); - - y1_ = i + count2; - y1_ = checkWrapY(y1_); - - off1 = 320 * y1_ + x1_; - - x1_ = j + count; - x1_ = checkWrapX(x1_); - - y1_ = i + tempLine[j]; - y1_ = checkWrapY(y1_); - off2 = 320 * y1_ + x1_; - - VGA[320 * i + j] = ghost[drawSurface1[off2] + (copia[off1] << 8)]; - } - } - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - _system->updateScreen(); - - _system->delayMillis(20); - - // end of efecto() - - updateEvents(); - if (rightMouseButton == 1 || leftMouseButton == 1) - break; - if (mouseX != xr) - break; - if (mouseY != yr) - break; - } - // fin_ghost(); - free(copia); - free(ghost); - - loadPic(roomNumber, drawSurface1, HALF_PAL); -} - -void DrasculaEngine::playFLI(const char *filefli, int vel) { - // Open file - MiVideoSSN = (byte *)malloc(64256); - globalSpeed = 1000 / vel; - FrameSSN = 0; - UsingMem = 0; - if (MiVideoSSN == NULL) - return; - _arj.open(filefli); - mSession = TryInMem(); - LastFrame = _system->getMillis(); - - while (playFrameSSN() && (!term_int)) { - if (getScan() == Common::KEYCODE_ESCAPE) - term_int = 1; - } - - free(MiVideoSSN); - if (UsingMem) - free(pointer); - else - _arj.close(); -} - -void DrasculaEngine::fadeFromBlack(int fadeSpeed) { - char fade; - unsigned int color, component; - - DacPalette256 palFade; - - for (fade = 0; fade < 64; fade++) { - for (color = 0; color < 256; color++) { - for (component = 0; component < 3; component++) { - palFade[color][component] = adjustToVGA(gamePalette[color][component] - 63 + fade); - } - } - pause(fadeSpeed); - - setPalette((byte *)&palFade); - } -} - -void DrasculaEngine::color_abc(int cl) { - _color = cl; - - char colorTable[][3] = { - { 0, 0, 0 }, { 0x10, 0x3E, 0x28 }, - { 0, 0, 0 }, // unused - { 0x16, 0x3F, 0x16 }, { 0x09, 0x3F, 0x12 }, - { 0x3F, 0x3F, 0x15 }, - { 0, 0, 0 }, // unused - { 0x38, 0, 0 }, { 0x3F, 0x27, 0x0B }, - { 0x2A, 0, 0x2A }, { 0x30, 0x30, 0x30 }, - { 98, 91, 100 } - }; - - for (int i = 0; i <= 2; i++) - gamePalette[254][i] = colorTable[cl][i]; - - setPalette((byte *)&gamePalette); -} - -char DrasculaEngine::adjustToVGA(char value) { - return (value & 0x3F) * (value > 0); -} - -void DrasculaEngine::centerText(const char *message, int textX, int textY) { - char bb[200], m2[200], m1[200], mb[10][50]; - char m3[200]; - int h, fil, textX3, textX2, textX1, conta_f = 0, ya = 0; - - strcpy(m1, " "); - strcpy(m2, " "); - strcpy(m3, " "); - strcpy(bb, " "); - - for (h = 0; h < 10; h++) - strcpy(mb[h], " "); - - if (textX > 160) - ya = 1; - - strcpy(m1, message); - textX = CLIP<int>(textX, 60, 255); - - textX1 = textX; - - if (ya == 1) - textX1 = 315 - textX; - - textX2 = (strlen(m1) / 2) * CHAR_WIDTH; - - while (true) { - strcpy(bb, m1); - scumm_strrev(bb); - - if (textX1 < textX2) { - strcpy(m3, strrchr(m1, ' ')); - strcpy(m1, strstr(bb, " ")); - scumm_strrev(m1); - m1[strlen(m1) - 1] = '\0'; - strcat(m3, m2); - strcpy(m2, m3); - }; - - textX2 = (strlen(m1) / 2) * CHAR_WIDTH; - - if (textX1 < textX2) - continue; - - strcpy(mb[conta_f], m1); - - if (!strcmp(m2, "")) - break; - - scumm_strrev(m2); - m2[strlen(m2) - 1] = '\0'; - scumm_strrev(m2); - strcpy(m1, m2); - strcpy(m2, ""); - conta_f++; - } - - fil = textY - (((conta_f + 3) * CHAR_HEIGHT)); - - for (h = 0; h < conta_f + 1; h++) { - textX3 = strlen(mb[h]) / 2; - print_abc(mb[h], ((textX) - textX3 * CHAR_WIDTH) - 1, fil); - fil = fil + CHAR_HEIGHT + 2; - } -} - -void DrasculaEngine::playSound(int soundNum) { - char file[20]; - sprintf(file, "s%i.als", soundNum); - - playFile(file); -} - -bool DrasculaEngine::animate(const char *animationFile, int FPS) { - unsigned j; - int NFrames = 1; - int cnt = 2; - int dataSize = 0; - - AuxBuffLast = (byte *)malloc(65000); - AuxBuffDes = (byte *)malloc(65000); - - _arj.open(animationFile); - - if (!_arj.isOpen()) { - error("Animation file %s not found", animationFile); - } - - NFrames = _arj.readSint32LE(); - dataSize = _arj.readSint32LE(); - AuxBuffOrg = (byte *)malloc(dataSize); - _arj.read(AuxBuffOrg, dataSize); - _arj.read(cPal, 768); - loadPCX(AuxBuffOrg); - free(AuxBuffOrg); - memcpy(VGA, AuxBuffDes, 64000); - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - _system->updateScreen(); - setPalette(cPal); - memcpy(AuxBuffLast, AuxBuffDes, 64000); - WaitForNext(FPS); - while (cnt < NFrames) { - dataSize = _arj.readSint32LE(); - AuxBuffOrg = (byte *)malloc(dataSize); - _arj.read(AuxBuffOrg, dataSize); - _arj.read(cPal, 768); - loadPCX(AuxBuffOrg); - free(AuxBuffOrg); - for (j = 0;j < 64000; j++) { - VGA[j] = AuxBuffLast[j] = AuxBuffDes[j] ^ AuxBuffLast[j]; - } - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - _system->updateScreen(); - WaitForNext(FPS); - cnt++; - byte key = getScan(); - if (key == Common::KEYCODE_ESCAPE) - term_int = 1; - if (key != 0) - break; - } - free(AuxBuffLast); - free(AuxBuffDes); - _arj.close(); - - return ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE)); -} - -void DrasculaEngine::fadeToBlack(int fadeSpeed) { - char fade; - unsigned int color, component; - - DacPalette256 palFade; - - for (fade = 63; fade >= 0; fade--) { - for (color = 0; color < 256; color++) { - for (component = 0; component < 3; component++) { - palFade[color][component] = adjustToVGA(gamePalette[color][component] - 63 + fade); - } - } - pause(fadeSpeed); - - setPalette((byte *)&palFade); - } -} - void DrasculaEngine::pause(int duration) { _system->delayMillis(duration * 30); // was originaly 2 } -void DrasculaEngine::placeIgor() { - int pos_igor[6]; - - pos_igor[0] = 1; - if (currentChapter == 4) { - pos_igor[1] = 138; - } else { - if (trackIgor == 3) - pos_igor[1] = 138; - else if (trackIgor == 1) - pos_igor[1] = 76; - } - pos_igor[2] = igorX; - pos_igor[3] = igorY; - pos_igor[4] = 54; - pos_igor[5] = 61; - - copyRectClip(pos_igor, frontSurface, screenSurface); -} - -void DrasculaEngine::placeDrascula() { - int pos_dr[6]; - - 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; - pos_dr[1] = 122; - pos_dr[2] = x_dr; - pos_dr[3] = y_dr; - pos_dr[4] = 45; - pos_dr[5] = 77; - - if (currentChapter == 6) - copyRectClip(pos_dr, drawSurface2, screenSurface); - else - copyRectClip(pos_dr, backSurface, screenSurface); -} - -void DrasculaEngine::placeBJ() { - int pos_bj[6]; - - if (trackBJ == 3) - pos_bj[0] = 10; - else if (trackBJ == 0) - pos_bj[0] = 37; - pos_bj[1] = 99; - pos_bj[2] = x_bj; - pos_bj[3] = y_bj; - pos_bj[4] = 26; - pos_bj[5] = 76; - - 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::finishSound() { - delay(1); - - while (soundIsActive()) - _system->delayMillis(10); -} - -void DrasculaEngine::playMusic(int p) { - AudioCD.stop(); - AudioCD.play(p - 1, 1, 0, 0); -} - -void DrasculaEngine::stopMusic() { - AudioCD.stop(); -} - -int DrasculaEngine::musicStatus() { - return AudioCD.isPlaying(); -} - -void DrasculaEngine::updateRoom() { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - updateRefresh_pre(); - if (currentChapter == 3) { - if (flags[0] == 0) - moveCharacters(); - else - copyRect(113, 54, curX - 20, curY - 1, 77, 89, drawSurface3, screenSurface); - } else { - moveCharacters(); - } - updateRefresh(); -} - -bool DrasculaEngine::loadGame(const char *gameName) { - int l, savedChapter, roomNum = 0; - Common::InSaveFile *sav; - - previousMusic = roomMusic; - menuScreen = 0; - if (currentChapter != 1) - clearRoom(); - - if (!(sav = _saveFileMan->openForLoading(gameName))) { - error("missing savegame file"); - } - - savedChapter = sav->readSint32LE(); - if (savedChapter != currentChapter) { - strcpy(saveName, gameName); - currentChapter = savedChapter - 1; - hay_que_load = 1; - return false; - } - sav->read(currentData, 20); - curX = sav->readSint32LE(); - curY = sav->readSint32LE(); - trackProtagonist = sav->readSint32LE(); - - for (l = 1; l < 43; l++) { - inventoryObjects[l] = sav->readSint32LE(); - } - - for (l = 0; l < NUM_FLAGS; l++) { - flags[l] = sav->readSint32LE(); - } - - takeObject = sav->readSint32LE(); - pickedObject = sav->readSint32LE(); - hay_que_load = 0; - sscanf(currentData, "%d.ald", &roomNum); - enterRoom(roomNum); - withoutVerb(); - - return true; -} - -void DrasculaEngine::updateDoor(int doorNum) { - if (currentChapter == 1 || currentChapter == 3 || currentChapter == 5 || currentChapter == 6) - return; - else if (currentChapter == 2) { - if (objectNum[doorNum] == 138) - isDoor[doorNum] = flags[0]; - else if (objectNum[doorNum] == 136) - isDoor[doorNum] = flags[8]; - else if (objectNum[doorNum] == 156) - isDoor[doorNum] = flags[16]; - else if (objectNum[doorNum] == 163) - isDoor[doorNum] = flags[17]; - else if (objectNum[doorNum] == 177) - isDoor[doorNum] = flags[15]; - else if (objectNum[doorNum] == 175) - isDoor[doorNum] = flags[40]; - else if (objectNum[doorNum] == 173) - isDoor[doorNum] = flags[36]; - } else if (currentChapter == 4) { - if (objectNum[doorNum] == 101 && flags[0] == 0) - isDoor[doorNum] = 0; - else if (objectNum[doorNum] == 101 && flags[0] == 1 && flags[28] == 1) - isDoor[doorNum] = 1; - else if (objectNum[doorNum] == 103) - isDoor[doorNum] = flags[0]; - else if (objectNum[doorNum] == 104) - isDoor[doorNum] = flags[1]; - else if (objectNum[doorNum] == 105) - isDoor[doorNum] = flags[1]; - else if (objectNum[doorNum] == 106) - isDoor[doorNum] = flags[2]; - else if (objectNum[doorNum] == 107) - isDoor[doorNum] = flags[2]; - else if (objectNum[doorNum] == 110) - isDoor[doorNum] = flags[6]; - else if (objectNum[doorNum] == 114) - isDoor[doorNum] = flags[4]; - else if (objectNum[doorNum] == 115) - isDoor[doorNum] = flags[4]; - else if (objectNum[doorNum] == 116 && flags[5] == 0) - isDoor[doorNum] = 0; - else if (objectNum[doorNum] == 116 && flags[5] == 1 && flags[23] == 1) - isDoor[doorNum] = 1; - else if (objectNum[doorNum] == 117) - isDoor[doorNum] = flags[5]; - else if (objectNum[doorNum] == 120) - isDoor[doorNum] = flags[8]; - else if (objectNum[doorNum] == 122) - isDoor[doorNum] = flags[7]; - } -} - -void DrasculaEngine::assignDefaultPalette() { - int color, component; - - for (color = 235; color < 253; color++) - for (component = 0; component < 3; component++) - defaultPalette[color][component] = gamePalette[color][component]; -} - -void DrasculaEngine::assignBrightPalette() { - int color, component; - - for (color = 235; color < 253; color++) { - for (component = 0; component < 3; component++) - brightPalette[color][component] = gamePalette[color][component]; - } -} - -void DrasculaEngine::assignDarkPalette() { - int color, component; - - for (color = 235; color < 253; color++) { - for (component = 0; component < 3; component++) - darkPalette[color][component] = gamePalette[color][component]; - } -} - -void DrasculaEngine::setDefaultPalette() { - int color, component; - - for (color = 235; color < 253; color++) { - for (component = 0; component < 3; component++) { - gamePalette[color][component] = defaultPalette[color][component]; - } - } - setPalette((byte *)&gamePalette); -} - -void DrasculaEngine::setBrightPalette() { - int color, component; - - for (color = 235; color < 253; color++) { - for (component = 0; component < 3; component++) - gamePalette[color][component] = brightPalette[color][component]; - } - - setPalette((byte *)&gamePalette); -} - -void DrasculaEngine::setDarkPalette() { - int color, component; - - for (color = 235; color < 253; color++ ) - for (component = 0; component < 3; component++) - gamePalette[color][component] = darkPalette[color][component]; - - setPalette((byte *)&gamePalette); -} - -void DrasculaEngine::setPaletteBase(int darkness) { - char fade; - unsigned int color, component; - - for (fade = darkness; fade >= 0; fade--) { - for (color = 235; color < 253; color++) { - for (component = 0; component < 3; component++) - gamePalette[color][component] = adjustToVGA(gamePalette[color][component] - 8 + fade); - } - } - - setPalette((byte *)&gamePalette); -} - -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] = frame_x[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::showMenu() { - int h, n, x; - char textIcon[13]; - - x = whichObject(); - strcpy(textIcon, iconName[x]); - - for (n = 1; n < 43; n++) { - h = inventoryObjects[n]; - - if (h != 0) { - if (currentChapter == 6) - copyBackground(x_pol[n], y_pol[n], itemLocations[n].x, itemLocations[n].y, - OBJWIDTH, OBJHEIGHT, tableSurface, screenSurface); - else - copyBackground(x_pol[n], y_pol[n], itemLocations[n].x, itemLocations[n].y, - OBJWIDTH, OBJHEIGHT, frontSurface, screenSurface); - } - copyRect(x1d_menu[h], y1d_menu[h], itemLocations[n].x, itemLocations[n].y, - OBJWIDTH, OBJHEIGHT, backSurface, screenSurface); - } - - if (x < 7) - print_abc(textIcon, itemLocations[x].x - 2, itemLocations[x].y - 7); -} - -void DrasculaEngine::clearMenu() { - int n, verbActivated = 1; - - for (n = 0; n < 7; n++) { - if (mouseX > verbBarX[n] && mouseX < verbBarX[n + 1]) - verbActivated = 0; - copyRect(OBJWIDTH * n, OBJHEIGHT * verbActivated, verbBarX[n], 2, - OBJWIDTH, OBJHEIGHT, backSurface, screenSurface); - verbActivated = 1; - } -} - -void DrasculaEngine::removeObject() { - int h = 0, n; - - updateRoom(); - - for (n = 1; n < 43; n++){ - if (whichObject() == n) { - h = inventoryObjects[n]; - inventoryObjects[n] = 0; - if (h != 0) - takeObject = 1; - } - } - - updateEvents(); - - if (takeObject == 1) - chooseObject(h); -} - -bool DrasculaEngine::exitRoom(int l) { - debug(2, "Exiting room from door %d", l); - - int roomNum = 0; - - if (currentChapter == 1) { - if (objectNum[l] == 105 && flags[0] == 0) - talk(442); - else { - updateDoor(l); - if (isDoor[l] != 0) { - gotoObject(roomObjX[l], roomObjY[l]); - trackProtagonist = trackObj[l]; - updateRoom(); - updateScreen(); - characterMoved = 0; - trackProtagonist = trackCharacter_alkeva[l]; - objExit = alapuertakeva[l]; - doBreak = 1; - previousMusic = roomMusic; - - if (objectNum[l] == 105) { - animation_2_1(); - return true; - } - clearRoom(); - sscanf(_targetSurface[l], "%d", &roomNum); - curX = -1; - enterRoom(roomNum); - } - } - } else if (currentChapter == 2) { - updateDoor(l); - if (isDoor[l] != 0) { - gotoObject(roomObjX[l], roomObjY[l]); - characterMoved = 0; - trackProtagonist = trackCharacter_alkeva[l]; - objExit = alapuertakeva[l]; - doBreak = 1; - previousMusic = roomMusic; - if (objectNum[l] == 136) - animation_2_2(); - if (objectNum[l] == 124) - animation_3_2(); - if (objectNum[l] == 173) { - animation_35_2(); - return true; - } if (objectNum[l] == 146 && flags[39] == 1) { - flags[5] = 1; - flags[11] = 1; - } - if (objectNum[l] == 176 && flags[29] == 1) { - flags[29] = 0; - removeObject(kItemEarWithEarPlug); - addObject(kItemEarplugs); - } - clearRoom(); - sscanf(_targetSurface[l], "%d", &roomNum); - curX =- 1; - enterRoom(roomNum); - } - } else if (currentChapter == 3) { - updateDoor(l); - if (isDoor[l] != 0 && visible[l] == 1) { - gotoObject(roomObjX[l], roomObjY[l]); - trackProtagonist = trackObj[l]; - updateRoom(); - updateScreen(); - characterMoved = 0; - trackProtagonist = trackCharacter_alkeva[l]; - objExit = alapuertakeva[l]; - doBreak = 1; - previousMusic = roomMusic; - clearRoom(); - sscanf(_targetSurface[l], "%d", &roomNum); - curX =- 1; - enterRoom(roomNum); - } - } else if (currentChapter == 4) { - updateDoor(l); - if (isDoor[l] != 0) { - gotoObject(roomObjX[l], roomObjY[l]); - trackProtagonist = trackObj[l]; - updateRoom(); - updateScreen(); - characterMoved = 0; - trackProtagonist = trackCharacter_alkeva[l]; - objExit = alapuertakeva[l]; - doBreak = 1; - previousMusic = roomMusic; - - if (objectNum[l] == 108) - gotoObject(171, 78); - clearRoom(); - sscanf(_targetSurface[l], "%d", &roomNum); - curX = -1; - enterRoom(roomNum); - } - } else if (currentChapter == 5) { - updateDoor(l); - if (isDoor[l] != 0 && visible[l] == 1) { - gotoObject(roomObjX[l], roomObjY[l]); - trackProtagonist = trackObj[l]; - updateRoom(); - updateScreen(); - characterMoved = 0; - trackProtagonist = trackCharacter_alkeva[l]; - objExit = alapuertakeva[l]; - doBreak = 1; - previousMusic = roomMusic; - hare_se_ve = 1; - clearRoom(); - sscanf(_targetSurface[l], "%d", &roomNum); - curX = -1; - enterRoom(roomNum); - } - } else if (currentChapter == 6) { - updateDoor(l); - if (isDoor[l] != 0) { - gotoObject(roomObjX[l], roomObjY[l]); - trackProtagonist = trackObj[l]; - updateRoom(); - updateScreen(); - characterMoved = 0; - trackProtagonist = trackCharacter_alkeva[l]; - objExit = alapuertakeva[l]; - doBreak = 1; - previousMusic = roomMusic; - clearRoom(); - sscanf(_targetSurface[l], "%d", &roomNum); - curX = -1; - enterRoom(roomNum); - - if (objExit == 105) - animation_19_6(); - } - } - - return false; -} - -bool DrasculaEngine::pickupObject() { - int h = pickedObject; - checkFlags = 1; - - updateRoom(); - showMenu(); - updateScreen(); - - // Objects with an ID smaller than 7 are the inventory verbs - if (pickedObject >= 7) { - for (int n = 1; n < 43; n++) { - if (whichObject() == n && inventoryObjects[n] == 0) { - inventoryObjects[n] = h; - takeObject = 0; - checkFlags = 0; - } - } - } - - if (checkFlags == 1) { - if (checkMenuFlags()) - return true; - } - updateEvents(); - if (takeObject == 0) - withoutVerb(); - - return false; -} - -void DrasculaEngine::setCursorTable() { - int cursorPos[8]; - - cursorPos[0] = 225; - cursorPos[1] = 56; - cursorPos[2] = mouseX - 20; - cursorPos[3] = mouseY - 12; - cursorPos[4] = 40; - cursorPos[5] = 25; - - copyRectClip(cursorPos, tableSurface, screenSurface); -} - -void DrasculaEngine::enterName() { - Common::KeyCode key; - int v = 0, h = 0; - char select2[23]; - strcpy(select2, " "); - for (;;) { - select2[v] = '-'; - copyBackground(115, 14, 115, 14, 176, 9, drawSurface1, screenSurface); - print_abc(select2, 117, 15); - updateScreen(); - key = getScan(); - delay(70); - if (key != 0) { - if (key >= 0 && key <= 0xFF && isalpha(key)) - select2[v] = tolower(key); - else if ((key == Common::KEYCODE_LCTRL) || (key == Common::KEYCODE_RCTRL)) - select2[v] = '\164'; - else if (key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) - select2[v] = key; - else if (key == Common::KEYCODE_SPACE) - select2[v] = '\167'; - else if (key == Common::KEYCODE_ESCAPE) - break; - else if (key == Common::KEYCODE_RETURN) { - select2[v] = '\0'; - h = 1; - break; - } else if (key == Common::KEYCODE_BACKSPACE) - select2[v] = '\0'; - else - v--; - - if (key == Common::KEYCODE_BACKSPACE) - v--; - else - v++; - } - if (v == 22) - v = 21; - else if (v == -1) - v = 0; - } - if (h == 1) { - strcpy(select, select2); - selectionMade = 1; - } -} - -int DrasculaEngine::playFrameSSN() { - int Exit = 0; - uint32 Lengt; - byte *BufferSSN; - - if (!UsingMem) - _arj.read(&CHUNK, 1); - else { - memcpy(&CHUNK, mSession, 1); - mSession += 1; - } - - switch (CHUNK) { - case kFrameSetPal: - if (!UsingMem) - _arj.read(dacSSN, 768); - else { - memcpy(dacSSN, mSession, 768); - mSession += 768; - } - setPalette(dacSSN); - break; - case kFrameEmptyFrame: - WaitFrameSSN(); - break; - case kFrameInit: - if (!UsingMem) { - CMP = _arj.readByte(); - Lengt = _arj.readUint32LE(); - } else { - memcpy(&CMP, mSession, 1); - mSession += 1; - Lengt = READ_LE_UINT32(mSession); - mSession += 4; - } - if (CMP == kFrameCmpRle) { - if (!UsingMem) { - BufferSSN = (byte *)malloc(Lengt); - _arj.read(BufferSSN, Lengt); - } else { - BufferSSN = (byte *)malloc(Lengt); - memcpy(BufferSSN, mSession, Lengt); - mSession += Lengt; - } - Des_RLE(BufferSSN, MiVideoSSN); - free(BufferSSN); - if (FrameSSN) { - WaitFrameSSN(); - MixVideo(VGA, MiVideoSSN); - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - } else { - WaitFrameSSN(); - memcpy(VGA, MiVideoSSN, 64000); - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - } - _system->updateScreen(); - FrameSSN++; - } else { - if (CMP == kFrameCmpOff) { - if (!UsingMem) { - BufferSSN = (byte *)malloc(Lengt); - _arj.read(BufferSSN, Lengt); - } else { - BufferSSN = (byte *)malloc(Lengt); - memcpy(BufferSSN, mSession, Lengt); - mSession += Lengt; - } - Des_OFF(BufferSSN, MiVideoSSN, Lengt); - free(BufferSSN); - if (FrameSSN) { - WaitFrameSSN(); - MixVideo(VGA, MiVideoSSN); - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - } else { - WaitFrameSSN(); - memcpy(VGA, MiVideoSSN, 64000); - _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); - } - _system->updateScreen(); - FrameSSN++; - } - } - break; - case kFrameEndAnim: - Exit = 1; - break; - default: - Exit = 1; - break; - } - - return (!Exit); -} - -byte *DrasculaEngine::TryInMem() { - int Lengt; - - _arj.seek(0, SEEK_END); - Lengt = _arj.pos(); - _arj.seek(0, SEEK_SET); - pointer = (byte *)malloc(Lengt); - if (pointer == NULL) - return NULL; - _arj.read(pointer, Lengt); - UsingMem = 1; - _arj.close(); - - return pointer; -} - -void DrasculaEngine::Des_OFF(byte *BufferOFF, byte *MiVideoOFF, int Lenght) { - int x = 0; - unsigned char Reps; - int Offset; - - memset(MiVideoSSN, 0, 64000); - while (x < Lenght) { - Offset = BufferOFF[x] + BufferOFF[x + 1] * 256; - Reps = BufferOFF[x + 2]; - memcpy(MiVideoOFF + Offset, &BufferOFF[x + 3], Reps); - x += 3 + Reps; - } -} - -void DrasculaEngine::Des_RLE(byte *BufferRLE, byte *MiVideoRLE) { - signed int con = 0; - unsigned int X = 0; - unsigned int fExit = 0; - char ch, rep; - while (!fExit) { - ch = *BufferRLE++; - rep = 1; - if ((ch & 192) == 192) { - rep = (ch & 63); - ch =* BufferRLE++; - } - for (con = 0; con < rep; con++) { - *MiVideoRLE++ = ch; - X++; - if (X > 64000) - fExit = 1; - } - } -} - -void DrasculaEngine::MixVideo(byte *OldScreen, byte *NewScreen) { - int x; - for (x = 0; x < 64000; x++) - OldScreen[x] ^= NewScreen[x]; -} - -void DrasculaEngine::WaitFrameSSN() { - uint32 now; - while ((now = _system->getMillis()) - LastFrame < ((uint32) globalSpeed)) - _system->delayMillis(globalSpeed - (now - LastFrame)); - LastFrame = LastFrame + globalSpeed; -} - -byte *DrasculaEngine::loadPCX(byte *NamePcc) { - signed int con = 0; - unsigned int X = 0; - unsigned int fExit = 0; - char ch, rep; - byte *AuxPun; - - AuxPun = AuxBuffDes; - - while (!fExit) { - ch = *NamePcc++; - rep = 1; - if ((ch & 192) == 192) { - rep = (ch & 63); - ch = *NamePcc++; - } - for (con = 0; con< rep; con++) { - *AuxPun++ = ch; - X++; - if (X > 64000) - fExit = 1; - } - } - return AuxBuffDes; -} - -void DrasculaEngine::WaitForNext(int FPS) { - _system->delayMillis(1000 / FPS); -} - int DrasculaEngine::getTime() { return _system->getMillis() / 20; // originaly was 1 } @@ -2852,660 +747,13 @@ void DrasculaEngine::reduce_hare_chico(int xx1, int yy1, int xx2, int yy2, int w copyRectClip(pixelPos, dir_inicio, dir_fin); - pixelX = pixelX + totalX; + pixelX += totalX; } pixelX = xx1; - pixelY = pixelY + totalY; - } -} - -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::saveGame(char gameName[]) { - Common::OutSaveFile *out; - int l; - - if (!(out = _saveFileMan->openForSaving(gameName))) { - error("no puedo abrir el archivo"); - } - out->writeSint32LE(currentChapter); - out->write(currentData, 20); - out->writeSint32LE(curX); - out->writeSint32LE(curY); - out->writeSint32LE(trackProtagonist); - - for (l = 1; l < 43; l++) { - out->writeSint32LE(inventoryObjects[l]); - } - - for (l = 0; l < NUM_FLAGS; l++) { - out->writeSint32LE(flags[l]); - } - - out->writeSint32LE(takeObject); - out->writeSint32LE(pickedObject); - - out->finalize(); - if (out->ioFailed()) - warning("Can't write file '%s'. (Disk full?)", gameName); - - delete out; - - playSound(99); - finishSound(); -} - -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; - } -} - -int DrasculaEngine::whichObject() { - int n = 0; - - for (n = 1; n < 43; n++) { - if (mouseX > itemLocations[n].x && mouseY > itemLocations[n].y - && mouseX < itemLocations[n].x + OBJWIDTH && mouseY < itemLocations[n].y + OBJHEIGHT) - break; - } - - return n; -} - -bool DrasculaEngine::checkMenuFlags() { - int h, n; - - for (n = 0; n < 43; n++) { - if (whichObject() == n) { - h = inventoryObjects[n]; - if (h != 0) - if (checkAction(h)) - return true; - } - } - - return false; -} - -void DrasculaEngine::converse(int index) { - char fileName[20]; - sprintf(fileName, "op_%d.cal", index); - int 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 length; - int answer1; - int answer2; - int answer3; - int used1 = 0; - int used2 = 0; - int used3 = 0; - char buffer[256]; - - 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, " cuanto queda para que acabe el partido?"); - strcpy(sound3, "274.als"); - answer3 = 15; - } - - length = strlen(phrase1); - for (h = 0; h < length; h++) - if (phrase1[h] == (char)0xa7) - phrase1[h] = ' '; - - length = strlen(phrase2); - for (h = 0; h < length; h++) - if (phrase2[h] == (char)0xa7) - phrase2[h] = ' '; - - length = strlen(phrase3); - for (h = 0; h < length; h++) - if (phrase3[h] == (char)0xa7) - phrase3[h] = ' '; - - length = strlen(phrase4); - for (h = 0; h < length; 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(); - } -} - -void DrasculaEngine::addObject(int obj) { - int h, position = 0; - - for (h = 1; h < 43; h++) { - if (inventoryObjects[h] == obj) - position = 1; - } - - if (position == 0) { - for (h = 1; h < 43; h++) { - if (inventoryObjects[h] == 0) { - inventoryObjects[h] = obj; - position = 1; - break; - } - } - } -} - -void DrasculaEngine::stopSound() { - _mixer->stopHandle(_soundHandle); -} - -void DrasculaEngine::MusicFadeout() { - int org_vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType); - for (;;) { - int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType); - vol -= 10; - if (vol < 0) - vol = 0; - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); - if (vol == 0) - break; - updateEvents(); - _system->updateScreen(); - _system->delayMillis(50); - } - AudioCD.stop(); - _system->delayMillis(100); - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, org_vol); -} - -void DrasculaEngine::playFile(const char *fname) { - _arj.open(fname); - - int soundSize = _arj.size(); - byte *soundData = (byte *)malloc(soundSize); - _arj.seek(32); - _arj.read(soundData, soundSize); - _arj.close(); - - _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_soundHandle, soundData, soundSize - 64, - 11025, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED); -} - -bool DrasculaEngine::soundIsActive() { - return _mixer->isSoundHandleActive(_soundHandle); -} - -void DrasculaEngine::updateVisible() { - if (currentChapter == 1) { - // nothing - } else if (currentChapter == 2) { - if (roomNumber == 2 && flags[40] == 0) - visible[3] = 0; - else if (roomNumber == 3 && flags[3] == 1) - visible[8] = 0; - else if (roomNumber == 6 && flags[1] == 1 && flags[10] == 0) { - visible[2] = 0; - visible[4] = 1; - } else if (roomNumber == 7 && flags[35] == 1) - visible[3] = 0; - else if (roomNumber == 14 && flags[5] == 1) - visible[4] = 0; - else if (roomNumber == 18 && flags[28] == 1) - visible[2] = 0; - } else if (currentChapter == 3) { - // nothing - } else if (currentChapter == 4) { - if (roomNumber == 23 && flags[0] == 0 && flags[11] == 0) - visible[2] = 1; - if (roomNumber == 23 && flags[0] == 1 && flags[11] == 0) - visible[2] = 0; - if (roomNumber == 21 && flags[10] == 1) - visible[2] = 0; - if (roomNumber == 22 && flags[26] == 1) { - visible[2] = 0; - visible[1] = 1; - } - if (roomNumber == 22 && flags[27] == 1) - visible[3] = 0; - if (roomNumber == 26 && flags[21] == 0) - strcpy(objName[2], _textmisc[_lang][0]); - if (roomNumber == 26 && flags[18] == 1) - visible[2] = 0; - if (roomNumber == 26 && flags[12] == 1) - visible[1] = 0; - if (roomNumber == 35 && flags[14] == 1) - visible[2] = 0; - if (roomNumber == 35 && flags[17] == 1) - visible[3] = 1; - if (roomNumber == 35 && flags[15] == 1) - visible[1] = 0; - } else if (currentChapter == 5) { - if (roomNumber == 49 && flags[6] == 1) - visible[2] = 0; - if (roomNumber == 49 && flags[6] == 0) - visible[1] = 0; - if (roomNumber == 49 && flags[6] == 1) - visible[1] = 1; - if (roomNumber == 45 && flags[6] == 1) - visible[3] = 1; - if (roomNumber == 53 && flags[2] == 1) - visible[3] = 0; - if (roomNumber == 54 && flags[13] == 1) - visible[3] = 0; - if (roomNumber == 55 && flags[8] == 1) - visible[1] = 0; - } else if (currentChapter == 6) { - if (roomNumber == 58 && flags[8] == 0) - isDoor[1] = 0; - if (roomNumber == 58 && flags[8] == 1) - isDoor[1] = 1; - if (roomNumber == 59) - isDoor[1] = 0; - if (roomNumber == 60) { - trackDrascula = 0; - x_dr = 155; - y_dr = 69; - } + pixelY += totalY; } } -void DrasculaEngine::walkDown() { - curDirection = 4; - trackProtagonist = 3; - stepX = 0; -} - -void DrasculaEngine::walkUp() { - curDirection = 0; - trackProtagonist = 2; - stepX = 0; -} - -void DrasculaEngine::moveVB() { - int pos_vb[6]; - - if (vbHasMoved == 0) { - pos_vb[0] = 256; - pos_vb[1] = 129; - pos_vb[2] = vbX; - pos_vb[3] = 66; - pos_vb[4] = 33; - pos_vb[5] = 69; - if (trackVB == 0) - pos_vb[0] = 222; - else if (trackVB == 1) - pos_vb[0] = 188; - } else { - pos_vb[2] = vbX; - pos_vb[3] = 66; - pos_vb[4] = 28; - pos_vb[5] = 68; - - if (trackVB == 0) { - pos_vb[0] = frame_vb; - pos_vb[1] = 62; - } else { - pos_vb[0] = frame_vb; - pos_vb[1] = 131; - } - - frame_vb = frame_vb + 29; - if (frame_vb > 146) - frame_vb = 1; - } - - copyRectClip(pos_vb, frontSurface, screenSurface); -} - -void DrasculaEngine::placeVB(int pointX) { - trackVB = (pointX < vbX) ? 0 : 1; - vbHasMoved = 1; - - for (;;) { - updateRoom(); - updateScreen(); - if (trackVB == 0) { - vbX = vbX - 5; - if (vbX <= pointX) - break; - } else { - vbX = vbX + 5; - if (vbX >= pointX) - break; - } - pause(5); - } - - vbHasMoved = 0; -} - void DrasculaEngine::hipo_sin_nadie(int counter){ int y = 0, trackCharacter = 0; if (currentChapter == 3) @@ -3514,7 +762,7 @@ void DrasculaEngine::hipo_sin_nadie(int counter){ do { counter--; - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); if (currentChapter == 3) updateScreen(0, 0, 0, y, 320, 200, screenSurface); else @@ -3538,94 +786,212 @@ void DrasculaEngine::hipo_sin_nadie(int counter){ } } while (counter > 0); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateScreen(); } -void DrasculaEngine::openDoor(int nflag, int doorNum) { - if (flags[nflag] == 0) { - if (currentChapter == 1 /*|| currentChapter == 4*/) { - if (nflag != 7) { - playSound(3); - flags[nflag] = 1; - } - } else { - playSound(3); - flags[nflag] = 1; - } +bool DrasculaEngine::loadDrasculaDat() { + Common::File in; + int i; - if (doorNum != NO_DOOR) - updateDoor(doorNum); - updateRoom(); - updateScreen(); - finishSound(); - withoutVerb(); + in.open("drascula.dat"); + + if (!in.isOpen()) { + Common::String errorMessage = "You're missing the 'drascula.dat' file. Get it from the ScummVM website"; + GUIErrorMessage(errorMessage); + warning(errorMessage.c_str()); + + return false; } -} -void DrasculaEngine::showMap() { - int l, veo = 0; + char buf[256]; + int ver; - for (l = 0; l < numRoomObjs; l++) { - if (mouseX > x1[l] && mouseY > y1[l] - && mouseX < x2[l] && mouseY < y2[l] - && visible[l] == 1) { - strcpy(textName, objName[l]); - hasName = 1; - veo = 1; - } + in.read(buf, 8); + buf[8] = '\0'; + + if (strcmp(buf, "DRASCULA")) { + Common::String errorMessage = "File 'drascula.dat' is corrupt. Get it from the ScummVM website"; + GUIErrorMessage(errorMessage); + warning(errorMessage.c_str()); + + return false; } - if (veo == 0) - hasName = 0; + ver = in.readByte(); + + if (ver != DRASCULA_DAT_VER) { + snprintf(buf, 256, "File 'drascula.dat' is wrong version. Expected %d but got %d. Get it from the ScummVM website", DRASCULA_DAT_VER, ver); + GUIErrorMessage(buf); + warning(buf); + + return false; + } + + _charMapSize = in.readUint16BE(); + _charMap = (CharInfo *)malloc(sizeof(CharInfo) * _charMapSize); + for (i = 0; i < _charMapSize; i++) { + _charMap[i].inChar = in.readByte(); + _charMap[i].mappedChar = in.readSint16BE(); + _charMap[i].charType = in.readByte(); + } + + _itemLocationsSize = in.readUint16BE(); + _itemLocations = (ItemLocation *)malloc(sizeof(ItemLocation) * _itemLocationsSize); + for (i = 0; i < _itemLocationsSize; i++) { + _itemLocations[i].x = in.readSint16BE(); + _itemLocations[i].y = in.readSint16BE(); + } + + _polXSize = in.readUint16BE(); + _polX = (int *)malloc(sizeof(int) * _polXSize); + _polY = (int *)malloc(sizeof(int) * _polXSize); + for (i = 0; i < _polXSize; i++) { + _polX[i] = in.readSint16BE(); + _polY[i] = in.readSint16BE(); + } + + _verbBarXSize = in.readUint16BE(); + _verbBarX = (int *)malloc(sizeof(int) * _verbBarXSize); + for (i = 0; i < _verbBarXSize; i++) { + _verbBarX[i] = in.readSint16BE(); + } + + _x1dMenuSize = in.readUint16BE(); + _x1d_menu = (int *)malloc(sizeof(int) * _x1dMenuSize); + _y1d_menu = (int *)malloc(sizeof(int) * _x1dMenuSize); + for (i = 0; i < _x1dMenuSize; i++) { + _x1d_menu[i] = in.readSint16BE(); + _y1d_menu[i] = in.readSint16BE(); + } + + _frameXSize = in.readUint16BE(); + _frameX = (int *)malloc(sizeof(int) * _frameXSize); + for (i = 0; i < _frameXSize; i++) { + _frameX[i] = in.readSint16BE(); + } + + _candleXSize = in.readUint16BE(); + _candleX = (int *)malloc(sizeof(int) * _candleXSize); + _candleY = (int *)malloc(sizeof(int) * _candleXSize); + for (i = 0; i < _candleXSize; i++) { + _candleX[i] = in.readSint16BE(); + _candleY[i] = in.readSint16BE(); + } + + _pianistXSize = in.readUint16BE(); + _pianistX = (int *)malloc(sizeof(int) * _pianistXSize); + for (i = 0; i < _pianistXSize; i++) { + _pianistX[i] = in.readSint16BE(); + } + + _drunkXSize = in.readUint16BE(); + _drunkX = (int *)malloc(sizeof(int) * _drunkXSize); + for (i = 0; i < _drunkXSize; i++) { + _drunkX[i] = in.readSint16BE(); + } + + _roomPreUpdatesSize = in.readUint16BE(); + _roomPreUpdates = (RoomUpdate *)malloc(sizeof(RoomUpdate) * _roomPreUpdatesSize); + for (i = 0; i < _roomPreUpdatesSize; i++) { + _roomPreUpdates[i].roomNum = in.readSint16BE(); + _roomPreUpdates[i].flag = in.readSint16BE(); + _roomPreUpdates[i].flagValue = in.readSint16BE(); + _roomPreUpdates[i].sourceX = in.readSint16BE(); + _roomPreUpdates[i].sourceY = in.readSint16BE(); + _roomPreUpdates[i].destX = in.readSint16BE(); + _roomPreUpdates[i].destY = in.readSint16BE(); + _roomPreUpdates[i].width = in.readSint16BE(); + _roomPreUpdates[i].height = in.readSint16BE(); + _roomPreUpdates[i].type = in.readSint16BE(); + } + + _roomUpdatesSize = in.readUint16BE(); + _roomUpdates = (RoomUpdate *)malloc(sizeof(RoomUpdate) * _roomUpdatesSize); + for (i = 0; i < _roomUpdatesSize; i++) { + _roomUpdates[i].roomNum = in.readSint16BE(); + _roomUpdates[i].flag = in.readSint16BE(); + _roomUpdates[i].flagValue = in.readSint16BE(); + _roomUpdates[i].sourceX = in.readSint16BE(); + _roomUpdates[i].sourceY = in.readSint16BE(); + _roomUpdates[i].destX = in.readSint16BE(); + _roomUpdates[i].destY = in.readSint16BE(); + _roomUpdates[i].width = in.readSint16BE(); + _roomUpdates[i].height = in.readSint16BE(); + _roomUpdates[i].type = in.readSint16BE(); + } + + _roomActionsSize = in.readUint16BE(); + _roomActions = (RoomTalkAction *)malloc(sizeof(RoomTalkAction) * _roomActionsSize); + for (i = 0; i < _roomActionsSize; i++) { + _roomActions[i].room = in.readSint16BE(); + _roomActions[i].chapter = in.readSint16BE(); + _roomActions[i].action = in.readSint16BE(); + _roomActions[i].objectID = in.readSint16BE(); + _roomActions[i].speechID = in.readSint16BE(); + } + + _numLangs = in.readUint16BE(); + + _text = loadTexts(in); + _textd = loadTexts(in); + _textb = loadTexts(in); + _textbj = loadTexts(in); + _texte = loadTexts(in); + _texti = loadTexts(in); + _textl = loadTexts(in); + _textp = loadTexts(in); + _textt = loadTexts(in); + _textvb = loadTexts(in); + _textsys = loadTexts(in); + _texthis = loadTexts(in); + _textverbs = loadTexts(in); + _textmisc = loadTexts(in); + _textd1 = loadTexts(in); + + return true; } -void DrasculaEngine::grr() { - int length = 30; +char ***DrasculaEngine::loadTexts(Common::File &in) { + int numTexts = in.readUint16BE(); + char ***res; + int entryLen; + char *pos; + int len; - color_abc(kColorDarkGreen); + res = (char ***)malloc(sizeof(char *) * _numLangs); - playFile("s10.als"); + for (int lang = 0; lang < _numLangs; lang++) { + entryLen = in.readUint16BE(); - updateRoom(); - copyBackground(253, 110, 150, 65, 20, 30, drawSurface3, screenSurface); + res[lang] = (char **)malloc(sizeof(char *) * numTexts); - if (withVoices == 0) - centerText(".groaaarrrrgghhh!", 153, 65); + pos = (char *)malloc(entryLen); + res[lang][0] = pos; - updateScreen(); + in.read(res[lang][0], entryLen); - while (!isTalkFinished(&length)); + pos += DATAALIGNMENT; - updateRoom(); - updateScreen(); -} + for (int i = 1; i < numTexts; i++) { + pos -= 2; -void DrasculaEngine::activatePendulum() { - flags[1] = 2; - hare_se_ve = 0; - roomNumber = 102; - loadPic(102, drawSurface1, HALF_PAL); - loadPic("an_p1.alg", drawSurface3); - loadPic("an_p2.alg", extraSurface); - loadPic("an_p3.alg", frontSurface); + len = READ_BE_UINT16(pos); + pos += 2 + len; - copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3); + res[lang][i] = pos; + } + } - savedTime = getTime(); + return res; } -void DrasculaEngine::closeDoor(int nflag, int doorNum) { - if (flags[nflag] == 1) { - playSound(4); - flags[nflag] = 0; - if (doorNum != NO_DOOR) - updateDoor(doorNum); - updateRoom(); - updateScreen(); - finishSound(); - withoutVerb(); +void DrasculaEngine::freeTexts(char ***ptr) { + for (int lang = 0; lang < _numLangs; lang++) { + free(ptr[lang][0] - DATAALIGNMENT); + free(ptr[lang]); } + free(ptr); } } // End of namespace Drascula diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index cbc1d0b442..ce67cc2c0e 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -46,6 +46,9 @@ namespace Drascula { +#define DRASCULA_DAT_VER 2 +#define DATAALIGNMENT 4 + enum DrasculaGameFeatures { GF_PACKED = (1 << 0) }; @@ -132,6 +135,17 @@ enum IgorTalkerTypes { kIgorWig = 4 }; +enum AnimFrameTypes { + kFrameBlind = 0, + kFrameSnore = 1, + kFrameBat = 2, + kFrameVonBraun = 3, + kFramePianist = 4, + kFrameDrunk = 5, + kFrameCandles = 6, + kFramePendulum = 7 +}; + #define TEXTD_START 68 struct DrasculaGameDescription; @@ -144,18 +158,30 @@ struct RoomTalkAction { int speechID; }; +struct RoomUpdate { + int roomNum; + int flag; + int flagValue; + int sourceX; + int sourceY; + int destX; + int destY; + int width; + int height; + int type; // 0 - background, 1 - rect +}; + struct ItemLocation { int x; int y; }; struct CharInfo { - int inChar; - int mappedChar; - int charType; // 0 - letters, 1 - signs, 2 - accented + byte inChar; + uint16 mappedChar; + byte charType; // 0 - letters, 1 - signs, 2 - accented }; -#define CHARMAP_SIZE 93 #define NUM_SAVES 10 #define NUM_FLAGS 50 #define DIF_MASK 55 @@ -209,7 +235,7 @@ public: void allocMemory(); void freeMemory(); - void quitGame(); + void endChapter(); void loadPic(int roomNum, byte *targetSurface, int colorCount = 1) { char rm[20]; @@ -221,7 +247,7 @@ public: typedef char DacPalette256[256][3]; - void setRGB(byte *dir_lectura, int plt); + void setRGB(byte *pal, int plt); void assignDefaultPalette(); void setPalette(byte *PalBuf); void copyBackground(int xorg, int yorg, int xdes, int ydes, int width, @@ -249,9 +275,9 @@ public: DacPalette256 brightPalette; DacPalette256 darkPalette; + // Graphics buffers/pointers byte *VGA; - - byte *drawSurface1; + byte *bgSurface; byte *backSurface; byte *drawSurface3; byte *drawSurface2; @@ -260,13 +286,15 @@ public: byte *screenSurface; byte *frontSurface; byte *textSurface; - byte *pendulumSurface; + byte *memPtr; + byte *mSession; byte cPal[768]; - byte *pcxBuffer; Common::ArjFile _arj; + int actorFrames[8]; + int previousMusic, roomMusic; int roomNumber; char roomDisk[20]; @@ -287,9 +315,6 @@ public: int withVoices; int menuBar, menuScreen, hasName; char textName[20]; - int frame_blind; - int frame_snore; - int frame_bat; int curExcuseLook; int curExcuseAction; @@ -311,18 +336,15 @@ public: int savedTime; int changeColor; int breakOut; - int vbX, trackVB, vbHasMoved, frame_vb; + int vonBraunX, trackVonBraun, vonBraunHasMoved; float newHeight, newWidth; int factor_red[202]; - int frame_piano; - int frame_drunk; - int frame_candles; int color_solo; int blinking; int igorX, igorY, trackIgor; - int x_dr, y_dr, trackDrascula; - int x_bj, y_bj, trackBJ; - int cont_sv; + int drasculaX, drasculaY, trackDrascula; + int bjX, bjY, trackBJ; + int framesWithoutAction; int term_int; int currentChapter; int hay_que_load; @@ -333,17 +355,18 @@ public: int selectionMade; int mouseX; int mouseY; - int mouseY_ant; int leftMouseButton; int rightMouseButton; + bool loadDrasculaDat(); + bool runCurrentChapter(); void black(); void pickObject(int); void walkUp(); void walkDown(); - void moveVB(); - void placeVB(int pointX); + void moveVonBraun(); + void placeVonBraun(int pointX); void hipo_sin_nadie(int counter); void openDoor(int nflag, int doorNum); void showMap(); @@ -368,17 +391,17 @@ public: void delay(int ms); bool confirmExit(); void screenSaver(); - void chooseObject(int objeto); + void chooseObject(int object); void addObject(int); int removeObject(int osj); void playFLI(const char *filefli, int vel); void fadeFromBlack(int fadeSpeed); + void fadeToBlack(int fadeSpeed); char adjustToVGA(char value); void color_abc(int cl); void centerText(const char *,int,int); void playSound(int soundNum); bool animate(const char *animation, int FPS); - void fadeToBlack(int fadeSpeed); void pause(int); void placeIgor(); void placeBJ(); @@ -400,13 +423,14 @@ public: void talk_sync(const char *, const char *, const char *); void talk_drunk(int); void talk_pianist(int); - void talk_wolf(int); + void talk_werewolf(int); void talk_mus(int); void talk_dr_grande(int); - void talk_vb(int); - void talk_vbpuerta(int); + void talk_vonBraun(int); + void talk_vonBraunpuerta(int); void talk_blind(int); - void talk_hacker(const char *, const char *); + void talk_hacker(int); + void talk_generic(const char* said, const char* filename, int* faces, int faceCount, int* coords, byte* surface); void hiccup(int); void finishSound(); @@ -437,32 +461,23 @@ public: void setCursorTable(); void enterName(); bool soundIsActive(); - void WaitFrameSSN(); - void MixVideo(byte *OldScreen, byte *NewScreen); - void Des_RLE(byte *BufferRLE, byte *MiVideoRLE); - void Des_OFF(byte *BufferOFF, byte *MiVideoOFF, int Lenght); + void waitFrameSSN(); + void mixVideo(byte *OldScreen, byte *NewScreen); + void decodeRLE(byte *BufferRLE, byte *MiVideoRLE); + void decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length); byte *TryInMem(); int playFrameSSN(); - byte *AuxBuffOrg; - byte *AuxBuffLast; - byte *AuxBuffDes; - - byte *pointer; int UsingMem; byte CHUNK; byte CMP, dacSSN[768]; - byte *MiVideoSSN; - byte *mSession; int FrameSSN; int globalSpeed; uint32 LastFrame; - int frame_pen; int flag_tv; - byte *loadPCX(byte *NamePcc); - void WaitForNext(int FPS); + void showFrame(bool firstFrame = false); int getTime(); void reduce_hare_chico(int, int, int, int, int, int, int, byte *, byte *); void quadrant_1(); @@ -491,48 +506,45 @@ public: void updateAnim(int y, int destX, int destY, int width, int height, int count, byte* src, int delayVal = 3); void updateAnim2(int y, int px, int py, int width, int height, int count, byte* src); - void room_0(); - void room_1(int); - void room_2(int); - void room_3(int); - void room_4(int); - void room_5(int); - void room_6(int); - void room_7(int); - void room_8(int); - void room_9(int); - void room_12(int); - bool room_13(int fl); - void room_14(int); - void room_15(int); - void room_16(int); - void room_17(int); - void room_18(int); - void room_19(int); + bool room(int rN, int fl); + bool room_0(int); + bool room_1(int); + bool room_2(int); + bool room_3(int); + bool room_4(int); + bool room_5(int); + bool room_6(int); + bool room_7(int); + bool room_8(int); + bool room_9(int); + bool room_12(int); + bool room_13(int); + bool room_14(int); + bool room_15(int); + bool room_16(int); + bool room_17(int); + bool room_18(int); bool room_21(int); - void room_22(int); - void room_23(int); - void room_24(int); - void room_26(int); - void room_27(int); - void room_29(int); - void room_30(int); - void room_31(int); - void room_34(int); - void room_35(int); - void room_44(int); - void room_49(int); - void room_53(int); - void room_54(int); - void room_55(int); + bool room_22(int); + bool room_23(int); + bool room_24(int); + bool room_26(int); + bool room_27(int); + bool room_29(int); + bool room_30(int); + bool room_31(int); + bool room_34(int); + bool room_35(int); + bool room_49(int); + bool room_53(int); + bool room_54(int); + bool room_55(int); bool room_56(int); - void room_58(int); - void room_59(int); + bool room_58(int); + bool room_59(int); bool room_60(int); - void room_61(int); - void room_62(int); - void room_63(int); - void room_102(int); + bool room_62(int); + bool room_102(int); void animation_1_1(); void animation_2_1(); @@ -634,84 +646,73 @@ public: void update_1_pre(); void update_2(); void update_3(); - void update_3_pre(); void update_4(); - void update_5(); - void update_5_pre(); void update_6_pre(); - void update_7_pre(); void update_9_pre(); - void update_12_pre(); void update_14_pre(); void update_13(); - void update_15(); void update_16_pre(); - void update_17_pre(); - void update_17(); void update_18_pre(); - void update_18(); - void update_20(); - void update_21_pre(); - void update_22_pre(); void update_23_pre(); - void update_24_pre(); void update_26_pre(); void update_26(); - void update_27(); - void update_27_pre(); - void update_29(); - void update_29_pre(); - void update_30_pre(); - void update_31_pre(); - void update_34_pre(); void update_35_pre(); - void update_31(); - void update_34(); - void update_35(); - void update_49_pre(); - void update_53_pre(); - void update_54_pre(); - void update_56_pre(); - void update_50(); - void update_57(); void update_58(); void update_58_pre(); void update_59_pre(); void update_60_pre(); void update_60(); - void update_61(); void update_62(); void update_62_pre(); - void update_63(); void update_102(); private: int _lang; -}; -extern const char *_text[][501]; -extern const char *_textd[][84]; -extern const char *_textb[][15]; -extern const char *_textbj[][29]; -extern const char *_texte[][24]; -extern const char *_texti[][33]; -extern const char *_textl[][32]; -extern const char *_textp[][20]; -extern const char *_textt[][25]; -extern const char *_textvb[][63]; -extern const char *_textsys[][4]; -extern const char *_texthis[][5]; -extern const char *_textverbs[][6]; -extern const char *_textmisc[][2]; -extern const char *_textd1[][11]; - -extern const ItemLocation itemLocations[]; -extern int frame_x[20]; -extern const int x_pol[44], y_pol[44]; -extern const int verbBarX[]; -extern const int x1d_menu[], y1d_menu[]; - -extern const CharInfo charMap[]; + CharInfo *_charMap; + int _charMapSize; + + int _itemLocationsSize; + int _polXSize; + int _verbBarXSize; + int _x1dMenuSize; + int _frameXSize; + int _candleXSize; + int _pianistXSize; + int _drunkXSize; + int _roomPreUpdatesSize; + int _roomUpdatesSize; + int _roomActionsSize; + int _numLangs; + + char ***_text; + char ***_textd; + char ***_textb; + char ***_textbj; + char ***_texte; + char ***_texti; + char ***_textl; + char ***_textp; + char ***_textt; + char ***_textvb; + char ***_textsys; + char ***_texthis; + char ***_textverbs; + char ***_textmisc; + char ***_textd1; + ItemLocation *_itemLocations; + int *_polX, *_polY; + int *_verbBarX; + int *_x1d_menu, *_y1d_menu; + int *_frameX; + int *_candleX, *_candleY; + int *_pianistX, *_drunkX; + RoomUpdate *_roomPreUpdates, *_roomUpdates; + RoomTalkAction *_roomActions; + + char ***loadTexts(Common::File &in); + void freeTexts(char ***ptr); +}; } // End of namespace Drascula diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp new file mode 100644 index 0000000000..64591a856e --- /dev/null +++ b/engines/drascula/graphics.cpp @@ -0,0 +1,687 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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::allocMemory() { + // FIXME: decodeOffset writes beyond 64000, so this + // buffer has been initialized to 64256 bytes (like + // the original did with the MiVideoSSN buffer) + screenSurface = (byte *)malloc(64256); + assert(screenSurface); + frontSurface = (byte *)malloc(64000); + assert(frontSurface); + backSurface = (byte *)malloc(64000); + assert(backSurface); + bgSurface = (byte *)malloc(64000); + assert(bgSurface); + 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(bgSurface); + free(backSurface); + free(drawSurface2); + free(tableSurface); + free(drawSurface3); + free(extraSurface); + free(frontSurface); +} + +void DrasculaEngine::moveCursor() { + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); + + updateRefresh_pre(); + moveCharacters(); + updateRefresh(); + + if (!strcmp(textName, "hacker") && hasName == 1) { + if (_color != kColorRed && menuScreen == 0) + color_abc(kColorRed); + } else if (menuScreen == 0 && _color != kColorLightGreen) + color_abc(kColorLightGreen); + if (hasName == 1 && menuScreen == 0) + centerText(textName, mouseX, mouseY); + if (menuScreen == 1) + showMenu(); + else if (menuBar == 1) + clearMenu(); + + int cursorPos[6] = { 0, 0, mouseX - 20, mouseY - 17, OBJWIDTH, OBJHEIGHT }; + copyRectClip(cursorPos, drawSurface3, screenSurface); +} + +void DrasculaEngine::setCursorTable() { + int cursorPos[6] = { 225, 56, mouseX - 20, mouseY - 12, 40, 25 }; + copyRectClip(cursorPos, tableSurface, screenSurface); +} + +void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int colorCount) { + unsigned int con, x = 0; + unsigned int fExit = 0; + byte ch, rep; + + _arj.open(NamePcc); + if (!_arj.isOpen()) + error("missing game data %s %c", NamePcc, 7); + + _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++) { + x++; + if (x > 64000) { + fExit = 1; + break; + } + *targetSurface++ = ch; + } + } + + for (int i = 0; i < 256; i++) { + cPal[i * 3 + 0] = _arj.readByte(); + cPal[i * 3 + 1] = _arj.readByte(); + cPal[i * 3 + 2] = _arj.readByte(); + } + + _arj.close(); + + setRGB((byte *)cPal, colorCount); +} + +void DrasculaEngine::showFrame(bool firstFrame) { + int dataSize = _arj.readSint32LE(); + byte *pcxData = (byte *)malloc(dataSize); + _arj.read(pcxData, dataSize); + + for (int i = 0; i < 256; i++) { + cPal[i * 3 + 0] = _arj.readByte(); + cPal[i * 3 + 1] = _arj.readByte(); + cPal[i * 3 + 2] = _arj.readByte(); + } + + byte *prevFrame = (byte *)malloc(64000); + memcpy(prevFrame, VGA, 64000); + + decodeRLE(pcxData, VGA); + + free(pcxData); + + if (!firstFrame) + mixVideo(VGA, prevFrame); + + _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); + _system->updateScreen(); + if (firstFrame) + setPalette(cPal); + + free(prevFrame); +} + +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(); +} + +void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) { + int letterY = 0, letterX = 0, i; + uint len = strlen(said); + byte c; + + for (uint h = 0; h < len; h++) { + c = toupper(said[h]); + + for (i = 0; i < _charMapSize; i++) { + if (c == _charMap[i].inChar) { + letterX = _charMap[i].mappedChar; + + switch (_charMap[i].charType) { + case 0: // letters + letterY = (_lang == kSpanish) ? 149 : 158; + break; + case 1: // signs + letterY = (_lang == kSpanish) ? 160 : 169; + break; + case 2: // accented + letterY = 180; + break; + } // switch + break; + } // if + } // for + + int textPos[6] = { letterX, letterY, screenX, screenY, CHAR_WIDTH, CHAR_HEIGHT }; + copyRectClip(textPos, textSurface, screenSurface); + + screenX = screenX + CHAR_WIDTH; + if (screenX > 317) { + screenX = 0; + screenY = screenY + CHAR_HEIGHT + 2; + } + } // for +} + +void DrasculaEngine::print_abc_opc(const char *said, int screenX, int screenY, int game) { + int signY, letterY, letterX = 0; + uint len = strlen(said); + + for (uint h = 0; h < len; h++) { + if (game == 1) { + letterY = 6; + signY = 15; + } else if (game == 3) { + letterY = 56; + signY = 65; + } else { + letterY = 31; + signY = 40; + } + + byte c = toupper(said[h]); + + // WORKAROUND: Even original did not process it correctly + // Fixes apostrophe rendering + if (_lang != kSpanish) + if (c == '\'') + c = (byte)'\244'; + + for (int i = 0; i < _charMapSize; i++) { + if (c == _charMap[i].inChar) { + // Convert the mapped char of the normal font to the + // mapped char of the dialogue font + + int multiplier = (_charMap[i].mappedChar - 6) / 9; + + letterX = multiplier * 7 + 10; + + if (_charMap[i].charType > 0) + letterY = signY; + break; + } // if + } // for + + int textPos[6] = { letterX, letterY, screenX, screenY, CHAR_WIDTH_OPC, CHAR_HEIGHT_OPC }; + copyRectClip(textPos, backSurface, screenSurface); + + screenX = screenX + CHAR_WIDTH_OPC; + } +} + +void DrasculaEngine::centerText(const char *message, int textX, int textY) { + char bb[200], m2[200], m1[200], mb[10][50]; + char m3[200]; + int h, fil, textX3, textX2, textX1, conta_f = 0, ya = 0; + + strcpy(m1, " "); + strcpy(m2, " "); + strcpy(m3, " "); + strcpy(bb, " "); + + for (h = 0; h < 10; h++) + strcpy(mb[h], " "); + + if (textX > 160) + ya = 1; + + strcpy(m1, message); + textX = CLIP<int>(textX, 60, 255); + + textX1 = textX; + + if (ya == 1) + textX1 = 315 - textX; + + textX2 = (strlen(m1) / 2) * CHAR_WIDTH; + + while (true) { + strcpy(bb, m1); + scumm_strrev(bb); + + if (textX1 < textX2) { + strcpy(m3, strrchr(m1, ' ')); + strcpy(m1, strstr(bb, " ")); + scumm_strrev(m1); + m1[strlen(m1) - 1] = '\0'; + strcat(m3, m2); + strcpy(m2, m3); + }; + + textX2 = (strlen(m1) / 2) * CHAR_WIDTH; + + if (textX1 < textX2) + continue; + + strcpy(mb[conta_f], m1); + + if (!strcmp(m2, "")) + break; + + scumm_strrev(m2); + m2[strlen(m2) - 1] = '\0'; + scumm_strrev(m2); + strcpy(m1, m2); + strcpy(m2, ""); + conta_f++; + } + + fil = textY - (((conta_f + 3) * CHAR_HEIGHT)); + + for (h = 0; h < conta_f + 1; h++) { + textX3 = strlen(mb[h]) / 2; + print_abc(mb[h], ((textX) - textX3 * CHAR_WIDTH) - 1, fil); + fil = fil + CHAR_HEIGHT + 2; + } +} + +void DrasculaEngine::screenSaver() { + int xr, yr; + byte *copia, *ghost; + float coeff = 0, coeff2 = 0; + int count = 0; + int count2 = 0; + int tempLine[320]; + int tempRow[200]; + + clearRoom(); + + loadPic("sv.alg", bgSurface, HALF_PAL); + + // inicio_ghost(); + copia = (byte *)malloc(64000); + ghost = (byte *)malloc(65536); + + // carga_ghost(); + _arj.open("ghost.drv"); + if (!_arj.isOpen()) + error("Cannot open file ghost.drv"); + + _arj.read(ghost, 65536); + _arj.close(); + + updateEvents(); + xr = mouseX; + yr = mouseY; + + for (;;) { + // efecto(bgSurface); + + memcpy(copia, bgSurface, 64000); + coeff += 0.1f; + coeff2 = coeff; + + if (++count > 319) + count = 0; + + for (int i = 0; i < 320; i++) { + tempLine[i] = (int)(sin(coeff2) * 16); + coeff2 += 0.02f; + tempLine[i] = checkWrapY(tempLine[i]); + } + + coeff2 = coeff; + for (int i = 0; i < 200; i++) { + tempRow[i] = (int)(sin(coeff2) * 16); + coeff2 += 0.02f; + tempRow[i] = checkWrapX(tempRow[i]); + } + + if (++count2 > 199) + count2 = 0; + + int x1_, y1_, off1, off2; + + for (int i = 0; i < 200; i++) { + for (int j = 0; j < 320; j++) { + x1_ = j + tempRow[i]; + x1_ = checkWrapX(x1_); + + y1_ = i + count2; + y1_ = checkWrapY(y1_); + + off1 = 320 * y1_ + x1_; + + x1_ = j + count; + x1_ = checkWrapX(x1_); + + y1_ = i + tempLine[j]; + y1_ = checkWrapY(y1_); + off2 = 320 * y1_ + x1_; + + VGA[320 * i + j] = ghost[bgSurface[off2] + (copia[off1] << 8)]; + } + } + _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); + _system->updateScreen(); + + _system->delayMillis(20); + + // end of efecto() + + updateEvents(); + if (rightMouseButton == 1 || leftMouseButton == 1) + break; + if (mouseX != xr) + break; + if (mouseY != yr) + break; + } + // fin_ghost(); + free(copia); + free(ghost); + + loadPic(roomNumber, bgSurface, HALF_PAL); +} + +void DrasculaEngine::playFLI(const char *filefli, int vel) { + // Open file + globalSpeed = 1000 / vel; + FrameSSN = 0; + UsingMem = 0; + _arj.open(filefli); + mSession = TryInMem(); + LastFrame = _system->getMillis(); + + while (playFrameSSN() && (!term_int)) { + if (getScan() == Common::KEYCODE_ESCAPE) + term_int = 1; + } + + if (UsingMem) + free(memPtr); + else + _arj.close(); +} + +int DrasculaEngine::playFrameSSN() { + int Exit = 0; + uint32 length; + byte *BufferSSN; + + if (!UsingMem) + CHUNK = _arj.readByte(); + else { + memcpy(&CHUNK, mSession, 1); + mSession += 1; + } + + switch (CHUNK) { + case kFrameSetPal: + if (!UsingMem) { + for (int i = 0; i < 256; i++) { + dacSSN[i * 3 + 0] = _arj.readByte(); + dacSSN[i * 3 + 1] = _arj.readByte(); + dacSSN[i * 3 + 2] = _arj.readByte(); + } + } else { + memcpy(dacSSN, mSession, 768); + mSession += 768; + } + setPalette(dacSSN); + break; + case kFrameEmptyFrame: + waitFrameSSN(); + break; + case kFrameInit: + if (!UsingMem) { + CMP = _arj.readByte(); + length = _arj.readUint32LE(); + } else { + memcpy(&CMP, mSession, 1); + mSession += 1; + length = READ_LE_UINT32(mSession); + mSession += 4; + } + if (CMP == kFrameCmpRle) { + BufferSSN = (byte *)malloc(length); + if (!UsingMem) { + _arj.read(BufferSSN, length); + } else { + memcpy(BufferSSN, mSession, length); + mSession += length; + } + decodeRLE(BufferSSN, screenSurface); + free(BufferSSN); + waitFrameSSN(); + if (FrameSSN) + mixVideo(VGA, screenSurface); + else + memcpy(VGA, screenSurface, 64000); + _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); + _system->updateScreen(); + FrameSSN++; + } else { + if (CMP == kFrameCmpOff) { + BufferSSN = (byte *)malloc(length); + if (!UsingMem) { + _arj.read(BufferSSN, length); + } else { + memcpy(BufferSSN, mSession, length); + mSession += length; + } + decodeOffset(BufferSSN, screenSurface, length); + free(BufferSSN); + waitFrameSSN(); + if (FrameSSN) + mixVideo(VGA, screenSurface); + else + memcpy(VGA, screenSurface, 64000); + _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); + _system->updateScreen(); + FrameSSN++; + } + } + break; + case kFrameEndAnim: + Exit = 1; + break; + default: + Exit = 1; + break; + } + + return (!Exit); +} + +byte *DrasculaEngine::TryInMem() { + int length; + + _arj.seek(0, SEEK_END); + length = _arj.pos(); + _arj.seek(0, SEEK_SET); + memPtr = (byte *)malloc(length); + if (memPtr == NULL) + return NULL; + _arj.read(memPtr, length); + UsingMem = 1; + _arj.close(); + + return memPtr; +} + +void DrasculaEngine::decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length) { + int x = 0; + int size; + int offset; + + memset(screenSurface, 0, 64000); + while (x < length) { + offset = BufferOFF[x] + BufferOFF[x + 1] * 256; + // FIXME: this writes beyond 64000, so the buffer has been initialized + // to 64256 bytes (like the original did) + size = BufferOFF[x + 2]; + memcpy(MiVideoOFF + offset, &BufferOFF[x + 3], size); + x += 3 + size; + } +} + +void DrasculaEngine::decodeRLE(byte* srcPtr, byte* dstPtr) { + bool stopProcessing = false; + byte pixel; + uint repeat; + int curByte = 0; + + while (!stopProcessing) { + pixel = *srcPtr++; + repeat = 1; + if ((pixel & 192) == 192) { + repeat = (pixel & 63); + pixel = *srcPtr++; + } + for (uint j = 0; j < repeat; j++) { + curByte++; + if (curByte > 64000) { + stopProcessing = true; + break; + } + *dstPtr++ = pixel; + } + } +} + +void DrasculaEngine::mixVideo(byte *OldScreen, byte *NewScreen) { + for (int x = 0; x < 64000; x++) + OldScreen[x] ^= NewScreen[x]; +} + +void DrasculaEngine::waitFrameSSN() { + uint32 now; + while ((now = _system->getMillis()) - LastFrame < ((uint32) globalSpeed)) + _system->delayMillis(globalSpeed - (now - LastFrame)); + LastFrame = LastFrame + globalSpeed; +} + +bool DrasculaEngine::animate(const char *animationFile, int FPS) { + int NFrames = 1; + int cnt = 2; + + _arj.open(animationFile); + + if (!_arj.isOpen()) { + error("Animation file %s not found", animationFile); + } + + NFrames = _arj.readSint32LE(); + showFrame(true); + _system->delayMillis(1000 / FPS); + while (cnt < NFrames) { + showFrame(); + _system->delayMillis(1000 / FPS); + cnt++; + byte key = getScan(); + if (key == Common::KEYCODE_ESCAPE) + term_int = 1; + if (key != 0) + break; + } + _arj.close(); + + return ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE)); +} + + + +} // End of namespace Drascula diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp new file mode 100644 index 0000000000..6e86788007 --- /dev/null +++ b/engines/drascula/interface.cpp @@ -0,0 +1,209 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "drascula/drascula.h" + +namespace Drascula { + +void DrasculaEngine::selectVerbFromBar() { + for (int n = 0; n < 7; n++) { + if (mouseX > _verbBarX[n] && mouseX < _verbBarX[n + 1] && n > 0) { + selectVerb(n); + return; + } + } + + // no verb selected + withoutVerb(); +} + +void DrasculaEngine::selectVerb(int verb) { + int c = (menuScreen == 1) ? 0 : 171; + + if (currentChapter == 5) { + if (takeObject == 1 && pickedObject != 16) + addObject(pickedObject); + } else { + if (takeObject == 1) + addObject(pickedObject); + } + + copyBackground(OBJWIDTH * verb, c, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3); + + takeObject = 1; + pickedObject = verb; +} + +bool DrasculaEngine::confirmExit() { + byte key; + + color_abc(kColorRed); + updateRoom(); + centerText(_textsys[_lang][1], 160, 87); + updateScreen(); + + delay(100); + for (;;) { + key = getScan(); + if (key != 0) + break; + } + + if (key == Common::KEYCODE_ESCAPE) { + stopMusic(); + return false; + } + + return true; +} + +void DrasculaEngine::showMenu() { + int h, n, x; + char textIcon[13]; + byte *srcSurface = (currentChapter == 6) ? tableSurface : frontSurface; + x = whichObject(); + strcpy(textIcon, iconName[x]); + + for (n = 1; n < 43; n++) { + h = inventoryObjects[n]; + + if (h != 0) { + copyBackground(_polX[n], _polY[n], _itemLocations[n].x, _itemLocations[n].y, + OBJWIDTH, OBJHEIGHT, srcSurface, screenSurface); + } + copyRect(_x1d_menu[h], _y1d_menu[h], _itemLocations[n].x, _itemLocations[n].y, + OBJWIDTH, OBJHEIGHT, backSurface, screenSurface); + } + + if (x < 7) + print_abc(textIcon, _itemLocations[x].x - 2, _itemLocations[x].y - 7); +} + +void DrasculaEngine::clearMenu() { + int n, verbActivated = 1; + + for (n = 0; n < 7; n++) { + if (mouseX > _verbBarX[n] && mouseX < _verbBarX[n + 1]) + verbActivated = 0; + copyRect(OBJWIDTH * n, OBJHEIGHT * verbActivated, _verbBarX[n], 2, + OBJWIDTH, OBJHEIGHT, backSurface, screenSurface); + verbActivated = 1; + } +} + +void DrasculaEngine::enterName() { + Common::KeyCode key; + int v = 0, h = 0; + char select2[23]; + strcpy(select2, " "); + for (;;) { + select2[v] = '-'; + copyBackground(115, 14, 115, 14, 176, 9, bgSurface, screenSurface); + print_abc(select2, 117, 15); + updateScreen(); + key = getScan(); + delay(70); + if (key != 0) { + if (key >= 0 && key <= 0xFF && isalpha(key)) + select2[v] = tolower(key); + else if ((key == Common::KEYCODE_LCTRL) || (key == Common::KEYCODE_RCTRL)) + select2[v] = '\164'; + else if (key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) + select2[v] = key; + else if (key == Common::KEYCODE_SPACE) + select2[v] = '\167'; + else if (key == Common::KEYCODE_ESCAPE) + break; + else if (key == Common::KEYCODE_RETURN) { + select2[v] = '\0'; + h = 1; + break; + } else if (key == Common::KEYCODE_BACKSPACE) + select2[v] = '\0'; + else + v--; + + if (key == Common::KEYCODE_BACKSPACE) + v--; + else + v++; + } + if (v == 22) + v = 21; + else if (v == -1) + v = 0; + } + if (h == 1) { + strcpy(select, select2); + selectionMade = 1; + } +} + +bool DrasculaEngine::checkMenuFlags() { + for (int n = 0; n < 43; n++) { + if (whichObject() == n) { + if (inventoryObjects[n] != 0 && checkAction(inventoryObjects[n])) + return true; + } + } + + return false; +} + +void DrasculaEngine::showMap() { + hasName = 0; + + for (int l = 0; l < numRoomObjs; l++) { + if (mouseX > x1[l] && mouseY > y1[l] + && mouseX < x2[l] && mouseY < y2[l] + && visible[l] == 1) { + strcpy(textName, objName[l]); + hasName = 1; + } + } +} + +void DrasculaEngine::grr() { + int length = 30; + + color_abc(kColorDarkGreen); + + playFile("s10.als"); + + updateRoom(); + copyBackground(253, 110, 150, 65, 20, 30, drawSurface3, screenSurface); + + if (withVoices == 0) + centerText("groaaarrrrgghhhh!", 153, 65); + + updateScreen(); + + while (!isTalkFinished(&length)); + + updateRoom(); + updateScreen(); +} + +} // End of namespace Drascula diff --git a/engines/drascula/module.mk b/engines/drascula/module.mk index 2f72855af1..dfe53ca824 100644 --- a/engines/drascula/module.mk +++ b/engines/drascula/module.mk @@ -1,10 +1,18 @@ MODULE := engines/drascula MODULE_OBJS = \ + actors.o \ animation.o \ + converse.o \ detection.o \ drascula.o \ + graphics.o \ + interface.o \ + objects.o \ + palette.o \ rooms.o \ + saveload.o \ + sound.o \ talk.o diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp new file mode 100644 index 0000000000..01967d975d --- /dev/null +++ b/engines/drascula/objects.cpp @@ -0,0 +1,300 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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::pickObject(int object) { + 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(object); + if (currentChapter == 2) + loadPic(menuBackground, backSurface); + else + loadPic(99, backSurface); +} + +void DrasculaEngine::chooseObject(int object) { + if (currentChapter == 5) { + if (takeObject == 1 && menuScreen == 0 && pickedObject != 16) + addObject(pickedObject); + } else { + if (takeObject == 1 && menuScreen == 0) + addObject(pickedObject); + } + copyBackground(_x1d_menu[object], _y1d_menu[object], 0, 0, OBJWIDTH,OBJHEIGHT, backSurface, drawSurface3); + takeObject = 1; + pickedObject = object; +} + +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; +} + +void DrasculaEngine::gotoObject(int pointX, int pointY) { + if (currentChapter == 5 || currentChapter == 6) { + if (hare_se_ve == 0) { + curX = roomX; + curY = roomY; + updateRoom(); + updateScreen(); + return; + } + } + roomX = pointX; + roomY = pointY; + startWalking(); + + for (;;) { + updateRoom(); + updateScreen(); + if (characterMoved == 0) + break; + } + + if (walkToObject == 1) { + walkToObject = 0; + trackProtagonist = trackFinal; + } + updateRoom(); + updateScreen(); +} + +void DrasculaEngine::checkObjects() { + int l, veo = 0; + + for (l = 0; l < numRoomObjs; l++) { + if (mouseX > x1[l] && mouseY > y1[l] + && mouseX < x2[l] && mouseY < y2[l] + && visible[l] == 1 && isDoor[l] == 0) { + strcpy(textName, objName[l]); + hasName = 1; + veo = 1; + } + } + + if (mouseX > curX + 2 && mouseY > curY + 2 + && mouseX < curX + curWidth - 2 && mouseY < curY + curHeight - 2) { + if (currentChapter == 2 || veo == 0) { + strcpy(textName, "hacker"); + hasName = 1; + veo = 1; + } + } + + if (veo == 0) + hasName = 0; +} + +void DrasculaEngine::removeObject() { + int h = 0, n; + + updateRoom(); + + for (n = 1; n < 43; n++){ + if (whichObject() == n) { + h = inventoryObjects[n]; + inventoryObjects[n] = 0; + if (h != 0) + takeObject = 1; + } + } + + updateEvents(); + + if (takeObject == 1) + chooseObject(h); +} + +bool DrasculaEngine::pickupObject() { + int h = pickedObject; + checkFlags = 1; + + updateRoom(); + showMenu(); + updateScreen(); + + // Objects with an ID smaller than 7 are the inventory verbs + if (pickedObject >= 7) { + for (int n = 1; n < 43; n++) { + if (whichObject() == n && inventoryObjects[n] == 0) { + inventoryObjects[n] = h; + takeObject = 0; + checkFlags = 0; + } + } + } + + if (checkFlags == 1) { + if (checkMenuFlags()) + return true; + } + updateEvents(); + if (takeObject == 0) + withoutVerb(); + + return false; +} + +void DrasculaEngine::addObject(int obj) { + int h, position = 0; + + for (h = 1; h < 43; h++) { + if (inventoryObjects[h] == obj) + position = 1; + } + + if (position == 0) { + for (h = 1; h < 43; h++) { + if (inventoryObjects[h] == 0) { + inventoryObjects[h] = obj; + position = 1; + break; + } + } + } +} + +int DrasculaEngine::whichObject() { + int n = 0; + + for (n = 1; n < 43; n++) { + if (mouseX > _itemLocations[n].x && mouseY > _itemLocations[n].y && + mouseX < _itemLocations[n].x + OBJWIDTH && + mouseY < _itemLocations[n].y + OBJHEIGHT) + break; + } + + return n; +} + +void DrasculaEngine::updateVisible() { + if (currentChapter == 1) { + // nothing + } else if (currentChapter == 2) { + if (roomNumber == 2 && flags[40] == 0) + visible[3] = 0; + else if (roomNumber == 3 && flags[3] == 1) + visible[8] = 0; + else if (roomNumber == 6 && flags[1] == 1 && flags[10] == 0) { + visible[2] = 0; + visible[4] = 1; + } else if (roomNumber == 7 && flags[35] == 1) + visible[3] = 0; + else if (roomNumber == 14 && flags[5] == 1) + visible[4] = 0; + else if (roomNumber == 18 && flags[28] == 1) + visible[2] = 0; + } else if (currentChapter == 3) { + // nothing + } else if (currentChapter == 4) { + if (roomNumber == 23 && flags[0] == 0 && flags[11] == 0) + visible[2] = 1; + if (roomNumber == 23 && flags[0] == 1 && flags[11] == 0) + visible[2] = 0; + if (roomNumber == 21 && flags[10] == 1) + visible[2] = 0; + if (roomNumber == 22 && flags[26] == 1) { + visible[2] = 0; + visible[1] = 1; + } + if (roomNumber == 22 && flags[27] == 1) + visible[3] = 0; + if (roomNumber == 26 && flags[21] == 0) + strcpy(objName[2], _textmisc[_lang][0]); + if (roomNumber == 26 && flags[18] == 1) + visible[2] = 0; + if (roomNumber == 26 && flags[12] == 1) + visible[1] = 0; + if (roomNumber == 35 && flags[14] == 1) + visible[2] = 0; + if (roomNumber == 35 && flags[17] == 1) + visible[3] = 1; + if (roomNumber == 35 && flags[15] == 1) + visible[1] = 0; + } else if (currentChapter == 5) { + if (roomNumber == 49 && flags[6] == 1) + visible[2] = 0; + if (roomNumber == 49 && flags[6] == 0) + visible[1] = 0; + if (roomNumber == 49 && flags[6] == 1) + visible[1] = 1; + if (roomNumber == 45 && flags[6] == 1) + visible[3] = 1; + if (roomNumber == 53 && flags[2] == 1) + visible[3] = 0; + if (roomNumber == 54 && flags[13] == 1) + visible[3] = 0; + if (roomNumber == 55 && flags[8] == 1) + visible[1] = 0; + } else if (currentChapter == 6) { + if (roomNumber == 58 && flags[8] == 0) + isDoor[1] = 0; + if (roomNumber == 58 && flags[8] == 1) + isDoor[1] = 1; + if (roomNumber == 59) + isDoor[1] = 0; + if (roomNumber == 60) { + trackDrascula = 0; + drasculaX = 155; + drasculaY = 69; + } + } +} + +} // End of namespace Drascula diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp new file mode 100644 index 0000000000..ad57bce618 --- /dev/null +++ b/engines/drascula/palette.cpp @@ -0,0 +1,202 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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::setRGB(byte *pal, int colorCount) { + int x, cnt = 0; + + for (x = 0; x < colorCount; x++) { + gamePalette[x][0] = pal[cnt++] / 4; + gamePalette[x][1] = pal[cnt++] / 4; + gamePalette[x][2] = pal[cnt++] / 4; + } + setPalette((byte *)&gamePalette); +} + +void DrasculaEngine::black() { + int color, component; + DacPalette256 blackPalette; + + for (color = 0; color < 256; color++) + for (component = 0; component < 3; component++) + blackPalette[color][component] = 0; + + blackPalette[254][0] = 0x3F; + blackPalette[254][1] = 0x3F; + blackPalette[254][2] = 0x15; + + setPalette((byte *)&blackPalette); +} + +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::color_abc(int cl) { + _color = cl; + + char colorTable[][3] = { + { 0, 0, 0 }, { 0x10, 0x3E, 0x28 }, + { 0, 0, 0 }, // unused + { 0x16, 0x3F, 0x16 }, { 0x09, 0x3F, 0x12 }, + { 0x3F, 0x3F, 0x15 }, + { 0, 0, 0 }, // unused + { 0x38, 0, 0 }, { 0x3F, 0x27, 0x0B }, + { 0x2A, 0, 0x2A }, { 0x30, 0x30, 0x30 }, + { 98, 91, 100 } + }; + + for (int i = 0; i <= 2; i++) + gamePalette[254][i] = colorTable[cl][i]; + + setPalette((byte *)&gamePalette); +} + +char DrasculaEngine::adjustToVGA(char value) { + return (value & 0x3F) * (value > 0); +} + +void DrasculaEngine::fadeToBlack(int fadeSpeed) { + char fade; + unsigned int color, component; + + DacPalette256 palFade; + + for (fade = 63; fade >= 0; fade--) { + for (color = 0; color < 256; color++) { + for (component = 0; component < 3; component++) { + palFade[color][component] = adjustToVGA(gamePalette[color][component] - 63 + fade); + } + } + pause(fadeSpeed); + + setPalette((byte *)&palFade); + } +} + +void DrasculaEngine::fadeFromBlack(int fadeSpeed) { + char fade; + unsigned int color, component; + + DacPalette256 palFade; + + for (fade = 0; fade < 64; fade++) { + for (color = 0; color < 256; color++) { + for (component = 0; component < 3; component++) { + palFade[color][component] = adjustToVGA(gamePalette[color][component] - 63 + fade); + } + } + pause(fadeSpeed); + + setPalette((byte *)&palFade); + } +} + +void DrasculaEngine::assignDefaultPalette() { + int color, component; + + for (color = 235; color < 253; color++) + for (component = 0; component < 3; component++) + defaultPalette[color][component] = gamePalette[color][component]; +} + +void DrasculaEngine::assignBrightPalette() { + int color, component; + + for (color = 235; color < 253; color++) { + for (component = 0; component < 3; component++) + brightPalette[color][component] = gamePalette[color][component]; + } +} + +void DrasculaEngine::assignDarkPalette() { + int color, component; + + for (color = 235; color < 253; color++) { + for (component = 0; component < 3; component++) + darkPalette[color][component] = gamePalette[color][component]; + } +} + +void DrasculaEngine::setDefaultPalette() { + int color, component; + + for (color = 235; color < 253; color++) { + for (component = 0; component < 3; component++) { + gamePalette[color][component] = defaultPalette[color][component]; + } + } + setPalette((byte *)&gamePalette); +} + +void DrasculaEngine::setBrightPalette() { + int color, component; + + for (color = 235; color < 253; color++) { + for (component = 0; component < 3; component++) + gamePalette[color][component] = brightPalette[color][component]; + } + + setPalette((byte *)&gamePalette); +} + +void DrasculaEngine::setDarkPalette() { + int color, component; + + for (color = 235; color < 253; color++ ) + for (component = 0; component < 3; component++) + gamePalette[color][component] = darkPalette[color][component]; + + setPalette((byte *)&gamePalette); +} + +void DrasculaEngine::setPaletteBase(int darkness) { + char fade; + unsigned int color, component; + + for (fade = darkness; fade >= 0; fade--) { + for (color = 235; color < 253; color++) { + for (component = 0; component < 3; component++) + gamePalette[color][component] = adjustToVGA(gamePalette[color][component] - 8 + fade); + } + } + + setPalette((byte *)&gamePalette); +} + +} // End of namespace Drascula diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 62d8c557fe..6fe28bdbdc 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -26,11 +26,10 @@ #include "common/array.h" #include "drascula/drascula.h" -#include "drascula/staticdata.h" namespace Drascula { -typedef void (DrasculaEngine::*RoomParser)(int args); +typedef bool (DrasculaEngine::*RoomParser)(int args); struct DrasculaRoomParser { DrasculaRoomParser(const char* d, RoomParser p) : desc(d), proc(p) {} @@ -55,7 +54,7 @@ Common::Array<DrasculaUpdater*> _roomUpdaters; #define UPDATEROOM(x) _roomUpdaters.push_back(new DrasculaUpdater(#x, &DrasculaEngine::x)) void DrasculaEngine::setupRoomsTable() { - //ROOM(room_0); // default + ROOM(room_0); // default ROOM(room_1); ROOM(room_3); ROOM(room_4); @@ -65,14 +64,13 @@ void DrasculaEngine::setupRoomsTable() { ROOM(room_8); ROOM(room_9); ROOM(room_12); - //ROOM(room_13); // returns bool + ROOM(room_13); // returns bool ROOM(room_14); ROOM(room_15); ROOM(room_16); ROOM(room_17); ROOM(room_18); - ROOM(room_19); - //ROOM(room_21); // returns bool + ROOM(room_21); // returns bool ROOM(room_22); ROOM(room_23); ROOM(room_24); @@ -83,46 +81,26 @@ void DrasculaEngine::setupRoomsTable() { ROOM(room_31); ROOM(room_34); ROOM(room_35); - ROOM(room_44); ROOM(room_49); ROOM(room_53); ROOM(room_54); ROOM(room_55); - //ROOM(room_56); // returns bool + ROOM(room_56); // returns bool ROOM(room_58); ROOM(room_59); - //ROOM(room_60); // returns bool - ROOM(room_61); + ROOM(room_60); // returns bool ROOM(room_62); - ROOM(room_63); ROOM(room_102); PREUPDATEROOM(update_1_pre); - PREUPDATEROOM(update_3_pre); - PREUPDATEROOM(update_5_pre); PREUPDATEROOM(update_6_pre); - PREUPDATEROOM(update_7_pre); PREUPDATEROOM(update_9_pre); - PREUPDATEROOM(update_12_pre); PREUPDATEROOM(update_14_pre); PREUPDATEROOM(update_16_pre); - PREUPDATEROOM(update_17_pre); PREUPDATEROOM(update_18_pre); - PREUPDATEROOM(update_21_pre); - PREUPDATEROOM(update_22_pre); PREUPDATEROOM(update_23_pre); - PREUPDATEROOM(update_24_pre); PREUPDATEROOM(update_26_pre); - PREUPDATEROOM(update_27_pre); - PREUPDATEROOM(update_29_pre); - PREUPDATEROOM(update_30_pre); - PREUPDATEROOM(update_31_pre); - PREUPDATEROOM(update_34_pre); PREUPDATEROOM(update_35_pre); - PREUPDATEROOM(update_49_pre); - PREUPDATEROOM(update_53_pre); - PREUPDATEROOM(update_54_pre); - PREUPDATEROOM(update_56_pre); PREUPDATEROOM(update_58_pre); PREUPDATEROOM(update_59_pre); PREUPDATEROOM(update_60_pre); @@ -131,41 +109,27 @@ void DrasculaEngine::setupRoomsTable() { UPDATEROOM(update_2); UPDATEROOM(update_3); UPDATEROOM(update_4); - UPDATEROOM(update_5); UPDATEROOM(update_13); - UPDATEROOM(update_15); - UPDATEROOM(update_17); - UPDATEROOM(update_18); - UPDATEROOM(update_20); UPDATEROOM(update_26); - UPDATEROOM(update_27); - UPDATEROOM(update_29); - UPDATEROOM(update_31); - UPDATEROOM(update_34); - UPDATEROOM(update_35); - UPDATEROOM(update_50); - UPDATEROOM(update_57); UPDATEROOM(update_58); UPDATEROOM(update_60); - UPDATEROOM(update_61); UPDATEROOM(update_62); - UPDATEROOM(update_63); UPDATEROOM(update_102); } -bool DrasculaEngine::roomParse(int room, int fl) { +bool DrasculaEngine::roomParse(int rN, int fl) { bool seen = false; - for (int i = 0; i < ARRAYSIZE(roomActions); i++) { - if (roomActions[i].room == room) { + for (int i = 0; i < _roomActionsSize; i++) { + if (_roomActions[i].room == rN) { seen = true; - if (roomActions[i].chapter == currentChapter || - roomActions[i].chapter == -1) { - if (roomActions[i].action == pickedObject || - roomActions[i].action == kVerbDefault) { - if (roomActions[i].objectID == fl || - roomActions[i].objectID == -1) { - talk(roomActions[i].speechID); + if (_roomActions[i].chapter == currentChapter || + _roomActions[i].chapter == -1) { + if (_roomActions[i].action == pickedObject || + _roomActions[i].action == kVerbDefault) { + if (_roomActions[i].objectID == fl || + _roomActions[i].objectID == -1) { + talk(_roomActions[i].speechID); hasAnswer = 1; return true; } @@ -178,12 +142,11 @@ bool DrasculaEngine::roomParse(int room, int fl) { return false; } -void DrasculaEngine::room_0() { +bool DrasculaEngine::room_0(int fl) { static const int lookExcuses[3] = {100, 101, 54}; static const int actionExcuses[6] = {11, 109, 111, 110, 115, 116}; - if (roomParse(0, -1)) - return; + fl = -1; // avoid warning // non-default actions if (currentChapter == 2 || currentChapter == 4 || @@ -200,9 +163,11 @@ void DrasculaEngine::room_0() { curExcuseAction = 0; } } + + return true; } -void DrasculaEngine::room_1(int fl) { +bool DrasculaEngine::room_1(int fl) { if (pickedObject == kVerbLook && fl == 118) { talk(1); pause(10); @@ -211,9 +176,11 @@ void DrasculaEngine::room_1(int fl) { talk(14); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_3(int fl) { +bool DrasculaEngine::room_3(int fl) { if (pickedObject == kVerbTalk && fl == 129) { talk(23); pause(6); @@ -228,7 +195,7 @@ void DrasculaEngine::room_3(int fl) { talk(149); talk(150); } else if (pickedObject == kVerbPick && fl == 165) { - copyBackground(0, 0, 0,0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0,0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); copyRect(44, 1, curX, curY, 41, 70, drawSurface2, screenSurface); updateRefresh(); @@ -247,9 +214,11 @@ void DrasculaEngine::room_3(int fl) { talk(186); } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_4(int fl) { +bool DrasculaEngine::room_4(int fl) { if (pickedObject == kVerbMove && fl == 189 && flags[34] == 0) { talk(327); pickObject(13); @@ -258,9 +227,11 @@ void DrasculaEngine::room_4(int fl) { flags[38] = 1; } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_5(int fl) { +bool DrasculaEngine::room_5(int fl) { if (pickedObject == kVerbLook && fl == 136 && flags[8] == 0) talk(14); else if (pickedObject == 10 && fl == 136) { @@ -268,9 +239,11 @@ void DrasculaEngine::room_5(int fl) { removeObject(kItemSpike); } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_6(int fl){ +bool DrasculaEngine::room_6(int fl) { if (pickedObject == kVerbLook && fl==144) { talk(41); talk(42); @@ -279,7 +252,7 @@ void DrasculaEngine::room_6(int fl){ else if (pickedObject == kVerbClose && fl == 138) closeDoor(0, 1); else if (pickedObject == kVerbOpen && fl == 143 && flags[2] == 0) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); copyRect(228, 102, curX + 5, curY - 1, 47, 73, drawSurface3, screenSurface); updateScreen(); @@ -290,7 +263,7 @@ void DrasculaEngine::room_6(int fl){ updateScreen(); finishSound(); } else if (pickedObject == kVerbClose && fl == 143 && flags[2] == 1) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); flags[2] = 0; updateRefresh_pre(); copyRect(228, 102, curX + 5, curY - 1, 47, 73, drawSurface3, screenSurface); @@ -301,7 +274,7 @@ void DrasculaEngine::room_6(int fl){ updateScreen(); finishSound(); } else if (pickedObject == kVerbOpen && fl == 139 && flags[1] == 0) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); copyRect(267, 1, curX - 14, curY - 2, 52, 73, drawSurface3, screenSurface); updateScreen(); @@ -314,7 +287,7 @@ void DrasculaEngine::room_6(int fl){ updateScreen(); finishSound(); } else if (pickedObject == kVerbPick && fl == 140) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); copyRect(267, 1, curX - 14, curY - 2, 52, 73, drawSurface3, screenSurface); updateScreen(); @@ -326,9 +299,11 @@ void DrasculaEngine::room_6(int fl){ hasAnswer = 1; else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_7(int fl){ +bool DrasculaEngine::room_7(int fl) { if (pickedObject == kVerbPick && fl == 190) { pickObject(17); flags[35] = 1; @@ -337,9 +312,11 @@ void DrasculaEngine::room_7(int fl){ flags[38] = 1; } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_8(int fl) { +bool DrasculaEngine::room_8(int fl) { if (pickedObject == kVerbLook && fl == 147) { if (flags[7] == 0) { talk(58); @@ -352,9 +329,11 @@ void DrasculaEngine::room_8(int fl) { } } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_9(int fl){ +bool DrasculaEngine::room_9(int fl) { if (pickedObject == kVerbTalk && fl == 51 && flags[4] == 0) animation_4_2(); else if (pickedObject == kVerbTalk && fl == 51 && flags[4] == 1) @@ -365,15 +344,19 @@ void DrasculaEngine::room_9(int fl){ pickObject(14);} else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_12(int fl){ +bool DrasculaEngine::room_12(int fl) { if (pickedObject == kVerbOpen && fl == 156) openDoor(16, 4); else if (pickedObject == kVerbClose && fl == 156) closeDoor(16, 4); else hasAnswer = 0; + + return true; } bool DrasculaEngine::room_13(int fl) { @@ -391,10 +374,11 @@ bool DrasculaEngine::room_13(int fl) { return true; } else hasAnswer = 0; + return false; } -void DrasculaEngine::room_14(int fl) { +bool DrasculaEngine::room_14(int fl) { if (pickedObject == kVerbTalk && fl == 54 && flags[39] == 0) animation_12_2(); else if (pickedObject == kVerbTalk && fl == 54 && flags[39] == 1) @@ -409,9 +393,11 @@ void DrasculaEngine::room_14(int fl) { animation_13_2(); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_15(int fl) { +bool DrasculaEngine::room_15(int fl) { if (pickedObject == 19 && fl == 188 && flags[27] == 0) talk(335); else if (pickedObject == 19 && fl == 188 && flags[27] == 1) { @@ -421,7 +407,7 @@ void DrasculaEngine::room_15(int fl) { talk_sync(_text[_lang][46], "46.als", "4442444244244"); trackProtagonist = 1; } else if (pickedObject == 18 && fl == 188 && flags[26] == 0) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); copyRect(133, 135, curX + 6, curY, 39, 63, drawSurface3, screenSurface); updateScreen(); playSound(8); @@ -440,9 +426,11 @@ void DrasculaEngine::room_15(int fl) { flags[38] = 1; } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_16(int fl) { +bool DrasculaEngine::room_16(int fl) { if (pickedObject == kVerbOpen && fl == 163) openDoor(17, 0); else if (pickedObject == kVerbClose && fl == 163) @@ -473,9 +461,11 @@ void DrasculaEngine::room_16(int fl) { talk(344); } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_17(int fl) { +bool DrasculaEngine::room_17(int fl) { if (pickedObject == kVerbLook && fl == 177) talk(35); else if (pickedObject == kVerbTalk && fl == 177 && flags[18] == 0) @@ -497,15 +487,17 @@ void DrasculaEngine::room_17(int fl) { removeObject(kItemEarplugs); } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_18(int fl) { +bool DrasculaEngine::room_18(int fl) { if (pickedObject == kVerbTalk && fl == 55 && flags[36] == 0) animation_24_2(); else if (pickedObject == kVerbTalk && fl == 55 && flags[36] == 1) talk(109); else if (pickedObject == kVerbPick && fl == 182) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); copyRect(44, 1, curX, curY, 41, 70, drawSurface2, screenSurface); updateRefresh(); @@ -527,7 +519,7 @@ void DrasculaEngine::room_18(int fl) { trackProtagonist = 3; updateRoom(); updateScreen(); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); copyRect(1, 1, curX - 1, curY + 3, 42, 67, drawSurface2, screenSurface); updateRefresh(); @@ -539,10 +531,8 @@ void DrasculaEngine::room_18(int fl) { removeObject(kItemEarplugs); } else hasAnswer = 0; -} -void DrasculaEngine::room_19(int fl) { - hasAnswer = 0; + return true; } bool DrasculaEngine::room_21(int fl) { @@ -569,7 +559,7 @@ bool DrasculaEngine::room_21(int fl) { return false; } -void DrasculaEngine::room_22(int fl) { +bool DrasculaEngine::room_22(int fl) { if (pickedObject == 11 && fl == 140) { pickObject(18); visible[1] = 0; @@ -594,9 +584,11 @@ void DrasculaEngine::room_22(int fl) { flags[27] = 1; } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_23(int fl) { +bool DrasculaEngine::room_23(int fl) { if (pickedObject == kVerbOpen && fl == 103) { openDoor(0, 0); updateVisible(); @@ -617,9 +609,11 @@ void DrasculaEngine::room_23(int fl) { animation_6_4(); } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_24(int fl) { +bool DrasculaEngine::room_24(int fl) { if (pickedObject == kVerbOpen && fl == 105) openDoor(1, 0); else if (pickedObject == kVerbClose && fl == 105) @@ -630,9 +624,11 @@ void DrasculaEngine::room_24(int fl) { closeDoor(2, 1); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_26(int fl) { +bool DrasculaEngine::room_26(int fl) { if (pickedObject == kVerbOpen && fl == 107 && flags[30] == 0) openDoor(2, 0); else if (pickedObject == kVerbOpen && fl == 107 && flags[30] == 1) @@ -669,9 +665,11 @@ void DrasculaEngine::room_26(int fl) { animation_1_4(); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_27(int fl) { +bool DrasculaEngine::room_27(int fl) { if (pickedObject == kVerbOpen && fl == 110) openDoor(6, 1); else if (pickedObject == kVerbClose && fl == 110) @@ -684,24 +682,26 @@ void DrasculaEngine::room_27(int fl) { flags[23] = 1; openDoor(5,3); withoutVerb(); - } else if (pickedObject == kVerbLook && fl == 175) - talk(429); - else if (fl == 150) + } else if (fl == 150) talk(460); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_29(int fl) { +bool DrasculaEngine::room_29(int fl) { if (pickedObject == kVerbOpen && fl == 114) openDoor(4, 1); else if (pickedObject == kVerbClose && fl == 114) closeDoor(4, 1); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_30(int fl) { +bool DrasculaEngine::room_30(int fl) { if (pickedObject == kVerbOpen && fl == 115) openDoor(4, 0); else if (pickedObject == kVerbClose && fl == 115) @@ -726,9 +726,11 @@ void DrasculaEngine::room_30(int fl) { flags[19] = 1; } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_31(int fl) { +bool DrasculaEngine::room_31(int fl) { if (pickedObject == kVerbPick && fl == 145) { pickObject(11); visible[1] = 0; @@ -739,9 +741,11 @@ void DrasculaEngine::room_31(int fl) { closeDoor(5, 0); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_34(int fl) { +bool DrasculaEngine::room_34(int fl) { if (pickedObject == kVerbMove && fl == 146) animation_8_4(); else if (pickedObject == kVerbOpen && fl == 120 && flags[25] == 1) @@ -756,9 +760,11 @@ void DrasculaEngine::room_34(int fl) { closeDoor(8, 2); else hasAnswer=0; + + return true; } -void DrasculaEngine::room_35(int fl) { +bool DrasculaEngine::room_35(int fl) { if (pickedObject == kVerbPick && fl == 148) { pickObject(16); visible[2] = 0; @@ -780,22 +786,22 @@ void DrasculaEngine::room_35(int fl) { flags[17] = 0; } else hasAnswer = 0; -} -void DrasculaEngine::room_44(int fl) { - hasAnswer = 0; + return true; } -void DrasculaEngine::room_49(int fl){ +bool DrasculaEngine::room_49(int fl) { if (pickedObject == kVerbTalk && fl ==51) converse(9); else if ((pickedObject == 8 && fl == 51) || (pickedObject == 8 && fl == 203)) animation_5_5(); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_53(int fl) { +bool DrasculaEngine::room_53(int fl) { if (pickedObject == kVerbPick && fl == 120) { pickObject(16); visible[3] = 0; @@ -815,12 +821,14 @@ void DrasculaEngine::room_53(int fl) { visible[3] = 1; } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_54(int fl) { +bool DrasculaEngine::room_54(int fl) { if ((pickedObject == kVerbTalk && fl == 118) || (pickedObject == kVerbLook && fl == 118 && flags[0] == 0)) animation_1_5(); - else if (pickedObject == kVerbLook && fl == 118 && flags[0]==1) + else if (pickedObject == kVerbLook && fl == 118 && flags[0] == 1) talk(124); else if (pickedObject == kVerbTalk && fl == 53 && flags[14] == 0) { talk(288); @@ -847,9 +855,11 @@ void DrasculaEngine::room_54(int fl) { removeObject(10); } else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_55(int fl) { +bool DrasculaEngine::room_55(int fl) { if (pickedObject == kVerbPick && fl == 122) { pickObject(12); flags[8] = 1; @@ -861,12 +871,11 @@ void DrasculaEngine::room_55(int fl) { gotoObject(curX - 3, curY + curHeight + 6); } else hasAnswer = 0; + + return true; } bool DrasculaEngine::room_56(int fl) { - if (roomParse(56, fl)) - return false; - if (pickedObject == kVerbOpen && fl == 124) { animation_14_5(); return true; @@ -876,14 +885,16 @@ bool DrasculaEngine::room_56(int fl) { return false; } -void DrasculaEngine::room_58(int fl) { +bool DrasculaEngine::room_58(int fl) { if (pickedObject == kVerbMove && fl == 103) animation_7_6(); else hasAnswer = 0; + + return true; } -void DrasculaEngine::room_59(int fl) { +bool DrasculaEngine::room_59(int fl) { if ((pickedObject == kVerbTalk && fl == 51) || (pickedObject == kVerbLook && fl == 51)) { flags[9] = 1; talk(259); @@ -911,11 +922,11 @@ void DrasculaEngine::room_59(int fl) { hare_se_ve = 0; updateRoom(); copyRect(101, 34, curX - 4, curY - 1, 37, 70, drawSurface3, screenSurface); - copyBackground(0, 0, 0, 0, 320, 200, screenSurface, drawSurface1); + copyBackground(0, 0, 0, 0, 320, 200, screenSurface, bgSurface); updateScreen(); hare_se_ve = 1; clearRoom(); - loadPic("tlef0.alg", drawSurface1, COMPLETE_PAL); + loadPic("tlef0.alg", bgSurface, COMPLETE_PAL); loadPic("tlef1.alg", drawSurface3); loadPic("tlef2.alg", frontSurface); loadPic("tlef3.alg", backSurface); @@ -939,7 +950,7 @@ void DrasculaEngine::room_59(int fl) { loadPic("aux59.alg", drawSurface3); loadPic(96, frontSurface, COMPLETE_PAL); loadPic(99, backSurface); - loadPic(59, drawSurface1, HALF_PAL); + loadPic(59, bgSurface, HALF_PAL); trackProtagonist = 3; talk(245); withoutVerb(); @@ -947,12 +958,11 @@ void DrasculaEngine::room_59(int fl) { } } else hasAnswer = 0; + + return true; } bool DrasculaEngine::room_60(int fl) { - if (roomParse(60, fl)) - return false; - if (pickedObject == kVerbMove && fl == 112) animation_10_6(); else if (pickedObject == kVerbTalk && fl == 52) { @@ -975,11 +985,7 @@ bool DrasculaEngine::room_60(int fl) { return false; } -void DrasculaEngine::room_61(int fl) { - hasAnswer = 0; -} - -void DrasculaEngine::room_62(int fl) { +bool DrasculaEngine::room_62(int fl) { if (pickedObject == kVerbTalk && fl == 53) converse(13); else if (pickedObject == kVerbTalk && fl == 52 && flags[0] == 0) @@ -990,13 +996,11 @@ void DrasculaEngine::room_62(int fl) { animation_4_1(); else hasAnswer = 0; -} -void DrasculaEngine::room_63(int fl) { - hasAnswer = 0; + return true; } -void DrasculaEngine::room_102(int fl) { +bool DrasculaEngine::room_102(int fl) { if (pickedObject == kVerbPick && fl == 101) pickObject(20); else if (pickedObject == 20 && fl == 100) @@ -1005,9 +1009,31 @@ void DrasculaEngine::room_102(int fl) { talk(453); else hasAnswer = 0; + + return true; } void DrasculaEngine::updateRefresh() { + // Check generic updaters + for (int i = 0; i < _roomUpdatesSize; i++) { + if (_roomUpdates[i].roomNum == roomNumber) { + if (_roomUpdates[i].flag < 0 || + flags[_roomUpdates[i].flag] == _roomUpdates[i].flagValue) { + if (_roomUpdates[i].type == 0) { + copyBackground(_roomUpdates[i].sourceX, _roomUpdates[i].sourceY, + _roomUpdates[i].destX, _roomUpdates[i].destY, + _roomUpdates[i].width, _roomUpdates[i].height, + drawSurface3, screenSurface); + } else { + copyRect(_roomUpdates[i].sourceX, _roomUpdates[i].sourceY, + _roomUpdates[i].destX, _roomUpdates[i].destY, + _roomUpdates[i].width, _roomUpdates[i].height, + drawSurface3, screenSurface); + } + } + } + } + // Call room-specific updater char rm[20]; sprintf(rm, "update_%d", roomNumber); @@ -1026,6 +1052,26 @@ void DrasculaEngine::updateRefresh() { } void DrasculaEngine::updateRefresh_pre() { + // Check generic preupdaters + for (int i = 0; i < _roomPreUpdatesSize; i++) { + if (_roomPreUpdates[i].roomNum == roomNumber) { + if (_roomPreUpdates[i].flag < 0 || + flags[_roomPreUpdates[i].flag] == _roomPreUpdates[i].flagValue) { + if (_roomPreUpdates[i].type == 0) { + copyBackground(_roomPreUpdates[i].sourceX, _roomPreUpdates[i].sourceY, + _roomPreUpdates[i].destX, _roomPreUpdates[i].destY, + _roomPreUpdates[i].width, _roomPreUpdates[i].height, + drawSurface3, screenSurface); + } else { + copyRect(_roomPreUpdates[i].sourceX, _roomPreUpdates[i].sourceY, + _roomPreUpdates[i].destX, _roomPreUpdates[i].destY, + _roomPreUpdates[i].width, _roomPreUpdates[i].height, + drawSurface3, screenSurface); + } + } + } + } + // Call room-specific preupdater char rm[20]; sprintf(rm, "update_%d_pre", roomNumber); @@ -1054,7 +1100,7 @@ void DrasculaEngine::update_1_pre() { copyBackground(2, 158, 208, 67, 27, 40, drawSurface3, screenSurface); } -void DrasculaEngine::update_2(){ +void DrasculaEngine::update_2() { int batPos[6]; int difference; int batX[] = {0, 38, 76, 114, 152, 190, 228, 266, @@ -1073,16 +1119,16 @@ void DrasculaEngine::update_2(){ 41, 41, 41, 41, 4, 4, 4, 4}; - if (frame_bat == 41) - frame_bat = 0; + if (actorFrames[kFrameBat] == 41) + actorFrames[kFrameBat] = 0; - batPos[0] = batX[frame_bat]; - batPos[1] = batY[frame_bat]; + batPos[0] = batX[actorFrames[kFrameBat]]; + batPos[1] = batY[actorFrames[kFrameBat]]; - if (frame_bat < 22) { + if (actorFrames[kFrameBat] < 22) { batPos[4] = 37; batPos[5] = 21; - } else if (frame_bat > 27) { + } else if (actorFrames[kFrameBat] > 27) { batPos[4] = 57; batPos[5] = 36; } else { @@ -1096,7 +1142,7 @@ void DrasculaEngine::update_2(){ copyRectClip(batPos, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference >= 6) { - frame_bat++; + actorFrames[kFrameBat]++; savedTime = getTime(); } @@ -1104,11 +1150,6 @@ void DrasculaEngine::update_2(){ showMap(); } -void DrasculaEngine::update_3_pre() { - if (flags[3] == 1) - copyBackground(258, 110, 85, 44, 23, 53, drawSurface3, screenSurface); -} - void DrasculaEngine::update_3() { if (curY + curHeight < 118) copyRect(129, 110, 194, 36, 126, 88, drawSurface3, screenSurface); @@ -1125,15 +1166,6 @@ void DrasculaEngine::update_4() { } } -void DrasculaEngine::update_5_pre(){ - if (flags[8] == 0) - copyBackground(256, 152, 208, 67, 27, 40, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_5() { - copyRect(114, 130, 211, 87, 109, 69, drawSurface3, screenSurface); -} - void DrasculaEngine::update_6_pre() { if ((curX > 149 && curY + curHeight > 160 && curX < 220 && curY + curHeight < 188) || (curX > 75 && curY + curHeight > 183 && curX < 145)) { @@ -1143,18 +1175,6 @@ void DrasculaEngine::update_6_pre() { changeColor = 1; setDarkPalette(); } - - if (flags[0] == 0) - copyBackground(3, 103, 185, 69, 23, 76, drawSurface3, screenSurface); - if (flags[1] == 0) - copyBackground(97, 117, 34, 148, 36, 31, drawSurface3, screenSurface); - if (flags[2] == 0) - copyBackground(28, 100, 219, 72, 64, 97, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_7_pre() { - if (flags[35] == 0) - copyBackground(1, 72, 158, 162, 19, 12, drawSurface3, screenSurface); } void DrasculaEngine::update_9_pre() { @@ -1162,27 +1182,24 @@ void DrasculaEngine::update_9_pre() { int blindY[] = {51, 51, 51, 51, 51, 51, 51, 127, 127}; int difference; - copyRect(blindX[frame_blind], blindY[frame_blind], 122, 57, 41, 72, drawSurface3, screenSurface); + copyRect(blindX[actorFrames[kFrameBlind]], blindY[actorFrames[kFrameBlind]], + 122, 57, 41, 72, drawSurface3, screenSurface); if (flags[9] == 0) { difference = getTime() - savedTime; if (difference >= 11) { - frame_blind++; + actorFrames[kFrameBlind]++; savedTime = getTime(); } - if (frame_blind == 9) - frame_blind = 0; + if (actorFrames[kFrameBlind] == 9) + actorFrames[kFrameBlind] = 0; } else - frame_blind = 3; -} - -void DrasculaEngine::update_12_pre() { - if (flags[16] == 0) - copyBackground(1, 131, 106, 117, 55, 68, drawSurface3, screenSurface); + actorFrames[kFrameBlind] = 3; } void DrasculaEngine::update_13() { if (curX > 55 && flags[3] == 0) animation_6_3(); + // These cannot be placed in an array, as they're between screen updates if (flags[1] == 0) copyRect(185, 110, 121, 65, 67, 88, drawSurface3, screenSurface); if (flags[2] == 0) @@ -1191,54 +1208,46 @@ void DrasculaEngine::update_13() { } void DrasculaEngine::update_14_pre() { - int candleY[] = {158, 172, 186}; - int candleX[] = {14, 19, 24}; - int pianistX[] = {1, 91, 61, 31, 91, 31, 1, 61, 31}; - int drunkX[] = {1, 42, 83, 124, 165, 206, 247, 1}; int difference; - copyBackground(123, candleY[frame_candles], 142, 14, 39, 13, drawSurface3, screenSurface); - copyBackground(candleX[frame_candles], 146, 311, 80, 4, 8, drawSurface3, screenSurface); + copyBackground(123, _candleY[actorFrames[kFrameCandles]], 142, 14, 39, 13, drawSurface3, screenSurface); + copyBackground(_candleX[actorFrames[kFrameCandles]], 146, 311, 80, 4, 8, drawSurface3, screenSurface); if (blinking == 5) copyBackground(1, 149, 127, 52, 9, 5, drawSurface3, screenSurface); if (curX > 101 && curX < 155) copyBackground(31, 138, 178, 51, 18, 16, drawSurface3, screenSurface); if (flags[11] == 0) - copyBackground(pianistX[frame_piano], 157, 245, 130, 29, 42, drawSurface3, screenSurface); + copyBackground(_pianistX[actorFrames[kFramePianist]], 157, 245, 130, 29, 42, drawSurface3, screenSurface); else if (flags[5] == 0) copyBackground(145, 139, 228, 112, 47, 60, extraSurface, screenSurface); else copyBackground(165, 140, 229, 117, 43, 59, drawSurface3, screenSurface); if (flags[12] == 1) - copyBackground(drunkX[frame_drunk], 82, 170, 50, 40, 53, drawSurface3, screenSurface); + copyBackground(_drunkX[actorFrames[kFrameDrunk]], 82, 170, 50, 40, 53, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference > 6) { if (flags[12] == 1) { - frame_drunk++; - if (frame_drunk == 8) { - frame_drunk = 0; + actorFrames[kFrameDrunk]++; + if (actorFrames[kFrameDrunk] == 8) { + actorFrames[kFrameDrunk] = 0; flags[12] = 0; } } else if ((_rnd->getRandomNumber(94) == 15) && (flags[13] == 0)) flags[12] = 1; - frame_candles++; - if (frame_candles == 3) - frame_candles = 0; - frame_piano++; - if (frame_piano == 9) - frame_piano = 0; + actorFrames[kFrameCandles]++; + if (actorFrames[kFrameCandles] == 3) + actorFrames[kFrameCandles] = 0; + actorFrames[kFramePianist]++; + if (actorFrames[kFramePianist] == 9) + actorFrames[kFramePianist] = 0; blinking = _rnd->getRandomNumber(10); savedTime = getTime(); } } -void DrasculaEngine::update_15() { - copyRect(1, 154, 83, 122, 131, 44, drawSurface3, screenSurface); -} - void DrasculaEngine::update_16_pre() { if (currentChapter != 2) { debug(4, "update_16_pre: Special case, current chapter is not 2, not performing update"); @@ -1251,15 +1260,6 @@ void DrasculaEngine::update_16_pre() { copyBackground(37, 151, 224, 115, 56, 47, drawSurface3, screenSurface); } -void DrasculaEngine::update_17_pre() { - if (flags[15] == 1) - copyBackground(1, 135, 108, 65, 44, 63, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_17() { - copyRect(48, 135, 78, 139, 80, 30, drawSurface3, screenSurface); -} - void DrasculaEngine::update_18_pre() { int difference; int snore_x[] = {95, 136, 95, 136, 95, 95, 95, 95, 136, 95, 95, 95, 95, 95, 95, 95}; @@ -1267,54 +1267,27 @@ void DrasculaEngine::update_18_pre() { if (flags[21] == 0) { copyBackground(1, 69, 120, 58, 56, 61, drawSurface3, screenSurface); - copyBackground(snore_x[frame_snore], snore_y[frame_snore], 124, 59, 40, 37, drawSurface3, screenSurface); + copyBackground(snore_x[actorFrames[kFrameSnore]], + snore_y[actorFrames[kFrameSnore]], + 124, 59, 40, 37, drawSurface3, screenSurface); } else - moveVB(); + moveVonBraun(); difference = getTime() - savedTime; if (difference > 9) { - frame_snore++; - if (frame_snore == 16) - frame_snore = 0; + actorFrames[kFrameSnore]++; + if (actorFrames[kFrameSnore] == 16) + actorFrames[kFrameSnore] = 0; savedTime = getTime(); } } -void DrasculaEngine::update_18() { - if (flags[24] == 1) - copyRect(177, 1, 69, 29, 142, 130, drawSurface3, screenSurface); - copyRect(105, 132, 109, 108, 196, 65, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_20() { - copyRect(1, 137, 106, 121, 213, 61, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_21_pre() { - if (flags[0] == 1) - copyBackground(2, 171, 84, 126, 17, 26, drawSurface3, screenSurface); - - if (flags[10] == 1) - copyBackground(20, 163, 257, 149, 14, 34, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_22_pre() { - if (flags[24] == 1) - copyBackground(2, 187, 107, 106, 62, 12, drawSurface3, screenSurface); - - if (flags[27] == 0) - copyBackground(32, 181, 203, 88, 13, 5, drawSurface3, screenSurface); - - if (flags[26] == 0) - copyBackground(2, 133, 137, 83, 29, 53, drawSurface3, screenSurface); - else - copyBackground(65, 174, 109, 145, 55, 25, drawSurface3, screenSurface); -} - void DrasculaEngine::update_23_pre() { if (flags[11] == 1 && flags[0] == 0) copyBackground(87, 171, 237, 110, 20, 28, drawSurface3, screenSurface); + // It might be possible to put these in an array, though I'm a bit unsure + // of the draw order if (flags[0] == 1) copyBackground(29, 126, 239, 94, 57, 73, drawSurface3, screenSurface); @@ -1322,26 +1295,9 @@ void DrasculaEngine::update_23_pre() { copyRect(1, 135, 7, 94, 27, 64, drawSurface3, screenSurface); } -void DrasculaEngine::update_24_pre() { - if (flags[1] == 1) - copyBackground(1, 163, 225, 124, 12, 36, drawSurface3, screenSurface); - - if (flags[2] == 1) - copyBackground(14, 153, 30, 107, 23, 46, drawSurface3, screenSurface); -} - void DrasculaEngine::update_26_pre() { int difference; - if (flags[2] == 1) - copyBackground(1, 130, 87, 44, 50, 69, drawSurface3, screenSurface); - - if (flags[12] == 1) - copyBackground(52, 177, 272, 103, 27, 22, drawSurface3, screenSurface); - - if (flags[18] == 0) - copyBackground(80, 133, 199, 95, 50, 66, drawSurface3, screenSurface); - if (blinking == 5 && flags[18] == 0) copyBackground(52, 172, 226, 106, 3, 4, drawSurface3, screenSurface); @@ -1362,123 +1318,20 @@ void DrasculaEngine::update_26() { copyRect(233, 107, 17, 102, 66, 92, drawSurface3, screenSurface); } -void DrasculaEngine::update_27_pre() { - if (flags[5] == 1) - copyRect(1, 175, 59, 109, 17, 24, drawSurface3, screenSurface); - - if (flags[6] == 1) - copyRect(19, 177, 161, 103, 18, 22, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_27() { - copyRect(38, 177, 103, 171, 21, 22, drawSurface3, screenSurface); - copyRect(60, 162, 228, 156, 18, 37, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_29_pre() { - if (flags[4] == 1) - copyBackground(12, 113, 247, 49, 41, 84, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_29() { - copyRect(1, 180, 150, 126, 10, 17, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_30_pre() { - if (flags[4] == 1) - copyBackground(1, 148, 148, 66, 35, 51, drawSurface3, screenSurface); - - if (flags[16] == 1) - copyBackground(37, 173, 109, 84, 20, 26, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_31_pre() { - if (flags[13] == 1) - copyBackground(1, 163, 116, 41, 61, 36, drawSurface3, screenSurface); - - if (flags[5] == 1) - copyBackground(1, 78, 245, 63, 30, 84, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_31() { - copyRect(63, 190, 223, 157, 17, 9, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_34_pre() { - if (flags[7] == 1) - copyBackground(99, 127, 73, 41, 79, 72, drawSurface3, screenSurface); - - if (flags[8] == 1) - copyBackground(36, 129, 153, 41, 62, 65, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_34() { - copyRect(5, 171, 234, 126, 29, 23, drawSurface3, screenSurface); -} - void DrasculaEngine::update_35_pre() { - if (flags[14] == 1) - copyBackground(1, 86, 246, 65, 68, 87, drawSurface3, screenSurface); - if (flags[17] == 0 && flags[15] == 1) copyBackground(111, 150, 118, 52, 40, 23, drawSurface3, screenSurface); - - if (flags[17] == 1) - copyBackground(70, 150, 118, 52, 40, 23, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_35() { - copyRect(1, 174, 54, 152, 195, 25, drawSurface3, screenSurface); -} - - -void DrasculaEngine::update_49_pre() { - if (flags[6] == 0) - copyBackground(2, 136, 176, 81, 49, 62, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_50() { - copyRect(4, 153, 118, 95, 67, 44, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_53_pre() { - if (flags[1] == 0) - copyRect(2, 113, 205, 50, 38, 86, drawSurface3, screenSurface); - if (flags[2] == 0) - copyBackground(41, 159, 27, 117, 25, 40, drawSurface3, screenSurface); - if (flags[9] == 1) - copyBackground(67, 184, 56, 93, 32, 15, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_54_pre() { - if (flags[5] == 1) - copyBackground(168, 156, 187, 111, 7, 11, drawSurface3, screenSurface); - if (flags[12] == 1) - copyBackground(16, 156, 190, 64, 18, 24, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_56_pre() { - if (flags[10] == 0) - copyBackground(2, 126, 42, 67, 57, 67, drawSurface3, screenSurface); - if (flags[11] == 1) - copyBackground(60, 160, 128, 97, 103, 38, drawSurface3, screenSurface); -} - -void DrasculaEngine::update_57() { - copyRect(7, 113, 166, 61, 62, 82, drawSurface3, screenSurface); } void DrasculaEngine::update_58_pre() { - if (flags[0] == 0) - copyBackground(1, 156, 143, 120, 120, 43, drawSurface3, screenSurface); - if (flags[1] == 2) - copyRect(252, 171, 173, 116, 25, 28, drawSurface3, screenSurface); if (flags[1] == 0 && flags[0] == 0) copyRect(278, 171, 173, 116, 25, 28, drawSurface3, screenSurface); if (flags[2] == 0) { placeIgor(); placeDrascula(); } + // Not possible to put these in an array, as there are other surfaces + // copied above if (flags[3] == 1) copyRect(1, 29, 204, 0, 18, 125, drawSurface3, screenSurface); if (flags[8] == 1) @@ -1491,22 +1344,19 @@ void DrasculaEngine::update_58() { } void DrasculaEngine::update_59_pre() { - if (flags[4] == 0) - copyRect(1, 146, 65, 106, 83, 40, drawSurface3, screenSurface); if (flags[9] == 1) { - copyBackground(65, 103, 65, 103, 49, 38, drawSurface1, screenSurface); + copyBackground(65, 103, 65, 103, 49, 38, bgSurface, screenSurface); copyRect(1, 105, 65, 103, 49, 38, drawSurface3, screenSurface); } } void DrasculaEngine::update_60_pre() { - int candleY[] = {158, 172, 186}; int difference; if (flags[5] == 0) placeDrascula(); - copyBackground(123, candleY[frame_candles], 142, 14, 39, 13, drawSurface3, screenSurface); + copyBackground(123, _candleY[actorFrames[kFrameCandles]], 142, 14, 39, 13, drawSurface3, screenSurface); if (flag_tv == 1) copyBackground(114, 158, 8, 30, 8, 23, drawSurface3, screenSurface); @@ -1518,31 +1368,23 @@ void DrasculaEngine::update_60_pre() { else if (blinking == 5 && flag_tv == 1) flag_tv = 0; if (difference > 6) { - frame_candles++; - if (frame_candles == 3) - frame_candles = 0; + actorFrames[kFrameCandles]++; + if (actorFrames[kFrameCandles] == 3) + actorFrames[kFrameCandles] = 0; savedTime = getTime(); } } void DrasculaEngine::update_60() { - if (curY - 10 < y_dr && flags[5] == 0) + if (curY - 10 < drasculaY && flags[5] == 0) placeDrascula(); } -void DrasculaEngine::update_61() { - copyRect(1, 154, 83, 122, 131, 44, drawSurface3, screenSurface); -} - void DrasculaEngine::update_62_pre() { - int candleY[] = { 158, 172, 186 }; - int candleX[] = { 14, 19, 24 }; - int pianistX[] = {1, 91, 61, 31, 91, 31, 1, 61, 31 }; - int drunkX[] = {1, 42, 83, 124, 165, 206, 247, 1 }; int difference; - copyBackground(123, candleY[frame_candles], 142, 14, 39, 13, drawSurface3, screenSurface); - copyBackground(candleX[frame_candles], 146, 311, 80, 4, 8, drawSurface3, screenSurface); + copyBackground(123, _candleY[actorFrames[kFrameCandles]], 142, 14, 39, 13, drawSurface3, screenSurface); + copyBackground(_candleX[actorFrames[kFrameCandles]], 146, 311, 80, 4, 8, drawSurface3, screenSurface); if (blinking == 5) copyBackground(1, 149, 127, 52, 9, 5, drawSurface3, screenSurface); @@ -1551,64 +1393,59 @@ void DrasculaEngine::update_62_pre() { copyBackground(31, 138, 178, 51, 18, 16, drawSurface3, screenSurface); if (flags[11] == 0) - copyBackground(pianistX[frame_piano], 157, 245, 130, 29, 42, drawSurface3, screenSurface); + copyBackground(_pianistX[actorFrames[kFramePianist]], 157, 245, 130, 29, 42, drawSurface3, screenSurface); else if (flags[5] == 0) copyBackground(145, 139, 228, 112, 47, 60, extraSurface, screenSurface); else copyBackground(165, 140, 229, 117, 43, 59, drawSurface3, screenSurface); if (flags[12] == 1) - copyBackground(drunkX[frame_drunk], 82, 170, 50, 40, 53, drawSurface3, screenSurface); + copyBackground(_drunkX[actorFrames[kFrameDrunk]], 82, 170, 50, 40, 53, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference > 6) { if (flags[12] == 1) { - frame_drunk++; - if (frame_drunk == 8) { - frame_drunk = 0; + actorFrames[kFrameDrunk]++; + if (actorFrames[kFrameDrunk] == 8) { + actorFrames[kFrameDrunk] = 0; flags[12] = 0; } } else if ((_rnd->getRandomNumber(94) == 15) && (flags[13] == 0)) flags[12] = 1; - frame_candles++; - if (frame_candles == 3) - frame_candles = 0; - frame_piano++; - if (frame_piano == 9) - frame_piano = 0; + actorFrames[kFrameCandles]++; + if (actorFrames[kFrameCandles] == 3) + actorFrames[kFrameCandles] = 0; + actorFrames[kFramePianist]++; + if (actorFrames[kFramePianist] == 9) + actorFrames[kFramePianist] = 0; blinking = _rnd->getRandomNumber(10); savedTime = getTime(); } } void DrasculaEngine::update_62() { - int drunkX[] = { 1, 42, 83, 124, 165, 206, 247, 1 }; - copyRect(1, 1, 0, 0, 62, 142, drawSurface2, screenSurface); if (curY + curHeight < 89) { copyRect(205, 1, 180, 9, 82, 80, drawSurface3, screenSurface); - copyBackground(drunkX[frame_drunk], 82, 170, 50, 40, 53, drawSurface3, screenSurface); + copyBackground(_drunkX[actorFrames[kFrameDrunk]], 82, 170, 50, 40, 53, drawSurface3, screenSurface); } } -void DrasculaEngine::update_63() { - copyRect(1, 154, 83, 122, 131, 44, drawSurface3, screenSurface); -} - void DrasculaEngine::update_102() { int pendulum_x[] = {40, 96, 152, 208, 264, 40, 96, 152, 208, 208, 152, 264, 40, 96, 152, 208, 264}; int difference; + byte *pendulumSurface = drawSurface3; - if (frame_pen <= 4) + if (actorFrames[kFramePendulum] <= 4) pendulumSurface = drawSurface3; - else if (frame_pen <= 11) + else if (actorFrames[kFramePendulum] <= 11) pendulumSurface = extraSurface; else pendulumSurface = frontSurface; - copyBackground(pendulum_x[frame_pen], 19, 152, 0, 55, 125, pendulumSurface, screenSurface); + copyBackground(pendulum_x[actorFrames[kFramePendulum]], 19, 152, 0, 55, 125, pendulumSurface, screenSurface); if (flags[1] == 2) copyRect(18, 145, 145, 105, 25, 29, drawSurface3, screenSurface); @@ -1618,9 +1455,9 @@ void DrasculaEngine::update_102() { difference = getTime() - savedTime; if (difference > 8) { - frame_pen++; - if (frame_pen == 17) - frame_pen = 0; + actorFrames[kFramePendulum]++; + if (actorFrames[kFramePendulum] == 17) + actorFrames[kFramePendulum] = 0; savedTime = getTime(); } } @@ -1659,9 +1496,7 @@ bool DrasculaEngine::checkAction(int fl) { chooseObject(21); removeObject(18); removeObject(19); - } else if ((pickedObject == 14 && fl == 19) || (pickedObject == 19 && fl == 14)) - talk(484); - else if (pickedObject == kVerbLook && fl == 9) { + } else if (pickedObject == kVerbLook && fl == 9) { talk(482); talk(483); } else if (pickedObject == kVerbLook && fl == 19) { @@ -1689,15 +1524,11 @@ bool DrasculaEngine::checkAction(int fl) { // Note: the original check was strcmp(num_room, "18.alg") if (pickedObject == 11 && fl == 50 && flags[22] == 0 && roomNumber != 18) talk(315); - else if (pickedObject == 13 && fl == 50) - talk(156); - else if (pickedObject == 20 && fl == 50) - talk(163); else hasAnswer = 0; } else if (currentChapter == 3) { if (roomNumber == 13) { - if (room_13(fl)) + if (room(13, fl)) return true; } else hasAnswer = 0; @@ -1706,22 +1537,16 @@ bool DrasculaEngine::checkAction(int fl) { talk(178); else if (pickedObject == 8 && fl == 50 && flags[18] == 0) talk(481); - else if (pickedObject == 9 && fl == 50) - talk(484); else if (pickedObject == 12 && fl == 50 && flags[18] == 0) talk(487); - else if (pickedObject == 20 && fl == 50) - talk(487); else if (roomNumber == 21) { - if (room_21(fl)) + if (room(21, fl)) return true; } else hasAnswer = 0; } else if (currentChapter == 5) { - if (pickedObject == 20 && fl == 50) - talk(487); - else if (roomNumber == 56) { - if (room_56(fl)) + if (roomNumber == 56) { + if (room(56, fl)) return true; } else hasAnswer = 0; @@ -1731,9 +1556,9 @@ bool DrasculaEngine::checkAction(int fl) { else if (pickedObject == kVerbLook && fl == 50 && flags[0] == 0) talk(310); else if (roomNumber == 102) - room_102(fl); + room(102, fl); else if (roomNumber == 60) { - if (room_60(fl)) + if (room(60, fl)) return true; } else @@ -1744,24 +1569,510 @@ bool DrasculaEngine::checkAction(int fl) { if (hasAnswer == 0) { hasAnswer = 1; - if (!roomParse(roomNumber, fl)) { - // Call room-specific parser - char rm[20]; - sprintf(rm, "room_%d", roomNumber); - for (uint i = 0; i < _roomParsers.size(); i++) { - if (!strcmp(rm, _roomParsers[i]->desc)) { - debug(4, "Calling room parser %d", roomNumber); - (this->*(_roomParsers[i]->proc))(fl); - break; - } + room(roomNumber, fl); + } + + if (hasAnswer == 0 && (hasName == 1 || menuScreen == 1)) + room(0, -1); + + return false; +} + +bool DrasculaEngine::room(int rN, int fl) { + if (!roomParse(rN, fl)) { + // Call room-specific parser + char rm[20]; + sprintf(rm, "room_%d", rN); + for (uint i = 0; i < _roomParsers.size(); i++) { + if (!strcmp(rm, _roomParsers[i]->desc)) { + debug(4, "Calling room parser %d", rN); + + return (this->*(_roomParsers[i]->proc))(fl); } } + + // We did not find any parser, let default one work + hasAnswer = 0; } - if (hasAnswer == 0 && (hasName == 1 || menuScreen == 1)) - room_0(); + return false; +} + +void DrasculaEngine::enterRoom(int roomIndex) { + debug(2, "Entering room %d", roomIndex); + + char fileName[20]; + sprintf(fileName, "%d.ald", roomIndex); + int soc, l, martin = 0, objIsExit = 0; + float chiquez = 0, pequegnez = 0; + char pant1[20], pant2[20], pant3[20], pant4[20]; + char buffer[256]; + int palLevel = 0; + + hasName = 0; + + strcpy(currentData, fileName); + + _arj.open(fileName); + if (!_arj.isOpen()) { + error("missing data file %s", fileName); + } + int size = _arj.size(); + + getIntFromLine(buffer, size, &roomNumber); + getIntFromLine(buffer, size, &roomMusic); + getStringFromLine(buffer, size, roomDisk); + getIntFromLine(buffer, size, &palLevel); + + if (currentChapter == 2) + getIntFromLine(buffer, size, &martin); + + if (currentChapter == 2 && martin != 0) { + curWidth = martin; + getIntFromLine(buffer, size, &curHeight); + getIntFromLine(buffer, size, &feetHeight); + getIntFromLine(buffer, size, &stepX); + getIntFromLine(buffer, size, &stepY); + + getStringFromLine(buffer, size, pant1); + getStringFromLine(buffer, size, pant2); + getStringFromLine(buffer, size, pant3); + getStringFromLine(buffer, size, pant4); + + strcpy(menuBackground, pant4); + } + + getIntFromLine(buffer, size, &numRoomObjs); + + for (l = 0; l < numRoomObjs; l++) { + getIntFromLine(buffer, size, &objectNum[l]); + getStringFromLine(buffer, size, objName[l]); + getIntFromLine(buffer, size, &x1[l]); + getIntFromLine(buffer, size, &y1[l]); + getIntFromLine(buffer, size, &x2[l]); + getIntFromLine(buffer, size, &y2[l]); + getIntFromLine(buffer, size, &roomObjX[l]); + getIntFromLine(buffer, size, &roomObjY[l]); + getIntFromLine(buffer, size, &trackObj[l]); + getIntFromLine(buffer, size, &visible[l]); + getIntFromLine(buffer, size, &isDoor[l]); + if (isDoor[l] != 0) { + getStringFromLine(buffer, size, _targetSurface[l]); + getIntFromLine(buffer, size, &_destX[l]); + getIntFromLine(buffer, size, &_destY[l]); + getIntFromLine(buffer, size, &trackCharacter_alkeva[l]); + getIntFromLine(buffer, size, &alapuertakeva[l]); + updateDoor(l); + } + } + + getIntFromLine(buffer, size, &floorX1); + getIntFromLine(buffer, size, &floorY1); + getIntFromLine(buffer, size, &floorX2); + getIntFromLine(buffer, size, &floorY2); + + if (currentChapter != 2) { + getIntFromLine(buffer, size, &far); + getIntFromLine(buffer, size, &near); + } + _arj.close(); + + if (currentChapter == 2 && martin != 0) { + loadPic(pant2, extraSurface); + loadPic(pant1, frontSurface); + loadPic(pant4, backSurface); + } + + if (currentChapter == 2) { + if (martin == 0) { + stepX = STEP_X; + stepY = STEP_Y; + curHeight = CHARACTER_HEIGHT; + curWidth = CHARACTER_WIDTH; + feetHeight = FEET_HEIGHT; + loadPic(97, extraSurface); + loadPic(96, frontSurface); + loadPic(99, backSurface); + + strcpy(menuBackground, "99.alg"); + } + } + + for (l = 0; l < numRoomObjs; l++) { + if (objectNum[l] == objExit) + objIsExit = l; + } + + if (currentChapter == 2) { + if (curX == -1) { + curX = _destX[objIsExit]; + curY = _destY[objIsExit] - curHeight; + } + characterMoved = 0; + } + + loadPic(roomDisk, drawSurface3); + loadPic(roomNumber, bgSurface, HALF_PAL); + + copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3); + + setDefaultPalette(); + if (palLevel != 0) + setPaletteBase(palLevel); + assignBrightPalette(); + setDefaultPalette(); + setPaletteBase(palLevel + 2); + assignDarkPalette(); + + setBrightPalette(); + changeColor = -1; + + if (currentChapter == 2) + color_abc(kColorLightGreen); + + if (currentChapter != 2) { + for (l = 0; l <= floorY1; l++) + factor_red[l] = far; + for (l = floorY1; l <= 201; l++) + factor_red[l] = near; + + chiquez = (float)(near - far) / (float)(floorY2 - floorY1); + for (l = floorY1; l <= floorY2; l++) { + factor_red[l] = (int)(far + pequegnez); + pequegnez = pequegnez + chiquez; + } + } + + if (roomNumber == 24) { + for (l = floorY1 - 1; l > 74; l--) { + factor_red[l] = (int)(far - pequegnez); + pequegnez = pequegnez + chiquez; + } + } + + if (currentChapter == 5 && roomNumber == 54) { + for (l = floorY1 - 1; l > 84; l--) { + factor_red[l] = (int)(far - pequegnez); + pequegnez = pequegnez + chiquez; + } + } + + if (currentChapter != 2) { + if (curX == -1) { + curX = _destX[objIsExit]; + curY = _destY[objIsExit]; + curHeight = (CHARACTER_HEIGHT * factor_red[curY]) / 100; + curWidth = (CHARACTER_WIDTH * factor_red[curY]) / 100; + curY = curY - curHeight; + } else { + curHeight = (CHARACTER_HEIGHT * factor_red[curY]) / 100; + curWidth = (CHARACTER_WIDTH * factor_red[curY]) / 100; + } + characterMoved = 0; + } + + if (currentChapter == 2) { + soc = 0; + for (l = 0; l < 6; l++) { + soc += curWidth; + _frameX[l] = soc; + } + } + + if (currentChapter == 5) + hare_se_ve = 1; + + updateVisible(); + + if (currentChapter == 1) + isDoor[7] = 0; + + if (currentChapter == 2) { + if (roomNumber == 14 && flags[39] == 1) + roomMusic = 16; + else if (roomNumber == 15 && flags[39] == 1) + roomMusic = 16; + if (roomNumber == 14 && flags[5] == 1) + roomMusic = 0; + else if (roomNumber == 15 && flags[5] == 1) + roomMusic = 0; + + if (previousMusic != roomMusic && roomMusic != 0) + playMusic(roomMusic); + if (roomMusic == 0) + stopMusic(); + } else { + if (previousMusic != roomMusic && roomMusic != 0) + playMusic(roomMusic); + } + + if (currentChapter == 2) { + if (roomNumber == 9 || roomNumber == 2 || roomNumber == 14 || roomNumber == 18) + savedTime = getTime(); + } + if (currentChapter == 4) { + if (roomNumber == 26) + savedTime = getTime(); + } + + if (currentChapter == 4 && roomNumber == 24 && flags[29] == 1) + animation_7_4(); + + if (currentChapter == 5) { + if (roomNumber == 45) + hare_se_ve = 0; + if (roomNumber == 49 && flags[7] == 0) + animation_4_5(); + } + + updateRoom(); +} + +void DrasculaEngine::clearRoom() { + memset(VGA, 0, 64000); + _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); + _system->updateScreen(); +} + +bool DrasculaEngine::exitRoom(int l) { + debug(2, "Exiting room from door %d", l); + + int roomNum = 0; + + if (currentChapter == 1) { + if (objectNum[l] == 105 && flags[0] == 0) + talk(442); + else { + updateDoor(l); + if (isDoor[l] != 0) { + gotoObject(roomObjX[l], roomObjY[l]); + trackProtagonist = trackObj[l]; + updateRoom(); + updateScreen(); + characterMoved = 0; + trackProtagonist = trackCharacter_alkeva[l]; + objExit = alapuertakeva[l]; + doBreak = 1; + previousMusic = roomMusic; + + if (objectNum[l] == 105) { + animation_2_1(); + return true; + } + clearRoom(); + sscanf(_targetSurface[l], "%d", &roomNum); + curX = -1; + enterRoom(roomNum); + } + } + } else if (currentChapter == 2) { + updateDoor(l); + if (isDoor[l] != 0) { + gotoObject(roomObjX[l], roomObjY[l]); + characterMoved = 0; + trackProtagonist = trackCharacter_alkeva[l]; + objExit = alapuertakeva[l]; + doBreak = 1; + previousMusic = roomMusic; + if (objectNum[l] == 136) + animation_2_2(); + if (objectNum[l] == 124) + animation_3_2(); + if (objectNum[l] == 173) { + animation_35_2(); + return true; + } if (objectNum[l] == 146 && flags[39] == 1) { + flags[5] = 1; + flags[11] = 1; + } + if (objectNum[l] == 176 && flags[29] == 1) { + flags[29] = 0; + removeObject(kItemEarWithEarPlug); + addObject(kItemEarplugs); + } + clearRoom(); + sscanf(_targetSurface[l], "%d", &roomNum); + curX =- 1; + enterRoom(roomNum); + } + } else if (currentChapter == 3) { + updateDoor(l); + if (isDoor[l] != 0 && visible[l] == 1) { + gotoObject(roomObjX[l], roomObjY[l]); + trackProtagonist = trackObj[l]; + updateRoom(); + updateScreen(); + characterMoved = 0; + trackProtagonist = trackCharacter_alkeva[l]; + objExit = alapuertakeva[l]; + doBreak = 1; + previousMusic = roomMusic; + clearRoom(); + sscanf(_targetSurface[l], "%d", &roomNum); + curX =- 1; + enterRoom(roomNum); + } + } else if (currentChapter == 4) { + updateDoor(l); + if (isDoor[l] != 0) { + gotoObject(roomObjX[l], roomObjY[l]); + trackProtagonist = trackObj[l]; + updateRoom(); + updateScreen(); + characterMoved = 0; + trackProtagonist = trackCharacter_alkeva[l]; + objExit = alapuertakeva[l]; + doBreak = 1; + previousMusic = roomMusic; + + if (objectNum[l] == 108) + gotoObject(171, 78); + clearRoom(); + sscanf(_targetSurface[l], "%d", &roomNum); + curX = -1; + enterRoom(roomNum); + } + } else if (currentChapter == 5) { + updateDoor(l); + if (isDoor[l] != 0 && visible[l] == 1) { + gotoObject(roomObjX[l], roomObjY[l]); + trackProtagonist = trackObj[l]; + updateRoom(); + updateScreen(); + characterMoved = 0; + trackProtagonist = trackCharacter_alkeva[l]; + objExit = alapuertakeva[l]; + doBreak = 1; + previousMusic = roomMusic; + hare_se_ve = 1; + clearRoom(); + sscanf(_targetSurface[l], "%d", &roomNum); + curX = -1; + enterRoom(roomNum); + } + } else if (currentChapter == 6) { + updateDoor(l); + if (isDoor[l] != 0) { + gotoObject(roomObjX[l], roomObjY[l]); + trackProtagonist = trackObj[l]; + updateRoom(); + updateScreen(); + characterMoved = 0; + trackProtagonist = trackCharacter_alkeva[l]; + objExit = alapuertakeva[l]; + doBreak = 1; + previousMusic = roomMusic; + clearRoom(); + sscanf(_targetSurface[l], "%d", &roomNum); + curX = -1; + enterRoom(roomNum); + + if (objExit == 105) + animation_19_6(); + } + } return false; } +void DrasculaEngine::updateRoom() { + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); + updateRefresh_pre(); + if (currentChapter == 3) { + if (flags[0] == 0) + moveCharacters(); + else + copyRect(113, 54, curX - 20, curY - 1, 77, 89, drawSurface3, screenSurface); + } else { + moveCharacters(); + } + updateRefresh(); +} + +void DrasculaEngine::updateDoor(int doorNum) { + if (currentChapter == 1 || currentChapter == 3 || currentChapter == 5 || currentChapter == 6) + return; + else if (currentChapter == 2) { + if (objectNum[doorNum] == 138) + isDoor[doorNum] = flags[0]; + else if (objectNum[doorNum] == 136) + isDoor[doorNum] = flags[8]; + else if (objectNum[doorNum] == 156) + isDoor[doorNum] = flags[16]; + else if (objectNum[doorNum] == 163) + isDoor[doorNum] = flags[17]; + else if (objectNum[doorNum] == 177) + isDoor[doorNum] = flags[15]; + else if (objectNum[doorNum] == 175) + isDoor[doorNum] = flags[40]; + else if (objectNum[doorNum] == 173) + isDoor[doorNum] = flags[36]; + } else if (currentChapter == 4) { + if (objectNum[doorNum] == 101 && flags[0] == 0) + isDoor[doorNum] = 0; + else if (objectNum[doorNum] == 101 && flags[0] == 1 && flags[28] == 1) + isDoor[doorNum] = 1; + else if (objectNum[doorNum] == 103) + isDoor[doorNum] = flags[0]; + else if (objectNum[doorNum] == 104) + isDoor[doorNum] = flags[1]; + else if (objectNum[doorNum] == 105) + isDoor[doorNum] = flags[1]; + else if (objectNum[doorNum] == 106) + isDoor[doorNum] = flags[2]; + else if (objectNum[doorNum] == 107) + isDoor[doorNum] = flags[2]; + else if (objectNum[doorNum] == 110) + isDoor[doorNum] = flags[6]; + else if (objectNum[doorNum] == 114) + isDoor[doorNum] = flags[4]; + else if (objectNum[doorNum] == 115) + isDoor[doorNum] = flags[4]; + else if (objectNum[doorNum] == 116 && flags[5] == 0) + isDoor[doorNum] = 0; + else if (objectNum[doorNum] == 116 && flags[5] == 1 && flags[23] == 1) + isDoor[doorNum] = 1; + else if (objectNum[doorNum] == 117) + isDoor[doorNum] = flags[5]; + else if (objectNum[doorNum] == 120) + isDoor[doorNum] = flags[8]; + else if (objectNum[doorNum] == 122) + isDoor[doorNum] = flags[7]; + } +} + +void DrasculaEngine::openDoor(int nflag, int doorNum) { + if (flags[nflag] == 0) { + if (currentChapter == 1 /*|| currentChapter == 4*/) { + if (nflag != 7) { + playSound(3); + flags[nflag] = 1; + } + } else { + playSound(3); + flags[nflag] = 1; + } + + if (doorNum != NO_DOOR) + updateDoor(doorNum); + updateRoom(); + updateScreen(); + finishSound(); + withoutVerb(); + } +} + +void DrasculaEngine::closeDoor(int nflag, int doorNum) { + if (flags[nflag] == 1) { + playSound(4); + flags[nflag] = 0; + if (doorNum != NO_DOOR) + updateDoor(doorNum); + updateRoom(); + updateScreen(); + finishSound(); + withoutVerb(); + } +} + } // End of namespace Drascula diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp new file mode 100644 index 0000000000..de82899462 --- /dev/null +++ b/engines/drascula/saveload.cpp @@ -0,0 +1,255 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "drascula/drascula.h" + +namespace Drascula { + +bool DrasculaEngine::saveLoadScreen() { + char names[10][23]; + char file[50]; + char fileEpa[50]; + int n, n2, num_sav = 0, y = 27; + Common::InSaveFile *sav; + + clearRoom(); + + snprintf(fileEpa, 50, "%s.epa", _targetName.c_str()); + if (!(sav = _saveFileMan->openForLoading(fileEpa))) { + Common::OutSaveFile *epa; + if (!(epa = _saveFileMan->openForSaving(fileEpa))) + error("Can't open %s file", fileEpa); + for (n = 0; n < NUM_SAVES; n++) + epa->writeString("*\n"); + epa->finalize(); + delete epa; + if (!(sav = _saveFileMan->openForLoading(fileEpa))) { + error("Can't open %s file", fileEpa); + } + } + for (n = 0; n < NUM_SAVES; n++) + sav->readLine(names[n], 23); + delete sav; + + loadPic("savescr.alg", bgSurface, HALF_PAL); + + color_abc(kColorLightGreen); + + select[0] = 0; + + for (;;) { + y = 27; + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); + for (n = 0; n < NUM_SAVES; n++) { + print_abc(names[n], 116, y); + y = y + 9; + } + print_abc(select, 117, 15); + setCursorTable(); + updateScreen(); + y = 27; + + updateEvents(); + + if (leftMouseButton == 1) { + delay(50); + for (n = 0; n < NUM_SAVES; n++) { + if (mouseX > 115 && mouseY > y + (9 * n) && mouseX < 115 + 175 && mouseY < y + 10 + (9 * n)) { + strcpy(select, names[n]); + + if (strcmp(select, "*")) + selectionMade = 1; + else { + enterName(); + strcpy(names[n], select); + if (selectionMade == 1) { + snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); + saveGame(file); + Common::OutSaveFile *tsav; + if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { + error("Can't open %s file", fileEpa); + } + for (n = 0; n < NUM_SAVES; n++) { + tsav->writeString(names[n]); + tsav->writeString("\n"); + } + tsav->finalize(); + delete tsav; + } + } + + print_abc(select, 117, 15); + y = 27; + for (n2 = 0; n2 < NUM_SAVES; n2++) { + print_abc(names[n2], 116, y); + y = y + 9; + } + if (selectionMade == 1) { + snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); + } + num_sav = n; + } + } + + if (mouseX > 117 && mouseY > 15 && mouseX < 295 && mouseY < 24 && selectionMade == 1) { + enterName(); + strcpy(names[num_sav], select); + print_abc(select, 117, 15); + y = 27; + for (n2 = 0; n2 < NUM_SAVES; n2++) { + print_abc(names[n2], 116, y); + y = y + 9; + } + + if (selectionMade == 1) { + snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); + saveGame(file); + Common::OutSaveFile *tsav; + if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { + error("Can't open %s file", fileEpa); + } + for (n = 0; n < NUM_SAVES; n++) { + tsav->writeString(names[n]); + tsav->writeString("\n"); + } + tsav->finalize(); + delete tsav; + } + } + + if (mouseX > 125 && mouseY > 123 && mouseX < 199 && mouseY < 149 && selectionMade == 1) { + if (!loadGame(file)) + return false; + break; + } else if (mouseX > 208 && mouseY > 123 && mouseX < 282 && mouseY < 149 && selectionMade == 1) { + saveGame(file); + Common::OutSaveFile *tsav; + if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { + error("Can't open %s file", fileEpa); + } + for (n = 0; n < NUM_SAVES; n++) { + tsav->writeString(names[n]); + tsav->writeString("\n"); + } + tsav->finalize(); + delete tsav; + } else if (mouseX > 168 && mouseY > 154 && mouseX < 242 && mouseY < 180) + break; + else if (selectionMade == 0) { + print_abc("Please select a slot", 117, 15); + } + updateScreen(); + delay(200); + } + y = 26; + + delay(5); + } + + clearRoom(); + loadPic(roomNumber, bgSurface, HALF_PAL); + selectionMade = 0; + + return true; +} + +bool DrasculaEngine::loadGame(const char *gameName) { + int l, savedChapter, roomNum = 0; + Common::InSaveFile *sav; + + previousMusic = roomMusic; + menuScreen = 0; + if (currentChapter != 1) + clearRoom(); + + if (!(sav = _saveFileMan->openForLoading(gameName))) { + error("missing savegame file"); + } + + savedChapter = sav->readSint32LE(); + if (savedChapter != currentChapter) { + strcpy(saveName, gameName); + currentChapter = savedChapter - 1; + hay_que_load = 1; + return false; + } + sav->read(currentData, 20); + curX = sav->readSint32LE(); + curY = sav->readSint32LE(); + trackProtagonist = sav->readSint32LE(); + + for (l = 1; l < 43; l++) { + inventoryObjects[l] = sav->readSint32LE(); + } + + for (l = 0; l < NUM_FLAGS; l++) { + flags[l] = sav->readSint32LE(); + } + + takeObject = sav->readSint32LE(); + pickedObject = sav->readSint32LE(); + hay_que_load = 0; + sscanf(currentData, "%d.ald", &roomNum); + enterRoom(roomNum); + withoutVerb(); + + return true; +} + +void DrasculaEngine::saveGame(char gameName[]) { + Common::OutSaveFile *out; + int l; + + if (!(out = _saveFileMan->openForSaving(gameName))) { + error("Unable to open the file"); + } + out->writeSint32LE(currentChapter); + out->write(currentData, 20); + out->writeSint32LE(curX); + out->writeSint32LE(curY); + out->writeSint32LE(trackProtagonist); + + for (l = 1; l < 43; l++) { + out->writeSint32LE(inventoryObjects[l]); + } + + for (l = 0; l < NUM_FLAGS; l++) { + out->writeSint32LE(flags[l]); + } + + out->writeSint32LE(takeObject); + out->writeSint32LE(pickedObject); + + out->finalize(); + if (out->ioFailed()) + warning("Can't write file '%s'. (Disk full?)", gameName); + + delete out; + + playSound(99); + finishSound(); +} + +} // End of namespace Drascula diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp new file mode 100644 index 0000000000..840d6c7cb5 --- /dev/null +++ b/engines/drascula/sound.cpp @@ -0,0 +1,159 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "drascula/drascula.h" + +namespace Drascula { + +void DrasculaEngine::updateVolume(Audio::Mixer::SoundType soundType, int prevVolume) { + int vol = _mixer->getVolumeForSoundType(soundType) / 16; + if (mouseY < prevVolume && vol < 15) + vol++; + if (mouseY > prevVolume && vol > 0) + vol--; + _mixer->setVolumeForSoundType(soundType, vol * 16); +} + +void DrasculaEngine::volumeControls() { + int masterVolume, voiceVolume, musicVolume; + + copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); + updateScreen(73, 63, 73, 63, 177, 97, screenSurface); + + masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4); + voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4); + musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4); + + for (;;) { + updateRoom(); + + copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface); + + copyBackground(183, 56, 82, masterVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4), tableSurface, screenSurface); + copyBackground(183, 56, 138, voiceVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4), tableSurface, screenSurface); + copyBackground(183, 56, 194, musicVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4), tableSurface, screenSurface); + + setCursorTable(); + + updateScreen(); + + updateEvents(); + + if (rightMouseButton == 1) { + delay(100); + break; + } + if (leftMouseButton == 1) { + delay(100); + if (mouseX > 80 && mouseX < 121) { + updateVolume(Audio::Mixer::kPlainSoundType, mouseY); + masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4); + } + + if (mouseX > 136 && mouseX < 178) { + updateVolume(Audio::Mixer::kSFXSoundType, mouseY); + voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4); + } + + if (mouseX > 192 && mouseX < 233) { + updateVolume(Audio::Mixer::kMusicSoundType, mouseY); + musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4); + } + } + + } + + updateEvents(); +} + +void DrasculaEngine::playSound(int soundNum) { + char file[20]; + sprintf(file, "s%i.als", soundNum); + + playFile(file); +} + +void DrasculaEngine::finishSound() { + delay(1); + + while (soundIsActive()) + _system->delayMillis(10); +} + +void DrasculaEngine::playMusic(int p) { + AudioCD.stop(); + AudioCD.play(p - 1, 1, 0, 0); +} + +void DrasculaEngine::stopMusic() { + AudioCD.stop(); +} + +int DrasculaEngine::musicStatus() { + return AudioCD.isPlaying(); +} + +void DrasculaEngine::stopSound() { + _mixer->stopHandle(_soundHandle); +} + +void DrasculaEngine::MusicFadeout() { + int org_vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType); + for (;;) { + int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType); + vol -= 10; + if (vol < 0) + vol = 0; + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); + if (vol == 0) + break; + updateEvents(); + _system->updateScreen(); + _system->delayMillis(50); + } + AudioCD.stop(); + _system->delayMillis(100); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, org_vol); +} + +void DrasculaEngine::playFile(const char *fname) { + if (_arj.open(fname)) { + int soundSize = _arj.size(); + byte *soundData = (byte *)malloc(soundSize); + _arj.seek(32); + _arj.read(soundData, soundSize); + _arj.close(); + + _mixer->playRaw(Audio::Mixer::kSFXSoundType, &_soundHandle, soundData, soundSize - 64, + 11025, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED); + } else + warning("playFile: Could not open %s", fname); +} + +bool DrasculaEngine::soundIsActive() { + return _mixer->isSoundHandleActive(_soundHandle); +} + +} // End of namespace Drascula diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index 108434fe9a..4d3187a0fd 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -68,55 +68,49 @@ void DrasculaEngine::talk_igor(int index, int talkerType) { talkInit(filename); do { - if (talkerType == 0 || talkerType == 1) { + if (talkerType == kIgorDch || talkerType == kIgorFront) { face = _rnd->getRandomNumber(7); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); - } else if (talkerType == 3 || talkerType == 4) { + } else if (talkerType == kIgorSeated || talkerType == kIgorWig) { face = _rnd->getRandomNumber(3); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); } - if (talkerType == 0) { + if (talkerType == kIgorDch) { placeIgor(); placeDrascula(); - copyBackground(igorX + 17, igorY, igorX + 17, igorY, 37, 24, drawSurface1, screenSurface); + copyBackground(igorX + 17, igorY, igorX + 17, igorY, 37, 24, bgSurface, screenSurface); copyRect(x_talk0[face], 148, igorX + 17, igorY, 25, 24, frontSurface, screenSurface); updateRefresh(); if (withVoices == 0) centerText(said, igorX + 26, igorY); updateScreen(); pause(3); - } else if (talkerType == 1) { + } else if (talkerType == kIgorFront) { if (currentChapter == 1 || currentChapter == 4) placeIgor(); if (currentChapter == 1) placeDrascula(); if (currentChapter == 1 || currentChapter == 6) - copyBackground(igorX, igorY, igorX, igorY, 29, 25, drawSurface1, screenSurface); + copyBackground(igorX, igorY, igorX, igorY, 29, 25, bgSurface, screenSurface); copyRect(x_talk1[face], 173, igorX, igorY, 29, 25, frontSurface, screenSurface); updateRefresh(); if (withVoices == 0) centerText(said, igorX + 26, igorY); updateScreen(); pause(3); - } else if (talkerType == 2) { + } else if (talkerType == kIgorDoor) { updateRoom(); if (withVoices == 0) centerText(said, 87, 66); updateScreen(); - } else if (talkerType == 3) { - copyBackground(x_talk3[face], 109, 207, 92, 21, 23, drawSurface3, screenSurface); - moveCharacters(); - updateRefresh(); - if (withVoices == 0) - centerText(said, 221, 102); - - updateScreen(); - pause(3); - } else if (talkerType == 4) { - copyBackground(x_talk4[face], 78, 199, 94, 38, 27, drawSurface3, screenSurface); + } else if (talkerType == kIgorSeated || talkerType == kIgorWig) { + if (talkerType == kIgorSeated) + copyBackground(x_talk3[face], 109, 207, 92, 21, 23, drawSurface3, screenSurface); + else + copyBackground(x_talk4[face], 78, 199, 94, 38, 27, drawSurface3, screenSurface); moveCharacters(); updateRefresh(); if (withVoices == 0) @@ -127,13 +121,13 @@ void DrasculaEngine::talk_igor(int index, int talkerType) { } } while (!isTalkFinished(&length)); - if ((talkerType == 1 && currentChapter == 6) || - talkerType == 2 || talkerType == 3 || talkerType == 4) { + if ((talkerType == kIgorFront && currentChapter == 6) || + talkerType == kIgorDoor || talkerType == kIgorSeated || talkerType == kIgorWig) { updateRoom(); } - if (talkerType == 0 || (talkerType == 1 && currentChapter == 1)) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + if (talkerType == kIgorDch || (talkerType == kIgorFront && currentChapter == 1)) { + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); placeIgor(); placeDrascula(); } @@ -158,7 +152,7 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) { do { face = _rnd->getRandomNumber(7); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); @@ -167,16 +161,16 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) { if (currentChapter == 6) moveCharacters(); - copyBackground(x_dr, y_dr, x_dr, y_dr, 38 + offset, 31, drawSurface1, screenSurface); + copyBackground(drasculaX, drasculaY, drasculaX, drasculaY, 38 + offset, 31, bgSurface, screenSurface); if (currentChapter == 6) - copyRect(x_talk[face], offset2, x_dr + offset, y_dr, 38, 31, drawSurface2, screenSurface); + copyRect(x_talk[face], offset2, drasculaX + offset, drasculaY, 38, 31, drawSurface2, screenSurface); else - copyRect(x_talk[face], offset2, x_dr + offset, y_dr, 38, 31, backSurface, screenSurface); + copyRect(x_talk[face], offset2, drasculaX + offset, drasculaY, 38, 31, backSurface, screenSurface); updateRefresh(); if (withVoices == 0) - centerText(said, x_dr + 19, y_dr); + centerText(said, drasculaX + 19, drasculaY); updateScreen(); @@ -185,7 +179,7 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) { } while (!isTalkFinished(&length)); if (talkerType == 0) - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); if (talkerType == 1 && currentChapter == 6) updateRoom(); @@ -210,7 +204,7 @@ void DrasculaEngine::talk_solo(const char *said, const char *filename) { talkInit(filename); if (currentChapter == 6) - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); do { if (withVoices == 0) { @@ -225,7 +219,7 @@ void DrasculaEngine::talk_solo(const char *said, const char *filename) { } while (!isTalkFinished(&length)); if (currentChapter == 6) { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateScreen(); } } @@ -266,7 +260,7 @@ void DrasculaEngine::talk_bartender(int index, int talkerType) { face = _rnd->getRandomNumber(5); } - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); @@ -305,20 +299,20 @@ void DrasculaEngine::talk_bj(int index) { if (currentChapter != 5) { face = _rnd->getRandomNumber(4); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); - copyBackground(x_bj + 2, y_bj - 1, x_bj + 2, y_bj - 1, 27, 40, - drawSurface1, screenSurface); + copyBackground(bjX + 2, bjY - 1, bjX + 2, bjY - 1, 27, 40, + bgSurface, screenSurface); - copyRect(x_talk[face], 99, x_bj + 2, y_bj - 1, 27, 40, + copyRect(x_talk[face], 99, bjX + 2, bjY - 1, 27, 40, drawSurface3, screenSurface); moveCharacters(); updateRefresh(); if (withVoices == 0) - centerText(said, x_bj + 7, y_bj); + centerText(said, bjX + 7, bjY); updateScreen(); @@ -381,7 +375,7 @@ void DrasculaEngine::talk(const char *said, const char *filename) { do { face = _rnd->getRandomNumber(5); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); if (currentChapter == 2) @@ -464,35 +458,10 @@ void DrasculaEngine::talk_pianist(int index) { sprintf(filename, "P%i.als", index); const char* said = _textp[_lang][index]; int x_talk[4] = { 97, 145, 193, 241 }; - int face; - int length = strlen(said); + int coords[7] = { 139, 228, 112, 47, 60, 221, 128 }; color_abc(kColorWhite); - - talkInit(filename); - - do { - face = _rnd->getRandomNumber(3); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); - - copyBackground(x_talk[face], 139, 228, 112, 47, 60, - extraSurface, screenSurface); - moveCharacters(); - updateRefresh(); - - if (withVoices == 0) - centerText(said, 221, 128); - - updateScreen(); - - pause(3); - } while (!isTalkFinished(&length)); - - updateRoom(); - updateScreen(); + talk_generic(said, filename, x_talk, 4, coords, extraSurface); } void DrasculaEngine::talk_drunk(int index) { @@ -500,8 +469,7 @@ void DrasculaEngine::talk_drunk(int index) { sprintf(filename, "B%i.als", index); const char *said = _textb[_lang][index]; int x_talk[8] = { 1, 21, 41, 61, 81, 101, 121, 141 }; - int face; - int length = strlen(said); + int coords[7] = { 29, 177, 50, 19, 19, 181, 54 }; if (currentChapter == 1) loadPic("an11y13.alg", frontSurface); @@ -515,29 +483,7 @@ void DrasculaEngine::talk_drunk(int index) { color_abc(kColorDarkGreen); - talkInit(filename); - - do { - face = _rnd->getRandomNumber(7); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); - - copyBackground(x_talk[face], 29, 177, 50, 19, 19, frontSurface, screenSurface); - moveCharacters(); - updateRefresh(); - - if (withVoices == 0) - centerText(said, 181, 54); - - updateScreen(); - - pause(3); - } while (!isTalkFinished(&length)); - - updateRoom(); - updateScreen(); + talk_generic(said, filename, x_talk, 8, coords, frontSurface); flags[13] = 0; if (currentChapter == 1) @@ -552,7 +498,7 @@ void DrasculaEngine::talk_drunk(int index) { } } -void DrasculaEngine::talk_vb(int index) { +void DrasculaEngine::talk_vonBraun(int index) { char filename[20]; sprintf(filename, "VB%i.als", index); const char *said = _textvb[_lang][index]; @@ -564,23 +510,23 @@ void DrasculaEngine::talk_vb(int index) { talkInit(filename); - copyBackground(vbX + 5, 64, OBJWIDTH + 1, 0, 25, 27, drawSurface1, drawSurface3); + copyBackground(vonBraunX + 5, 64, OBJWIDTH + 1, 0, 25, 27, bgSurface, drawSurface3); do { - if (trackVB == 1) { + if (trackVonBraun == 1) { face = _rnd->getRandomNumber(5); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); moveCharacters(); - moveVB(); + moveVonBraun(); - copyBackground(OBJWIDTH + 1, 0, vbX + 5, 64, 25, 27, drawSurface3, screenSurface); - copyRect(x_talk[face], 34, vbX + 5, 64, 25, 27, frontSurface, screenSurface); + copyBackground(OBJWIDTH + 1, 0, vonBraunX + 5, 64, 25, 27, drawSurface3, screenSurface); + copyRect(x_talk[face], 34, vonBraunX + 5, 64, 25, 27, frontSurface, screenSurface); updateRefresh(); } if (withVoices == 0) - centerText(said, vbX, 66); + centerText(said, vonBraunX, 66); updateScreen(); @@ -593,7 +539,7 @@ void DrasculaEngine::talk_vb(int index) { playMusic(roomMusic); } -void DrasculaEngine::talk_vbpuerta(int index) { +void DrasculaEngine::talk_vonBraunpuerta(int index) { char filename[20]; sprintf(filename, "VB%i.als", index); const char *said = _textvb[_lang][index]; @@ -629,24 +575,18 @@ void DrasculaEngine::talk_blind(int index) { byte *faceBuffer; int p = 0; - int pos_blind[6]; + int pos_blind[6] = { 0, 2, 73, 1, 126, 149 }; int length = strlen(said); color_abc(kColorBrown); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateScreen(); talkInit(filename); - pos_blind[1] = 2; - pos_blind[2] = 73; - pos_blind[3] = 1; - pos_blind[4] = 126; - pos_blind[5] = 149; - do { - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); pos_blind[5] = 149; char c = toupper(syncChar[p]); @@ -677,10 +617,13 @@ void DrasculaEngine::talk_blind(int index) { } while (!isTalkFinished(&length)); } -void DrasculaEngine::talk_hacker(const char *said, const char *filename) { +void DrasculaEngine::talk_hacker(int index) { + char filename[20]; + sprintf(filename, "d%i.als", index); + const char *said = _textd[_lang][index]; int length = strlen(said); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateScreen(); color_abc(kColorYellow); @@ -694,39 +637,15 @@ void DrasculaEngine::talk_hacker(const char *said, const char *filename) { } while (!isTalkFinished(&length)); } -void DrasculaEngine::talk_wolf(int index) { +void DrasculaEngine::talk_werewolf(int index) { char filename[20]; sprintf(filename, "L%i.als", index); const char *said = _textl[_lang][index]; int x_talk[9] = {52, 79, 106, 133, 160, 187, 214, 241, 268}; - int face; - int length = strlen(said); + int coords[7] = { 136, 198, 81, 26, 24, 203, 78 }; color_abc(kColorRed); - - talkInit(filename); - - do { - face = _rnd->getRandomNumber(8); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); - - copyBackground(x_talk[face], 136, 198, 81, 26, 24, drawSurface3, screenSurface); - moveCharacters(); - updateRefresh(); - - if (withVoices == 0) - centerText(said, 203, 78); - - updateScreen(); - - pause(3); - } while (!isTalkFinished(&length)); - - updateRoom(); - updateScreen(); + talk_generic(said, filename, x_talk, 9, coords, drawSurface3); } void DrasculaEngine::talk_mus(int index) { @@ -734,35 +653,10 @@ void DrasculaEngine::talk_mus(int index) { sprintf(filename, "E%i.als", index); const char *said = _texte[_lang][index]; int x_talk[8] = { 16, 35, 54, 73, 92, 111, 130, 149}; - int face; - int length = strlen(said); + int coords[7] = { 156, 190, 64, 18, 24, 197, 64 }; color_abc(kColorWhite); - - talkInit(filename); - - do { - face = _rnd->getRandomNumber(7); - - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); - - updateRefresh_pre(); - - copyBackground(x_talk[face], 156, 190, 64, 18, 24, drawSurface3, screenSurface); - moveCharacters(); - updateRefresh(); - - if (withVoices == 0) - centerText(said, 197, 64); - - updateScreen(); - - pause(3); - - } while (!isTalkFinished(&length)); - - updateRoom(); - updateScreen(); + talk_generic(said, filename, x_talk, 8, coords, drawSurface3); } void DrasculaEngine::talk_pen(const char *said, const char *filename, int talkerType) { @@ -789,7 +683,7 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker else face = _rnd->getRandomNumber(4); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); if (talkerType == 0) @@ -812,7 +706,7 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker } while (!isTalkFinished(&length)); flags[1] = 0; - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); updateScreen(); } @@ -832,11 +726,11 @@ void DrasculaEngine::talk_bj_bed(int index) { do { face = _rnd->getRandomNumber(4); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); - copyBackground(65, 103, 65, 103, 49, 38, drawSurface1, screenSurface); + copyBackground(65, 103, 65, 103, 49, 38, bgSurface, screenSurface); copyRect(x_talk[face], 105, 65, 103, 49, 38, drawSurface3, screenSurface); moveCharacters(); updateRefresh(); @@ -877,7 +771,7 @@ void DrasculaEngine::talk_htel(int index) { else faceBuffer = (char *)backSurface; - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); copyBackground(x_talk[face], 1, 45, 24, 92, 108, (byte *)faceBuffer, screenSurface); @@ -888,7 +782,7 @@ void DrasculaEngine::talk_htel(int index) { pause(3); } while (!isTalkFinished(&length)); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateScreen(); } @@ -914,7 +808,7 @@ void DrasculaEngine::talk_sync(const char *said, const char *filename, const cha strncpy(buf, &syncChar[p], 1); face = atoi(buf); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); updateRefresh_pre(); if (currentChapter == 2) @@ -1024,7 +918,7 @@ void DrasculaEngine::talk_dr_grande(int index) { do { face = _rnd->getRandomNumber(3); - copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface); + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); copyBackground(interf_x[l] + 24, interf_y[l], 0, 45, 39, 31, drawSurface2, screenSurface); copyBackground(x_talk[face], 1, 171, 68, 45, 48, drawSurface2, screenSurface); l++; @@ -1044,4 +938,31 @@ void DrasculaEngine::talk_dr_grande(int index) { } while (!isTalkFinished(&length)); } +void DrasculaEngine::talk_generic(const char* said, const char* filename, int* faces, int faceCount, int* coords, byte* surface) { + int face; + int length = strlen(said); + talkInit(filename); + + do { + face = _rnd->getRandomNumber(faceCount - 1); + + copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface); + updateRefresh_pre(); + copyBackground(faces[face], coords[0], coords[1], coords[2], + coords[3], coords[4], surface, screenSurface); + moveCharacters(); + updateRefresh(); + + if (withVoices == 0) + centerText(said, coords[5], coords[6]); + + updateScreen(); + + pause(3); + } while (!isTalkFinished(&length)); + + updateRoom(); + updateScreen(); +} + } // End of namespace Drascula diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 01702f08b3..afd7eacfda 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -156,7 +156,6 @@ bool Resource::loadPakFile(const Common::String &filename) { const ResArchiveLoader *loader = getLoader(iter->_value.type); if (!loader) { - assert(loader); error("no archive loader for file '%s' found which is of type %d", filename.c_str(), iter->_value.type); return false; } diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 302b92ab07..abdf115c1e 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -1200,31 +1200,31 @@ void KyraEngine_HoF::initStaticResource() { _ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize); _sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize); _ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize); - _ingameSoundIndex = (const uint16*) _staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize); + _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize); _musicFileListIntro = _staticres->loadStrings(k2SeqplayIntroTracks, _musicFileListIntroSize); _musicFileListIngame = _staticres->loadStrings(k2IngameTracks, _musicFileListIngameSize); _musicFileListFinale = _staticres->loadStrings(k2SeqplayFinaleTracks, _musicFileListFinaleSize); _cdaTrackTableIntro = _staticres->loadRawData(k2SeqplayIntroCDA, _cdaTrackTableIntroSize); _cdaTrackTableIngame = _staticres->loadRawData(k2IngameCDA, _cdaTrackTableIngameSize); _cdaTrackTableFinale = _staticres->loadRawData(k2SeqplayFinaleCDA, _cdaTrackTableFinaleSize); - _ingameTalkObjIndex = (const uint16*) _staticres->loadRawData(k2IngameTalkObjIndex, _ingameTalkObjIndexSize); + _ingameTalkObjIndex = (const uint16 *)_staticres->loadRawData(k2IngameTalkObjIndex, _ingameTalkObjIndexSize); _ingameTimJpStr = _staticres->loadStrings(k2IngameTimJpStrings, _ingameTimJpStrSize); _itemAnimData = _staticres->loadShapeAnimData_v2(k2IngameShapeAnimData, _itemAnimDataSize); // replace sequence talkie files with localized versions - const char* const* seqSoundList = _staticres->loadStrings(k2SeqplaySfxFiles, _sequenceSoundListSize); - const char* const* tlkfiles = _staticres->loadStrings(k2SeqplayTlkFiles, tmpSize); - char ** tmpSndLst = new char*[_sequenceSoundListSize]; + const char *const *seqSoundList = _staticres->loadStrings(k2SeqplaySfxFiles, _sequenceSoundListSize); + const char *const *tlkfiles = _staticres->loadStrings(k2SeqplayTlkFiles, tmpSize); + char **tmpSndLst = new char*[_sequenceSoundListSize]; for (int i = 0; i < _sequenceSoundListSize; i++) { - int len = strlen(seqSoundList[i]); + const int len = strlen(seqSoundList[i]); tmpSndLst[i] = new char[len + 1]; tmpSndLst[i][0] = 0; if (tlkfiles && len > 1) { for (int ii = 0; ii < tmpSize; ii++) { - if (!scumm_stricmp(&seqSoundList[i][1], &tlkfiles[ii][1])) + if (strlen(tlkfiles[ii]) > 1 && !scumm_stricmp(&seqSoundList[i][1], &tlkfiles[ii][1])) strcpy(tmpSndLst[i], tlkfiles[ii]); } } diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 6480428661..729af6c40f 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -1110,7 +1110,7 @@ void Converse::setValue(int32 offset, int32 value) { _variables[hashOffset] = value; } -const int32 Converse::getValue(int32 offset) { +int32 Converse::getValue(int32 offset) { char hashOffset[10]; sprintf(hashOffset, "%i", offset); ConvVarHashMap::const_iterator entry = _variables.find(hashOffset); diff --git a/engines/m4/converse.h b/engines/m4/converse.h index bea90d9ddf..4bd4524029 100644 --- a/engines/m4/converse.h +++ b/engines/m4/converse.h @@ -171,7 +171,7 @@ public: ConvEntry *getNode(int32 index) { return _convNodes[index]; } void setValue(int32 offset, int32 value); - const int32 getValue(int32 offset); + int32 getValue(int32 offset); bool evaluateCondition(int32 leftVal, int32 op, int32 rightVal); bool performAction(EntryAction *action); /* diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp index c9b9a44f23..119e7297cf 100644 --- a/engines/m4/font.cpp +++ b/engines/m4/font.cpp @@ -192,7 +192,7 @@ int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, while (*text) { - char theChar = (*text++) & 0x7F; + unsigned char theChar = (*text++) & 0x7F; int charWidth = _charWidths[theChar]; if (charWidth > 0) { diff --git a/engines/parallaction/font.cpp b/engines/parallaction/font.cpp index bc67acf644..91848b30a4 100644 --- a/engines/parallaction/font.cpp +++ b/engines/parallaction/font.cpp @@ -96,7 +96,7 @@ public: return (uint16)_height; } - uint16 drawChar(char c) { + uint16 drawChar(unsigned char c) { assert(c < _numGlyphs); byte *src = _data + _offsets[c]; diff --git a/graphics/fontman.h b/graphics/fontman.h index eeefab77ec..7121c314cd 100644 --- a/graphics/fontman.h +++ b/graphics/fontman.h @@ -84,7 +84,7 @@ private: friend class Common::Singleton<SingletonBaseType>; FontManager(); - Common::HashMap<Common::String, const Font *, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> _fontMap; + Common::HashMap<Common::String, const Font *> _fontMap; }; diff --git a/gui/eval.h b/gui/eval.h index 245ab1230b..47c8313903 100644 --- a/gui/eval.h +++ b/gui/eval.h @@ -68,9 +68,9 @@ public: char *lastToken() { return _token; } - typedef HashMap<String, int, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> VariablesMap; - typedef HashMap<String, String, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> AliasesMap; - typedef HashMap<String, String, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> StringsMap; + typedef HashMap<String, int> VariablesMap; + typedef HashMap<String, String> AliasesMap; + typedef HashMap<String, String> StringsMap; private: enum TokenTypes { diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 92867562ad..2c1212b84a 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -572,8 +572,16 @@ void LauncherDialog::updateListing() { // Retrieve a list of all games defined in the config file _domains.clear(); const ConfigManager::DomainMap &domains = ConfMan.getGameDomains(); - ConfigManager::DomainMap::const_iterator iter = domains.begin(); + ConfigManager::DomainMap::const_iterator iter; for (iter = domains.begin(); iter != domains.end(); ++iter) { +#ifdef __DS__ + // DS port uses an extra section called 'ds'. This prevents the section from being + // detected as a game. + if (iter->_key == "ds") { + continue; + } +#endif + String gameid(iter->_value.get("gameid")); String description(iter->_value.get("description")); @@ -585,14 +593,6 @@ void LauncherDialog::updateListing() { description = g.description(); } -#ifdef __DS__ - // DS port uses an extra section called 'ds'. This prevents the section from being - // detected as a game. - if (gameid == "ds") { - continue; - } -#endif - if (description.empty()) description = "Unknown (target " + iter->_key + ", gameid " + gameid + ")"; diff --git a/gui/massadd.cpp b/gui/massadd.cpp index b39b51f1fb..687d367516 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -24,6 +24,7 @@ #include "engines/metaengine.h" #include "common/events.h" +#include "common/config-manager.h" #include "gui/launcher.h" // For addGameToConf() #include "gui/massadd.h" @@ -87,6 +88,29 @@ MassAddDialog::MassAddDialog(const FilesystemNode &startDir) new ButtonWidget(this, "massadddialog_cancel", "Cancel", kCancelCmd, Common::ASCII_ESCAPE); + // Build a map from all configured game paths to the targets using them + const Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains(); + Common::ConfigManager::DomainMap::const_iterator iter; + for (iter = domains.begin(); iter != domains.end(); ++iter) { + +#ifdef __DS__ + // DS port uses an extra section called 'ds'. This prevents the section from being + // detected as a game. + if (iter->_key == "ds") { + continue; + } +#endif + + Common::String path(iter->_value.get("path")); + // Remove trailing slash, so that "/foo" and "/foo/" match. + // This works around a bug in the POSIX FS code (and others?) + // where paths are not normalized (so FSNodes refering to identical + // FS objects may return different values in path()). + while (path != "/" && path.lastChar() == '/') + path.deleteLastChar(); + if (!path.empty()) + _pathToTargets[path].push_back(iter->_key); + } } @@ -136,9 +160,36 @@ void MassAddDialog::handleTickle() { // that either means the directory contains multiple games, or the detector // could not fully determine which game variant it was seeing. In either // case, let the user choose which entries he wants to keep. + // + // However, we only add games which are not already in the config file. for (GameList::const_iterator cand = candidates.begin(); cand != candidates.end(); ++cand) { GameDescriptor result = *cand; - result["path"] = dir.getPath(); + Common::String path = dir.getPath(); + + // Remove trailing slashes + while (path != "/" && path.lastChar() == '/') + path.deleteLastChar(); + + // Check for existing config entries for this path/gameid/lang/platform combination + if (_pathToTargets.contains(path)) { + bool duplicate = false; + const Common::StringList &targets = _pathToTargets[path]; + for (Common::StringList::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { + // If the gameid, platform and language match -> skip it + Common::ConfigManager::Domain *dom = ConfMan.getDomain(*iter); + assert(dom); + + if ((*dom)["gameid"] == result["gameid"] && + (*dom)["platform"] == result["platform"] && + (*dom)["language"] == result["language"]) { + duplicate = true; + break; + } + } + if (duplicate) + break; // Skip duplicates + } + result["path"] = path; _games.push_back(result); } @@ -164,14 +215,14 @@ void MassAddDialog::handleTickle() { snprintf(buf, sizeof(buf), "Scan complete!"); _dirProgressText->setLabel(buf); - snprintf(buf, sizeof(buf), "Discovered %d games.", _games.size()); + snprintf(buf, sizeof(buf), "Discovered %d new games.", _games.size()); _gameProgressText->setLabel(buf); } else { snprintf(buf, sizeof(buf), "Scanned %d directories ...", _dirsScanned); _dirProgressText->setLabel(buf); - snprintf(buf, sizeof(buf), "Discovered %d games ...", _games.size()); + snprintf(buf, sizeof(buf), "Discovered %d new games ...", _games.size()); _gameProgressText->setLabel(buf); } diff --git a/gui/massadd.h b/gui/massadd.h index 29d24ca9a5..e0eff75c64 100644 --- a/gui/massadd.h +++ b/gui/massadd.h @@ -27,7 +27,10 @@ #include "gui/dialog.h" #include "common/fs.h" +#include "common/hashmap.h" #include "common/stack.h" +#include "common/str.h" +#include "common/hash-str.h" namespace GUI { @@ -45,6 +48,13 @@ private: Common::Stack<FilesystemNode> _scanStack; GameList _games; + /** + * Map each path occuring in the config file to the target(s) using that path. + * Used to detect whether a potential new target is already present in the + * config manager. + */ + Common::HashMap<Common::String, Common::StringList> _pathToTargets; + int _dirsScanned; Widget *_okButton; diff --git a/sound/mixer.h b/sound/mixer.h index d46a933d97..26ae0898fd 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -147,7 +147,7 @@ public: SoundType type, SoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, - int id = -1, byte volume = 255, int8 balance = 0, + int id = -1, byte volume = kMaxChannelVolume, int8 balance = 0, uint32 loopStart = 0, uint32 loopEnd = 0); /** @@ -174,7 +174,7 @@ public: SoundType type, SoundHandle *handle, AudioStream *input, - int id = -1, byte volume = 255, int8 balance = 0, + int id = -1, byte volume = kMaxChannelVolume, int8 balance = 0, bool autofreeStream = true, bool permanent = false, bool reverseStereo = false); @@ -258,7 +258,7 @@ public: * Set the channel volume for the given handle. * * @param handle the sound to affect - * @param volume the new channel volume (0 - 255) + * @param volume the new channel volume (0 - kMaxChannelVolume) */ void setChannelVolume(SoundHandle handle, byte volume); @@ -290,7 +290,7 @@ public: * Set the volume for the given sound type. * * @param type the sound type - * @param volume the new global volume, 0-kMaxMixerVolume + * @param volume the new global volume, 0 - kMaxMixerVolume */ void setVolumeForSoundType(SoundType type, int volume); @@ -298,7 +298,7 @@ public: * Query the global volume. * * @param type the sound type - * @return the global music volume, 0-kMaxMixerVolume + * @return the global music volume, 0 - kMaxMixerVolume */ int getVolumeForSoundType(SoundType type) const; diff --git a/tools/create_drascula/Makefile b/tools/create_drascula/Makefile new file mode 100644 index 0000000000..3052436b55 --- /dev/null +++ b/tools/create_drascula/Makefile @@ -0,0 +1,4 @@ +# $Id$ + +all: + g++ -I../.. create_drascula.cpp -o create_drascula diff --git a/tools/create_drascula/create_drascula.cpp b/tools/create_drascula/create_drascula.cpp new file mode 100644 index 0000000000..2676376e42 --- /dev/null +++ b/tools/create_drascula/create_drascula.cpp @@ -0,0 +1,527 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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$ + * + * This is a utility for storing all the hardcoded data of Drascula in a separate + * data file, used by the game engine + */ + + // HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "create_drascula.h" +#include "staticdata.h" + +#define DRASCULA_DAT_VER 2 // 1 byte + +static void writeByte(FILE *fp, uint8 b) { + fwrite(&b, 1, 1, fp); +} + +static void writeUint16BE(FILE *fp, uint16 value) { + writeByte(fp, (uint8)(value >> 8)); + writeByte(fp, (uint8)(value & 0xFF)); +} + +void writeSint16BE(FILE *fp, int16 value) { + writeUint16BE(fp, (uint16)value); +} + +int main(int argc, char *argv[]) { + FILE* outFile; + int i, lang; + int len, len1, pad; + uint8 padBuf[DATAALIGNMENT]; + + for (i = 0; i < DATAALIGNMENT; i++) + padBuf[i] = 0; + + outFile = fopen("drascula.dat", "wb"); + + // Write header + fwrite("DRASCULA", 8, 1, outFile); + + writeByte(outFile, DRASCULA_DAT_VER); + + // Write charmap + writeUint16BE(outFile, ARRAYSIZE(charMap)); + for (i = 0; i < ARRAYSIZE(charMap); i++) { + writeByte(outFile, charMap[i].inChar); + writeSint16BE(outFile, charMap[i].mappedChar); + writeByte(outFile, charMap[i].charType); + } + + // Write item locations + writeUint16BE(outFile, ARRAYSIZE(itemLocations)); + for (i = 0; i < ARRAYSIZE(itemLocations); i++) { + writeSint16BE(outFile, itemLocations[i].x); + writeSint16BE(outFile, itemLocations[i].y); + } + + // Write x_pol and y_pol + writeUint16BE(outFile, ARRAYSIZE(x_pol)); + for (i = 0; i < ARRAYSIZE(x_pol); i++) { + writeSint16BE(outFile, x_pol[i]); + writeSint16BE(outFile, y_pol[i]); + } + + // Write verbBarX + writeUint16BE(outFile, ARRAYSIZE(verbBarX)); + for (i = 0; i < ARRAYSIZE(verbBarX); i++) { + writeSint16BE(outFile, verbBarX[i]); + } + + // Write x1d_menu and y1d_menu + writeUint16BE(outFile, ARRAYSIZE(x1d_menu)); + for (i = 0; i < ARRAYSIZE(x1d_menu); i++) { + writeSint16BE(outFile, x1d_menu[i]); + writeSint16BE(outFile, y1d_menu[i]); + } + + // Write frameX + writeUint16BE(outFile, ARRAYSIZE(frameX)); + for (i = 0; i < ARRAYSIZE(frameX); i++) { + writeSint16BE(outFile, frameX[i]); + } + + // Write candleX and candleY + writeUint16BE(outFile, ARRAYSIZE(candleX)); + for (i = 0; i < ARRAYSIZE(candleX); i++) { + writeSint16BE(outFile, candleX[i]); + writeSint16BE(outFile, candleY[i]); + } + + // Write pianistX + writeUint16BE(outFile, ARRAYSIZE(pianistX)); + for (i = 0; i < ARRAYSIZE(pianistX); i++) { + writeSint16BE(outFile, pianistX[i]); + } + + // Write drunkX + writeUint16BE(outFile, ARRAYSIZE(drunkX)); + for (i = 0; i < ARRAYSIZE(drunkX); i++) { + writeSint16BE(outFile, drunkX[i]); + } + + // Write preupdates + writeUint16BE(outFile, ARRAYSIZE(roomPreUpdates)); + + for (i = 0; i < ARRAYSIZE(roomPreUpdates); i++) { + writeSint16BE(outFile, roomPreUpdates[i].roomNum); + writeSint16BE(outFile, roomPreUpdates[i].flag); + writeSint16BE(outFile, roomPreUpdates[i].flagValue); + writeSint16BE(outFile, roomPreUpdates[i].sourceX); + writeSint16BE(outFile, roomPreUpdates[i].sourceY); + writeSint16BE(outFile, roomPreUpdates[i].destX); + writeSint16BE(outFile, roomPreUpdates[i].destY); + writeSint16BE(outFile, roomPreUpdates[i].width); + writeSint16BE(outFile, roomPreUpdates[i].height); + writeSint16BE(outFile, roomPreUpdates[i].type); + } + + // Write updates + writeUint16BE(outFile, ARRAYSIZE(roomUpdates)); + + for (i = 0; i < ARRAYSIZE(roomUpdates); i++) { + writeSint16BE(outFile, roomUpdates[i].roomNum); + writeSint16BE(outFile, roomUpdates[i].flag); + writeSint16BE(outFile, roomUpdates[i].flagValue); + writeSint16BE(outFile, roomUpdates[i].sourceX); + writeSint16BE(outFile, roomUpdates[i].sourceY); + writeSint16BE(outFile, roomUpdates[i].destX); + writeSint16BE(outFile, roomUpdates[i].destY); + writeSint16BE(outFile, roomUpdates[i].width); + writeSint16BE(outFile, roomUpdates[i].height); + writeSint16BE(outFile, roomUpdates[i].type); + } + + // Write room actions + writeUint16BE(outFile, ARRAYSIZE(roomActions)); + + for (i = 0; i < ARRAYSIZE(roomActions); i++) { + writeSint16BE(outFile, roomActions[i].room); + writeSint16BE(outFile, roomActions[i].chapter); + writeSint16BE(outFile, roomActions[i].action); + writeSint16BE(outFile, roomActions[i].objectID); + writeSint16BE(outFile, roomActions[i].speechID); + } + + // langs + writeUint16BE(outFile, NUM_LANGS); + + // Write _text + writeUint16BE(outFile, NUM_TEXT); + + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXT; i++) { + len1 = strlen(_text[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXT; i++) { + len = strlen(_text[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_text[lang][i], len, 1, outFile); + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textd + writeUint16BE(outFile, NUM_TEXTD); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTD; i++) { + len1 = strlen(_textd[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTD; i++) { + len = strlen(_textd[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textd[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textb + writeUint16BE(outFile, NUM_TEXTB); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTB; i++) { + len1 = strlen(_textb[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTB; i++) { + len = strlen(_textb[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textb[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textbj + writeUint16BE(outFile, NUM_TEXTBJ); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTBJ; i++) { + len1 = strlen(_textbj[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTBJ; i++) { + len = strlen(_textbj[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textbj[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _texte + writeUint16BE(outFile, NUM_TEXTE); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTE; i++) { + len1 = strlen(_texte[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTE; i++) { + len = strlen(_texte[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_texte[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _texti + writeUint16BE(outFile, NUM_TEXTI); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTI; i++) { + len1 = strlen(_texti[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTI; i++) { + len = strlen(_texti[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_texti[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textl + writeUint16BE(outFile, NUM_TEXTL); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTL; i++) { + len1 = strlen(_textl[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTL; i++) { + len = strlen(_textl[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textl[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textp + writeUint16BE(outFile, NUM_TEXTP); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTP; i++) { + len1 = strlen(_textp[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTP; i++) { + len = strlen(_textp[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textp[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textt + writeUint16BE(outFile, NUM_TEXTT); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTT; i++) { + len1 = strlen(_textt[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTT; i++) { + len = strlen(_textt[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textt[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textvb + writeUint16BE(outFile, NUM_TEXTVB); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTVB; i++) { + len1 = strlen(_textvb[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTVB; i++) { + len = strlen(_textvb[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textvb[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textsys + writeUint16BE(outFile, NUM_TEXTSYS); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTSYS; i++) { + len1 = strlen(_textsys[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTSYS; i++) { + len = strlen(_textsys[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textsys[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _texthis + writeUint16BE(outFile, NUM_TEXTHIS); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTHIS; i++) { + len1 = strlen(_texthis[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTHIS; i++) { + len = strlen(_texthis[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_texthis[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textverbs + writeUint16BE(outFile, NUM_TEXTVERBS); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTVERBS; i++) { + len1 = strlen(_textverbs[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTVERBS; i++) { + len = strlen(_textverbs[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textverbs[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textmisc + writeUint16BE(outFile, NUM_TEXTMISC); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTMISC; i++) { + len1 = strlen(_textmisc[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTMISC; i++) { + len = strlen(_textmisc[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textmisc[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + // Write _textd1 + writeUint16BE(outFile, NUM_TEXTD1); + for (lang = 0; lang < NUM_LANGS; lang++) { + len = DATAALIGNMENT - 2; + for (i = 0; i < NUM_TEXTD1; i++) { + len1 = strlen(_textd1[lang][i]) + 1; + pad = DATAALIGNMENT - (len1 + 2) % DATAALIGNMENT; + len += 2 + len1 + pad; + } + writeUint16BE(outFile, len); + + fwrite(padBuf, DATAALIGNMENT - 2, 1, outFile); // padding + for (i = 0; i < NUM_TEXTD1; i++) { + len = strlen(_textd1[lang][i]) + 1; + pad = DATAALIGNMENT - (len + 2) % DATAALIGNMENT; + + writeUint16BE(outFile, len + pad + 2); + fwrite(_textd1[lang][i], len, 1, outFile); + + fwrite(padBuf, pad, 1, outFile); + } + } + + fclose(outFile); + + return 0; +} diff --git a/tools/create_drascula/create_drascula.h b/tools/create_drascula/create_drascula.h new file mode 100644 index 0000000000..ed81651e86 --- /dev/null +++ b/tools/create_drascula/create_drascula.h @@ -0,0 +1,97 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public 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$ + * + */ + +#ifndef CREATE_DRASCULA_H +#define CREATE_DRASCULA_H + +#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0]))) + +#define DATAALIGNMENT 4 + +#define NUM_LANGS 5 +#define NUM_TEXT 501 +#define NUM_TEXTD 84 +#define NUM_TEXTB 15 +#define NUM_TEXTBJ 29 +#define NUM_TEXTE 24 +#define NUM_TEXTI 33 +#define NUM_TEXTL 32 +#define NUM_TEXTP 20 +#define NUM_TEXTT 25 +#define NUM_TEXTVB 63 +#define NUM_TEXTSYS 4 +#define NUM_TEXTHIS 5 +#define NUM_TEXTVERBS 6 +#define NUM_TEXTMISC 3 +#define NUM_TEXTD1 11 + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef signed short int16; + +enum Verbs { + kVerbDefault = -1, + kVerbLook = 1, + kVerbPick = 2, + kVerbOpen = 3, + kVerbClose = 4, + kVerbTalk = 5, + kVerbMove = 6 +}; + +struct RoomTalkAction { + int room; + int chapter; + int action; + int objectID; + int speechID; +}; + +struct ItemLocation { + int x; + int y; +}; + +struct CharInfo { + char inChar; + uint16 mappedChar; + char charType; // 0 - letters, 1 - signs, 2 - accented +}; + +struct RoomUpdate { + int roomNum; + int flag; + int flagValue; + int sourceX; + int sourceY; + int destX; + int destY; + int width; + int height; + int type; // 0 - background, 1 - rect +}; + + +#endif /* CREATE_DRASCULA_H */ diff --git a/tools/create_drascula/dists/msvc8/create_drascula.sln b/tools/create_drascula/dists/msvc8/create_drascula.sln new file mode 100644 index 0000000000..dc7428bb80 --- /dev/null +++ b/tools/create_drascula/dists/msvc8/create_drascula.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_drascula", "create_drascula.vcproj", "{5F280130-349D-11DD-AE16-0800200C9A66}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5F280130-349D-11DD-AE16-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/create_drascula/dists/msvc8/create_drascula.vcproj b/tools/create_drascula/dists/msvc8/create_drascula.vcproj new file mode 100644 index 0000000000..3b26261a76 --- /dev/null +++ b/tools/create_drascula/dists/msvc8/create_drascula.vcproj @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="create_drascula" + ProjectGUID="{5F280130-349D-11DD-AE16-0800200C9A66}" + RootNamespace="create_drascula" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/wd4996" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/create_drascula.exe" + LinkIncremental="2" + IgnoreDefaultLibraryNames="libc.lib;libcmt.lib" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/create_drascula.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/wd4996" + Optimization="3" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/create_drascula.exe" + LinkIncremental="1" + IgnoreDefaultLibraryNames="libc.lib;libcmt.lib" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="..\..\create_drascula.cpp" + > + </File> + <File + RelativePath="..\..\create_drascula.h" + > + </File> + <File + RelativePath="..\..\staticdata.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/tools/create_drascula/dists/msvc8_to_msvc9.bat b/tools/create_drascula/dists/msvc8_to_msvc9.bat new file mode 100644 index 0000000000..54820b34d0 --- /dev/null +++ b/tools/create_drascula/dists/msvc8_to_msvc9.bat @@ -0,0 +1,32 @@ +@echo off +rem This batch file is used to convert MSVC8 (Visual Studio 2005) project files to MSVC9 (Visual Studio 2008) ones +rem You need the Windows version of GNU rpl +rem Get it here: +rem http://gnuwin32.sourceforge.net/packages/rpl.htm +rem Place rpl.exe from the bin folder inside the archive in the folder where +rem this batch file resides + +if not exist rpl.exe goto no_rpl + +echo Creating MSVC9 project files from the MSVC8 ones +copy /y msvc8\*.vcproj msvc9\ +copy /y msvc8\*.sln msvc9\ +rpl -e -q "Version=\"8.00\"" "Version=\"9.00\"" msvc9\*.vcproj +rpl -e -q "Version=\"8,00\"" "Version=\"9,00\"" msvc9\*.vcproj +rpl -e -q "Keyword=\"Win32Proj\"" "Keyword=\"Win32Proj\"\n\tTargetFrameworkVersion=\"131072\"" msvc9\*.vcproj +rpl -e -q "EntryPointSymbol=\"WinMainCRTStartup\"" "EntryPointSymbol=\"WinMainCRTStartup\"\n\t\t\t\tRandomizedBaseAddress=\"1\"\n\t\t\t\tDataExecutionPrevention=\"0\"" msvc9\*.vcproj +rpl -e -q "Format Version 9.00" "Format Version 10.00" msvc9\*.sln +rpl -e -q "Format Version 9,00" "Format Version 10,00" msvc9\*.sln +rpl -e -q "# Visual C++ Express 2005" "# Visual C++ Express 2008" msvc9\*.sln +rpl -e -q "# Visual Studio 2005" "# Visual Studio 2008" msvc9\*.sln +goto the_end + +:no_rpl +echo You need the Windows version of GNU rpl +echo Get it here: +echo http://gnuwin32.sourceforge.net/packages/rpl.htm +echo Place rpl.exe from the bin folder inside the archive in the folder where +echo this batch file resides + +:the_end +pause diff --git a/tools/create_drascula/dists/msvc9/create_drascula.sln b/tools/create_drascula/dists/msvc9/create_drascula.sln new file mode 100644 index 0000000000..4a39bdbe42 --- /dev/null +++ b/tools/create_drascula/dists/msvc9/create_drascula.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "create_drascula", "create_drascula.vcproj", "{5F280130-349D-11DD-AE16-0800200C9A66}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5F280130-349D-11DD-AE16-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 + {5F280130-349D-11DD-AE16-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/create_drascula/dists/msvc9/create_drascula.vcproj b/tools/create_drascula/dists/msvc9/create_drascula.vcproj new file mode 100644 index 0000000000..f30d6a114b --- /dev/null +++ b/tools/create_drascula/dists/msvc9/create_drascula.vcproj @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="create_drascula" + ProjectGUID="{5F280130-349D-11DD-AE16-0800200C9A66}" + RootNamespace="create_drascula" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/wd4996" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/create_drascula.exe" + LinkIncremental="2" + IgnoreDefaultLibraryNames="libc.lib;libcmt.lib" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/create_drascula.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/wd4996" + Optimization="3" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/create_drascula.exe" + LinkIncremental="1" + IgnoreDefaultLibraryNames="libc.lib;libcmt.lib" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="..\..\create_drascula.cpp" + > + </File> + <File + RelativePath="..\..\create_drascula.h" + > + </File> + <File + RelativePath="..\..\staticdata.h" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/tools/create_drascula/dists/msvc9_to_msvc8.bat b/tools/create_drascula/dists/msvc9_to_msvc8.bat new file mode 100644 index 0000000000..c87a524f77 --- /dev/null +++ b/tools/create_drascula/dists/msvc9_to_msvc8.bat @@ -0,0 +1,33 @@ +@echo off +rem This batch file is used to convert MSVC9 (Visual Studio 2008) project files to MSVC8 (Visual Studio 2005) ones +rem You need the Windows version of GNU rpl +rem Get it here: +rem http://gnuwin32.sourceforge.net/packages/rpl.htm +rem Place rpl.exe from the bin folder inside the archive in the folder where +rem this batch file resides + +if not exist rpl.exe goto no_rpl + +echo Creating MSVC8 project files from the MSVC9 ones +copy /y msvc9\*.vcproj msvc8\ +copy /y msvc9\*.sln msvc8\ +rpl -e -q "Version=\"9.00\"" "Version=\"8.00\"" msvc8\*.vcproj +rpl -e -q "Version=\"9,00\"" "Version=\"8,00\"" msvc8\*.vcproj +rpl -e -q "\tTargetFrameworkVersion=\"131072\"\n" "" msvc8\*.vcproj +rpl -e -q "\t\t\t\tRandomizedBaseAddress=\"1\"\n" "" msvc8\*.vcproj +rpl -e -q "\t\t\t\tDataExecutionPrevention=\"0\"\n" "" msvc8\*.vcproj +rpl -e -q "Format Version 10.00" "Format Version 9.00" msvc8\*.sln +rpl -e -q "Format Version 10,00" "Format Version 9,00" msvc8\*.sln +rpl -e -q "# Visual C++ Express 2008" "# Visual C++ Express 2005" msvc8\*.sln +rpl -e -q "# Visual Studio 2008" "# Visual Studio 2005" msvc8\*.sln +goto the_end + +:no_rpl +echo You need the Windows version of GNU rpl +echo Get it here: +echo http://gnuwin32.sourceforge.net/packages/rpl.htm +echo Place rpl.exe from the bin folder inside the archive in the folder where +echo this batch file resides + +:the_end +pause diff --git a/tools/create_drascula/module.mk b/tools/create_drascula/module.mk new file mode 100644 index 0000000000..3d64871960 --- /dev/null +++ b/tools/create_drascula/module.mk @@ -0,0 +1,13 @@ +# $URL$ +# $Id$ + +MODULE := tools/create_drascula + +MODULE_OBJS := \ + create_drascula.o + +# Set the name of the executable +TOOL_EXECUTABLE := create_drascula + +# Include common rules +include $(srcdir)/rules.mk diff --git a/engines/drascula/staticdata.h b/tools/create_drascula/staticdata.h index 58bf24f75d..4778c530e4 100644 --- a/engines/drascula/staticdata.h +++ b/tools/create_drascula/staticdata.h @@ -26,11 +26,7 @@ #ifndef STATICDATA_H #define STATICDATA_H -#include "drascula/drascula.h" - -namespace Drascula { - -const CharInfo charMap[CHARMAP_SIZE] = { +const CharInfo charMap[] = { // Letters // --------------------------------------- { 'A', 6, 0 }, { 'B', 15, 0 }, @@ -48,7 +44,7 @@ const CharInfo charMap[CHARMAP_SIZE] = { { 'W', 213, 0 }, { 'X', 222, 0 }, { 'Y', 231, 0 }, { 'Z', 240, 0 }, // --------------------------------------- - { 0xa7, 250, 0 }, { ' ', 250, 0 }, + { '\247', 250, 0 }, { ' ', 250, 0 }, // Signs // --------------------------------------- { '.', 6, 1 }, { ',', 15, 1 }, @@ -75,7 +71,7 @@ const CharInfo charMap[CHARMAP_SIZE] = { { '\225', 78, 2 }, { '\227', 87, 2 }, // I, J { '\203', 96, 2 }, { '\210', 105, 2 }, // K, L { '\214', 114, 2 }, { '\223', 123, 2 }, // M, N - { '\226', 132, 2 }, { '\047', 141, 2 }, // special Spanish char, O + { '\226', 132, 2 }, { '\'', 141, 2 }, // special Spanish char, O { '\200', 150, 2 }, { '\207', 150, 2 }, // P, P { '\265', 6, 2 }, { '\220', 15, 2 }, // A, B { '\326', 24, 2 }, { '\340', 33, 2 }, // C, D @@ -106,12 +102,12 @@ const ItemLocation itemLocations[] = { { 275, 160 } // 43 }; -const int x_pol[44] = {0, 1, 42, 83, 124, 165, 206, 247, 83, 1, 206, - 1, 42, 83, 124, 165, 206, 247, 83, 1, 206, - 247, 83, 165, 1, 206, 42, 124, 83, 1, 247, - 83, 165, 1, 206, 42, 124, 83, 1, 247, 42, - 1, 165, 206}; -const int y_pol[44] = {0, 1, 1, 1, 1, 1, 1, 1, 27, 27, 1, +const int x_pol[44] = {0, 1, 42, 83, 124, 165, 206, 247, 83, 1, 206, + 1, 42, 83, 124, 165, 206, 247, 83, 1, 206, + 247, 83, 165, 1, 206, 42, 124, 83, 1, 247, + 83, 165, 1, 206, 42, 124, 83, 1, 247, 42, + 1, 165, 206}; +const int y_pol[44] = {0, 1, 1, 1, 1, 1, 1, 1, 27, 27, 1, 27, 27, 27, 27, 27, 27, 27, 1, 1, 27, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, 1, 1, 1, 1, 1, 27, 27, 27, 27, 27, @@ -122,8 +118,97 @@ const int x1d_menu[] = {280, 40, 80, 120, 160, 200, 240, 0, 40, 80, 120, 40, 80, 120, 160, 200, 240, 0}; const int y1d_menu[] = {0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 50, 50, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75, 75, 75, 100}; -int frame_x[20] = {43, 87, 130, 173, 216, 259}; +int frameX[20] = {43, 87, 130, 173, 216, 259}; +int candleX[] = {14, 19, 24}; +int candleY[] = {158, 172, 186}; +int pianistX[] = {1, 91, 61, 31, 91, 31, 1, 61, 31}; +int drunkX[] = {1, 42, 83, 124, 165, 206, 247, 1}; +const RoomUpdate roomPreUpdates[] = { + // room flag val x1 y1 x2 y2 width height type + { 3, 3, 1, 258, 110, 85, 44, 23, 53, 0 }, + //------------------------------------------------------------------------------- + { 5, 8, 0, 256, 152, 208, 67, 27, 40, 0 }, + //------------------------------------------------------------------------------- + { 6, 0, 0, 3, 103, 185, 69, 23, 76, 0 }, + { 6, 1, 0, 97, 117, 34, 148, 36, 31, 0 }, + { 6, 2, 0, 28, 100, 219, 72, 64, 97, 0 }, + //------------------------------------------------------------------------------- + { 7, 35, 0, 1, 72, 158, 162, 19, 12, 0 }, + //------------------------------------------------------------------------------- + { 12, 16, 0, 1, 131, 106, 117, 55, 68, 0 }, + //------------------------------------------------------------------------------- + { 17, 15, 1, 1, 135, 108, 65, 44, 63, 0 }, + //------------------------------------------------------------------------------- + { 21, 0, 1, 2, 171, 84, 126, 17, 26, 0 }, + { 21, 10, 1, 20, 163, 257, 149, 14, 34, 0 }, + //------------------------------------------------------------------------------- + { 22, 24, 1, 2, 187, 107, 106, 62, 12, 0 }, + { 22, 27, 0, 32, 181, 203, 88, 13, 5, 0 }, + { 22, 26, 0, 2, 133, 137, 83, 29, 53, 0 }, + { 22, 26, 1, 65, 174, 109, 145, 55, 25, 0 }, + //------------------------------------------------------------------------------- + { 24, 1, 1, 1, 163, 225, 124, 12, 36, 0 }, + { 24, 2, 1, 14, 153, 30, 107, 23, 46, 0 }, + //------------------------------------------------------------------------------- + { 26, 2, 1, 1, 130, 87, 44, 50, 69, 0 }, + { 26, 12, 1, 52, 177, 272, 103, 27, 22, 0 }, + { 26, 18, 0, 80, 133, 199, 95, 50, 66, 0 }, + //------------------------------------------------------------------------------- + { 27, 5, 1, 1, 175, 59, 109, 17, 24, 1 }, + { 27, 6, 1, 19, 177, 161, 103, 18, 22, 1 }, + //------------------------------------------------------------------------------- + { 29, 4, 1, 12, 113, 247, 49, 41, 84, 0 }, + //------------------------------------------------------------------------------- + { 30, 4, 1, 1, 148, 148, 66, 35, 51, 0 }, + { 30, 16, 1, 37, 173, 109, 84, 20, 26, 0 }, + //------------------------------------------------------------------------------- + { 31, 13, 1, 1, 163, 116, 41, 61, 36, 0 }, + { 31, 5, 1, 1, 78, 245, 63, 30, 84, 0 }, + //------------------------------------------------------------------------------- + { 34, 7, 1, 99, 127, 73, 41, 79, 72, 0 }, + { 34, 8, 1, 36, 129, 153, 41, 62, 65, 0 }, + //------------------------------------------------------------------------------- + { 35, 14, 1, 1, 86, 246, 65, 68, 87, 0 }, + { 35, 17, 1, 70, 150, 118, 52, 40, 23, 0 }, + //------------------------------------------------------------------------------- + { 49, 6, 0, 2, 136, 176, 81, 49, 62, 0 }, + //------------------------------------------------------------------------------- + { 53, 1, 0, 2, 113, 205, 50, 38, 86, 1 }, + { 53, 2, 0, 41, 159, 27, 117, 25, 40, 0 }, + { 53, 9, 1, 67, 184, 56, 93, 32, 15, 0 }, + //------------------------------------------------------------------------------- + { 54, 5, 1, 168, 156, 187, 111, 7, 11, 0 }, + { 54, 12, 1, 16, 156, 190, 64, 18, 24, 0 }, + //------------------------------------------------------------------------------- + { 56, 10, 0, 2, 126, 42, 67, 57, 67, 0 }, + { 56, 11, 1, 60, 160, 128, 97, 103, 38, 0 }, + //------------------------------------------------------------------------------- + { 58, 0, 0, 1, 156, 143, 120, 120, 43, 0 }, + { 58, 1, 2, 252, 171, 173, 116, 25, 28, 1 }, + //------------------------------------------------------------------------------- + { 59, 4, 0, 1, 146, 65, 106, 83, 40, 1 } +}; + +const RoomUpdate roomUpdates[] = { + // room flag val x1 y1 x2 y2 width height type + { 5, -1, -1, 114, 130, 211, 87, 109, 69, 1 }, + { 15, -1, -1, 1, 154, 83, 122, 131, 44, 1 }, + { 17, -1, -1, 48, 135, 78, 139, 80, 30, 1 }, + { 18, 24, 1, 177, 1, 69, 29, 142, 130, 1 }, + { 18, -1, -1, 105, 132, 109, 108, 196, 65, 1 }, + { 20, -1, -1, 1, 137, 106, 121, 213, 61, 1 }, + { 27, -1, -1, 38, 177, 103, 171, 21, 22, 1 }, + { 27, -1, -1, 60, 162, 228, 156, 18, 37, 1 }, + { 29, -1, -1, 1, 180, 150, 126, 10, 17, 1 }, + { 31, -1, -1, 63, 190, 223, 157, 17, 9, 1 }, + { 34, -1, -1, 5, 171, 234, 126, 29, 23, 1 }, + { 35, -1, -1, 1, 174, 54, 152, 195, 25, 1 }, + { 50, -1, -1, 4, 153, 118, 95, 67, 44, 1 }, + { 57, -1, -1, 7, 113, 166, 61, 62, 82, 1 }, + { 61, -1, -1, 1, 154, 83, 122, 131, 44, 1 }, + { 63, -1, -1, 1, 154, 83, 122, 131, 44, 1 }, +}; // Note: default action needs to be LAST for each group // of actions with the same number @@ -323,6 +408,8 @@ RoomTalkAction roomActions[] = { { 26, -1, kVerbLook, 168, 476 }, { 26, -1, kVerbPick, 168, 477 }, // ================================== + { 27, -1, kVerbLook, 175, 429 }, + // ================================== { 29, -1, kVerbLook, 152, 463 }, { 29, -1, kVerbOpen, 152, 464 }, // ---------------------------------- @@ -481,6 +568,8 @@ RoomTalkAction roomActions[] = { { 200, 4, kVerbLook, 28, 328 }, { 200, 4, kVerbTalk, 15, 118 }, { 200, 4, kVerbOpen, 15, 119 }, + { 200, 4, 14, 19, 484 }, + { 200, 4, 19, 14, 484 }, // ---------------------------------- { 200, 5, kVerbLook, 7, 478 }, { 200, 5, kVerbLook, 8, 120 }, @@ -512,6 +601,8 @@ RoomTalkAction roomActions[] = { { 201, 2, kVerbMove, 50, 312 }, { 201, 2, kVerbPick, 50, 313 }, { 201, 2, kVerbTalk, 50, 314 }, + { 201, 2, 13, 50, 156 }, + { 201, 2, 20, 50, 163 }, // ---------------------------------- { 201, 3, kVerbLook, 50, 309 }, { 201, 3, kVerbOpen, 50, 310 }, @@ -526,6 +617,8 @@ RoomTalkAction roomActions[] = { { 201, 4, kVerbMove, 50, 312 }, { 201, 4, kVerbPick, 50, 313 }, { 201, 4, kVerbTalk, 50, 314 }, + { 201, 4, 9, 50, 484 }, + { 201, 4, 20, 50, 487 }, // ---------------------------------- { 201, 5, kVerbLook, 50, 309 }, // Originally these are with { 201, 5, kVerbOpen, 50, 310 }, // completely wrong voices @@ -533,6 +626,7 @@ RoomTalkAction roomActions[] = { { 201, 5, kVerbMove, 50, 312 }, { 201, 5, kVerbPick, 50, 313 }, { 201, 5, kVerbTalk, 50, 314 }, + { 201, 5, 20, 50, 487 }, // ---------------------------------- { 201, 6, kVerbOpen, 50, 310 }, { 201, 6, kVerbClose, 50, 311 }, @@ -542,7 +636,7 @@ RoomTalkAction roomActions[] = { }; -const char *_text[][501] = { +const char *_text[NUM_LANGS][NUM_TEXT] = { { // 0 "", @@ -553,7 +647,7 @@ const char *_text[][501] = { // 5 "WHAT SHOULD I DO, SHOULD I PULL IT OFF?", "HI THERE DOOR, I'M GOING TO MAKE YOU A DOOR-FRAME", - "IT'S TOO MUCH FOR ME", + "IT'S TOO TOUGH FOR ME", "THE WINDOW IS BOARDED UP", "I CAN'T", // 10 @@ -570,7 +664,7 @@ const char *_text[][501] = { "IT'S ALRIGHT WHERE IT IS", // 20 "", - "ITS A COFFIN IN THE SHAPE OF A CROSS", + "IT'S A COFFIN IN THE SHAPE OF A CROSS", "NO THANKS", "HI DEAD MAN. NO, DON'T GET UP FOR MY SAKE", "YES, JUST LIKE IN POLTERGEIST", @@ -578,10 +672,10 @@ const char *_text[][501] = { "", "", "I'LL BE BACK IN FIFTEEN MINUTES", - "IT IS FORBIDDEN TO PUT UP POSTERS", + "IT'S FORBIDDEN TO PUT UP POSTERS", "IT'S UNCLE EVARISTO'S TOMB", // 30 - "ITS LOCKED", + "IT'S LOCKED", "I'VE GOT ONE", "YOO HOO, UNCLE EVARISTO!", "THERE'S NO POWER", @@ -595,9 +689,9 @@ const char *_text[][501] = { // 40 "", "IT'S AN ANCIENT CANDELABRUM", - "IT MUST HAVE BEEN HERE EVER SINCE YULE BRINNER HAD HAIR ON HIS HEAD", - "NO, ITS A RELIC", - "ITS A NICE ALTARPIECE", + "IT MUST HAVE BEEN HERE SINCE YULE BRINNER HAD HAIR ON HIS HEAD", + "NO, IT'S A RELIC", + "IT'S A NICE ALTARPIECE", // 45 "", "HA, HA, HA", @@ -689,21 +783,21 @@ const char *_text[][501] = { "AND SO BRAIN, WHAT ARE YOU UP TONIGHT?", "NO, IT MUST BE KEPT SOMEWHERE AWAY FROM THE MUTANT ACTION OF THE ATMOSPHERE", // 120 - "HE IS VERY STIFF, JUST LIKE MY BOSS", + "IT IS VERY STIFF, JUST LIKE MY BOSS", "A VERY SHARP STAKE", - "YOU FAITHFUL SHARP-PAINTED STAKE, NOBLE TRANSILVANIAN OAK TREE", + "YOU FAITHFUL SHARP-POINTED STAKE, FROM THE MOST NOBLE TRANSILVANIAN OAK TREE", "DAMN, I HAVE TO CUT MY NAILS!", "B.J. IS IN THERE... SHE IS A REALLY HOT CHICK!", // 125 "IT IS FIRMLY LOCKED", - "\"SAVE AWAY LOCKS LTD.\"", + "\"SAFE AWAY LOCKS LTD.\"", "IT IS THE TYPICAL SKELETON YOU FIND IN THE DUNGEONS OF ALL THE GAMES", "IT IS COMMONLY USED TO TRANSFER ELECTRICITY TO THE MACHINES CONNECTED TO IT", "IT IS HAND MADE BECAUSE THE JAPANESE MAKE THEM POCKET SIZE", // 130 "I HAVE ONLY ONCE SEEN IN MY LIFE ANOTHER THING AS UGLY AS THIS", "FORGET IT. I AM NOT GOING TO TELL HIM ANYTHING IN CASE HE GETS MAD", - "IT SEEMS QUITE RATIONAL", + "HE SEEMS QUITE RATIONAL", "IT IS A PICTURE OF PLATO WRITING HIS LOST DIALOGUE", "I AM NOT ONE OF THOSE PEOPLE WHO TALKS TO POSTERS", // 135 @@ -721,13 +815,13 @@ const char *_text[][501] = { // 145 "THOSE ARE STRANGE LEAVES. THEY MUST HAVE BROUGHT THEM FROM SOUTH AMERICA OR AROUND THERE", "I DON'T THINK THEY WOULD ANSWER ME", - "THAT'S A BEAUTIFUL WOODEN CRUCIFIX. THE ICON DOESN'T REALLY SHOW THE FULL EXTENT OF ITS BEAUTY", + "THAT'S A BEAUTIFUL WOODEN CRUCIFIX. THE ICON DOESN'T REALLY SHOW THE FULL EXTENT OF IT'S BEAUTY", "I ONLY PRAY BEFORE I GO TO BED", "HEY, THIS SPIKE SEEMS A LITTLE BIT LOOSE!", // 150 "I HOPE YOU WON'T COMPLAIN ABOUT NOT GETTING ANY CLUES FROM ME", "IT'S A QUITE CONVENTIONAL SPIKE", - "THEY ARE CUTE, THOUGH THEY ARE COVERED WITH A LITTLE BIT OF SHIT", + "THEY ARE CUTE, THOUGH THEY ARE COVERED WITH A LITTLE BIT OF WAX", "NO, THEY WON'T HEAR ME. HA,HA,HA THIS IS GREAT!", "\"SLEEPING BEAUTY\" FROM TCHAIKOVSKY, OR CHOIFRUSKY, OR WHATEVER IT IS", // 155 @@ -744,7 +838,7 @@ const char *_text[][501] = { "THERE IS A ONE THOUSAND BILL AND A COUPLE OF COINS", // 165 "IT SAYS \"PLEASE, DO NOT THROW FOOD TO THE PIANIST\"", - "OMELETTE, 200. FRIED FISH, 150, MAYONNAISE POTATOES, 225", + "OMELETTE, 1.00. FRIED FISH, 0.80, MAYONNAISE POTATOES, 1.10", "BEST BURGERS ON THIS SIDE OF THE DANUBE, ONLY 325!", "THAT'S A NICE SKULL WITH A VERY PENETRATING LOOK, HA, HA, HA, HA, THAT WAS GOOD!", "HI SKULL, YOU REMIND ME OF UNCLE HAMLET", @@ -753,12 +847,12 @@ const char *_text[][501] = { "IT'S A BIN", "IT'S A BET FOR TONIGHT'S GAME", "I WONDER WHAT IS BEHIND THAT", - "HEY, THE CURTAIN WONT MOVE!", + "HEY, THE CURTAIN WILL NOT MOVE!", // 175 "MAN, THIS CASTLE IS REALLY GLOOMY", "I CAN'T, HE IS TOO FAR AWAY TO HEAR ME", "IT'S A TYPICAL TRANSILVANIAN FOREST, WITH TREES", - "MAN YOU SAY REALLY STUPID THINGS, AND THIS IS TOO DARK!", + "MAN YOU SAY REALLY STUPID THINGS, THIS ROOM IS TOO DARK!", "GARCIA, CANDY STORE. SWEETS AND BUBBLE GUM", // 180 "A VERY NICE DOOR", @@ -782,7 +876,7 @@ const char *_text[][501] = { "YES, SO WHAT?", "SO?", "IS...THAT RIGHT?", - "GOOD QUESTION. GET ME A DRINK AND LET ME TELL YOU MY STORY. LOOK...", + "GOOD QUESTION. LET ME TELL YOU MY STORY. LOOK...", "IT WILL TAKE JUST FIVE MINUTES", // 200 "I'M JOHN HACKER AND I REPRESENT A BRITISH PROPERTY COMPANY", @@ -793,7 +887,7 @@ const char *_text[][501] = { // 205 "YOU...PIANIST...!!!!", "BEAUTIFUL NIGHT", - "AND IT'S NOT EVEN COLD OR ANYTHING", + "AND IT'S NOT EVEN COLD OR ANYTHING, BY THE WAY, CANT YOU PLAY A DIFFERENT SONG?", "ALL RIGHT, I'LL JUST LET YOU GO ON PLAYING", "WELL THEN", // 210 @@ -803,7 +897,7 @@ const char *_text[][501] = { "I'D BETTER NOT SAY ANYTHING", "THERE IS NO PLACE LIKE HOME. THERE IS NO...WHAT?, BUT YOU ARE NOT AUNTIE EMMA. AS A MATTER OF FACT, I DON'T HAVE AN AUNTIE EMMA!", // 215 - "YES, SO DOES MINE. YOU CAN CALL ME ANYTHING YOU WANT, BUT IF YOU CALL ME JOHNNY, I'LL COME TO YOU LIKE A DOG", + "YOU CAN CALL ME ANYTHING YOU WANT, BUT IF YOU CALL ME JOHNNY, I'LL COME TO YOU LIKE A DOG", "AREN'T I JUST A FUNNY GUY, HUH?. BY THE WAY, WHERE AM I?", "YES", "SHOOT...!", @@ -839,11 +933,11 @@ const char *_text[][501] = { "", "BY THE WAY, THIS IS NOT THE CASE, OF COURSE, BUT WHAT COULD HAPPEN IF A VAMPIRE GOT THE RECIPE BY ANY CHANCE?", // 245 - "WELL ANYWAY. LISTEN, DOESN'T THIS LOOK TO YOU LIKE A LOT OF CRAP TO END THE GAME WITH?. WELL, MAYBE NOT", + "WELL ANYWAY. LISTEN, DOESN'T THIS LOOK LIKE A LOT OF CRAP TO END THE GAME WITH?. WELL, MAYBE NOT", "IT'S EMPTY!", "WHY DID YOU TAKE MY ONLY LOVE, B.J., AWAY FROM ME?. LIFE HAS NO MEANING FOR ME WITHOUT HER", "HER BRAIN?\?!!", - "TO TELL YOU THE TRUTH, I THINK I HAVE HAD JUST ABOUT ENOUGH OF YOUR LITTLE MONSTER", + "TO TELL YOU THE TRUTH, I THINK I HAVE HAD ENOUGH FUN WITH YOUR LITTLE MONSTER ALREADY", // 250 "OH PLEASE, HOLY VIRGIN, DON'T LET ANYTHING WORSE HAPPEN TO ME!!", "YOU ARE NOT GOING TO GET YOUR WAY. I'M SURE SUPERMAN WILL COME AND RESCUE ME!", @@ -869,7 +963,7 @@ const char *_text[][501] = { "WHO?", "CAN'T YOU SEE DRASCULA IS HERE?", // 270 - "THEN, LET'S END UP WITH HIM, RIGHT?", + "THEN, LET'S FINISH HIM OFF, RIGHT?", "GIVE ME A SCOTCH ON THE ROCKS", "NOTHING, I JUST FORGOT WHAT I WAS GOING TO SAY...", "EITHER YOU GET ME A SCOTCH ON THE ROCKS OR I'LL PLAY THE PIANO UNTIL THE GAME IS OVER", @@ -878,7 +972,7 @@ const char *_text[][501] = { "GOOD EVENING", "AND SO IGOR, HOW ARE YOU FEELING...A LITTLE HUMPED...?. HA, HA, HA, THAT WAS FUNNY!", "WHAT ARE YOU SUPPOSED TO BE DOING?", - "WELL, NO", + "WELL, NO, I DONT UNDERSTAND TAXES", "THEN WEAR GLASSES", // 280 "WHAT IS ALL THAT ABOUT THE SUPERNATURAL ORGY?", @@ -887,7 +981,7 @@ const char *_text[][501] = { "OH...PLEASE...COME ON...!", "WHY NOT?", // 285 - "OH...BUT DOES HE SLEEP AT NIGHT?", + "OH...DOES HE SLEEP AT NIGHT?", "WELL, I HOPE YOU GET LUCKY", "I HAVE TO TALK TO HIM...", "YOUUU...SKELETONNNN..!!!", @@ -938,14 +1032,14 @@ const char *_text[][501] = { "JAMM. AHH...", "YES...WOF, WOF", "LOOK, THERE'S A PIECE OF BUBBLE GUM STUCK HERE", - "THIS IS THE PORTABLILINE I GOT LAST CHRISTMAS", + "THIS IS THE MOBILE PHONE I GOT LAST CHRISTMAS", "IT'S VERY HIGH!", // 330 "COME OUT TO THE BALCONY MY JULIET!!", "YOU ARE THE LIGHT THAT ILLUMINATES MY WAY!", "HEY, DOOR!, WHAT'S THE MATTER?", - "YOUUU, CIGARETTE SPENDING MACHINE!", - "IT'S A CIGARETTE SPENDING MACHINE", + "YOUUU, CIGARETTE VENDING MACHINE!", + "IT'S A CIGARETTE VENDING MACHINE", // 335 "I HAVE ANOTHER COIN INSIDE", "NO, I JUST QUIT SMOKING AND DRINKING ALCOHOL", @@ -953,7 +1047,7 @@ const char *_text[][501] = { "THIS IS A TRICK! NOTHING CAME OUT!", "AT LAST!", // 340 - "ITS JUST A TRUNK", + "IT'S JUST A TRUNK", "HELLO TRUNK, YOUR NAME IS JUST LIKE MY COUSIN FRANK...", "I'VE FOUND B.J.'S HANDBAG!", "OH MY GOD! I HAVE NO REFLECTION! I'M A VAMPIRE!", @@ -985,11 +1079,11 @@ const char *_text[][501] = { // 365 "WELL GOODBYE, I HAVE TO KILL A VAMPIRE", "", - "WHAT'S YOUR LANGUAGE, TRANSILVANIAN?", - "WHO IS UNCLE DESIDERIO?", - "BUT, WHAT'S THE MATTER WITH DRASCULA?", + "WHAT LANGUAGE ARE YOU SPEAKING?, TRANSILVANIAN?", + "WHAT ARE YOU TALKING ABOUT? WHO IS UNCLE DESIDERIO?", + "BUT, WHAT'S THE PROBLEM WITH DRASCULA?", // 370 - "WHO IS THAT GUY NAMED VON BRAUN?", + "WHO IS THIS GUY NAMED VON BRAUN?", "AND WHY DOESN'T HE DO IT?", "WHERE CAN I FIND VON BRAUN?", "WELL, THANKS AND GOODBYE. HOPE YOU SLEEP IT OFF JUST FINE", @@ -1016,7 +1110,7 @@ const char *_text[][501] = { "ALL RIGHT OLD MAN. I CAME FOR MY MONEY", "NO, NOTHING. I WAS JUST LEAVING", "SORRY...", - "DO YOU LIKE THIS BOOK?. IT HAS SOME SCORES FROM TCHAIKOVSKY", + "WOULD YOU LIKE THIS BOOK?. IT HAS SOME SCORES FROM TCHAIKOVSKY", "HOW CAN I KILL A VAMPIRE?", // 395 "HAS ANYBODY TOLD YOU THAT SLEEPING IN A BAD POSITION IS NOT GOOD FOR YOU?", @@ -1033,9 +1127,9 @@ const char *_text[][501] = { // 405 "I HAVE ALL THE INGREDIENTS OF THAT BREW", "JUST A QUESTION. WHAT IS ALL THAT ABOUT THE ALUCSARD ETEREUM?", - "HELLO, HELLO...", + "YES, YES?...", "AND WHERE IS THAT CAVERN?", - "WHAT HAPPENS? DIDN'T YOU HAVE TO GO TO THE COURT?", + "WHAT HAPPENED? DIDN'T THEY HAVE TO GO TO COURT?", // 410 "...BUT... IF I MEET MORE VAMPIRES?", "IT'S A VAMPIRE THAT WON'T LET ME COME THROUGH", @@ -1056,7 +1150,7 @@ const char *_text[][501] = { "THAT TOOK AWAY THE RUST", // 425 "I FOUND A PINE STAKE", - "I'LL TAKE THIS THICKER ONE", + "I'LL TAKE THIS LARGER ONE", "WELL, I THINK I CAN GET RID OF THIS STUPID DISGUISE", "\"PASSAGE TO TOWERS CLOSED FOR REPAIRS. PLEASE USE THE MAIN ENTRANCE. SORRY FOR THE INCONVENIENCE\"", "...HE IS PALE, HE HAS FANGS AND WEARS A TOUPE\220 HE SURE IS DRASCULA!", @@ -1097,21 +1191,21 @@ const char *_text[][501] = { "IT SEEMS A LITTLE LOOSE ON THE WALL", "I DON'T THINK IT IS GOING TO HELP ME ANYWAY. IT'S TOO WET TO LIGHT", // 460 - "TO THE WEST WING? NO WAY! NOBODY KNOWS WHAT YOU WILL FIND IN THERE!!", - "SHE'S GOT NICE TRANSILVANIAN REASONS", + "TO THE WEST WING? NO WAY! NOBODY KNOWS WHAT YOU WILL FIND THERE!!", + "SHE'S GOT NICE TRANSILVANIAN FEATURES", "", "IT'S A SHAME THERE ISN'T A ROASTED LAMB IN THERE", "LAST TIME I OPENED AN OVEN I BLEW UP THE HOUSE", // 465 - "THAT'S THE TRANSILVANIAN FOOTBALL BADGE", - "WHAT FOR? TO PUT IT ON MY HEAD", + "THAT'S THE TRANSILVANIAN FOOTBALL TEAMS BADGE", + "WHAT FOR? TO PUT IT ON MY HEAD??", "I DON'T THINK THESE TOWERS ARE THE OPENING KIND", "I DON'T WANT TO KNOW WHAT KIND OF FOOD IS IN THERE!", "IT LOOKS IMPRESSIONIST TO ME...", // 470 "THE NIGHT IS FALLING OVER ALL OF US...THAT'S SCARY, ISN'T IT?", "IT'S STUCK!", - "IT'S THE KING. YOU DIDN'T IMAGINE THAT, DID YOU!", + "IT'S ELVIS THE KING. YOU DIDN'T IMAGINE THAT WOULD BE HERE, DID YOU!", "NO, I ALREADY HAVE ONE AT HOME TO FEED", "A SHELF WITH BOOKS AND SOME OTHER THINGS", // 475 @@ -1137,13 +1231,13 @@ const char *_text[][501] = { "THAT'S A PRETTY CUTE CLOAK", "", "JUST LIKE ALL THE BRANCHES FROM ANY TREE IN THE WORLD, THERE IS NOTHING SPECIAL.", - "HEY, THAT'S AMAZING! A ROPE WITHIN THIS TYPE OF ADVENTURE GAME!", + "HEY, THAT'S AMAZING! A ROPE IN THIS TYPE OF ADVENTURE GAME!", // 495 "I WONDER WHAT WE COULD USE IT FOR...", "A ROPE TIED TO A BRANCH OR THE OTHER WAY AROUND, HOWEVER YOU WANT TO PUT IT...", "IT LOOKS LIKE THIS MAGPIE IS EVIL-MINDED", "FORGET IT, I'M NOT SAYING ANYTHING IN CASE HE GETS MAD", - "SHE LOOKS DEAD, BUT REALLY SHE ISN'T, HUH?", + "SHE LOOKS DEAD, BUT SHE REALLY ISN'T, HUH?", // 500 "NO ANIMAL WAS HARMED DURING THE PRODUCTION OF THIS GAME", }, @@ -2793,7 +2887,7 @@ const char *_text[][501] = { "ET ALORS, POURQUOI TU M'\220COUTES?", "PR\322TE-MOI LES TAMPONS", "ALLONS! JE VAIS TE LES REDONNER TOUT DE SUITE", - "ALLOOONSSS..." + "ALLOOONSSS...", // 365 "AU REVOIR. JE DOIS TUER UN VAMPIRE", "", @@ -3565,17 +3659,17 @@ const char *_text[][501] = { }, }; -const char *_textd[][84] = { +const char *_textd[NUM_LANGS][NUM_TEXTD] = { { // 0 "", "HEY IGOR, HOW IS EVERYTHING GOING?", "IT'S ALWAYS THE SAME STORY EVERYTIME THERE'S A GOOD GAME ON THE SATELLITE! ANYWAY, WE'LL GO WATCH IT IN THE BAR, AS USUAL", "IGOR LISTEN CAREFULLY MAN, WE ARE GOING TO START WITH PHASE NUMBER ONE OF MY PLAN TO CONQUER THE WORLD", - "FIRST WE'LL CAPTURE SOME LIGHTNING AND WE'LL DEMAGNETIZE IT WITH OUR INDIFIBULATOR. THE ELECTRICITY WILL COME THROUGH TO MY MONSTER AND HE WILL LIVE!", + "FIRST WE'LL CAPTURE SOME LIGHTNING THEN WE'LL DEMAGNETIZE IT WITH OUR INDIFIBULATOR. THE ELECTRICITY WILL FLOW THROUGH TO MY MONSTER AND HE WILL LIVE!", // 5 "IF EVERYTHING WORKS OUT ALL RIGHT, THIS WILL BE THE BEGINNING OF A GREAT ARMY THAT WILL CONQUER THE WORLD FOR ME. HA, HA", - "THE MONSTERS WILL DESTROY ALL THE ARMY'S WEAPONS IN THE WORLD, MEANWHILE, WE'LL BE SAFE IN THE PIECES OF LAND I BOUGHT IN GIBRALTAR", + "THE MONSTERS WILL DESTROY ALL THE ARMY'S WEAPONS IN THE WORLD, MEANWHILE, WE'LL BE SAFE IN THE PIECES OF LAND I PLAN TO BUY IN GIBRALTAR", "WE'LL SET UP A COUP. GOVERNMENTS ALL OVER THE WORLD WILL BE UNCOVERED AND THEIR COUNTRIES WILL SURRENDER TO ME!", "I'LL BECOME THE FIRST BAD GUY IN HISTORY TO MAKE IT ! HA, HA!", "I'M NOT TALKING TO YOU, IDIOT! I'M JUST GIVING YOU THE PLOT. ALL RIGHT, EVERYTHING READY?", @@ -3583,17 +3677,17 @@ const char *_textd[][84] = { "THE TIME HAS COME! TURN ON THE ALKALINE BATTERIES' SWITCH", "DAMN IT! WHAT WENT WRONG?", "ARE YOU SURE YOU CHECKED IT ALL AND THERE WAS NOTHING MISSING? LATELY YOU'VE BEEN MESSING AROUND WITH THAT STUFF ABOUT TAXES AND I DON'T KNOW MAN...", - "YOU STUPID THING! YOU FORGOT TO CONNECT THE INDIFIBULATOR. THE SCREWS HAVE PROBABLY MAGNETIZED AND HIS BRAIN HAS PROBABLY BURNT", + "YOU STUPID THING! YOU FORGOT TO CONNECT THE INDIFIBULATOR. THE SCREWS HAVE MAGNETIZED AND HIS BRAIN HAS PROBABLY BURNT", "YOU ARE DEAD, YOU ARE DEAD...WAIT TILL I GET YOU!", // 15 "SHUT UP! I'LL GET ANOTHER BRAIN TOMORROW AND THEN WE WILL REPEAT THE EXPERIMENT", - "THIS TIME I'LL GET A WOMAN'S BRAIN. SHINY AND NOT USED YET...HA, HA, HA, GOODIE ONE!", - "SO WHAT? I'M THE BAD GUY, RIGHT? SO I CAN BE AS FULL OF MACHISMO AS I WANT, ALL RIGHT? AND IF YOU SAY SOMETHING AGAIN I'LL TURN YOUR HUMP BACK TO FRONT!", - "HA, HA, HA. YOU FELL TOO!! NOW YOU ARE GOING TO PAY FOR DARING TO FIGHT ME! IGOR, TAKE HIM TO THE PENDULUM OF DEATH!", + "THIS TIME I'LL GET A WOMAN'S BRAIN. SHINY AND NOT USED YET...HA, HA, HA, GOOD ONE!", + "SO WHAT? I'M THE BAD GUY, RIGHT? SO I CAN BE AS FULL OF MACHISMO AS I WANT, ALL RIGHT? AND IF YOU SAY ANOTHER THING I'LL TURN YOUR HUMP BACK TO FRONT!", + "HA, HA, HA. YOU FELL FOR IT!! NOW YOU ARE GOING TO PAY FOR DARING TO FIGHT ME! IGOR, TAKE HIM TO THE PENDULUM OF DEATH!", "AND SO, TELL ME, YOU STUPID HUMAN. HOW COME YOU WANT TO DESTROY ME?", // 20 "THAT'S BEAUTIFUL!. IF IT WASN'T BECAUSE IT MAKES ME LAUGH, I WOULD CRY", - "YOUR GIRLFRIEND'S BRAIN, TO HELP ME CONQUER THE WORLD", + "I PLAN TO USE YOUR GIRLFRIEND'S BRAIN, TO HELP ME CONQUER THE WORLD", "YES, SURE! I'LL TAKE IT FROM HER AND GIVE IT TO MY FRUSKYNSTEIN. THE WORLD WILL BE MINE WITH IT, HA, HA", "WHAT!? YOU'RE DEAD, MAN! I'M GOING TO...YOU REALLY GOT ME ANGRY MAN...COME ON, PREPARE TO DIE!", "HA, HA, HA. NOT EVEN IN YOUR WILDEST DREAMS!", @@ -3601,13 +3695,13 @@ const char *_textd[][84] = { "YES, ISN'T IT? HA, HA", "ALL RIGHT, ALL RIGHT. BUT DO IT QUICKLY, OK?", "PUT THAT CIGARETTE OUT NOW! I CAN'T STAND YOU ANYMORE!", - "AND SO, DOES THAT BREW HAVE THE OPPOSITE EFFECT?", - "WELL, WE'LL SEE THAT", + "SO, DOES THAT BREW HAVE IMMUNISATING EFFECTS FOR VAMPIRES??", + "WELL, WE'LL SEE ABOUT THAT", // 30 - "OK, LET'S SEE IT. IGOR, BRING ME THE CD \"SCRATCHING YOUR NAILS ALL OVER THE BLACKBOARD\"", + "OK, LET'S SEE. IGOR, BRING ME THE CD \"SCRATCHING YOUR NAILS ALL OVER THE BLACKBOARD\"", "NO WAY. THE GIRL STAYS WITH ME. YOU'RE STAYING THERE UNTIL THE PENDULUM CUTS YOU INTO THIN SLICES. HA, HA, HA", - "MAN I'M I JUST BAD... COME ON IGOR, LET'S MAKE THE BREW AND CONQUER THE WORLD", - "WHAT HAPPENED NOW?", + "MAN I'M SO BAD... COME ON IGOR, LET'S MAKE THE BREW AND CONQUER THE WORLD", + "WHATS HAPPENED NOW?", "YES, WHAT?...OH, DAMNED, THE GAME!", // 35 "I FORGOT ABOUT THAT. GET THE GIRL AND LET'S GO AND WATCH IT. WE CAN CONQUER THE WORLD LATER", @@ -3637,7 +3731,7 @@ const char *_textd[][84] = { "", "HI BLIND MAN. HOW IT'S GOING?", "HOW DO YOU KNOW I'M A FOREIGNER?", - "YOU LOOK BLIND. YOU'RE WEARING DARK GLASSES LIKE STEVIE WONDER", + "YOU LOOK BLIND. BECAUSE YOU'RE WEARING DARK GLASSES LIKE STEVIE WONDER", "LOOK, I'M SORRY, I DIDN'T KNOW YOU COULD SEE", // 60 "BUT YOU JUST TOLD ME YOU WEREN'T BLIND", @@ -3648,26 +3742,26 @@ const char *_textd[][84] = { // 65 "AH YES, I SUPPOSE THAT'S TRUE. GOODBYE SIGHTLESS PERSON... BLIND MAN", "HERE IS THE LARGE AMOUNT OF MONEY YOU ASKED ME FOR", - "YOU BETTER HAVE", + "I HOPE SO", "HI THERE FOREIGNER", "AND HOW DO YOU KNOW I'M BLIND?", // 70 - "AND I'M NOT KIDDING YOU BUT YOURS ARE LIKE WOODY ALLEN'S", + "AND I'M NOT KIDDING YOU BUT YOURS LOOK LIKE WOODY ALLEN'S", "NO, I CAN'T SEE", "AND I'M NOT", - "OH OF COURSE. JUST COS I CAN'T SEE, YOU ACCUSE ME OF BEING BLIND", + "OH OF COURSE. JUST BECAUSE I CAN'T SEE, YOU ACCUSE ME OF BEING BLIND", "HI THERE FOREIGNER! WHAT ARE YOU DOING IN TRANSILVANIA?", // 75 - "THAT'S RIGHT, FOREIGNER. IN EXCHANGE FOR A LARGE SUM OF MONEY I'LL GIVE YOU A SICKLE FOR WHEN YOU MIGHT NEED IT", + "THAT'S RIGHT, FOREIGNER. IN EXCHANGE FOR A LARGE SUM OF MONEY I'LL GIVE YOU A SICKLE YOU NEVER KNOW WHEN YOU MIGHT NEED IT", "SHHHH, I'M A SICKLES TRADER, THAT'S WHY I HAVE TO HIDE", "BECAUSE YOU TOLD ME BEFORE, DIDN'T YOU?", - "THANKS FOREIGNER. HERE'S THE SICKLE IN EXCHANGE. YOU'LL FIND IT REALLY USEFUL LATER ON, HONESTLY", + "THANKS FOREIGNER. HERE'S THE SICKLE IN EXCHANGE. YOU'LL FIND IT REALLY USEFUL LATER ON, HONESTLY.", "", // 80 "", "", - "No, nada", - "bla, bla, bla." + "NOTHING, NOTHING AT ALL", + "BLA, BLA, BLA." }, { // 0 @@ -4083,23 +4177,23 @@ const char *_textd[][84] = { }, }; -const char *_textb[][15] = { +const char *_textb[NUM_LANGS][NUM_TEXTB] = { { // 0 "", "I'M HERE, DRINKING", - "THEY ARE ALL DEAD, THANKS. BURP...", + "THEY ARE ALL DEAD, THANKS. HIC...!", "YES, SURE...", - "SHE FEELS ATTRACTED TO UNCLE DESIDERIO", + "SHE IS ATTRACTED TO UNCLE DESIDERIO", // 5 "EVEN BETTER, UNCLE DESIDERIO'S DEAD BODY", "MY UNCLE. HE WENT TO THE CASTLE AND NEVER CAME BACK", "WELL, HE CAME BACK JUST A LITTLE. IF ONLY VON BRAUN HADN'T SCREWED THINGS UP MY UNCLE WOULD BE DRINKING WITH US NOW", "NOTHING...", - "WELL, YES !. THAT MEAN MAN HAS TERRIFIED US ALL", + "WELL, YES! THAT MEAN MAN HAS TERRIFIED US ALL", // 10 "FROM TIME TO TIME HE COMES DOWN TO THE VILLAGE AND TAKES SOMEONE WITH HIM.", - "A LITTLE WHILE AFTER WE JUST A FEW FOUND BODY PARTS. I THINK HE IS DEALING IN ORGANS OR SOMETHING LIKE THAT", + "A LITTLE WHILE AFTER WE FOUND A FEW BODY PARTS. I THINK HE IS DEALING IN ORGANS OR SOMETHING LIKE THAT", "THE ONLY PERSON IN THE VILLAGE WHO KNOWS HOW TO GET TO DRASCULA IS A CULTIVATED PERSON", "HE LIVES IN A LOG-CABIN OUT OF TOWN, EVER SINCE DRASCULA BEAT HIM UP", "HE IS THE ONLY ONE WHO COULD HELP US WITH DRASCULA, AND HE DOESN'T WANT TO HEAR ABOUT IT. HOW DO YOU LIKE THAT?", @@ -4186,7 +4280,7 @@ const char *_textb[][15] = { }, }; -const char *_textbj[][29] = { +const char *_textbj[NUM_LANGS][NUM_TEXTBJ] = { { // 0 "", @@ -4199,12 +4293,12 @@ const char *_textbj[][29] = { "AS I OPENED THE DOOR I WAS SHOCKED TO FIND YOU THERE, LYING ON THE FLOOR. I THOUGHT YOU WERE DEAD, I SWEAR... HA, HA, SILLY BILLY", "I WAS GOING TO GIVE YOU THE KISS OF LIFE BUT IT WASN'T NECESSARY BECAUSE YOU STARTED TO TALK", "YOU SAID SOMETHING ABOUT A SCARECROW. I WAS VERY SCARED, YOU KNOW. IT'S A REAL SHOCK WHEN A DEAD PERSON STARTS TALKING?", - "ISN'T THAT RIGHT? WELL, THEN I MANAGED TO BRING YOU TO MY ROOM THE BEST WAY I COULD. I PUT YOU IN BED... AND THAT'S ALL... HA, HA, HA...", + "ISN'T THAT RIGHT? WELL, THEN I MANAGED TO BRING YOU TO MY ROOM THE BEST WAY I COULD. I PUT YOU IN MY BED... AND THAT'S ALL... HA, HA, HA...", // 10 "OH, NO...! IT WASN'T THE HIT, HA, HA. I JUST STEPPED ON YOUR GLASSES BY ACCIDENT", "YOU REALLY LOOK GOOD WITH THOSE GLASSES. I KNOW HE'S NOT FERNANDO LANCHA, BUT I FIND HIM ATTRACTIVE...", "YES, YES, I DO... COME ON, HOLD ME AND KISS ME TIGHT", - "OH JOHNNY, HONEY, THANK GOD YOU'RE HERE... THAT DAMNED DRASCULA TIED ME UP TO THE BED AND THEN HE'S GONE DOWNSTAIRS TO WATCH THE FOOTBALL GAME", + "OH JOHNNY, HONEY, THANK GOD YOU'RE HERE... THAT DAMNED DRASCULA TIED ME UP TO THE BED AND HE'S GONE DOWNSTAIRS TO WATCH THE FOOTBALL GAME", "YES, IT'S TRUE. PLEASE, SET ME FREE", // 15 "NO, I'M SORRY. I USED THEM ALL IN THE TOWER WHEN I WAS TRYING TO ESCAPE WHILE YOU LET ME DOWN", @@ -4221,7 +4315,7 @@ const char *_textbj[][29] = { // 25 "I'LL NEVER FORGET YOU BUT I'VE REALIZED THAT THIS JUST COULDN'T WORK OUT RIGHT. TO BE HONEST, I'LL TELL YOU THAT THERE IS ANOTHER MAN. HE'S TALLER, STRONGER", "AND HE HAS ALSO RESCUED ME FROM DRASCULA. HE HAS ASKED ME TO MARRY HIM, AND I HAVE ACCEPTED", - "BYE JOHNNY. PLEASE DON'T TRY TO FIND SOME KIND OF EXPLANATION. YOU KNOW LOVE IS BLIND AND HAS ITS OWN WAYS", + "BYE JOHNNY. PLEASE DON'T TRY TO FIND SOME KIND OF EXPLANATION. YOU KNOW LOVE IS BLIND AND HAS IT'S OWN WAYS", "I HOPE THERE WON'T BE HARD FEELINGS BETWEEN US. REMEMBER THAT I STILL LOVE YOU, BUT ONLY AS A FRIEND", }, { @@ -4270,7 +4364,7 @@ const char *_textbj[][29] = { "JA STELL DIR VOR, HEINZ, ICH WOLLTE MICH HIER GERADE HINLEGEN, ALS ICH EINEN LAUTEN KNALL IM FLUR HoeRTE", // 5 "ANFANGS HAB ICH NICHT SO DRAUF GEACHTET, ABER NACHDEM ICH 2 STUNDEN LANG NICHT SCHLAFEN KONNTE, GING ICH RUNTER, UM SPAZIERENZUGEHEN", - "ICH WAR NATueRLICH BAFF, ALS ICH DICH VOR der tuer LIEGEN SAH. ICH HABE ECHT GEDACHT,DASS DU TOT BIST, HEHE, WIE bloed" + "ICH WAR NATueRLICH BAFF, ALS ICH DICH VOR der tuer LIEGEN SAH. ICH HABE ECHT GEDACHT,DASS DU TOT BIST, HEHE, WIE bloed", "ICH WOLLTE GERADE MUND-ZU-MUND BEATMUNG MACHEN, ABER DANN FINGST DU JA AN ZU REDEN", "DU FASELTEST WAS VON NER VOGELSCHEUCHE UND ICH Hatte ganz schoen schiss,WEIL sprechende tote schon echt UNHEIMLICH sind?", "NICHT WAHR ?NAJA,ICH HABE DICH DANN AUFGEHOBEN UND IN MEIN ZIMMER GETRAGEN UND AUF MEIN BETT GELEGT.... WEITER NICHTS. HI,HI,HI", @@ -4375,7 +4469,7 @@ const char *_textbj[][29] = { }; -const char *_texte[][24] = { +const char *_texte[NUM_LANGS][NUM_TEXTE] = { { // 0 "", @@ -4387,10 +4481,10 @@ const char *_texte[][24] = { "SINCE ALCOHOL STILL KEEPS ME QUITE YOUNG, I'M HERE LIKE A SCRAP YARD. EVERYTIME HE NEEDS SOMETHING FOR THE MONSTER HE IS MAKING, HE COMES AND TAKES IT FROM ME", "IT HURT AT FIRST, BUT I DON'T CARE ANYMORE", "I DON'T KNOW. I GUESS IT'S HIS GRADUATE PROJECT", - "I'M DESIDERIO, AND I CAN HELP YOU IN ANYTHING YOU NEED", + "I'M DESIDERIO, AND I CAN HELP YOU WITH ANYTHING YOU NEED", "THE TRUTH IS THAT I DON'T REALLY FEEL LIKE IT, BUT THANKS VERY MUCH ANYWAY SIR", // 10 - "YEAH, IT'S YOU", + "TAKE IT, IT'S YOURS", "WHY DO ALL ADVENTURE GAMES END WITH A SUNRISE OR A SUNSET?", "DO ALL THESE NAMES BELONG TO THE CREATORS OF THE GAME?", "AREN'T THEY ASHAMED TO BE SEEN BY EVERYBODY?", @@ -4534,7 +4628,7 @@ const char *_texte[][24] = { }; -const char *_texti[][33] = { +const char *_texti[NUM_LANGS][NUM_TEXTI] = { { // 0 "", @@ -4543,10 +4637,10 @@ const char *_texti[][33] = { "I'M SORRY MASTER", "ARE YOU GOING TO BRING ANOTHER CRAZY SCIENTIST HERE? THE LABORATORY IS ALREADY FULL UP, AND BESIDES, THEY'RE ALL OUT OF DATE", // 5 - "HUSH MASTER, THE FEMINISTS COULD HEAR YOU", + "HUSH MASTER, THE FEMINISTS MIGHT HEAR YOU", "DAMN IT!", "I DIDN'T EXPECT YOU SO SOON, MASTER", - "QUITE BAD MASTER. THERE MUST BE SOME PROBLEMS WITH THE SATELLITE AND I JUST CAN'T RECEIVE ANYTHING. BESIDES THERE IS SOME INTERFERENCE BECAUSE OF THE STORM", + "QUITE BAD MASTER. THERE ARE SOME PROBLEMS WITH THE SATELLITE, I JUST CAN'T RECEIVE ANYTHING. THERE MUST BE SOME INTERFERENCE FROM THE STORM", "WHAT DO I KNOW, MASTER?", // 10 "YES, MY MASTER", @@ -4556,8 +4650,8 @@ const char *_texti[][33] = { "I'M IGOR, THE VALET. YOU CAN START WITH THE BALL ROOM. THERE'S BEEN A SUPER NATURAL ORGY IN THERE YESTERDAY AND IT LOOKS LIKE SHIT", // 15 "IF YOU NEED ANYTHING, JUST BUY IT", - "IT'S THE TAX RETURN APPLICATION FORM, CAN'T YOU SEE IT?", - "NEITHER DO I. FIRST OF ALL THE NUMBERS ARE VERY SMALL AND ALSO I CAN'T SEE MUCH AT THIS DISTANCE.", + "IT'S THE TAX RETURN APPLICATION FORM, CAN'T YOU SEE?", + "NEITHER DO I. THE NUMBERS ARE VERY SMALL AND I CAN'T SEE MUCH AT THIS DISTANCE.", "NO WAY! THEY MAKE ME LOOK UGLY", "OH, WELL. IT'S JUST LIKE A CRAZY PARTY THAT THE MASTER ORGANIZES WITH HIS FRIENDS EACH TIME SOME IDIOT COMES ALONG TRYING TO KILL HIM", // 20 @@ -4748,25 +4842,25 @@ const char *_texti[][33] = { }; -const char *_textl[][32] = { +const char *_textl[NUM_LANGS][NUM_TEXTL] = { { // 0 "", - "ARE YOU GOING TO LET OURSELVES BE GUIDED BY PRIMITIVE INSTINCTS JUST BECAUSE WE BELONG TO DIFFERENT RACES AND THE SOCIAL SITUATION IS TELLING US TO DO SO?", + "ARE YOU GOING TO LET YOURSELF BE GUIDED BY PRIMITIVE INSTINCTS JUST BECAUSE WE BELONG TO DIFFERENT RACES AND THE SOCIAL SITUATION IS TELLING US TO DO SO?", "AREN'T WE TIED BY SENSE? WHICH IS OUR MOST POWERFUL WEAPON AS WELL AS OUR MOST PRECIOUS GIFT?", "OH, IF WE ALL LET OUR THOUGHTS GUIDE OUR WAY IN LIFE WITHOUT LEAVING SOME ROOM FOR FEELINGS WHICH LET OUR PRE-EVOLUTIVE INSTINCTS COME OUT!", - "ANSWER ME, EPHEMERAL CREATURE. WOULDN'T WE ALL BE HAPPIER WITH THOSE EMOTIONAL BINDINGS?", + "ANSWER ME, EPHEMERAL CREATURE. WOULDN'T WE ALL BE HAPPIER WITHOUT THOSE EMOTIONAL BINDINGS?", // 5 "YOU ARE NOT GETTING THROUGH", "THIS IS A VERY CLEAR EXAMPLE, YOU SEE?: YOU WANT TO GET THROUGH AND GO AHEAD WITH YOUR ADVENTURE, AND I WON'T LET YOU DO THAT", - "WILL THAT BE A CONTROVERSIAL POINT BETWEEN US THAT HAVE JUST MET?", + "WILL THIS BE A CONTROVERSIAL POINT BETWEEN US AFTER WE HAVE ONLY JUST MET?", "WELL THEN", - "WELL, THAT DEPENDS ON WHAT WE TAKE A RELATIONSHIP FOR. SOME AUTHORS DEFEND...", + "WELL, THAT DEPENDS ON WHAT WE HAVE A RELATIONSHIP FOR. SOME AUTHORS DEFEND...", // 10 "YUCK! HUNTING AS A WAY TO SURVIVE IS AN INCOMPREHENSIBLE ARCHAIC THING FOR A SUPERIOR BEING LIKE ME. BESIDES, I'VE BECOME A VEGETARIAN", - "IT JUST SO HAPPENS THAT I WAS ACTUALLY EATING A GUY AND I STARTED TO THINK AND GET TO THE ABOVE MENTIONED THOUGHT", - "IT TOOK ME A LONG TIME TO QUIT OLD HABITS BUT AT LEAST MY IRASCIBLE SOUL BIT UP THE CONCUPISCIBLE ONE, AND EVER SINCE, I'VE NEVER EATEN MEAT AGAIN", - "NOT EVEN THE PLEASURE OF SUCKING UP THE BONE, FEELING THE TASTE OF THE SKIN AND THAT SWEET TASTE OF MARROW...THAT JUST TAKES YOU TO HEAVENLY PLACES", + "IT JUST SO HAPPENS THAT I WAS ACTUALLY EATING A GUY AND I STARTED TO THINK ABOUT THE ABOVE MENTIONED THOUGHT", + "IT TOOK ME A LONG TIME TO QUIT OLD HABITS BUT AT LEAST MY IRASCIBLE SOUL SWALLOWED UP THE CONCUPISCIBLE ONE, AND EVER SINCE, I'VE NEVER EATEN MEAT AGAIN", + "NOT EVEN THE PLEASURE OF SUCKING ON THE BONE, THE TASTE OF THE SKIN AND THAT SWEET TASTE OF MARROW...THAT JUST TAKES YOU TO HEAVENLY PLACES", "IT DOESN'T REALLY GET TO ME AT ALL", // 15 "WHAT?", @@ -4855,20 +4949,21 @@ const char *_textl[][32] = { "ICH WEISS NICHT, WOVON DU REDEST, DU EINTAGSFLIEGE", "DAS INTERESSIERT MICH NICHT", "ANDERE SPIELE, ACH ICH WEISS NICHT, ABER DAS HIER HAT SO EINE NETTE GRAFIK", - "ICH HaeTTE SCHON LUST..", + "", // 20 + "ICH HaeTTE SCHON LUST..", "NEIN, SO HEISSEN DER OPA, DER VATER, DER SOHN UND EIN FREUND.", "NEIN, ABER WENN NICHT, SIEHT ES SO AUS ALS WaeRE DAS SPIEL VON FueNF LEUTEN GEMACHT WORDEN", "DIESE JUNGS SIND VIELVERSPRECHEND !", "DER IST GUT, SUPERKLASSE !", - "NENN MICH KONSTANTIN", // 25 + "NENN MICH KONSTANTIN", "MANN, DAS WAR NICHT ICH, SONDERN MEIN DOUBLE, DER KOYOTE", "WOW, WAS FueR EINE LANGE DANKESLISTE", "ICH HAB SCHON DEN ueBERBLICK VERLOREN", "O.K. DESIDERIO, UND WAS WIRD JETZT AUS DIR WERDEN ?", - "ABER DANN MueSSTEST DU ABNEHMEN", // 30 + "ABER DANN MueSSTEST DU ABNEHMEN", "ICH WERDE NACH TIBET AUSWANDERN UND ueBER DEN SINN DES LEBENS NACHDENKEN", }, { @@ -4955,7 +5050,7 @@ const char *_textl[][32] = { }, }; -const char *_textp[][20] = { +const char *_textp[NUM_LANGS][NUM_TEXTP] = { { // 0 "", @@ -4966,12 +5061,12 @@ const char *_textp[][20] = { // 5 "REALLY?", "SO?", - "I'M SORRY. THE PIANIST UNION TRADE DOESN'T ALLOW ME TO SAVE GIRLS FROM VAMPIRES' CLUTCHES", + "I'M SORRY. THE PIANIST TRADE UNION DOESN'T ALLOW ME TO SAVE GIRLS FROM VAMPIRES' CLUTCHES", "IF SHE HAD BEEN KIDNAPPED BY THE WEREWOLF...", "I CAN ONLY PLAY THIS SONG", // 10 "I'M A CONSERVATOIRE PIANIST AND THE BARTENDER WON'T BUY MORE SCORES FOR ME", - "OH GOD, I REALLY LOVE CLASSIC MUSIC!", + "OH GOD, I REALLY LOVE CLASSICAL MUSIC!", "IT'S BECAUSE I'M WEARING EAR-PLUGS", "IT'S BECAUSE I CAN LIP-READ", "NOOO", @@ -4979,7 +5074,7 @@ const char *_textp[][20] = { "NO! I'M NOT TAKING THIS ANY LONGER!", "NO WAYYYYY!", "WHAT? OF COURSE I'M INTERESTED", - "THANKS GOD! I CAN PLAY A DIFFERENT SONG NOW!", + "THANK GOD! I CAN PLAY A DIFFERENT SONG NOW!", "I GUESS YOU CAN KEEP MY EAR-PLUGS", }, { @@ -5089,7 +5184,7 @@ const char *_textp[][20] = { }; -const char *_textt[][25] = { +const char *_textt[NUM_LANGS][NUM_TEXTT] = { { // 0 "", @@ -5101,7 +5196,7 @@ const char *_textt[][25] = { "WELL, THERE ARE ALL KINDS OF STORIES GOING AROUND ABOUT HIM, SOME SAY HE IS A VAMPIRE WHO KIDNAPS PEOPLE TO SUCK THEIR BLOOD", "HOWEVER, SOME OTHERS SAY THAT HE IS JUST AN ORGAN-DEALER AND THAT IS THE REASON WHY THERE ARE BODY PARTS ALL OVER THE PLACE", "BUT OF COURSE, THOSE ARE JUST RUMORS. HE'S PROBABLY BOTH THINGS. BY THE WAY, WHY DO YOU WANT TO MEET HIM?", - "HERE IS YOUR DRINK, FORGET IT. I'M REALLY BUSY...", + "FORGET IT. I'M REALLY BUSY...", "WELL, OK. BUT JUST BECAUSE I WANT TO DO IT, NOT BECAUSE YOU TOLD ME TO", // 10 "THEY'RE WINNING", @@ -5253,42 +5348,42 @@ const char *_textt[][25] = { }; -const char *_textvb[][63] = { +const char *_textvb[NUM_LANGS][NUM_TEXTVB] = { { // 0 "", "WHO THE HELL IS CALLING AT THIS TIME?", "OH, ..OH, NO, NO....I'M...GANIMEDES THE DWARF. PROFESSOR VON BRAUN DOESN'T LIVE HERE ANYMORE", - "NO, I DON'T KNOW WHERE IT IS !!", + "NO, I DON'T KNOW WHERE HE LIVES !!", "GET OUT!!", // 5 "IT'S TOO LATE NOW, YOU IDIOT!! IT ALWAYS IS", "I COULDN'T AGREE MORE", "ME, SCARED?", - "LISTEN HERE, DUDE. YOU'RE TALKING TO THE ONLY PERSON WHO KNOWS THE SECRET OF HOW TO FIGHT AGAINST THE VAMPIRE", + "LISTEN HERE, DUDE. YOU'RE TALKING TO THE ONLY PERSON WHO KNOWS THE SECRET OF HOW TO FIGHT AGAINST THE VAMPIRES", "YOU NEED TO HAVE SPECIAL SKILLS TO FIGHT AGAINST A VAMPIRE. NOT EVERYBODY CAN DO IT", // 10 "YOU DON'T HAVE THEM", "I'M SURE YOU WOULDN'T BET ALL YOUR MONEY ON IT, HUH?", "WELL, ALL RIGHT, COME ON IN", - "IF YOU REALLY MEAN TO FACE DRASCULA, YOU'VE GOT TO BE ABLE TO TAKE ALL TYPES OF CREAKING AND VAMPIRE-LIKE NOISES", + "IF YOU REALLY MEAN TO FACE DRASCULA, YOU'VE GOT TO BE ABLE TO STAND ALL TYPES OF CREAKING AND VAMPIRE-LIKE NOISES", "IS THAT CLEAR?", // 15 "OK, WAIT A MINUTE", "STAND IN THE CENTER OF THE ROOM, PLEASE", - "WHERE DID I PUT THAT RECORD CALLED \"NAILS SCRATCHING THE BLACKBOARD\"?", + "NOW WHERE DID I PUT THE RECORD CALLED \"NAILS SCRATCHING THE BLACKBOARD\"?", "ALL RIGHT. LET'S GET TO IT", "YOU ARE USELESS. YOU SEE...?, JUST LIKE THE REST!!", // 20 "JUST GIVE ME THE MONEY, YOU LOST SO GET OUT OF HERE", "AND DON'T COME BACK UNTIL YOU ARE ABSOLUTELY READY", "WHAT DO YOU WANT NOW?", - "I HAVE TO ADMIT IT. YOU REALLY GOT WHAT IT TAKES TO FIGHT AGAINST THE VAMPIRES", - "HEY, TAKE YOUR MONEY. I ADMIT IT WHEN I MAKE A MISTAKE...", + "I HAVE TO ADMIT IT. YOU REALLY HAVE WHAT IT TAKES TO FIGHT AGAINST THE VAMPIRES", + "HEY, TAKE YOUR MONEY. I'LL ADMIT IT. I MAKE A MISTAKE...", // 25 "LEAVE ME ALONE NOW, I WANT TO GET SOME SLEEP", "WHENEVER YOU ARE READY TO FIGHT AGAINST THE VAMPIRES, JUST COME BACK AND I'LL HELP YOU OUT", - "OH, THAT'S EASY. TAKE THIS CRUCIFIX JUST USING THE LIGHT OF THIS CRUCIFIX IS ENOUGH TO DESTROY HIM", + "OH, THAT'S EASY. TAKE THIS CRUCIFIX JUST USING IT'S LIGHT IS ENOUGH TO DESTROY A VAMPIRE", "YOU HAVE TO BE EXTRA CAREFUL WITH DRASCULA, HIS FRISISNOTIC POWERS HAVE MADE OF HIM THE MOST POWERFUL VAMPIRE", "YOU'D BE LOST IF IT WASN'T FOR THIS...", // 30 @@ -5328,8 +5423,8 @@ const char *_textvb[][63] = { "ARE YOU JOHN HACKER? I'M DOCTOR VON BRAUN", "LISTEN TO ME, THIS IS VERY IMPORTANT. IT'S ABOUT THE BREW", // 60 - "SHUT UP AND LET ME TALK. I JUST FOUND THIS BOOK ABOUT ANTI-VAMPIRE BREWS WARNING AGAINST MIXING THE CIGARETTE WITH ANY ALCOHOLIC DRINK BEFORE YOU", - "ALCOHOL REACTS WHEN MIXED WITH BREW, SO THAT IT CANCELS OUT ITS EFFECTS IN A FEW SECONDS", + "SHUT UP AND LET ME TALK. I JUST FOUND THIS BOOK ABOUT ANTI-VAMPIRE BREWS WARNING AGAINST MIXING THE CIGARETTE WITH ANY ALCOHOLIC DRINK", + "ALCOHOL REACTS WHEN MIXED WITH BREW, SO THAT IT CANCELS OUT IT'S EFFECTS IN A FEW SECONDS", "I'M SORRY, BUT I HAVE TO HANG UP RIGHT NOW. THE POLICE ARE LOOKING FOR ME, THEY THINK I'M A DRUG PUSHER. IDIOTS!. ANYWAY, BYE AND GOOD LUCK SAVING THE WORLD!", }, { @@ -5647,7 +5742,7 @@ const char *_textvb[][63] = { }; -const char *_textsys[][4] = { +const char *_textsys[NUM_LANGS][NUM_TEXTSYS] = { { "PRESS 'DEL' AGAIN TO RESTART", "PRESS 'ESC' AGAIN TO EXIT", @@ -5681,11 +5776,11 @@ const char *_textsys[][4] = { }; -const char *_texthis[][5] = { +const char *_texthis[NUM_LANGS][NUM_TEXTHIS] = { { "", "A long time ago, it seems that Drascula killed Von Braun's wife, and then, as he intended to face the count, Von Braun started to research all he could find on vampires.", - "When he thought he was ready, he came up to the castle and had a very violent encounter with Drascula.", + "When he thought he was ready, he went up to the castle and had a very violent encounter with Drascula.", "Nobody knows exactly what happened there. Although Von Braun lost, Drascula could not kill him.", "Von Braun felt humiliated by his defeat, he run away from the castle and has never dared to face Drascula again.", }, @@ -5720,7 +5815,7 @@ const char *_texthis[][5] = { }; -const char *_textd1[][11] = { +const char *_textd1[NUM_LANGS][NUM_TEXTD1] = { { // 68 "44472225500022227555544444664447222550002222755554444466", @@ -5805,7 +5900,7 @@ const char *_textd1[][11] = { }; -const char *_textverbs[][6] = { +const char *_textverbs[NUM_LANGS][NUM_TEXTVERBS] = { { "look", "take", @@ -5849,29 +5944,32 @@ const char *_textverbs[][6] = { }; -const char *_textmisc[][2] = { +const char *_textmisc[NUM_LANGS][NUM_TEXTMISC] = { { "HUNCHBACKED", "Transilvania, 1993 d.c.", + "GOOOOOOOAAAAAAAL!", }, { "jorobado", "Transilvania, 1993 d.c. (despues de cenar)", + "GOOOOOOOOOOOOOOOL", }, { "HUNCHBACKED", "Transilvania, 1993 d.c.", + "GOOOOOOOAAAAAAAL!", }, { "HUNCHBACKED", "Transilvania, 1993 d.c.", + "GOOOOOOOAAAAAAAL!", }, { "HUNCHBACKED", "Transilvania, 1993 d.c.", + "GOOOOOOOAAAAAAAL!", }, }; -} // End of namespace Drascula - #endif /* STATICDATA_H */ |