mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Display up to one Ancient Gear on the minimap
This commit is contained in:
parent
f40138b41d
commit
e52de2de88
4 changed files with 65 additions and 0 deletions
|
|
@ -6292,6 +6292,12 @@ static void K_drawKartMinimap(void)
|
|||
colormap = R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolornum_t>(owner->color), GTC_CACHE);
|
||||
}
|
||||
break;
|
||||
case MT_ANCIENTGEAR:
|
||||
if (mobj == Obj_GetAncientGearMinimapMobj())
|
||||
{
|
||||
workingPic = kp_unknownminimap;
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolornum_t>(K_RainbowColor(leveltime)), GTC_CACHE);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -500,6 +500,7 @@ void Obj_AncientGearSetup(mobj_t *gear, mapthing_t *mt);
|
|||
void Obj_AncientGearLevelInit(void);
|
||||
player_t *Obj_GetAncientGearCollectingPlayer(void);
|
||||
boolean Obj_AllAncientGearsCollected(void);
|
||||
mobj_t *Obj_GetAncientGearMinimapMobj(void);
|
||||
|
||||
void Obj_MushroomHillPolePlayerThink(player_t *player);
|
||||
void Obj_MushroomHillPoleTouch(mobj_t *pole, mobj_t *toucher);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ static UINT32 gearBank = 0;
|
|||
static UINT8 gearBankIndex = 0;
|
||||
static boolean allGearsCollected = false;
|
||||
static player_t *collectingPlayer = NULL;
|
||||
static mobj_t *minimapGear = NULL;
|
||||
|
||||
static void UpdateAncientGearPart(mobj_t *part)
|
||||
{
|
||||
|
|
@ -122,6 +123,11 @@ void Obj_AncientGearPartThink(mobj_t *part)
|
|||
|
||||
void Obj_AncientGearRemoved(mobj_t *gear)
|
||||
{
|
||||
if (gear == minimapGear)
|
||||
{
|
||||
minimapGear = NULL;
|
||||
}
|
||||
|
||||
while (!P_MobjWasRemoved(gear->hnext))
|
||||
{
|
||||
P_RemoveMobj(gear->hnext);
|
||||
|
|
@ -281,6 +287,7 @@ void Obj_AncientGearLevelInit(void)
|
|||
gearBankIndex = 0;
|
||||
numGears = 0;
|
||||
collectingPlayer = NULL;
|
||||
minimapGear = NULL;
|
||||
}
|
||||
|
||||
player_t *Obj_GetAncientGearCollectingPlayer(void)
|
||||
|
|
@ -292,3 +299,53 @@ boolean Obj_AllAncientGearsCollected(void)
|
|||
{
|
||||
return allGearsCollected;
|
||||
}
|
||||
|
||||
mobj_t *Obj_GetAncientGearMinimapMobj(void)
|
||||
{
|
||||
UINT8 lowestTag = UINT8_MAX;
|
||||
UINT8 tag;
|
||||
mobj_t *mobj;
|
||||
|
||||
// no gears in the map? nothing to display
|
||||
if (numGears == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// if a gear is currently being tracked, display it on the minimap
|
||||
if (!P_MobjWasRemoved(minimapGear))
|
||||
{
|
||||
// only display the gear while uncollected,
|
||||
// but keep it tracked so there's some natural delay between when one gear disappears and when the next one is chosen
|
||||
if (minimapGear->health > 0)
|
||||
{
|
||||
return minimapGear;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
minimapGear = NULL;
|
||||
|
||||
// try to find a new gear to track
|
||||
for (mobj = trackercap; mobj; mobj = mobj->itnext)
|
||||
{
|
||||
if (
|
||||
mobj->type != MT_ANCIENTGEAR
|
||||
|| !(mobj->health > 0)
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tag = ((UINT8)(mobj->thing_args[0] - 1)) % MAX_GEARS; // 0 minus 1 wraps around to 31 so that untagged gears are chosen last
|
||||
|
||||
if (tag < lowestTag)
|
||||
{
|
||||
lowestTag = tag;
|
||||
minimapGear = mobj;
|
||||
}
|
||||
}
|
||||
|
||||
// display the tracked gear, if found
|
||||
return minimapGear;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5458,6 +5458,7 @@ static boolean P_IsTrackerType(INT32 type)
|
|||
case MT_SPB:
|
||||
case MT_BATTLECAPSULE:
|
||||
case MT_CDUFO:
|
||||
case MT_ANCIENTGEAR:
|
||||
return true;
|
||||
|
||||
// Players sometimes get targeted with HUD tracking
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue