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

aquadran noreply at scummvm.org
Sun Jul 31 08:30:32 UTC 2022


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:
a71891824d ICB: Few more endian fixes


Commit: a71891824da71a4c8cd8469fba29fb1322389b1e
    https://github.com/scummvm/scummvm/commit/a71891824da71a4c8cd8469fba29fb1322389b1e
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-07-31T10:30:27+02:00

Commit Message:
ICB: Few more endian fixes

Changed paths:
    engines/icb/actor_view_pc.cpp
    engines/icb/protocol.cpp
    engines/icb/text_pc.cpp


diff --git a/engines/icb/actor_view_pc.cpp b/engines/icb/actor_view_pc.cpp
index 2e581ad5d36..8fba1d182e5 100644
--- a/engines/icb/actor_view_pc.cpp
+++ b/engines/icb/actor_view_pc.cpp
@@ -421,25 +421,25 @@ void DrawFrame(const int32 frame) {
 	ConvertRAP(mesh);
 
 	// Some error checking
-	if (*(int32 *)mesh->id != *(int32 *)const_cast<char *>(RAP_API_ID)) {
+	if (READ_LE_INT32((int32 *)mesh->id) != *(int32 *)const_cast<char *>(RAP_API_ID)) {
 		Fatal_error("Wrong rap id value file %d api %d file:%s", mesh->id, RAP_API_ID, mesh_name);
 	}
-	if (mesh->schema != RAP_API_SCHEMA) {
+	if (FROM_LE_32(mesh->schema) != RAP_API_SCHEMA) {
 		Fatal_error("Wrong rap schema value file %d rap_api %d file:%s", mesh->schema, RAP_API_SCHEMA, mesh_name);
 	}
-	if (*(int32 *)pose->id != *(int32 *)const_cast<char *>(RAP_API_ID)) {
+	if (READ_LE_INT32((int32 *)pose->id) != *(int32 *)const_cast<char *>(RAP_API_ID)) {
 		Fatal_error("Wrong rap id value file %d api %d file:%s", pose->id, RAP_API_ID, pose_name);
 	}
-	if (pose->schema != RAP_API_SCHEMA) {
+	if (FROM_LE_32(pose->schema) != RAP_API_SCHEMA) {
 		Fatal_error("Wrong rap schema value file %d rap_api %d file:%s", pose->schema, RAP_API_SCHEMA, pose_name);
 	}
-	if (*(int32 *)rab->id != *(int32 *)const_cast<char *>(RAB_API_ID)) {
+	if (READ_LE_INT32((int32 *)rab->id) != *(int32 *)const_cast<char *>(RAB_API_ID)) {
 		Fatal_error("Wrong rab id value file %d rab_api %d file:%s", rab->id, RAB_API_ID, bone_name);
 	}
-	if (rab->schema != RAB_API_SCHEMA) {
+	if (FROM_LE_32(rab->schema) != RAB_API_SCHEMA) {
 		Fatal_error("Wrong rab schema value file %d rab_api %d file:%s", rab->schema, RAB_API_SCHEMA, bone_name);
 	}
-	if (mesh->nBones != rab->nBones) {
+	if (FROM_LE_16(mesh->nBones) != rab->nBones) {
 		Fatal_error("mesh nBones != animation nBones %d != %d", mesh->nBones, rab->nBones);
 	}
 
diff --git a/engines/icb/protocol.cpp b/engines/icb/protocol.cpp
index 668c20d3ede..63f64694870 100644
--- a/engines/icb/protocol.cpp
+++ b/engines/icb/protocol.cpp
@@ -47,7 +47,7 @@ _cdtEntry *FetchCdtEntry(uint8 *animFile, uint16 frameNo) {
 
 _frameHeader *FetchFrameHeader(uint8 *animFile, uint16 frameNo) {
 	// required address = (address of the start of the anim header) + frameOffset
-	return (_frameHeader *)(animFile + sizeof(_standardHeader) + (FetchCdtEntry(animFile, frameNo)->frameOffset));
+	return (_frameHeader *)(animFile + sizeof(_standardHeader) + FROM_LE_32(FetchCdtEntry(animFile, frameNo)->frameOffset));
 }
 
 } // End of namespace ICB
diff --git a/engines/icb/text_pc.cpp b/engines/icb/text_pc.cpp
index 764d2afd22c..d4856e7249c 100644
--- a/engines/icb/text_pc.cpp
+++ b/engines/icb/text_pc.cpp
@@ -62,9 +62,9 @@ void Clip_text_print(_rgb *pen, uint32 x, uint32 y, uint8 *base, uint32 pitch, c
 		head = (_frameHeader *)FetchFrameHeader(charSet, (uint16)chr);
 		sprite_data = (uint8 *)(head + 1);
 
-		Render_clip_character(x, y, head->width, head->height, pen, base, pitch, sprite_data);
+		Render_clip_character(x, y, FROM_LE_16(head->width), FROM_LE_16(head->height), pen, base, pitch, sprite_data);
 
-		x += head->width + 1; // move on the x coordinate
+		x += FROM_LE_16(head->width) + 1; // move on the x coordinate
 
 	} while ((ascii[j]) && j < 150);
 }




More information about the Scummvm-git-logs mailing list