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.