[Scummvm-git-logs] scummvm master -> 02c75be38b7e0c1a3687f55e9ee7ab5716b8a9bc

aquadran aquadran at gmail.com
Sat Mar 13 20:10:33 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:
02c75be38b ICB: Remove global constructor


Commit: 02c75be38b7e0c1a3687f55e9ee7ab5716b8a9bc
    https://github.com/scummvm/scummvm/commit/02c75be38b7e0c1a3687f55e9ee7ab5716b8a9bc
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-03-13T21:10:28+01:00

Commit Message:
ICB: Remove global constructor

Changed paths:
    engines/icb/gfx/gfxstub.cpp
    engines/icb/gfx/psx_scrn.h
    engines/icb/global_vars.cpp


diff --git a/engines/icb/gfx/gfxstub.cpp b/engines/icb/gfx/gfxstub.cpp
index db7e4f7ffc..64b9ad9f8c 100644
--- a/engines/icb/gfx/gfxstub.cpp
+++ b/engines/icb/gfx/gfxstub.cpp
@@ -62,8 +62,8 @@ int32 nearClip = 0;
 int32 minUsedZpos = 20000;
 int32 maxUsedZpos = 0;
 
-int32 otz_shift = 0; // 1cm accuracy
-int32 otz_offset = ((nearClip >> otz_shift) - minZOTpos);
+int32 g_otz_shift = 0; // 1cm accuracy
+int32 g_otz_offset;
 
 // The zones for otz_shift computation
 #define OTZ_ZONE1 32000  // 1cm
@@ -89,8 +89,8 @@ void InitDrawing(void) {
 	minUsedZpos = 20000;
 	maxUsedZpos = 0;
 
-	otz_shift = 0; // 1cm accuracy
-	otz_offset = ((nearClip >> otz_shift) - minZOTpos);
+	g_otz_shift = 0; // 1cm accuracy
+	g_otz_offset = ((nearClip >> g_otz_shift) - minZOTpos);
 }
 
 void drawOTList(void) {
@@ -111,17 +111,17 @@ void ResetZRange(void) {
 	int32 dz = maxUsedZpos - nearClip;
 	// Simple zones for otz_shift
 	if (dz < OTZ_ZONE1) // 1cm
-		otz_shift = 0;
+		g_otz_shift = 0;
 	else if (dz < OTZ_ZONE2) // 2cm
-		otz_shift = 1;
+		g_otz_shift = 1;
 	else if (dz < OTZ_ZONE4) // 4cm
-		otz_shift = 2;
+		g_otz_shift = 2;
 	else if (dz < OTZ_ZONE8) // 8cm
-		otz_shift = 3;
+		g_otz_shift = 3;
 	else
-		otz_shift = 4; // 16cm - yuck
+		g_otz_shift = 4; // 16cm - yuck
 
-	otz_offset = ((nearClip >> otz_shift) - minZOTpos);
+	g_otz_offset = ((nearClip >> g_otz_shift) - minZOTpos);
 
 	minUsedZpos = 20000;
 	maxUsedZpos = 0;
diff --git a/engines/icb/gfx/psx_scrn.h b/engines/icb/gfx/psx_scrn.h
index 55b66f5b4b..d242c0a5be 100644
--- a/engines/icb/gfx/psx_scrn.h
+++ b/engines/icb/gfx/psx_scrn.h
@@ -101,8 +101,8 @@ extern int32 packetsUsed;
 
 // How much to shift & then offset the z values from gte to
 // put them into the otlist
-extern int32 otz_shift;
-extern int32 otz_offset;
+extern int32 g_otz_shift;
+extern int32 g_otz_offset;
 
 // Enable/disable updating of the auto-sliding & scaling min,max z position
 extern int32 update_minmaxzpos;
@@ -205,7 +205,7 @@ static inline void myAddDRLOADNoFlush(RECT16 *r, uint32 *pot, int32 length) {
 
 // Little to convert a z-value into an OT position
 static inline int32 myMakeOTPosition(int32 z0) {
-	int32 z1 = (z0 >> otz_shift) - otz_offset;
+	int32 z1 = (z0 >> g_otz_shift) - g_otz_offset;
 
 	minUsedZpos = MIN(z0, minUsedZpos);
 	maxUsedZpos = MAX(z0, maxUsedZpos);
diff --git a/engines/icb/global_vars.cpp b/engines/icb/global_vars.cpp
index 42017994f7..7a91cc4fa0 100644
--- a/engines/icb/global_vars.cpp
+++ b/engines/icb/global_vars.cpp
@@ -45,6 +45,7 @@
 #include "engines/icb/gfx/psx_camera.h"
 #include "engines/icb/gfx/psx_pxactor.h"
 #include "engines/icb/gfx/rlp_api.h"
+#include "engines/icb/gfx/psx_scrn.h"
 #include "engines/icb/common/px_capri_maths_pc.h"
 #include "engines/icb/common/px_capri_maths.h"
 #include "engines/icb/common/ptr_util.h"
@@ -131,6 +132,8 @@ void Init_globals() {
 	// So sort the globals so they can be searched quicker !
 	g_globalScriptVariables->SortVariables();
 
+	g_otz_offset = -5;
+
 	Tdebug("globals.txt", "Found %d global variables", nVars);
 }
 




More information about the Scummvm-git-logs mailing list