View Issue Details

IDProjectCategoryView StatusLast Update
0002214FSSCPHUDpublic2010-06-07 07:01
ReporterFSF Assigned To 
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.12 RC2 
Fixed in Version3.6.13 
Summary0002214: Assertion for 2-frame 2_toparc2.ani
DescriptionWhen using a 2_toparc2.ani (the thing that flashes when someone is firing on you) of 2 frames (haven't tested with other numbers), debug gives an assertion error (bmpman.cpp, line 1049).
It should probably just be able to use those anis (2_toparc3, the missile indicator, probably causes the same error), or give an error "please use a 3-frame ani for that".
Additional InformationUnpack the attached file into \data\, play mission aniHUD.fs2. As soon as the Basilisk fires on you, you'll get the error.
TagsNo tags attached.

Activities

2010-06-01 13:51

 

Test_HUD_ani.zip (2,060 bytes)

The_E

2010-06-01 16:35

administrator   ~0012035

Okay, seems like the code was built on the assumption that those anis would only ever be just 3 frames long.

Attached is a patch that effectively allows anis with at least two frames to be used.

2010-06-01 16:35

 

hudframes.patch (1,868 bytes)   
Index: hud/hudreticle.cpp
===================================================================
--- hud/hudreticle.cpp	(revision 6150)
+++ hud/hudreticle.cpp	(working copy)
@@ -585,8 +585,13 @@
 // threat exists, and draw flashing frames.
 void hud_show_lock_threat()
 {
-	int frame_offset;
+	int frame_offset, num_frames;
 
+	//Let's find out how many frames our ani has, and adjust accordingly
+	num_frames = Reticle_gauges[RETICLE_LOCK_WARN].num_frames;
+	//We need at least two frames here
+	Assert( num_frames >= 2 );
+
 	if ( Player->threat_flags & (THREAT_LOCK | THREAT_ATTEMPT_LOCK) ) {
 		if ( timestamp_elapsed(Threat_lock_timer) ) {
 			if ( Player->threat_flags & THREAT_LOCK )  {
@@ -595,7 +600,7 @@
 				Threat_lock_timer = timestamp(THREAT_LOCK_FLASH);
 			}
 			Threat_lock_frame++;
-			if ( Threat_lock_frame > 2 ) {
+			if ( Threat_lock_frame > (num_frames - 1) ) { //The first frame being the default "off" setting, we need to cycle through all the other frames
 				Threat_lock_frame = 1;
 			}
 			if ( (Threat_lock_frame == 2) && (Player->threat_flags & THREAT_ATTEMPT_LOCK ) ) {
@@ -633,13 +638,18 @@
 // threat exists, and draw flashing frames.
 void hud_show_dumbfire_threat()
 {
-	int frame_offset;
+	int frame_offset, num_frames;
 
+	//Check how many frames the ani actually has
+	num_frames = Reticle_gauges[RETICLE_LASER_WARN].num_frames;
+	//We need at least two frames here
+	Assert( num_frames >= 2 );
+
 	if ( Player->threat_flags & THREAT_DUMBFIRE ) {
 		if ( timestamp_elapsed(Threat_dumbfire_timer) ) {
 			Threat_dumbfire_timer = timestamp(THREAT_DUMBFIRE_FLASH);
 			Threat_dumbfire_frame++;
-			if ( Threat_dumbfire_frame > 2 ) {
+			if ( Threat_dumbfire_frame > (num_frames - 1) ) { //The first frame being the default "off" setting, we need to cycle through all the other frames
 				Threat_dumbfire_frame = 1;
 			}
 		}
hudframes.patch (1,868 bytes)   

The_E

2010-06-02 11:49

administrator   ~0012036

Committed to trunk in revision 6153

Goober5000

2010-06-07 07:01

administrator   ~0012049

Patch also added to 3.6.12. Resolving as fixed.

Issue History

Date Modified Username Field Change
2010-06-01 13:51 FSF New Issue
2010-06-01 13:51 FSF File Added: Test_HUD_ani.zip
2010-06-01 16:35 The_E Note Added: 0012035
2010-06-01 16:35 The_E File Added: hudframes.patch
2010-06-02 11:49 The_E Note Added: 0012036
2010-06-07 07:01 Goober5000 Note Added: 0012049
2010-06-07 07:01 Goober5000 Status new => resolved
2010-06-07 07:01 Goober5000 Resolution open => fixed
2010-06-07 07:01 Goober5000 Fixed in Version => 3.6.13