View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003122 | FSSCP | HUD | public | 2014-10-05 21:33 | 2015-11-01 19:23 |
Reporter | Yarn | Assigned To | Yarn | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Platform | x64 | OS | Windows 7 | ||
Product Version | 3.7.1 | ||||
Fixed in Version | 3.7.4 | ||||
Summary | 0003122: Scalable head ANIs | ||||
Description | (Posted here at the request of Niffiwan and copied from http://www.hard-light.net/forums/index.php?topic=88439.0 with some modifications.) Anyone who's tried to play the main Wings of Dawn campaign with the Stranded add-on installed knows that the head animation does not fill the head gauge with that setup. This happens because Stranded includes a HUD table that uses a larger head gauge to accommodate Stranded's larger head animations. This inspired me to implement a way to scale head animations, which FSO cannot currently do. The patch that I made is attached. The patch scales head animations to the size specified by either "Animation Background Size" or the new "Animation Size" in the head gauge's hud_gauges.tbl entry. Both parameters do the same thing, but the former is deprecated because it no longer accurately describes its function (and, judging by the rest of the code, it looks like it was always meant to define the animation size anyway). To try it out, use the attached TBM. A larger talking head gauge will be used, and the head animations will be scaled to fit. Alternatively, you can just try the main Wings of Dawn campaign with Stranded installed. (And yes, I did use "Animation Background Size", which I said is deprecated. I did that so the table can also be used with existing builds for comparison purposes.) | ||||
Tags | No tags attached. | ||||
|
ScalableHeadANIs.patch (2,420 bytes)
Index: code/hud/hudmessage.cpp =================================================================== --- code/hud/hudmessage.cpp (revision 11090) +++ code/hud/hudmessage.cpp (working copy) @@ -1227,7 +1227,9 @@ { anim_play_struct aps; - anim_play_init(&aps, anim_data, position[0] + Anim_offsets[0] + fl2i(HUD_offset_x), position[1] + Anim_offsets[1] + fl2i(HUD_offset_y), base_w, base_h); + float scale_x = i2fl(Anim_size[0]) / i2fl(anim_data->width); + float scale_y = i2fl(Anim_size[1]) / i2fl(anim_data->height); + anim_play_init(&aps, anim_data, fl2ir((position[0] + Anim_offsets[0] + HUD_offset_x) / scale_x), fl2ir((position[1] + Anim_offsets[1] + HUD_offset_y) / scale_y), base_w, base_h); aps.start_at = anim_start_frame; // aps.color = &HUD_color_defaults[HUD_color_alpha]; @@ -1261,10 +1263,13 @@ resetClip(); renderBitmap(Head_frame.first_frame, position[0], position[1]); // head ani border - gr_set_screen_scale(base_w, base_h); + float scale_x = i2fl(Anim_size[0]) / i2fl(head_anim->width); + float scale_y = i2fl(Anim_size[1]) / i2fl(head_anim->height); + gr_set_screen_scale(fl2ir(base_w / scale_x), fl2ir(base_h / scale_y)); setGaugeColor(); - generic_anim_render(head_anim,frametime, position[0] + Anim_offsets[0] + fl2i(HUD_offset_x), position[1] + Anim_offsets[1] + fl2i(HUD_offset_y)); + generic_anim_render(head_anim,frametime, fl2ir((position[0] + Anim_offsets[0] + HUD_offset_x) / scale_x), fl2ir((position[1] + Anim_offsets[1] + HUD_offset_y) / scale_y)); // draw title + gr_set_screen_scale(base_w, base_h); renderString(position[0] + Header_offsets[0], position[1] + Header_offsets[1], XSTR("message", 217)); } else { for (int j = 0; j < Num_messages_playing; ++j) { Index: code/hud/hudparse.cpp =================================================================== --- code/hud/hudparse.cpp (revision 11090) +++ code/hud/hudparse.cpp (working copy) @@ -3743,8 +3743,12 @@ stuff_int_list(Anim_offsets, 2); } if(optional_string("Animation Background Size:")) { + mprintf(("Animation Background Size in hud_gauges.tbl and -hdg.tbms is deprecated. Use \"Animation Size\" instead.\n")); stuff_int_list(Anim_size, 2); } + if(optional_string("Animation Size:")) { + stuff_int_list(Anim_size, 2); + } hud_gauge->initAnimOffsets(Anim_offsets[0], Anim_offsets[1]); hud_gauge->initAnimSizes(Anim_size[0], Anim_size[1]); |
|
|
|
Reviewed and merged by niffiwan at github: https://github.com/scp-fs2open/fs2open.github.com/pull/404 |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-10-05 21:33 | Yarn | New Issue | |
2014-10-05 21:33 | Yarn | Status | new => assigned |
2014-10-05 21:33 | Yarn | Assigned To | => Yarn |
2014-10-05 21:33 | Yarn | File Added: ScalableHeadANIs.patch | |
2014-10-05 21:33 | Yarn | Status | assigned => code review |
2014-10-05 21:33 | Yarn | File Added: big_head-hdg.tbm | |
2015-11-01 19:23 | Goober5000 | Note Added: 0016790 | |
2015-11-01 19:23 | Goober5000 | Status | code review => resolved |
2015-11-01 19:23 | Goober5000 | Resolution | open => fixed |
2015-11-01 19:23 | Goober5000 | Fixed in Version | => 3.7.4 |