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

Strangerke noreply at scummvm.org
Sat Jan 18 07:24:46 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:
9a681b3ada GOT: Rename Setup members


Commit: 9a681b3ada2f0fad1dbb32e5c27cb0430b5c2755
    https://github.com/scummvm/scummvm/commit/9a681b3ada2f0fad1dbb32e5c27cb0430b5c2755
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-18T08:24:26+01:00

Commit Message:
GOT: Rename Setup members

Changed paths:
    engines/got/data/setup.cpp
    engines/got/data/setup.h
    engines/got/game/back.cpp
    engines/got/game/boss1.cpp
    engines/got/game/boss2.cpp
    engines/got/game/boss3.cpp
    engines/got/game/init.cpp
    engines/got/game/move.cpp
    engines/got/game/move_patterns.cpp
    engines/got/game/shot_pattern.cpp
    engines/got/got.cpp
    engines/got/vars.cpp
    engines/got/vars.h
    engines/got/views/dialogs/options_menu.cpp
    engines/got/views/dialogs/select_scroll.cpp


diff --git a/engines/got/data/setup.cpp b/engines/got/data/setup.cpp
index af199ef959d..8eeba2682f8 100644
--- a/engines/got/data/setup.cpp
+++ b/engines/got/data/setup.cpp
@@ -45,23 +45,23 @@ void SetupFlags::sync(Common::Serializer &s) {
 	}
 }
 
-void SETUP::sync(Common::Serializer &s) {
+void Setup::sync(Common::Serializer &s) {
 	// Sync the flags bit-fields
 	SetupFlags::sync(s);
 
-	s.syncBytes(value, 16);
-	s.syncAsByte(junk);
-	s.syncAsByte(game);
-	s.syncAsByte(area);
-	s.syncAsByte(pc_sound);
-	s.syncAsByte(dig_sound);
-	s.syncAsByte(music);
-	s.syncAsByte(speed);
-	s.syncAsByte(scroll_flag);
-	s.syncBytes(boss_dead, 3);
-	s.syncAsByte(skill);
-	s.syncAsByte(game_over);
-	s.syncBytes(future, 19);
+	s.syncBytes(_value, 16);
+	s.syncAsByte(_filler1);
+	s.syncAsByte(_game);
+	s.syncAsByte(_areaNum);
+	s.syncAsByte(_speakerSound);
+	s.syncAsByte(_digitalSound);
+	s.syncAsByte(_musicEnabled);
+	s.syncAsByte(_slowMode);
+	s.syncAsByte(_scrollFlag);
+	s.syncBytes(_bossDead, 3);
+	s.syncAsByte(_difficultyLevel);
+	s.syncAsByte(_gameOver);
+	s.syncBytes(_filler2, 19);
 }
 
 } // namespace Got
diff --git a/engines/got/data/setup.h b/engines/got/data/setup.h
index 5eb41fa3e05..3c545db9e6f 100644
--- a/engines/got/data/setup.h
+++ b/engines/got/data/setup.h
@@ -99,21 +99,21 @@ struct SetupFlags {
 	SetupFlags &operator=(const Got::SetupFlags &src);
 };
 
-struct SETUP : public SetupFlags {
-	byte value[16] = {};
-	byte junk = 0;
-	byte game = 0;
-	byte area = 0;        //1,2,3
-	byte pc_sound = 0;    //1=enabled
-	byte dig_sound = 0;   //1 & !pc_sound = enabled
-	byte music = 0;       //1=enabled
-	byte speed = 0;       //1=slow mode (for slower 286's)
-	byte scroll_flag = 0; //unused
-	byte boss_dead[3] = {};
-	byte skill = 0;       //0=easy, 1=normal, 2=hard
-	byte game_over = 0;
-	byte future[19] = {}; //probably not needed
-
+struct Setup : public SetupFlags {
+	byte _value[16] = {};
+	byte _filler1 = 0;
+	byte _game = 0;
+	byte _areaNum = 0;        //1,2,3
+	byte _speakerSound = 0;    //1=enabled
+	byte _digitalSound = 0;   //1 & !_speakerSound = enabled
+	byte _musicEnabled = 0;       //1=enabled
+	byte _slowMode = 0;       //1=slow mode (for slower 286's)
+	byte _scrollFlag = 0; //unused
+	byte _bossDead[3] = {};
+	byte _difficultyLevel = 0;       //0=easy, 1=normal, 2=hard
+	byte _gameOver = 0;
+	byte _filler2[19] = {};
+	
 	void sync(Common::Serializer &s) override;
 };
 
diff --git a/engines/got/game/back.cpp b/engines/got/game/back.cpp
index 89b8b6974d5..c584eafa5aa 100644
--- a/engines/got/game/back.cpp
+++ b/engines/got/game/back.cpp
@@ -90,7 +90,7 @@ void show_level(int new_level) {
 			_G(current_level) = new_level - 1;
 	}
 
-	if (!_G(setup).scroll_flag)
+	if (!_G(setup)._scrollFlag)
 		_G(current_level) = new_level; // Force no scroll
 
 	if (_G(music_current) != _G(levelMusic))
@@ -144,14 +144,14 @@ void show_level_done() {
 
 	bool f = true;
 	if (GAME1 && _G(new_level) == BOSS_LEVEL1) {
-		if (!_G(setup).boss_dead[0]) {
+		if (!_G(setup)._bossDead[0]) {
 			if (!_G(auto_load))
 				boss_level1();
 			f = false;
 		}
 	}
 	if (GAME2 && _G(new_level) == BOSS_LEVEL2) {
-		if (!_G(setup).boss_dead[1]) {
+		if (!_G(setup)._bossDead[1]) {
 			if (!_G(auto_load))
 				boss_level2();
 			f = false;
@@ -159,7 +159,7 @@ void show_level_done() {
 	}
 	if (GAME3) {
 		if (_G(new_level) == BOSS_LEVEL3) {
-			if (!_G(setup).boss_dead[2]) {
+			if (!_G(setup)._bossDead[2]) {
 				if (!_G(auto_load))
 					boss_level3();
 				f = false;
diff --git a/engines/got/game/boss1.cpp b/engines/got/game/boss1.cpp
index 82cb335ab66..f9c5fed33b9 100644
--- a/engines/got/game/boss1.cpp
+++ b/engines/got/game/boss1.cpp
@@ -85,7 +85,7 @@ int boss1_movement(Actor *actr) {
 		}
 
 		actr->_nextFrame = 3;
-		actr->_numMoves = _G(setup).skill + 2;
+		actr->_numMoves = _G(setup)._difficultyLevel + 2;
 		goto done1;
 	}
 
@@ -97,7 +97,7 @@ int boss1_movement(Actor *actr) {
 						_G(thor)->_x, _G(thor)->_y + 8, _G(thor)->_x + 15, _G(thor)->_y + 15)) {
 				goto done1;
 			}
-			actr->_numMoves = _G(setup).skill + 1;
+			actr->_numMoves = _G(setup)._difficultyLevel + 1;
 			goto done0;
 		}
 
@@ -282,7 +282,7 @@ void closing_sequence1_4() {
 		_G(scrn)._actorType[rep] = 0;
 
 	_G(boss_dead) = false;
-	_G(setup).boss_dead[0] = 1;
+	_G(setup)._bossDead[0] = 1;
 	_G(boss_active) = false;
 	_G(scrn)._music = 4;
 	show_level(BOSS_LEVEL1);
diff --git a/engines/got/game/boss2.cpp b/engines/got/game/boss2.cpp
index 7acd353261f..90de3b494fa 100644
--- a/engines/got/game/boss2.cpp
+++ b/engines/got/game/boss2.cpp
@@ -52,7 +52,7 @@ static int boss2_die();
 static void boss_set(int d, int x, int y);
 
 int boss2_movement(Actor *actr) {
-	switch (_G(setup).skill) {
+	switch (_G(setup)._difficultyLevel) {
 	case 0:
 		num_skulls = 3;
 		num_spikes = 5;
@@ -405,7 +405,7 @@ void closing_sequence2_4() {
 		_G(scrn)._actorType[rep] = 0;
 
 	_G(boss_dead) = false;
-	_G(setup).boss_dead[1] = 1;
+	_G(setup)._bossDead[1] = 1;
 	_G(game_over) = true;
 	_G(boss_active) = false;
 	_G(scrn)._music = 6;
diff --git a/engines/got/game/boss3.cpp b/engines/got/game/boss3.cpp
index 8ab737c0b44..9ed3658711f 100644
--- a/engines/got/game/boss3.cpp
+++ b/engines/got/game/boss3.cpp
@@ -77,7 +77,7 @@ static int boss_movement_one(Actor *actr) {
 	actr->_numMoves = 2;
 	pod_speed = 2;
 
-	switch (_G(setup).skill) {
+	switch (_G(setup)._difficultyLevel) {
 	case 0:
 		numPods = 3;
 		break;
@@ -226,7 +226,7 @@ int boss3_movement(Actor *actr) {
 	if (!boss_mode)
 		return boss_movement_one(actr);
 	num_pods1 = 10;
-	switch (_G(setup).skill) {
+	switch (_G(setup)._difficultyLevel) {
 	case 0:
 		actr->_numMoves = 3;
 		actr->_speed = 2;
@@ -534,7 +534,7 @@ void closing_sequence3_3() {
 		_G(scrn)._actorType[rep] = 0;
 
 	_G(boss_dead) = false;
-	_G(setup).boss_dead[2] = 1;
+	_G(setup)._bossDead[2] = 1;
 	_G(game_over) = true;
 	_G(boss_active) = false;
 	_G(scrn)._music = 6;
diff --git a/engines/got/game/init.cpp b/engines/got/game/init.cpp
index a122e1c9b71..c1231216e75 100644
--- a/engines/got/game/init.cpp
+++ b/engines/got/game/init.cpp
@@ -83,7 +83,7 @@ void initialize_game() {
 		_G(thor_info).magic = 100;
 		_G(thor_info).jewels = 463;
 		_G(thor_info).score = 12455;
-		_G(setup).skill = 0;
+		_G(setup)._difficultyLevel = 0;
 		_G(thor_info).inventory = 1 + 2;
 		_G(current_level) = 54;
 		_G(thor_info).item = 2;
diff --git a/engines/got/game/move.cpp b/engines/got/game/move.cpp
index ec70c364861..e1a2185c03a 100644
--- a/engines/got/game/move.cpp
+++ b/engines/got/game/move.cpp
@@ -107,9 +107,9 @@ int kill_good_guy(void) {
 }
 
 void actor_damaged(Actor *actr, int damage) {
-	if (!_G(setup).skill)
+	if (!_G(setup)._difficultyLevel)
 		damage *= 2;
-	else if (_G(setup).skill == 2)
+	else if (_G(setup)._difficultyLevel == 2)
 		damage /= 2;
 
 	if (!actr->_vulnerableCountdown && actr->_type != 3 && (actr->_solid & 0x7f) != 2) {
@@ -163,9 +163,9 @@ void thor_damaged(Actor *actr) {
 
 	int damage = actr->_hitStrength;
 	if (damage != 255) {
-		if (!_G(setup).skill)
+		if (!_G(setup)._difficultyLevel)
 			damage /= 2;
-		else if (_G(setup).skill == 2)
+		else if (_G(setup)._difficultyLevel == 2)
 			damage *= 2;
 	}
 	if ((!_G(thor)->_vulnerableCountdown && !_G(shield_on)) || damage == 255) {
diff --git a/engines/got/game/move_patterns.cpp b/engines/got/game/move_patterns.cpp
index 4c057cdc68f..7af05300842 100644
--- a/engines/got/game/move_patterns.cpp
+++ b/engines/got/game/move_patterns.cpp
@@ -2421,13 +2421,13 @@ done:
 
 // Troll 1
 int movement_thirtynine(Actor *actr) {
-	if (_G(setup).skill == 0) {
+	if (_G(setup)._difficultyLevel == 0) {
 		actr->_speed = 3;
 		actr->_numMoves = 1;
-	} else if (_G(setup).skill == 1) {
+	} else if (_G(setup)._difficultyLevel == 1) {
 		actr->_speed = 2;
 		actr->_numMoves = 1;
-	} else if (_G(setup).skill == 2) {
+	} else if (_G(setup)._difficultyLevel == 2) {
 		actr->_speed = 1;
 		actr->_numMoves = 1;
 	}
diff --git a/engines/got/game/shot_pattern.cpp b/engines/got/game/shot_pattern.cpp
index b3c488c1bc8..dd24a0ee9d2 100644
--- a/engines/got/game/shot_pattern.cpp
+++ b/engines/got/game/shot_pattern.cpp
@@ -153,7 +153,7 @@ int shot_pattern_four(Actor *actr) {
 int shot_pattern_five(Actor *actr) {
 	if (_G(rand1) < 15 && (actr->_temp1 == 0) && (actr->_temp2 == 0)) {
 		actr->_y += 16;
-		actr->_numShotsAllowed = 3 + _G(setup).skill;
+		actr->_numShotsAllowed = 3 + _G(setup)._difficultyLevel;
 		actor_shoots(actr, 2);
 		play_sound(BOSS12, false);
 
diff --git a/engines/got/got.cpp b/engines/got/got.cpp
index a4a7d68eca1..3ce14014554 100644
--- a/engines/got/got.cpp
+++ b/engines/got/got.cpp
@@ -120,7 +120,7 @@ Common::Error GotEngine::syncGame(Common::Serializer &s) {
 		if (!firstView() || firstView()->getName() != "Game")
 			initialize_game();
 
-		int area = _G(setup).area;
+		int area = _G(setup)._areaNum;
 		if (area == 0)
 			area = 1;
 
@@ -157,23 +157,23 @@ void GotEngine::savegameLoaded() {
 	g_vars->resetEndgameFlags();
 
 	if (!_G(music_flag))
-		_G(setup).music = 0;
+		_G(setup)._musicEnabled = 0;
 	if (!_G(sound_flag))
-		_G(setup).dig_sound = 0;
-	if (_G(setup).music == 1) {
+		_G(setup)._digitalSound = 0;
+	if (_G(setup)._musicEnabled == 1) {
 		if (GAME1 && _G(current_area) == 59) {
 			music_play(5, true);
 		} else {
 			music_play(_G(levelMusic), true);
 		}
 	} else {
-		_G(setup).music = 1;
+		_G(setup)._musicEnabled = 1;
 		music_pause();
-		_G(setup).music = 0;
+		_G(setup)._musicEnabled = 0;
 	}
 
-	_G(game_over) = _G(setup).game_over != 0;
-	_G(slow_mode) = _G(setup).speed != 0;
+	_G(game_over) = _G(setup)._gameOver != 0;
+	_G(slow_mode) = _G(setup)._slowMode != 0;
 
 	g_events->replaceView("Game", true);
 	setup_load();
diff --git a/engines/got/vars.cpp b/engines/got/vars.cpp
index 8e6a2b6b802..3ada6b1fcaa 100644
--- a/engines/got/vars.cpp
+++ b/engines/got/vars.cpp
@@ -60,14 +60,14 @@ void Vars::load() {
 	if (_current_level != 23)
 		_story_flag = false;
 
-	_setup.music = _music_flag;
-	_setup.dig_sound = _sound_flag;
-	_setup.pc_sound = _pcsound_flag;
+	_setup._musicEnabled = _music_flag;
+	_setup._digitalSound = _sound_flag;
+	_setup._speakerSound = _pcsound_flag;
 	if (_sound_flag)
-		_setup.pc_sound = false;
-	_setup.scroll_flag = true;
-	_setup.speed = _slow_mode ? 1 : 0;
-	_setup.skill = 1;
+		_setup._speakerSound = false;
+	_setup._scrollFlag = true;
+	_setup._slowMode = _slow_mode ? 1 : 0;
+	_setup._difficultyLevel = 1;
 
 	_tmp_buff = new byte[TMP_SIZE];
 
@@ -85,7 +85,7 @@ Vars::~Vars() {
 void Vars::setArea(int areaNum) {
 	if (areaNum != _area) {
 		_area = areaNum;
-		_setup.area = areaNum;
+		_setup._areaNum = areaNum;
 		_sd_data.setArea(areaNum);
 		_bgPics.setArea(areaNum);
 
diff --git a/engines/got/vars.h b/engines/got/vars.h
index 7cd45aad994..0fc2bafd6cd 100644
--- a/engines/got/vars.h
+++ b/engines/got/vars.h
@@ -144,8 +144,8 @@ public:
 
 	Level _scrn;
 
-	SETUP _setup;
-	SETUP _last_setup;
+	Setup _setup;
+	Setup _last_setup;
 	byte *_tmp_buff = nullptr;
 
 	Actor _actor[MAX_ACTORS] = {};  //current actors
diff --git a/engines/got/views/dialogs/options_menu.cpp b/engines/got/views/dialogs/options_menu.cpp
index 7432da37735..fe8970d63c4 100644
--- a/engines/got/views/dialogs/options_menu.cpp
+++ b/engines/got/views/dialogs/options_menu.cpp
@@ -38,7 +38,7 @@ void OptionsMenu::selected() {
 		addView("SetSound");
 		break;
 	case 1:
-		// skill level
+		// skill level (difficulty level)
 		break;
 	case 2:
 		g_engine->saveGameDialog();
diff --git a/engines/got/views/dialogs/select_scroll.cpp b/engines/got/views/dialogs/select_scroll.cpp
index 69aadf3f860..cb6d9464503 100644
--- a/engines/got/views/dialogs/select_scroll.cpp
+++ b/engines/got/views/dialogs/select_scroll.cpp
@@ -30,12 +30,12 @@ SelectScroll::SelectScroll() : SelectOption("SelectScroll", "Scroll Between Scre
 }
 
 bool SelectScroll::msgFocus(const FocusMessage &msg) {
-	_selectedItem = 1 - _G(setup).scroll_flag;
+	_selectedItem = 1 - _G(setup)._scrollFlag;
 	return true;
 }
 
 void SelectScroll::selected() {
-	_G(setup).scroll_flag = (_selectedItem == 0) ? 1 : 0;
+	_G(setup)._scrollFlag = (_selectedItem == 0) ? 1 : 0;
 	_G(last_setup) = _G(setup);
 }
 




More information about the Scummvm-git-logs mailing list