Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Admiral Nelson on July 10, 2017, 07:11:52 am
-
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.
; #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).
-
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.
-
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:
#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.
-
This has been implemented in PR #1467 (https://github.com/scp-fs2open/fs2open.github.com/pull/1467). To use the feature, add +Exit Button Hotspot Index: after +Mask Bitmap:.
I've also added an entry (http://www.hard-light.net/wiki/index.php/Medals.tbl#.2BExit_Button_Hotspot_Index:) in the wiki.