[Scummvm-git-logs] scummvm master -> 2b9156ed4570eceecf89a3edb9f4c9b3498ce835

Strangerke noreply at scummvm.org
Fri Jan 17 21:41:09 UTC 2025


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:
2b9156ed45 GOT: Turn two members to boolean in Actor, remove an unused one


Commit: 2b9156ed4570eceecf89a3edb9f4c9b3498ce835
    https://github.com/scummvm/scummvm/commit/2b9156ed4570eceecf89a3edb9f4c9b3498ce835
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-17T22:40:36+01:00

Commit Message:
GOT: Turn two members to boolean in Actor, remove an unused one

Changed paths:
    engines/got/data/actor.cpp
    engines/got/data/actor.h
    engines/got/game/back.cpp
    engines/got/game/boss1.cpp
    engines/got/game/boss2.cpp
    engines/got/game/boss3.cpp
    engines/got/game/main.cpp
    engines/got/game/move.cpp
    engines/got/game/move_patterns.cpp
    engines/got/game/object.cpp
    engines/got/gfx/image.cpp
    engines/got/got.cpp
    engines/got/views/game_content.cpp


diff --git a/engines/got/data/actor.cpp b/engines/got/data/actor.cpp
index 0fddab2a1f1..a85de909c80 100644
--- a/engines/got/data/actor.cpp
+++ b/engines/got/data/actor.cpp
@@ -142,7 +142,6 @@ Actor &Actor::operator=(const Actor &src) {
 	_i6 = src._i6;
 	_initHealth = src._initHealth;
 	_talkCounter = src._talkCounter;
-	_eType = src._eType;
 
 	return *this;
 }
diff --git a/engines/got/data/actor.h b/engines/got/data/actor.h
index a6ad2832e69..977a1551c55 100644
--- a/engines/got/data/actor.h
+++ b/engines/got/data/actor.h
@@ -69,7 +69,7 @@ struct Actor {
 	int _center = 0;                // Center of object
 	int _lastX[2] = {};             // Last X coordinate on each page
 	int _lastY[2] = {};             // Last Y coordinate on each page
-	byte _active = 0; //boolean     // 1=active, 0=not active
+	bool _active = false;           // true=active, false=not active
 	byte _nextFrame = 0;            // Next frame to be shown
 	byte _moveCountdown = 0;        // Count down to movement
 	byte _vulnerableCountdown = 0;  // Count down to vulnerability
@@ -92,7 +92,7 @@ struct Actor {
 	byte _temp3 = 0;
 	byte _temp4 = 0;
 	byte _temp5 = 0;
-	byte _hitThor = 0; // boolean
+	bool _hitThor = false;
 	int _rand = 0;
 	byte _initDir = 0;
 	byte _passValue = 0;
@@ -102,7 +102,6 @@ struct Actor {
 	int _i1 = 0, _i2 = 0, _i3 = 0, _i4 = 0, _i5 = 0, _i6 = 0;
 	byte _initHealth = 0;
 	byte _talkCounter = 0;
-	byte _eType = 0; // unused
 
 	void loadFixed(Common::SeekableReadStream *src);
 	void loadFixed(const byte *src);
diff --git a/engines/got/game/back.cpp b/engines/got/game/back.cpp
index 43ff91a8513..d0e0f286d2d 100644
--- a/engines/got/game/back.cpp
+++ b/engines/got/game/back.cpp
@@ -48,7 +48,7 @@ static const char *odinEndMessage;
 void show_level(int new_level) {
 	_G(boss_active) = false;
 	if (!_G(shield_on))
-		_G(actor[2])._active = 0;
+		_G(actor[2])._active = false;
 	_G(bomb_flag) = false;
 	_G(slipping) = false;
 
diff --git a/engines/got/game/boss1.cpp b/engines/got/game/boss1.cpp
index 4f8f2635e5e..01a5b6aa45b 100644
--- a/engines/got/game/boss1.cpp
+++ b/engines/got/game/boss1.cpp
@@ -237,7 +237,7 @@ static int boss1_dead() {
 			_G(actor[3 + rep])._lastX[_G(pge) ^ 1] = x;
 			_G(actor[3 + rep])._lastY[_G(pge)] = y1;
 			_G(actor[3 + rep])._lastY[_G(pge) ^ 1] = y;
-			_G(actor[3 + rep])._active = 1;
+			_G(actor[3 + rep])._active = true;
 			_G(actor[3 + rep])._vulnerableCountdown = 255;
 			_G(actor[3 + rep])._moveType = 6;
 			_G(actor[3 + rep])._nextFrame = rep;
diff --git a/engines/got/game/boss2.cpp b/engines/got/game/boss2.cpp
index 2c105a95952..2303e64ac4f 100644
--- a/engines/got/game/boss2.cpp
+++ b/engines/got/game/boss2.cpp
@@ -40,7 +40,7 @@ static const byte EXPLOSION[] = {
 	161, 162, 165, 166, 169, 170, 173, 174, 177, 178
 };
 
-static byte expf[60];
+static bool expf[60];
 static byte num_skulls; // Hehe
 static byte num_spikes;
 static bool drop_flag;
@@ -240,7 +240,7 @@ static int boss2_die() {
 			_G(actor[3 + rep])._lastX[_G(pge) ^ 1] = x;
 			_G(actor[3 + rep])._lastY[_G(pge)] = y1;
 			_G(actor[3 + rep])._lastY[_G(pge) ^ 1] = y;
-			_G(actor[3 + rep])._active = 1;
+			_G(actor[3 + rep])._active = true;
 			_G(actor[3 + rep])._vulnerableCountdown = 255;
 			_G(actor[3 + rep])._moveType = 6;
 			_G(actor[3 + rep])._nextFrame = rep;
@@ -278,7 +278,7 @@ static int boss2a_movement(Actor *actr) {
 		if (r > 59)
 			r = 0;
 	}
-	expf[r] = 1;
+	expf[r] = true;
 	int x = (EXPLOSION[r] % 20) * 16;
 	int y = (EXPLOSION[r] / 20) * 16;
 	_G(actor[an])._x = x;
diff --git a/engines/got/game/boss3.cpp b/engines/got/game/boss3.cpp
index 38678a707ce..296f64cd035 100644
--- a/engines/got/game/boss3.cpp
+++ b/engines/got/game/boss3.cpp
@@ -501,7 +501,7 @@ static int boss_die() {
 			_G(actor[3 + rep])._lastX[_G(pge) ^ 1] = x;
 			_G(actor[3 + rep])._lastY[_G(pge)] = y1;
 			_G(actor[3 + rep])._lastY[_G(pge) ^ 1] = y;
-			_G(actor[3 + rep])._active = 1;
+			_G(actor[3 + rep])._active = true;
 			_G(actor[3 + rep])._vulnerableCountdown = 255;
 			_G(actor[3 + rep])._moveType = 6;
 			_G(actor[3 + rep])._nextFrame = rep;
@@ -563,7 +563,7 @@ void ending_screen() {
 	expcnt = 0;
 
 	_G(actor[34]) = _G(explosion);
-	_G(actor[34])._active = 0;
+	_G(actor[34])._active = false;
 	_G(actor[34])._speed = 2;
 	_G(actor[34])._moveCountdown = _G(actor[34])._speed;
 	_G(actor[34])._currNumShots = 3; // Used to reverse explosion
@@ -587,12 +587,12 @@ int endgame_one() {
 		if (r > 31)
 			r = 0;
 	}
-	expf[r / 8][r % 8] = 1;
+	expf[r / 8][r % 8] = true;
 	int x = (EXPLOSION[r / 8][r % 8] % 20) * 16;
 	int y = (EXPLOSION[r / 8][r % 8] / 20) * 16;
 	_G(actor[34])._x = x;
 	_G(actor[34])._y = y;
-	_G(actor[34])._active = 1;
+	_G(actor[34])._active = true;
 	_G(actor[34])._nextFrame = 0;
 	_G(actor[34])._currNumShots = 3;
 
@@ -600,7 +600,7 @@ int endgame_one() {
 
 	_G(endgame++);
 	if (_G(endgame) > 32) {
-		_G(actor[34])._active = 0;
+		_G(actor[34])._active = false;
 		_G(endgame) = 0;
 	}
 	return 1;
@@ -627,12 +627,12 @@ int endgame_movement() {
 		if (r > 7)
 			r = 0;
 	}
-	expf[_G(exprow)][r] = 1;
+	expf[_G(exprow)][r] = true;
 	int x = (EXPLOSION[_G(exprow)][r] % 20) * 16;
 	int y = (EXPLOSION[_G(exprow)][r] / 20) * 16;
 	_G(actor[34])._x = x;
 	_G(actor[34])._y = y;
-	_G(actor[34])._active = 1;
+	_G(actor[34])._active = true;
 	_G(actor[34])._nextFrame = 0;
 	_G(actor[34])._currNumShots = 3;
 
diff --git a/engines/got/game/main.cpp b/engines/got/game/main.cpp
index 1a2d46ad73a..617f313629b 100644
--- a/engines/got/game/main.cpp
+++ b/engines/got/game/main.cpp
@@ -26,7 +26,7 @@
 namespace Got {
 
 void setup_load() {
-	_G(thor)->_active = 1;
+	_G(thor)->_active = true;
 	_G(new_level) = _G(thor_info).last_screen;
 	_G(thor)->_x = (_G(thor_info).last_icon % 20) * 16;
 	_G(thor)->_y = ((_G(thor_info).last_icon / 20) * 16) - 1;
@@ -59,8 +59,8 @@ void setup_load() {
 	_G(lightning_used) = false;
 	_G(tornado_used) = false;
 	_G(shield_on) = false;
-	_G(actor[1])._active = 0;
-	_G(actor[2])._active = 0;
+	_G(actor[1])._active = false;
+	_G(actor[2])._active = false;
 	_G(thor)->_moveCountdown = 6;
 
 	_G(scrn).load(_G(new_level));
diff --git a/engines/got/game/move.cpp b/engines/got/game/move.cpp
index 4700bc2ec63..ce1923a897f 100644
--- a/engines/got/game/move.cpp
+++ b/engines/got/game/move.cpp
@@ -79,10 +79,10 @@ int reverse_direction(Actor *actr) {
 }
 
 void thor_shoots() {
-	if ((_G(hammer)->_active != 1) && (!_G(hammer)->_dead) && (!_G(thor)->_shotCountdown)) {
+	if (!_G(hammer)->_active && (!_G(hammer)->_dead) && (!_G(thor)->_shotCountdown)) {
 		play_sound(SWISH, false);
 		_G(thor)->_shotCountdown = 20;
-		_G(hammer)->_active = 1;
+		_G(hammer)->_active = true;
 		_G(hammer)->_dir = _G(thor)->_dir;
 		_G(hammer)->_lastDir = _G(thor)->_dir;
 		_G(hammer)->_x = _G(thor)->_x;
@@ -141,7 +141,7 @@ void actor_damaged(Actor *actr, int damage) {
 }
 
 void thor_damaged(Actor *actr) {
-	actr->_hitThor = 1;
+	actr->_hitThor = true;
 
 	// If we're invincible, ignore any damage
 	if (_G(cheats).freezeHealth)
@@ -211,12 +211,12 @@ void actor_destroyed(Actor *actr) {
 		actr->_lastY[pge] = y1;
 		actr->_lastY[pge ^ 1] = y;
 		actr->_moveCountdown = actr->_speed;
-		actr->_active = 1;
+		actr->_active = true;
 		actr->_currNumShots = 3; // used to reverse explosion
 		actr->_vulnerableCountdown = 255;
 	} else {
 		actr->_dead = 2;
-		actr->_active = 0;
+		actr->_active = false;
 	}
 }
 
@@ -263,7 +263,7 @@ int _actor_shoots(Actor *actr, int dir) {
 			act->_lastX[1] = actr->_x;
 			act->_lastY[0] = cy;
 			act->_lastY[1] = cy;
-			act->_active = 1;
+			act->_active = true;
 			act->_creator = actr->_actorNum;
 			act->_moveCount = act->_numMoves;
 			act->_dead = 0;
diff --git a/engines/got/game/move_patterns.cpp b/engines/got/game/move_patterns.cpp
index 6598e8c400f..b5a076ec862 100644
--- a/engines/got/game/move_patterns.cpp
+++ b/engines/got/game/move_patterns.cpp
@@ -1128,7 +1128,7 @@ int movement_two(Actor *actr) {
 			_G(hammer)->_dir = d;
 		}
 		if (actr->_actorNum == 2) {
-			actr->_active = 0;
+			actr->_active = false;
 			actr->_dead = 2;
 			_G(lightning_used) = false;
 			_G(tornado_used) = false;
@@ -1366,7 +1366,7 @@ int movement_six(Actor *actr) {
 		actr->_currNumShots--;
 	} else {
 		actr->_dead = 2;
-		actr->_active = 0;
+		actr->_active = false;
 		if (!_G(boss_dead) && !_G(endgame)) {
 			if (actr->_type == 2)
 				drop_object(actr);
@@ -1726,7 +1726,7 @@ int movement_eighteen(Actor *actr) {
 			if (actr->_hitThor) {
 				actr->_temp5 = 50;
 				actr->_numMoves = 2;
-				actr->_hitThor = 0;
+				actr->_hitThor = false;
 				actr->_dir = d;
 				d = reverse_direction(actr);
 			}
@@ -1744,7 +1744,7 @@ int movement_eighteen(Actor *actr) {
 		if (actr->_hitThor) {
 			actr->_temp5 = 50;
 			actr->_numMoves = 2;
-			actr->_hitThor = 0;
+			actr->_hitThor = false;
 			actr->_dir = d;
 			d = reverse_direction(actr);
 		}
diff --git a/engines/got/game/object.cpp b/engines/got/game/object.cpp
index cc9fd5b48cc..504170bd424 100644
--- a/engines/got/game/object.cpp
+++ b/engines/got/game/object.cpp
@@ -125,7 +125,7 @@ void pick_up_object(int p) {
 			return;
 		_G(thor)->_numMoves = 1;
 		_G(hammer)->_numMoves = 2;
-		_G(actor[2])._active = 0;
+		_G(actor[2])._active = false;
 		_G(shield_on) = false;
 		_G(tornado_used) = false;
 		_G(thor_info).inventory |= 64;
@@ -147,7 +147,7 @@ void pick_up_object(int p) {
 		_G(tornado_used) = false;
 		_G(hammer)->_numMoves = 2;
 		_G(thor)->_numMoves = 1;
-		_G(actor[2])._active = 0;
+		_G(actor[2])._active = false;
 		s = 1 << (_G(object_map[p]) - 27);
 		_G(thor_info).inventory |= s;
 		odin_speaks((_G(object_map[p]) - 27) + 516, _G(object_map[p]) - 1);
@@ -310,7 +310,7 @@ int use_shield(int flag) {
 
 	if (_G(shield_on)) {
 		_G(actor[2])._dead = 2;
-		_G(actor[2])._active = 0;
+		_G(actor[2])._active = false;
 		_G(shield_on) = false;
 	}
 
diff --git a/engines/got/gfx/image.cpp b/engines/got/gfx/image.cpp
index f01047f4d60..96081d1089e 100644
--- a/engines/got/gfx/image.cpp
+++ b/engines/got/gfx/image.cpp
@@ -54,28 +54,28 @@ void setup_actor(Actor *actr, char num, char dir, int x, int y) {
 		actr->_nextFrame = dir;
 	}
 
-	actr->_x = x;         // Actual X coor
-	actr->_y = y;         // Actual Y coor
-	actr->_width = 16;    // Actual X coor
-	actr->_height = 16;   // Actual Y coor
-	actr->_center = 0;    // Center of object
-	actr->_lastX[0] = x; // Last X coor on each page
+	actr->_x = x;                         // Actual X coor
+	actr->_y = y;                         // Actual Y coor
+	actr->_width = 16;                    // Actual X coor
+	actr->_height = 16;                   // Actual Y coor
+	actr->_center = 0;                    // Center of object
+	actr->_lastX[0] = x;                  // Last X coor on each page
 	actr->_lastX[1] = x;
-	actr->_lastY[0] = y; // Last Y coor on each page
+	actr->_lastY[0] = y;                  // Last Y coor on each page
 	actr->_lastY[1] = y;
-	actr->_active = 1;            // 1=active, 0=not active
-	actr->_moveCountdown = 8;     // Count down to movement
+	actr->_active = true;                 // true=active, false=not active
+	actr->_moveCountdown = 8;             // Count down to movement
 	actr->_vulnerableCountdown = STAMINA; // Count down to vulnerability
-	actr->_shotCountdown = 20;       // Count down to another shot
-	actr->_currNumShots = 0;       // # of shots currently on screen
-	actr->_creator = 0;         // which actor # created this actor
-	actr->_unpauseCountdown = 0;           // Pause must be 0 to move
+	actr->_shotCountdown = 20;            // Count down to another shot
+	actr->_currNumShots = 0;              // # of shots currently on screen
+	actr->_creator = 0;                   // which actor # created this actor
+	actr->_unpauseCountdown = 0;          // Pause must be 0 to move
 	actr->_show = 0;
 	actr->_actorNum = num;
 	actr->_counter = 0;
 	actr->_moveCounter = 0;
 	actr->_edgeCounter = 20;
-	actr->_hitThor = 0;
+	actr->_hitThor = false;
 	actr->_rand = g_engine->getRandomNumber(99);
 	actr->_temp1 = 0;
 	actr->_initHealth = actr->_health;
@@ -108,7 +108,7 @@ int load_standard_actors() {
 	load_actor(0, 103 + _G(thor_info).armor); // Load hammer
 	_G(actor[1]).loadFixed(_G(tmp_buff) + 5120);
 	setup_actor(&_G(actor[1]), 1, 0, 100, 100);
-	_G(actor[1])._active = 0;
+	_G(actor[1])._active = false;
 	_G(hammer) = &_G(actor[1]);
 
 	make_actor_surface(&_G(actor[1]));
@@ -117,14 +117,14 @@ int load_standard_actors() {
 	load_actor(0, 106);
 	_G(sparkle).loadFixed(_G(tmp_buff) + 5120);
 	setup_actor(&_G(sparkle), 20, 0, 100, 100);
-	_G(sparkle)._active = 0;
+	_G(sparkle)._active = false;
 	make_actor_surface(&_G(sparkle));
 
 	// Load explosion
 	load_actor(0, 107);
 	_G(explosion).loadFixed(_G(tmp_buff) + 5120);
 	setup_actor(&_G(explosion), 21, 0, 100, 100);
-	_G(explosion)._active = 0;
+	_G(explosion)._active = false;
 	make_actor_surface(&_G(explosion));
 
 	// Load tornado
@@ -133,7 +133,7 @@ int load_standard_actors() {
 	Common::copy(_G(tmp_buff), _G(tmp_buff) + 1024, _G(magic_pic[0]));
 
 	setup_actor(&_G(magic_item[0]), 20, 0, 0, 0);
-	_G(magic_item[0])._active = 0;
+	_G(magic_item[0])._active = false;
 
 	// Load shield
 	load_actor(0, 109);
@@ -141,9 +141,9 @@ int load_standard_actors() {
 	Common::copy(_G(tmp_buff), _G(tmp_buff) + 1024, _G(magic_pic[1]));
 
 	setup_actor(&_G(magic_item[1]), 20, 0, 0, 0);
-	_G(magic_item[1])._active = 0;
+	_G(magic_item[1])._active = false;
 
-	_G(actor[2])._active = 0;
+	_G(actor[2])._active = false;
 
 	make_actor_surface(&_G(magic_item[0]));
 
@@ -152,7 +152,7 @@ int load_standard_actors() {
 
 void show_enemies() {
 	for (int i = 3; i < MAX_ACTORS; i++)
-		_G(actor[i])._active = 0;
+		_G(actor[i])._active = false;
 
 	for (int i = 0; i < MAX_ENEMIES; i++)
 		_G(enemy_type[i]) = 0;
@@ -177,7 +177,7 @@ void show_enemies() {
 				}
 
 				if (_G(scrn).actor_invis[i])
-					_G(actor[i + 3])._active = 0;
+					_G(actor[i + 3])._active = false;
 			}
 
 			_G(etype[i]) = r;
diff --git a/engines/got/got.cpp b/engines/got/got.cpp
index 2da43feaa02..16efa6bcfbc 100644
--- a/engines/got/got.cpp
+++ b/engines/got/got.cpp
@@ -226,7 +226,7 @@ void GotEngine::pauseEngineIntern(bool pause) {
 
 	if (_G(shield_on)) {
 		_G(actor[2])._dead = 2;
-		_G(actor[2])._active = 0;
+		_G(actor[2])._active = false;
 		_G(shield_on) = false;
 	}
 
diff --git a/engines/got/views/game_content.cpp b/engines/got/views/game_content.cpp
index 75e10f288c5..b0abedb9e38 100644
--- a/engines/got/views/game_content.cpp
+++ b/engines/got/views/game_content.cpp
@@ -155,7 +155,7 @@ bool GameContent::tick() {
 		if (_deathCtr < DEATH_THRESHOLD) {
 			spinThor();
 		} else if (_deathCtr < DEATH_THRESHOLD + 60) {
-			_G(thor)->_active = 0;
+			_G(thor)->_active = false;
 			++_deathCtr;
 		} else {
 			thorDead();
@@ -466,8 +466,8 @@ void GameContent::checkForAreaChange() {
 	} else if (_G(new_level) != _G(current_level)) {
 		// Area transition beginning
 		_G(thor)->_show = 0;
-		_G(thor)->_active = 0;
-		_G(hammer)->_active = 0;
+		_G(thor)->_active = false;
+		_G(hammer)->_active = false;
 		_G(tornado_used) = false;
 
 		// Draws the old area without Thor, and then save a copy of it.
@@ -476,7 +476,7 @@ void GameContent::checkForAreaChange() {
 		_surface.copyFrom(getSurface());
 
 		// Set up new level
-		_G(thor)->_active = 1;
+		_G(thor)->_active = true;
 		show_level(_G(new_level));
 	}
 }
@@ -488,7 +488,7 @@ void GameContent::thorDies() {
 	// Stop any actors on-screen from moving
 	for (int li = 0; li < MAX_ACTORS; li++)
 		_G(actor[li])._show = 0;
-	_G(actor[2])._active = 0;
+	_G(actor[2])._active = false;
 
 	// Set the state for showing death animation
 	_G(gameMode) = MODE_THOR_DIES;
@@ -552,10 +552,10 @@ void GameContent::thorDead() {
 	_G(tornado_used) = false;
 	_G(shield_on) = false;
 	music_resume();
-	_G(actor[1])._active = 0;
-	_G(actor[2])._active = 0;
+	_G(actor[1])._active = false;
+	_G(actor[2])._active = false;
 	_G(thor)->_moveCountdown = 6;
-	_G(thor)->_active = 1;
+	_G(thor)->_active = true;
 
 	// Load saved data for new level back into scrn
 	_G(scrn).load(_G(new_level));




More information about the Scummvm-git-logs mailing list