[Scummvm-git-logs] scummvm master -> 9b348b3e7da8bf47bb98729b14e5c89a523d5e2a

ccawley2011 ccawley2011 at gmail.com
Wed Jun 16 12:03:58 UTC 2021


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

Summary:
9b348b3e7d AGS: Fix more type mismatches


Commit: 9b348b3e7da8bf47bb98729b14e5c89a523d5e2a
    https://github.com/scummvm/scummvm/commit/9b348b3e7da8bf47bb98729b14e5c89a523d5e2a
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-06-16T13:03:41+01:00

Commit Message:
AGS: Fix more type mismatches

Changed paths:
    engines/ags/engine/ac/dialog.cpp
    engines/ags/engine/ac/game_setup.h
    engines/ags/engine/ac/game_state.cpp
    engines/ags/engine/ac/lip_sync.h
    engines/ags/engine/game/game_init.cpp
    engines/ags/engine/game/savegame_v321.cpp
    engines/ags/engine/gui/gui_engine.cpp
    engines/ags/engine/main/engine.cpp
    engines/ags/engine/main/graphics_mode.cpp
    engines/ags/engine/platform/base/ags_platform_driver.h
    engines/ags/plugins/ags_plugin.h
    engines/ags/shared/ac/game_setup_struct.cpp
    engines/ags/shared/gui/gui_main.cpp
    engines/ags/shared/gui/gui_main.h
    engines/ags/shared/util/compress.cpp


diff --git a/engines/ags/engine/ac/dialog.cpp b/engines/ags/engine/ac/dialog.cpp
index 1c1e730876..5bdeff0554 100644
--- a/engines/ags/engine/ac/dialog.cpp
+++ b/engines/ags/engine/ac/dialog.cpp
@@ -1016,7 +1016,7 @@ int show_dialog_options(int _dlgnum, int sayChosenOption, bool _runGameLoopsInBa
 	if (dialog_choice >= 0) { // NOTE: this condition also excludes CHOSE_TEXTPARSER
 		assert(dialog_choice >= 0 && dialog_choice < MAXTOPICOPTIONS);
 		DialogTopic *dialog_topic = DlgOpt.dtop;
-		int &option_flags = dialog_topic->optionflags[dialog_choice];
+		int32_t &option_flags = dialog_topic->optionflags[dialog_choice];
 		const char *option_name = DlgOpt.dtop->optionnames[dialog_choice];
 
 		option_flags |= DFLG_HASBEENCHOSEN;
diff --git a/engines/ags/engine/ac/game_setup.h b/engines/ags/engine/ac/game_setup.h
index 113494f7e4..b845512392 100644
--- a/engines/ags/engine/ac/game_setup.h
+++ b/engines/ags/engine/ac/game_setup.h
@@ -75,7 +75,7 @@ struct GameSetup {
 	String translation;
 	bool  mouse_auto_lock;
 	int   override_script_os;
-	char  override_multitasking;
+	uint8_t override_multitasking;
 	bool  override_upscale;
 	float mouse_speed;
 	MouseControlWhen mouse_ctrl_when;
diff --git a/engines/ags/engine/ac/game_state.cpp b/engines/ags/engine/ac/game_state.cpp
index 32d71ec41a..42d06aacde 100644
--- a/engines/ags/engine/ac/game_state.cpp
+++ b/engines/ags/engine/ac/game_state.cpp
@@ -245,7 +245,7 @@ PViewport GameState::CreateRoomViewport() {
 	viewport->SetRect(_mainViewport.GetRect());
 	ScriptViewport *scv = new ScriptViewport(index);
 	_roomViewports.push_back(viewport);
-	_scViewportRefs.push_back(std::make_pair(scv, 0));
+	_scViewportRefs.push_back(std::make_pair<ScriptViewport*, int32_t>(scv, 0));
 	_roomViewportsSorted.push_back(viewport);
 	_roomViewportZOrderChanged = true;
 	on_roomviewport_created(index);
@@ -302,7 +302,7 @@ PCamera GameState::CreateRoomCamera() {
 	camera->SetAt(0, 0);
 	camera->SetSize(_mainViewport.GetRect().GetSize());
 	ScriptCamera *scam = new ScriptCamera(index);
-	_scCameraRefs.push_back(std::make_pair(scam, 0));
+	_scCameraRefs.push_back(std::make_pair<ScriptCamera*, int32_t>(scam, 0));
 	_roomCameras.push_back(camera);
 	return camera;
 }
diff --git a/engines/ags/engine/ac/lip_sync.h b/engines/ags/engine/ac/lip_sync.h
index d5ef6e2bbf..d0c840283e 100644
--- a/engines/ags/engine/ac/lip_sync.h
+++ b/engines/ags/engine/ac/lip_sync.h
@@ -27,7 +27,7 @@ namespace AGS3 {
 
 struct SpeechLipSyncLine {
 	char  filename[14];
-	int *endtimeoffs;
+	int32_t *endtimeoffs;
 	short *frame;
 	short numPhonemes;
 };
diff --git a/engines/ags/engine/game/game_init.cpp b/engines/ags/engine/game/game_init.cpp
index 3f300fb30a..84f348f269 100644
--- a/engines/ags/engine/game/game_init.cpp
+++ b/engines/ags/engine/game/game_init.cpp
@@ -342,7 +342,7 @@ HGameInitError InitGameState(const LoadedGameEntities &ents, GameDataVersion dat
 		// labels are not clickable by default
 		_GP(guilabels)[i].SetClickable(false);
 	}
-	_GP(play).gui_draw_order = (int *)calloc(_GP(game).numgui * sizeof(int), 1);
+	_GP(play).gui_draw_order = (int32_t *)calloc(_GP(game).numgui * sizeof(int), 1);
 	update_gui_zorder();
 	calculate_reserved_channel_count();
 
diff --git a/engines/ags/engine/game/savegame_v321.cpp b/engines/ags/engine/game/savegame_v321.cpp
index 18c917e56a..611437a513 100644
--- a/engines/ags/engine/game/savegame_v321.cpp
+++ b/engines/ags/engine/game/savegame_v321.cpp
@@ -161,7 +161,7 @@ static void restore_game_play(Stream *in, RestoredData &r_data) {
 	int screenfadedout_was = _GP(play).screen_is_faded_out;
 	int roomchanges_was = _GP(play).room_changes;
 	// make sure the pointer is preserved
-	int *gui_draw_order_was = _GP(play).gui_draw_order;
+	int32_t *gui_draw_order_was = _GP(play).gui_draw_order;
 
 	ReadGameState_Aligned(in, r_data);
 	r_data.Cameras[0].Flags = r_data.Camera0_Flags;
diff --git a/engines/ags/engine/gui/gui_engine.cpp b/engines/ags/engine/gui/gui_engine.cpp
index 70aa4b487c..fe1d7ee297 100644
--- a/engines/ags/engine/gui/gui_engine.cpp
+++ b/engines/ags/engine/gui/gui_engine.cpp
@@ -77,7 +77,7 @@ bool GUIMain::HasAlphaChannel() const {
 // Engine-specific implementation split out of acgui.h
 //=============================================================================
 
-void check_font(int *fontnum) {
+void check_font(int32_t *fontnum) {
 	// do nothing
 }
 
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index 52ceb8fb50..09eac0be40 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -311,7 +311,7 @@ void engine_locate_speech_pak() {
 					for (int ee = 0; ee < _G(numLipLines); ee++) {
 						_G(splipsync)[ee].numPhonemes = speechsync->ReadInt16();
 						speechsync->Read(_G(splipsync)[ee].filename, 14);
-						_G(splipsync)[ee].endtimeoffs = (int *)malloc(_G(splipsync)[ee].numPhonemes * sizeof(int));
+						_G(splipsync)[ee].endtimeoffs = (int32_t *)malloc(_G(splipsync)[ee].numPhonemes * sizeof(int));
 						speechsync->ReadArrayOfInt32(_G(splipsync)[ee].endtimeoffs, _G(splipsync)[ee].numPhonemes);
 						_G(splipsync)[ee].frame = (short *)malloc(_G(splipsync)[ee].numPhonemes * sizeof(short));
 						speechsync->ReadArrayOfInt16(_G(splipsync)[ee].frame, _G(splipsync)[ee].numPhonemes);
diff --git a/engines/ags/engine/main/graphics_mode.cpp b/engines/ags/engine/main/graphics_mode.cpp
index 769bf8725d..1f3b62fff6 100644
--- a/engines/ags/engine/main/graphics_mode.cpp
+++ b/engines/ags/engine/main/graphics_mode.cpp
@@ -268,8 +268,8 @@ bool try_init_compatible_mode(const DisplayMode &dm, const bool match_device_rat
 	// Windowed mode
 	if (dm.Windowed) {
 		// If windowed mode, make the resolution stay in the generally supported limits
-		dm_compat.Width = Math::Min(dm_compat.Width, device_size.Width);
-		dm_compat.Height = Math::Min(dm_compat.Height, device_size.Height);
+		dm_compat.Width = Math::Min<int32_t>(dm_compat.Width, device_size.Width);
+		dm_compat.Height = Math::Min<int32_t>(dm_compat.Height, device_size.Height);
 	}
 	// Fullscreen mode
 	else {
diff --git a/engines/ags/engine/platform/base/ags_platform_driver.h b/engines/ags/engine/platform/base/ags_platform_driver.h
index 5aad35f093..3ab486a98e 100644
--- a/engines/ags/engine/platform/base/ags_platform_driver.h
+++ b/engines/ags/engine/platform/base/ags_platform_driver.h
@@ -157,7 +157,7 @@ struct AGSPlatformDriver
 	virtual void UnRegisterGameWithGameExplorer();
 	virtual int  ConvertKeycodeToScanCode(int keyCode);
 	// Adjust window size to ensure it is in the supported limits
-	virtual void ValidateWindowSize(int32_t &x, int32_t &y, bool borderless) const {
+	virtual void ValidateWindowSize(int &x, int &y, bool borderless) const {
 	}
 
 	virtual int  InitializeCDPlayer() = 0;  // return 0 on success
diff --git a/engines/ags/plugins/ags_plugin.h b/engines/ags/plugins/ags_plugin.h
index 03a63746f4..34ca0baf28 100644
--- a/engines/ags/plugins/ags_plugin.h
+++ b/engines/ags/plugins/ags_plugin.h
@@ -62,10 +62,6 @@ class BITMAP;
 typedef int HWND;
 #endif
 
-#ifndef int32
-typedef int int32;
-#endif
-
 #define AGSIFUNC(type) virtual type
 
 #define MASK_WALKABLE   1
diff --git a/engines/ags/shared/ac/game_setup_struct.cpp b/engines/ags/shared/ac/game_setup_struct.cpp
index 1dd6233c47..b9e7310939 100644
--- a/engines/ags/shared/ac/game_setup_struct.cpp
+++ b/engines/ags/shared/ac/game_setup_struct.cpp
@@ -129,7 +129,7 @@ void GameSetupStruct::read_font_infos(Shared::Stream *in, GameDataVersion data_v
 		for (int i = 0; i < numfonts; ++i) {
 			fonts[i].YOffset = in->ReadInt32();
 			if (data_ver >= kGameVersion_341_2)
-				fonts[i].LineSpacing = Math::Max(0, in->ReadInt32());
+				fonts[i].LineSpacing = Math::Max<int32_t>(0, in->ReadInt32());
 		}
 	} else {
 		for (int i = 0; i < numfonts; ++i) {
@@ -137,7 +137,7 @@ void GameSetupStruct::read_font_infos(Shared::Stream *in, GameDataVersion data_v
 			fonts[i].SizePt = in->ReadInt32();
 			fonts[i].Outline = in->ReadInt32();
 			fonts[i].YOffset = in->ReadInt32();
-			fonts[i].LineSpacing = Math::Max(0, in->ReadInt32());
+			fonts[i].LineSpacing = Math::Max<int32_t>(0, in->ReadInt32());
 			AdjustFontInfoUsingFlags(fonts[i], flags);
 		}
 	}
diff --git a/engines/ags/shared/gui/gui_main.cpp b/engines/ags/shared/gui/gui_main.cpp
index 40fbe0a47e..05756d6d64 100644
--- a/engines/ags/shared/gui/gui_main.cpp
+++ b/engines/ags/shared/gui/gui_main.cpp
@@ -88,7 +88,7 @@ void GUIMain::InitDefaults() {
 	_ctrlDrawOrder.clear();
 }
 
-int GUIMain::FindControlUnderMouse(int leeway, bool must_be_clickable) const {
+int32_t GUIMain::FindControlUnderMouse(int leeway, bool must_be_clickable) const {
 	if (_G(loaded_game_file_version) <= kGameVersion_262) {
 		// Ignore draw order On 2.6.2 and lower
 		for (size_t i = 0; i < _controls.size(); ++i) {
@@ -113,15 +113,15 @@ int GUIMain::FindControlUnderMouse(int leeway, bool must_be_clickable) const {
 	return -1;
 }
 
-int GUIMain::FindControlUnderMouse() const {
+int32_t GUIMain::FindControlUnderMouse() const {
 	return FindControlUnderMouse(0, true);
 }
 
-int GUIMain::FindControlUnderMouse(int leeway) const {
+int32_t GUIMain::FindControlUnderMouse(int leeway) const {
 	return FindControlUnderMouse(leeway, true);
 }
 
-int GUIMain::GetControlCount() const {
+int32_t GUIMain::GetControlCount() const {
 	return (int32_t)_controls.size();
 }
 
@@ -185,7 +185,7 @@ void GUIMain::ClearChanged() {
 	_hasChanged = false;
 }
 
-void GUIMain::AddControl(GUIControlType type, int id, GUIObject *control) {
+void GUIMain::AddControl(GUIControlType type, int32_t id, GUIObject *control) {
 	_ctrlRefs.push_back(std::make_pair(type, id));
 	_controls.push_back(control);
 }
diff --git a/engines/ags/shared/gui/gui_main.h b/engines/ags/shared/gui/gui_main.h
index 98d2006167..3fb13d1736 100644
--- a/engines/ags/shared/gui/gui_main.h
+++ b/engines/ags/shared/gui/gui_main.h
@@ -120,7 +120,7 @@ public:
 
 	// Child control management
 	// Note that currently GUIMain does not own controls (should not delete them)
-	void    AddControl(GUIControlType type, int id, GUIObject *control);
+	void    AddControl(GUIControlType type, int32_t id, GUIObject *control);
 	void    RemoveAllControls();
 
 	// Operations
@@ -250,7 +250,7 @@ extern AGS_INLINE int get_fixed_pixel_size(int pixels);
 // Those function have distinct implementations in Engine and Editor
 extern void wouttext_outline(Shared::Bitmap *ds, int xxp, int yyp, int usingfont, color_t text_color, const char *texx);
 extern int wgettextwidth_compensate(Shared::Bitmap *ds, const char *tex, int font);
-extern void check_font(int *fontnum);
+extern void check_font(int32_t *fontnum);
 
 extern void set_our_eip(int eip);
 #define SET_EIP(x) set_our_eip(x);
diff --git a/engines/ags/shared/util/compress.cpp b/engines/ags/shared/util/compress.cpp
index 3877045791..c94bc9cf13 100644
--- a/engines/ags/shared/util/compress.cpp
+++ b/engines/ags/shared/util/compress.cpp
@@ -183,7 +183,7 @@ int cunpackbitl(uint8_t *line, int size, Stream *in) {
 		if (in->HasErrors())
 			break;
 
-		char cx = ix;
+		int8_t cx = ix;
 		if (cx == -128)
 			cx = 0;
 
@@ -220,7 +220,7 @@ int cunpackbitl16(uint16_t *line, int size, Stream *in) {
 		if (in->HasErrors())
 			break;
 
-		char cx = ix;
+		int8_t cx = ix;
 		if (cx == -128)
 			cx = 0;
 
@@ -257,7 +257,7 @@ int cunpackbitl32(uint32_t *line, int size, Stream *in) {
 		if (in->HasErrors())
 			break;
 
-		char cx = ix;
+		int8_t cx = ix;
 		if (cx == -128)
 			cx = 0;
 




More information about the Scummvm-git-logs mailing list