[Scummvm-git-logs] scummvm master -> 313a824fb91c88b9d8cfe6234c73608c3a55dfa4

dreammaster dreammaster at scummvm.org
Wed Jun 16 02:16:49 UTC 2021


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4a8ad2d199 AGS: Fix Buildbot compiler warning
881bae2f5a AGS: Added AGSClipboard plugin
38405b5e23 AGS: Creating AGSSock plugin
472fbb224a AGS: Switch processmessage to use NumberPtr again
313a824fb9 AGS: Fix int pointer type mismatches


Commit: 4a8ad2d19950914b4c1363598e973481b71ed743
    https://github.com/scummvm/scummvm/commit/4a8ad2d19950914b4c1363598e973481b71ed743
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-06-15T18:35:38-07:00

Commit Message:
AGS: Fix Buildbot compiler warning

Changed paths:
    engines/ags/shared/ac/game_setup_struct.cpp
    engines/ags/shared/ac/mouse_cursor.h


diff --git a/engines/ags/shared/ac/game_setup_struct.cpp b/engines/ags/shared/ac/game_setup_struct.cpp
index 7018216f19..1dd6233c47 100644
--- a/engines/ags/shared/ac/game_setup_struct.cpp
+++ b/engines/ags/shared/ac/game_setup_struct.cpp
@@ -40,7 +40,8 @@ GameSetupStruct::GameSetupStruct()
 	, roomNames(nullptr)
 	, scoreClipID(0) {
 	memset(invinfo, 0, sizeof(invinfo));
-	for (uint8 i = 0; i < ARRAYSIZE(mcurs); i++) mcurs[i].clear();
+	for (int i = 0; i < MAX_CURSOR; ++i)
+		mcurs[i].clear();
 	memset(lipSyncFrameLetters, 0, sizeof(lipSyncFrameLetters));
 	memset(guid, 0, sizeof(guid));
 	memset(saveGameFileExtension, 0, sizeof(saveGameFileExtension));
diff --git a/engines/ags/shared/ac/mouse_cursor.h b/engines/ags/shared/ac/mouse_cursor.h
index 775cd56729..fff97d5e66 100644
--- a/engines/ags/shared/ac/mouse_cursor.h
+++ b/engines/ags/shared/ac/mouse_cursor.h
@@ -47,8 +47,8 @@ struct MouseCursor {
 	char  flags;
 
 	MouseCursor();
-	void clear();
 
+	void clear();
 	void ReadFromFile(Shared::Stream *in);
 	void WriteToFile(Shared::Stream *out);
 	void ReadFromSavegame(Shared::Stream *in);


Commit: 881bae2f5a839680833af461f076d83de38ad7ce
    https://github.com/scummvm/scummvm/commit/881bae2f5a839680833af461f076d83de38ad7ce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-06-15T18:35:39-07:00

Commit Message:
AGS: Added AGSClipboard plugin

Changed paths:
  A engines/ags/plugins/ags_clipboard/ags_clipboard.cpp
  A engines/ags/plugins/ags_clipboard/ags_clipboard.h
    engines/ags/module.mk
    engines/ags/plugins/ags_plugin.cpp
    engines/ags/plugins/plugin_base.cpp


diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index 0f47bca84d..9412180278 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -288,6 +288,7 @@ MODULE_OBJS = \
 	plugins/plugin_object_reader.o \
 	plugins/ags_agi/ags_agi.o \
 	plugins/ags_blend/ags_blend.o \
+	plugins/ags_clipboard/ags_clipboard.o \
 	plugins/ags_controller/ags_controller.o \
 	plugins/ags_creditz/ags_creditz.o \
 	plugins/ags_creditz/ags_creditz1.o \
diff --git a/engines/ags/plugins/ags_clipboard/ags_clipboard.cpp b/engines/ags/plugins/ags_clipboard/ags_clipboard.cpp
new file mode 100644
index 0000000000..8a5231b44f
--- /dev/null
+++ b/engines/ags/plugins/ags_clipboard/ags_clipboard.cpp
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or(at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/system.h"
+#include "ags/plugins/ags_clipboard/ags_clipboard.h"
+
+namespace AGS3 {
+namespace Plugins {
+namespace AGSClipboard {
+
+IAGSEngine *AGSClipboard::_engine;
+Common::String *AGSClipboard::_text;
+
+AGSClipboard::AGSClipboard() : PluginBase() {
+	_engine = nullptr;
+	_text = new Common::String();
+
+	DLL_METHOD(AGS_GetPluginName);
+	DLL_METHOD(AGS_EngineStartup);
+	DLL_METHOD(AGS_EngineShutdown);
+}
+
+const char *AGSClipboard::AGS_GetPluginName() {
+	return "AGS Clipboard Plugin v0.4";
+}
+
+void AGSClipboard::AGS_EngineStartup(IAGSEngine *engine) {
+	SCRIPT_METHOD_EXT(Clipboard::PasteText, Clipboard_PasteText);
+	SCRIPT_METHOD_EXT(Clipboard::CopyText^1, Clipboard_CopyText);
+}
+
+void AGSClipboard::AGS_EngineShutdown() {
+	delete _text;
+}
+
+void AGSClipboard::Clipboard_PasteText(ScriptMethodParams &params) {
+	Common::U32String text = g_system->getTextFromClipboard();
+	*_text = Common::String(text);
+
+	params._result = _text->c_str();
+}
+
+void AGSClipboard::Clipboard_CopyText(ScriptMethodParams &params) {
+	PARAMS1(const char *, text);
+	g_system->setTextInClipboard(Common::U32String(text));
+}
+
+} // namespace AGSClipboard
+} // namespace Plugins
+} // namespace AGS3
diff --git a/engines/ags/plugins/ags_clipboard/ags_clipboard.h b/engines/ags/plugins/ags_clipboard/ags_clipboard.h
new file mode 100644
index 0000000000..885e9c4dd0
--- /dev/null
+++ b/engines/ags/plugins/ags_clipboard/ags_clipboard.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or(at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef AGS_PLUGINS_AGS_CLIPBOARD_H
+#define AGS_PLUGINS_AGS_CLIPBOARD_H
+
+#include "ags/plugins/plugin_base.h"
+
+namespace AGS3 {
+namespace Plugins {
+namespace AGSClipboard {
+
+class AGSClipboard : public PluginBase {
+private:
+	static IAGSEngine *_engine;
+	static Common::String *_text;
+private:
+	static const char *AGS_GetPluginName();
+	static void AGS_EngineStartup(IAGSEngine *engine);
+	static void AGS_EngineShutdown();
+	static void Clipboard_PasteText(ScriptMethodParams &params);
+	static void Clipboard_CopyText(ScriptMethodParams &params);
+
+public:
+	AGSClipboard();
+};
+
+} // namespace AGSClipboard
+} // namespace Plugins
+} // namespace AGS3
+
+#endif
diff --git a/engines/ags/plugins/ags_plugin.cpp b/engines/ags/plugins/ags_plugin.cpp
index ede1b0e767..c604bc8971 100644
--- a/engines/ags/plugins/ags_plugin.cpp
+++ b/engines/ags/plugins/ags_plugin.cpp
@@ -843,91 +843,6 @@ void pl_run_plugin_init_gfx_hooks(const char *driverName, void *data) {
 	}
 }
 
-#if 0
-int pl_register_builtin_plugin(const InbuiltPluginDetails &details) {
-	_registered_builtin_plugins.push_back(details);
-	return 0;
-}
-#endif
-
-bool pl_use_builtin_plugin(EnginePlugin *apl) {
-#if defined(BUILTIN_PLUGINS)
-	if (ags_stricmp(apl->filename, "agsflashlight") == 0) {
-		apl->engineStartup = agsflashlight::AGS_EngineStartup;
-		apl->engineShutdown = agsflashlight::AGS_EngineShutdown;
-		apl->onEvent = agsflashlight::AGS_EngineOnEvent;
-		apl->debugHook = agsflashlight::AGS_EngineDebugHook;
-		apl->initGfxHook = agsflashlight::AGS_EngineInitGfx;
-		apl->available = true;
-		apl->builtin = true;
-		return true;
-	} else if (ags_stricmp(apl->filename, "agsblend") == 0) {
-		apl->engineStartup = agsblend::AGS_EngineStartup;
-		apl->engineShutdown = agsblend::AGS_EngineShutdown;
-		apl->onEvent = agsblend::AGS_EngineOnEvent;
-		apl->debugHook = agsblend::AGS_EngineDebugHook;
-		apl->initGfxHook = agsblend::AGS_EngineInitGfx;
-		apl->available = true;
-		apl->builtin = true;
-		return true;
-	} else if (ags_stricmp(apl->filename, "ags_snowrain") == 0) {
-		apl->engineStartup = ags_snowrain::AGS_EngineStartup;
-		apl->engineShutdown = ags_snowrain::AGS_EngineShutdown;
-		apl->onEvent = ags_snowrain::AGS_EngineOnEvent;
-		apl->debugHook = ags_snowrain::AGS_EngineDebugHook;
-		apl->initGfxHook = ags_snowrain::AGS_EngineInitGfx;
-		apl->available = true;
-		apl->builtin = true;
-		return true;
-	} else if (ags_stricmp(apl->filename, "ags_parallax") == 0) {
-		apl->engineStartup = ags_parallax::AGS_EngineStartup;
-		apl->engineShutdown = ags_parallax::AGS_EngineShutdown;
-		apl->onEvent = ags_parallax::AGS_EngineOnEvent;
-		apl->debugHook = ags_parallax::AGS_EngineDebugHook;
-		apl->initGfxHook = ags_parallax::AGS_EngineInitGfx;
-		apl->available = true;
-		apl->builtin = true;
-		return true;
-	} else if (ags_stricmp(apl->filename, "agspalrender") == 0) {
-		apl->engineStartup = agspalrender::AGS_EngineStartup;
-		apl->engineShutdown = agspalrender::AGS_EngineShutdown;
-		apl->onEvent = agspalrender::AGS_EngineOnEvent;
-		apl->debugHook = agspalrender::AGS_EngineDebugHook;
-		apl->initGfxHook = agspalrender::AGS_EngineInitGfx;
-		apl->available = true;
-		apl->builtin = true;
-		return true;
-	}
-#if AGS_PLATFORM_OS_IOS
-	else if (ags_stricmp(apl->filename, "agstouch") == 0) {
-		apl->engineStartup = agstouch::AGS_EngineStartup;
-		apl->engineShutdown = agstouch::AGS_EngineShutdown;
-		apl->onEvent = agstouch::AGS_EngineOnEvent;
-		apl->debugHook = agstouch::AGS_EngineDebugHook;
-		apl->initGfxHook = agstouch::AGS_EngineInitGfx;
-		apl->available = true;
-		apl->builtin = true;
-		return true;
-	}
-#endif // IOS_VERSION
-#endif // BUILTIN_PLUGINS
-#if 0
-	for (std::vector<InbuiltPluginDetails>::iterator it = _registered_builtin_plugins.begin(); it != _registered_builtin_plugins.end(); ++it) {
-		if (ags_stricmp(apl->filename, it->filename) == 0) {
-			apl->engineStartup = it->engineStartup;
-			apl->engineShutdown = it->engineShutdown;
-			apl->onEvent = it->onEvent;
-			apl->debugHook = it->debugHook;
-			apl->initGfxHook = it->initGfxHook;
-			apl->available = true;
-			apl->builtin = true;
-			return true;
-		}
-	}
-#endif
-	return false;
-}
-
 Engine::GameInitError pl_register_plugins(const std::vector<Shared::PluginInfo> &infos) {
 	numPlugins = 0;
 	for (size_t inf_index = 0; inf_index < infos.size(); ++inf_index) {
@@ -980,6 +895,7 @@ Engine::GameInitError pl_register_plugins(const std::vector<Shared::PluginInfo>
 		} else {
 			AGS::Shared::Debug::Printf(kDbgMsg_Info, "Plugin '%s' could not be loaded (expected '%s')",
 			                           apl->filename, expect_filename.GetCStr());
+			continue;
 		}
 
 		apl->eiface.pluginId = numPlugins - 1;
diff --git a/engines/ags/plugins/plugin_base.cpp b/engines/ags/plugins/plugin_base.cpp
index 295483795c..9d15de3919 100644
--- a/engines/ags/plugins/plugin_base.cpp
+++ b/engines/ags/plugins/plugin_base.cpp
@@ -24,6 +24,7 @@
 #include "ags/plugins/plugin_base.h"
 #include "ags/plugins/ags_agi/ags_agi.h"
 #include "ags/plugins/ags_blend/ags_blend.h"
+#include "ags/plugins/ags_clipboard/ags_clipboard.h"
 #include "ags/plugins/ags_controller/ags_controller.h"
 #include "ags/plugins/ags_creditz/ags_creditz1.h"
 #include "ags/plugins/ags_creditz/ags_creditz2.h"
@@ -69,6 +70,9 @@ void *pluginOpen(const char *filename) {
 	if (fname.equalsIgnoreCase("AGSBlend"))
 		return new AGSBlend::AGSBlend();
 
+	if (fname.equalsIgnoreCase("AGSClipboard"))
+		return new AGSClipboard::AGSClipboard();
+
 	if (fname.equalsIgnoreCase("AGSController"))
 		return new AGSController::AGSController();
 


Commit: 38405b5e237d1e7df46aed885b566bc873e3cf90
    https://github.com/scummvm/scummvm/commit/38405b5e237d1e7df46aed885b566bc873e3cf90
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-06-15T18:37:59-07:00

Commit Message:
AGS: Creating AGSSock plugin

Changed paths:
  A engines/ags/plugins/ags_sock/ags_sock.cpp
  A engines/ags/plugins/ags_sock/ags_sock.h
    engines/ags/module.mk
    engines/ags/plugins/plugin_base.cpp


diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index 9412180278..190cc3afec 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -305,6 +305,7 @@ MODULE_OBJS = \
 	plugins/ags_parallax/ags_parallax.o \
 	plugins/ags_snow_rain/ags_snow_rain.o \
 	plugins/ags_snow_rain/weather.o \
+	plugins/ags_sock/ags_sock.o \
 	plugins/ags_sprite_font/ags_sprite_font.o \
 	plugins/ags_sprite_font/ags_sprite_font_clifftop.o \
 	plugins/ags_sprite_font/character_entry.o \
diff --git a/engines/ags/plugins/ags_sock/ags_sock.cpp b/engines/ags/plugins/ags_sock/ags_sock.cpp
new file mode 100644
index 0000000000..7356eb11ed
--- /dev/null
+++ b/engines/ags/plugins/ags_sock/ags_sock.cpp
@@ -0,0 +1,321 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or(at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/array.h"
+#include "common/str.h"
+#include "ags/plugins/ags_sock/ags_sock.h"
+
+namespace AGS3 {
+namespace Plugins {
+namespace AGSSock {
+
+IAGSEngine *AGSSock::_engine;
+
+typedef Common::Array<byte> SockData;
+
+class SockAddr {
+public:
+	int _port = 0;
+	Common::String _address;
+	Common::String _ip;
+};
+
+class Socket {
+public:
+};
+
+AGSSock::AGSSock() : PluginBase() {
+	_engine = nullptr;
+
+	DLL_METHOD(AGS_GetPluginName);
+	DLL_METHOD(AGS_EngineStartup);
+}
+
+const char *AGSSock::AGS_GetPluginName() {
+	return "AGS Sock";
+}
+
+void AGSSock::AGS_EngineStartup(IAGSEngine *engine) {
+	SCRIPT_METHOD_EXT(SockData::Create^2, SockData_Create);
+	SCRIPT_METHOD_EXT(SockData::CreateEmpty^0, SockData_CreateEmpty);
+	SCRIPT_METHOD_EXT(SockData::CreateFromString^1, SockData_CreateFromString);
+	SCRIPT_METHOD_EXT(SockData::get_Size, SockData_get_Size);
+	SCRIPT_METHOD_EXT(SockData::set_Size, SockData_set_Size);
+	SCRIPT_METHOD_EXT(SockData::geti_Chars, SockData_geti_Chars);
+	SCRIPT_METHOD_EXT(SockData::seti_Chars, SockData_seti_Chars);
+	SCRIPT_METHOD_EXT(SockData::AsString^0, SockData_AsString);
+	SCRIPT_METHOD_EXT(SockData::Clear^0, SockData_Clear);
+	SCRIPT_METHOD_EXT(SockAddr::Create^1, SockAddr_Create);
+	SCRIPT_METHOD_EXT(SockAddr::CreateFromString^2, SockAddr_CreateFromString);
+	SCRIPT_METHOD_EXT(SockAddr::CreateFromData^1, SockAddr_CreateFromData);
+	SCRIPT_METHOD_EXT(SockAddr::CreateIP^2, SockAddr_CreateIP);
+	SCRIPT_METHOD_EXT(SockAddr::CreateIPv6^2, SockAddr_CreateIPv6);
+	SCRIPT_METHOD_EXT(SockAddr::get_Port, SockAddr_get_Port);
+	SCRIPT_METHOD_EXT(SockAddr::set_Port, SockAddr_set_Port);
+	SCRIPT_METHOD_EXT(SockAddr::get_Address, SockAddr_get_Address);
+	SCRIPT_METHOD_EXT(SockAddr::set_Address, SockAddr_set_Address);
+	SCRIPT_METHOD_EXT(SockAddr::get_IP, SockAddr_get_IP);
+	SCRIPT_METHOD_EXT(SockAddr::set_IP, SockAddr_set_IP);
+	SCRIPT_METHOD_EXT(SockAddr::GetData^0, SockAddr_GetData);
+	SCRIPT_METHOD_EXT(Socket::Create^3, Socket_Create);
+	SCRIPT_METHOD_EXT(Socket::CreateUDP^0, Socket_CreateUDP);
+	SCRIPT_METHOD_EXT(Socket::CreateTCP^0, Socket_CreateTCP);
+	SCRIPT_METHOD_EXT(Socket::CreateUDPv6^0, Socket_CreateUDPv6);
+	SCRIPT_METHOD_EXT(Socket::CreateTCPv6^0, Socket_CreateTCPv6);
+	SCRIPT_METHOD_EXT(Socket::get_Tag, Socket_get_Tag);
+	SCRIPT_METHOD_EXT(Socket::set_Tag, Socket_set_Tag);
+	SCRIPT_METHOD_EXT(Socket::get_Local, Socket_get_Local);
+	SCRIPT_METHOD_EXT(Socket::get_Remote, Socket_get_Remote);
+	SCRIPT_METHOD_EXT(Socket::get_Valid, Socket_get_Valid);
+	SCRIPT_METHOD_EXT(Socket::ErrorString^0, Socket_ErrorString);
+	SCRIPT_METHOD_EXT(Socket::Bind^1, Socket_Bind);
+	SCRIPT_METHOD_EXT(Socket::Listen^1, Socket_Listen);
+	SCRIPT_METHOD_EXT(Socket::Connect^2, Socket_Connect);
+	SCRIPT_METHOD_EXT(Socket::Accept^0, Socket_Accept);
+	SCRIPT_METHOD_EXT(Socket::Close^0, Socket_Close);
+	SCRIPT_METHOD_EXT(Socket::Send^1, Socket_Send);
+	SCRIPT_METHOD_EXT(Socket::SendTo^2, Socket_SendTo);
+	SCRIPT_METHOD_EXT(Socket::Recv^0, Socket_Recv);
+	SCRIPT_METHOD_EXT(Socket::RecvFrom^1, Socket_RecvFrom);
+	SCRIPT_METHOD_EXT(Socket::SendData^1, Socket_SendData);
+	SCRIPT_METHOD_EXT(Socket::SendDataTo^2, Socket_SendDataTo);
+	SCRIPT_METHOD_EXT(Socket::RecvData^0, Socket_RecvData);
+	SCRIPT_METHOD_EXT(Socket::RecvDataFrom^1, Socket_RecvDataFrom);
+	SCRIPT_METHOD_EXT(Socket::GetOption^2, Socket_GetOption);
+	SCRIPT_METHOD_EXT(Socket::SetOption^3, Socket_SetOption);
+
+}
+
+void AGSSock::SockData_Create(ScriptMethodParams &params) {
+	PARAMS2(int, size, char, defchar);
+
+	SockData *data = new SockData();
+	data->resize(size);
+	Common::fill(&(*data)[0], &(*data)[0] + size, defchar);
+
+	params._result = data;
+}
+
+void AGSSock::SockData_CreateEmpty(ScriptMethodParams &params) {
+	params._result = new SockData();
+}
+
+void AGSSock::SockData_CreateFromString(ScriptMethodParams &params) {
+	PARAMS1(const char *, str);
+	size_t len = strlen(str);
+
+	SockData *data = new SockData();
+	data->resize(len + 1);
+	Common::copy(str, str + len + 1, &(*data)[0]);
+
+	params._result = data;
+}
+
+void AGSSock::SockData_get_Size(ScriptMethodParams &params) {
+	PARAMS1(SockData *, sockData);
+	params._result = sockData->size();
+}
+
+void AGSSock::SockData_set_Size(ScriptMethodParams &params) {
+	PARAMS2(SockData *, sockData, size_t, size);
+	sockData->resize(size);
+}
+
+void AGSSock::SockData_geti_Chars(ScriptMethodParams &params) {
+	PARAMS1(SockData *, sockData);
+	params._result = &(*sockData)[0];
+}
+
+void AGSSock::SockData_seti_Chars(ScriptMethodParams &params) {
+	PARAMS2(SockData *, sockData, const byte *, chars);
+	Common::copy(chars, chars + sockData->size(), &(*sockData)[0]);
+}
+
+void AGSSock::SockData_AsString(ScriptMethodParams &params) {
+	PARAMS1(SockData *, sockData);
+	params._result = (const char *)&(*sockData)[0];
+}
+
+void AGSSock::SockData_Clear(ScriptMethodParams &params) {
+	PARAMS1(SockData *, sockData);
+	sockData->clear();
+}
+
+void AGSSock::SockAddr_Create(ScriptMethodParams &params) {
+//	PARAMS1(int, type);
+	params._result = new SockAddr();
+}
+
+void AGSSock::SockAddr_CreateFromString(ScriptMethodParams &params) {
+//	PARAMS2(const char *, address, int, type);
+	PARAMS1(const char *, address);
+
+	SockAddr *sock = new SockAddr();
+	sock->_address = address;
+
+	params._result = sock;
+}
+
+void AGSSock::SockAddr_CreateFromData(ScriptMethodParams &params) {
+//	PARAMS1(const SockData *, data);
+	params._result = new SockAddr();
+}
+
+void AGSSock::SockAddr_CreateIP(ScriptMethodParams &params) {
+	PARAMS2(const char *, address, int, port);
+
+	SockAddr *sock = new SockAddr();
+	sock->_address = address;
+	sock->_port = port;
+
+	params._result = sock;
+}
+
+void AGSSock::SockAddr_CreateIPv6(ScriptMethodParams &params) {
+	//PARAMS2(const char *, address, int, port);
+	PARAMS1(const char *, address);
+
+	SockAddr *sock = new SockAddr();
+	sock->_address = address;
+
+	params._result = sock;
+}
+
+void AGSSock::SockAddr_get_Port(ScriptMethodParams &params) {
+	PARAMS1(const SockAddr *, sockAddr);
+	params._result = sockAddr->_port;
+}
+
+void AGSSock::SockAddr_set_Port(ScriptMethodParams &params) {
+	PARAMS2(SockAddr *, sockAddr, int, port);
+	sockAddr->_port = port;
+}
+
+void AGSSock::SockAddr_get_Address(ScriptMethodParams &params) {
+	PARAMS1(const SockAddr *, sockAddr);
+	params._result = sockAddr->_address.c_str();
+}
+
+void AGSSock::SockAddr_set_Address(ScriptMethodParams &params) {
+	PARAMS2(SockAddr *, sockAddr, const char *, address);
+	sockAddr->_address = address;
+}
+
+void AGSSock::SockAddr_get_IP(ScriptMethodParams &params) {
+	PARAMS1(const SockAddr *, sockAddr);
+	params._result = sockAddr->_ip.c_str();
+}
+
+void AGSSock::SockAddr_set_IP(ScriptMethodParams &params) {
+	PARAMS2(SockAddr *, sockAddr, const char *, IP);
+	sockAddr->_ip = IP;
+}
+
+void AGSSock::SockAddr_GetData(ScriptMethodParams &params) {
+//	PARAMS1(const SockAddr *, sockAddr);
+	params._result = new SockData();
+}
+
+
+void AGSSock::Socket_Create(ScriptMethodParams &params) {
+	//PARAMS3(int, domain, int, type, int, protocol);
+	params._result = new Socket();
+}
+
+void AGSSock::Socket_CreateUDP(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_CreateTCP(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_CreateUDPv6(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_CreateTCPv6(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_get_Tag(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_set_Tag(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_get_Local(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_get_Remote(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_get_Valid(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_ErrorString(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_Bind(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_Listen(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_Connect(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_Accept(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_Close(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_Send(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_SendTo(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_Recv(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_RecvFrom(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_SendData(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_SendDataTo(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_RecvData(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_RecvDataFrom(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_GetOption(ScriptMethodParams &params) {
+}
+
+void AGSSock::Socket_SetOption(ScriptMethodParams &params) {
+}
+
+} // namespace AGSSock
+} // namespace Plugins
+} // namespace AGS3
diff --git a/engines/ags/plugins/ags_sock/ags_sock.h b/engines/ags/plugins/ags_sock/ags_sock.h
new file mode 100644
index 0000000000..e0d2478803
--- /dev/null
+++ b/engines/ags/plugins/ags_sock/ags_sock.h
@@ -0,0 +1,305 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or(at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef AGS_PLUGINS_AGS_SOCK_H
+#define AGS_PLUGINS_AGS_SOCK_H
+
+#include "ags/plugins/plugin_base.h"
+
+namespace AGS3 {
+namespace Plugins {
+namespace AGSSock {
+
+class AGSSock : public PluginBase {
+private:
+	static IAGSEngine *_engine;
+	static Common::String *_text;
+private:
+	static const char *AGS_GetPluginName();
+	static void AGS_EngineStartup(IAGSEngine *engine);
+
+	/**
+	 * Creates a new data container with specified size
+	 * (and what character to fill it with)
+	 */
+	static void SockData_Create(ScriptMethodParams &params);
+
+	/**
+	 * Creates a new data container of zero size
+	 */
+	static void SockData_CreateEmpty(ScriptMethodParams &params);
+
+	/**
+	 * Creates a data container from a string
+	 */
+	static void SockData_CreateFromString(ScriptMethodParams &params);
+
+	/**
+	 * Gets the size property
+	 */
+	static void SockData_get_Size(ScriptMethodParams &params);
+
+	/**
+	 * Sets the size property
+	 */
+	static void SockData_set_Size(ScriptMethodParams &params);
+
+	/**
+	 * Gets the chars array
+	 */
+	static void SockData_geti_Chars(ScriptMethodParams &params);
+
+	/**
+	 * Sets the chars array
+	 */
+	static void SockData_seti_Chars(ScriptMethodParams &params);
+
+	/**
+	 * Makes and returns a string from the data object.
+	 * (Warning: anything after a null character will be truncated)
+	 */
+	static void SockData_AsString(ScriptMethodParams &params);
+
+	/**
+	 * Removes all the data from a socket data object,
+	 * reducing it's size to zero
+	 */
+	static void SockData_Clear(ScriptMethodParams &params);
+
+	/**
+	 * Creates an empty socket address. (advanced: set type
+	 * to IPv6 if you're using IPv6)
+	 */
+	static void SockAddr_Create(ScriptMethodParams &params);
+
+	/**
+	 * Creates a socket address from a string.
+	 * (for example: "https://www.scummvm.org/"
+	 */
+	static void SockAddr_CreateFromString(ScriptMethodParams &params);
+
+	/**
+	 * Creates a socket address from raw data. (advanced)
+	 */
+	static void SockAddr_CreateFromData(ScriptMethodParams &params);
+
+	/**
+	 * Creates a socket address from an IP-address.
+	 * (for example: "127.0.0.1")
+	 */
+	static void SockAddr_CreateIP(ScriptMethodParams &params);
+
+	/**
+	 * Creates a socket address from an IPv6-address.
+	 * (for example: "::1")
+	 */
+	static void SockAddr_CreateIPv6(ScriptMethodParams &params);
+
+	/**
+	 * Gets the value of the port property
+	 */
+	static void SockAddr_get_Port(ScriptMethodParams &params);
+
+	/**
+	 * Sets the value of the port property
+	 */
+	static void SockAddr_set_Port(ScriptMethodParams &params);
+
+	/**
+	 * Gets the value of the address property
+	 */
+	static void SockAddr_get_Address(ScriptMethodParams &params);
+
+	/**
+	 * Sets the value of the address property
+	 */
+	static void SockAddr_set_Address(ScriptMethodParams &params);
+
+	/**
+	 * Gets the value of the IP property
+	 */
+	static void SockAddr_get_IP(ScriptMethodParams &params);
+
+	/**
+	 * Sets the value of the IP property
+	 */
+	static void SockAddr_set_IP(ScriptMethodParams &params);
+
+	/**
+	 * Returns a SockData object that contains the raw data
+	 * of the socket address. (advanced)
+	 */
+	static void SockAddr_GetData(ScriptMethodParams &params);
+
+	/**
+	 * Creates a socket for the specified protocol. (advanced)
+	 */
+	static void Socket_Create(ScriptMethodParams &params);
+
+	/**
+	 * Creates a UDP socket. (unrealiable, connectionless, message based)
+	 */
+	static void Socket_CreateUDP(ScriptMethodParams &params);
+
+	/**
+	 * Creates a TCP socket. (reliable, connection based, streaming)
+	 */
+	static void Socket_CreateTCP(ScriptMethodParams &params);
+
+	/**
+	 * Creates a UDP socket for IPv6. (when in doubt use CreateUDP)
+	 */
+	static void Socket_CreateUDPv6(ScriptMethodParams &params);
+
+	/**
+	 * Creates a TCP socket for IPv6. (when in doubt use CreateTCP)
+	 */
+	static void Socket_CreateTCPv6(ScriptMethodParams &params);
+
+	/**
+	 * Gets the value of the Tag property
+	 */
+	static void Socket_get_Tag(ScriptMethodParams &params);
+
+	/**
+	 * Sets the value of the Tag property
+	 */
+	static void Socket_set_Tag(ScriptMethodParams &params);
+
+	/**
+	 * Gets the value of the Local property
+	 */
+	static void Socket_get_Local(ScriptMethodParams &params);
+
+	/**
+	 * Gets the value of the Remote property
+	 */
+	static void Socket_get_Remote(ScriptMethodParams &params);
+
+	/**
+	 * Gets the value of the Value property
+	 */
+	static void Socket_get_Valid(ScriptMethodParams &params);
+
+	/**
+	 * Returns the last error observed from this socket
+	 * as an human readable string
+	 */
+	static void Socket_ErrorString(ScriptMethodParams &params);
+
+	/**
+	 * Binds the socket to a local address. (generally used
+	 * before listening)
+	 */
+	static void Socket_Bind(ScriptMethodParams &params);
+
+	/**
+	 * Makes a socket listen for incoming connection requests.
+	 * (TCP only) Backlog specifies how many requests can be
+	 * queued. (optional)
+	 */
+	static void Socket_Listen(ScriptMethodParams &params);
+
+	/**
+	 * Makes a socket connect to a remote host. (for UDP it
+	 * will simply bind to a remote address) Defaults to sync
+	 * which makes it wait; see the manual for async use.
+	 */
+	static void Socket_Connect(ScriptMethodParams &params);
+
+	/**
+	 * Accepts a connection request and returns the resulting
+	 * socket when successful. (TCP only)
+	 */
+	static void Socket_Accept(ScriptMethodParams &params);
+
+	/**
+	 * Closes the socket. (you can still receive until socket
+	 * is marked invalid
+	 */
+	static void Socket_Close(ScriptMethodParams &params);
+
+	/**
+	 * Sends a string to the remote host. Returns whether
+	 * successful. (no error means: try again later)
+	 */
+	static void Socket_Send(ScriptMethodParams &params);
+
+	/**
+	 * Sends a string to the specified remote host. (UDP only)
+	 */
+	static void Socket_SendTo(ScriptMethodParams &params);
+
+	/**
+	 * Receives a string from the remote host. (no error
+	 * means: try again later)
+	 */
+	static void Socket_Recv(ScriptMethodParams &params);
+
+	/**
+	 * Receives a string from an unspecified host. The given
+	 * address object will contain the remote address. (UDP only)
+	 */
+	static void Socket_RecvFrom(ScriptMethodParams &params);
+
+	/**
+	 * Sends raw data to the remote host. Returns whether
+	 * successful. (no error means: try again later
+	 */
+	static void Socket_SendData(ScriptMethodParams &params);
+
+	/**
+	 * Sends raw data to the specified remote host. (UDP only)
+	 */
+	static void Socket_SendDataTo(ScriptMethodParams &params);
+
+	/**
+	 * Receives raw data from the remote host. (no error
+	 * means: try again later
+	 */
+	static void Socket_RecvData(ScriptMethodParams &params);
+
+	/**
+	 * Receives raw data from an unspecified host. The given
+	 * address object will contain the remote address. (UDP only)
+	 */
+	static void Socket_RecvDataFrom(ScriptMethodParams &params);
+
+	/**
+	 * Gets a socket option. (advanced)
+	 */
+	static void Socket_GetOption(ScriptMethodParams &params);
+
+	/**
+	 * Sets a socket option. (advanced)
+	 */
+	static void Socket_SetOption(ScriptMethodParams &params);
+
+public:
+	AGSSock();
+};
+
+} // namespace AGSSock
+} // namespace Plugins
+} // namespace AGS3
+
+#endif
diff --git a/engines/ags/plugins/plugin_base.cpp b/engines/ags/plugins/plugin_base.cpp
index 9d15de3919..868a61d79f 100644
--- a/engines/ags/plugins/plugin_base.cpp
+++ b/engines/ags/plugins/plugin_base.cpp
@@ -37,6 +37,7 @@
 #include "ags/plugins/ags_pal_render/ags_pal_render.h"
 #include "ags/plugins/ags_shell/ags_shell.h"
 #include "ags/plugins/ags_snow_rain/ags_snow_rain.h"
+#include "ags/plugins/ags_sock/ags_sock.h"
 #include "ags/plugins/ags_sprite_font/ags_sprite_font.h"
 #include "ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.h"
 #include "ags/plugins/ags_tcp_ip/ags_tcp_ip.h"
@@ -100,6 +101,9 @@ void *pluginOpen(const char *filename) {
 	if (fname.equalsIgnoreCase("AGSSnowRain") || fname.equalsIgnoreCase("ags_snowrain"))
 		return new AGSSnowRain::AGSSnowRain();
 
+	if (fname.equalsIgnoreCase("AGSSock"))
+		return new AGSSock::AGSSock();
+
 	if ((fname.equalsIgnoreCase("AGSSpriteFont") && version == ::AGS::kClifftopGames))
 		return new AGSSpriteFont::AGSSpriteFontClifftopGames();
 


Commit: 472fbb224a9cdb07c252126abe118abaee377210
    https://github.com/scummvm/scummvm/commit/472fbb224a9cdb07c252126abe118abaee377210
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-06-15T18:38:07-07:00

Commit Message:
AGS: Switch processmessage to use NumberPtr again

Changed paths:
    engines/ags/engine/gui/csci_dialog.cpp
    engines/ags/engine/gui/csci_dialog.h
    engines/ags/engine/gui/gui_dialog.cpp
    engines/ags/engine/gui/my_label.cpp
    engines/ags/engine/gui/my_label.h
    engines/ags/engine/gui/my_listbox.cpp
    engines/ags/engine/gui/my_listbox.h
    engines/ags/engine/gui/my_push_button.cpp
    engines/ags/engine/gui/my_push_button.h
    engines/ags/engine/gui/my_textbox.cpp
    engines/ags/engine/gui/my_textbox.h
    engines/ags/engine/gui/new_control.h


diff --git a/engines/ags/engine/gui/csci_dialog.cpp b/engines/ags/engine/gui/csci_dialog.cpp
index b8423e7f53..4d8b7dcf0a 100644
--- a/engines/ags/engine/gui/csci_dialog.cpp
+++ b/engines/ags/engine/gui/csci_dialog.cpp
@@ -219,7 +219,7 @@ void CSCIDeleteControl(int haa) {
 	_G(vobjs)[haa] = nullptr;
 }
 
-int CSCISendControlMessage(int haa, int mess, int wPar, long lPar) {
+int CSCISendControlMessage(int haa, int mess, int wPar, NumberPtr lPar) {
 	if (_G(vobjs)[haa] == nullptr)
 		return -1;
 	return _G(vobjs)[haa]->processmessage(mess, wPar, lPar);
diff --git a/engines/ags/engine/gui/csci_dialog.h b/engines/ags/engine/gui/csci_dialog.h
index 5aeb55d44e..f0433ccfd2 100644
--- a/engines/ags/engine/gui/csci_dialog.h
+++ b/engines/ags/engine/gui/csci_dialog.h
@@ -29,6 +29,7 @@
 #ifndef AGS_ENGINE_GUI_CSCI_DIALOG_H
 #define AGS_ENGINE_GUI_CSCI_DIALOG_H
 
+#include "ags/shared/core/types.h"
 #include "ags/engine/gui/gui_dialog_internal_defs.h"
 
 namespace AGS3 {
@@ -42,7 +43,7 @@ void CSCIEraseWindow(int handl);
 int  CSCIWaitMessage(CSCIMessage *cscim);
 int  CSCICreateControl(int typeandflags, int xx, int yy, int wii, int hii, const char *title);
 void CSCIDeleteControl(int haa);
-int  CSCISendControlMessage(int haa, int mess, int wPar, long lPar);
+int  CSCISendControlMessage(int haa, int mess, int wPar, NumberPtr lPar);
 void multiply_up_to_game_res(int *x, int *y);
 void multiply_up(int *x1, int *y1, int *x2, int *y2);
 int  checkcontrols();
diff --git a/engines/ags/engine/gui/gui_dialog.cpp b/engines/ags/engine/gui/gui_dialog.cpp
index d6c361e6ff..7330e8ab66 100644
--- a/engines/ags/engine/gui/gui_dialog.cpp
+++ b/engines/ags/engine/gui/gui_dialog.cpp
@@ -169,11 +169,11 @@ int savegamedialog() {
 
 	_G(lpTemp) = nullptr;
 	if (_G(numsaves) > 0)
-		CSCISendControlMessage(ctrllist, CLB_GETTEXT, 0, (long)&_G(buffer2)[0]);
+		CSCISendControlMessage(ctrllist, CLB_GETTEXT, 0, &_G(buffer2)[0]);
 	else
 		_G(buffer2)[0] = 0;
 
-	CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, (long)&_G(buffer2)[0]);
+	CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
 
 	int toret = -1;
 	while (1) {
@@ -181,10 +181,10 @@ int savegamedialog() {
 		if (mes.code == CM_COMMAND) {
 			if (mes.id == ctrlok) {
 				int cursell = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
-				CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, (long)&_G(buffer2)[0]);
+				CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, &_G(buffer2)[0]);
 
 				if (_G(numsaves) > 0)
-					CSCISendControlMessage(ctrllist, CLB_GETTEXT, cursell, (long)&_G(bufTemp)[0]);
+					CSCISendControlMessage(ctrllist, CLB_GETTEXT, cursell, &_G(bufTemp)[0]);
 				else
 					strcpy(_G(bufTemp), "_NOSAVEGAMENAME");
 
@@ -208,7 +208,7 @@ int savegamedialog() {
 						CSCIWaitMessage(&cmes);
 					} while (cmes.code != CM_COMMAND);
 
-					CSCISendControlMessage(txt1, CTB_GETTEXT, 0, (long)&_G(buffer2)[0]);
+					CSCISendControlMessage(txt1, CTB_GETTEXT, 0, &_G(buffer2)[0]);
 					CSCIDeleteControl(btnCancel);
 					CSCIDeleteControl(btnOk);
 					CSCIDeleteControl(txt1);
@@ -256,8 +256,8 @@ int savegamedialog() {
 		} else if (mes.code == CM_SELCHANGE) {
 			int cursel = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
 			if (cursel >= 0) {
-				CSCISendControlMessage(ctrllist, CLB_GETTEXT, cursel, (long)&_G(buffer2)[0]);
-				CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, (long)&_G(buffer2)[0]);
+				CSCISendControlMessage(ctrllist, CLB_GETTEXT, cursel, &_G(buffer2)[0]);
+				CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
 			}
 		}
 	}
@@ -287,7 +287,7 @@ void preparesavegamelist(int ctrllist) {
 	// fill in the list box and global savegameindex[] array for backward compatibilty
 	for (_G(numsaves) = 0; _G(numsaves) < (int)saveList.size(); ++_G(numsaves)) {
 		CSCISendControlMessage(ctrllist, CLB_ADDITEM, 0,
-		                       (long)saveList[_G(numsaves)].getDescription().c_str());
+		                       saveList[_G(numsaves)].getDescription().c_str());
 		_G(filenumbers)[_G(numsaves)] = saveList[_G(numsaves)].getSaveSlot();
 		_G(filedates)[_G(numsaves)] = 0;
 		//(long int)saveList[_G(numsaves)].FileTime;
@@ -322,7 +322,7 @@ void enterstringwindow(const char *prompttext, char *stouse) {
 			if (mes.id == ctrlcancel)
 				_G(buffer2)[0] = 0;
 			else
-				CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, (long)&_G(buffer2)[0]);
+				CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, &_G(buffer2)[0]);
 			break;
 		}
 	}
@@ -361,7 +361,7 @@ int roomSelectorWindow(int currentRoom, int numRooms, int *roomNumbers, char **r
 	CSCISendControlMessage(ctrllist, CLB_CLEAR, 0, 0);    // clear the list box
 	for (int aa = 0; aa < numRooms; aa++) {
 		sprintf(_G(buff), "%3d %s", roomNumbers[aa], roomNames[aa]);
-		CSCISendControlMessage(ctrllist, CLB_ADDITEM, 0, (long)&_G(buff)[0]);
+		CSCISendControlMessage(ctrllist, CLB_ADDITEM, 0, &_G(buff)[0]);
 		if (roomNumbers[aa] == currentRoom) {
 			CSCISendControlMessage(ctrllist, CLB_SETCURSEL, aa, 0);
 		}
@@ -375,14 +375,14 @@ int roomSelectorWindow(int currentRoom, int numRooms, int *roomNumbers, char **r
 	_G(buffer2)[0] = 0;
 
 	int ctrltbox = CSCICreateControl(CNT_TEXTBOX, 10, 29, 120, 0, nullptr);
-	CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, (long)&_G(buffer2)[0]);
+	CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
 
 	int toret = -1;
 	while (1) {
 		CSCIWaitMessage(&mes);      //printf("mess: %d, id %d ",mes.code,mes.id);
 		if (mes.code == CM_COMMAND) {
 			if (mes.id == ctrlok) {
-				CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, (long)&_G(buffer2)[0]);
+				CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, &_G(buffer2)[0]);
 				if (Common::isDigit(_G(buffer2)[0])) {
 					toret = atoi(_G(buffer2));
 				}
@@ -393,7 +393,7 @@ int roomSelectorWindow(int currentRoom, int numRooms, int *roomNumbers, char **r
 			int cursel = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
 			if (cursel >= 0) {
 				sprintf(_G(buffer2), "%d", roomNumbers[cursel]);
-				CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, (long)&_G(buffer2)[0]);
+				CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
 			}
 		}
 	}
diff --git a/engines/ags/engine/gui/my_label.cpp b/engines/ags/engine/gui/my_label.cpp
index d97fa89280..2b0d036ba7 100644
--- a/engines/ags/engine/gui/my_label.cpp
+++ b/engines/ags/engine/gui/my_label.cpp
@@ -59,7 +59,7 @@ int MyLabel::pressedon(int mousex, int mousey) {
 	return 0;
 }
 
-int MyLabel::processmessage(int mcode, int wParam, long lParam) {
+int MyLabel::processmessage(int mcode, int wParam, NumberPtr lParam) {
 	return -1;                  // doesn't support messages
 }
 
diff --git a/engines/ags/engine/gui/my_label.h b/engines/ags/engine/gui/my_label.h
index eebabd98ed..8dc18235e3 100644
--- a/engines/ags/engine/gui/my_label.h
+++ b/engines/ags/engine/gui/my_label.h
@@ -35,7 +35,7 @@ struct MyLabel : public NewControl {
 
 	int pressedon(int mousex, int mousey) override;
 
-	int processmessage(int mcode, int wParam, long lParam) override;
+	int processmessage(int mcode, int wParam, NumberPtr lParam) override;
 };
 
 } // namespace AGS3
diff --git a/engines/ags/engine/gui/my_listbox.cpp b/engines/ags/engine/gui/my_listbox.cpp
index 49528949f7..622b36dfe4 100644
--- a/engines/ags/engine/gui/my_listbox.cpp
+++ b/engines/ags/engine/gui/my_listbox.cpp
@@ -133,9 +133,9 @@ void MyListBox::additem(char *texx) {
 	needredraw = 1;
 }
 
-int MyListBox::processmessage(int mcode, int wParam, long lParam) {
+int MyListBox::processmessage(int mcode, int wParam, NumberPtr lParam) {
 	if (mcode == CLB_ADDITEM) {
-		additem((char *)lParam);
+		additem((char *)lParam._ptr);
 	} else if (mcode == CLB_CLEAR)
 		clearlist();
 	else if (mcode == CLB_GETCURSEL)
@@ -149,12 +149,12 @@ int MyListBox::processmessage(int mcode, int wParam, long lParam) {
 		if (topitem + numonscreen <= selected)
 			topitem = (selected + 1) - numonscreen;
 	} else if (mcode == CLB_GETTEXT)
-		strcpy((char *)lParam, itemnames[wParam]);
+		strcpy((char *)lParam._ptr, itemnames[wParam]);
 	else if (mcode == CLB_SETTEXT) {
 		if (wParam < items)
 			free(itemnames[wParam]);
 
-		char *newstri = (char *)lParam;
+		char *newstri = (char *)lParam._ptr;
 		itemnames[wParam] = (char *)malloc(strlen(newstri) + 2);
 		strcpy(itemnames[wParam], newstri);
 
diff --git a/engines/ags/engine/gui/my_listbox.h b/engines/ags/engine/gui/my_listbox.h
index 183269bb5d..8465025c2b 100644
--- a/engines/ags/engine/gui/my_listbox.h
+++ b/engines/ags/engine/gui/my_listbox.h
@@ -40,7 +40,7 @@ struct MyListBox : public NewControl {
 	void draw(Shared::Bitmap *ds) override;
 	int pressedon(int mousex, int mousey) override;
 	void additem(char *texx);
-	int processmessage(int mcode, int wParam, long lParam) override;
+	int processmessage(int mcode, int wParam, NumberPtr lParam) override;
 };
 
 } // namespace AGS3
diff --git a/engines/ags/engine/gui/my_push_button.cpp b/engines/ags/engine/gui/my_push_button.cpp
index bcd18448ff..2da6b5ad19 100644
--- a/engines/ags/engine/gui/my_push_button.cpp
+++ b/engines/ags/engine/gui/my_push_button.cpp
@@ -99,7 +99,7 @@ int MyPushButton::pressedon(int mousex, int mousey) {
 	return wasstat;
 }
 
-int MyPushButton::processmessage(int mcode, int wParam, long lParam) {
+int MyPushButton::processmessage(int mcode, int wParam, NumberPtr lParam) {
 	return -1;                  // doesn't support messages
 }
 
diff --git a/engines/ags/engine/gui/my_push_button.h b/engines/ags/engine/gui/my_push_button.h
index 3f84c5c713..4b96f87799 100644
--- a/engines/ags/engine/gui/my_push_button.h
+++ b/engines/ags/engine/gui/my_push_button.h
@@ -32,7 +32,7 @@ struct MyPushButton : public NewControl {
 	MyPushButton(int xx, int yy, int wi, int hi, const char *tex);
 	void draw(Shared::Bitmap *ds) override;
 	int pressedon(int mousex, int mousey) override;
-	int processmessage(int mcode, int wParam, long lParam) override;
+	int processmessage(int mcode, int wParam, NumberPtr lParam) override;
 };
 
 } // namespace AGS3
diff --git a/engines/ags/engine/gui/my_textbox.cpp b/engines/ags/engine/gui/my_textbox.cpp
index 9155ae06b0..d54399e925 100644
--- a/engines/ags/engine/gui/my_textbox.cpp
+++ b/engines/ags/engine/gui/my_textbox.cpp
@@ -59,12 +59,12 @@ int MyTextBox::pressedon(int mousex, int mousey) {
 	return 0;
 }
 
-int MyTextBox::processmessage(int mcode, int wParam, long lParam) {
+int MyTextBox::processmessage(int mcode, int wParam, NumberPtr lParam) {
 	if (mcode == CTB_SETTEXT) {
-		strcpy(text, (char *)lParam);
+		strcpy(text, (char *)lParam._ptr);
 		needredraw = 1;
 	} else if (mcode == CTB_GETTEXT)
-		strcpy((char *)lParam, text);
+		strcpy((char *)lParam._ptr, text);
 	else if (mcode == CTB_KEYPRESS) {
 		if (wParam == eAGSKeyCodeBackspace) {
 			if (text[0] != 0)
diff --git a/engines/ags/engine/gui/my_textbox.h b/engines/ags/engine/gui/my_textbox.h
index 1829bd9bd7..61c4fd98b8 100644
--- a/engines/ags/engine/gui/my_textbox.h
+++ b/engines/ags/engine/gui/my_textbox.h
@@ -33,7 +33,7 @@ struct MyTextBox : public NewControl {
 	MyTextBox(int xx, int yy, int wii, const char *tee);
 	void draw(Shared::Bitmap *ds) override;
 	int pressedon(int mousex, int mousey) override;
-	int processmessage(int mcode, int wParam, long lParam) override;
+	int processmessage(int mcode, int wParam, NumberPtr lParam) override;
 };
 
 } // namespace AGS3
diff --git a/engines/ags/engine/gui/new_control.h b/engines/ags/engine/gui/new_control.h
index 945a5aadd6..a02e407401 100644
--- a/engines/ags/engine/gui/new_control.h
+++ b/engines/ags/engine/gui/new_control.h
@@ -35,7 +35,7 @@ struct NewControl {
 	char needredraw;
 	virtual void draw(Shared::Bitmap *ds) = 0;
 	virtual int pressedon(int mousex, int mousey) = 0;
-	virtual int processmessage(int, int, long) = 0;
+	virtual int processmessage(int, int, NumberPtr) = 0;
 
 	NewControl(int xx, int yy, int wi, int hi);
 	NewControl();


Commit: 313a824fb91c88b9d8cfe6234c73608c3a55dfa4
    https://github.com/scummvm/scummvm/commit/313a824fb91c88b9d8cfe6234c73608c3a55dfa4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-06-15T19:16:10-07:00

Commit Message:
AGS: Fix int pointer type mismatches

Changed paths:
    engines/ags/engine/ac/game_state.h
    engines/ags/engine/ac/move_list.h
    engines/ags/engine/ac/room_object.cpp
    engines/ags/engine/ac/room_status.h
    engines/ags/engine/game/savegame_internal.h
    engines/ags/shared/ac/dialog_topic.h
    engines/ags/shared/ac/game_setup_struct_base.h
    engines/ags/shared/ac/inventory_item_info.h
    engines/ags/shared/ac/sprite_cache.cpp
    engines/ags/shared/ac/view.h
    engines/ags/shared/game/interactions.cpp


diff --git a/engines/ags/engine/ac/game_state.h b/engines/ags/engine/ac/game_state.h
index d1abf2c6e1..1b1bee1db1 100644
--- a/engines/ags/engine/ac/game_state.h
+++ b/engines/ags/engine/ac/game_state.h
@@ -74,7 +74,7 @@ struct GameState {
 	int  disabled_user_interface = 0;  // >0 while in cutscene/etc
 	int  gscript_timer = 0;    // obsolete
 	int  debug_mode = 0;       // whether we're in debug mode
-	int  globalvars[MAXGLOBALVARS];  // obsolete
+	int32_t globalvars[MAXGLOBALVARS];  // obsolete
 	int  messagetime = 0;      // time left for auto-remove messages
 	int  usedinv = 0;          // inventory item last used
 	int  inv_top = 0, inv_numdisp = 0, obsolete_inv_numorder = 0, inv_numinline = 0;
@@ -148,7 +148,7 @@ struct GameState {
 	int  speech_display_post_time_ms = 0; // keep speech text/portrait on screen after text/voice has finished playing = 0;
 	// no speech animation is supposed to be played at this time
 	int  dialog_options_highlight_color = 0; // The colour used for highlighted (hovered over) text in dialog options
-	int  reserved[GAME_STATE_RESERVED_INTS];  // make sure if a future version adds a var, it doesn't mess anything up
+	int32_t reserved[GAME_STATE_RESERVED_INTS];  // make sure if a future version adds a var, it doesn't mess anything up
 	// ** up to here is referenced in the script "game." object
 	long  randseed = 0;    // random seed
 	int   player_on_region = 0;    // player's current region
@@ -160,7 +160,7 @@ struct GameState {
 	short mboundx1 = 0, mboundx2 = 0, mboundy1 = 0, mboundy2 = 0;
 	int   fade_effect = 0;
 	int   bg_frame_locked = 0;
-	int   globalscriptvars[MAXGSVALUES];
+	int32_t globalscriptvars[MAXGSVALUES];
 	int   cur_music_number = 0, music_repeat = 0;
 	int   music_master_volume = 0;
 	int   digital_master_volume = 0;
@@ -169,7 +169,7 @@ struct GameState {
 	int   entered_at_x = 0, entered_at_y = 0, entered_edge = 0;
 	int   want_speech = 0;
 	int   cant_skip_speech = 0;
-	int   script_timers[MAX_TIMERS];
+	int32_t   script_timers[MAX_TIMERS];
 	int   sound_volume = 0, speech_volume = 0;
 	int   normal_font = 0, speech_font = 0;
 	char  key_skip_wait = 0;
@@ -182,7 +182,7 @@ struct GameState {
 	short parsed_words[MAX_PARSED_WORDS];
 	char  bad_parsed_word[100];
 	int   raw_color = 0;
-	int   raw_modified[MAX_ROOM_BGFRAMES];
+	int32_t raw_modified[MAX_ROOM_BGFRAMES];
 	Shared::PBitmap raw_drawing_surface = 0;
 	short filenumbers[MAXSAVEGAMES];
 	int   room_changes = 0;
@@ -222,11 +222,11 @@ struct GameState {
 	int   gamma_adjustment = 0;
 	short temporarily_turned_off_character = 0;  // Hide Player Charactr ticked
 	short inv_backwards_compatibility = 0;
-	int *gui_draw_order = 0;
+	int32_t *gui_draw_order = 0;
 	std::vector<AGS::Shared::String> do_once_tokens = 0;
 	int   text_min_display_time_ms = 0;
 	int   ignore_user_input_after_text_timeout_ms = 0;
-	int   default_audio_type_volumes[MAX_AUDIO_TYPES];
+	int32_t default_audio_type_volumes[MAX_AUDIO_TYPES];
 
 	// Dynamic custom property values for characters and items
 	std::vector<AGS::Shared::StringIMap> charProps;
diff --git a/engines/ags/engine/ac/move_list.h b/engines/ags/engine/ac/move_list.h
index 2932806ba6..097fb936a8 100644
--- a/engines/ags/engine/ac/move_list.h
+++ b/engines/ags/engine/ac/move_list.h
@@ -40,7 +40,7 @@ using namespace AGS; // FIXME later
 #define MAXNEEDSTAGES_LEGACY 40
 
 struct MoveList {
-	int   pos[MAXNEEDSTAGES];
+	int32_t pos[MAXNEEDSTAGES];
 	int   numstage;
 	fixed xpermove[MAXNEEDSTAGES], ypermove[MAXNEEDSTAGES];
 	int   fromx, fromy;
diff --git a/engines/ags/engine/ac/room_object.cpp b/engines/ags/engine/ac/room_object.cpp
index 618aeb8513..f311d49d01 100644
--- a/engines/ags/engine/ac/room_object.cpp
+++ b/engines/ags/engine/ac/room_object.cpp
@@ -159,7 +159,10 @@ void RoomObject::update_cycle_view_backwards() {
 }
 
 void RoomObject::ReadFromFile(Stream *in) {
-	in->ReadArrayOfInt32(&x, 3);
+	x = in->ReadInt32();
+	y = in->ReadInt32();
+	transparent = in->ReadInt32();
+
 	in->ReadArrayOfInt16(&tint_r, 15);
 	cycling = in->ReadByte();
 	overall_speed = in->ReadByte();
@@ -169,7 +172,11 @@ void RoomObject::ReadFromFile(Stream *in) {
 }
 
 void RoomObject::WriteToFile(Stream *out) const {
-	out->WriteArrayOfInt32(&x, 3);
+	out->WriteInt32(x);
+	out->WriteInt32(y);
+	out->WriteInt32(transparent);
+
+	// TODO: Split up array write to properly write fields separately
 	out->WriteArrayOfInt16(&tint_r, 15);
 	out->WriteByte(cycling);
 	out->WriteByte(overall_speed);
diff --git a/engines/ags/engine/ac/room_status.h b/engines/ags/engine/ac/room_status.h
index 30ec22965b..68b60bb3f1 100644
--- a/engines/ags/engine/ac/room_status.h
+++ b/engines/ags/engine/ac/room_status.h
@@ -66,7 +66,7 @@ struct RoomStatus {
 	char  hotspot_enabled[MAX_ROOM_HOTSPOTS];
 	char  region_enabled[MAX_ROOM_REGIONS];
 	short walkbehind_base[MAX_WALK_BEHINDS];
-	int   interactionVariableValues[MAX_GLOBAL_VARIABLES];
+	int32_t interactionVariableValues[MAX_GLOBAL_VARIABLES];
 
 	RoomStatus();
 	~RoomStatus();
diff --git a/engines/ags/engine/game/savegame_internal.h b/engines/ags/engine/game/savegame_internal.h
index 6997d24207..8476c114cb 100644
--- a/engines/ags/engine/game/savegame_internal.h
+++ b/engines/ags/engine/game/savegame_internal.h
@@ -82,10 +82,10 @@ struct RestoredData {
 	std::vector<ScriptData> ScriptModules;
 	// Room data (has to be be preserved until room is loaded)
 	PBitmap                 RoomBkgScene[MAX_ROOM_BGFRAMES];
-	short                   RoomLightLevels[MAX_ROOM_REGIONS];
-	int                     RoomTintLevels[MAX_ROOM_REGIONS];
-	short                   RoomZoomLevels1[MAX_WALK_AREAS + 1];
-	short                   RoomZoomLevels2[MAX_WALK_AREAS + 1];
+	int16_t                 RoomLightLevels[MAX_ROOM_REGIONS];
+	int32_t                 RoomTintLevels[MAX_ROOM_REGIONS];
+	int16_t                 RoomZoomLevels1[MAX_WALK_AREAS + 1];
+	int16_t                 RoomZoomLevels2[MAX_WALK_AREAS + 1];
 	RoomVolumeMod           RoomVolume;
 	// Mouse cursor parameters
 	int                     CursorID;
diff --git a/engines/ags/shared/ac/dialog_topic.h b/engines/ags/shared/ac/dialog_topic.h
index 467dda9297..41fd8c4051 100644
--- a/engines/ags/shared/ac/dialog_topic.h
+++ b/engines/ags/shared/ac/dialog_topic.h
@@ -23,6 +23,8 @@
 #ifndef AGS_SHARED_AC_DIALOG_TOPIC_H
 #define AGS_SHARED_AC_DIALOG_TOPIC_H
 
+#include "ags/shared/core/types.h"
+
 namespace AGS3 {
 
 namespace AGS {
@@ -63,7 +65,7 @@ using namespace AGS; // FIXME later
 
 struct DialogTopic {
 	char          optionnames[MAXTOPICOPTIONS][150];
-	int           optionflags[MAXTOPICOPTIONS];
+	int32_t       optionflags[MAXTOPICOPTIONS];
 	unsigned char *optionscripts;
 	short         entrypoints[MAXTOPICOPTIONS];
 	short         startupentrypoint;
diff --git a/engines/ags/shared/ac/game_setup_struct_base.h b/engines/ags/shared/ac/game_setup_struct_base.h
index 1dc3808a7c..4c57134ba9 100644
--- a/engines/ags/shared/ac/game_setup_struct_base.h
+++ b/engines/ags/shared/ac/game_setup_struct_base.h
@@ -51,7 +51,7 @@ struct GameSetupStructBase {
 	static const int  NUM_INTS_RESERVED = 17;
 
 	char              gamename[GAME_NAME_LENGTH];
-	int               options[MAX_OPTIONS];
+	int32_t           options[MAX_OPTIONS];
 	unsigned char     paluses[256];
 	RGB               defpal[256];
 	int               numviews;
@@ -70,16 +70,16 @@ struct GameSetupStructBase {
 	int               numcursors;
 	int               default_lipsync_frame; // used for unknown chars
 	int               invhotdotsprite;
-	int               reserved[NUM_INTS_RESERVED];
+	int32_t           reserved[NUM_INTS_RESERVED];
 	char *messages[MAXGLOBALMES];
 	WordsDictionary *dict;
 	char *globalscript;
 	CharacterInfo *chars;
 	ccScript *compiled_script;
 
-	int *load_messages;
-	bool             load_dictionary;
-	bool             load_compiled_script;
+	int32_t *load_messages;
+	bool load_dictionary;
+	bool load_compiled_script;
 	// [IKM] 2013-03-30
 	// NOTE: it looks like nor 'globalscript', not 'compiled_script' are used
 	// to store actual script data anytime; 'ccScript* _GP(gamescript)' global
diff --git a/engines/ags/shared/ac/inventory_item_info.h b/engines/ags/shared/ac/inventory_item_info.h
index 215051aa55..fde16d2921 100644
--- a/engines/ags/shared/ac/inventory_item_info.h
+++ b/engines/ags/shared/ac/inventory_item_info.h
@@ -23,6 +23,8 @@
 #ifndef AGS_SHARED_AC_INVENTORY_ITEM_INFO_H
 #define AGS_SHARED_AC_INVENTORY_ITEM_INFO_H
 
+#include "ags/shared/core/types.h"
+
 namespace AGS3 {
 
 namespace AGS {
@@ -38,7 +40,7 @@ struct InventoryItemInfo {
 	char name[25];
 	int  pic;
 	int  cursorPic, hotx, hoty;
-	int  reserved[5];
+	int32_t reserved[5];
 	char flags;
 
 	void ReadFromFile(Shared::Stream *in);
diff --git a/engines/ags/shared/ac/sprite_cache.cpp b/engines/ags/shared/ac/sprite_cache.cpp
index c655323d07..847283251e 100644
--- a/engines/ags/shared/ac/sprite_cache.cpp
+++ b/engines/ags/shared/ac/sprite_cache.cpp
@@ -496,10 +496,10 @@ void SpriteCache::CompressSprite(Bitmap *sprite, Stream *out) {
 			cpackbitl(&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), out);
 	} else if (depth == 2) {
 		for (int y = 0; y < sprite->GetHeight(); y++)
-			cpackbitl16((const unsigned short *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
+			cpackbitl16((const uint16_t *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
 	} else {
 		for (int y = 0; y < sprite->GetHeight(); y++)
-			cpackbitl32((const unsigned int *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
+			cpackbitl32((const uint32_t *)&sprite->GetScanLine(y)[0], sprite->GetWidth(), out);
 	}
 }
 
@@ -510,10 +510,10 @@ void SpriteCache::UnCompressSprite(Bitmap *sprite, Stream *in) {
 			cunpackbitl(&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
 	} else if (depth == 2) {
 		for (int y = 0; y < sprite->GetHeight(); y++)
-			cunpackbitl16((unsigned short *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
+			cunpackbitl16((uint16_t *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
 	} else {
 		for (int y = 0; y < sprite->GetHeight(); y++)
-			cunpackbitl32((unsigned int *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
+			cunpackbitl32((uint32_t *)&sprite->GetScanLineForWriting(y)[0], sprite->GetWidth(), in);
 	}
 }
 
diff --git a/engines/ags/shared/ac/view.h b/engines/ags/shared/ac/view.h
index 742da5a93e..b46a8a3b33 100644
--- a/engines/ags/shared/ac/view.h
+++ b/engines/ags/shared/ac/view.h
@@ -24,6 +24,7 @@
 #define AGS_SHARED_AC_VIEW_H
 
 #include "ags/lib/std/vector.h"
+#include "ags/shared/core/types.h"
 
 namespace AGS3 {
 
@@ -84,7 +85,7 @@ struct ViewStruct {
 struct ViewStruct272 {
 	short     numloops;
 	short     numframes[16];
-	int       loopflags[16];
+	int32_t   loopflags[16];
 	ViewFrame frames[16][20];
 
 	ViewStruct272();
diff --git a/engines/ags/shared/game/interactions.cpp b/engines/ags/shared/game/interactions.cpp
index fdedbcc5c8..8d0248860d 100644
--- a/engines/ags/shared/game/interactions.cpp
+++ b/engines/ags/shared/game/interactions.cpp
@@ -246,8 +246,8 @@ Interaction *Interaction::CreateFromStream(Stream *in) {
 	if (evt_count > MAX_NEWINTERACTION_EVENTS)
 		quit("Can't deserialize interaction: too many events");
 
-	int types[MAX_NEWINTERACTION_EVENTS];
-	int load_response[MAX_NEWINTERACTION_EVENTS];
+	int32_t types[MAX_NEWINTERACTION_EVENTS];
+	int32_t load_response[MAX_NEWINTERACTION_EVENTS];
 	in->ReadArrayOfInt32(types, evt_count);
 	in->ReadArrayOfInt32(load_response, evt_count);
 




More information about the Scummvm-git-logs mailing list