[Scummvm-git-logs] scummvm master -> 3dc4ee2860159842309a9a6004d8bbd6f4c30cae

Strangerke noreply at scummvm.org
Mon Jan 20 06:05:03 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:
3dc4ee2860 GOT: Renaming and small cleanups in object and script


Commit: 3dc4ee2860159842309a9a6004d8bbd6f4c30cae
    https://github.com/scummvm/scummvm/commit/3dc4ee2860159842309a9a6004d8bbd6f4c30cae
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-20T07:04:52+01:00

Commit Message:
GOT: Renaming and small cleanups in object and script

Changed paths:
    engines/got/game/back.cpp
    engines/got/game/boss3.cpp
    engines/got/game/move_patterns.cpp
    engines/got/game/object.cpp
    engines/got/game/object.h
    engines/got/game/script.cpp
    engines/got/game/script.h
    engines/got/game/shot_movement.cpp
    engines/got/game/special_tile.cpp
    engines/got/views/game_content.cpp


diff --git a/engines/got/game/back.cpp b/engines/got/game/back.cpp
index 96c8016354b..f0d7de30eed 100644
--- a/engines/got/game/back.cpp
+++ b/engines/got/game/back.cpp
@@ -66,7 +66,7 @@ void showLevel(const int newLevel) {
 
 	_G(thor)->_nextFrame = 0;
 
-	show_objects();
+	showObjects();
 	show_enemies();
 
 	// The original was probably shortly displaying Thor in direction 0 before switching back to its prior position.
@@ -195,7 +195,7 @@ static void odin_speaks_end() {
 void odinSpeaks(const int index, int item, const char *endMessage) {
 	odinEndMessage = endMessage;
 
-	execute_script((long)index, _G(odin), odin_speaks_end);
+	executeScript((long)index, _G(odin), odin_speaks_end);
 }
 
 int switchIcons() {
@@ -312,7 +312,7 @@ void actorSpeaks(const Actor *actor, int index, int item) {
 	if (actor->_type != 4)
 		return;
 
-	int v = atoi(actor->_name);
+	const int v = atoi(actor->_name);
 	if (v < 1 || v > 20)
 		return;
 
@@ -320,12 +320,12 @@ void actorSpeaks(const Actor *actor, int index, int item) {
 	lind = lind * 1000;
 	lind += (long)actor->_actorNum;
 
-	Common::String str = Common::String::format("FACE%d", v);
+	const Common::String str = Common::String::format("FACE%d", v);
 	if (Common::File::exists(Common::Path(str))) {
 		Gfx::Pics pics(str, 262);
-		execute_script(lind, pics);
+		executeScript(lind, pics);
 	} else {
-		execute_script(lind, _G(odin));
+		executeScript(lind, _G(odin));
 	}
 
 	if (!_G(thor)->_health) {
diff --git a/engines/got/game/boss3.cpp b/engines/got/game/boss3.cpp
index 0cca557e830..6914218c0af 100644
--- a/engines/got/game/boss3.cpp
+++ b/engines/got/game/boss3.cpp
@@ -465,7 +465,7 @@ static void boss3CheckHit() {
 static void bossChangeMode() {
 	if (!_G(boss_intro2)) {
 		Gfx::Pics loki("FACE18", 262);
-		execute_script(1003, loki);
+		executeScript(1003, loki);
 		_G(boss_intro2) = true;
 	}
 	
@@ -483,7 +483,7 @@ void boss3SetupLevel() {
 
 	if (!_G(boss_intro1)) {
 		Gfx::Pics loki("FACE18", 262);
-		execute_script(1002, loki);
+		executeScript(1002, loki);
 		_G(boss_intro1) = true;
 	}
 
diff --git a/engines/got/game/move_patterns.cpp b/engines/got/game/move_patterns.cpp
index 6d578c4b090..0d388c64c01 100644
--- a/engines/got/game/move_patterns.cpp
+++ b/engines/got/game/move_patterns.cpp
@@ -986,7 +986,7 @@ int specialMovementThree(Actor *actor) {
 	long lind = (long)_G(current_level);
 	lind *= 1000;
 	lind += (long)actor->_actorNum;
-	execute_script(lind, _G(odin));
+	executeScript(lind, _G(odin));
 
 	return 0;
 }
@@ -1393,7 +1393,7 @@ int movementSix(Actor *actor) {
 		actor->_active = false;
 		if (!_G(boss_dead) && !_G(endgame)) {
 			if (actor->_type == 2)
-				drop_object(actor);
+				dropRandomObject(actor);
 		}
 	}
 
diff --git a/engines/got/game/object.cpp b/engines/got/game/object.cpp
index f87c397b77e..b024fbed795 100644
--- a/engines/got/game/object.cpp
+++ b/engines/got/game/object.cpp
@@ -30,57 +30,55 @@
 
 namespace Got {
 
-void not_enough_magic();
-void cannot_carry_more();
+void notEnoughMagic();
+void cannotCarryMore();
 
-void show_objects() {
+void showObjects() {
 	Common::fill(_G(object_map), _G(object_map) + TILES_COUNT, 0);
 	Common::fill(_G(object_index), _G(object_index) + TILES_COUNT, 0);
 
 	for (int i = 0; i < OBJECTS_COUNT; i++) {
 		if (_G(scrn)._staticObject[i]) {
-			int p = _G(scrn)._staticX[i] + (_G(scrn)._staticY[i] * TILES_X);
+			const int p = _G(scrn)._staticX[i] + (_G(scrn)._staticY[i] * TILES_X);
 			_G(object_index[p]) = i;
 			_G(object_map[p]) = _G(scrn)._staticObject[i];
 		}
 	}
 }
 
-void pick_up_object(int p) {
-	int s; // CHECKME : Maybe it should be initialized to 0, and the assignment before the check should be remove
-
+void pickUpObject(int p) {
 	switch (_G(object_map[p])) {
 	case 1: // Red jewel
 		if (_G(thor_info)._jewels >= 999) {
-			cannot_carry_more();
+			cannotCarryMore();
 			return;
 		}
 		add_jewels(10);
 		break;
 	case 2: // Blue jewel
 		if (_G(thor_info)._jewels >= 999) {
-			cannot_carry_more();
+			cannotCarryMore();
 			return;
 		}
 		add_jewels(1);
 		break;
 	case 3: // Red potion
 		if (_G(thor_info)._magic >= 150) {
-			cannot_carry_more();
+			cannotCarryMore();
 			return;
 		}
 		add_magic(10);
 		break;
 	case 4: // Blue potion
 		if (_G(thor_info)._magic >= 150) {
-			cannot_carry_more();
+			cannotCarryMore();
 			return;
 		}
 		add_magic(3);
 		break;
 	case 5: // Good apple
 		if (_G(thor)->_health >= 150) {
-			cannot_carry_more();
+			cannotCarryMore();
 			return;
 		}
 		play_sound(GULP, false);
@@ -95,7 +93,7 @@ void pick_up_object(int p) {
 		break;
 	case 8: // Treasure
 		if (_G(thor_info)._jewels >= 999) {
-			cannot_carry_more();
+			cannotCarryMore();
 			return;
 		}
 		add_jewels(50);
@@ -139,7 +137,7 @@ void pick_up_object(int p) {
 	case 29:
 	case 30:
 	case 31:
-	case 32:
+	case 32: {
 		_G(hourglass_flag) = 0;
 		_G(thunder_flag) = 0;
 		_G(shield_on) = false;
@@ -148,16 +146,20 @@ void pick_up_object(int p) {
 		_G(hammer)->_numMoves = 2;
 		_G(thor)->_numMoves = 1;
 		_G(actor[2])._active = false;
-		s = 1 << (_G(object_map[p]) - 27);
+		const int s = 1 << (_G(object_map[p]) - 27);
 		_G(thor_info)._inventory |= s;
 		odinSpeaks((_G(object_map[p]) - 27) + 516, _G(object_map[p]) - 1);
 		_G(thor_info)._selectedItem = _G(object_map[p]) - 26;
 		add_magic(150);
 		fill_score(5);
+		}
+		break;
+
+	default:
 		break;
 	}
-	int x = p % 20;
-	int y = p / 20;
+	const int x = p % 20;
+	const int y = p / 20;
 
 	_G(ox) = x * 16;
 	_G(oy) = y * 16;
@@ -173,47 +175,46 @@ void pick_up_object(int p) {
 	_G(object_index[p]) = 0;
 }
 
-int drop_object(Actor *actr) {
-	int o;
+void dropRandomObject(Actor *actor) {
+	int objId;
 
-	int rnd1 = g_events->getRandomNumber(99);
-	int rnd2 = g_events->getRandomNumber(99);
+	const int rnd1 = g_events->getRandomNumber(99);
+	const int rnd2 = g_events->getRandomNumber(99);
 
 	if (rnd1 < 25)
-		o = 5; // Apple
+		objId = 5; // Apple
 	else if (rnd1 & 1) {
 		// Jewels
 		if (rnd2 < 10)
-			o = 1; // Red
+			objId = 1; // Red
 		else
-			o = 2; // Blue
+			objId = 2; // Blue
 	} else {
 		// Potion
 		if (rnd2 < 10)
-			o = 3; // Red
+			objId = 3; // Red
 		else
-			o = 4; // Blue
+			objId = 4; // Blue
 	}
 
-	_drop_obj(actr, o);
-	return 1;
+	dropObject(actor, objId);
 }
 
-int _drop_obj(Actor *actr, int o) {
-	int p = (actr->_x + (actr->_sizeX / 2)) / 16 + (((actr->_y + (actr->_sizeY / 2)) / 16) * 20);
+bool dropObject(Actor *actor, const int objId) {
+	const int p = (actor->_x + (actor->_sizeX / 2)) / 16 + (((actor->_y + (actor->_sizeY / 2)) / 16) * 20);
 	if (!_G(object_map[p]) && _G(scrn)._iconGrid[p / 20][p % 20] >= 140) { //nothing there and solid
-		_G(object_map[p]) = o;
-		_G(object_index[p]) = 27 + actr->_actorNum; //actor is 3-15
+		_G(object_map[p]) = objId;
+		_G(object_index[p]) = 27 + actor->_actorNum; //actor is 3-15
 
-		return 1;
+		return true;
 	}
 
-	return 0;
+	return false;
 }
 
-int use_apple(int flag) {
+bool useApple(int flag) {
 	if (_G(thor)->_health == 150)
-		return 0;
+		return false;
 
 	if (flag && _G(thor_info)._magic > 0) {
 		if (!_G(apple_flag)) {
@@ -229,36 +230,36 @@ int use_apple(int flag) {
 				play_sound(ANGEL, false);
 		}
 		_G(apple_flag) = true;
-		return 1;
+		return true;
 	}
 
 	_G(apple_flag) = false;
 	if (flag)
-		not_enough_magic();
+		notEnoughMagic();
 
-	return 0;
+	return false;
 }
 
-int use_thunder(int flag) {
-
+bool useThunder(int flag) {
 	if (flag && _G(thor_info)._magic > 29) {
 		if (!_G(thunder_flag)) {
 			add_magic(-30);
 			play_sound(THUNDER, false);
 			_G(thunder_flag) = 60;
 		}
-		return 1;
+		return true;
 	}
 
 	if (flag && !_G(thunder_flag))
-		not_enough_magic();
+		notEnoughMagic();
 
 	if (_G(thunder_flag))
-		return 1;
-	return 0;
+		return true;
+	
+	return false;
 }
 
-int use_boots(int flag) {
+bool useBoots(int flag) {
 	if (flag) {
 		if (_G(thor_info)._magic > 0) {
 			if (_G(thor)->_numMoves == 1) {
@@ -270,10 +271,10 @@ int use_boots(int flag) {
 			}
 			_G(thor)->_numMoves = 2;
 			_G(hammer)->_numMoves = 3;
-			return 1;
+			return true;
 		}
 
-		not_enough_magic();
+		notEnoughMagic();
 		_G(thor)->_numMoves = 1;
 		_G(hammer)->_numMoves = 2;
 
@@ -281,10 +282,10 @@ int use_boots(int flag) {
 		_G(thor)->_numMoves = 1;
 		_G(hammer)->_numMoves = 2;
 	}
-	return 0;
+	return false;
 }
 
-int use_shield(int flag) {
+bool useShield(int flag) {
 	if (flag) {
 		if (_G(thor_info)._magic) {
 			if (!_G(shield_on)) {
@@ -302,10 +303,10 @@ int use_shield(int flag) {
 				add_magic(-1);
 			}
 
-			return 1;
+			return true;
 		}
 
-		not_enough_magic();
+		notEnoughMagic();
 	}
 
 	if (_G(shield_on)) {
@@ -314,23 +315,23 @@ int use_shield(int flag) {
 		_G(shield_on) = false;
 	}
 
-	return 0;
+	return false;
 }
 
-int use_lightning(int flag) {
+bool useLightning(int flag) {
 	if (flag) {
 		if (_G(thor_info)._magic > 14) {
 			add_magic(-15);
 			g_events->send("Game", GameMessage("THROW_LIGHTNING"));
 		} else {
-			not_enough_magic();
-			return 0;
+			notEnoughMagic();
+			return false;
 		}
 	}
-	return 1;
+	return true;
 }
 
-int use_tornado(int flag) {
+bool useTornado(int flag) {
 	if (flag) {
 		if (_G(thor_info)._magic > 10) {
 			if (!_G(tornado_used) && !_G(actor[2])._dead && _G(magic_cnt) > 20) {
@@ -346,8 +347,8 @@ int use_tornado(int flag) {
 				play_sound(WIND, false);
 			}
 		} else if (!_G(tornado_used)) {
-			not_enough_magic();
-			return 0;
+			notEnoughMagic();
+			return false;
 		}
 		if (_G(magic_cnt) > 8) {
 			if (_G(tornado_used)) {
@@ -358,26 +359,24 @@ int use_tornado(int flag) {
 		if (_G(thor_info)._magic < 1) {
 			actorDestroyed(&_G(actor[2]));
 			_G(tornado_used) = false;
-			not_enough_magic();
-			return 0;
+			notEnoughMagic();
+			return false;
 		}
-		return 1;
+		return true;
 	}
-	return 0;
+	return false;
 }
 
-int use_object(int flag) {
-	if (!flag)
-		return 0;
-	if (!(_G(thor_info)._inventory & 64))
-		return 0;
+bool useObject(int flag) {
+	if (!flag || !(_G(thor_info)._inventory & 64))
+		return false;
 
 	odinSpeaks((_G(thor_info)._object - 1) + 5501, _G(thor_info)._object - 1);
-	return 1;
+	return true;
 }
 
-void use_item() {
-	int ret = 0;
+void useItem() {
+	bool ret = false;
 
 	int kf = _G(key_flag[key_magic]);
 
@@ -389,29 +388,32 @@ void use_item() {
 	bool mf = _G(magic_inform);
 	switch (_G(thor_info)._selectedItem) {
 	case 1:
-		ret = use_apple(kf);
+		ret = useApple(kf);
 		break;
 	case 2:
-		ret = use_lightning(kf);
+		ret = useLightning(kf);
 		break;
 	case 3:
-		ret = use_boots(kf);
+		ret = useBoots(kf);
 		break;
 	case 4:
-		ret = use_tornado(kf);
+		ret = useTornado(kf);
 		break;
 	case 5:
-		ret = use_shield(kf);
+		ret = useShield(kf);
 		break;
 	case 6:
-		ret = use_thunder(kf);
+		ret = useThunder(kf);
 		break;
 	case 7:
-		ret = use_object(kf);
+		ret = useObject(kf);
+		break;
+	default:
 		break;
 	}
+	
 	if (kf) {
-		if ((!ret) && (!_G(useItemFlag))) {
+		if (!ret && !_G(useItemFlag)) {
 			if (mf)
 				play_sound(BRAAPP, false);
 			_G(useItemFlag) = true;
@@ -421,21 +423,20 @@ void use_item() {
 	}
 }
 
-void not_enough_magic() {
+void notEnoughMagic() {
 	if (!_G(magic_inform))
 		odinSpeaks(2006, 0);
 
 	_G(magic_inform) = true;
 }
 
-void cannot_carry_more() {
+void cannotCarryMore() {
 	if (!_G(carry_inform))
 		odinSpeaks(2007, 0);
 	_G(carry_inform) = true;
 }
 
-void delete_object() {
-
+void deleteObject() {
 	_G(thor_info)._inventory &= 0xbf;
 	_G(thor_info)._selectedItem = 1;
 }
diff --git a/engines/got/game/object.h b/engines/got/game/object.h
index 7d187c147be..673d1a1ae76 100644
--- a/engines/got/game/object.h
+++ b/engines/got/game/object.h
@@ -26,12 +26,12 @@
 
 namespace Got {
 
-extern void show_objects();
-extern void pick_up_object(int p);
-extern int drop_object(Actor *actr);
-extern int _drop_obj(Actor *actr, int o);
-extern void delete_object();
-extern void use_item();
+extern void showObjects();
+extern void pickUpObject(int p);
+extern void dropRandomObject(Actor *actor);
+extern bool dropObject(Actor *actor, int objId);
+extern void deleteObject();
+extern void useItem();
 
 } // namespace Got
 
diff --git a/engines/got/game/script.cpp b/engines/got/game/script.cpp
index 7d85ee4f92e..8be3570c2a3 100644
--- a/engines/got/game/script.cpp
+++ b/engines/got/game/script.cpp
@@ -82,13 +82,13 @@ Scripts::ScrFunction Scripts::scr_func[5] = {
 	&Scripts::scr_func2,
 	&Scripts::scr_func3,
 	&Scripts::scr_func4,
-	&Scripts::scr_func5,
+	&Scripts::scr_func5
 };
 
 Scripts *g_scripts;
 
-void execute_script(long index, const Gfx::Pics &speakerIcon, ScriptEndFn endFn) {
-	g_scripts->execute_script(index, speakerIcon, endFn);
+void executeScript(long index, const Gfx::Pics &speakerIcon, ScriptEndFn endFn) {
+	g_scripts->executeScript(index, speakerIcon, endFn);
 }
 
 Scripts::Scripts() {
@@ -99,7 +99,7 @@ Scripts::~Scripts() {
 	g_scripts = nullptr;
 }
 
-void Scripts::execute_script(long index, const Gfx::Pics &speakerIcon, ScriptEndFn endFn) {
+void Scripts::executeScript(long index, const Gfx::Pics &speakerIcon, ScriptEndFn endFn) {
 	// Firstly disable any on-screen actors
 	for (int i = 0; i < MAX_ACTORS; i++)
 		_G(actor[i])._show = 0;
@@ -125,15 +125,15 @@ void Scripts::runScript(bool firstTime) {
 	Common::fill(_forStack, _forStack + 10, (char *)nullptr);
 	_forPtr = 0;
 
-	int i = read_script_file();
+	int i = readScriptFile();
 	if (i != 0) {
-		script_error(i);
-		script_exit();
+		scriptError(i);
+		scriptExit();
 		return;
 	}
 
 	if (firstTime)
-		script_entry();
+		scriptEntry();
 
 	_buffPtr = _buffer;
 	scriptLoop();
@@ -144,12 +144,12 @@ void Scripts::scriptLoop() {
 		if (_G(cheat) && _G(key_flag[_B]))
 			break;
 
-		int ret = get_command();
+		int ret = getCommand();
 		if (ret == -1)
 			break; // Ignore NO END error
 
 		if (ret == -2) {
-			script_error(5); // Syntax error
+			scriptError(5); // Syntax error
 			break;
 		}
 
@@ -168,10 +168,10 @@ void Scripts::scriptLoop() {
 	}
 
 	if (_paused == SCRIPT_READY)
-		script_exit();
+		scriptExit();
 }
 
-void Scripts::script_exit() {
+void Scripts::scriptExit() {
 	if (_buffer) {
 		free(_buffer);
 		_buffer = nullptr;
@@ -181,7 +181,7 @@ void Scripts::script_exit() {
 		_endFn();
 }
 
-int Scripts::skip_colon() {
+int Scripts::skipColon() {
 	while (*_buffPtr == 0 || *_buffPtr == ':') {
 		_buffPtr++;
 		if (_buffPtr > _buffEnd)
@@ -191,8 +191,8 @@ int Scripts::skip_colon() {
 	return 1;
 }
 
-int Scripts::get_command() {
-	if (!skip_colon())
+int Scripts::getCommand() {
+	if (!skipColon())
 		return -1;
 
 	int i = 0;
@@ -214,7 +214,7 @@ int Scripts::get_command() {
 		if (*(_buffPtr + 1) == '=') { // Num var assignment
 			i = (*_buffPtr) - 65;
 			_buffPtr += 2;
-			ret = calc_value();
+			ret = calcValue();
 			if (!ret)
 				return -2;
 
@@ -225,7 +225,7 @@ int Scripts::get_command() {
 		if (*(_buffPtr + 1) == '$' && *(_buffPtr + 2) == '=') {
 			i = (*_buffPtr) - 65;
 			_buffPtr += 3;
-			ret = calc_string(0); // String var assignment
+			ret = calcString(0); // String var assignment
 			if (ret == 0)
 				return -2;
 
@@ -243,28 +243,28 @@ int Scripts::get_command() {
 	return -2;
 }
 
-int Scripts::calc_string(int mode) {
+int Scripts::calcString(int mode) {
 	// if mode==1 stop at comma
-	char varstr[255];
-	uint varnum;
+	char varString[255];
+	uint varNumber;
 
-	Common::strcpy_s(varstr, "");
+	Common::strcpy_s(varString, "");
 
-	if (!skip_colon())
+	if (!skipColon())
 		return 0;
 
 strloop:
 	if (*_buffPtr == '"') {
-		get_str();
-		if (strlen(varstr) + strlen(_tempS) < 255)
-			Common::strcat_s(varstr, _tempS);
+		getStr();
+		if (strlen(varString) + strlen(_tempS) < 255)
+			Common::strcat_s(varString, _tempS);
 		goto nextstr;
 	}
 	if (Common::isAlpha(*_buffPtr)) {
 		if (*(_buffPtr + 1) == '$') {
-			varnum = (*_buffPtr) - 65;
-			if (strlen(varstr) + strlen(_strVar[varnum]) < 255)
-				Common::strcat_s(varstr, _strVar[varnum]);
+			varNumber = (*_buffPtr) - 65;
+			if (strlen(varString) + strlen(_strVar[varNumber]) < 255)
+				Common::strcat_s(varString, _strVar[varNumber]);
 			_buffPtr += 2;
 			goto nextstr;
 		}
@@ -287,15 +287,15 @@ nextstr:
 
 strdone:
 
-	Common::strcpy_s(_tempS, (char *)varstr);
+	Common::strcpy_s(_tempS, (char *)varString);
 	return 1;
 }
 
-void Scripts::get_str() {
+void Scripts::getStr() {
 	_buffPtr++;
 	int t = 0;
 
-	while (1) {
+	while (true) {
 		if (*_buffPtr == '"' || *_buffPtr == 0) {
 			_tempS[t] = 0;
 			if (*_buffPtr == '"')
@@ -308,45 +308,52 @@ void Scripts::get_str() {
 	}
 }
 
-int Scripts::calc_value() {
-	long tmpval2 = 0;
-	char exptype = 1;
+int Scripts::calcValue() {
+	long tmpVal2 = 0;
+	char expType = 1;
 
-	while (1) {
-		if (!get_next_val())
+	while (true) {
+		if (!getNextValue())
 			return 0;
-		switch (exptype) {
+
+		switch (expType) {
 		case 0:
-			tmpval2 = tmpval2 * _lTemp;
+			tmpVal2 = tmpVal2 * _lTemp;
 			break;
+			
 		case 1:
-			tmpval2 = tmpval2 + _lTemp;
+			tmpVal2 = tmpVal2 + _lTemp;
 			break;
+			
 		case 2:
-			tmpval2 = tmpval2 - _lTemp;
+			tmpVal2 = tmpVal2 - _lTemp;
 			break;
+			
 		case 3:
 			if (_lTemp != 0)
-				tmpval2 = tmpval2 / _lTemp;
+				tmpVal2 = tmpVal2 / _lTemp;
+			break;
+			
+		default:
 			break;
 		}
 
-		char ch = *_buffPtr;
+		const char ch = *_buffPtr;
 		switch (ch) {
 		case 42:
-			exptype = 0; /* multiply */
+			expType = 0; /* multiply */
 			break;
 		case 43:
-			exptype = 1; /* add */
+			expType = 1; /* add */
 			break;
 		case 45:
-			exptype = 2; /* minus */
+			expType = 2; /* minus */
 			break;
 		case 47:
-			exptype = 3; /* divide */
+			expType = 3; /* divide */
 			break;
 		default:
-			_lValue = tmpval2;
+			_lValue = tmpVal2;
 			return 1;
 		}
 
@@ -354,12 +361,12 @@ int Scripts::calc_value() {
 	}
 }
 
-int Scripts::get_next_val() {
-	char ch = *_buffPtr;
+int Scripts::getNextValue() {
+	const char ch = *_buffPtr;
 	if (ch == 0 || ch == ':')
 		return 0;
 	if (ch == 64)
-		return get_internal_variable();
+		return getInternalVariable();
 
 	if (Common::isAlpha(ch)) {
 		_buffPtr++;
@@ -368,27 +375,27 @@ int Scripts::get_next_val() {
 	}
 
 	if (strchr("0123456789-", ch)) {
-		char tmpstr[25];
-		int t = 0;
-		tmpstr[t] = ch;
+		char tmpString[25];
+		int tmpIndex = 0;
+		tmpString[tmpIndex] = ch;
 		_buffPtr++;
-		t++;
+		tmpIndex++;
 		while (strchr("0123456789", *_buffPtr) && *_buffPtr != 0) {
-			tmpstr[t] = *_buffPtr;
+			tmpString[tmpIndex] = *_buffPtr;
 			_buffPtr++;
-			t++;
+			tmpIndex++;
 		}
-		tmpstr[t] = 0;
-		if (t > 10)
+		tmpString[tmpIndex] = 0;
+		if (tmpIndex > 10)
 			return 0;
-		_lTemp = atol(tmpstr);
+		_lTemp = atol(tmpString);
 		return 1;
 	}
 
 	return 0;
 }
 
-int Scripts::get_internal_variable() {
+int Scripts::getInternalVariable() {
 	int i = 0;
 	while (true) {
 		if (!INTERNAL_VARIABLE[i])
@@ -438,7 +445,7 @@ int Scripts::get_internal_variable() {
 		_lTemp = (long)(i - 5l);
 		break;
 	case 22:
-		if (!calc_value())
+		if (!calcValue())
 			return 0;
 		i = (int)_lValue;
 		if (i < 1 || i > 64)
@@ -465,7 +472,7 @@ int Scripts::get_internal_variable() {
 	return 1;
 }
 
-int Scripts::get_line(char *src, char *dst) {
+int Scripts::getLine(char *src, char *dst) {
 	int cnt = 0;
 	if (!src)
 		return cnt;
@@ -485,9 +492,9 @@ int Scripts::get_line(char *src, char *dst) {
 	return cnt;
 }
 
-int Scripts::read_script_file() {
-	char temp_buff[255];
-	char quote_flag;
+int Scripts::readScriptFile() {
+	char tmpBuffer[255];
+	char quoteFlag;
 	int len, p, ret, cnt;
 	Common::String str;
 	char tmps[255];
@@ -516,21 +523,21 @@ int Scripts::read_script_file() {
 	}
 
 	str = Common::String::format("|%ld", _scrIndex);
-	Common::strcpy_s(temp_buff, str.c_str());
+	Common::strcpy_s(tmpBuffer, str.c_str());
 
-	while (1) {
-		cnt = get_line(sb, (char *)tmps);
+	while (true) {
+		cnt = getLine(sb, (char *)tmps);
 		sb += cnt;
 		if (!strcmp(tmps, "|EOF")) {
 			ret = 2;
 			goto done;
 		}
-		if (!strcmp(tmps, temp_buff))
+		if (!strcmp(tmps, tmpBuffer))
 			break;
 	}
 	_numLabels = 0;
-	while (1) {
-		cnt = get_line(sb, (char *)tmps);
+	while (true) {
+		cnt = getLine(sb, (char *)tmps);
 		if (!strcmp(tmps, "|STOP")) {
 			if (_buffPtr != _buffer) {
 				_buffEnd = _buffPtr;
@@ -547,32 +554,32 @@ int Scripts::read_script_file() {
 			_buffPtr++;
 			continue;
 		}
-		quote_flag = 0;
+		quoteFlag = 0;
 		p = 0;
 		for (int i = 0; i < len; i++) {
 			char ch = tmps[i];
 			if (ch == 34)
-				quote_flag ^= 1;
+				quoteFlag ^= 1;
 			else if (ch == 13 || ch == 10) { // Check for CR
-				temp_buff[p] = 0;
+				tmpBuffer[p] = 0;
 				break;
-			} else if ((ch == 39 || ch == 96) && !quote_flag) {
-				temp_buff[p] = 0;
+			} else if ((ch == 39 || ch == 96) && !quoteFlag) {
+				tmpBuffer[p] = 0;
 				break;
 			}
-			if (!quote_flag)
+			if (!quoteFlag)
 				ch = toupper(ch);
-			if (quote_flag || ch > 32) {
-				temp_buff[p++] = ch;
+			if (quoteFlag || ch > 32) {
+				tmpBuffer[p++] = ch;
 			}
 		}
-		temp_buff[p] = 0;
+		tmpBuffer[p] = 0;
 
-		len = strlen(temp_buff);
-		if (len > 0 && len < 10 && temp_buff[len - 1] == ':') { //line label
-			temp_buff[len - 1] = 0;
+		len = strlen(tmpBuffer);
+		if (len > 0 && len < 10 && tmpBuffer[len - 1] == ':') { //line label
+			tmpBuffer[len - 1] = 0;
 			_linePtr[_numLabels] = _buffPtr;
-			Common::strcpy_s(_lineLabel[_numLabels++], (char *)temp_buff);
+			Common::strcpy_s(_lineLabel[_numLabels++], (char *)tmpBuffer);
 			if (_numLabels > 31) {
 				ret = 3;
 				goto done;
@@ -582,8 +589,8 @@ int Scripts::read_script_file() {
 			continue;
 		}
 
-		Common::strcpy_s(_buffPtr, SCR_BUFF_SIZE, temp_buff);
-		_buffPtr += strlen(temp_buff);
+		Common::strcpy_s(_buffPtr, SCR_BUFF_SIZE, tmpBuffer);
+		_buffPtr += strlen(tmpBuffer);
 		*_buffPtr = 0;
 		_buffPtr++;
 	}
@@ -595,13 +602,13 @@ done:
 	return ret;
 }
 
-void Scripts::script_error(int err_num) {
-	int line_num = 1;
+void Scripts::scriptError(int err_num) {
+	int lineNum = 1;
 	char *tb = _buffer;
 
 	while (1) {
 		if (*tb == 0)
-			line_num++;
+			lineNum++;
 		if (tb >= _buffPtr)
 			break;
 		tb++;
@@ -610,7 +617,7 @@ void Scripts::script_error(int err_num) {
 	if (err_num > ERROR_MAX)
 		err_num = 5; // Unknown=syntax
 
-	warning("%s in Line #%d", SCR_ERROR[err_num], line_num);
+	warning("%s in Line #%d", SCR_ERROR[err_num], lineNum);
 }
 
 int Scripts::cmd_goto() {
@@ -635,50 +642,50 @@ int Scripts::cmd_goto() {
 }
 
 int Scripts::cmd_if() {
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
-	
-	long tmpval1 = _lValue;
-	char exptype = *_buffPtr;
+
+	const long tmpVal1 = _lValue;
+	char expType = *_buffPtr;
 	_buffPtr++;
 
-	char ch = *_buffPtr;
+	const char ch = *_buffPtr;
 	if (ch == 60 || ch == 61 || ch == 62) {
-		if (exptype == *_buffPtr)
+		if (expType == *_buffPtr)
 			return 5;
 		
-		exptype += *_buffPtr;
+		expType += *_buffPtr;
 		_buffPtr++;
 	}
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 
-	long tmpval2 = _lValue;
+	const long tmpVal2 = _lValue;
 	_buffPtr += 4;
 
-	switch (exptype) {
+	switch (expType) {
 	case 60: /* less than */
-		if (tmpval1 < tmpval2)
+		if (tmpVal1 < tmpVal2)
 			goto iftrue;
 		goto iffalse;
 	case 61: /* equal */
-		if (tmpval1 == tmpval2)
+		if (tmpVal1 == tmpVal2)
 			goto iftrue;
 		goto iffalse;
 	case 62: /* greater than */
-		if (tmpval1 > tmpval2)
+		if (tmpVal1 > tmpVal2)
 			goto iftrue;
 		goto iffalse;
 	case 121: /* less than or equal */
-		if (tmpval1 <= tmpval2)
+		if (tmpVal1 <= tmpVal2)
 			goto iftrue;
 		goto iffalse;
 	case 122: /* less or greater (not equal) */
-		if (tmpval1 != tmpval2)
+		if (tmpVal1 != tmpVal2)
 			goto iftrue;
 		goto iffalse;
 	case 123: /* greater than or equal */
-		if (tmpval1 >= tmpval2)
+		if (tmpVal1 >= tmpVal2)
 			goto iftrue;
 		goto iffalse;
 	default:
@@ -699,7 +706,7 @@ iftrue:
 }
 
 int Scripts::cmd_run() {
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -707,8 +714,8 @@ int Scripts::cmd_run() {
 	return -100;
 }
 
-int Scripts::cmd_addjewels() {
-	if (!calc_value())
+int Scripts::cmd_addJewels() {
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -717,8 +724,8 @@ int Scripts::cmd_addjewels() {
 	return 0;
 }
 
-int Scripts::cmd_addhealth() {
-	if (!calc_value())
+int Scripts::cmd_addHealth() {
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -726,8 +733,8 @@ int Scripts::cmd_addhealth() {
 	return 0;
 }
 
-int Scripts::cmd_addmagic() {
-	if (!calc_value())
+int Scripts::cmd_addMagic() {
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -735,8 +742,8 @@ int Scripts::cmd_addmagic() {
 	return 0;
 }
 
-int Scripts::cmd_addkeys() {
-	if (!calc_value())
+int Scripts::cmd_addKeys() {
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -744,8 +751,8 @@ int Scripts::cmd_addkeys() {
 	return 0;
 }
 
-int Scripts::cmd_addscore() {
-	if (!calc_value())
+int Scripts::cmd_addScore() {
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -757,7 +764,7 @@ int Scripts::cmd_say(int mode, int type) {
 	int obj = 0;
 
 	if (mode) {
-		if (!calc_value())
+		if (!calcValue())
 			return 5;
 		_buffPtr++;
 		obj = (int)_lValue;
@@ -771,7 +778,7 @@ int Scripts::cmd_say(int mode, int type) {
 	Common::fill(_G(tmp_buff), _G(tmp_buff) + TMP_SIZE, 0);
 	char *p = (char *)_G(tmp_buff);
 
-	while (calc_string(0)) {
+	while (calcString(0)) {
 		Common::strcpy_s(p, TMP_SIZE, _tempS);
 		p += strlen(_tempS);
 		*(p) = 10;
@@ -792,7 +799,7 @@ int Scripts::cmd_ask() {
 
 	memset(_G(tmp_buff), 0, TMP_SIZE);
 
-	if (!skip_colon())
+	if (!skipColon())
 		return 5;
 
 	if (Common::isAlpha(*_buffPtr)) {
@@ -806,7 +813,7 @@ int Scripts::cmd_ask() {
 		return 5;
 	}
 
-	if (!calc_string(1))
+	if (!calcString(1))
 		return 5;
 
 	strncpy(title, _tempS, 41);
@@ -814,7 +821,7 @@ int Scripts::cmd_ask() {
 
 	if (*_buffPtr == ',') {
 		_buffPtr++;
-		if (!calc_value())
+		if (!calcValue())
 			return 5;
 
 		_buffPtr++;
@@ -824,7 +831,7 @@ int Scripts::cmd_ask() {
 
 	_askVar = v;
 
-	while (calc_string(0)) {
+	while (calcString(0)) {
 		Common::strcpy_s(opt, _tempS);
 		opts.push_back(opt);
 
@@ -860,7 +867,7 @@ void Scripts::runIfResuming() {
 }
 
 int Scripts::cmd_sound() {
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -871,21 +878,21 @@ int Scripts::cmd_sound() {
 	return 0;
 }
 
-int Scripts::cmd_settile() {
-	if (!calc_value())
+int Scripts::cmd_setTile() {
+	if (!calcValue())
 		return 5;
 	
 	_buffPtr++;
-	int screen = (int)_lValue;
-	if (!calc_value())
+	const int screen = (int)_lValue;
+	if (!calcValue())
 		return 5;
 	
 	_buffPtr++;
-	int pos = (int)_lValue;
-	if (!calc_value())
+	const int pos = (int)_lValue;
+	if (!calcValue())
 		return 5;
-	
-	int tile = (int)_lValue;
+
+	const int tile = (int)_lValue;
 
 	if (screen < 0 || screen > 119)
 		return 6;
@@ -907,8 +914,8 @@ int Scripts::cmd_settile() {
 	return 0;
 }
 
-int Scripts::cmd_itemgive() {
-	if (!calc_value())
+int Scripts::cmd_itemGive() {
+	if (!calcValue())
 		return 5;
 
 	_buffPtr++;
@@ -924,13 +931,13 @@ int Scripts::cmd_itemgive() {
 	return 0;
 }
 
-int Scripts::cmd_itemtake() {
-	delete_object();
+int Scripts::cmd_itemTake() {
+	deleteObject();
 	return 0;
 }
 
-int Scripts::cmd_setflag() {
-	if (!calc_value())
+int Scripts::cmd_setFlag() {
+	if (!calcValue())
 		return 5;
 
 	int i = (int)_lValue;
@@ -945,7 +952,7 @@ int Scripts::cmd_setflag() {
 int Scripts::cmd_ltoa() {
 	int sv;
 
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 	_buffPtr++;
 
@@ -966,7 +973,7 @@ int Scripts::cmd_ltoa() {
 }
 
 int Scripts::cmd_pause() {
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 	
 	_buffPtr++;
@@ -978,7 +985,7 @@ int Scripts::cmd_pause() {
 }
 
 int Scripts::cmd_visible() {
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 	
 	_buffPtr++;
@@ -1003,7 +1010,7 @@ int Scripts::cmd_random() {
 		return 5;
 	}
 
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 	_buffPtr++;
 	int r = (int)_lValue;
@@ -1088,7 +1095,7 @@ void Scripts::scr_func5() {
 }
 
 int Scripts::cmd_exec() {
-	if (!calc_value())
+	if (!calcValue())
 		return 5;
 	_buffPtr++;
 	if (_lValue < 1 || _lValue > 10)
@@ -1147,13 +1154,13 @@ int Scripts::exec_command(int num) {
 		ch -= 65;
 		_forVar[_forPtr] = ch;
 		_buffPtr += 2;
-		if (!calc_value()) {
+		if (!calcValue()) {
 			ret = 5;
 			break;
 		}
 		_numVar[_forVar[_forPtr]] = _lValue;
 		_buffPtr += 2;
-		if (!calc_value()) {
+		if (!calcValue()) {
 			ret = 5;
 			break;
 		}
@@ -1184,19 +1191,19 @@ int Scripts::exec_command(int num) {
 			return -100;
 		break;
 	case 10: // addjewels
-		ret = cmd_addjewels();
+		ret = cmd_addJewels();
 		break;
 	case 11: // addhealth
-		ret = cmd_addhealth();
+		ret = cmd_addHealth();
 		break;
 	case 12: // addmagic
-		ret = cmd_addmagic();
+		ret = cmd_addMagic();
 		break;
 	case 13: // addkeys
-		ret = cmd_addkeys();
+		ret = cmd_addKeys();
 		break;
 	case 14: // addscore
-		ret = cmd_addscore();
+		ret = cmd_addScore();
 		break;
 	case 15: // say
 		ret = cmd_say(0, 1);
@@ -1208,19 +1215,19 @@ int Scripts::exec_command(int num) {
 		ret = cmd_sound();
 		break;
 	case 18: // settile
-		ret = cmd_settile();
+		ret = cmd_setTile();
 		break;
 	case 19: // itemgive
-		ret = cmd_itemgive();
+		ret = cmd_itemGive();
 		break;
 	case 20: // itemtake
-		ret = cmd_itemtake();
+		ret = cmd_itemTake();
 		break;
 	case 21: // itemsay
 		ret = cmd_say(1, 1);
 		break;
 	case 22: // setflag
-		ret = cmd_setflag();
+		ret = cmd_setFlag();
 		break;
 	case 23: // ltoa
 		ret = cmd_ltoa();
@@ -1245,7 +1252,7 @@ int Scripts::exec_command(int num) {
 	}
 
 	if (ret > 0) {
-		script_error(ret);
+		scriptError(ret);
 		return 0;
 	}
 
diff --git a/engines/got/game/script.h b/engines/got/game/script.h
index ed751a2df38..934b75d61aa 100644
--- a/engines/got/game/script.h
+++ b/engines/got/game/script.h
@@ -38,7 +38,7 @@ public:
 	Scripts();
 	~Scripts();
 
-	void execute_script(long index, const Gfx::Pics &speakerIcon, ScriptEndFn endFn = nullptr);
+	void executeScript(long index, const Gfx::Pics &speakerIcon, ScriptEndFn endFn = nullptr);
 	void pause();
 	void resume();
 	void setAskResponse(int option);
@@ -70,35 +70,35 @@ private:
     int _askVar = -1;
 
 private:
-    int  read_script_file();
-    void script_error(int err_num);
-    int  get_command();
-    int  skip_colon();
-    int  calc_value();
-    int  get_next_val();
-    int  calc_string(int mode);
-    void get_str();
-    int  get_internal_variable();
+    int  readScriptFile();
+    void scriptError(int err_num);
+    int  getCommand();
+    int  skipColon();
+    int  calcValue();
+    int  getNextValue();
+    int  calcString(int mode);
+    void getStr();
+    int  getInternalVariable();
     int  exec_command(int num);
-    int get_line(char *src, char *dst);
-    void script_entry() {}
-    void script_exit();
+    int getLine(char *src, char *dst);
+    void scriptEntry() {}
+    void scriptExit();
 
     int cmd_goto();
     int cmd_if();
     int cmd_run();
-    int cmd_addjewels();
-    int cmd_addhealth();
-    int cmd_addmagic();
-    int cmd_addkeys();
-    int cmd_addscore();
+    int cmd_addJewels();
+    int cmd_addHealth();
+    int cmd_addMagic();
+    int cmd_addKeys();
+    int cmd_addScore();
     int cmd_say(int mode, int type);
     int cmd_ask();
     int cmd_sound();
-    int cmd_settile();
-    int cmd_itemgive();
-    int cmd_itemtake();
-    int cmd_setflag();
+    int cmd_setTile();
+    int cmd_itemGive();
+    int cmd_itemTake();
+    int cmd_setFlag();
     int cmd_ltoa();
     int cmd_pause();
     int cmd_visible();
@@ -119,7 +119,7 @@ private:
 
 };
 
-extern void execute_script(long index, const Gfx::Pics &speakerIcon,
+extern void executeScript(long index, const Gfx::Pics &speakerIcon,
                            ScriptEndFn endFn = nullptr);
 
 } // namespace Got
diff --git a/engines/got/game/shot_movement.cpp b/engines/got/game/shot_movement.cpp
index 61033a139d4..2d97a8619ff 100644
--- a/engines/got/game/shot_movement.cpp
+++ b/engines/got/game/shot_movement.cpp
@@ -214,12 +214,12 @@ int shot_movement_four(Actor *actr) {
 			actorDestroyed(actr);
 			_G(apple_drop++);
 			if (_G(apple_drop) == 4) {
-				if (_drop_obj(actr, 5))
+				if (dropObject(actr, 5))
 					_G(apple_drop) = 0;
 				else
 					_G(apple_drop) = 3;
 			} else
-				_drop_obj(actr, 3);
+				dropObject(actr, 3);
 			return 0;
 		}
 	}
@@ -686,12 +686,12 @@ int shot_movement_thirteen(Actor *actr) {
 		actorDestroyed(actr);
 		_G(apple_drop++);
 		if (_G(apple_drop) > 4) {
-			if (_drop_obj(actr, 5))
+			if (dropObject(actr, 5))
 				_G(apple_drop) = 0;
 			else
 				_G(apple_drop) = 4;
 		} else
-			_drop_obj(actr, 4);
+			dropObject(actr, 4);
 		return 0;
 	}
 
diff --git a/engines/got/game/special_tile.cpp b/engines/got/game/special_tile.cpp
index b44de83c8de..e174d7db124 100644
--- a/engines/got/game/special_tile.cpp
+++ b/engines/got/game/special_tile.cpp
@@ -44,7 +44,7 @@ int special_tile_thor(int x, int y, int icon) {
 			if (_G(thor_info)._inventory & 64) {
 				if (_G(thor_info)._object == 4) {
 					erase_door(y, x);
-					delete_object();
+					deleteObject();
 					return 1;
 				}
 			}
@@ -59,7 +59,7 @@ int special_tile_thor(int x, int y, int icon) {
 		if (!GAME1) {
 			if ((_G(thor_info)._inventory & 64) && _G(thor_info)._object == 5) {
 				odinSpeaks(2012, 0);
-				delete_object();
+				deleteObject();
 				_G(setup).f10 = 1;
 			} else if (!_G(setup).f10) {
 				odinSpeaks(2011, 0);
diff --git a/engines/got/views/game_content.cpp b/engines/got/views/game_content.cpp
index 94aba352393..9a3d2d47967 100644
--- a/engines/got/views/game_content.cpp
+++ b/engines/got/views/game_content.cpp
@@ -142,7 +142,7 @@ bool GameContent::tick() {
 		checkSwitchFlag();
 		checkForItem();
 		moveActors();
-		use_item();
+		useItem();
 		updateActors();
 		checkForBossDead();
 		checkForCheats();
@@ -348,7 +348,7 @@ void GameContent::checkSwitchFlag() {
 void GameContent::checkForItem() {
 	int thor_pos = _G(thor)->getPos();
 	if (_G(object_map[thor_pos]))
-		pick_up_object(thor_pos);
+		pickUpObject(thor_pos);
 }
 
 void GameContent::moveActors() {




More information about the Scummvm-git-logs mailing list