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

joostp noreply at scummvm.org
Thu Aug 4 11:49:15 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:
f23d8fddf7 ICB: ELDORADO: implement pose overriding functions


Commit: f23d8fddf7707bc329ae61377116def826c8bcfb
    https://github.com/scummvm/scummvm/commit/f23d8fddf7707bc329ae61377116def826c8bcfb
Author: Joost Peters (joostp at 7fc1.org)
Date: 2022-08-04T13:48:42+02:00

Commit Message:
ICB: ELDORADO: implement pose overriding functions

Changed paths:
    engines/icb/animation_mega_set.cpp
    engines/icb/object_structs.h
    engines/icb/stagedraw_pc_poly.cpp


diff --git a/engines/icb/animation_mega_set.cpp b/engines/icb/animation_mega_set.cpp
index c9c35f82278..ba1b80044c9 100644
--- a/engines/icb/animation_mega_set.cpp
+++ b/engines/icb/animation_mega_set.cpp
@@ -146,7 +146,10 @@ _player_stat player_stat_table[__TOTAL_WEAPONS] = {STOOD, NEW_AIM, CROUCHING, CR
 bool8 crouch_state_table[__TOTAL_WEAPONS] = {FALSE8, FALSE8, TRUE8, TRUE8};
 
 void _vox_image::___init(const char *chr, const char *set, __weapon weapon) {
-// store these things temporarily so we can recall this function when swapping voxel -> polygon and vice verse...
+	// Clear the override pose hash value
+	Cancel_override_pose();
+
+	// store these things temporarily so we can recall this function when swapping voxel -> polygon and vice verse...
 	strcpy(temp_chr, chr);
 	strcpy(temp_set, set);
 	temp_weapon = weapon;
@@ -458,4 +461,41 @@ bool8 _vox_image::Set_palette(const char *pal_name) {
 	return TRUE8;
 }
 
+bool8 _vox_image::Set_override_pose(const char *p_name) {
+	int len = sprintf(override_pose_name, "%s\\pose.rap", p_name);
+
+	if (len > IMAGE_PATH_STR_LEN)
+		Fatal_error("_vox_image::Set_override_pose [%s] string too long", override_pose_name);
+
+	override_pose_hash = HashString(override_pose_name);
+
+	return TRUE8;
+}
+
+bool8 _vox_image::Cancel_override_pose() {
+	override_pose_hash = NULL_HASH;
+	override_pose_name[0] = '\0';
+
+	return TRUE8;
+}
+
+// Async load a file from a character cluster into rs_anims
+// Return 0 - file is not in memory
+// Return 1 - file is in memory
+int _vox_image::Preload_file(const char *file) {
+	char file_name[ENGINE_STRING_LEN];
+	int len = sprintf(file_name, "%s", file);
+
+	if (len > IMAGE_PATH_STR_LEN)
+		Fatal_error("_vox_image::Preload_file [%s] string too long", file_name);
+
+	uint32 fileHash = NULL_HASH;
+
+	// The PC version does not use async loading
+	if (rs_anims->Res_open(file_name, fileHash, base_path, base_path_hash))
+		return 1;
+
+	return 0;
+}
+
 } // End of namespace ICB
diff --git a/engines/icb/object_structs.h b/engines/icb/object_structs.h
index 618290924bb..0ade8d6b6b9 100644
--- a/engines/icb/object_structs.h
+++ b/engines/icb/object_structs.h
@@ -103,9 +103,12 @@ public:
 	bool8 Set_texture(const char *texture_name);
 	bool8 Set_palette(const char *palette_name);
 	bool8 Set_mesh(const char *mesh_name);
+	bool8 Set_override_pose(const char *override_pose_name);
+	bool8 Cancel_override_pose();
 	void Promote_non_generic();
 	int8 IsAnimTable(int32 i);
 	void MakeAnimEntry(int32 i);
+	int Preload_file(const char *file);
 
 	// those hashs in full
 
@@ -117,6 +120,7 @@ public:
 	uint32 palette_hash;     // the name of the palette
 	uint32 texture_hash;     // the name of the texture (which includes a default palette)
 	uint32 pose_hash;        // the name of the ordinary pose/accessory mesh
+	uint32 override_pose_hash; // the name of the pose/accessory mesh overrides the default setting
 	uint32 custom_pose_hash; // the name of the "custom" pose/accessory mesh
 
 	// base path
@@ -152,6 +156,7 @@ public:
 	char palette_name[PALETTE_STR_LEN];
 	char pose_name[ANIM_NAME_STR_LEN];
 	char custom_pose_name[ANIM_NAME_STR_LEN];
+	char override_pose_name[ANIM_NAME_STR_LEN];
 
 	// and so the access functions return the
 	// actual thing
@@ -164,6 +169,7 @@ public:
 	char *get_palette_name() { return palette_name; }
 	char *get_pose_name() { return pose_name; }
 	char *get_custom_pose_name() { return custom_pose_name; }
+	char *get_override_pose_name() { return override_pose_name; }
 
 };
 
diff --git a/engines/icb/stagedraw_pc_poly.cpp b/engines/icb/stagedraw_pc_poly.cpp
index ab72032894f..cc1a1f58696 100644
--- a/engines/icb/stagedraw_pc_poly.cpp
+++ b/engines/icb/stagedraw_pc_poly.cpp
@@ -274,6 +274,12 @@ void drawObjects(SDactor &act, PSXLampList &lamplist, PSXrgb *pAmbient, PSXShade
 		poseName = vox->pose_name;
 		poseHash = vox->pose_hash;
 	}
+	if (vox->override_pose_hash != NULL_HASH) {
+		// If the default pose object has been overriden then it is
+		// vox->override_pose_hash
+		poseName = vox->override_pose_name;
+		poseHash = vox->override_pose_hash;
+	}
 
 	// Load the POSE
 	pose = (RapAPI *)rs_anims->Res_open(poseName, poseHash, vox->base_path, vox->base_path_hash);




More information about the Scummvm-git-logs mailing list