Author Topic: Medals Limit Oddity  (Read 406 times)

0 Members and 1 Guest are viewing this topic.

Online Admiral Nelson

  • Resurrecter of Campaigns
  • 211
  • The GTA expects that every man will do his duty.
Medals Limit Oddity
Although it is true that one can have more medals in current FSO builds than with retail, there is one oddity which I haven't seen documented.

FSO uses color indexed mask files in its interface.  In the case of the medals screen, the mask uses colors starting from rgb 255/255/255 used for the first medal appearing in medals.tbl, with the color index decrementing by one for each additional medal.  However, FSO reserves the RGB color index 237/237/237 for the close screen button (a fact undocumented anywhere I could find).  If one wants to create more medals than exist in retail, one therefore needs to create a placeholder "medal" entry in medals.tbl in the right place so that no actual medal is assigned to color 237, as in this snippet.

Code: [Select]
; #3
$Name:          Flight Training
$Bitmap:        ribbon_training.dds
+Position 1024: 563,256
+Debriefing Bitmap: Debriefmedal07.dds
$Num mods:      1

; phony medal here to stand in for the close button
; the close button is hard coded to occupy this slot
$Name:          Exit Button
$Bitmap:        ribbon_combat_action.dds
+Position 640: 463,256
+Position 1024: 914,659
+Debriefing Bitmap: Debriefmedal08.dds
$Num mods:      1

; #2
$Name:          Combat Action Medal
$Bitmap:        ribbon_combat_action.dds
+Position 640: 463,256
+Position 1024: 463,256
+Debriefing Bitmap: Debriefmedal08.dds
$Num mods:      1

Is this actually the intended behavior of the medals table?  One would think that FSO would use the color index (255-Total number of medals-1) for the close button and not a hard coded value.  At the very least the medals.tbl wiki should be updated with this information (which I am happy to do).
« Last Edit: July 10, 2017, 05:01:45 pm by Admiral Nelson »
If a man consults whether he is to fight, when he has the power in his own hands, it is certain that his opinion is against fighting.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 418, Cutscenes: 8, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: Medals Limit Oddity
Well that's certainly interesting. Honestly, I think an easier solution would be to allow us to specify the color index in the medals.tbl for each medal. If not there, default to retail behavior.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
Re: Medals Limit Oddity
To be pedantic, the hotspot index isn't the RGB color index, but rather the index in the PCX 256-color palette.  It just so happens that these are almost always the same.  (The reason I discovered this is that I ran across a mask file that didn't follow that convention.)

But I found it; the offset is indeed hardcoded:

Code: [Select]
#define MEDALS_NUM_BUTTONS 1
#define MEDALS_EXIT 0
ui_button_info Medals_buttons[GR_NUM_RESOLUTIONS][MEDALS_NUM_BUTTONS] = {
{ // GR_640
ui_button_info("MEB_18", 574, 432, -1, -1, 18),
},
{ // GR_1024
ui_button_info("2_MEB_18", 919, 691, -1, -1, 18),
}
};

That number 18 is the hotspot: 255 - 18 = 237.

It shouldn't be too hard to add a feature that allows you to specify the close button's index in medals.tbl.

 

Offline Goober5000

  • HLP Loremaster
  • Administrator
  • 214
    • Goober5000 Productions
This has been implemented in PR #1467.  To use the feature, add +Exit Button Hotspot Index: after +Mask Bitmap:.

I've also added an entry in the wiki.