[Scummvm-git-logs] scummvm master -> d49407368dbfe41c1aa083f6fe2165a58818c978

Strangerke noreply at scummvm.org
Sun Feb 12 06:47:12 UTC 2023


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:
d49407368d EFH: one small renaming, reduce parameters by 1 for loadImageSetToTileBank()


Commit: d49407368dbfe41c1aa083f6fe2165a58818c978
    https://github.com/scummvm/scummvm/commit/d49407368dbfe41c1aa083f6fe2165a58818c978
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2023-02-12T07:46:58+01:00

Commit Message:
EFH: one small renaming, reduce parameters by 1 for loadImageSetToTileBank()

Changed paths:
    engines/efh/efh.cpp
    engines/efh/efh.h
    engines/efh/files.cpp
    engines/efh/init.cpp
    engines/efh/menu.cpp


diff --git a/engines/efh/efh.cpp b/engines/efh/efh.cpp
index 7a546fef0bb..da62273f647 100644
--- a/engines/efh/efh.cpp
+++ b/engines/efh/efh.cpp
@@ -400,11 +400,11 @@ void EfhEngine::initEngine() {
 	}
 
 	// Load map tiles bitmaps
+	loadImageSetToTileBank(0, 0);
 	loadImageSetToTileBank(1, 1);
-	loadImageSetToTileBank(2, 2);
 
 	// Load characters bitmaps
-	loadImageSetToTileBank(3, 6);
+	loadImageSetToTileBank(2, 5);
 
 	// Load 320*200 Menu screen
 	Common::String fileName = Common::String::format("imageset.%d", 10);
@@ -436,10 +436,8 @@ void EfhEngine::initEngine() {
 	loadImageSet(6, _circleImageBuf, _circleImageSubFileArray, _decompBuf);
 	readImpFile(99, false);
 	_introDoneFl = true;
-	restoreAnimImageSetId();
-
-	// Note: The original at this point saves int 24h and sets a new int24 to handle fatal failure
 
+	restoreAnimImageSetId();
 	checkProtection();
 	if (_loadSaveSlot == -1) {
 		loadEfhGame();
@@ -649,11 +647,10 @@ void EfhEngine::drawMap(bool largeMapFl, int16 mapPosX, int16 mapPosY, int16 map
 				if (!groupAliveFl)
 					continue;
 
-				int16 imageSetIdx = 148 + kEncounters[curMapMons->_monsterRef]._animId;
-
 				if ((curMapMons->_possessivePronounSHL6 & 0x3F) == 0x3F && isNpcATeamMember(curMapMons->_npcId))
 					continue;
 
+				int16 imageSetIdx = 148 + kEncounters[curMapMons->_monsterRef]._animId;
 				int16 drawPosX = 128 + (posX - minX) * 16;
 				drawPosY = 8 + (posY - minY) * 16;
 				displayRawDataAtPos(_tileBankSubFilesArray[imageSetIdx], drawPosX, drawPosY);
@@ -2148,14 +2145,14 @@ bool EfhEngine::handleInteractionText(int16 mapPosX, int16 mapPosY, int16 charId
 	return false;
 }
 
-int8 EfhEngine::checkTileStatus(int16 mapPosX, int16 mapPosY, bool arg4) {
-	debugC(3, kDebugEngine, "checkTileStatus %d-%d %s", mapPosX, mapPosY, arg4 ? "true" : "false");
+int8 EfhEngine::checkTileStatus(int16 mapPosX, int16 mapPosY, bool teamFl) {
+	debugC(3, kDebugEngine, "checkTileStatus %d-%d %s", mapPosX, mapPosY, teamFl ? "true" : "false");
 
 	int16 curTileInfo = getMapTileInfo(mapPosX, mapPosY);
 	int16 tileFactId = _currentTileBankImageSetId[curTileInfo / 72] * 72;
 	tileFactId += curTileInfo % 72;
 
-	if (arg4) {
+	if (teamFl) {
 		handleInteractionText(mapPosX, mapPosY, -1, 0x7FFF, 0, tileFactId);
 	}
 
@@ -2165,20 +2162,20 @@ int8 EfhEngine::checkTileStatus(int16 mapPosX, int16 mapPosY, bool arg4) {
 	}
 
 	if (_tileFact[tileFactId]._tileId != 0xFF) {
-		if ((arg4) || (!arg4 && tileFactId != 128 && tileFactId != 121)) {
+		if (teamFl || (!teamFl && tileFactId != 128 && tileFactId != 121)) {
 			if (_largeMapFlag)
 				_mapGameMaps[_techId][mapPosX][mapPosY] = _tileFact[tileFactId]._tileId;
 			else
 				_curPlace[mapPosX][mapPosY] = _tileFact[tileFactId]._tileId;
 
 			_redrawNeededFl = true;
-			if (_tileFact[tileFactId]._field0 == 0)
+			if (_tileFact[tileFactId]._status == 0) // Stone ?
 				return 2;
 			return 1;
 		}
 	}
 
-	return _tileFact[tileFactId]._field0;
+	return _tileFact[tileFactId]._status;
 }
 
 void EfhEngine::computeInitiatives() {
@@ -2444,12 +2441,9 @@ bool EfhEngine::checkMonsterCollision() {
 	return true;
 }
 
-void EfhEngine::loadImageSetToTileBank(int16 tileBankId, int16 imageSetId) {
-	debugC(3, kDebugEngine, "loadImageSetToTileBank %d %d", tileBankId, imageSetId);
-
-	// TODO: all the values of titleBankId and imageSetId are hardcoded. When all the calls are implemented, fix the values to avoid to have to decrease them
-	int16 bankId = tileBankId - 1;
-	int16 setId = imageSetId - 1;
+// The original was decreasing both parameters by 1. Instead, the values passed which are hardcoded are reduced by 1
+void EfhEngine::loadImageSetToTileBank(int16 bankId, int16 setId) {
+	debugC(3, kDebugEngine, "loadImageSetToTileBank %d %d", bankId, setId);
 
 	if (_currentTileBankImageSetId[bankId] == setId)
 		return;
diff --git a/engines/efh/efh.h b/engines/efh/efh.h
index 49d9d9ab418..b09cf1e2769 100644
--- a/engines/efh/efh.h
+++ b/engines/efh/efh.h
@@ -216,7 +216,7 @@ struct MapMonster {
 	uint8 _weaponItemId;
 	uint8 _maxDamageAbsorption;
 	uint8 _monsterRef;
-	uint8 _additionalInfo; // abbb cddd a: special move flag, bbb: Pct modifier for random move, c aggressiveness, ddd movetype
+	uint8 _additionalInfo; // abbb cddd a: special move flag, bbb: Pct modifier for random move, c aggressiveness, ddd move type
 	uint8 _talkTextId;
 	uint8 _groupSize;
 	int16 _hitPoints[9];
@@ -232,7 +232,7 @@ struct InitiativeStruct {
 };
 
 struct TileFactStruct {
-	uint8 _field0;
+	uint8 _status;
 	uint8 _tileId;
 
 	void init();
@@ -305,7 +305,7 @@ private:
 	int16 getEquipmentDefense(int16 charId);
 	uint16 getEquippedExclusiveType(int16 charId, int16 exclusiveType, bool flag);
 	void displayLowStatusScreen(bool flag);
-	void loadImageSetToTileBank(int16 tileBankId, int16 imageSetId);
+	void loadImageSetToTileBank(int16 bankId, int16 setId);
 	void restoreAnimImageSetId();
 	void checkProtection();
 	void loadEfhGame();
@@ -366,7 +366,7 @@ private:
 	void startTalkMenu(int16 monsterId);
 	void displayImp1Text(int16 textId);
 	bool handleInteractionText(int16 mapPosX, int16 mapPosY, int16 charId, int16 itemId, int16 arg8, int16 imageSetId);
-	int8 checkTileStatus(int16 mapPosX, int16 mapPosY, bool arg4);
+	int8 checkTileStatus(int16 mapPosX, int16 mapPosY, bool teamFl);
 	void computeInitiatives();
 	void redrawScreenForced();
 	int16 countMonsterGroupMembers(int16 monsterGroup);
@@ -572,7 +572,7 @@ private:
 	int16 _animImageSetId;
 	uint8 _paletteTransformationConstant;
 	uint8 *_circleImageSubFileArray[12];
-	uint8 *_tileBankSubFilesArray[214]; // CHECKME : logically it should be 216
+	uint8 *_tileBankSubFilesArray[216];
 	BufferBM _imageDataPtr;
 	int16 _currentTileBankImageSetId[3];
 	int16 _unkRelatedToAnimImageSetId;
diff --git a/engines/efh/files.cpp b/engines/efh/files.cpp
index a5e87fbc877..907cc11ca7f 100644
--- a/engines/efh/files.cpp
+++ b/engines/efh/files.cpp
@@ -211,8 +211,8 @@ void EfhEngine::loadTechMapImp(int16 fileId) {
 	// The purpose is to properly load the misc map data in arrays in order to use them without being a pain afterwards
 	loadMapArrays(_techId);
 
-	loadImageSetToTileBank(1, _mapBitmapRefArr[_techId]._setId1 + 1);
-	loadImageSetToTileBank(2, _mapBitmapRefArr[_techId]._setId2 + 1);
+	loadImageSetToTileBank(0, _mapBitmapRefArr[_techId]._setId1);
+	loadImageSetToTileBank(1, _mapBitmapRefArr[_techId]._setId2);
 
 	initMapMonsters();
 	readImpFile(_techId, true);
@@ -248,7 +248,7 @@ void EfhEngine::readTileFact() {
 		error("Unable to find file %s", fileName.c_str());
 
 	for (int i = 0; i < 432; ++i) {
-		_tileFact[i]._field0 = f.readByte();
+		_tileFact[i]._status = f.readByte();
 		_tileFact[i]._tileId = f.readByte();
 	}
 }
diff --git a/engines/efh/init.cpp b/engines/efh/init.cpp
index b9f6339618e..7b720e8ae64 100644
--- a/engines/efh/init.cpp
+++ b/engines/efh/init.cpp
@@ -215,7 +215,7 @@ void InitiativeStruct::init() {
 }
 
 void TileFactStruct::init() {
-	_field0 = _tileId = 0;
+	_status = _tileId = 0;
 }
 
 void TeamChar::init() {
diff --git a/engines/efh/menu.cpp b/engines/efh/menu.cpp
index 6cf46578364..d0627237b42 100644
--- a/engines/efh/menu.cpp
+++ b/engines/efh/menu.cpp
@@ -1091,7 +1091,7 @@ int16 EfhEngine::useObject(int16 charId, int16 objectId, int16 teamMonsterId, in
 		_mapPosY = getRandom(_largeMapFlag ? 63 : 23);
 		int16 tileFactId = getTileFactId(_mapPosX, _mapPosY);
 
-		if (_tileFact[tileFactId]._field0 == 0) {
+		if (_tileFact[tileFactId]._status == 0) {
 			totalPartyKill();
 			buffer1 = "The entire party vanishes in a flash... only to appear in stone !";
 			if (gameMode == 2) {
@@ -1126,7 +1126,7 @@ int16 EfhEngine::useObject(int16 charId, int16 objectId, int16 teamMonsterId, in
 		_mapPosX = _items[itemId]._field19_mapPosX_or_maxDeltaPoints;
 		_mapPosY = _items[itemId]._mapPosY;
 		int16 tileFactId = getTileFactId(_mapPosX, _mapPosY);
-		if (_tileFact[tileFactId]._field0 == 0) {
+		if (_tileFact[tileFactId]._status == 0) {
 			totalPartyKill();
 			buffer1 = "The entire party vanishes in a flash... only to appear in stone !";
 			if (gameMode == 2) {




More information about the Scummvm-git-logs mailing list