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

dreammaster dreammaster at scummvm.org
Sun Feb 7 20:05:09 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:
9a9a2a9078 AGS: Correct usage of int32 vs int


Commit: 9a9a2a9078fa0cc7f3d81041e106ddfa0d454074
    https://github.com/scummvm/scummvm/commit/9a9a2a9078fa0cc7f3d81041e106ddfa0d454074
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-02-07T12:04:58-08:00

Commit Message:
AGS: Correct usage of int32 vs int

Changed paths:
    engines/ags/plugins/ags_blend/ags_blend.cpp
    engines/ags/plugins/ags_creditz/ags_creditz.cpp
    engines/ags/plugins/ags_creditz/ags_creditz.h
    engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
    engines/ags/plugins/ags_flashlight/ags_flashlight.h
    engines/ags/plugins/ags_parallax/ags_parallax.cpp
    engines/ags/plugins/ags_parallax/ags_parallax.h
    engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
    engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
    engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp
    engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp
    engines/ags/plugins/serializer.h


diff --git a/engines/ags/plugins/ags_blend/ags_blend.cpp b/engines/ags/plugins/ags_blend/ags_blend.cpp
index f32f79dec6..dd063b7fbe 100644
--- a/engines/ags/plugins/ags_blend/ags_blend.cpp
+++ b/engines/ags/plugins/ags_blend/ags_blend.cpp
@@ -186,7 +186,7 @@ int AGSBlend::xytolocale(int x, int y, int width) {
 
 int AGSBlend::HighPass(int sprite, int threshold) {
 	BITMAP *src = _engine->GetSpriteGraphic(sprite);
-	int srcWidth, srcHeight;
+	int32 srcWidth, srcHeight;
 
 	_engine->GetBitmapDimensions(src, &srcWidth, &srcHeight, nullptr);
 
@@ -218,7 +218,7 @@ int AGSBlend::HighPass(int sprite, int threshold) {
 int AGSBlend::Blur(int sprite, int radius) {
 	BITMAP *src = _engine->GetSpriteGraphic(sprite);
 
-	int srcWidth, srcHeight;
+	int32 srcWidth, srcHeight;
 	_engine->GetBitmapDimensions(src, &srcWidth, &srcHeight, nullptr);
 
 	unsigned char **srccharbuffer = _engine->GetRawBitmapSurface(src);
@@ -358,7 +358,7 @@ int AGSBlend::Blur(int sprite, int radius) {
 
 int AGSBlend::DrawSprite(int destination, int sprite, int x, int y, int DrawMode, int trans) {
 	trans = 100 - trans;
-	int srcWidth, srcHeight, destWidth, destHeight;
+	int32 srcWidth, srcHeight, destWidth, destHeight;
 
 	BITMAP *src = _engine->GetSpriteGraphic(sprite);
 	BITMAP *dest = _engine->GetSpriteGraphic(destination);
@@ -578,7 +578,7 @@ int AGSBlend::DrawSprite(int destination, int sprite, int x, int y, int DrawMode
 }
 
 int AGSBlend::DrawAdd(int destination, int sprite, int x, int y, float scale) {
-	int srcWidth, srcHeight, destWidth, destHeight;
+	int32 srcWidth, srcHeight, destWidth, destHeight;
 
 	BITMAP *src = _engine->GetSpriteGraphic(sprite);
 	BITMAP *dest = _engine->GetSpriteGraphic(destination);
@@ -653,7 +653,7 @@ int AGSBlend::DrawAdd(int destination, int sprite, int x, int y, float scale) {
 int AGSBlend::DrawAlpha(int destination, int sprite, int x, int y, int trans) {
 	trans = 100 - trans;
 
-	int srcWidth, srcHeight, destWidth, destHeight;
+	int32 srcWidth, srcHeight, destWidth, destHeight;
 
 	BITMAP *src = _engine->GetSpriteGraphic(sprite);
 	BITMAP *dest = _engine->GetSpriteGraphic(destination);
diff --git a/engines/ags/plugins/ags_creditz/ags_creditz.cpp b/engines/ags/plugins/ags_creditz/ags_creditz.cpp
index bf56f30036..d438c16507 100644
--- a/engines/ags/plugins/ags_creditz/ags_creditz.cpp
+++ b/engines/ags/plugins/ags_creditz/ags_creditz.cpp
@@ -473,7 +473,7 @@ int AGSCreditz20::GetCurrentStaticCredit(const ScriptMethodParams &params) {
 }
 
 void AGSCreditz20::calculateSequenceHeight(int sequence) {
-	int height, creditHeight, dum;
+	int32 height, creditHeight, dum;
 	height = 0;
 
 	for (uint currentCredit = 0; currentCredit < _state->_credits[sequence].size();
@@ -501,7 +501,7 @@ void AGSCreditz20::calculateSequenceHeight(int sequence) {
 }
 
 int AGSCreditz20::VGACheck(int value) {
-	int screenX, dum;
+	int32 screenX, dum;
 	_engine->GetScreenDimensions(&screenX, &dum, &dum);
 
 	if (screenX == 640)
diff --git a/engines/ags/plugins/ags_creditz/ags_creditz.h b/engines/ags/plugins/ags_creditz/ags_creditz.h
index d56583256b..3457f8a80a 100644
--- a/engines/ags/plugins/ags_creditz/ags_creditz.h
+++ b/engines/ags/plugins/ags_creditz/ags_creditz.h
@@ -109,7 +109,7 @@ struct State {
 
 	// Version 1.1 specific
 	bool _resolutionFlag = false;
-	int _screenWidth = 0, _screenHeight = 0, _screenColorDepth = 0;
+	int32 _screenWidth = 0, _screenHeight = 0, _screenColorDepth = 0;
 };
 
 class AGSCreditz : public DLL {
diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
index cccddec62d..1203710358 100644
--- a/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
+++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.cpp
@@ -34,9 +34,9 @@ const unsigned int Version = 2;
 const unsigned int SaveMagic = Magic + Version;
 const float PI = 3.14159265f;
 
-int AGSFlashlight::AGSFlashlight::screen_width = 320;
-int AGSFlashlight::screen_height = 200;
-int AGSFlashlight::screen_color_depth = 16;
+int32 AGSFlashlight::AGSFlashlight::screen_width = 320;
+int32 AGSFlashlight::screen_height = 200;
+int32 AGSFlashlight::screen_color_depth = 16;
 
 bool AGSFlashlight::g_BitmapMustBeUpdated = true;
 
@@ -50,10 +50,10 @@ int AGSFlashlight::g_DarknessSize = 0;
 int AGSFlashlight::g_DarknessDiameter = 0;
 int AGSFlashlight::g_BrightnessSize = 0;
 
-int AGSFlashlight::g_FlashlightX = 0;
-int AGSFlashlight::g_FlashlightY = 0;
-int AGSFlashlight::g_FlashlightDrawAtX = 0;
-int AGSFlashlight::g_FlashlightDrawAtY = 0;
+int32 AGSFlashlight::g_FlashlightX = 0;
+int32 AGSFlashlight::g_FlashlightY = 0;
+int32 AGSFlashlight::g_FlashlightDrawAtX = 0;
+int32 AGSFlashlight::g_FlashlightDrawAtY = 0;
 
 bool AGSFlashlight::g_FlashlightFollowMouse = false;
 
diff --git a/engines/ags/plugins/ags_flashlight/ags_flashlight.h b/engines/ags/plugins/ags_flashlight/ags_flashlight.h
index 182b3dfb2c..11572d8eac 100644
--- a/engines/ags/plugins/ags_flashlight/ags_flashlight.h
+++ b/engines/ags/plugins/ags_flashlight/ags_flashlight.h
@@ -37,9 +37,9 @@ namespace AGSFlashlight {
 class AGSFlashlight : public DLL {
 private:
 	static IAGSEngine *_engine;
-	static int screen_width;
-	static int screen_height;
-	static int screen_color_depth;
+	static int32 screen_width;
+	static int32 screen_height;
+	static int32 screen_color_depth;
 	static bool g_BitmapMustBeUpdated;
 	static int g_RedTint;
 	static int g_GreenTint;
@@ -49,10 +49,10 @@ private:
 	static int g_DarknessSize;
 	static int g_DarknessDiameter;
 	static int g_BrightnessSize;
-	static int g_FlashlightX;
-	static int g_FlashlightY;
-	static int g_FlashlightDrawAtX;
-	static int g_FlashlightDrawAtY;
+	static int32 g_FlashlightX;
+	static int32 g_FlashlightY;
+	static int32 g_FlashlightDrawAtX;
+	static int32 g_FlashlightDrawAtY;
 	static bool g_FlashlightFollowMouse;
 	static int g_FollowCharacterId;
 	static int g_FollowCharacterDx;
diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.cpp b/engines/ags/plugins/ags_parallax/ags_parallax.cpp
index 0a7b123e74..ac76003b6a 100644
--- a/engines/ags/plugins/ags_parallax/ags_parallax.cpp
+++ b/engines/ags/plugins/ags_parallax/ags_parallax.cpp
@@ -33,9 +33,9 @@ const unsigned int Version = 2;
 const unsigned int SaveMagic = Magic + Version;
 
 IAGSEngine *AGSParallax::_engine;
-int AGSParallax::_screenWidth;
-int AGSParallax::_screenHeight;
-int AGSParallax::_screenColorDepth;
+int32 AGSParallax::_screenWidth;
+int32 AGSParallax::_screenHeight;
+int32 AGSParallax::_screenColorDepth;
 bool AGSParallax::_enabled;
 Sprite AGSParallax::_sprites[MAX_SPRITES];
 
@@ -124,8 +124,8 @@ void AGSParallax::Draw(bool foreground) {
 	BITMAP *bmp;
 	int i;
 
-	int offsetX = 0;
-	int offsetY = 0;
+	int32 offsetX = 0;
+	int32 offsetY = 0;
 	_engine->ViewportToRoom(&offsetX, &offsetY);
 
 	for (i = 0; i < MAX_SPRITES; i++) {
diff --git a/engines/ags/plugins/ags_parallax/ags_parallax.h b/engines/ags/plugins/ags_parallax/ags_parallax.h
index 8647a95235..1d0e37f555 100644
--- a/engines/ags/plugins/ags_parallax/ags_parallax.h
+++ b/engines/ags/plugins/ags_parallax/ags_parallax.h
@@ -31,8 +31,8 @@ namespace Plugins {
 namespace AGSParallax {
 
 struct Sprite {
-	int x = 0;
-	int y = 0;
+	int32 x = 0;
+	int32 y = 0;
 	int slot = -1;
 	int speed = 0;
 
@@ -49,9 +49,9 @@ struct Sprite {
 class AGSParallax : public DLL {
 private:
 	static IAGSEngine *_engine;
-	static int _screenWidth;
-	static int _screenHeight;
-	static int _screenColorDepth;
+	static int32 _screenWidth;
+	static int32 _screenHeight;
+	static int32 _screenColorDepth;
 
 	static bool _enabled;
 	static Sprite _sprites[MAX_SPRITES];
diff --git a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
index 92764acc25..991b48eafa 100644
--- a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
+++ b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.cpp
@@ -27,9 +27,9 @@ namespace Plugins {
 namespace AGSSnowRain {
 
 IAGSEngine *_engine;
-int _screenWidth;
-int _screenHeight;
-int _screenColorDepth;
+int32 _screenWidth;
+int32 _screenHeight;
+int32 _screenColorDepth;
 
 Weather *AGSSnowRain::_rain;
 Weather *AGSSnowRain::_snow;
diff --git a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
index 148e865af7..fe24a84de2 100644
--- a/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
+++ b/engines/ags/plugins/ags_snow_rain/ags_snow_rain.h
@@ -31,9 +31,9 @@ namespace Plugins {
 namespace AGSSnowRain {
 
 extern IAGSEngine *_engine;
-extern int _screenWidth;
-extern int _screenHeight;
-extern int _screenColorDepth;
+extern int32 _screenWidth;
+extern int32 _screenHeight;
+extern int32 _screenColorDepth;
 
 /**
  * This is not the original AGS SnowRain plugin, but a workalike
diff --git a/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp b/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp
index 4dd7e31f21..3c7f5e7591 100644
--- a/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp
+++ b/engines/ags/plugins/ags_sprite_font/sprite_font_renderer.cpp
@@ -113,7 +113,7 @@ void SpriteFontRenderer::RenderText(const char *text, int fontNumber, BITMAP *de
 
 void SpriteFontRenderer::Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height) {
 
-	int srcWidth, srcHeight, destWidth, destHeight, srcColDepth, destColDepth;
+	int32 srcWidth, srcHeight, destWidth, destHeight, srcColDepth, destColDepth;
 
 	unsigned char **srccharbuffer = _engine->GetRawBitmapSurface(src);  //8bit
 	unsigned short **srcshortbuffer = (unsigned short **)srccharbuffer; //16bit;
diff --git a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp
index 3208008ed9..d333fed2e8 100644
--- a/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp
+++ b/engines/ags/plugins/ags_sprite_font/variable_width_sprite_font.cpp
@@ -124,7 +124,7 @@ void VariableWidthSpriteFontRenderer::RenderText(const char *text, int fontNumbe
 
 void VariableWidthSpriteFontRenderer::Draw(BITMAP *src, BITMAP *dest, int destx, int desty, int srcx, int srcy, int width, int height) {
 
-	int srcWidth, srcHeight, destWidth, destHeight, srcColDepth, destColDepth;
+	int32 srcWidth, srcHeight, destWidth, destHeight, srcColDepth, destColDepth;
 
 	unsigned char **srccharbuffer = _engine->GetRawBitmapSurface(src);  //8bit
 	unsigned short **srcshortbuffer = (unsigned short **)srccharbuffer; //16bit;
diff --git a/engines/ags/plugins/serializer.h b/engines/ags/plugins/serializer.h
index e752ea060f..68a5795081 100644
--- a/engines/ags/plugins/serializer.h
+++ b/engines/ags/plugins/serializer.h
@@ -41,14 +41,15 @@ public:
 	bool isLoading() const { return _isLoading; }
 	bool isSaving() const { return !_isLoading; }
 
-	void syncAsInt(int &value) {
+	template<typename T>
+	void syncAsInt(T &value) {
 		byte buf[4];
 		if (_isLoading) {
-			_engine->FRead(buf, sizeof(int32), _file);
+			_engine->FRead(buf, 4, _file);
 			value = READ_LE_INT32(buf);
 		} else {
 			WRITE_LE_UINT32(buf, value);
-			_engine->FWrite(buf, sizeof(int32), _file);
+			_engine->FWrite(buf, 4, _file);
 		}
 	}
 




More information about the Scummvm-git-logs mailing list