diff options
51 files changed, 507 insertions, 130 deletions
diff --git a/audio/mods/maxtrax.cpp b/audio/mods/maxtrax.cpp index f5754a5f96..b0cdaef95a 100644 --- a/audio/mods/maxtrax.cpp +++ b/audio/mods/maxtrax.cpp @@ -708,7 +708,7 @@ int8 MaxTrax::noteOn(ChannelContext &channel, const byte note, uint16 volume, ui voiceNum = pickvoice((channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 1 : 0, pri); } else { VoiceContext *voice = ARRAYEND(_voiceCtx); - for (voiceNum = ARRAYSIZE(_voiceCtx); voiceNum-- != 0 && --voice->channel != &channel;) + for (voiceNum = ARRAYSIZE(_voiceCtx); voiceNum >= 0 && voice->channel != &channel; voiceNum--, voice--) ; if (voiceNum < 0) voiceNum = pickvoice((channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 1 : 0, pri); diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk index 38128c62b0..4a29526941 100644 --- a/backends/platform/android/android.mk +++ b/backends/platform/android/android.mk @@ -1,7 +1,7 @@ # Android specific build targets # These must be incremented for each market upload -ANDROID_VERSIONCODE = 6 +ANDROID_VERSIONCODE = 16 ANDROID_TARGET_VERSION = 23 @@ -992,8 +992,8 @@ Optional Libraries: installed (optional) --disable-fluidsynth disable fluidsynth MIDI driver [autodetect] - --with-sparkle-prefix=DIR Prefix where sparkle is installed (Mac OS X only - optional) - --disable-sparkle disable sparkle automatic update support [Mac OS X only - autodetect] + --with-sparkle-prefix=DIR Prefix where sparkle is installed (OS X/Windows only - optional) + --disable-sparkle disable sparkle automatic update support [OS X/Windows only - autodetect] --disable-osx-dock-plugin disable the NSDockTilePlugin support [Mac OS X only - autodetect] @@ -4038,6 +4038,31 @@ EOF fi echo "$_sparkle" ;; + mingw*) + echocheck "Sparkle" + if test "$_updates" = no; then + _sparkle=no + else + if test ! -z $_sparklepath ; then + SPARKLE_CFLAGS="-I$_sparklepath/include" + SPARKLE_LIBS="-L$_sparklepath/Release -L$_sparklepath/x64/Release" + fi + if test "$_sparkle" = auto ; then + _sparkle=no + cat > $TMPC << EOF +#include <winsparkle.h> +int main(void) { win_sparkle_get_update_check_interval(); return 0; } +EOF + cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -lWinSparkle && _sparkle=yes + fi + if test "$_sparkle" = yes ; then + append_var LIBS "$SPARKLE_LIBS -lWinSparkle" + append_var INCLUDES "$SPARKLE_CFLAGS" + fi + define_in_config_if_yes "$_sparkle" 'USE_SPARKLE' + fi + echo "$_sparkle" + ;; *) _sparkle=no ;; diff --git a/dists/androidsdl/scummvm/AndroidAppSettings.cfg b/dists/androidsdl/scummvm/AndroidAppSettings.cfg index 73d794e1ab..d9f05ad2f4 100644 --- a/dists/androidsdl/scummvm/AndroidAppSettings.cfg +++ b/dists/androidsdl/scummvm/AndroidAppSettings.cfg @@ -41,7 +41,7 @@ NeedGles2=n # Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, # this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) -SwVideoMode=n +SwVideoMode=y # Application video output will be resized to fit into native device screen (y)/(n) SdlVideoResize=y @@ -165,16 +165,16 @@ FirstStartMenuOptions='' # Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, # but .apk size is 2x bigger (y) / (n) / (x86) / (all) -MultiABI="armeabi-v7a" +MultiABI="armeabi" # Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=256 # Application version code (integer) -AppVersionCode=19002 +AppVersionCode=@ANDROID_VERSIONCODE@ # Application user-visible version name (string) -AppVersionName="1.9.0git1661" +AppVersionName="1.9.0git" # Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=y @@ -227,4 +227,4 @@ AdmobBannerSize= UseGlshim=n -AccessSdCard=y
\ No newline at end of file +AccessSdCard=y diff --git a/dists/androidsdl/scummvm/AndroidAppSettings.cfg.in b/dists/androidsdl/scummvm/AndroidAppSettings.cfg.in new file mode 100644 index 0000000000..bb437d2a7d --- /dev/null +++ b/dists/androidsdl/scummvm/AndroidAppSettings.cfg.in @@ -0,0 +1,230 @@ +# The application settings for Android libSDL port + +AppSettingVersion=19 + +# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) +LibSdlVersion=1.2 + +# Specify application name (e.x. My Application) +AppName="ScummVM-SDL" + +# Specify reversed site name of application (e.x. com.mysite.myapp) +AppFullName=org.scummvm.sdl + +# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape +ScreenOrientation=h + +# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer +InhibitSuspend=y + +# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' +# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu +# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped +# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - +# these files are put inside .apk package by build system +# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS +AppDataDownloadUrl="!!App data|scummvm190-git-appdata.zip" + +# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only +# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) +VideoDepthBpp=32 + +# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedDepthBuffer=y + +# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) +NeedStencilBuffer=y + +# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# you need this option only if you're developing 3-d app (y) or (n) +NeedGles2=n + +# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, +# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) +SwVideoMode=n + +# Application video output will be resized to fit into native device screen (y)/(n) +SdlVideoResize=y + +# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) +SdlVideoResizeKeepAspect=n + +# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - +# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) +CompatibilityHacks=n + +# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) +CompatibilityHacksStaticInit=n + +# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) +CompatibilityHacksTextInputEmulatesHwKeyboard=y +TextInputKeyboard=1 + +# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) +CompatibilityHacksPreventAudioChopping=n + +# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) +CompatibilityHacksAppIgnoresAudioBufferSize=n + +# Hack for VCMI: preload additional shared libraries before aplication start +CompatibilityHacksAdditionalPreloadedSharedLibraries="" + +# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - +# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) +CompatibilityHacksSlowCompatibleEventQueue=n + +# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL +CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=y + +# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user +AppUsesMouse=y + +# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) +AppNeedsTwoButtonMouse=y + +# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) +ShowMouseCursor=n + +# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) +ForceRelativeMouseMode=n + +# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) +AppNeedsArrowKeys=n + +# Application needs text input (y) or (n), enables button for text input on screen +AppNeedsTextInput=y + +# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 +AppUsesJoystick=n + +# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) +AppUsesSecondJoystick=n + +# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 +AppUsesAccelerometer=n + +# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 +AppUsesGyroscope=n + +# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 +AppUsesMultitouch=y + +# Application records audio (it will use any available source, such a s microphone) +# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); +# This option will add additional permission to Android manifest (y)/(n) +AppRecordsAudio=n + +# Application implements Android-specific routines to put to background, and will not draw anything to screen +# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them +# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) +# This option is reported to be buggy, sometimes failing to restore video state +NonBlockingSwapBuffers=n + +# Redefine common hardware keys to SDL keysyms +# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent +# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices +# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) +# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA +RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP ESCAPE LCTRL F7 F4 F2 MOUSE_LEFT" + +# Number of virtual keyboard keys (currently 6 is maximum) +AppTouchscreenKeyboardKeysAmount=0 + +# Number of virtual keyboard keys that support autofire (currently 2 is maximum) +AppTouchscreenKeyboardKeysAmountAutoFire=0 + +# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) +RedefinedKeysScreenKb="MOUSE_RIGHT F7 LCTRL" + +# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu +RedefinedKeysScreenKbNames="MOUSE_RIGHT F7 LCTRL" + +# On-screen keys theme +# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick) +# 1 = Simple Theme by Beholder (white, with gamepad joystick) +# 2 = Sun by Sirea (yellow, with round joystick) +# 3 = Keen by Gerstrong (multicolor, with round joystick) +TouchscreenKeysTheme=1 + +# Redefine gamepad keys to SDL keysyms, button order is: +# A B X Y L1 R1 L2 R2 LThumb RThumb +RedefinedKeysGamepad="MOUSE_RIGHT F7 LCTRL ESCAPE F5 SPACE RETURN MOUSE_LEFT" + +# How long to show startup menu button, in msec, 0 to disable startup menu +StartupMenuButtonTimeout=3000 + +# Menu items to hide from startup menu, available menu items: +# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout +HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig' + +# Menu items to show at startup - this is Java code snippet, leave empty for default +# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration() +# Available menu items: +# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout +FirstStartMenuOptions='' + +# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, +# but .apk size is 2x bigger (y) / (n) / (x86) / (all) +MultiABI="armeabi-v7a" + +# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower +AppMinimumRAM=256 + +# Application version code (integer) +AppVersionCode=@ANDROID_VERSIONCODE@ + +# Application user-visible version name (string) +AppVersionName="@VERSION@" + +# Reset SDL config when updating application to the new version (y) / (n) +ResetSdlConfigForThisVersion=y + +# Delete application data files when upgrading (specify file/dir paths separated by spaces) +DeleteFilesOnUpgrade="%" + +# Optional shared libraries to compile - removing some of them will save space +# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed +# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 +CompiledLibraries="mad vorbis flac ogg jpeg png theora freetype faad" + +# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) +CustomBuildScript=y + +# Aditional CFLAGS for application +AppCflags='' + +# Additional LDFLAGS for application +AppLdflags='' + +# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable +AppOverlapsSystemHeaders= + +# Build only following subdirs (empty will build all dirs, ignored with custom script) +AppSubdirsBuild='' + +# Exclude these files from build +AppBuildExclude='' + +# Application command line parameters, including app name as 0-th param +AppCmdline='' + +# Here you may type readme text, which will be shown during startup. Format is: +# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) +ReadmeText='^You may press "Home" now - the data will be downloaded in background' + +# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens +# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge +MinimumScreenSize=s + +# Your AdMob Publisher ID, (n) if you don't want advertisements +AdmobPublisherId=n + +# Your AdMob test device ID, to receive a test ad +AdmobTestDeviceId= + +# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) +AdmobBannerSize= + +UseGlshim=n + +AccessSdCard=y diff --git a/dists/androidsdl/scummvm/AndroidBuild.sh b/dists/androidsdl/scummvm/AndroidBuild.sh index a7bf6ed446..5cc6863f5e 100644 --- a/dists/androidsdl/scummvm/AndroidBuild.sh +++ b/dists/androidsdl/scummvm/AndroidBuild.sh @@ -10,6 +10,6 @@ ln -sf libtheora.so $LOCAL_PATH/../../../obj/local/$1/libtheoradec.so ln -sf libglshim.a $LOCAL_PATH/../../../obj/local/$1/libGL.a if [ \! -f scummvm/config.mk ] ; then - ../setEnvironment-$1.sh sh -c "cd scummvm && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ./configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --enable-vkeybd --enable-verbose-build --disable-readline --disable-nasm --disable-mt32emu --disable-timidity --disable-fluidsynth --opengl-mode=gles --enable-all-engines --datadir=. " + ../setEnvironment-$1.sh sh -c "cd scummvm && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ./configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --enable-vkeybd --enable-release --disable-readline --disable-nasm --disable-mt32emu --disable-timidity --disable-fluidsynth --datadir=. " fi ../setEnvironment-$1.sh make -C scummvm -j2 && cp -f scummvm/scummvm libapplication-$1.so diff --git a/engines/gnap/character.cpp b/engines/gnap/character.cpp index 36d849acbf..56e520068d 100644 --- a/engines/gnap/character.cpp +++ b/engines/gnap/character.cpp @@ -402,22 +402,12 @@ int PlayerGnap::getSequenceId(int kind, Common::Point gridPos) { case kGSMoan1: if (gridPos.x > 0 && gridPos.y > 0) { - if (_pos.y > gridPos.y) { - if (_pos.x > gridPos.x) { - sequenceId = 0x832; - _idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _idleFacing = kDirBottomRight; - } + if (_pos.x > gridPos.x) { + sequenceId = 0x832; + _idleFacing = kDirBottomLeft; } else { - if (_pos.x > gridPos.x) { - sequenceId = 0x832; - _idleFacing = kDirBottomLeft; - } else { - sequenceId = 0x7AA; - _idleFacing = kDirBottomRight; - } + sequenceId = 0x7AA; + _idleFacing = kDirBottomRight; } } else if (_idleFacing != kDirBottomRight && _idleFacing != kDirUpRight) { sequenceId = 0x832; diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index a7e9eece4a..4445fcdea6 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -154,11 +154,10 @@ SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int s return SaveStateDescriptor(); } - char saveName[256]; + Common::String saveName; char ch; - int i = 0; while ((ch = (char)file->readByte()) != '\0') - saveName[i++] = ch; + saveName += ch; SaveStateDescriptor desc(slot, saveName); diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index e59662f08a..d31854d06e 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -48,6 +48,7 @@ GameSys::GameSys(GnapEngine *vm) : _vm(vm) { _removeSequenceItemValue = 0; _gfxItemsCount = 0; _animationsCount = 0; + _animationsDone = false; _backgroundImageValue3 = 0; _backgroundImageValue1 = 0; _backgroundImageValue4 = 1000; @@ -167,6 +168,9 @@ void GameSys::requestRemoveSequence(int sequenceId, int id) { void GameSys::waitForUpdate() { //ResetEvent(updateEvent); //WaitForSingleObject(updateEvent, INFINITE); + while ( !_animationsDone) { + _vm->gameUpdateTick(); + } } int GameSys::isSequenceActive(int sequenceId, int id) { @@ -638,9 +642,9 @@ void GameSys::blitSurface32(Graphics::Surface *destSurface, int x, int y, Graphi byte *rsrc = src; byte *rdst = dst; for (int xc = 0; xc < width; ++xc) { - uint32 pixel = READ_LE_UINT32(rsrc); + uint32 pixel = READ_UINT32(rsrc); if (!transparent || pixel != 0xFFFFFF00) - WRITE_LE_UINT32(rdst, pixel); + WRITE_UINT32(rdst, pixel); rsrc += 4; rdst += 4; } @@ -1006,6 +1010,8 @@ void GameSys::fatUpdateFrame() { if (clockDelta <= 0) return; + _animationsDone = true; + int duration, currFrameNum; for (int i = 0; i < _gfxItemsCount; ++i) { @@ -1091,10 +1097,12 @@ void GameSys::fatUpdateFrame() { } else { gfxItem->_prevFrame._duration -= duration; gfxItem->_updFlag = false; + _animationsDone = false; } } else { gfxItem->_delayTicks -= clockDelta; gfxItem->_updFlag = false; + _animationsDone = false; } } } else { @@ -1132,6 +1140,7 @@ void GameSys::fatUpdateFrame() { gfxItem->_currFrame._rect = _newSpriteDrawItems[k]._rect; gfxItem->_currFrame._spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO gfxItem->_currFrame._soundId = -1; + _animationsDone = false; } } _newSpriteDrawItemsCount = 0; @@ -1149,6 +1158,7 @@ void GameSys::fatUpdateFrame() { gfxItem->_currFrame._soundId = -1; gfxItem->_updFlag = true; gfxItem->_surface = _grabSpriteSurface2; + _animationsDone = false; break; } } @@ -1175,6 +1185,7 @@ void GameSys::fatUpdateFrame() { found = true; } if (found) { + _animationsDone = false; seqRemoveGfx(seqItem->_sequenceId2, seqItem->_id2); seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); _fatSequenceItems.remove_at(i); @@ -1197,6 +1208,7 @@ void GameSys::fatUpdateFrame() { found = true; } if (found) { + _animationsDone = false; seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); _fatSequenceItems.remove_at(i); --i; @@ -1220,6 +1232,7 @@ void GameSys::fatUpdateFrame() { seqRemoveGfx(seqItem->_sequenceId, seqItem->_id); seqInsertGfx(i, gfxDuration); } + _animationsDone = false; } } else { _seqItems.remove_at(i); diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h index 98014f1bac..b9752bde06 100644 --- a/engines/gnap/gamesys.h +++ b/engines/gnap/gamesys.h @@ -167,6 +167,8 @@ public: int _backgroundImageValue4, _backgroundImageValue2; int32 _gameSysClock, _lastUpdateClock; + bool _animationsDone; + Graphics::Surface *_backgroundSurface; Graphics::Surface *_frontSurface; diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index ed2d25f3de..76818181a5 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -138,6 +138,31 @@ GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) : _savegameSprites[i] = nullptr; for (int i = 0; i < 30; i++) _menuInventorySprites[i] = nullptr; + + _newSceneNum = 0; + _sceneDone = false; + _inventory = 0; + _gameFlags = 0; + _hotspotsCount = 0; + _sceneClickedHotspot = -1; + _isLeavingScene = false; + _isStockDatLoaded = false; + _newCursorValue = 0; + _cursorValue = 0; + _verbCursor = 0; + _cursorIndex = -1; + _leftClickMouseX = 0; + _leftClickMouseY = 0; + _grabCursorSprite = nullptr; + _grabCursorSpriteIndex = 0; + _newGrabCursorSpriteIndex = 0; + _fullScreenSprite = nullptr; + _fullScreenSpriteId = 0; + _deviceX1 = 0; + _deviceY1 = 0; + _soundTimerIndexA = 0; + _soundTimerIndexB = 0; + _soundTimerIndexC = 0; } GnapEngine::~GnapEngine() { @@ -148,7 +173,11 @@ GnapEngine::~GnapEngine() { Common::Error GnapEngine::run() { // Initialize the graphics mode to RGBA8888 +#if defined(SCUMM_BIG_ENDIAN) + Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24); +#else Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); +#endif initGraphics(800, 600, true, &format); // We do not support color conversion yet @@ -235,11 +264,11 @@ void GnapEngine::updateEvents() { _debugger->onFrame(); } - _keyPressState[event.kbd.keycode] = 1; - _keyDownState[event.kbd.keycode] = 1; + _keyPressState[event.kbd.keycode] = true; + _keyDownState[event.kbd.keycode] = true; break; case Common::EVENT_KEYUP: - _keyDownState[event.kbd.keycode] = 0; + _keyDownState[event.kbd.keycode] = false; break; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; @@ -627,19 +656,19 @@ void GnapEngine::removeDeviceIconActive() { void GnapEngine::setDeviceHotspot(int hotspotIndex, int x1, int y1, int x2, int y2) { _deviceX1 = x1; - _deviceX2 = x2; _deviceY1 = y1; - _deviceY2 = y2; + int deviceX2 = x2; + int deviceY2 = y2; if (x1 == -1) _deviceX1 = 730; if (x2 == -1) - _deviceX2 = 780; + deviceX2 = 780; if (y1 == -1) _deviceY1 = 14; if (y2 == -1) - _deviceY2 = 79; + deviceY2 = 79; - _hotspots[hotspotIndex]._rect = Common::Rect(_deviceX1, _deviceY1, _deviceX2, _deviceY2); + _hotspots[hotspotIndex]._rect = Common::Rect(_deviceX1, _deviceY1, deviceX2, deviceY2); _hotspots[hotspotIndex]._flags = SF_TALK_CURSOR | SF_GRAB_CURSOR | SF_LOOK_CURSOR; } @@ -959,21 +988,19 @@ void GnapEngine::screenEffect(int dir, byte r, byte g, byte b) { } bool GnapEngine::isKeyStatus1(int key) { - return _keyPressState[key] != 0; + return _keyPressState[key]; } bool GnapEngine::isKeyStatus2(int key) { - return _keyDownState[key] != 0; + return _keyDownState[key]; } void GnapEngine::clearKeyStatus1(int key) { - _keyPressState[key] = 0; - _keyDownState[key] = 0; + _keyPressState[key] = false; + _keyDownState[key] = false; } void GnapEngine::clearAllKeyStatus1() { - _keyStatus1[0] = 0; - _keyStatus1[1] = 0; memset(_keyPressState, 0, sizeof(_keyPressState)); memset(_keyDownState, 0, sizeof(_keyDownState)); } diff --git a/engines/gnap/gnap.h b/engines/gnap/gnap.h index 84c40e2969..dbefa31795 100644 --- a/engines/gnap/gnap.h +++ b/engines/gnap/gnap.h @@ -253,8 +253,8 @@ public: int _lastUpdateClock; bool _gameDone; - byte _keyPressState[512]; - byte _keyDownState[512]; + bool _keyPressState[512]; + bool _keyDownState[512]; bool _isPaused; Graphics::Surface *_pauseSprite; @@ -263,8 +263,6 @@ public: MouseButtonState _mouseButtonState; MouseButtonState _mouseClickState; - uint32 _keyStatus1[2]; - bool _sceneSavegameLoaded, _wasSavegameLoaded; Graphics::Surface *_backgroundSurface; @@ -296,7 +294,7 @@ public: Graphics::Surface *_fullScreenSprite; int _fullScreenSpriteId; - int _deviceX1, _deviceY1, _deviceX2, _deviceY2; + int _deviceX1, _deviceY1; int _soundTimerIndexA; int _soundTimerIndexB; diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp index 8244213a7f..c6390082b1 100644 --- a/engines/gnap/resource.cpp +++ b/engines/gnap/resource.cpp @@ -101,6 +101,10 @@ SpriteResource::SpriteResource(byte *data, uint32 size) { _colorsCount = READ_LE_UINT16(_data + 10); _palette = (uint32 *)(_data + 12); _pixels = _data + 12 + _colorsCount * 4; +#if defined(SCUMM_BIG_ENDIAN) + for (uint16 c = 0; c < _colorsCount; ++c) + _palette[c] = SWAP_BYTES_32(_palette[c]); +#endif debugC(kDebugBasic, "SpriteResource() width: %d; height: %d; colorsCount: %d", _width, _height, _colorsCount); } diff --git a/engines/gnap/scenes/arcade.cpp b/engines/gnap/scenes/arcade.cpp index 028a9006d0..db4999cb43 100644 --- a/engines/gnap/scenes/arcade.cpp +++ b/engines/gnap/scenes/arcade.cpp @@ -918,7 +918,6 @@ void Scene50::run() { _timesPlayedModifier = _timesPlayed / 4; _leftTongueRoundsWon = 0; _rightTongueRoundsWon = 0; - // initFont(); _leftTongueSequenceId = 186; _rightTongueSequenceId = 194; _rightTongueNextSequenceId = -1; @@ -1884,6 +1883,7 @@ Scene52::Scene52(GnapEngine *vm) : Scene(vm) { _aliensCount = 0; _nextUfoSequenceId = -1; _ufoSequenceId = -1; + _liveAlienRows = 0; } int Scene52::init() { @@ -2639,8 +2639,8 @@ void Scene52::run() { _shipMidY = _vm->_gameSys->getSpriteHeightById(15); _shipPosX = (800 - _shipMidX) / 2; _arcadeScreenBottom = 496; - _arcadeScreenRight = 595 - _shipMidX; - _arcadeScreenLeft = 210; + int arcadeScreenRight = 595 - _shipMidX; + int arcadeScreenLeft = 210; _shipsLeft = 3; _alienCounter = 0; @@ -2682,10 +2682,10 @@ void Scene52::run() { while (_vm->isKeyStatus2(Common::KEYCODE_RIGHT)) { update(); if (_vm->_gameSys->getAnimationStatus(7) == 2) { - if (_shipPosX < _arcadeScreenRight) { + if (_shipPosX < arcadeScreenRight) { _shipPosX += 15; - if (_shipPosX > _arcadeScreenRight) - _shipPosX = _arcadeScreenRight; + if (_shipPosX > arcadeScreenRight) + _shipPosX = arcadeScreenRight; _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7); _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom); _ufoSequenceId = _nextUfoSequenceId; @@ -2699,10 +2699,10 @@ void Scene52::run() { while (_vm->isKeyStatus2(Common::KEYCODE_LEFT)) { update(); if (_vm->_gameSys->getAnimationStatus(7) == 2) { - if (_shipPosX > _arcadeScreenLeft) { + if (_shipPosX > arcadeScreenLeft) { _shipPosX -= 15; - if (_shipPosX < _arcadeScreenLeft) - _shipPosX = _arcadeScreenLeft; + if (_shipPosX < arcadeScreenLeft) + _shipPosX = arcadeScreenLeft; _vm->_gameSys->setAnimation(_nextUfoSequenceId, 256, 7); _vm->_gameSys->insertSequence(_nextUfoSequenceId, 256, _ufoSequenceId, 256, kSeqSyncWait, 0, _shipPosX, _arcadeScreenBottom); _ufoSequenceId = _nextUfoSequenceId; diff --git a/engines/gnap/scenes/arcade.h b/engines/gnap/scenes/arcade.h index e472e00508..ab519ee00b 100644 --- a/engines/gnap/scenes/arcade.h +++ b/engines/gnap/scenes/arcade.h @@ -216,8 +216,6 @@ private: int _liveAlienRows; int _gameScore; bool _soundToggle; - int _arcadeScreenLeft; - int _arcadeScreenRight; int _arcadeScreenBottom; int _shipsLeft; int _shieldSpriteIds[3]; diff --git a/engines/gnap/scenes/group2.cpp b/engines/gnap/scenes/group2.cpp index 522a3f4337..1db3144c2d 100644 --- a/engines/gnap/scenes/group2.cpp +++ b/engines/gnap/scenes/group2.cpp @@ -1021,6 +1021,7 @@ Scene22::Scene22(GnapEngine *vm) : Scene(vm) { _caughtBefore = false; _cashierCtr = 3; _nextCashierSequenceId = -1; + _currCashierSequenceId = -1; } int Scene22::init() { diff --git a/engines/mohawk/cstime_view.cpp b/engines/mohawk/cstime_view.cpp index 7879175bb0..8727560094 100644 --- a/engines/mohawk/cstime_view.cpp +++ b/engines/mohawk/cstime_view.cpp @@ -243,7 +243,7 @@ void CSTimeModule::defaultMoveProc(Feature *feature) { if ((feature->_flags & kFeatureNewDisable) || (feature->_flags & kFeatureNewDisableOnReset)) { feature->_data.enabled = 0; } - feature->_dirty = 1; + feature->_dirty = true; if (feature->_flags & kFeatureInternalRegion) { // TODO: create region [+140] (if not already done) } @@ -257,7 +257,7 @@ void CSTimeModule::defaultMoveProc(Feature *feature) { // TODO: or clip with bounds } } - feature->_dirty = 1; + feature->_dirty = true; if (feature->_flags & kFeatureNewInternalTiming) { feature->_nextTime += feature->_delayTime; } else { @@ -277,7 +277,7 @@ void CSTimeModule::defaultMoveProc(Feature *feature) { } feature->_data.currOffset = 26; - feature->_done = 0; + feature->_done = false; } if (feature->_flags & kFeatureNewDisable) feature->_data.enabled = 0; @@ -307,7 +307,7 @@ void CSTimeModule::defaultMoveProc(Feature *feature) { } case 0: // TODO: set ptr +176 to 1 - feature->_done = 1; + feature->_done = true; if (feature->_doneProc) { (this->*(feature->_doneProc))(feature); // TODO: with -1 } diff --git a/engines/mohawk/view.cpp b/engines/mohawk/view.cpp index 1aaf32ea78..5b061ae1fc 100644 --- a/engines/mohawk/view.cpp +++ b/engines/mohawk/view.cpp @@ -37,6 +37,23 @@ Module::~Module() { } Feature::Feature(View *view) : _view(view) { + _next = _prev = nullptr; + _drawProc = nullptr; + _moveProc = nullptr; + _doneProc = nullptr; + _frameProc = nullptr; + _timeProc = nullptr; + _region = 0; + _id = 0; + _scrbId = 0; + _storedScrbId = 0; + _flags = 0; + _nextTime = 0; + _delayTime = 0; + _dirty = false; + _needsReset = false; + _justReset = false; + _done = false; } Feature::~Feature() { @@ -75,11 +92,10 @@ void Feature::setNodeDefaults(Feature *prev, Feature *next) { _flags = 0; - _dirty = 1; - _needsReset = 1; - _justReset = 0; // old - _notifyDone = 0; - _done = 0; // new + _dirty = true; + _needsReset = true; + _justReset = false; // old + _done = false; // new _nextTime = 0; _delayTime = 0; @@ -107,11 +123,11 @@ void Feature::resetFeatureScript(uint16 enabled, uint16 scrbId) { resetFrame(); _nextTime = 0; // New feature code uses _view->_lastIdleTime, but should be equivalent. _data.enabled = enabled; - _dirty = 1; + _dirty = true; finishResetFeatureScript(); - _needsReset = 0; + _needsReset = false; if (_region) { // TODO: mark _region as dirty @@ -123,7 +139,6 @@ void Feature::resetFeatureScript(uint16 enabled, uint16 scrbId) { void Feature::resetFeature(bool notifyDone, Module::FeatureProc doneProc, uint16 scrbId) { resetFeatureScript(1, scrbId); _doneProc = doneProc; - _notifyDone = notifyDone; } void Feature::hide(bool clip) { @@ -159,7 +174,7 @@ void Feature::moveAndUpdate(Common::Point newPos) { return; _nextTime = 0; - _dirty = 1; + _dirty = true; // TODO: mark _data.bounds as dirty if (_data.bitmapIds[0]) @@ -228,7 +243,7 @@ void OldFeature::resetScript() { } void OldFeature::finishResetFeatureScript() { - _justReset = 1; + _justReset = true; if (_flags & kFeatureOldAdjustByPos) { Common::SeekableReadStream *ourSCRB = _view->getSCRB(_data.scrbIndex, _scrbId); @@ -307,7 +322,7 @@ void NewFeature::resetScript() { } void NewFeature::finishResetFeatureScript() { - _done = 0; + _done = false; } View::View(MohawkEngine *vm) : _vm(vm) { @@ -319,6 +334,12 @@ View::View(MohawkEngine *vm) : _vm(vm) { _compoundSHAPGroups[i] = 0; } _numSCRBGroups = 0; + + _lastIdleTime = 0; + _needsUpdate = false; + _gfx = nullptr; + _rootNode = nullptr; + _cursorNode = nullptr; } View::~View() { @@ -347,7 +368,7 @@ void View::idleView() { } if (node->_drawProc) (_currentModule->*(node->_drawProc))(node); - node->_dirty = 0; + node->_dirty = false; } if (_needsUpdate) { diff --git a/engines/mohawk/view.h b/engines/mohawk/view.h index 47853f056f..463715b765 100644 --- a/engines/mohawk/view.h +++ b/engines/mohawk/view.h @@ -138,11 +138,10 @@ public: uint32 _flags; uint32 _nextTime; uint32 _delayTime; - uint16 _dirty; // byte in old - byte _needsReset; - byte _justReset; // old - byte _notifyDone; // old - byte _done; // new + bool _dirty; // byte in old + bool _needsReset; + bool _justReset; // old + bool _done; // new FeatureData _data; @@ -192,13 +191,6 @@ protected: void finishResetFeatureScript(); }; -#define NUM_SYNC_CHANNELS 17 -struct SyncChannel { - uint16 masterId; - byte state; - bool alternate; -}; - class View { public: View(MohawkEngine *vm); @@ -234,7 +226,6 @@ public: void sortView(); uint32 _lastIdleTime; - SyncChannel _syncChannels[NUM_SYNC_CHANNELS]; virtual uint32 getTime() = 0; diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index cfddc2d6b4..0f409a6435 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -114,6 +114,23 @@ static const NeverhoodGameDescription gameDescriptions[] = { }, { + // Neverhood earlier English demo version + { + "neverhood", + "Demo", + AD_ENTRY1s("nevdemo.blb", "9cbc33bc8ebacacfc8071f3e26a9c85f", 22357020), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_DEMO, + GUIO1(GUIO_NONE) + }, + 0, + 0, + 0, + 0, + }, + + { // Neverhood Russian version. Dyadyushka Risech { "neverhood", diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 771715b95e..4dbedc8dbe 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -153,6 +153,8 @@ DialogueManager::DialogueManager(Parallaction *vm, ZonePtr z) : _vm(vm), _z(z) { _downKey = 0; _mouseButtons = 0; + + _state = DIALOGUE_START; } void DialogueManager::start() { diff --git a/engines/parallaction/font.cpp b/engines/parallaction/font.cpp index f1c3b89ae8..0476b15971 100644 --- a/engines/parallaction/font.cpp +++ b/engines/parallaction/font.cpp @@ -70,6 +70,8 @@ public: _data = (byte *)malloc(size); stream.read(_data, size); + _cp = 0; + _bufPitch = 0; } ~BraFont() { diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index 2cd85d7f1c..c62e7479d3 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -77,6 +77,8 @@ Input::Input(Parallaction *vm) : _vm(vm) { _dougCursor = 0; _donnaCursor = 0; _comboArrow = 0; + _mouseArrow = 0; + initCursors(); } diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 5fd6d87985..ccf7130eb8 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -352,8 +352,8 @@ void Parallaction_ns::changeLocation() { } char location[200]; - strcpy(location, _newLocationName.c_str()); - strcpy(_location._name, _newLocationName.c_str()); + Common::strlcpy(location, _newLocationName.c_str(), 200); + Common::strlcpy(_location._name, _newLocationName.c_str(), 100); debugC(1, kDebugExec, "changeLocation(%s)", location); diff --git a/engines/prince/debugger.cpp b/engines/prince/debugger.cpp index fc216e0cfb..661b563944 100644 --- a/engines/prince/debugger.cpp +++ b/engines/prince/debugger.cpp @@ -37,6 +37,8 @@ Debugger::Debugger(PrinceEngine *vm, InterpreterFlags *flags) : GUI::Debugger(), registerCmd("initroom", WRAP_METHOD(Debugger, Cmd_InitRoom)); registerCmd("changecursor", WRAP_METHOD(Debugger, Cmd_ChangeCursor)); registerCmd("additem", WRAP_METHOD(Debugger, Cmd_AddItem)); + + _cursorNr = 0; } static int strToInt(const char *s) { diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp index d5178efc17..ea8c52a45b 100644 --- a/engines/prince/graphics.cpp +++ b/engines/prince/graphics.cpp @@ -44,6 +44,8 @@ GraphicsMan::GraphicsMan(PrinceEngine *vm) : _vm(vm), _changed(false) { _shadowTable70 = (byte *)malloc(256); _shadowTable50 = (byte *)malloc(256); + + _roomBackground = 0; } GraphicsMan::~GraphicsMan() { diff --git a/engines/prince/mob.h b/engines/prince/mob.h index 0ea610dd8f..863fd3a319 100644 --- a/engines/prince/mob.h +++ b/engines/prince/mob.h @@ -35,7 +35,7 @@ namespace Prince { class Mob { public: - Mob() : _name(""), _examText("") {} + Mob() : _name(""), _examText(""), _visible(false), _type(0), _mask(0), _examDirection(kDirL), _useDirection(kDirL) {} bool loadFromStream(Common::SeekableReadStream &stream); diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index f1fd5a25d3..a1386c6b16 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -623,6 +623,8 @@ void PrinceEngine::changeCursor(uint16 curId) { const Graphics::Surface *curSurface = nullptr; switch (curId) { + default: + error("Unknown cursor Id: %d", curId); case 0: CursorMan.showMouse(false); _optionsFlag = 0; diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 4ed3cee6f3..89e22b586e 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -400,9 +400,12 @@ bool Script::loadAllMasks(Common::Array<Mask> &maskList, int offset) { return false; } delete msStream; + + tempMask._width = tempMask.getWidth(); + tempMask._height = tempMask.getHeight(); + } else { + return false; } - tempMask._width = tempMask.getWidth(); - tempMask._height = tempMask.getHeight(); } maskList.push_back(tempMask); diff --git a/engines/prince/sound.cpp b/engines/prince/sound.cpp index c9746842ef..22db9c4998 100644 --- a/engines/prince/sound.cpp +++ b/engines/prince/sound.cpp @@ -118,6 +118,7 @@ const uint8 MusicPlayer::_musRoomTable[] = { MusicPlayer::MusicPlayer(PrinceEngine *vm) : _vm(vm) { _data = nullptr; + _dataSize = 0; _isGM = false; MidiPlayer::createDriver(); diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index b08534c7fa..9a5e6378b9 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -1170,7 +1170,7 @@ void Interface::processStatusTextInput(Common::KeyState keystate) { _statusTextInputPos--; _statusTextInputString[_statusTextInputPos] = 0; default: - if (_statusTextInputPos > STATUS_TEXT_INPUT_MAX) { + if (_statusTextInputPos > STATUS_TEXT_INPUT_MAX - 1) { // -1 because of the null termination break; } if (Common::isAlnum(keystate.ascii) || (keystate.ascii == ' ')) { diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp index 2d798bb0d6..1a131bf5cc 100644 --- a/engines/saga/saveload.cpp +++ b/engines/saga/saveload.cpp @@ -185,7 +185,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) { // Original game title memset(title, 0, TITLESIZE); - strncpy(title, _gameTitle.c_str(), TITLESIZE); + Common::strlcpy(title, _gameTitle.c_str(), TITLESIZE); out->write(title, TITLESIZE); // Thumbnail diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 64ae828a50..009ae2818e 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -667,6 +667,10 @@ void GfxFrameout::calcLists(ScreenItemListList &drawLists, EraseListList &eraseL --outerPlane->_priorityChanged; Plane *visibleOuterPlane = _visiblePlanes.findByObject(outerPlane->_object); + if (visibleOuterPlane == nullptr) { + warning("calcLists could not find visible plane for %04x:%04x", PRINT_REG(outerPlane->_object)); + continue; + } rectlist.add(outerPlane->_screenRect.findIntersectingRect(visibleOuterPlane->_screenRect)); @@ -680,7 +684,7 @@ void GfxFrameout::calcLists(ScreenItemListList &drawLists, EraseListList &eraseL int splitCount = splitRects(*rectlist[rectIndex], _planes[innerIndex]->_screenRect, outRects); if (splitCount == 0) { - if (visibleInnerPlane != nullptr && visibleOuterPlane != nullptr) { + if (visibleInnerPlane != nullptr) { // same priority, or relative priority between inner/outer changed if ((visibleOuterPlane->_priority - visibleInnerPlane->_priority) * (outerPlane->_priority - innerPlane->_priority) <= 0) { if (outerPlane->_priority <= innerPlane->_priority) { @@ -697,7 +701,7 @@ void GfxFrameout::calcLists(ScreenItemListList &drawLists, EraseListList &eraseL rectlist.add(outRects[i]); } - if (visibleInnerPlane != nullptr && visibleOuterPlane != nullptr) { + if (visibleInnerPlane != nullptr) { // same priority, or relative priority between inner/outer changed if ((visibleOuterPlane->_priority - visibleInnerPlane->_priority) * (outerPlane->_priority - innerPlane->_priority) <= 0) { *rectlist[rectIndex] = outerPlane->_screenRect.findIntersectingRect(innerPlane->_screenRect); diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp index c409863804..3a7ad49c2f 100644 --- a/engines/scumm/he/cup_player_he.cpp +++ b/engines/scumm/he/cup_player_he.cpp @@ -408,6 +408,9 @@ void CUP_Player::handleSRLE(Common::SeekableReadStream &dataStream, uint32 dataS static void decodeLZSS(uint8 *dst, const uint8 *src1, const uint8 *src2, const uint8 *src3) { uint8 wnd[4096]; int index = 1; + + memset(wnd, 0, sizeof(wnd)); + while (1) { int code = *src1++; for (int b = 0; b < 8; ++b) { diff --git a/engines/scumm/he/moonbase/ai_main.cpp b/engines/scumm/he/moonbase/ai_main.cpp index 9c9ff8bb01..98a577bdba 100644 --- a/engines/scumm/he/moonbase/ai_main.cpp +++ b/engines/scumm/he/moonbase/ai_main.cpp @@ -606,7 +606,7 @@ int AI::masterControlProgram(const int paramCount, const int32 *params) { targetX = getHubX(closestHub); targetY = getHubY(closestHub); - delete launchAction; + delete[] launchAction; launchAction = NULL; _aiState = STATE_DEFEND_TARGET; delete myTree; @@ -647,7 +647,7 @@ int AI::masterControlProgram(const int paramCount, const int32 *params) { } } else { index++; - delete launchAction; + delete[] launchAction; launchAction = NULL; } } else { @@ -667,7 +667,7 @@ int AI::masterControlProgram(const int paramCount, const int32 *params) { _aiState = STATE_INIT_ACQUIRE_TARGET; } else { index++; - delete launchAction; + delete[] launchAction; launchAction = NULL; } } @@ -695,7 +695,7 @@ int AI::masterControlProgram(const int paramCount, const int32 *params) { } } else { index++; - delete launchAction; + delete[] launchAction; launchAction = NULL; } } @@ -2110,7 +2110,7 @@ int *AI::energizeTarget(int &targetX, int &targetY, int index) { break; } - testDist = ((((n - attempt) / n) * .5) + .5) * (getDistance(getHubX(nextUnit), getHubY(nextUnit), targetX, targetY) / .8); + testDist = (((((double)n - (double)attempt) / n) * .5) + .5) * (getDistance(getHubX(nextUnit), getHubY(nextUnit), targetX, targetY) / .8); xPos = getHubX(nextUnit) + testDist * cos(degToRad(testAngle)); yPos = getHubY(nextUnit) + testDist * sin(degToRad(testAngle)); } diff --git a/engines/scumm/he/moonbase/ai_targetacquisition.cpp b/engines/scumm/he/moonbase/ai_targetacquisition.cpp index 02c49dc1a7..313ea7a411 100644 --- a/engines/scumm/he/moonbase/ai_targetacquisition.cpp +++ b/engines/scumm/he/moonbase/ai_targetacquisition.cpp @@ -320,6 +320,15 @@ void Sortie::printEnemyDefenses() { } } +Defender::Defender(AI *ai) : _ai(ai) { + _sourceX = _sourceY = 0; + _targetX = _targetY = 0; + _sourceUnit = 0; + _power = 0; + _angle = 0; + _unit = 0; +} + int Defender::calculateDefenseUnitPosition(int targetX, int targetY, int index) { int currentPlayer = _ai->getCurrentPlayer(); diff --git a/engines/scumm/he/moonbase/ai_targetacquisition.h b/engines/scumm/he/moonbase/ai_targetacquisition.h index 9afe0f50ab..5e6cfed8bc 100644 --- a/engines/scumm/he/moonbase/ai_targetacquisition.h +++ b/engines/scumm/he/moonbase/ai_targetacquisition.h @@ -112,7 +112,7 @@ private: AI *_ai; public: - Defender(AI *ai) : _ai(ai) {} + Defender(AI *ai); void setSourceX(int sourceX) { _sourceX = sourceX; } void setSourceY(int sourceY) { _sourceY = sourceY; } void setTargetX(int targetX) { _targetX = targetX; } diff --git a/engines/scumm/he/moonbase/ai_traveller.cpp b/engines/scumm/he/moonbase/ai_traveller.cpp index b1c9985b9d..d6eea67b41 100644 --- a/engines/scumm/he/moonbase/ai_traveller.cpp +++ b/engines/scumm/he/moonbase/ai_traveller.cpp @@ -46,6 +46,8 @@ Traveller::Traveller(AI *ai) : _ai(ai) { _waterSourceY = 0; _waterDestX = 0; _waterDestY = 0; + + _posX = _posY = 0; } Traveller::Traveller(int originX, int originY, AI *ai) : _ai(ai) { diff --git a/engines/scumm/he/moonbase/moonbase.h b/engines/scumm/he/moonbase/moonbase.h index 243d53a11d..1d87eed7d9 100644 --- a/engines/scumm/he/moonbase/moonbase.h +++ b/engines/scumm/he/moonbase/moonbase.h @@ -98,7 +98,7 @@ private: bool _fowBlackMode; - int _fowRenderTable[32768]; + int32 _fowRenderTable[32768]; Common::PEResources _exe; Common::String _fileName; diff --git a/engines/scumm/he/moonbase/moonbase_fow.cpp b/engines/scumm/he/moonbase/moonbase_fow.cpp index 48c2219926..2cd17a86fa 100644 --- a/engines/scumm/he/moonbase/moonbase_fow.cpp +++ b/engines/scumm/he/moonbase/moonbase_fow.cpp @@ -169,6 +169,21 @@ void Moonbase::setFOWInfo(int fowInfoArray, int downDim, int acrossDim, int view if (!_fowImage) return; + for (int y = 0; y < downDim; y++) { + Common::String s; + + for (int x = 0; x < acrossDim; x++) + if (readFOWVisibilityArray(fowInfoArray, x, y)) + s += "@"; + else + s+= " "; + + debug(0, "%s", s.c_str()); + } + debug(0, ""); + + memset(_fowRenderTable, 0, sizeof(_fowRenderTable)); + _fowDrawX = clipX1; _fowDrawY = clipY1; @@ -210,16 +225,16 @@ void Moonbase::setFOWInfo(int fowInfoArray, int downDim, int acrossDim, int view int dataOffset = (_fowVw * 3); int dataOffset2 = (dataOffset * 2); - int *pOutterRenderTableA = _fowRenderTable; - int *pOutterRenderTableB = pOutterRenderTableA + dataOffset; + int32 *pOutterRenderTableA = _fowRenderTable; + int32 *pOutterRenderTableB = pOutterRenderTableA + dataOffset; for (int ay = 0; ay < _fowVh; ay++) { int l = il; int c = ic; int r = ir; - int *pRenderTableA = pOutterRenderTableA; - int *pRenderTableB = pOutterRenderTableB; + int32 *pRenderTableA = pOutterRenderTableA; + int32 *pRenderTableB = pOutterRenderTableB; pOutterRenderTableA += dataOffset2; pOutterRenderTableB += dataOffset2; @@ -228,7 +243,7 @@ void Moonbase::setFOWInfo(int fowInfoArray, int downDim, int acrossDim, int view int visibility = readFOWVisibilityArray(fowInfoArray, m, c); if (visibility == FOW_EMPTY) { - int bits = 0; + uint32 bits = 0; if (readFOWVisibilityArray(fowInfoArray, t, l) != 0) bits |= FF_T_L; if (readFOWVisibilityArray(fowInfoArray, t, c) != 0) bits |= FF_T; @@ -333,7 +348,7 @@ static void blackRect_16bpp(uint8 *destSurface, int dstPitch, int dstw, int dsth int h = y2 - y1; int w = ((x2 - x1) + 1) * 2; - while ( --h >= 0 ) { + while (--h >= 0) { memset(dst, 0, w); dst += dstPitch; } @@ -343,7 +358,7 @@ void Moonbase::renderFOW(uint8 *destSurface, int dstPitch, int dstType, int dstw if (!_fowImage) return; - const int *pOutterRenderTable = _fowRenderTable; + const int32 *pOutterRenderTable = _fowRenderTable; int ixPos = ((_fowVtx1 * _fowTileW) - _fowMvx) + _fowDrawX; int yPos = ((_fowVty1 * _fowTileH) - _fowMvy) + _fowDrawY; int dataOffset = _fowVw * 3; @@ -355,7 +370,7 @@ void Moonbase::renderFOW(uint8 *destSurface, int dstPitch, int dstType, int dstw int real_yPos = yPos; for (int i = 0; i < 2; i++) { - const int *pRenderTable = pOutterRenderTable; + const int32 *pRenderTable = pOutterRenderTable; pOutterRenderTable += dataOffset; int xPos = ixPos; diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 2e7b4c4bf5..b2dad7ce86 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -643,6 +643,11 @@ void ScummEngine_v100he::o100_arrayOps() { dim2end = pop(); dim2start = pop(); + debug(0, "Complex: %d = %d[%d to %d][%d to %d] %c %d[%d to %d][%d to %d]", array, + array1, a1_dim1start, a1_dim2end, a1_dim1start, a1_dim2end, + " +-&|^"[type], + array2, a2_dim1start, a2_dim2end, a2_dim1start, a2_dim2end); + int a12_num = a1_dim2end - a1_dim2start + 1; int a11_num = a1_dim1end - a1_dim1start + 1; int a22_num = a2_dim2end - a2_dim2start + 1; @@ -689,8 +694,6 @@ void ScummEngine_v100he::o100_arrayOps() { writeArray(array, dim2start, dim1, res); } } - - warning("STUB: o100_arrayOps: case 132 type %d", type); break; } case 133: // SO_RANGE_ARRAY_ASSIGNMENT diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h index 807fbeb1d1..401d9b648d 100644 --- a/engines/sherlock/surface.h +++ b/engines/sherlock/surface.h @@ -121,7 +121,7 @@ protected: virtual void addDirtyRect(const Common::Rect &r) {} public: Surface() : BaseSurface() {} - Surface(int w, int h) : BaseSurface(w, h) {} + Surface(int width, int height) : BaseSurface(width, height) {} }; } // End of namespace Sherlock diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index 918894cf6f..495049d1a2 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -132,6 +132,8 @@ void PalettesToVideoDAC() { VIDEO_DAC_Q *pDACtail = g_vidDACdata; // set tail pointer byte pal[768]; + memset(pal, 0, sizeof(pal)); + // while Q is not empty while (g_pDAChead != pDACtail) { const PALETTE *pPalette; // pointer to hardware palette diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp index ef3127233d..a4f5bc8261 100644 --- a/engines/tinsel/play.cpp +++ b/engines/tinsel/play.cpp @@ -159,6 +159,9 @@ static int RegisterSoundReel(SCNHANDLE hFilm, int column, int actorCol) { } } + if (i == MAX_SOUNDREELS) + error("Out of sound reels in RegisterSoundReel()"); + g_soundReelNumbers[i]++; return i; } diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 226cbb51c0..c8fe5f898c 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -594,8 +594,8 @@ static void DoSave() { hdr.id = SAVEGAME_ID; hdr.size = SAVEGAME_HEADER_SIZE; hdr.ver = CURRENT_VER; - memcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN); - hdr.desc[SG_DESC_LEN - 1] = 0; + memset(hdr.desc, 0, SG_DESC_LEN); + Common::strlcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN); g_system->getTimeAndDate(hdr.dateTime); hdr.scnFlag = _vm->getFeatures() & GF_SCNFILES; hdr.language = _vm->_config->_language; diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 169e2eff7b..137562a91d 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -708,7 +708,7 @@ bool ToonEngine::showOptions() { entries[2].activeFrame = entries[2].animation->_numFrames - 1; if (!_showConversationText) { - entries[4].activeFrame = 4; + entries[4].activeFrame = 4; } else if (_useAlternativeFont) { entries[4].activeFrame = 8; } else { @@ -797,19 +797,19 @@ bool ToonEngine::showOptions() { // handle sliders if (clickingOn == OPTIONMENUHOTSPOT_VOLUMEMUSICSLIDER) { entries[clickingOnSprite].activeFrame = ratioX * (entries[clickingOnSprite].animation->_numFrames) / 256; - int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; + int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; _audioManager->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); } if (clickingOn == OPTIONMENUHOTSPOT_VOLUMEVOICESLIDER) { entries[clickingOnSprite].activeFrame = ratioX * (entries[clickingOnSprite].animation->_numFrames) / 256; - int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; + int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; _audioManager->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, vol); } if (clickingOn == OPTIONMENUHOTSPOT_VOLUMESFXSLIDER) { entries[clickingOnSprite].activeFrame = ratioX * (entries[clickingOnSprite].animation->_numFrames) / 256; - int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; + int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; _audioManager->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol); } @@ -935,10 +935,12 @@ bool ToonEngine::showOptions() { _gameState->_inMenu = false; _firstFrame = true; _gameState->_currentScrollValue = oldScrollValue; - + restorePalette(); dirtyAllScreen(); + delete optionPicture; + return exitGame; } diff --git a/graphics/nine_patch.cpp b/graphics/nine_patch.cpp index fea0d8ae66..a193200208 100644 --- a/graphics/nine_patch.cpp +++ b/graphics/nine_patch.cpp @@ -59,13 +59,13 @@ NinePatchSide::~NinePatchSide() { bool NinePatchSide::init(Graphics::TransparentSurface *bmp, bool vertical) { - const int len = vertical ? bmp->h : bmp->w; - int i; - int s, t, n, z; + const uint len = vertical ? bmp->h : bmp->w; + uint i; + int s, t, z; _m.clear(); - for (i = 1, s = -1, t = 0, n = 0, z = -1; i < len; ++i) { + for (i = 1, s = -1, t = 0, z = -1; i < len; ++i) { int zz; uint8 r, g, b, a; uint32 *color = vertical ? (uint32 *)bmp->getBasePtr(0, i) : (uint32 *)bmp->getBasePtr(i, 0); diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat Binary files differindex 917acdb13d..fe3b8a3cda 100644 --- a/gui/themes/translations.dat +++ b/gui/themes/translations.dat diff --git a/image/codecs/cinepak.cpp b/image/codecs/cinepak.cpp index 4e858921ee..2b02fc8127 100644 --- a/image/codecs/cinepak.cpp +++ b/image/codecs/cinepak.cpp @@ -260,7 +260,7 @@ private: } static inline byte getRGBLookupEntry(const byte *colorMap, uint16 index) { - return colorMap[s_defaultPaletteLookup[CLIP<int>(index, 0, 1024)]]; + return colorMap[s_defaultPaletteLookup[CLIP<int>(index, 0, 1023)]]; } }; diff --git a/image/pict.cpp b/image/pict.cpp index 89f115dc90..4f4f0396bf 100644 --- a/image/pict.cpp +++ b/image/pict.cpp @@ -340,6 +340,8 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPa uint32 lineSize = MAX<int>(width * bytesPerPixel + (8 * 2 / packBitsData.pixMap.pixelSize), packBitsData.pixMap.rowBytes); byte *buffer = new byte[lineSize * height]; + memset(buffer, 0, lineSize * height); + // Read in amount of data per row for (uint16 i = 0; i < packBitsData.pixMap.bounds.height(); i++) { // NOTE: Compression 0 is "default". The format in SCI games is packed when 0. diff --git a/po/de_DE.po b/po/de_DE.po index 65765ecca0..151d0feeb3 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: ScummVM 1.9.0git\n" "Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n" "POT-Creation-Date: 2016-04-07 08:55+0200\n" -"PO-Revision-Date: 2016-05-01 15:45+0200\n" +"PO-Revision-Date: 2016-05-29 17:00+0200\n" "Last-Translator: Lothar Serra Mari <rootfather@scummvm.org>\n" "Language-Team: Simon Sawatzki <SimSaw@gmx.de>, Lothar Serra Mari " "<rootfather@scummvm.org>\n" @@ -696,7 +696,7 @@ msgstr "Schneller Modus" #: gui/options.cpp:87 common/updates.cpp:56 msgid "Never" -msgstr "Niemals" +msgstr "nie" #: gui/options.cpp:87 msgid "every 5 mins" |