[Scummvm-git-logs] scummvm master -> 3e194453fadcca6ff8064f2557db8e5e8e16bb54
criezy
noreply at scummvm.org
Sun Oct 9 18:42:16 UTC 2022
This automated email contains information about 13 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
026d1e83ac AGS: don't start sound fadeout if skipping a cutscene
151d391188 AGS: Updated build version (3.6.0.29)
7f6d7f41d4 AGS: use #if instead of #ifdef for log macros
5fd47e4055 AGS: define verbose sprite cache log through a macro function
c1bfa68725 AGS: removed redundant global variable numBreakpoints
61e3a92963 AGS: fixed few more warnings related to typecasts
6f512bb2af AGS: Removed some redundant/obsolete comments
fa87b3f28f AGS: force update gui metrics on load and on game start
9ced7b370c AGS: fixed GUIListBox drawing double border outside of the clip
eb252cf824 AGS: fixed case when imported sprite got flags from placeholder
dd9595c8ce AGS: don't zero slider's HandleImage internally if sprite is missing
56f9bfba9e AGS: fixed GUISlider::IsOverControl() comparing abs with rel coords
3e194453fa AGS: Updated build version (3.6.0.30)
Commit: 026d1e83acd4d956a533a674ba64676fbce7c3bb
https://github.com/scummvm/scummvm/commit/026d1e83acd4d956a533a674ba64676fbce7c3bb
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T17:58:53+01:00
Commit Message:
AGS: don't start sound fadeout if skipping a cutscene
>From upstream d742c415a898e9c52875098f3f40ecffa57b22ee
Changed paths:
engines/ags/engine/media/audio/audio.cpp
diff --git a/engines/ags/engine/media/audio/audio.cpp b/engines/ags/engine/media/audio/audio.cpp
index dd6bb1146e5..dd7202e16f6 100644
--- a/engines/ags/engine/media/audio/audio.cpp
+++ b/engines/ags/engine/media/audio/audio.cpp
@@ -137,7 +137,8 @@ static void move_track_to_crossfade_channel(int currentChannel, int crossfadeSpe
// NOTE: this function assumes one of the user channels
void stop_or_fade_out_channel(int fadeOutChannel, int fadeInChannel, ScriptAudioClip *newSound) {
ScriptAudioClip *sourceClip = AudioChannel_GetPlayingClip(&_G(scrAudioChannel)[fadeOutChannel]);
- if ((sourceClip != nullptr) && (_GP(game).audioClipTypes[sourceClip->type].crossfadeSpeed > 0)) {
+ if ((_GP(play).fast_forward == 0) && // don't crossfade if skipping a cutscene
+ (sourceClip != nullptr) && (_GP(game).audioClipTypes[sourceClip->type].crossfadeSpeed > 0)) {
move_track_to_crossfade_channel(fadeOutChannel, _GP(game).audioClipTypes[sourceClip->type].crossfadeSpeed, fadeInChannel, newSound);
} else {
stop_and_destroy_channel(fadeOutChannel);
Commit: 151d3911887afa4ebd09ecaaf51a30515c7495a2
https://github.com/scummvm/scummvm/commit/151d3911887afa4ebd09ecaaf51a30515c7495a2
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T18:01:55+01:00
Commit Message:
AGS: Updated build version (3.6.0.29)
>From upstream 13ccc39f2027c9fcf07308440981221629b67b75
Changed paths:
engines/ags/shared/core/def_version.h
diff --git a/engines/ags/shared/core/def_version.h b/engines/ags/shared/core/def_version.h
index fc2d0e6f735..31e28624132 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,9 +22,9 @@
#ifndef AGS_SHARED_CORE_DEFVERSION_H
#define AGS_SHARED_CORE_DEFVERSION_H
-#define ACI_VERSION_STR "3.6.0.28"
+#define ACI_VERSION_STR "3.6.0.29"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.28
+#define ACI_VERSION_MSRC_DEF 3.6.0.29
#endif
#define SPECIAL_VERSION ""
Commit: 7f6d7f41d4ffda8c6fe407d8c81c3a04cc25ddea
https://github.com/scummvm/scummvm/commit/7f6d7f41d4ffda8c6fe407d8c81c3a04cc25ddea
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T18:11:02+01:00
Commit Message:
AGS: use #if instead of #ifdef for log macros
Sprite Cache and Managed Objects produce a lot of entries in the log currently.
They use a macro to set if they should be on or not, but this macro may be set =0, with the intent of disabling.
Let's instead use #if when testing these macros.
Additionally
- only define DEBUG_MANAGED_OBJECTS if AGS_DEBUG_MANAGED_OBJECTS is true
- adds a new command line flag AGS_DEBUG_SPRITECACHE, which will only define DEBUG_SPRITECACHE if true
- guard indefinition through core/platform.h
>From upstream e8bd58da2e09d844068dc087f1da153a693b7aa8
Changed paths:
engines/ags/engine/ac/dynobj/cc_dynamic_object.cpp
engines/ags/engine/ac/dynobj/managed_object_pool.h
engines/ags/engine/debugging/debug.cpp
engines/ags/shared/ac/sprite_cache.cpp
engines/ags/shared/core/platform.h
diff --git a/engines/ags/engine/ac/dynobj/cc_dynamic_object.cpp b/engines/ags/engine/ac/dynobj/cc_dynamic_object.cpp
index fa8e95b3746..0f59d9fcba8 100644
--- a/engines/ags/engine/ac/dynobj/cc_dynamic_object.cpp
+++ b/engines/ags/engine/ac/dynobj/cc_dynamic_object.cpp
@@ -33,6 +33,7 @@
//
//=============================================================================
+#include "ags/shared/core/platform.h"
#include "ags/engine/ac/dynobj/cc_dynamic_object.h"
#include "ags/engine/ac/dynobj/managed_object_pool.h"
#include "ags/shared/debugging/out.h"
diff --git a/engines/ags/engine/ac/dynobj/managed_object_pool.h b/engines/ags/engine/ac/dynobj/managed_object_pool.h
index 3208da3d32f..ee51a629d9d 100644
--- a/engines/ags/engine/ac/dynobj/managed_object_pool.h
+++ b/engines/ags/engine/ac/dynobj/managed_object_pool.h
@@ -26,6 +26,7 @@
#include "ags/lib/std/queue.h"
#include "ags/lib/std/map.h"
+#include "ags/shared/core/platform.h"
#include "ags/engine/script/runtime_script_value.h"
#include "ags/engine/ac/dynobj/cc_dynamic_object.h" // ICCDynamicObject
@@ -104,7 +105,7 @@ public:
const char *disableDisposeForObject{ nullptr };
};
-#ifdef DEBUG_MANAGED_OBJECTS
+#if DEBUG_MANAGED_OBJECTS
#define ManagedObjectLog(...) Debug::Printf(kDbgGroup_ManObj, kDbgMsg_Debug, __VA_ARGS__)
#else
#define ManagedObjectLog(...)
diff --git a/engines/ags/engine/debugging/debug.cpp b/engines/ags/engine/debugging/debug.cpp
index e483c91d6c6..f55cfaa8d4c 100644
--- a/engines/ags/engine/debugging/debug.cpp
+++ b/engines/ags/engine/debugging/debug.cpp
@@ -214,12 +214,12 @@ void apply_debug_config(const ConfigTree &cfg) {
legacy_log_enabled, {
DbgGroupOption(kDbgGroup_Main, kDbgMsg_All),
DbgGroupOption(kDbgGroup_Game, kDbgMsg_Info),
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
DbgGroupOption(kDbgGroup_SprCache, kDbgMsg_All),
#else
DbgGroupOption(kDbgGroup_SprCache, kDbgMsg_Info),
#endif
-#ifdef DEBUG_MANAGED_OBJECTS
+#if DEBUG_MANAGED_OBJECTS
DbgGroupOption(kDbgGroup_ManObj, kDbgMsg_All),
#else
DbgGroupOption(kDbgGroup_ManObj, kDbgMsg_Info),
diff --git a/engines/ags/shared/ac/sprite_cache.cpp b/engines/ags/shared/ac/sprite_cache.cpp
index 404e1503741..d6a1dd273ab 100644
--- a/engines/ags/shared/ac/sprite_cache.cpp
+++ b/engines/ags/shared/ac/sprite_cache.cpp
@@ -26,6 +26,7 @@
//=============================================================================
#include "common/system.h"
+#include "ags/shared/core/platform.h"
#include "ags/shared/util/stream.h"
#include "ags/lib/std/algorithm.h"
#include "ags/shared/ac/sprite_cache.h"
@@ -112,7 +113,7 @@ void SpriteCache::SetSprite(sprkey_t index, Bitmap *sprite) {
_spriteData[index].Image = sprite;
_spriteData[index].Flags = SPRCACHEFLAG_LOCKED; // NOT from asset file
_spriteData[index].Size = 0;
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "SetSprite: (external) %d", index);
#endif
}
@@ -133,7 +134,7 @@ void SpriteCache::SubstituteBitmap(sprkey_t index, Bitmap *sprite) {
return;
}
_spriteData[index].Image = sprite;
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "SubstituteBitmap: %d", index);
#endif
}
@@ -142,7 +143,7 @@ void SpriteCache::RemoveSprite(sprkey_t index, bool freeMemory) {
if (freeMemory)
delete _spriteData[index].Image;
InitNullSpriteParams(index);
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "RemoveSprite: %d", index);
#endif
}
@@ -247,7 +248,7 @@ void SpriteCache::DisposeOldest() {
_cacheSize -= _spriteData[sprnum].Size;
delete _spriteData[*it].Image;
_spriteData[sprnum].Image = nullptr;
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "DisposeOldest: disposed %d, size now %d KB", sprnum, _cacheSize / 1024);
#endif
}
@@ -294,7 +295,7 @@ void SpriteCache::Precache(sprkey_t index) {
_maxCacheSize += sprSize;
_lockedSize += sprSize;
_spriteData[index].Flags |= SPRCACHEFLAG_LOCKED;
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "Precached %d", index);
#endif
}
@@ -344,7 +345,7 @@ size_t SpriteCache::LoadSprite(sprkey_t index) {
_spriteData[index].Size = size;
_cacheSize += size;
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "Loaded %d, size now %zu KB", index, _cacheSize / 1024);
#endif
@@ -358,7 +359,7 @@ void SpriteCache::RemapSpriteToSprite0(sprkey_t index) {
_spriteData[index].Image = nullptr;
_spriteData[index].Size = _spriteData[0].Size;
_spriteData[index].Flags |= SPRCACHEFLAG_REMAPPED;
-#ifdef DEBUG_SPRITECACHE
+#if DEBUG_SPRITECACHE
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "RemapSpriteToSprite0: %d", index);
#endif
}
diff --git a/engines/ags/shared/core/platform.h b/engines/ags/shared/core/platform.h
index f9a9ec2afd4..a4a108d8e5e 100644
--- a/engines/ags/shared/core/platform.h
+++ b/engines/ags/shared/core/platform.h
@@ -146,6 +146,13 @@ namespace AGS3 {
// or read from default config.
#define AGS_SEARCH_FOR_GAME_ON_LAUNCH (AGS_PLATFORM_OS_WINDOWS || AGS_PLATFORM_OS_LINUX || AGS_PLATFORM_OS_MACOS)
+#if !defined(DEBUG_MANAGED_OBJECTS)
+ #define DEBUG_MANAGED_OBJECTS (0)
+#endif
+
+#if !defined(DEBUG_SPRITECACHE)
+ #define DEBUG_SPRITECACHE (0)
+#endif
} // namespace AGS3
Commit: 5fd47e4055786ee5a5f7e472164947cc894b2811
https://github.com/scummvm/scummvm/commit/5fd47e4055786ee5a5f7e472164947cc894b2811
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T18:34:44+01:00
Commit Message:
AGS: define verbose sprite cache log through a macro function
>From upstream a3e762c55b9424ebfc3f311b57ac30a8bcedf945
Changed paths:
engines/ags/engine/ac/dynobj/managed_object_pool.h
engines/ags/shared/ac/sprite_cache.cpp
diff --git a/engines/ags/engine/ac/dynobj/managed_object_pool.h b/engines/ags/engine/ac/dynobj/managed_object_pool.h
index ee51a629d9d..4fd35b5c61a 100644
--- a/engines/ags/engine/ac/dynobj/managed_object_pool.h
+++ b/engines/ags/engine/ac/dynobj/managed_object_pool.h
@@ -105,6 +105,7 @@ public:
const char *disableDisposeForObject{ nullptr };
};
+// Extreme(!!) verbosity managed memory pool log
#if DEBUG_MANAGED_OBJECTS
#define ManagedObjectLog(...) Debug::Printf(kDbgGroup_ManObj, kDbgMsg_Debug, __VA_ARGS__)
#else
diff --git a/engines/ags/shared/ac/sprite_cache.cpp b/engines/ags/shared/ac/sprite_cache.cpp
index d6a1dd273ab..952e061c2f3 100644
--- a/engines/ags/shared/ac/sprite_cache.cpp
+++ b/engines/ags/shared/ac/sprite_cache.cpp
@@ -44,8 +44,12 @@ extern void initialize_sprite(int);
extern void pre_save_sprite(Bitmap *image);
extern void get_new_size_for_sprite(int, int, int, int &, int &);
-#define START_OF_LIST -1
-#define END_OF_LIST -1
+// High-verbosity sprite cache log
+#if DEBUG_SPRITECACHE
+#define SprCacheLog(...) Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, __VA_ARGS__)
+#else
+#define SprCacheLog(...)
+#endif
SpriteInfo::SpriteInfo()
: Flags(0)
@@ -113,9 +117,7 @@ void SpriteCache::SetSprite(sprkey_t index, Bitmap *sprite) {
_spriteData[index].Image = sprite;
_spriteData[index].Flags = SPRCACHEFLAG_LOCKED; // NOT from asset file
_spriteData[index].Size = 0;
-#if DEBUG_SPRITECACHE
- Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "SetSprite: (external) %d", index);
-#endif
+ SprCacheLog("SetSprite: (external) %d", index);
}
void SpriteCache::SetEmptySprite(sprkey_t index, bool as_asset) {
@@ -134,18 +136,14 @@ void SpriteCache::SubstituteBitmap(sprkey_t index, Bitmap *sprite) {
return;
}
_spriteData[index].Image = sprite;
-#if DEBUG_SPRITECACHE
- Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "SubstituteBitmap: %d", index);
-#endif
+ SprCacheLog("SubstituteBitmap: %d", index);
}
void SpriteCache::RemoveSprite(sprkey_t index, bool freeMemory) {
if (freeMemory)
delete _spriteData[index].Image;
InitNullSpriteParams(index);
-#if DEBUG_SPRITECACHE
- Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "RemoveSprite: %d", index);
-#endif
+ SprCacheLog("RemoveSprite: %d", index);
}
sprkey_t SpriteCache::EnlargeTo(sprkey_t topmost) {
@@ -248,9 +246,7 @@ void SpriteCache::DisposeOldest() {
_cacheSize -= _spriteData[sprnum].Size;
delete _spriteData[*it].Image;
_spriteData[sprnum].Image = nullptr;
-#if DEBUG_SPRITECACHE
- Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "DisposeOldest: disposed %d, size now %d KB", sprnum, _cacheSize / 1024);
-#endif
+ SprCacheLog("DisposeOldest: disposed %d, size now %d KB", sprnum, _cacheSize / 1024);
}
// Remove from the mru list
_mru.erase(it);
@@ -295,9 +291,7 @@ void SpriteCache::Precache(sprkey_t index) {
_maxCacheSize += sprSize;
_lockedSize += sprSize;
_spriteData[index].Flags |= SPRCACHEFLAG_LOCKED;
-#if DEBUG_SPRITECACHE
- Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "Precached %d", index);
-#endif
+ SprCacheLog("Precached %d", index);
}
sprkey_t SpriteCache::GetDataIndex(sprkey_t index) {
@@ -344,11 +338,7 @@ size_t SpriteCache::LoadSprite(sprkey_t index) {
FreeMem(size);
_spriteData[index].Size = size;
_cacheSize += size;
-
-#if DEBUG_SPRITECACHE
- Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "Loaded %d, size now %zu KB", index, _cacheSize / 1024);
-#endif
-
+ SprCacheLog("Loaded %d, size now %zu KB", index, _cacheSize / 1024);
return size;
}
@@ -359,9 +349,7 @@ void SpriteCache::RemapSpriteToSprite0(sprkey_t index) {
_spriteData[index].Image = nullptr;
_spriteData[index].Size = _spriteData[0].Size;
_spriteData[index].Flags |= SPRCACHEFLAG_REMAPPED;
-#if DEBUG_SPRITECACHE
- Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Debug, "RemapSpriteToSprite0: %d", index);
-#endif
+ SprCacheLog("RemapSpriteToSprite0: %d", index);
}
int SpriteCache::SaveToFile(const String &filename, int store_flags, SpriteCompression compress, SpriteFileIndex &index) {
Commit: c1bfa6872518e7642440d878ed6b556a4e90583c
https://github.com/scummvm/scummvm/commit/c1bfa6872518e7642440d878ed6b556a4e90583c
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T18:45:15+01:00
Commit Message:
AGS: removed redundant global variable numBreakpoints
>From upstream 5cb25832b1da27049fc3531f00aeb5727b98fc38
Changed paths:
engines/ags/engine/debugging/debug.cpp
engines/ags/globals.h
diff --git a/engines/ags/engine/debugging/debug.cpp b/engines/ags/engine/debugging/debug.cpp
index f55cfaa8d4c..364634d7f28 100644
--- a/engines/ags/engine/debugging/debug.cpp
+++ b/engines/ags/engine/debugging/debug.cpp
@@ -398,31 +398,27 @@ int check_for_messages_from_editor() {
// Format: SETBREAK $scriptname$lineNumber$
msgPtr += 10;
char scriptNameBuf[sizeof(Breakpoint::scriptName)]{};
- size_t i = 0;
- while (msgPtr[0] != '$') {
+ for (size_t i = 0; msgPtr[0] != '$'; ++msgPtr, ++i) {
if (i < sizeof(scriptNameBuf) - 1)
scriptNameBuf[i] = msgPtr[0];
- msgPtr++;
- i++;
}
msgPtr++;
int lineNumber = atoi(msgPtr);
if (isDelete) {
- for (int j = 0; j < _G(numBreakpoints); j++) {
- if ((_G(breakpoints)[j].lineNumber == lineNumber) &&
- (strcmp(_G(breakpoints)[j].scriptName, scriptNameBuf) == 0)) {
- _G(numBreakpoints)--;
- _G(breakpoints).erase(_G(breakpoints).begin() + j);
+ for (size_t i = 0; i < _G(breakpoints).size(); ++i) {
+ if ((_G(breakpoints)[i].lineNumber == lineNumber) &&
+ (strcmp(_G(breakpoints)[i].scriptName, scriptNameBuf) == 0)) {
+ _G(breakpoints).erase(_G(breakpoints).begin() + i);
break;
}
}
} else {
- _G(breakpoints).push_back(Globals::Breakpoint());
- snprintf(_G(breakpoints)[_G(numBreakpoints)].scriptName, sizeof(Breakpoint::scriptName), "%s", scriptNameBuf);
- _G(breakpoints)[_G(numBreakpoints)].lineNumber = lineNumber;
- _G(numBreakpoints)++;
+ Globals::Breakpoint bp;
+ snprintf(bp.scriptName, sizeof(Breakpoint::scriptName), "%s", scriptNameBuf);
+ bp.lineNumber = lineNumber;
+ _G(breakpoints).push_back(bp);
}
} else if (strncmp(msgPtr, "RESUME", 6) == 0) {
_G(game_paused_in_debugger) = 0;
@@ -507,7 +503,7 @@ void scriptDebugHook(ccInstance *ccinst, int linenum) {
const char *scriptName = ccinst->runningInst->instanceof->GetSectionName(ccinst->pc);
- for (int i = 0; i < _G(numBreakpoints); i++) {
+ for (size_t i = 0; i < _G(breakpoints).size(); ++i) {
if ((_G(breakpoints)[i].lineNumber == linenum) &&
(strcmp(_G(breakpoints)[i].scriptName, scriptName) == 0)) {
break_into_debugger();
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index b3d6bbb5391..903e916c5cb 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -491,7 +491,6 @@ public:
};
std::vector<Breakpoint> _breakpoints;
- int _numBreakpoints = 0;
int _debug_flags = 0;
Commit: 61e3a92963d208a545b1d4bef6d3cb499fe12c1c
https://github.com/scummvm/scummvm/commit/61e3a92963d208a545b1d4bef6d3cb499fe12c1c
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T18:49:17+01:00
Commit Message:
AGS: fixed few more warnings related to typecasts
>From upstream 7946be9e75a0edda6fc9d955ea771f60f9b8e968
Changed paths:
engines/ags/engine/ac/global_game.cpp
diff --git a/engines/ags/engine/ac/global_game.cpp b/engines/ags/engine/ac/global_game.cpp
index bb931e3b935..33b58c673cd 100644
--- a/engines/ags/engine/ac/global_game.cpp
+++ b/engines/ags/engine/ac/global_game.cpp
@@ -643,7 +643,7 @@ void SetMultitasking(int mode) {
if ((mode < 0) | (mode > 1))
quit("!SetMultitasking: invalid mode parameter");
// Save requested setting
- _GP(usetup).multitasking = mode;
+ _GP(usetup).multitasking = mode != 0;
// Account for the override config option (must be checked first!)
if ((_GP(usetup).override_multitasking >= 0) && (mode != _GP(usetup).override_multitasking)) {
Commit: 6f512bb2af67e0127be003c180f1cbde4bb968cb
https://github.com/scummvm/scummvm/commit/6f512bb2af67e0127be003c180f1cbde4bb968cb
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T18:56:36+01:00
Commit Message:
AGS: Removed some redundant/obsolete comments
>From upstream a7bd24cd4822bdcabef061197c98d1224200aa2a
Changed paths:
engines/ags/engine/script/script_runtime.cpp
engines/ags/engine/script/script_runtime.h
diff --git a/engines/ags/engine/script/script_runtime.cpp b/engines/ags/engine/script/script_runtime.cpp
index 139cc1d7fc5..e5e63f3fe83 100644
--- a/engines/ags/engine/script/script_runtime.cpp
+++ b/engines/ags/engine/script/script_runtime.cpp
@@ -19,20 +19,6 @@
*
*/
-//=============================================================================
-//
-// C-Script run-time interpreter (c) 2001 Chris Jones
-//
-// You must DISABLE OPTIMIZATIONS AND REGISTER VARIABLES in your compiler
-// when compiling this, or strange results can happen.
-//
-// There is a problem with importing functions on 16-bit compilers: the
-// script system assumes that all parameters are passed as 4 bytes, which
-// ints are not on 16-bit systems. Be sure to define all parameters as longs,
-// or join the 21st century and switch to DJGPP or Visual C++.
-//
-//=============================================================================
-
#include "ags/engine/ac/dynobj/cc_dynamic_array.h"
#include "ags/engine/ac/statobj/static_object.h"
#include "ags/shared/script/cc_common.h"
diff --git a/engines/ags/engine/script/script_runtime.h b/engines/ags/engine/script/script_runtime.h
index a16338058b1..bf2d81be210 100644
--- a/engines/ags/engine/script/script_runtime.h
+++ b/engines/ags/engine/script/script_runtime.h
@@ -19,20 +19,6 @@
*
*/
-//=============================================================================
-//
-// C-Script run-time interpreter (c) 2001 Chris Jones
-//
-// You must DISABLE OPTIMIZATIONS AND REGISTER VARIABLES in your compiler
-// when compiling this, or strange results can happen.
-//
-// There is a problem with importing functions on 16-bit compilers: the
-// script system assumes that all parameters are passed as 4 bytes, which
-// ints are not on 16-bit systems. Be sure to define all parameters as longs,
-// or join the 21st century and switch to DJGPP or Visual C++.
-//
-//=============================================================================
-
#ifndef AGS_ENGINE_SCRIPT_SCRIPT_RUNTIME_H
#define AGS_ENGINE_SCRIPT_SCRIPT_RUNTIME_H
Commit: fa87b3f28f4b702b41b26d89ec864a696d93941b
https://github.com/scummvm/scummvm/commit/fa87b3f28f4b702b41b26d89ec864a696d93941b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T19:12:22+01:00
Commit Message:
AGS: force update gui metrics on load and on game start
This fixes some controls not reporting their metrics correctly until first displayed on screen.
>From upstream ea4e6762236a13621ba0771b9d5d8ac4bcf33ee8
Changed paths:
engines/ags/engine/main/engine.cpp
engines/ags/shared/gui/gui_listbox.cpp
engines/ags/shared/gui/gui_main.cpp
engines/ags/shared/gui/gui_main.h
engines/ags/shared/gui/gui_slider.cpp
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index 6b630dcb9ae..94b6be7bca8 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -560,18 +560,10 @@ void engine_init_game_settings() {
if (_G(playerchar)->view >= 0)
precache_view(_G(playerchar)->view);
- /* dummygui.guiId = -1;
- dummyguicontrol.guin = -1;
- dummyguicontrol.objn = -1;*/
-
_G(our_eip) = -6;
- // _GP(game).chars[0].talkview=4;
- //init_language_text(_GP(game).langcodes[0]);
for (ee = 0; ee < MAX_ROOM_OBJECTS; ee++) {
_G(scrObj)[ee].id = ee;
- // 64 bit: Using the id instead
- // _G(scrObj)[ee].obj = NULL;
}
for (ee = 0; ee < _GP(game).numcharacters; ee++) {
@@ -751,6 +743,8 @@ void engine_init_game_settings() {
GUI::Options.DisabledStyle = static_cast<GuiDisableStyle>(_GP(game).options[OPT_DISABLEOFF]);
GUI::Options.ClipControls = _GP(game).options[OPT_CLIPGUICONTROLS] != 0;
+ // Force GUI metrics recalculation, accomodating for loaded fonts
+ GUI::MarkForFontUpdate(-1);
memset(&_GP(play).walkable_areas_on[0], 1, MAX_WALK_AREAS + 1);
memset(&_GP(play).script_timers[0], 0, MAX_TIMERS * sizeof(int));
diff --git a/engines/ags/shared/gui/gui_listbox.cpp b/engines/ags/shared/gui/gui_listbox.cpp
index c54740a8608..30b1a95e332 100644
--- a/engines/ags/shared/gui/gui_listbox.cpp
+++ b/engines/ags/shared/gui/gui_listbox.cpp
@@ -383,6 +383,8 @@ void GUIListBox::ReadFromFile(Stream *in, GuiVersion gui_version) {
if (TextColor == 0)
TextColor = 16;
+
+ UpdateMetrics();
}
void GUIListBox::ReadFromSavegame(Stream *in, GuiSvgVersion svg_ver) {
@@ -415,6 +417,8 @@ void GUIListBox::ReadFromSavegame(Stream *in, GuiSvgVersion svg_ver) {
SavedGameIndex[i] = in->ReadInt16();
TopItem = in->ReadInt32();
SelectedItem = in->ReadInt32();
+
+ UpdateMetrics();
}
void GUIListBox::WriteToSavegame(Stream *out) const {
diff --git a/engines/ags/shared/gui/gui_main.cpp b/engines/ags/shared/gui/gui_main.cpp
index 77c9a17f024..b72025a9d35 100644
--- a/engines/ags/shared/gui/gui_main.cpp
+++ b/engines/ags/shared/gui/gui_main.cpp
@@ -705,21 +705,22 @@ void MarkForTranslationUpdate() {
}
void MarkForFontUpdate(int font) {
+ const bool update_all = (font < 0);
for (auto &btn : _GP(guibuts)) {
- if (btn.Font == font)
- btn.MarkChanged();
+ if (update_all || btn.Font == font)
+ btn.OnResized();
}
for (auto &lbl : _GP(guilabels)) {
- if (lbl.Font == font)
- lbl.MarkChanged();
+ if (update_all || lbl.Font == font)
+ lbl.OnResized();
}
for (auto &list : _GP(guilist)) {
- if (list.Font == font)
- list.MarkChanged();
+ if (update_all || list.Font == font)
+ list.OnResized();
}
for (auto &tb : _GP(guitext)) {
- if (tb.Font == font)
- tb.MarkChanged();
+ if (update_all || tb.Font == font)
+ tb.OnResized();
}
}
diff --git a/engines/ags/shared/gui/gui_main.h b/engines/ags/shared/gui/gui_main.h
index 625f23681c1..6bcc115500b 100644
--- a/engines/ags/shared/gui/gui_main.h
+++ b/engines/ags/shared/gui/gui_main.h
@@ -231,7 +231,8 @@ void DrawTextAlignedHor(Bitmap *ds, const char *text, int font, color_t text_col
void MarkAllGUIForUpdate();
// Mark all translatable GUI controls for redraw
void MarkForTranslationUpdate();
-// Mark all GUI which use the given font for redraw
+// Mark all GUI which use the given font for recalculate/redraw;
+// pass -1 to update all the textual controls together
void MarkForFontUpdate(int font);
// Mark labels that acts as special text placeholders for redraw
void MarkSpecialLabelsForUpdate(GUILabelMacro macro);
diff --git a/engines/ags/shared/gui/gui_slider.cpp b/engines/ags/shared/gui/gui_slider.cpp
index 492d733fc9b..4bd8a241d25 100644
--- a/engines/ags/shared/gui/gui_slider.cpp
+++ b/engines/ags/shared/gui/gui_slider.cpp
@@ -243,6 +243,8 @@ void GUISlider::ReadFromFile(Stream *in, GuiVersion gui_version) {
HandleOffset = 0;
BgImage = 0;
}
+
+ UpdateMetrics();
}
void GUISlider::WriteToFile(Stream *out) const {
@@ -263,6 +265,8 @@ void GUISlider::ReadFromSavegame(Stream *in, GuiSvgVersion svg_ver) {
MinValue = in->ReadInt32();
MaxValue = in->ReadInt32();
Value = in->ReadInt32();
+
+ UpdateMetrics();
}
void GUISlider::WriteToSavegame(Stream *out) const {
Commit: 9ced7b370c70864032347749cf17dacd8a2f9f7a
https://github.com/scummvm/scummvm/commit/9ced7b370c70864032347749cf17dacd8a2f9f7a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T19:16:26+01:00
Commit Message:
AGS: fixed GUIListBox drawing double border outside of the clip
>From upstream 0cece949e68d4fe55c6943654643abdc3bbb40d4
Changed paths:
engines/ags/shared/gui/gui_listbox.cpp
diff --git a/engines/ags/shared/gui/gui_listbox.cpp b/engines/ags/shared/gui/gui_listbox.cpp
index 30b1a95e332..31b2a5427e3 100644
--- a/engines/ags/shared/gui/gui_listbox.cpp
+++ b/engines/ags/shared/gui/gui_listbox.cpp
@@ -136,9 +136,9 @@ void GUIListBox::Draw(Bitmap *ds, int x, int y) {
color_t text_color = ds->GetCompatibleColor(TextColor);
color_t draw_color = ds->GetCompatibleColor(TextColor);
if (IsBorderShown()) {
- ds->DrawRect(Rect(x, y, x + width + (pixel_size - 1), y + height + (pixel_size - 1)), draw_color);
+ ds->DrawRect(Rect(x, y, x + width, y + height), draw_color);
if (pixel_size > 1)
- ds->DrawRect(Rect(x + 1, y + 1, x + width, y + height), draw_color);
+ ds->DrawRect(Rect(x + 1, y + 1, x + width - 1, y + height - 1), draw_color);
}
int right_hand_edge = (x + width) - pixel_size - 1;
Commit: eb252cf8244434747db966c2c26530223727f436
https://github.com/scummvm/scummvm/commit/eb252cf8244434747db966c2c26530223727f436
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T19:23:13+01:00
Commit Message:
AGS: fixed case when imported sprite got flags from placeholder
This could make a new sprite look differently, depending on placeholder's (sprite 0) settings, until the game is saved once.
>From upstream f2a922a9cefd40337502bde734503605a76550db
Changed paths:
engines/ags/shared/ac/sprite_cache.cpp
engines/ags/shared/ac/sprite_cache.h
diff --git a/engines/ags/shared/ac/sprite_cache.cpp b/engines/ags/shared/ac/sprite_cache.cpp
index 952e061c2f3..a454d00ec81 100644
--- a/engines/ags/shared/ac/sprite_cache.cpp
+++ b/engines/ags/shared/ac/sprite_cache.cpp
@@ -105,19 +105,23 @@ void SpriteCache::Reset() {
_lockedSize = 0;
}
-void SpriteCache::SetSprite(sprkey_t index, Bitmap *sprite) {
+bool SpriteCache::SetSprite(sprkey_t index, Bitmap *sprite, int flags) {
if (index < 0 || EnlargeTo(index) != index) {
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Error, "SetSprite: unable to use index %d", index);
- return;
+ return false;
}
if (!sprite) {
Debug::Printf(kDbgGroup_SprCache, kDbgMsg_Error, "SetSprite: attempt to assign nullptr to index %d", index);
- return;
+ return false;
}
_spriteData[index].Image = sprite;
_spriteData[index].Flags = SPRCACHEFLAG_LOCKED; // NOT from asset file
_spriteData[index].Size = 0;
+ _sprInfos[index].Flags = flags;
+ _sprInfos[index].Width = sprite->GetWidth();
+ _sprInfos[index].Height = sprite->GetHeight();
SprCacheLog("SetSprite: (external) %d", index);
+ return true;
}
void SpriteCache::SetEmptySprite(sprkey_t index, bool as_asset) {
diff --git a/engines/ags/shared/ac/sprite_cache.h b/engines/ags/shared/ac/sprite_cache.h
index d1715407c67..d5d846ff50b 100644
--- a/engines/ags/shared/ac/sprite_cache.h
+++ b/engines/ags/shared/ac/sprite_cache.h
@@ -134,7 +134,8 @@ public:
// Deletes all data and resets cache to the clear state
void Reset();
// Assigns new sprite for the given index; this sprite won't be auto disposed
- void SetSprite(sprkey_t index, Shared::Bitmap *);
+ // flags are SPF_* constants that define sprite's behavior in game.
+ bool SetSprite(sprkey_t index, Shared::Bitmap *, int flags = 0);
// Assigns new sprite for the given index, remapping it to sprite 0;
// optionally marks it as an asset placeholder
void SetEmptySprite(sprkey_t index, bool as_asset);
Commit: dd9595c8ce227e5309668f7d42a454548a3c848a
https://github.com/scummvm/scummvm/commit/dd9595c8ce227e5309668f7d42a454548a3c848a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T19:29:11+01:00
Commit Message:
AGS: don't zero slider's HandleImage internally if sprite is missing
This may lead to unexpected effects when resources are not fully preloaded yet, but a Slider's "UpdateMetrics" was called.
>From upstream 5654fb52a64904a6b0cdcec674224f7a0d91a8eb
Changed paths:
engines/ags/shared/gui/gui_slider.cpp
diff --git a/engines/ags/shared/gui/gui_slider.cpp b/engines/ags/shared/gui/gui_slider.cpp
index 4bd8a241d25..68b0237cd47 100644
--- a/engines/ags/shared/gui/gui_slider.cpp
+++ b/engines/ags/shared/gui/gui_slider.cpp
@@ -82,10 +82,8 @@ void GUISlider::UpdateMetrics() {
if (MinValue >= MaxValue)
MaxValue = MinValue + 1;
Value = Math::Clamp(Value, MinValue, MaxValue);
- // Test if sprite is available
- // TODO: react to sprites initialization/deletion instead!
- if (_GP(spriteset)[HandleImage] == nullptr)
- HandleImage = 0;
+ // Test if sprite is available; // TODO: return a placeholder from spriteset instead!
+ const int handle_im = _GP(spriteset)[HandleImage] ? HandleImage : 0;
// Depending on slider's orientation, thickness is either Height or Width
const int thickness = IsHorizontal() ? Height : Width;
@@ -96,10 +94,10 @@ void GUISlider::UpdateMetrics() {
// Calculate handle size
Size handle_sz;
- if (HandleImage > 0) // handle is a sprite
+ if (handle_im > 0) // handle is a sprite
{
- handle_sz = Size(get_adjusted_spritewidth(HandleImage),
- get_adjusted_spriteheight(HandleImage));
+ handle_sz = Size(get_adjusted_spritewidth(handle_im),
+ get_adjusted_spriteheight(handle_im));
} else // handle is a drawn rectangle
{
if (IsHorizontal())
@@ -180,9 +178,11 @@ void GUISlider::Draw(Bitmap *ds, int x, int y) {
ds->DrawLine(Line(bar.Left, bar.Bottom, bar.Right, bar.Bottom), draw_color);
}
- if (HandleImage > 0) // handle is a sprite
+ // Test if sprite is available; // TODO: return a placeholder from spriteset instead!
+ const int handle_im = _GP(spriteset)[HandleImage] ? HandleImage : 0;
+ if (handle_im > 0) // handle is a sprite
{
- draw_gui_sprite(ds, HandleImage, handle.Left, handle.Top, true);
+ draw_gui_sprite(ds, handle_im, handle.Left, handle.Top, true);
} else // handle is a drawn rectangle
{
// normal grey tracker handle
Commit: 56f9bfba9ea4b24c8089c5e3d42d89f79632706f
https://github.com/scummvm/scummvm/commit/56f9bfba9ea4b24c8089c5e3d42d89f79632706f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T19:36:47+01:00
Commit Message:
AGS: fixed GUISlider::IsOverControl() comparing abs with rel coords
Was broken likely by dec832ad4 (upstream 9394a2d)
>From upstream 77c10eb3757029d8d185d9b161890d05203d90af
Changed paths:
engines/ags/shared/gui/gui_slider.cpp
diff --git a/engines/ags/shared/gui/gui_slider.cpp b/engines/ags/shared/gui/gui_slider.cpp
index 68b0237cd47..9c08ac2dcaa 100644
--- a/engines/ags/shared/gui/gui_slider.cpp
+++ b/engines/ags/shared/gui/gui_slider.cpp
@@ -58,7 +58,7 @@ bool GUISlider::IsOverControl(int x, int y, int leeway) const {
if (GUIObject::IsOverControl(x, y, leeway))
return true;
// now check the handle too
- return _cachedHandle.IsInside(Point(x, y));
+ return _cachedHandle.IsInside(Point(x - X, y - Y));
}
Rect GUISlider::CalcGraphicRect(bool /*clipped*/) {
Commit: 3e194453fadcca6ff8064f2557db8e5e8e16bb54
https://github.com/scummvm/scummvm/commit/3e194453fadcca6ff8064f2557db8e5e8e16bb54
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-10-09T19:40:04+01:00
Commit Message:
AGS: Updated build version (3.6.0.30)
>From upstream 836a6bd1fb4f642272ed99eccae68eab33fa1ab8
Changed paths:
engines/ags/shared/core/def_version.h
diff --git a/engines/ags/shared/core/def_version.h b/engines/ags/shared/core/def_version.h
index 31e28624132..4f2d45b5c9d 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,9 +22,9 @@
#ifndef AGS_SHARED_CORE_DEFVERSION_H
#define AGS_SHARED_CORE_DEFVERSION_H
-#define ACI_VERSION_STR "3.6.0.29"
+#define ACI_VERSION_STR "3.6.0.30"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.29
+#define ACI_VERSION_MSRC_DEF 3.6.0.30
#endif
#define SPECIAL_VERSION ""
More information about the Scummvm-git-logs
mailing list