Support for user-specified minimap bounds
The totally-not-a-secret reason I made this branch.
- doomednum 770 (associated with polyobject anchors 760/761 and skybox centerpoint 780)
- Place exactly two in a map to draw an implicit rectangle.
- Supports top-left/bottom-right AND bottom-left/top-right placements.
- I_Errors if you place too many (or only one).
- You don't *have* to have these, this is just a bonus if you're a map like Power Plant or CDSS1 negatively affected by your skybox.
This commit is contained in:
parent
8ed510ca88
commit
b4dcc12e4f
3 changed files with 60 additions and 21 deletions
|
|
@ -730,6 +730,7 @@ _(OVERLAY)
|
|||
_(ANGLEMAN)
|
||||
_(POLYANCHOR)
|
||||
_(POLYSPAWN)
|
||||
_(MINIMAPBOUND)
|
||||
|
||||
// Skybox objects
|
||||
_(SKYBOX)
|
||||
|
|
|
|||
|
|
@ -523,7 +523,6 @@ extern precipmobj_t **precipblocklinks; // special blockmap for precip rendering
|
|||
extern struct minimapinfo
|
||||
{
|
||||
patch_t *minimap_pic;
|
||||
UINT8 mapthingcount;
|
||||
INT32 min_x, min_y;
|
||||
INT32 max_x, max_y;
|
||||
INT32 map_w, map_h;
|
||||
|
|
|
|||
|
|
@ -8138,6 +8138,7 @@ struct minimapinfo minimapinfo;
|
|||
|
||||
static void P_InitMinimapInfo(void)
|
||||
{
|
||||
size_t i, count;
|
||||
fixed_t a;
|
||||
fixed_t b;
|
||||
|
||||
|
|
@ -8145,29 +8146,67 @@ static void P_InitMinimapInfo(void)
|
|||
|
||||
minimapinfo.minimap_pic = mapheaderinfo[gamemap-1]->minimapPic;
|
||||
|
||||
minimapinfo.mapthingcount = 0;
|
||||
// TODO iterate over mapthings to look for possible user-defined bounds
|
||||
minimapinfo.min_x = minimapinfo.max_x = minimapinfo.min_y = minimapinfo.max_y = INT32_MAX;
|
||||
count = 0;
|
||||
for (i = 0; i < nummapthings; i++)
|
||||
{
|
||||
if (mapthings[i].type != mobjinfo[MT_MINIMAPBOUND].doomednum)
|
||||
continue;
|
||||
count++;
|
||||
|
||||
minimapinfo.min_x = bsp->bbox[0][BOXLEFT];
|
||||
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
|
||||
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
|
||||
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
|
||||
if (mapthings[i].x < minimapinfo.min_x)
|
||||
{
|
||||
minimapinfo.max_x = minimapinfo.min_x;
|
||||
minimapinfo.min_x = mapthings[i].x;
|
||||
}
|
||||
else
|
||||
{
|
||||
minimapinfo.max_x = mapthings[i].x;
|
||||
}
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
|
||||
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
|
||||
minimapinfo.max_x = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < minimapinfo.min_y)
|
||||
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
|
||||
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
|
||||
if (mapthings[i].y < minimapinfo.min_y)
|
||||
{
|
||||
minimapinfo.max_y = minimapinfo.min_y;
|
||||
minimapinfo.min_y = mapthings[i].y;
|
||||
}
|
||||
else
|
||||
{
|
||||
minimapinfo.max_y = mapthings[i].y;
|
||||
}
|
||||
}
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minimapinfo.map_w = (minimapinfo.max_x >>= FRACBITS) - (minimapinfo.min_x >>= FRACBITS);
|
||||
minimapinfo.map_h = (minimapinfo.max_y >>= FRACBITS) - (minimapinfo.min_y >>= FRACBITS);
|
||||
if (count == 0)
|
||||
{
|
||||
minimapinfo.min_x = bsp->bbox[0][BOXLEFT];
|
||||
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
|
||||
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
|
||||
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
|
||||
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
|
||||
minimapinfo.max_x = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < minimapinfo.min_y)
|
||||
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
|
||||
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minimapinfo.min_x >>= FRACBITS;
|
||||
minimapinfo.max_x >>= FRACBITS;
|
||||
minimapinfo.min_y >>= FRACBITS;
|
||||
minimapinfo.max_y >>= FRACBITS;
|
||||
}
|
||||
else if (count != 2)
|
||||
{
|
||||
I_Error("P_InitMinimapInfo: Too %s minimap helper objects! (found %s of mapthingnum %d, should have 2)",
|
||||
(count < 2 ? "few" : "many"), sizeu1(count), mobjinfo[MT_MINIMAPBOUND].doomednum);
|
||||
}
|
||||
minimapinfo.map_w = minimapinfo.max_x - minimapinfo.min_x;
|
||||
minimapinfo.map_h = minimapinfo.max_y - minimapinfo.min_y;
|
||||
|
||||
minimapinfo.minimap_w = minimapinfo.minimap_h = 100;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue