View Issue Details

IDProjectCategoryView StatusLast Update
0002846FSSCPuser interfacepublic2013-04-30 07:10
ReporterYarn Assigned Tom_m  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx64OSWindows 7 
Product Version3.6.18 
Target Version3.7.0 
Summary0002846: Problems with mission loop animations
DescriptionI noticed two problems with animations on the mission loop screen:

1: Animations appear to be cropped at higher resolutions; I've attached a screenshot of what this looks like. It appears that only the part of the animation that occupies the top 768 height pixels is actually displayed; the rest is cropped off.

2: The 2_ variants of animations are never used on the mission loop screen.
Steps To ReproduceMake sure that you load the MediaVPs and that the high-resolution CB animations are installed. Start the game in a sufficiently high resolution, such as 1440x900. Load the attached campaign and warp out after the first mission starts. The mission loop screen should appear after the debriefing. When it does, notice how the animation looks cropped. Also notice that the animation is the low-resolution version, even though the high-resolution version should be used here at this resolution.
Additional InformationThe first problem was introduced with revision 6833, the Antipodes 7 merge. As for the second problem, it looks like that feature was never implemented for this screen.
TagsNo tags attached.

Activities

Yarn

2013-04-18 06:08

developer  

LoopScreen.jpg (159,761 bytes)   
LoopScreen.jpg (159,761 bytes)   

Yarn

2013-04-18 06:08

developer  

looptest.zip (5,096 bytes)

m_m

2013-04-20 19:22

developer   ~0014936

I have uploaded a patch which should fix the described issue.

m_m

2013-04-20 19:22

developer  

mantis2846.patch (4,279 bytes)   
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp	(revision 9638)
+++ code/freespace2/freespace.cpp	(working copy)
@@ -6675,7 +6675,7 @@
 
 		case GS_STATE_LOOP_BRIEF:
 			game_set_frametime(GS_STATE_LOOP_BRIEF);
-			loop_brief_do();
+			loop_brief_do(flFrametime);
 			break;
 
 		case GS_STATE_FICTION_VIEWER:
Index: code/missionui/missionloopbrief.cpp
===================================================================
--- code/missionui/missionloopbrief.cpp	(revision 9638)
+++ code/missionui/missionloopbrief.cpp	(working copy)
@@ -23,6 +23,7 @@
 #include "sound/fsspeech.h"
 #include "popup/popup.h"
 
+#include "graphics/generic.h"
 
 
 // ---------------------------------------------------------------------------------------------------------------------------------------
@@ -65,13 +66,15 @@
 	}
 };
 
-// loop brief anim
-int Loop_brief_anim_coords[GR_NUM_RESOLUTIONS][2] = {
-	{ // GR_640
-		24, 267
+// Originally from missioncmdbrief.cpp
+// center coordinates only
+int Loop_brief_anim_center_coords[GR_NUM_RESOLUTIONS][2] =
+{
+	{
+		242, 367				// GR_640
 	},
-	{ // GR_640
-		167, 491
+	{
+		392, 587				// GR_1024
 	}
 };
 
@@ -88,8 +91,7 @@
 UI_WINDOW Loop_brief_window;
 int Loop_brief_bitmap;
 
-anim *Loop_anim;
-anim_instance *Loop_anim_instance;
+generic_anim Loop_anim;
 
 int Loop_sound;
 
@@ -147,24 +149,22 @@
 		Loop_brief_window.add_XSTR(&Loop_text[gr_screen.res][idx]);
 	}
 
+	const char* anim_name;
 	// load animation if any
-	Loop_anim = NULL;
-	Loop_anim_instance = NULL;
 	if(Campaign.missions[Campaign.current_mission].mission_branch_brief_anim != NULL){
-		Loop_anim = anim_load(Campaign.missions[Campaign.current_mission].mission_branch_brief_anim);
+		anim_name = Campaign.missions[Campaign.current_mission].mission_branch_brief_anim;
 	} else {
-		Loop_anim = anim_load("CB_default");
+		anim_name = "CB_default";
 	}
 
-	// fire up an anim instance
-	if(Loop_anim != NULL){
-		anim_play_struct aps;
-
-		anim_play_init(&aps, Loop_anim, Loop_brief_anim_coords[gr_screen.res][0], Loop_brief_anim_coords[gr_screen.res][1]);
-		aps.framerate_independent = 1;
-		aps.looped = 1;
-		aps.screen_id = GS_STATE_LOOP_BRIEF;
-		Loop_anim_instance = anim_play(&aps);
+	int stream_result = generic_anim_init_and_stream(&Loop_anim, anim_name, bm_get_type(Loop_brief_bitmap), true);
+	// we've failed to load any animation
+	if (stream_result < 0) {
+		// load an image and treat it like a 1 frame animation
+		Loop_anim.first_frame = bm_load(anim_name);	//if we fail here, the value is still -1
+		if(Loop_anim.first_frame != -1) {
+			Loop_anim.num_frames = 1;
+		}
 	}
 
 	// init brief text
@@ -196,7 +196,7 @@
 }
 
 // do
-void loop_brief_do()
+void loop_brief_do(float frametime)
 {
 	int k;
 	int idx;
@@ -245,7 +245,17 @@
 
 	// render the briefing text
 	brief_render_text(0, Loop_brief_text_coords[gr_screen.res][0], Loop_brief_text_coords[gr_screen.res][1], Loop_brief_text_coords[gr_screen.res][3], flFrametime);
+	
+	if(Loop_anim.num_frames > 0) {
+		int x;
+		int y;
 
+		bm_get_info((Loop_anim.streaming) ? Loop_anim.bitmap_id : Loop_anim.first_frame, &x, &y, NULL, NULL, NULL);
+		x = Loop_brief_anim_center_coords[gr_screen.res][0] - x / 2;
+		y = Loop_brief_anim_center_coords[gr_screen.res][1] - y / 2;
+		generic_anim_render(&Loop_anim, frametime, x, y);
+	}
+
 	// render all anims
 	anim_render_all(GS_STATE_LOOP_BRIEF, flFrametime);
 
@@ -267,15 +277,10 @@
 	// destroy the window
 	Loop_brief_window.destroy();
 
-	// free up anim stuff
-	if(Loop_anim_instance != NULL){
-		anim_release_render_instance(Loop_anim_instance);
-		Loop_anim_instance = NULL;
+	if (Loop_anim.num_frames > 0)
+	{
+		generic_anim_unload(&Loop_anim);
 	}
-	if(Loop_anim != NULL){
-		anim_free(Loop_anim);
-		Loop_anim = NULL;
-	}
 
 	// stop voice
 	if(Loop_sound != -1){
Index: code/missionui/missionloopbrief.h
===================================================================
--- code/missionui/missionloopbrief.h	(revision 9638)
+++ code/missionui/missionloopbrief.h	(working copy)
@@ -25,7 +25,7 @@
 void loop_brief_init();
 
 // do
-void loop_brief_do();
+void loop_brief_do(float frametime);
 
 // close
 void loop_brief_close();
mantis2846.patch (4,279 bytes)   

Yarn

2013-04-20 23:11

developer   ~0014937

That patch fixed both problems for me.

m_m

2013-04-21 07:16

developer   ~0014940

Good, I'll wait for a review by a coder until I commit this to trunk.
I guess this should also go into 3.7.0 but it seems that I'm not able to change the target version.

Zacam

2013-04-30 07:03

administrator   ~0014990

I don't happen to see anything glaringly obvious and it does do as advertised with the provided data.

m_m

2013-04-30 07:10

developer   ~0014991

Fix committed to trunk@9661.

Related Changesets

fs2open: trunk r9661

2013-04-30 04:02

m_m


Ported: N/A

Details Diff
Fix for Mantis 2846: Problems with mission loop animations Affected Issues
0002846
mod - /trunk/fs2_open/code/freespace2/freespace.cpp Diff File
mod - /trunk/fs2_open/code/missionui/missionloopbrief.cpp Diff File
mod - /trunk/fs2_open/code/missionui/missionloopbrief.h Diff File

Issue History

Date Modified Username Field Change
2013-04-18 06:08 Yarn New Issue
2013-04-18 06:08 Yarn File Added: LoopScreen.jpg
2013-04-18 06:08 Yarn File Added: looptest.zip
2013-04-20 19:22 m_m Note Added: 0014936
2013-04-20 19:22 m_m File Added: mantis2846.patch
2013-04-20 19:22 m_m Assigned To => m_m
2013-04-20 19:22 m_m Status new => code review
2013-04-20 23:11 Yarn Note Added: 0014937
2013-04-21 07:16 m_m Note Added: 0014940
2013-04-21 09:06 niffiwan Target Version => 3.7.0
2013-04-30 07:03 Zacam Note Added: 0014990
2013-04-30 07:10 m_m Changeset attached => fs2open trunk r9661
2013-04-30 07:10 m_m Note Added: 0014991
2013-04-30 07:10 m_m Status code review => resolved
2013-04-30 07:10 m_m Resolution open => fixed