diff --git a/src/doomstat.h b/src/doomstat.h index 18bf1dd15..33c200dbf 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -699,7 +699,6 @@ extern UINT8 gamespeed; extern boolean franticitems; extern boolean encoremode, prevencoremode; -extern UINT32 g_hiscore; extern tic_t wantedcalcdelay; extern tic_t itemCooldowns[NUMKARTITEMS - 1]; extern tic_t mapreset; diff --git a/src/g_game.c b/src/g_game.c index c0b4892d2..6b2af2c5d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -302,7 +302,6 @@ SINT8 votes[MAXPLAYERS]; // Each player's vote SINT8 pickedvote; // What vote the host rolls // Server-sided, synched variables -UINT32 g_hiscore; // Highest score (points) achieved by anyone in game tic_t wantedcalcdelay; // Time before it recalculates WANTED tic_t itemCooldowns[NUMKARTITEMS - 1]; // Cooldowns to prevent item spawning tic_t mapreset; // Map reset delay when enough players have joined an empty game diff --git a/src/k_battle.c b/src/k_battle.c index 4266d6981..9444dd78b 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -92,7 +92,6 @@ void K_CheckBumpers(void) { UINT8 i; UINT8 numingame = 0; - UINT32 toproundscore = 0; UINT8 nobumpers = 0; if (!(gametyperules & GTR_BUMPERS)) @@ -111,11 +110,6 @@ void K_CheckBumpers(void) numingame++; - if (players[i].roundscore > toproundscore) - { - toproundscore = players[i].roundscore; - } - if (players[i].bumpers <= 0) // if you don't have any bumpers, you're probably not a winner { nobumpers++; @@ -138,10 +132,6 @@ void K_CheckBumpers(void) } return; } - else - { - g_hiscore = toproundscore; - } if (numingame <= 1) { diff --git a/src/k_hud_track.cpp b/src/k_hud_track.cpp index dbb5ce8d0..d16de57fd 100644 --- a/src/k_hud_track.cpp +++ b/src/k_hud_track.cpp @@ -2,17 +2,23 @@ #include #include +#include "core/static_vec.hpp" + #include "k_battle.h" #include "k_boss.h" #include "k_hud.h" +#include "k_objects.h" #include "m_fixed.h" #include "p_local.h" #include "p_mobj.h" +#include "r_draw.h" #include "r_fps.h" #include "r_main.h" #include "st_stuff.h" #include "v_video.h" +using namespace srb2; + namespace { @@ -21,10 +27,82 @@ struct TargetTracking mobj_t* mobj; vector3_t point; 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(mobj->color); + + case MT_PLAYER: + return player_emeralds_color(); + + default: + return SKINCOLOR_NONE; + } + } + + StaticVec player_emeralds_vec() const + { + StaticVec emeralds; + + const player_t* player = mobj->player; + + if (player == nullptr) + { + return emeralds; + } + + for (int i = 0; i < 7; ++i) + { + const uint32_t emeraldFlag = (1U << i); + + if (player->emeralds & emeraldFlag) + { + emeralds.push_back(emeraldFlag); + } + } + + return emeralds; + } + + skincolornum_t player_emeralds_color() const + { + const StaticVec emeralds = player_emeralds_vec(); + + if (emeralds.empty()) + { + return SKINCOLOR_NONE; + } + + constexpr tic_t kPeriod = TICRATE / 2; + const int idx = (leveltime / kPeriod) % emeralds.size(); + + return static_cast(K_GetChaosEmeraldColor(emeralds[idx])); + } + + 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) { + const uint8_t* colormap = target.colormap(); + trackingResult_t result = {}; int32_t timer = 0; @@ -175,10 +253,10 @@ void K_DrawTargetTracking(const TargetTracking& target) 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 { @@ -207,7 +285,7 @@ void K_DrawTargetTracking(const TargetTracking& target) FRACUNIT, V_SPLITSCREEN, patch, - nullptr + colormap ); }; @@ -229,7 +307,7 @@ void K_DrawTargetTracking(const TargetTracking& target) } } -bool is_player_tracking_target(const player_t *player) +bool is_player_tracking_target(player_t *player = stplyr) { if ((gametyperules & (GTR_BUMPERS|GTR_CLOSERPLAYERS)) != (GTR_BUMPERS|GTR_CLOSERPLAYERS)) { @@ -253,17 +331,14 @@ bool is_player_tracking_target(const player_t *player) return player != stplyr; } - if (g_hiscore < 1) // SOMEONE should be scoring + // Except for DUEL mode, Overtime hides all TARGETs except + // the kiosk. + if (battleovertime.enabled) { return false; } - if (player->roundscore < g_hiscore) - { - return false; - } - - return true; + return K_IsPlayerWanted(player); } bool is_object_tracking_target(const mobj_t* mobj) @@ -277,6 +352,15 @@ bool is_object_tracking_target(const mobj_t* mobj) case MT_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: return false; } diff --git a/src/p_mobj.c b/src/p_mobj.c index aeeb93d2e..6bd6cbd79 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5268,6 +5268,11 @@ static boolean P_IsTrackerType(INT32 type) case MT_PLAYER: return true; + case MT_OVERTIME_CENTER: + case MT_MONITOR: + case MT_EMERALD: + return true; + default: return false; } @@ -6389,6 +6394,7 @@ static void P_MobjSceneryThink(mobj_t *mobj) numx->destscale = scale; } +#if 0 if (K_IsPlayerWanted(mobj->target->player) && mobj->movecount != 1) { mobj_t *wanted = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_PLAYERWANTED); @@ -6399,6 +6405,7 @@ static void P_MobjSceneryThink(mobj_t *mobj) mobj->movecount = 1; } else if (!K_IsPlayerWanted(mobj->target->player)) +#endif mobj->movecount = 0; } else diff --git a/src/p_saveg.c b/src/p_saveg.c index 24b1326ea..e0db5fdb0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -5008,8 +5008,6 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending) WRITESINT8(save->p, speedscramble); WRITESINT8(save->p, encorescramble); - WRITEUINT32(save->p, g_hiscore); - // battleovertime_t WRITEUINT16(save->p, battleovertime.enabled); WRITEFIXED(save->p, battleovertime.radius); @@ -5179,8 +5177,6 @@ static inline boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading) speedscramble = READSINT8(save->p); encorescramble = READSINT8(save->p); - g_hiscore = READUINT32(save->p); - // battleovertime_t battleovertime.enabled = READUINT16(save->p); battleovertime.radius = READFIXED(save->p); diff --git a/src/p_setup.c b/src/p_setup.c index d0cc73d6f..2ef614d48 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7115,8 +7115,6 @@ static void P_InitLevelSettings(void) franticitems = (boolean)cv_kartfrantic.value; } - g_hiscore = 0; - memset(&battleovertime, 0, sizeof(struct battleovertime)); speedscramble = encorescramble = -1;