[Scummvm-git-logs] scummvm master -> 0a305db7ec44b013e327b54f92140365e6b836d8
dreammaster
dreammaster at scummvm.org
Sat Mar 13 05:52:57 UTC 2021
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2f094655f1 AGS: Move script_runtime.cpp globals to Globals
24d800ae1b AGS: Move agsstaticobject.cpp globals to Globals
a18be9c938 AGS: Move miscellaneous engine/ac/ globals to Globals
0a305db7ec AGS: Move guimain.cpp globals to Globals
Commit: 2f094655f186af3aab28870eeea9fe7878ac7a32
https://github.com/scummvm/scummvm/commit/2f094655f186af3aab28870eeea9fe7878ac7a32
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-12T20:59:14-08:00
Commit Message:
AGS: Move script_runtime.cpp globals to Globals
Changed paths:
engines/ags/engine/ac/game.cpp
engines/ags/engine/ac/global_game.cpp
engines/ags/engine/gfx/gfx_util.cpp
engines/ags/engine/platform/base/agsplatformdriver.cpp
engines/ags/engine/platform/windows/gfx/ali3dd3d.cpp
engines/ags/engine/platform/windows/win_ex_handling.cpp
engines/ags/engine/script/cc_instance.cpp
engines/ags/engine/script/script_runtime.cpp
engines/ags/globals.cpp
engines/ags/globals.h
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index 163efc2a06..5fcbb48b17 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -109,10 +109,6 @@ namespace AGS3 {
using namespace AGS::Shared;
using namespace AGS::Engine;
-#if AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_ANDROID
-extern int _G(psp_gfx_renderer);
-#endif
-
//=============================================================================
// Audio
//=============================================================================
diff --git a/engines/ags/engine/ac/global_game.cpp b/engines/ags/engine/ac/global_game.cpp
index 1860483907..93c3400308 100644
--- a/engines/ags/engine/ac/global_game.cpp
+++ b/engines/ags/engine/ac/global_game.cpp
@@ -77,10 +77,6 @@ using namespace AGS::Shared;
extern int gui_disabled_style;
-#if AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_ANDROID
-extern int _G(psp_gfx_renderer);
-#endif
-
void GiveScore(int amnt) {
guis_need_update = 1;
_GP(play).score += amnt;
diff --git a/engines/ags/engine/gfx/gfx_util.cpp b/engines/ags/engine/gfx/gfx_util.cpp
index 298079fc2c..c5b50c7a11 100644
--- a/engines/ags/engine/gfx/gfx_util.cpp
+++ b/engines/ags/engine/gfx/gfx_util.cpp
@@ -26,11 +26,6 @@
namespace AGS3 {
-// CHECKME: is this hack still relevant?
-#if AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_ANDROID
-extern int _G(psp_gfx_renderer);
-#endif
-
namespace AGS {
namespace Engine {
diff --git a/engines/ags/engine/platform/base/agsplatformdriver.cpp b/engines/ags/engine/platform/base/agsplatformdriver.cpp
index 97569bd0f4..e90ad0a82c 100644
--- a/engines/ags/engine/platform/base/agsplatformdriver.cpp
+++ b/engines/ags/engine/platform/base/agsplatformdriver.cpp
@@ -190,10 +190,6 @@ void AGSPlatformDriver::PrintMessage(const Shared::DebugMessage &msg) {
#if defined (AGS_HAS_CD_AUDIO)
-// from ac_cdplayer
-extern int _G(use_cdplayer);
-extern int _G(need_to_stop_cd);
-
int numcddrives = 0;
int cd_player_init() {
diff --git a/engines/ags/engine/platform/windows/gfx/ali3dd3d.cpp b/engines/ags/engine/platform/windows/gfx/ali3dd3d.cpp
index a53c0a328d..0ce78f8663 100644
--- a/engines/ags/engine/platform/windows/gfx/ali3dd3d.cpp
+++ b/engines/ags/engine/platform/windows/gfx/ali3dd3d.cpp
@@ -49,9 +49,6 @@ namespace AGS3 {
using namespace AGS::Shared;
-// Necessary to update textures from 8-bit bitmaps
-extern RGB palette[256];
-
//
// Following functions implement various matrix operations. Normally they are found in the auxiliary d3d9x.dll,
// but we do not want AGS to be dependent on it.
diff --git a/engines/ags/engine/platform/windows/win_ex_handling.cpp b/engines/ags/engine/platform/windows/win_ex_handling.cpp
index c57f728ac3..f103d107f7 100644
--- a/engines/ags/engine/platform/windows/win_ex_handling.cpp
+++ b/engines/ags/engine/platform/windows/win_ex_handling.cpp
@@ -41,9 +41,6 @@ namespace AGS3 {
using namespace AGS::Shared;
-extern int _G(our_eip);
-extern int _G(eip_guinum);
-extern int _G(eip_guiobj);
extern int proper_exit;
char tempmsg[100];
diff --git a/engines/ags/engine/script/cc_instance.cpp b/engines/ags/engine/script/cc_instance.cpp
index 79bcf29e5e..90375745ca 100644
--- a/engines/ags/engine/script/cc_instance.cpp
+++ b/engines/ags/engine/script/cc_instance.cpp
@@ -50,14 +50,6 @@ namespace AGS3 {
using namespace AGS::Shared;
using namespace AGS::Shared::Memory;
-extern ccInstance *loadedInstances[MAX_LOADED_INSTANCES]; // in script/script_runtime
-
- // in script/script
-extern int maxWhileLoops;
-extern new_line_hook_type new_line_hook;
-
-
-
enum ScriptOpArgIsReg {
kScOpNoArgIsReg = 0,
kScOpArg1IsReg = 0x0001,
@@ -356,8 +348,8 @@ int ccInstance::CallScriptFunction(const char *funcname, int32_t numargs, const
// object with ref count 0 that is in use
_GP(pool).RunGarbageCollectionIfAppropriate();
- if (new_line_hook)
- new_line_hook(nullptr, 0);
+ if (_G(new_line_hook))
+ _G(new_line_hook)(nullptr, 0);
if (reterr)
return -6;
@@ -525,8 +517,8 @@ int ccInstance::Run(int32_t curpc) {
case SCMD_LINENUM:
line_number = arg1.IValue;
_G(currentline) = arg1.IValue;
- if (new_line_hook)
- new_line_hook(this, _G(currentline));
+ if (_G(new_line_hook))
+ _G(new_line_hook)(this, _G(currentline));
break;
case SCMD_ADD:
// If the the register is SREG_SP, we are allocating new variable on the stack
@@ -760,13 +752,13 @@ int ccInstance::Run(int32_t curpc) {
case SCMD_JMP:
pc += arg1.IValue;
- if ((arg1.IValue < 0) && (maxWhileLoops > 0) && (loopIterationCheckDisabled == 0)) {
+ if ((arg1.IValue < 0) && (_G(maxWhileLoops) > 0) && (loopIterationCheckDisabled == 0)) {
// Make sure it's not stuck in a While loop
loopIterations ++;
if (flags & INSTF_RUNNING) {
loopIterations = 0;
flags &= ~INSTF_RUNNING;
- } else if (loopIterations > maxWhileLoops) {
+ } else if (loopIterations > _G(maxWhileLoops)) {
cc_error("!Script appears to be hung (a while loop ran %d times). The problem may be in a calling function; check the call stack.", loopIterations);
return -1;
}
@@ -943,7 +935,7 @@ int ccInstance::Run(int32_t curpc) {
// extract the instance ID
int32_t instId = codeOp.Instruction.InstanceId;
// determine the offset into the code of the instance we want
- runningInst = loadedInstances[instId];
+ runningInst = _G(loadedInstances)[instId];
intptr_t callAddr = reg1.Ptr - (char *)&runningInst->code[0];
if (callAddr % sizeof(intptr_t) != 0) {
cc_error("call address not aligned");
@@ -1336,8 +1328,8 @@ bool ccInstance::_Create(PScript scri, ccInstance *joined) {
// find a LoadedInstance slot for it
for (i = 0; i < MAX_LOADED_INSTANCES; i++) {
- if (loadedInstances[i] == nullptr) {
- loadedInstances[i] = this;
+ if (_G(loadedInstances)[i] == nullptr) {
+ _G(loadedInstances)[i] = this;
loadedInstanceId = i;
break;
}
@@ -1413,8 +1405,8 @@ void ccInstance::Free() {
}
// remove from the Active Instances list
- if (loadedInstances[loadedInstanceId] == this)
- loadedInstances[loadedInstanceId] = nullptr;
+ if (_G(loadedInstances)[loadedInstanceId] == this)
+ _G(loadedInstances)[loadedInstanceId] = nullptr;
if ((flags & INSTF_SHAREDATA) == 0) {
nullfree(globaldata);
diff --git a/engines/ags/engine/script/script_runtime.cpp b/engines/ags/engine/script/script_runtime.cpp
index 4d6c62f4f6..26b2a28da8 100644
--- a/engines/ags/engine/script/script_runtime.cpp
+++ b/engines/ags/engine/script/script_runtime.cpp
@@ -83,11 +83,6 @@ void ccRemoveAllSymbols() {
_GP(simp).clear();
}
-ccInstance *loadedInstances[MAX_LOADED_INSTANCES] = { nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
-};
-
void nullfree(void *data) {
if (data != nullptr)
free(data);
@@ -119,16 +114,11 @@ void *ccGetSymbolAddressForPlugin(const String &name) {
return nullptr;
}
-new_line_hook_type new_line_hook = nullptr;
-
-char ccRunnerCopyright[] = "ScriptExecuter32 v" SCOM_VERSIONSTR " (c) 2001 Chris Jones";
-int maxWhileLoops = 0;
-
// If a while loop does this many iterations without the
// NofityScriptAlive function getting called, the script
// aborts. Set to 0 to disable.
void ccSetScriptAliveTimer(int numloop) {
- maxWhileLoops = numloop;
+ _G(maxWhileLoops) = numloop;
}
void ccNotifyScriptStillAlive() {
@@ -137,7 +127,7 @@ void ccNotifyScriptStillAlive() {
}
void ccSetDebugHook(new_line_hook_type jibble) {
- new_line_hook = jibble;
+ _G(new_line_hook) = jibble;
}
int call_function(intptr_t addr, const RuntimeScriptValue *object, int numparm, const RuntimeScriptValue *parms) {
diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp
index 4d0d9d2c18..f19f6350c1 100644
--- a/engines/ags/globals.cpp
+++ b/engines/ags/globals.cpp
@@ -282,6 +282,10 @@ Globals::Globals() {
_objectScriptObjNames = new String[MAX_ROOM_OBJECTS];
_guiScriptObjNames = new std::vector<String>();
+ // script_runtime.cpp globals
+ Common::fill(_loadedInstances, _loadedInstances + MAX_LOADED_INSTANCES,
+ (ccInstance *)nullptr);
+
// systemimports.cpp globals
_simp = new SystemImports();
_simp_for_plugin = new SystemImports();
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 075057d9df..1a01cae5d5 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -33,6 +33,7 @@
#include "ags/engine/main/engine.h"
#include "ags/engine/media/audio/audiodefines.h"
#include "ags/engine/script/script.h"
+#include "ags/engine/script/script_runtime.h"
#include "ags/lib/std/array.h"
#include "ags/lib/std/set.h"
#include "ags/lib/allegro/color.h"
@@ -1039,7 +1040,18 @@ public:
/**@}*/
/**
- * \defgroup script globals
+ * \defgroup script_runtime globals
+ * @{
+ */
+
+ new_line_hook_type _new_line_hook = nullptr;
+ int _maxWhileLoops = 0;
+ ccInstance *_loadedInstances[MAX_LOADED_INSTANCES];
+
+ /**@}*/
+
+ /**
+ * \defgroup systemimports globals
* @{
*/
Commit: 24d800ae1bbf9441bb6978f5c944f1018e644e6c
https://github.com/scummvm/scummvm/commit/24d800ae1bbf9441bb6978f5c944f1018e644e6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-12T21:14:38-08:00
Commit Message:
AGS: Move agsstaticobject.cpp globals to Globals
Changed paths:
engines/ags/engine/ac/game.cpp
engines/ags/engine/ac/statobj/agsstaticobject.cpp
engines/ags/engine/ac/statobj/agsstaticobject.h
engines/ags/engine/game/game_init.cpp
engines/ags/engine/script/cc_instance.cpp
engines/ags/engine/script/script_api.h
engines/ags/globals.cpp
engines/ags/globals.h
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index 5fcbb48b17..d0100b7715 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -2190,12 +2190,12 @@ void RegisterGameAPI() {
}
void RegisterStaticObjects() {
- ccAddExternalStaticObject("game", &_GP(play), &GameStaticManager);
- ccAddExternalStaticObject("gs_globals", &_GP(play).globalvars[0], &GlobalStaticManager);
- ccAddExternalStaticObject("mouse", &_GP(scmouse), &GlobalStaticManager);
- ccAddExternalStaticObject("palette", &_G(palette)[0], &GlobalStaticManager);
- ccAddExternalStaticObject("system", &_GP(scsystem), &GlobalStaticManager);
- ccAddExternalStaticObject("savegameindex", &_GP(play).filenumbers[0], &GlobalStaticManager);
+ ccAddExternalStaticObject("game", &_GP(play), &_GP(GameStaticManager));
+ ccAddExternalStaticObject("gs_globals", &_GP(play).globalvars[0], &_GP(GlobalStaticManager));
+ ccAddExternalStaticObject("mouse", &_GP(scmouse), &_GP(GlobalStaticManager));
+ ccAddExternalStaticObject("palette", &_G(palette)[0], &_GP(GlobalStaticManager));
+ ccAddExternalStaticObject("system", &_GP(scsystem), &_GP(GlobalStaticManager));
+ ccAddExternalStaticObject("savegameindex", &_GP(play).filenumbers[0], &_GP(GlobalStaticManager));
}
} // namespace AGS3
diff --git a/engines/ags/engine/ac/statobj/agsstaticobject.cpp b/engines/ags/engine/ac/statobj/agsstaticobject.cpp
index 9420dc0824..f88c98234e 100644
--- a/engines/ags/engine/ac/statobj/agsstaticobject.cpp
+++ b/engines/ags/engine/ac/statobj/agsstaticobject.cpp
@@ -27,9 +27,6 @@
namespace AGS3 {
-AGSStaticObject GlobalStaticManager;
-StaticGame GameStaticManager;
-
const char *AGSStaticObject::GetFieldPtr(const char *address, intptr_t offset) {
return address + offset;
}
diff --git a/engines/ags/engine/ac/statobj/agsstaticobject.h b/engines/ags/engine/ac/statobj/agsstaticobject.h
index d4e6e3c8d7..a48a0c1915 100644
--- a/engines/ags/engine/ac/statobj/agsstaticobject.h
+++ b/engines/ags/engine/ac/statobj/agsstaticobject.h
@@ -49,9 +49,6 @@ struct StaticGame : public AGSStaticObject {
void WriteInt32(const char *address, intptr_t offset, int32_t val) override;
};
-extern AGSStaticObject GlobalStaticManager;
-extern StaticGame GameStaticManager;
-
} // namespace AGS3
#endif
diff --git a/engines/ags/engine/game/game_init.cpp b/engines/ags/engine/game/game_init.cpp
index 26ca795761..2b75806d42 100644
--- a/engines/ags/engine/game/game_init.cpp
+++ b/engines/ags/engine/game/game_init.cpp
@@ -57,8 +57,6 @@ namespace AGS3 {
using namespace Shared;
using namespace Engine;
-extern AGSStaticObject GlobalStaticManager;
-
namespace AGS {
namespace Engine {
@@ -248,7 +246,7 @@ HError InitAndRegisterGameEntities() {
setup_player_character(_GP(game).playercharacter);
if (_G(loaded_game_file_version) >= kGameVersion_270)
- ccAddExternalStaticObject("player", &_G(sc_PlayerCharPtr), &GlobalStaticManager);
+ ccAddExternalStaticObject("player", &_G(sc_PlayerCharPtr), &_GP(GlobalStaticManager));
return HError::None();
}
diff --git a/engines/ags/engine/script/cc_instance.cpp b/engines/ags/engine/script/cc_instance.cpp
index 90375745ca..dd3acf9053 100644
--- a/engines/ags/engine/script/cc_instance.cpp
+++ b/engines/ags/engine/script/cc_instance.cpp
@@ -1492,7 +1492,7 @@ bool ccInstance::CreateGlobalVars(PScript scri) {
return false;
}
// TODO: register this explicitly as a string instead (can do this later)
- glvar.RValue.SetStaticObject(globaldata + data_addr, &GlobalStaticManager);
+ glvar.RValue.SetStaticObject(globaldata + data_addr, &_GP(GlobalStaticManager));
}
break;
default:
diff --git a/engines/ags/engine/script/script_api.h b/engines/ags/engine/script/script_api.h
index 1a314ec771..4c343581de 100644
--- a/engines/ags/engine/script/script_api.h
+++ b/engines/ags/engine/script/script_api.h
@@ -374,7 +374,7 @@ inline const char *ScriptVSprintf(char *buffer, size_t buf_length, const char *f
#define API_SCALL_STOBJ_POBJ2(RET_CLASS, FUNCTION, P1CLASS, P2CLASS) \
ASSERT_PARAM_COUNT(FUNCTION, 2); \
RET_CLASS* ret_obj = FUNCTION((P1CLASS*)params[0].Ptr, (P2CLASS*)params[1].Ptr); \
- return RuntimeScriptValue().SetStaticObject(ret_obj, &GlobalStaticManager)
+ return RuntimeScriptValue().SetStaticObject(ret_obj, &_GP(GlobalStaticManager))
//-----------------------------------------------------------------------------
// Calls to object functions
diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp
index f19f6350c1..6892e4e6da 100644
--- a/engines/ags/globals.cpp
+++ b/engines/ags/globals.cpp
@@ -98,7 +98,9 @@ Globals *g_globals;
Globals::Globals() {
g_globals = this;
- Common::fill(&_mousecurs[0], &_mousecurs[MAXCURSORS], nullptr);
+ // agsstaticobject.cpp globals
+ _GlobalStaticManager = new AGSStaticObject();
+ _GameStaticManager = new StaticGame();
// audio.cpp globals
_audioChannels = new std::array<SOUNDCLIP *>(MAX_SOUND_CHANNELS + 1);
@@ -241,6 +243,7 @@ Globals::Globals() {
// mouse.cpp globals
_scmouse = new ScriptMouse();
+ Common::fill(&_mousecurs[0], &_mousecurs[MAXCURSORS], nullptr);
// mousew32.cpp globals
_mouse = new Mouse();
@@ -302,6 +305,10 @@ Globals::Globals() {
Globals::~Globals() {
g_globals = nullptr;
+ // agsstaticobject.cpp globals
+ delete _GlobalStaticManager;
+ delete _GameStaticManager;
+
// audio.cpp globals
delete _audioChannels;
delete _ambient;
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 1a01cae5d5..3618a6c77c 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -87,6 +87,7 @@ class WFNFontRenderer;
struct ActiveDisplaySetting;
struct AGSDeSerializer;
struct AGSPlatformDriver;
+struct AGSStaticObject;
struct AmbientSound;
struct AnimatingGUIButton;
struct CachedActSpsData;
@@ -148,6 +149,7 @@ struct SOUNDCLIP;
struct SpeechLipSyncLine;
struct SpriteListEntry;
struct StaticArray;
+struct StaticGame;
struct SystemImports;
struct TopBarSettings;
struct TreeMap;
@@ -199,11 +201,12 @@ public:
/**@}*/
/**
- * \defgroup audio globals
+ * \defgroup agsstaticobject globals
* @{
*/
- AGSPlatformDriver *_platform = nullptr;
+ AGSStaticObject *_GlobalStaticManager;
+ StaticGame *_GameStaticManager;
/**@}*/
@@ -627,6 +630,7 @@ public:
AGS::Shared::String _saveGameSuffix;
bool _want_exit = false;
bool _abort_engine = false;
+ AGSPlatformDriver *_platform = nullptr;
RoomObject *_objs;
RoomStatus *_croom = nullptr;
Commit: a18be9c938e6d3104d5fcc9af653032c6f590780
https://github.com/scummvm/scummvm/commit/a18be9c938e6d3104d5fcc9af653032c6f590780
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-12T21:30:58-08:00
Commit Message:
AGS: Move miscellaneous engine/ac/ globals to Globals
Changed paths:
engines/ags/engine/ac/draw.cpp
engines/ags/engine/ac/dynobj/cc_dynamicarray.cpp
engines/ags/engine/ac/dynobj/cc_dynamicarray.h
engines/ags/engine/ac/dynobj/managedobjectpool.cpp
engines/ags/engine/ac/dynobj/managedobjectpool.h
engines/ags/engine/ac/file.cpp
engines/ags/engine/ac/global_string.cpp
engines/ags/engine/ac/room.cpp
engines/ags/engine/ac/scriptcontainers.cpp
engines/ags/engine/ac/string.cpp
engines/ags/engine/script/cc_instance.cpp
engines/ags/globals.cpp
engines/ags/globals.h
diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp
index 8637d24320..fa3e65095b 100644
--- a/engines/ags/engine/ac/draw.cpp
+++ b/engines/ags/engine/ac/draw.cpp
@@ -88,8 +88,6 @@ extern "C" void android_render();
extern "C" void ios_render();
#endif
-extern int bg_just_changed;
-
SpriteListEntry::SpriteListEntry()
: bmp(nullptr)
, pic(nullptr)
@@ -2237,9 +2235,9 @@ void render_graphics(IDriverDependantBitmap *extraBitmap, int extraX, int extraY
if (!_GP(play).screen_is_faded_out) {
// always update the palette, regardless of whether the plugin
// vetos the screen update
- if (bg_just_changed) {
+ if (_G(bg_just_changed)) {
setpal();
- bg_just_changed = 0;
+ _G(bg_just_changed) = 0;
}
}
diff --git a/engines/ags/engine/ac/dynobj/cc_dynamicarray.cpp b/engines/ags/engine/ac/dynobj/cc_dynamicarray.cpp
index 30b1aca788..72d7df6635 100644
--- a/engines/ags/engine/ac/dynobj/cc_dynamicarray.cpp
+++ b/engines/ags/engine/ac/dynobj/cc_dynamicarray.cpp
@@ -133,12 +133,9 @@ void CCDynamicArray::WriteFloat(const char *address, intptr_t offset, float val)
*(float *)(const_cast<char *>(address) + offset) = val;
}
-CCDynamicArray globalDynamicArray;
-
-
DynObjectRef DynamicArrayHelpers::CreateStringArray(const std::vector<const char *> items) {
// NOTE: we need element size of "handle" for array of managed pointers
- DynObjectRef arr = globalDynamicArray.Create(items.size(), sizeof(int32_t), true);
+ DynObjectRef arr = _GP(globalDynamicArray).Create(items.size(), sizeof(int32_t), true);
if (!arr.second)
return arr;
// Create script strings and put handles into array
diff --git a/engines/ags/engine/ac/dynobj/cc_dynamicarray.h b/engines/ags/engine/ac/dynobj/cc_dynamicarray.h
index 8df26233b8..62ac557b93 100644
--- a/engines/ags/engine/ac/dynobj/cc_dynamicarray.h
+++ b/engines/ags/engine/ac/dynobj/cc_dynamicarray.h
@@ -58,8 +58,6 @@ struct CCDynamicArray final : ICCDynamicObject {
void WriteFloat(const char *address, intptr_t offset, float val) override;
};
-extern CCDynamicArray globalDynamicArray;
-
// Helper functions for setting up dynamic arrays.
namespace DynamicArrayHelpers {
diff --git a/engines/ags/engine/ac/dynobj/managedobjectpool.cpp b/engines/ags/engine/ac/dynobj/managedobjectpool.cpp
index 9e8516c75a..16a6ce7d71 100644
--- a/engines/ags/engine/ac/dynobj/managedobjectpool.cpp
+++ b/engines/ags/engine/ac/dynobj/managedobjectpool.cpp
@@ -22,12 +22,13 @@
#include "ags/lib/std/vector.h"
#include "ags/engine/ac/dynobj/managedobjectpool.h"
-#include "ags/engine/ac/dynobj/cc_dynamicarray.h" // globalDynamicArray, constants
+#include "ags/engine/ac/dynobj/cc_dynamicarray.h" // _GP(globalDynamicArray), constants
#include "ags/shared/debugging/out.h"
#include "ags/shared/util/string_utils.h" // fputstring, etc
#include "ags/shared/script/cc_error.h"
#include "ags/shared/script/script_common.h"
#include "ags/shared/util/stream.h"
+#include "ags/globals.h"
namespace AGS3 {
@@ -303,7 +304,7 @@ int ManagedObjectPool::ReadFromDisk(Stream *in, ICCObjectReader *reader) {
}
in->Read(&serializeBuffer.front(), numBytes);
if (strcmp(typeNameBuffer, CC_DYNAMIC_ARRAY_TYPE_NAME) == 0) {
- globalDynamicArray.Unserialize(i, &serializeBuffer.front(), numBytes);
+ _GP(globalDynamicArray).Unserialize(i, &serializeBuffer.front(), numBytes);
} else {
reader->Unserialize(i, typeNameBuffer, &serializeBuffer.front(), numBytes);
}
@@ -328,7 +329,7 @@ int ManagedObjectPool::ReadFromDisk(Stream *in, ICCObjectReader *reader) {
}
in->Read(&serializeBuffer.front(), numBytes);
if (strcmp(typeNameBuffer, CC_DYNAMIC_ARRAY_TYPE_NAME) == 0) {
- globalDynamicArray.Unserialize(handle, &serializeBuffer.front(), numBytes);
+ _GP(globalDynamicArray).Unserialize(handle, &serializeBuffer.front(), numBytes);
} else {
reader->Unserialize(handle, typeNameBuffer, &serializeBuffer.front(), numBytes);
}
diff --git a/engines/ags/engine/ac/dynobj/managedobjectpool.h b/engines/ags/engine/ac/dynobj/managedobjectpool.h
index a27034358a..a33b76fe73 100644
--- a/engines/ags/engine/ac/dynobj/managedobjectpool.h
+++ b/engines/ags/engine/ac/dynobj/managedobjectpool.h
@@ -102,8 +102,6 @@ public:
const char *disableDisposeForObject{ nullptr };
};
-extern ManagedObjectPool pool;
-
#ifdef DEBUG_MANAGED_OBJECTS
#define ManagedObjectLog(...) Debug::Printf(kDbgGroup_ManObj, kDbgMsg_Debug, __VA_ARGS__)
#else
diff --git a/engines/ags/engine/ac/file.cpp b/engines/ags/engine/ac/file.cpp
index f1c04d2f7e..9d0845e0f3 100644
--- a/engines/ags/engine/ac/file.cpp
+++ b/engines/ags/engine/ac/file.cpp
@@ -57,9 +57,6 @@ namespace AGS3 {
using namespace AGS::Shared;
-
-extern int MAXSTRLEN;
-
// object-based File routines
int File_Exists(const char *fnmm) {
@@ -121,7 +118,7 @@ void File_ReadRawLine(sc_File *fil, char *buffer) {
Stream *in = get_valid_file_stream_from_handle(fil->handle, "File.ReadRawLine");
check_strlen(buffer);
int i = 0;
- while (i < MAXSTRLEN - 1) {
+ while (i < _G(MAXSTRLEN) - 1) {
buffer[i] = in->ReadInt8();
if (buffer[i] == 13) {
// CR -- skip LF and abort
diff --git a/engines/ags/engine/ac/global_string.cpp b/engines/ags/engine/ac/global_string.cpp
index 347e03cd2c..e82589b21d 100644
--- a/engines/ags/engine/ac/global_string.cpp
+++ b/engines/ags/engine/ac/global_string.cpp
@@ -26,11 +26,10 @@
#include "ags/engine/ac/runtime_defines.h"
#include "ags/engine/ac/string.h"
#include "ags/shared/util/string_compat.h"
+#include "ags/globals.h"
namespace AGS3 {
-extern int MAXSTRLEN;
-
int StrGetCharAt(const char *strin, int posn) {
if ((posn < 0) || (posn >= (int)strlen(strin)))
return 0;
@@ -50,7 +49,7 @@ void _sc_strcat(char *s1, const char *s2) {
// make sure they don't try to append a char to the string
VALIDATE_STRING(s2);
check_strlen(s1);
- int mosttocopy = (MAXSTRLEN - strlen(s1)) - 1;
+ int mosttocopy = (_G(MAXSTRLEN) - strlen(s1)) - 1;
// int numbf=_GP(game).iface[4].numbuttons;
my_strncpy(&s1[strlen(s1)], s2, mosttocopy);
}
@@ -78,7 +77,7 @@ return ags_stricmp (get_translation (s1), get_translation(s2));
void _sc_strcpy(char *destt, const char *text) {
VALIDATE_STRING(destt);
check_strlen(destt);
- my_strncpy(destt, text, MAXSTRLEN - 1);
+ my_strncpy(destt, text, _G(MAXSTRLEN) - 1);
}
} // namespace AGS3
diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index 0d5e0aa873..e62f833fa9 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -973,8 +973,6 @@ void compile_room_script() {
_GP(getDialogOptionsDimensionsFunc).roomHasFunction = true;
}
-int bg_just_changed = 0;
-
void on_background_frame_change() {
invalidate_screen();
@@ -999,7 +997,7 @@ void on_background_frame_change() {
// 256-colours, tell it to update the palette (will actually be done as
// close as possible to the screen update to prevent flicker problem)
if (_GP(game).color_depth == 1)
- bg_just_changed = 1;
+ _G(bg_just_changed) = 1;
}
void croom_ptr_clear() {
diff --git a/engines/ags/engine/ac/scriptcontainers.cpp b/engines/ags/engine/ac/scriptcontainers.cpp
index 267bdcabbd..86b01b092e 100644
--- a/engines/ags/engine/ac/scriptcontainers.cpp
+++ b/engines/ags/engine/ac/scriptcontainers.cpp
@@ -170,11 +170,11 @@ RuntimeScriptValue Sc_Dict_GetItemCount(void *self, const RuntimeScriptValue *pa
}
RuntimeScriptValue Sc_Dict_GetKeysAsArray(void *self, const RuntimeScriptValue *params, int32_t param_count) {
- API_OBJCALL_OBJ(ScriptDictBase, void, globalDynamicArray, Dict_GetKeysAsArray);
+ API_OBJCALL_OBJ(ScriptDictBase, void, _GP(globalDynamicArray), Dict_GetKeysAsArray);
}
RuntimeScriptValue Sc_Dict_GetValuesAsArray(void *self, const RuntimeScriptValue *params, int32_t param_count) {
- API_OBJCALL_OBJ(ScriptDictBase, void, globalDynamicArray, Dict_GetValuesAsArray);
+ API_OBJCALL_OBJ(ScriptDictBase, void, _GP(globalDynamicArray), Dict_GetValuesAsArray);
}
//=============================================================================
@@ -289,7 +289,7 @@ RuntimeScriptValue Sc_Set_GetItemCount(void *self, const RuntimeScriptValue *par
}
RuntimeScriptValue Sc_Set_GetItemAsArray(void *self, const RuntimeScriptValue *params, int32_t param_count) {
- API_OBJCALL_OBJ(ScriptSetBase, void, globalDynamicArray, Set_GetItemsAsArray);
+ API_OBJCALL_OBJ(ScriptSetBase, void, _GP(globalDynamicArray), Set_GetItemsAsArray);
}
diff --git a/engines/ags/engine/ac/string.cpp b/engines/ags/engine/ac/string.cpp
index ddf4f192a9..1e6636e6f4 100644
--- a/engines/ags/engine/ac/string.cpp
+++ b/engines/ags/engine/ac/string.cpp
@@ -264,13 +264,12 @@ size_t break_up_text_into_lines(const char *todis, SplitLines &lines, int wii, i
return lines.Count();
}
-int MAXSTRLEN = MAX_MAXSTRLEN;
void check_strlen(char *ptt) {
- MAXSTRLEN = MAX_MAXSTRLEN;
+ _G(MAXSTRLEN) = MAX_MAXSTRLEN;
const byte *charstart = (const byte *)&_GP(game).chars[0];
const byte *charend = charstart + sizeof(CharacterInfo) * _GP(game).numcharacters;
if (((const byte *)&ptt[0] >= charstart) && ((const byte *)&ptt[0] <= charend))
- MAXSTRLEN = 30;
+ _G(MAXSTRLEN) = 30;
}
/*void GetLanguageString(int indxx,char*buffr) {
diff --git a/engines/ags/engine/script/cc_instance.cpp b/engines/ags/engine/script/cc_instance.cpp
index dd3acf9053..082d0665b6 100644
--- a/engines/ags/engine/script/cc_instance.cpp
+++ b/engines/ags/engine/script/cc_instance.cpp
@@ -1084,8 +1084,8 @@ int ccInstance::Run(int32_t curpc) {
cc_error("invalid size for dynamic array; requested: %d, range: 1..%d", numElements, INT32_MAX);
return -1;
}
- DynObjectRef ref = globalDynamicArray.Create(numElements, arg2.IValue, arg3.GetAsBool());
- reg1.SetDynamicObject(ref.second, &globalDynamicArray);
+ DynObjectRef ref = _GP(globalDynamicArray).Create(numElements, arg2.IValue, arg3.GetAsBool());
+ reg1.SetDynamicObject(ref.second, &_GP(globalDynamicArray));
break;
}
case SCMD_NEWUSEROBJECT: {
diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp
index 6892e4e6da..e60eacf4ba 100644
--- a/engines/ags/globals.cpp
+++ b/engines/ags/globals.cpp
@@ -54,6 +54,7 @@
#include "ags/engine/ac/dynobj/cc_audioclip.h"
#include "ags/engine/ac/dynobj/cc_character.h"
#include "ags/engine/ac/dynobj/cc_dialog.h"
+#include "ags/engine/ac/dynobj/cc_dynamicarray.h"
#include "ags/engine/ac/dynobj/cc_gui.h"
#include "ags/engine/ac/dynobj/cc_guiobject.h"
#include "ags/engine/ac/dynobj/cc_hotspot.h"
@@ -120,6 +121,9 @@ Globals::Globals() {
// cc_serializer.cpp globals
_ccUnserializer = new AGSDeSerializer();
+ // cc_dynamicarray.cpp globals
+ _globalDynamicArray = new CCDynamicArray();
+
// cscdialog.cpp globals
_vobjs = new NewControl *[MAXCONTROLS];
_oswi = new OnScreenWindow[MAXSCREENWINDOWS];
@@ -323,6 +327,9 @@ Globals::~Globals() {
// cc_serializer.cpp globals
delete _ccUnserializer;
+ // cc_dynamicarray.cpp globals
+ delete _globalDynamicArray;
+
// cscdialog.cpp globals
delete[] _vobjs;
delete[] _oswi;
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 3618a6c77c..d63857e41b 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -95,6 +95,7 @@ struct CCAudioChannel;
struct CCAudioClip;
struct CCCharacter;
struct CCDialog;
+struct CCDynamicArray;
struct CCGUI;
struct CCGUIObject;
struct CCHotspot;
@@ -249,6 +250,15 @@ public:
/**@}*/
+ /**
+ * \defgroup cc_dynamicarray globals
+ * @{
+ */
+
+ CCDynamicArray *_globalDynamicArray;
+
+ /**@}*/
+
/**
* \defgroup cc_dynamicobject globals
* @{
@@ -970,6 +980,7 @@ public:
RGB_MAP *_rgb_table; // for 256-col antialiasing
int _new_room_flags = 0;
int _gs_to_newroom = -1;
+ int _bg_just_changed = 0;
/**@}*/
@@ -1054,6 +1065,15 @@ public:
/**@}*/
+ /**
+ * \defgroup string globals
+ * @{
+ */
+
+ int _MAXSTRLEN = MAX_MAXSTRLEN;
+
+ /**@}*/
+
/**
* \defgroup systemimports globals
* @{
Commit: 0a305db7ec44b013e327b54f92140365e6b836d8
https://github.com/scummvm/scummvm/commit/0a305db7ec44b013e327b54f92140365e6b836d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-03-12T21:39:16-08:00
Commit Message:
AGS: Move guimain.cpp globals to Globals
Changed paths:
engines/ags/engine/ac/button.cpp
engines/ags/engine/ac/character.cpp
engines/ags/engine/ac/display.cpp
engines/ags/engine/ac/draw.cpp
engines/ags/engine/ac/drawingsurface.cpp
engines/ags/engine/ac/global_character.cpp
engines/ags/engine/ac/global_game.cpp
engines/ags/engine/ac/global_gui.cpp
engines/ags/engine/ac/global_inventoryitem.cpp
engines/ags/engine/ac/global_invwindow.cpp
engines/ags/engine/ac/gui.cpp
engines/ags/engine/ac/guicontrol.cpp
engines/ags/engine/ac/guiinv.cpp
engines/ags/engine/ac/invwindow.cpp
engines/ags/engine/ac/label.cpp
engines/ags/engine/ac/listbox.cpp
engines/ags/engine/ac/mouse.cpp
engines/ags/engine/ac/room.cpp
engines/ags/engine/ac/slider.cpp
engines/ags/engine/ac/textbox.cpp
engines/ags/engine/game/savegame.cpp
engines/ags/engine/main/engine.cpp
engines/ags/engine/main/game_run.cpp
engines/ags/engine/script/script.cpp
engines/ags/globals.h
engines/ags/shared/gui/guibutton.cpp
engines/ags/shared/gui/guidefines.h
engines/ags/shared/gui/guilistbox.cpp
engines/ags/shared/gui/guimain.cpp
engines/ags/shared/gui/guimain.h
engines/ags/shared/gui/guiobject.cpp
engines/ags/shared/gui/guiobject.h
engines/ags/shared/gui/guislider.cpp
engines/ags/shared/gui/guitextbox.cpp
diff --git a/engines/ags/engine/ac/button.cpp b/engines/ags/engine/ac/button.cpp
index 8c4e9bb7bb..fb6e1b72bc 100644
--- a/engines/ags/engine/ac/button.cpp
+++ b/engines/ags/engine/ac/button.cpp
@@ -92,7 +92,7 @@ void Button_SetText(GUIButton *butt, const char *newtx) {
newtx = get_translation(newtx);
if (strcmp(butt->GetText(), newtx)) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
butt->SetText(newtx);
}
}
@@ -103,7 +103,7 @@ void Button_SetFont(GUIButton *butt, int newFont) {
if (butt->Font != newFont) {
butt->Font = newFont;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -118,7 +118,7 @@ int Button_GetClipImage(GUIButton *butt) {
void Button_SetClipImage(GUIButton *butt, int newval) {
if (butt->IsClippingImage() != (newval != 0)) {
butt->SetClipImage(newval != 0);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -140,7 +140,7 @@ void Button_SetMouseOverGraphic(GUIButton *guil, int slotn) {
guil->CurrentImage = slotn;
guil->MouseOverImage = slotn;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
FindAndRemoveButtonAnimation(guil->ParentId, guil->Id);
}
@@ -158,7 +158,7 @@ void Button_SetNormalGraphic(GUIButton *guil, int slotn) {
guil->Width = _GP(game).SpriteInfos[slotn].Width;
guil->Height = _GP(game).SpriteInfos[slotn].Height;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
FindAndRemoveButtonAnimation(guil->ParentId, guil->Id);
}
@@ -173,7 +173,7 @@ void Button_SetPushedGraphic(GUIButton *guil, int slotn) {
guil->CurrentImage = slotn;
guil->PushedImage = slotn;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
FindAndRemoveButtonAnimation(guil->ParentId, guil->Id);
}
@@ -184,7 +184,7 @@ int Button_GetTextColor(GUIButton *butt) {
void Button_SetTextColor(GUIButton *butt, int newcol) {
if (butt->TextColor != newcol) {
butt->TextColor = newcol;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -222,7 +222,7 @@ int UpdateAnimatingButton(int bu) {
_GP(guibuts)[_G(animbuts)[bu].buttonid].CurrentImage = _GP(guibuts)[_G(animbuts)[bu].buttonid].Image;
_GP(guibuts)[_G(animbuts)[bu].buttonid].PushedImage = 0;
_GP(guibuts)[_G(animbuts)[bu].buttonid].MouseOverImage = 0;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_G(animbuts)[bu].wait = _G(animbuts)[bu].speed + tview->loops[_G(animbuts)[bu].loop].frames[_G(animbuts)[bu].frame].speed;
return 0;
@@ -285,7 +285,7 @@ int Button_GetTextAlignment(GUIButton *butt) {
void Button_SetTextAlignment(GUIButton *butt, int align) {
if (butt->TextAlignment != align) {
butt->TextAlignment = (FrameAlignment)align;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
diff --git a/engines/ags/engine/ac/character.cpp b/engines/ags/engine/ac/character.cpp
index 57cf18f52d..21a7ae2950 100644
--- a/engines/ags/engine/ac/character.cpp
+++ b/engines/ags/engine/ac/character.cpp
@@ -123,7 +123,7 @@ void Character_AddInventory(CharacterInfo *chaa, ScriptInvItem *invi, int addInd
_G(charextra)[charid].invorder[addIndex] = inum;
}
_G(charextra)[charid].invorder_count++;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
if (chaa == _G(playerchar))
run_on_event(GE_ADD_INV, RuntimeScriptValue().SetInt32(inum));
@@ -665,7 +665,7 @@ void Character_LoseInventory(CharacterInfo *chap, ScriptInvItem *invi) {
}
}
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
if (chap == _G(playerchar))
run_on_event(GE_LOSE_INV, RuntimeScriptValue().SetInt32(inum));
@@ -1032,7 +1032,7 @@ ScriptInvItem *Character_GetActiveInventory(CharacterInfo *chaa) {
}
void Character_SetActiveInventory(CharacterInfo *chaa, ScriptInvItem *iit) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
if (iit == nullptr) {
chaa->activeinv = -1;
diff --git a/engines/ags/engine/ac/display.cpp b/engines/ags/engine/ac/display.cpp
index a7ad4e566f..fa88de1b88 100644
--- a/engines/ags/engine/ac/display.cpp
+++ b/engines/ags/engine/ac/display.cpp
@@ -111,7 +111,7 @@ int _display_main(int xx, int yy, int wii, const char *text, int disp_type, int
}
if (asspch > 0) {
- // update the all_buttons_disabled variable in advance
+ // update the _G(all_buttons_disabled) variable in advance
// of the adjust_x/y_for_guis calls
_GP(play).disabled_user_interface++;
update_gui_disabled_status();
diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp
index fa3e65095b..ab14d93364 100644
--- a/engines/ags/engine/ac/draw.cpp
+++ b/engines/ags/engine/ac/draw.cpp
@@ -1890,11 +1890,11 @@ void draw_gui_and_overlays() {
quit("!The player.activeinv variable has been corrupted, probably as a result\n"
"of an incorrect assignment in the game script.");
}
- if (_G(playerchar)->activeinv < 1) gui_inv_pic = -1;
- else gui_inv_pic = _GP(game).invinfo[_G(playerchar)->activeinv].pic;
+ if (_G(playerchar)->activeinv < 1) _G(gui_inv_pic) = -1;
+ else _G(gui_inv_pic) = _GP(game).invinfo[_G(playerchar)->activeinv].pic;
_G(our_eip) = 37;
- if (guis_need_update) {
- guis_need_update = 0;
+ if (_G(guis_need_update)) {
+ _G(guis_need_update) = 0;
for (aa = 0; aa < _GP(game).numgui; aa++) {
if (!_GP(guis)[aa].IsDisplayed()) continue;
@@ -1934,7 +1934,7 @@ void draw_gui_and_overlays() {
// Don't draw GUI if "GUIs Turn Off When Disabled"
if ((_GP(game).options[OPT_DISABLEOFF] == 3) &&
- (all_buttons_disabled > 0) &&
+ (_G(all_buttons_disabled) > 0) &&
(_GP(guis)[aa].PopupStyle != kGUIPopupNoAutoRemove))
continue;
diff --git a/engines/ags/engine/ac/drawingsurface.cpp b/engines/ags/engine/ac/drawingsurface.cpp
index 4e4775018d..d72e538382 100644
--- a/engines/ags/engine/ac/drawingsurface.cpp
+++ b/engines/ags/engine/ac/drawingsurface.cpp
@@ -89,7 +89,7 @@ void DrawingSurface_Release(ScriptDrawingSurface *sds) {
for (tt = 0; tt < _GP(game).numgui; tt++) {
if ((_GP(guis)[tt].BgImage == sds->dynamicSpriteNumber) &&
(_GP(guis)[tt].IsDisplayed())) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
break;
}
}
diff --git a/engines/ags/engine/ac/global_character.cpp b/engines/ags/engine/ac/global_character.cpp
index 336adcde34..b0129df56a 100644
--- a/engines/ags/engine/ac/global_character.cpp
+++ b/engines/ags/engine/ac/global_character.cpp
@@ -471,7 +471,7 @@ void update_invorder() {
// backwards compatibility
_GP(play).obsolete_inv_numorder = _G(charextra)[_GP(game).playercharacter].invorder_count;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void add_inventory(int inum) {
diff --git a/engines/ags/engine/ac/global_game.cpp b/engines/ags/engine/ac/global_game.cpp
index 93c3400308..4fbe0374d8 100644
--- a/engines/ags/engine/ac/global_game.cpp
+++ b/engines/ags/engine/ac/global_game.cpp
@@ -75,10 +75,8 @@ using namespace AGS::Shared;
#define ALLEGRO_KEYBOARD_HANDLER
-extern int gui_disabled_style;
-
void GiveScore(int amnt) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).score += amnt;
if ((amnt > 0) && (_GP(play).score_sound >= 0))
@@ -400,7 +398,7 @@ int SetGameOption(int opt, int setting) {
if (opt == OPT_DUPLICATEINV)
update_invorder();
else if (opt == OPT_DISABLEOFF)
- gui_disabled_style = convert_gui_disabled_style(_GP(game).options[OPT_DISABLEOFF]);
+ _G(gui_disabled_style) = convert_gui_disabled_style(_GP(game).options[OPT_DISABLEOFF]);
else if (opt == OPT_PORTRAITSIDE) {
if (setting == 0) // set back to Left
_GP(play).swap_portrait_side = 0;
@@ -522,12 +520,12 @@ void GetLocationName(int xxx, int yyy, char *tempo) {
int mover = GetInvAt(xxx, yyy);
if (mover > 0) {
if (_GP(play).get_loc_name_last_time != 1000 + mover)
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).get_loc_name_last_time = 1000 + mover;
strcpy(tempo, get_translation(_GP(game).invinfo[mover].name));
} else if ((_GP(play).get_loc_name_last_time > 1000) && (_GP(play).get_loc_name_last_time < 1000 + MAX_INV)) {
// no longer selecting an item
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).get_loc_name_last_time = -1;
}
return;
@@ -546,7 +544,7 @@ void GetLocationName(int xxx, int yyy, char *tempo) {
if (loctype == 0) {
if (_GP(play).get_loc_name_last_time != 0) {
_GP(play).get_loc_name_last_time = 0;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
return;
}
@@ -556,7 +554,7 @@ void GetLocationName(int xxx, int yyy, char *tempo) {
onhs = _G(getloctype_index);
strcpy(tempo, get_translation(_GP(game).chars[onhs].name));
if (_GP(play).get_loc_name_last_time != 2000 + onhs)
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).get_loc_name_last_time = 2000 + onhs;
return;
}
@@ -571,7 +569,7 @@ void GetLocationName(int xxx, int yyy, char *tempo) {
tempo[1] = 0;
}
if (_GP(play).get_loc_name_last_time != 3000 + aa)
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).get_loc_name_last_time = 3000 + aa;
return;
}
@@ -579,7 +577,7 @@ void GetLocationName(int xxx, int yyy, char *tempo) {
if (onhs > 0)
strcpy(tempo, get_translation(_GP(thisroom).Hotspots[onhs].Name));
if (_GP(play).get_loc_name_last_time != onhs)
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).get_loc_name_last_time = onhs;
}
diff --git a/engines/ags/engine/ac/global_gui.cpp b/engines/ags/engine/ac/global_gui.cpp
index 6488c92941..ed2dd211ab 100644
--- a/engines/ags/engine/ac/global_gui.cpp
+++ b/engines/ags/engine/ac/global_gui.cpp
@@ -75,7 +75,7 @@ void InterfaceOn(int ifn) {
debug_script_log("GUIOn(%d) ignored (already on)", ifn);
return;
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(guis)[ifn].SetVisible(true);
debug_script_log("GUI %d turned on", ifn);
// modal interface
@@ -99,7 +99,7 @@ void InterfaceOff(int ifn) {
_GP(guis)[ifn].MouseOverCtrl = -1;
}
_GP(guis)[ifn].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
// modal interface
if (_GP(guis)[ifn].PopupStyle == kGUIPopupModal) UnPauseGame();
}
@@ -214,12 +214,12 @@ void SetGUIBackgroundPic(int guin, int slotn) {
void DisableInterface() {
_GP(play).disabled_user_interface++;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
set_mouse_cursor(CURS_WAIT);
}
void EnableInterface() {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).disabled_user_interface--;
if (_GP(play).disabled_user_interface < 1) {
_GP(play).disabled_user_interface = 0;
diff --git a/engines/ags/engine/ac/global_inventoryitem.cpp b/engines/ags/engine/ac/global_inventoryitem.cpp
index 0b0a7c2efd..86899580f8 100644
--- a/engines/ags/engine/ac/global_inventoryitem.cpp
+++ b/engines/ags/engine/ac/global_inventoryitem.cpp
@@ -53,7 +53,7 @@ void set_inv_item_pic(int invi, int piccy) {
}
_GP(game).invinfo[invi].pic = piccy;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void SetInvItemName(int invi, const char *newName) {
@@ -65,7 +65,7 @@ void SetInvItemName(int invi, const char *newName) {
_GP(game).invinfo[invi].name[24] = 0;
// might need to redraw the GUI if it has the inv item name on it
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int GetInvAt(int xxx, int yyy) {
diff --git a/engines/ags/engine/ac/global_invwindow.cpp b/engines/ags/engine/ac/global_invwindow.cpp
index 252f2226d3..8bf556f4a2 100644
--- a/engines/ags/engine/ac/global_invwindow.cpp
+++ b/engines/ags/engine/ac/global_invwindow.cpp
@@ -44,7 +44,7 @@ void SetInvDimensions(int ww, int hh) {
_GP(guiinv)[i].ItemHeight = hh;
_GP(guiinv)[i].OnResized();
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
} // namespace AGS3
diff --git a/engines/ags/engine/ac/gui.cpp b/engines/ags/engine/ac/gui.cpp
index a518ab0da7..a8fcc58034 100644
--- a/engines/ags/engine/ac/gui.cpp
+++ b/engines/ags/engine/ac/gui.cpp
@@ -122,7 +122,7 @@ void GUI_SetSize(ScriptGUI *sgui, int widd, int hitt) {
recreate_guibg_image(tehgui);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int GUI_GetWidth(ScriptGUI *sgui) {
@@ -206,7 +206,7 @@ void GUI_Centre(ScriptGUI *sgui) {
void GUI_SetBackgroundGraphic(ScriptGUI *tehgui, int slotn) {
if (_GP(guis)[tehgui->id].BgImage != slotn) {
_GP(guis)[tehgui->id].BgImage = slotn;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -219,7 +219,7 @@ int GUI_GetBackgroundGraphic(ScriptGUI *tehgui) {
void GUI_SetBackgroundColor(ScriptGUI *tehgui, int newcol) {
if (_GP(guis)[tehgui->id].BgColor != newcol) {
_GP(guis)[tehgui->id].BgColor = newcol;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -232,7 +232,7 @@ void GUI_SetBorderColor(ScriptGUI *tehgui, int newcol) {
return;
if (_GP(guis)[tehgui->id].FgColor != newcol) {
_GP(guis)[tehgui->id].FgColor = newcol;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -247,7 +247,7 @@ void GUI_SetTextColor(ScriptGUI *tehgui, int newcol) {
return;
if (_GP(guis)[tehgui->id].FgColor != newcol) {
_GP(guis)[tehgui->id].FgColor = newcol;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -308,7 +308,7 @@ void remove_popup_interface(int ifacenum) {
set_default_cursor();
if (ifacenum == _G(mouse_on_iface)) _G(mouse_on_iface) = -1;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void process_interface_click(int ifce, int btn, int mbut) {
@@ -478,26 +478,26 @@ int convert_gui_disabled_style(int oldStyle) {
void update_gui_disabled_status() {
// update GUI display status (perhaps we've gone into
// an interface disabled state)
- int all_buttons_was = all_buttons_disabled;
- all_buttons_disabled = 0;
+ int all_buttons_was = _G(all_buttons_disabled);
+ _G(all_buttons_disabled) = 0;
if (!IsInterfaceEnabled()) {
- all_buttons_disabled = gui_disabled_style;
+ _G(all_buttons_disabled) = _G(gui_disabled_style);
}
- if (all_buttons_was != all_buttons_disabled) {
+ if (all_buttons_was != _G(all_buttons_disabled)) {
// GUIs might have been removed/added
for (int aa = 0; aa < _GP(game).numgui; aa++) {
_GP(guis)[aa].OnControlPositionChanged();
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
invalidate_screen();
}
}
int adjust_x_for_guis(int xx, int yy) {
- if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (all_buttons_disabled > 0))
+ if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (_G(all_buttons_disabled) > 0))
return xx;
// If it's covered by a GUI, move it right a bit
for (int aa = 0; aa < _GP(game).numgui; aa++) {
@@ -520,7 +520,7 @@ int adjust_x_for_guis(int xx, int yy) {
}
int adjust_y_for_guis(int yy) {
- if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (all_buttons_disabled > 0))
+ if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (_G(all_buttons_disabled) > 0))
return yy;
// If it's covered by a GUI, move it down a bit
for (int aa = 0; aa < _GP(game).numgui; aa++) {
@@ -557,7 +557,7 @@ void recreate_guibg_image(GUIMain *tehgui) {
}
int gui_get_interactable(int x, int y) {
- if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (all_buttons_disabled > 0))
+ if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (_G(all_buttons_disabled) > 0))
return -1;
return GetGUIAt(x, y);
}
@@ -565,7 +565,7 @@ int gui_get_interactable(int x, int y) {
int gui_on_mouse_move() {
int mouse_over_gui = -1;
// If all GUIs are off, skip the loop
- if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (all_buttons_disabled > 0));
+ if ((_GP(game).options[OPT_DISABLEOFF] == 3) && (_G(all_buttons_disabled) > 0));
else {
// Scan for mouse-y-pos GUIs, and pop one up if appropriate
// Also work out the mouse-over GUI while we're at it
@@ -585,7 +585,7 @@ int gui_on_mouse_move() {
if (_G(mousey) < _GP(guis)[guin].PopupAtMouseY) {
set_mouse_cursor(CURS_ARROW);
_GP(guis)[guin].SetConceal(false);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_G(ifacepopped) = guin;
PauseGame();
break;
diff --git a/engines/ags/engine/ac/guicontrol.cpp b/engines/ags/engine/ac/guicontrol.cpp
index 4356443484..7ab2fcdfaa 100644
--- a/engines/ags/engine/ac/guicontrol.cpp
+++ b/engines/ags/engine/ac/guicontrol.cpp
@@ -73,7 +73,7 @@ void GUIControl_SetVisible(GUIObject *guio, int visible) {
if (on != guio->IsVisible()) {
guio->SetVisible(on);
_GP(guis)[guio->ParentId].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -90,7 +90,7 @@ void GUIControl_SetClickable(GUIObject *guio, int enabled) {
guio->SetClickable(false);
_GP(guis)[guio->ParentId].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int GUIControl_GetEnabled(GUIObject *guio) {
@@ -102,7 +102,7 @@ void GUIControl_SetEnabled(GUIObject *guio, int enabled) {
if (on != guio->IsEnabled()) {
guio->SetEnabled(on);
_GP(guis)[guio->ParentId].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -164,7 +164,7 @@ int GUIControl_GetX(GUIObject *guio) {
void GUIControl_SetX(GUIObject *guio, int xx) {
guio->X = data_to_game_coord(xx);
_GP(guis)[guio->ParentId].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int GUIControl_GetY(GUIObject *guio) {
@@ -174,7 +174,7 @@ int GUIControl_GetY(GUIObject *guio) {
void GUIControl_SetY(GUIObject *guio, int yy) {
guio->Y = data_to_game_coord(yy);
_GP(guis)[guio->ParentId].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int GUIControl_GetZOrder(GUIObject *guio) {
@@ -183,7 +183,7 @@ int GUIControl_GetZOrder(GUIObject *guio) {
void GUIControl_SetZOrder(GUIObject *guio, int zorder) {
if (_GP(guis)[guio->ParentId].SetControlZOrder(guio->Id, zorder))
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIControl_SetPosition(GUIObject *guio, int xx, int yy) {
@@ -200,7 +200,7 @@ void GUIControl_SetWidth(GUIObject *guio, int newwid) {
guio->Width = data_to_game_coord(newwid);
guio->OnResized();
_GP(guis)[guio->ParentId].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int GUIControl_GetHeight(GUIObject *guio) {
@@ -211,7 +211,7 @@ void GUIControl_SetHeight(GUIObject *guio, int newhit) {
guio->Height = data_to_game_coord(newhit);
guio->OnResized();
_GP(guis)[guio->ParentId].OnControlPositionChanged();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIControl_SetSize(GUIObject *guio, int newwid, int newhit) {
@@ -225,12 +225,12 @@ void GUIControl_SetSize(GUIObject *guio, int newwid, int newhit) {
void GUIControl_SendToBack(GUIObject *guio) {
if (_GP(guis)[guio->ParentId].SendControlToBack(guio->Id))
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIControl_BringToFront(GUIObject *guio) {
if (_GP(guis)[guio->ParentId].BringControlToFront(guio->Id))
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
//=============================================================================
diff --git a/engines/ags/engine/ac/guiinv.cpp b/engines/ags/engine/ac/guiinv.cpp
index bd557853c5..91a65d4c65 100644
--- a/engines/ags/engine/ac/guiinv.cpp
+++ b/engines/ags/engine/ac/guiinv.cpp
@@ -32,8 +32,6 @@
namespace AGS3 {
-extern int gui_disabled_style;
-
namespace AGS {
namespace Shared {
@@ -46,7 +44,7 @@ int GUIInvWindow::GetCharacterId() const {
void GUIInvWindow::Draw(Bitmap *ds) {
const bool enabled = IsGUIEnabled(this);
- if (!enabled && (gui_disabled_style == GUIDIS_BLACKOUT))
+ if (!enabled && (_G(gui_disabled_style) == GUIDIS_BLACKOUT))
return;
// backwards compatibility
@@ -81,7 +79,7 @@ void GUIInvWindow::Draw(Bitmap *ds) {
}
if (!enabled &&
- gui_disabled_style == GUIDIS_GREYOUT &&
+ _G(gui_disabled_style) == GUIDIS_GREYOUT &&
_GP(play).inventory_greys_out == 1) {
// darken the inventory when disabled
GUI::DrawDisabledEffect(ds, RectWH(X, Y, Width, Height));
diff --git a/engines/ags/engine/ac/invwindow.cpp b/engines/ags/engine/ac/invwindow.cpp
index 0318a07a64..8bbd7778ad 100644
--- a/engines/ags/engine/ac/invwindow.cpp
+++ b/engines/ags/engine/ac/invwindow.cpp
@@ -61,7 +61,7 @@ void InvWindow_SetCharacterToUse(GUIInvWindow *guii, CharacterInfo *chaa) {
// reset to top of list
guii->TopItem = 0;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
CharacterInfo *InvWindow_GetCharacterToUse(GUIInvWindow *guii) {
@@ -92,7 +92,7 @@ int InvWindow_GetItemHeight(GUIInvWindow *guii) {
void InvWindow_SetTopItem(GUIInvWindow *guii, int topitem) {
if (guii->TopItem != topitem) {
guii->TopItem = topitem;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -116,7 +116,7 @@ void InvWindow_ScrollDown(GUIInvWindow *guii) {
if ((_G(charextra)[guii->GetCharacterId()].invorder_count) >
(guii->TopItem + (guii->ColCount * guii->RowCount))) {
guii->TopItem += guii->ColCount;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -126,7 +126,7 @@ void InvWindow_ScrollUp(GUIInvWindow *guii) {
if (guii->TopItem < 0)
guii->TopItem = 0;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -502,7 +502,7 @@ int invscreen() {
int selt = __actual_invscreen();
if (selt < 0) return -1;
_G(playerchar)->activeinv = selt;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
set_cursor_mode(MODE_USE);
return selt;
}
diff --git a/engines/ags/engine/ac/label.cpp b/engines/ags/engine/ac/label.cpp
index 2fb12950cd..42b06d3f83 100644
--- a/engines/ags/engine/ac/label.cpp
+++ b/engines/ags/engine/ac/label.cpp
@@ -49,7 +49,7 @@ void Label_SetText(GUILabel *labl, const char *newtx) {
newtx = get_translation(newtx);
if (strcmp(labl->GetText(), newtx)) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
labl->SetText(newtx);
}
}
@@ -61,7 +61,7 @@ int Label_GetTextAlignment(GUILabel *labl) {
void Label_SetTextAlignment(GUILabel *labl, int align) {
if (labl->TextAlignment != align) {
labl->TextAlignment = (HorAlignment)align;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -72,7 +72,7 @@ int Label_GetColor(GUILabel *labl) {
void Label_SetColor(GUILabel *labl, int colr) {
if (labl->TextColor != colr) {
labl->TextColor = colr;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -86,7 +86,7 @@ void Label_SetFont(GUILabel *guil, int fontnum) {
if (fontnum != guil->Font) {
guil->Font = fontnum;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
diff --git a/engines/ags/engine/ac/listbox.cpp b/engines/ags/engine/ac/listbox.cpp
index bd49e07ca6..1634dc78c4 100644
--- a/engines/ags/engine/ac/listbox.cpp
+++ b/engines/ags/engine/ac/listbox.cpp
@@ -56,7 +56,7 @@ int ListBox_AddItem(GUIListBox *lbb, const char *text) {
if (lbb->AddItem(text) < 0)
return 0;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
return 1;
}
@@ -64,13 +64,13 @@ int ListBox_InsertItemAt(GUIListBox *lbb, int index, const char *text) {
if (lbb->InsertItem(index, text) < 0)
return 0;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
return 1;
}
void ListBox_Clear(GUIListBox *listbox) {
listbox->Clear();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void FillDirList(std::set<String> &files, const String &path) {
@@ -98,7 +98,7 @@ void FillDirList(std::set<String> &files, const String &path) {
void ListBox_FillDirList(GUIListBox *listbox, const char *filemask) {
listbox->Clear();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
ResolvedPath rp;
ResolveScriptPath("$SAVEGAMEDIR$/agssave.*", true, rp);
@@ -166,7 +166,7 @@ int ListBox_FillSaveGameList(GUIListBox *listbox) {
_GP(play).filenumbers[nn] = listbox->SavedGameIndex[nn];
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
listbox->SetSvgIndex(true);
if (numsaves >= MAXSAVEGAMES)
@@ -210,7 +210,7 @@ void ListBox_SetItemText(GUIListBox *listbox, int index, const char *newtext) {
if (strcmp(listbox->Items[index], newtext)) {
listbox->SetItemText(index, newtext);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -220,7 +220,7 @@ void ListBox_RemoveItem(GUIListBox *listbox, int itemIndex) {
quit("!ListBoxRemove: invalid listindex specified");
listbox->RemoveItem(itemIndex);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int ListBox_GetItemCount(GUIListBox *listbox) {
@@ -238,7 +238,7 @@ void ListBox_SetFont(GUIListBox *listbox, int newfont) {
if (newfont != listbox->Font) {
listbox->SetFont(newfont);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -250,7 +250,7 @@ bool ListBox_GetShowBorder(GUIListBox *listbox) {
void ListBox_SetShowBorder(GUIListBox *listbox, bool newValue) {
if (listbox->IsBorderShown() != newValue) {
listbox->SetShowBorder(newValue);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -261,7 +261,7 @@ bool ListBox_GetShowScrollArrows(GUIListBox *listbox) {
void ListBox_SetShowScrollArrows(GUIListBox *listbox, bool newValue) {
if (listbox->AreArrowsShown() != newValue) {
listbox->SetShowArrows(newValue);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -288,7 +288,7 @@ int ListBox_GetSelectedBackColor(GUIListBox *listbox) {
void ListBox_SetSelectedBackColor(GUIListBox *listbox, int colr) {
if (listbox->SelectedBgColor != colr) {
listbox->SelectedBgColor = colr;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -299,7 +299,7 @@ int ListBox_GetSelectedTextColor(GUIListBox *listbox) {
void ListBox_SetSelectedTextColor(GUIListBox *listbox, int colr) {
if (listbox->SelectedTextColor != colr) {
listbox->SelectedTextColor = colr;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -310,7 +310,7 @@ int ListBox_GetTextAlignment(GUIListBox *listbox) {
void ListBox_SetTextAlignment(GUIListBox *listbox, int align) {
if (listbox->TextAlignment != align) {
listbox->TextAlignment = (HorAlignment)align;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -321,7 +321,7 @@ int ListBox_GetTextColor(GUIListBox *listbox) {
void ListBox_SetTextColor(GUIListBox *listbox, int colr) {
if (listbox->TextColor != colr) {
listbox->TextColor = colr;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -344,7 +344,7 @@ void ListBox_SetSelectedIndex(GUIListBox *guisl, int newsel) {
if (newsel >= guisl->TopItem + guisl->VisibleItemCount)
guisl->TopItem = (newsel - guisl->VisibleItemCount) + 1;
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -360,7 +360,7 @@ void ListBox_SetTopItem(GUIListBox *guisl, int item) {
quit("!ListBoxSetTopItem: tried to set top to beyond top or bottom of list");
guisl->TopItem = item;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
int ListBox_GetRowCount(GUIListBox *listbox) {
@@ -370,14 +370,14 @@ int ListBox_GetRowCount(GUIListBox *listbox) {
void ListBox_ScrollDown(GUIListBox *listbox) {
if (listbox->TopItem + listbox->VisibleItemCount < listbox->ItemCount) {
listbox->TopItem++;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
void ListBox_ScrollUp(GUIListBox *listbox) {
if (listbox->TopItem > 0) {
listbox->TopItem--;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -387,7 +387,7 @@ GUIListBox *is_valid_listbox(int guin, int objn) {
if ((objn < 0) | (objn >= _GP(guis)[guin].GetControlCount())) quit("!ListBox: invalid object number");
if (_GP(guis)[guin].GetControlType(objn) != kGUIListBox)
quit("!ListBox: specified control is not a list box");
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
return (GUIListBox *)_GP(guis)[guin].GetControl(objn);
}
diff --git a/engines/ags/engine/ac/mouse.cpp b/engines/ags/engine/ac/mouse.cpp
index 28b6c1fd48..2ce7e95382 100644
--- a/engines/ags/engine/ac/mouse.cpp
+++ b/engines/ags/engine/ac/mouse.cpp
@@ -216,7 +216,7 @@ void set_cursor_mode(int newmode) {
if ((newmode < 0) || (newmode >= _GP(game).numcursors))
quit("!SetCursorMode: invalid cursor mode specified");
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
if (_GP(game).mcurs[newmode].flags & MCF_DISABLED) {
find_next_enabled_cursor(newmode);
return;
@@ -248,7 +248,7 @@ void enable_cursor_mode(int modd) {
gbpt->SetEnabled(true);
}
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void disable_cursor_mode(int modd) {
@@ -266,7 +266,7 @@ void disable_cursor_mode(int modd) {
}
}
if (_G(cur_mode) == modd) find_next_enabled_cursor(modd);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void RefreshMouse() {
diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index e62f833fa9..722dea37e1 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -858,7 +858,7 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
_G(our_eip) = 220;
update_polled_stuff_if_runtime();
debug_script_log("Now in room %d", _G(displayed_room));
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
pl_run_plugin_hooks(AGSE_ENTERROOM, _G(displayed_room));
// MoveToWalkableArea(_GP(game).playercharacter);
// MSS_CHECK_ALL_BLOCKS;
@@ -910,7 +910,7 @@ void new_room(int newnum, CharacterInfo *forchar) {
_G(gfxDriver)->DestroyDDB(_G(guibgbmp)[i]);
_G(guibgbmp)[i] = nullptr;
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
update_polled_stuff_if_runtime();
diff --git a/engines/ags/engine/ac/slider.cpp b/engines/ags/engine/ac/slider.cpp
index 005570b2e3..b41e5837c2 100644
--- a/engines/ags/engine/ac/slider.cpp
+++ b/engines/ags/engine/ac/slider.cpp
@@ -22,10 +22,10 @@
#include "ags/engine/ac/slider.h"
#include "ags/shared/ac/common.h"
-
#include "ags/shared/debugging/out.h"
#include "ags/engine/script/script_api.h"
#include "ags/engine/script/script_runtime.h"
+#include "ags/globals.h"
namespace AGS3 {
@@ -41,7 +41,7 @@ void Slider_SetMax(GUISlider *guisl, int valn) {
if (guisl->MinValue > guisl->MaxValue)
quit("!Slider.Max: minimum cannot be greater than maximum");
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -60,7 +60,7 @@ void Slider_SetMin(GUISlider *guisl, int valn) {
if (guisl->MinValue > guisl->MaxValue)
quit("!Slider.Min: minimum cannot be greater than maximum");
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -75,7 +75,7 @@ void Slider_SetValue(GUISlider *guisl, int valn) {
if (valn != guisl->Value) {
guisl->Value = valn;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -90,7 +90,7 @@ int Slider_GetBackgroundGraphic(GUISlider *guisl) {
void Slider_SetBackgroundGraphic(GUISlider *guisl, int newImage) {
if (newImage != guisl->BgImage) {
guisl->BgImage = newImage;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -101,7 +101,7 @@ int Slider_GetHandleGraphic(GUISlider *guisl) {
void Slider_SetHandleGraphic(GUISlider *guisl, int newImage) {
if (newImage != guisl->HandleImage) {
guisl->HandleImage = newImage;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -112,7 +112,7 @@ int Slider_GetHandleOffset(GUISlider *guisl) {
void Slider_SetHandleOffset(GUISlider *guisl, int newOffset) {
if (newOffset != guisl->HandleOffset) {
guisl->HandleOffset = newOffset;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
diff --git a/engines/ags/engine/ac/textbox.cpp b/engines/ags/engine/ac/textbox.cpp
index b5b696c0a8..d2ef175ad7 100644
--- a/engines/ags/engine/ac/textbox.cpp
+++ b/engines/ags/engine/ac/textbox.cpp
@@ -45,7 +45,7 @@ void TextBox_GetText(GUITextBox *texbox, char *buffer) {
void TextBox_SetText(GUITextBox *texbox, const char *newtex) {
if (strcmp(texbox->Text, newtex)) {
texbox->Text = newtex;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -56,7 +56,7 @@ int TextBox_GetTextColor(GUITextBox *guit) {
void TextBox_SetTextColor(GUITextBox *guit, int colr) {
if (guit->TextColor != colr) {
guit->TextColor = colr;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -70,7 +70,7 @@ void TextBox_SetFont(GUITextBox *guit, int fontnum) {
if (guit->Font != fontnum) {
guit->Font = fontnum;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
@@ -81,7 +81,7 @@ bool TextBox_GetShowBorder(GUITextBox *guit) {
void TextBox_SetShowBorder(GUITextBox *guit, bool on) {
if (guit->IsBorderShown() != on) {
guit->SetShowBorder(on);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
}
diff --git a/engines/ags/engine/game/savegame.cpp b/engines/ags/engine/game/savegame.cpp
index d3f2c76227..939560f085 100644
--- a/engines/ags/engine/game/savegame.cpp
+++ b/engines/ags/engine/game/savegame.cpp
@@ -528,7 +528,7 @@ HSaveError DoAfterRestore(const PreservedParams &pp, const RestoredData &r_data)
on_background_frame_change();
}
- gui_disabled_style = convert_gui_disabled_style(_GP(game).options[OPT_DISABLEOFF]);
+ _G(gui_disabled_style) = convert_gui_disabled_style(_GP(game).options[OPT_DISABLEOFF]);
// restore the queue now that the music is playing
_GP(play).music_queue_size = queuedMusicSize;
@@ -599,7 +599,7 @@ HSaveError DoAfterRestore(const PreservedParams &pp, const RestoredData &r_data)
recreate_overlay_ddbs();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
RestoreViewportsAndCameras(r_data);
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index c7474d54bb..bb7983d6de 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -826,7 +826,7 @@ void engine_init_game_settings() {
_GP(play).game_speed_modifier = 0;
if (_G(debug_flags) & DBG_DEBUGMODE)
_GP(play).debug_mode = 1;
- gui_disabled_style = convert_gui_disabled_style(_GP(game).options[OPT_DISABLEOFF]);
+ _G(gui_disabled_style) = convert_gui_disabled_style(_GP(game).options[OPT_DISABLEOFF]);
_GP(play).shake_screen_yoff = 0;
memset(&_GP(play).walkable_areas_on[0], 1, MAX_WALK_AREAS + 1);
diff --git a/engines/ags/engine/main/game_run.cpp b/engines/ags/engine/main/game_run.cpp
index d9f0b1a021..5402d0d8b2 100644
--- a/engines/ags/engine/main/game_run.cpp
+++ b/engines/ags/engine/main/game_run.cpp
@@ -456,7 +456,7 @@ static void check_keyboard_controls() {
// pressed, but exclude control characters (<32) and
// extended keys (eg. up/down arrow; 256+)
if ((((kgn >= 32) && (kgn <= 255) && (kgn != '[')) || (kgn == eAGSKeyCodeReturn) || (kgn == eAGSKeyCodeBackspace))
- && !all_buttons_disabled) {
+ && !_G(all_buttons_disabled)) {
for (int guiIndex = 0; guiIndex < _GP(game).numgui; guiIndex++) {
auto &gui = _GP(guis)[guiIndex];
@@ -835,7 +835,7 @@ static int UpdateWaitMode() {
auto was_disabled_for = _G(user_disabled_for);
set_default_cursor();
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
_GP(play).disabled_user_interface--;
_G(user_disabled_for) = 0;
@@ -875,7 +875,7 @@ static int GameTick() {
static void SetupLoopParameters(int untilwhat, const void *udata) {
_GP(play).disabled_user_interface++;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
// Only change the mouse cursor if it hasn't been specifically changed first
// (or if it's speech, always change it)
if (((_G(cur_cursor) == _G(cur_mode)) || (untilwhat == UNTIL_NOOVERLAY)) &&
diff --git a/engines/ags/engine/script/script.cpp b/engines/ags/engine/script/script.cpp
index 1106a80d8f..cac973ce12 100644
--- a/engines/ags/engine/script/script.cpp
+++ b/engines/ags/engine/script/script.cpp
@@ -433,7 +433,7 @@ int RunTextScript2IParam(ccInstance *sci, const char *tsname, const RuntimeScrip
// response to a button click, better update guis
if (ags_strnicmp(tsname, "interface_click", 15) == 0)
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
return RunScriptFunctionIfExists(sci, tsname, 2, params);
}
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index d63857e41b..5af938af2b 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -793,6 +793,17 @@ public:
/**@}*/
+ /**
+ * \defgroup guimain globals
+ * @{
+ */
+
+ int _guis_need_update = 1;
+ int _all_buttons_disabled = 0, _gui_inv_pic = -1;
+ int _gui_disabled_style = 0;
+
+ /**@}*/
+
/**
* \defgroup guislider globals
* @{
diff --git a/engines/ags/shared/gui/guibutton.cpp b/engines/ags/shared/gui/guibutton.cpp
index 51a6368484..33f123f06f 100644
--- a/engines/ags/shared/gui/guibutton.cpp
+++ b/engines/ags/shared/gui/guibutton.cpp
@@ -93,15 +93,15 @@ void GUIButton::Draw(Bitmap *ds) {
check_font(&Font);
// if it's "Unchanged when disabled" or "GUI Off", don't grey out
- if (gui_disabled_style == GUIDIS_UNCHANGED ||
- gui_disabled_style == GUIDIS_GUIOFF) {
+ if (_G(gui_disabled_style) == GUIDIS_UNCHANGED ||
+ _G(gui_disabled_style) == GUIDIS_GUIOFF) {
draw_disabled = false;
}
// TODO: should only change properties in reaction to particular events
if (CurrentImage <= 0 || draw_disabled)
CurrentImage = Image;
- if (draw_disabled && gui_disabled_style == GUIDIS_BLACKOUT)
+ if (draw_disabled && _G(gui_disabled_style) == GUIDIS_BLACKOUT)
// buttons off when disabled - no point carrying on
return;
@@ -265,11 +265,11 @@ void GUIButton::DrawImageButton(Bitmap *ds, bool draw_disabled) {
draw_gui_sprite(ds, CurrentImage, X, Y, true);
// Draw active inventory item
- if (_placeholder != kButtonPlace_None && gui_inv_pic >= 0) {
+ if (_placeholder != kButtonPlace_None && _G(gui_inv_pic) >= 0) {
GUIButtonPlaceholder place = _placeholder;
if (place == kButtonPlace_InvItemAuto) {
- if ((get_adjusted_spritewidth(gui_inv_pic) > Width - 6) ||
- (get_adjusted_spriteheight(gui_inv_pic) > Height - 6)) {
+ if ((get_adjusted_spritewidth(_G(gui_inv_pic)) > Width - 6) ||
+ (get_adjusted_spriteheight(_G(gui_inv_pic)) > Height - 6)) {
place = kButtonPlace_InvItemStretch;
} else {
place = kButtonPlace_InvItemCenter;
@@ -277,16 +277,16 @@ void GUIButton::DrawImageButton(Bitmap *ds, bool draw_disabled) {
}
if (place == kButtonPlace_InvItemStretch) {
- ds->StretchBlt(_GP(spriteset)[gui_inv_pic], RectWH(X + 3, Y + 3, Width - 6, Height - 6), Shared::kBitmap_Transparency);
+ ds->StretchBlt(_GP(spriteset)[_G(gui_inv_pic)], RectWH(X + 3, Y + 3, Width - 6, Height - 6), Shared::kBitmap_Transparency);
} else if (place == kButtonPlace_InvItemCenter) {
- draw_gui_sprite(ds, gui_inv_pic,
- X + Width / 2 - get_adjusted_spritewidth(gui_inv_pic) / 2,
- Y + Height / 2 - get_adjusted_spriteheight(gui_inv_pic) / 2,
+ draw_gui_sprite(ds, _G(gui_inv_pic),
+ X + Width / 2 - get_adjusted_spritewidth(_G(gui_inv_pic)) / 2,
+ Y + Height / 2 - get_adjusted_spriteheight(_G(gui_inv_pic)) / 2,
true);
}
}
- if ((draw_disabled) && (gui_disabled_style == GUIDIS_GREYOUT)) {
+ if ((draw_disabled) && (_G(gui_disabled_style) == GUIDIS_GREYOUT)) {
// darken the button when disabled
GUI::DrawDisabledEffect(ds, RectWH(X, Y,
_GP(spriteset)[CurrentImage]->GetWidth(),
diff --git a/engines/ags/shared/gui/guidefines.h b/engines/ags/shared/gui/guidefines.h
index 1086132e9e..4a62e112db 100644
--- a/engines/ags/shared/gui/guidefines.h
+++ b/engines/ags/shared/gui/guidefines.h
@@ -178,9 +178,6 @@ enum GuiSvgVersion {
} // namespace Shared
} // namespace AGS
-
-extern int guis_need_update;
-
} // namespace AGS3
#endif
diff --git a/engines/ags/shared/gui/guilistbox.cpp b/engines/ags/shared/gui/guilistbox.cpp
index ed8b965263..2d653c8663 100644
--- a/engines/ags/shared/gui/guilistbox.cpp
+++ b/engines/ags/shared/gui/guilistbox.cpp
@@ -25,6 +25,7 @@
#include "ags/shared/gui/guimain.h"
#include "ags/shared/util/stream.h"
#include "ags/shared/util/string_utils.h"
+#include "ags/globals.h"
namespace AGS3 {
@@ -78,7 +79,7 @@ bool GUIListBox::IsInRightMargin(int x) const {
}
int GUIListBox::AddItem(const String &text) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
Items.push_back(text);
SavedGameIndex.push_back(-1);
ItemCount++;
@@ -91,7 +92,7 @@ void GUIListBox::Clear() {
ItemCount = 0;
SelectedItem = 0;
TopItem = 0;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIListBox::Draw(Shared::Bitmap *ds) {
@@ -177,7 +178,7 @@ int GUIListBox::InsertItem(int index, const String &text) {
SelectedItem++;
ItemCount++;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
return ItemCount - 1;
}
@@ -193,7 +194,7 @@ void GUIListBox::RemoveItem(int index) {
SelectedItem--;
if (SelectedItem >= ItemCount)
SelectedItem = -1;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIListBox::SetShowArrows(bool on) {
@@ -225,7 +226,7 @@ void GUIListBox::SetFont(int font) {
void GUIListBox::SetItemText(int index, const String &text) {
if (index >= 0 && index < ItemCount) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
Items[index] = text;
}
}
diff --git a/engines/ags/shared/gui/guimain.cpp b/engines/ags/shared/gui/guimain.cpp
index f7a1a2b9a1..e7b54f6c8d 100644
--- a/engines/ags/shared/gui/guimain.cpp
+++ b/engines/ags/shared/gui/guimain.cpp
@@ -42,10 +42,6 @@ using namespace AGS::Shared;
#define MOVER_MOUSEDOWNLOCKED -4000
-int guis_need_update = 1;
-int all_buttons_disabled = 0, gui_inv_pic = -1;
-int gui_disabled_style = 0;
-
namespace AGS {
namespace Shared {
@@ -231,7 +227,7 @@ void GUIMain::DrawAt(Bitmap *ds, int x, int y) {
SET_EIP(379)
- if (all_buttons_disabled && gui_disabled_style == GUIDIS_BLACKOUT)
+ if (_G(all_buttons_disabled) && _G(gui_disabled_style) == GUIDIS_BLACKOUT)
return; // don't draw GUI controls
for (size_t ctrl_index = 0; ctrl_index < _controls.size(); ++ctrl_index) {
@@ -239,7 +235,7 @@ void GUIMain::DrawAt(Bitmap *ds, int x, int y) {
GUIObject *objToDraw = _controls[_ctrlDrawOrder[ctrl_index]];
- if (!objToDraw->IsEnabled() && gui_disabled_style == GUIDIS_BLACKOUT)
+ if (!objToDraw->IsEnabled() && _G(gui_disabled_style) == GUIDIS_BLACKOUT)
continue;
if (!objToDraw->IsVisible())
continue;
@@ -307,7 +303,7 @@ void GUIMain::Poll() {
_controls[MouseOverCtrl]->OnMouseMove(_G(mousex), _G(mousey));
}
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
} else if (MouseOverCtrl >= 0)
_controls[MouseOverCtrl]->OnMouseMove(_G(mousex), _G(mousey));
}
@@ -422,7 +418,7 @@ void GUIMain::SetTextWindow(bool on) {
void GUIMain::SetTransparencyAsPercentage(int percent) {
Transparency = GfxDef::Trans100ToLegacyTrans255(percent);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIMain::SetVisible(bool on) {
@@ -451,7 +447,7 @@ void GUIMain::OnMouseButtonDown() {
if (_controls[MouseOverCtrl]->OnMouseDown())
MouseOverCtrl = MOVER_MOUSEDOWNLOCKED;
_controls[MouseDownCtrl]->OnMouseMove(_G(mousex) - X, _G(mousey) - Y);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIMain::OnMouseButtonUp() {
@@ -467,7 +463,7 @@ void GUIMain::OnMouseButtonUp() {
_controls[MouseDownCtrl]->OnMouseUp();
MouseDownCtrl = -1;
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
}
void GUIMain::ReadFromFile(Stream *in, GuiVersion gui_version) {
@@ -660,7 +656,7 @@ HError ResortGUI(std::vector<GUIMain> &theGuis, bool bwcompat_ctrl_zorder = fals
}
gui.ResortZOrder();
}
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
return HError::None();
}
diff --git a/engines/ags/shared/gui/guimain.h b/engines/ags/shared/gui/guimain.h
index 301f1aa092..c32da7fe97 100644
--- a/engines/ags/shared/gui/guimain.h
+++ b/engines/ags/shared/gui/guimain.h
@@ -219,9 +219,6 @@ void ApplyLegacyVisibility(GUIMain &gui, LegacyGUIVisState vis);
} // namespace AGS
-extern int all_buttons_disabled, gui_inv_pic;
-extern int gui_disabled_style;
-
extern int get_adjusted_spritewidth(int spr);
extern int get_adjusted_spriteheight(int spr);
extern bool is_sprite_alpha(int spr);
diff --git a/engines/ags/shared/gui/guiobject.cpp b/engines/ags/shared/gui/guiobject.cpp
index 6ba23826e5..92dbd22fd6 100644
--- a/engines/ags/shared/gui/guiobject.cpp
+++ b/engines/ags/shared/gui/guiobject.cpp
@@ -24,6 +24,7 @@
#include "ags/shared/gui/guimain.h"
#include "ags/shared/gui/guiobject.h"
#include "ags/shared/util/stream.h"
+#include "ags/globals.h"
namespace AGS3 {
namespace AGS {
@@ -197,4 +198,9 @@ HorAlignment ConvertLegacyGUIAlignment(LegacyGUIAlignment align) {
} // namespace Shared
} // namespace AGS
+
+bool IsGUIEnabled(AGS::Shared::GUIObject *g) {
+ return !_G(all_buttons_disabled) && g->IsEnabled();
+}
+
} // namespace AGS3
diff --git a/engines/ags/shared/gui/guiobject.h b/engines/ags/shared/gui/guiobject.h
index 463afc872c..8c2a51dd13 100644
--- a/engines/ags/shared/gui/guiobject.h
+++ b/engines/ags/shared/gui/guiobject.h
@@ -130,12 +130,8 @@ HorAlignment ConvertLegacyGUIAlignment(LegacyGUIAlignment align);
} // namespace Shared
} // namespace AGS
-// Tells if all controls are disabled
-extern int all_buttons_disabled;
// Tells if the given control is considered enabled, taking global flag into account
-inline bool IsGUIEnabled(AGS::Shared::GUIObject *g) {
- return !all_buttons_disabled && g->IsEnabled();
-}
+extern bool IsGUIEnabled(AGS::Shared::GUIObject *g);
} // namespace AGS3
diff --git a/engines/ags/shared/gui/guislider.cpp b/engines/ags/shared/gui/guislider.cpp
index 2e4419560d..b4d9c3cdab 100644
--- a/engines/ags/shared/gui/guislider.cpp
+++ b/engines/ags/shared/gui/guislider.cpp
@@ -182,7 +182,7 @@ void GUISlider::OnMouseMove(int x, int y) {
Value = (int)(((float)(((Y + Height) - y) - 2) / (float)(Height - 4)) * (float)(MaxValue - MinValue)) + MinValue;
Value = Math::Clamp(Value, MinValue, MaxValue);
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
IsActivated = true;
}
diff --git a/engines/ags/shared/gui/guitextbox.cpp b/engines/ags/shared/gui/guitextbox.cpp
index 6c08cd2709..50a7f63e75 100644
--- a/engines/ags/shared/gui/guitextbox.cpp
+++ b/engines/ags/shared/gui/guitextbox.cpp
@@ -25,6 +25,7 @@
#include "ags/shared/gui/guitextbox.h"
#include "ags/shared/util/stream.h"
#include "ags/shared/util/string_utils.h"
+#include "ags/globals.h"
namespace AGS3 {
@@ -61,7 +62,7 @@ void GUITextBox::Draw(Bitmap *ds) {
}
void GUITextBox::OnKeyPress(int keycode) {
- guis_need_update = 1;
+ _G(guis_need_update) = 1;
// TODO: use keycode constants
// backspace, remove character
if (keycode == 8) {
More information about the Scummvm-git-logs
mailing list