mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 20:41:46 +00:00
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
223531ffce
commit
6a723cff58
5 changed files with 88 additions and 21 deletions
|
|
@ -5273,6 +5273,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
|
||||||
"MT_ANGLEMAN",
|
"MT_ANGLEMAN",
|
||||||
"MT_POLYANCHOR",
|
"MT_POLYANCHOR",
|
||||||
"MT_POLYSPAWN",
|
"MT_POLYSPAWN",
|
||||||
|
"MT_MINIMAPBOUND",
|
||||||
|
|
||||||
// Skybox objects
|
// Skybox objects
|
||||||
"MT_SKYBOX",
|
"MT_SKYBOX",
|
||||||
|
|
|
||||||
27
src/info.c
27
src/info.c
|
|
@ -21497,6 +21497,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||||
S_NULL // raisestate
|
S_NULL // raisestate
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ // MT_MINIMAPBOUND
|
||||||
|
770, // doomednum
|
||||||
|
S_INVISIBLE, // spawnstate
|
||||||
|
1000, // spawnhealth
|
||||||
|
S_NULL, // seestate
|
||||||
|
sfx_None, // seesound
|
||||||
|
8, // reactiontime
|
||||||
|
sfx_None, // attacksound
|
||||||
|
S_NULL, // painstate
|
||||||
|
0, // painchance
|
||||||
|
sfx_None, // painsound
|
||||||
|
S_NULL, // meleestate
|
||||||
|
S_NULL, // missilestate
|
||||||
|
S_NULL, // deathstate
|
||||||
|
S_NULL, // xdeathstate
|
||||||
|
sfx_None, // deathsound
|
||||||
|
0, // speed
|
||||||
|
12*FRACUNIT, // radius
|
||||||
|
24*FRACUNIT, // height
|
||||||
|
0, // display offset
|
||||||
|
10, // mass
|
||||||
|
0, // damage
|
||||||
|
sfx_None, // activesound
|
||||||
|
MF_SCENERY|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags
|
||||||
|
S_NULL // raisestate
|
||||||
|
},
|
||||||
|
|
||||||
{ // MT_SKYBOX
|
{ // MT_SKYBOX
|
||||||
780, // doomednum
|
780, // doomednum
|
||||||
S_INVISIBLE, // spawnstate
|
S_INVISIBLE, // spawnstate
|
||||||
|
|
|
||||||
|
|
@ -6340,6 +6340,7 @@ typedef enum mobj_type
|
||||||
MT_ANGLEMAN,
|
MT_ANGLEMAN,
|
||||||
MT_POLYANCHOR,
|
MT_POLYANCHOR,
|
||||||
MT_POLYSPAWN,
|
MT_POLYSPAWN,
|
||||||
|
MT_MINIMAPBOUND,
|
||||||
|
|
||||||
// Skybox objects
|
// Skybox objects
|
||||||
MT_SKYBOX,
|
MT_SKYBOX,
|
||||||
|
|
|
||||||
|
|
@ -507,7 +507,6 @@ extern mobj_t **blocklinks; // for thing chains
|
||||||
extern struct minimapinfo
|
extern struct minimapinfo
|
||||||
{
|
{
|
||||||
patch_t *minimap_pic;
|
patch_t *minimap_pic;
|
||||||
UINT8 mapthingcount;
|
|
||||||
INT32 min_x, min_y;
|
INT32 min_x, min_y;
|
||||||
INT32 max_x, max_y;
|
INT32 max_x, max_y;
|
||||||
INT32 map_w, map_h;
|
INT32 map_w, map_h;
|
||||||
|
|
|
||||||
|
|
@ -7349,6 +7349,7 @@ struct minimapinfo minimapinfo;
|
||||||
|
|
||||||
static void P_InitMinimapInfo(void)
|
static void P_InitMinimapInfo(void)
|
||||||
{
|
{
|
||||||
|
size_t i, count;
|
||||||
fixed_t a;
|
fixed_t a;
|
||||||
fixed_t b;
|
fixed_t b;
|
||||||
|
|
||||||
|
|
@ -7356,29 +7357,67 @@ static void P_InitMinimapInfo(void)
|
||||||
|
|
||||||
minimapinfo.minimap_pic = mapheaderinfo[gamemap-1]->minimapPic;
|
minimapinfo.minimap_pic = mapheaderinfo[gamemap-1]->minimapPic;
|
||||||
|
|
||||||
minimapinfo.mapthingcount = 0;
|
minimapinfo.min_x = minimapinfo.max_x = minimapinfo.min_y = minimapinfo.max_y = INT32_MAX;
|
||||||
// TODO iterate over mapthings to look for possible user-defined bounds
|
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];
|
if (mapthings[i].x < minimapinfo.min_x)
|
||||||
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
|
{
|
||||||
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
|
minimapinfo.max_x = minimapinfo.min_x;
|
||||||
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
|
minimapinfo.min_x = mapthings[i].x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
minimapinfo.max_x = mapthings[i].x;
|
||||||
|
}
|
||||||
|
|
||||||
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
|
if (mapthings[i].y < minimapinfo.min_y)
|
||||||
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
|
{
|
||||||
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
|
minimapinfo.max_y = minimapinfo.min_y;
|
||||||
minimapinfo.max_x = bsp->bbox[1][BOXRIGHT];
|
minimapinfo.min_y = mapthings[i].y;
|
||||||
if (bsp->bbox[1][BOXBOTTOM] < minimapinfo.min_y)
|
}
|
||||||
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
|
else
|
||||||
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
|
{
|
||||||
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
|
minimapinfo.max_y = mapthings[i].y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// You might be wondering why these are being bitshift here
|
if (count == 0)
|
||||||
// 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
|
minimapinfo.min_x = bsp->bbox[0][BOXLEFT];
|
||||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
|
||||||
minimapinfo.map_w = (minimapinfo.max_x >>= FRACBITS) - (minimapinfo.min_x >>= FRACBITS);
|
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
|
||||||
minimapinfo.map_h = (minimapinfo.max_y >>= FRACBITS) - (minimapinfo.min_y >>= FRACBITS);
|
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;
|
minimapinfo.minimap_w = minimapinfo.minimap_h = 100;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue