HUD TARGET for Battle Kiosk, Monitors and Emeralds

Except in Break the Capsules, Boss mode or DUEL mode:

- When Overtime begins, all TARGETs are hidden and the
  Kiosk is targeted instead. Blue colored TARGET.

- TARGET player themself sees TARGETs on emeralds and
  monitors with emeralds inside. TARGET color matches
  emerald.
This commit is contained in:
James R 2023-03-03 21:31:39 -08:00
parent feb70916c1
commit 20fe13deb7
2 changed files with 57 additions and 4 deletions

View file

@ -5,9 +5,11 @@
#include "k_battle.h" #include "k_battle.h"
#include "k_boss.h" #include "k_boss.h"
#include "k_hud.h" #include "k_hud.h"
#include "k_objects.h"
#include "m_fixed.h" #include "m_fixed.h"
#include "p_local.h" #include "p_local.h"
#include "p_mobj.h" #include "p_mobj.h"
#include "r_draw.h"
#include "r_fps.h" #include "r_fps.h"
#include "r_main.h" #include "r_main.h"
#include "st_stuff.h" #include "st_stuff.h"
@ -21,10 +23,40 @@ struct TargetTracking
mobj_t* mobj; mobj_t* mobj;
vector3_t point; vector3_t point;
fixed_t camDist; fixed_t camDist;
skincolornum_t color() const
{
switch (mobj->type)
{
case MT_OVERTIME_CENTER:
return SKINCOLOR_BLUE;
case MT_MONITOR:
case MT_EMERALD:
return static_cast<skincolornum_t>(mobj->color);
default:
return SKINCOLOR_NONE;
}
}
const uint8_t* colormap() const
{
const skincolornum_t clr = color();
if (clr != SKINCOLOR_NONE)
{
return R_GetTranslationColormap(TC_RAINBOW, clr, GTC_CACHE);
}
return nullptr;
}
}; };
void K_DrawTargetTracking(const TargetTracking& target) void K_DrawTargetTracking(const TargetTracking& target)
{ {
const uint8_t* colormap = target.colormap();
trackingResult_t result = {}; trackingResult_t result = {};
int32_t timer = 0; int32_t timer = 0;
@ -175,10 +207,10 @@ void K_DrawTargetTracking(const TargetTracking& target)
if (targetPatch) if (targetPatch)
{ {
V_DrawFixedPatch(targetPos.x, targetPos.y, FRACUNIT, V_SPLITSCREEN, targetPatch, nullptr); V_DrawFixedPatch(targetPos.x, targetPos.y, FRACUNIT, V_SPLITSCREEN, targetPatch, colormap);
} }
V_DrawFixedPatch(arrowPos.x, arrowPos.y, FRACUNIT, V_SPLITSCREEN | arrowFlags, arrowPatch, nullptr); V_DrawFixedPatch(arrowPos.x, arrowPos.y, FRACUNIT, V_SPLITSCREEN | arrowFlags, arrowPatch, colormap);
} }
else else
{ {
@ -207,7 +239,7 @@ void K_DrawTargetTracking(const TargetTracking& target)
FRACUNIT, FRACUNIT,
V_SPLITSCREEN, V_SPLITSCREEN,
patch, patch,
nullptr colormap
); );
}; };
@ -229,7 +261,7 @@ void K_DrawTargetTracking(const TargetTracking& target)
} }
} }
bool is_player_tracking_target(const player_t *player) bool is_player_tracking_target(const player_t *player = stplyr)
{ {
if ((gametyperules & (GTR_BUMPERS|GTR_CLOSERPLAYERS)) != (GTR_BUMPERS|GTR_CLOSERPLAYERS)) if ((gametyperules & (GTR_BUMPERS|GTR_CLOSERPLAYERS)) != (GTR_BUMPERS|GTR_CLOSERPLAYERS))
{ {
@ -253,6 +285,13 @@ bool is_player_tracking_target(const player_t *player)
return player != stplyr; return player != stplyr;
} }
// Except for DUEL mode, Overtime hides all TARGETs except
// the kiosk.
if (battleovertime.enabled)
{
return false;
}
if (g_hiscore < 1) // SOMEONE should be scoring if (g_hiscore < 1) // SOMEONE should be scoring
{ {
return false; return false;
@ -277,6 +316,15 @@ bool is_object_tracking_target(const mobj_t* mobj)
case MT_PLAYER: case MT_PLAYER:
return is_player_tracking_target(mobj->player); return is_player_tracking_target(mobj->player);
case MT_OVERTIME_CENTER:
return inDuel == false && battleovertime.enabled;
case MT_EMERALD:
return is_player_tracking_target();
case MT_MONITOR:
return is_player_tracking_target() && Obj_MonitorGetEmerald(mobj) != 0;
default: default:
return false; return false;
} }

View file

@ -5265,6 +5265,11 @@ static boolean P_IsTrackerType(INT32 type)
case MT_PLAYER: case MT_PLAYER:
return true; return true;
case MT_OVERTIME_CENTER:
case MT_MONITOR:
case MT_EMERALD:
return true;
default: default:
return false; return false;
} }