mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
k_hud_track.cpp: only draw TARGET text in 1P or 2P splitscreen
This commit is contained in:
parent
4adf585590
commit
75c9ee253e
3 changed files with 28 additions and 8 deletions
|
|
@ -177,6 +177,7 @@ static patch_t *kp_trickcool[2];
|
||||||
patch_t *kp_capsuletarget_arrow[2][2];
|
patch_t *kp_capsuletarget_arrow[2][2];
|
||||||
patch_t *kp_capsuletarget_icon[2];
|
patch_t *kp_capsuletarget_icon[2];
|
||||||
patch_t *kp_capsuletarget_far[2];
|
patch_t *kp_capsuletarget_far[2];
|
||||||
|
patch_t *kp_capsuletarget_far_text[2];
|
||||||
patch_t *kp_capsuletarget_near[8];
|
patch_t *kp_capsuletarget_near[8];
|
||||||
|
|
||||||
void K_LoadKartHUDGraphics(void)
|
void K_LoadKartHUDGraphics(void)
|
||||||
|
|
@ -665,6 +666,13 @@ void K_LoadKartHUDGraphics(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprintf(buffer, "HUDCAPDx");
|
||||||
|
for (i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
buffer[7] = '0'+i;
|
||||||
|
HU_UpdatePatch(&kp_capsuletarget_far_text[i], "%s", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(buffer, "HUDCAPCx");
|
sprintf(buffer, "HUDCAPCx");
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ extern patch_t *kp_facehighlight[8];
|
||||||
extern patch_t *kp_capsuletarget_arrow[2][2];
|
extern patch_t *kp_capsuletarget_arrow[2][2];
|
||||||
extern patch_t *kp_capsuletarget_icon[2];
|
extern patch_t *kp_capsuletarget_icon[2];
|
||||||
extern patch_t *kp_capsuletarget_far[2];
|
extern patch_t *kp_capsuletarget_far[2];
|
||||||
|
extern patch_t *kp_capsuletarget_far_text[2];
|
||||||
extern patch_t *kp_capsuletarget_near[8];
|
extern patch_t *kp_capsuletarget_near[8];
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,6 @@ void K_DrawTargetTracking(const TargetTracking& target)
|
||||||
const fixed_t farDistance = 1280 * mapobjectscale;
|
const fixed_t farDistance = 1280 * mapobjectscale;
|
||||||
bool useNear = (target.camDist < farDistance);
|
bool useNear = (target.camDist < farDistance);
|
||||||
|
|
||||||
patch_t* targetPatch = nullptr;
|
|
||||||
vector2_t targetPos = {};
|
vector2_t targetPos = {};
|
||||||
|
|
||||||
bool visible = P_CheckSight(stplyr->mo, target.mobj);
|
bool visible = P_CheckSight(stplyr->mo, target.mobj);
|
||||||
|
|
@ -188,21 +187,33 @@ void K_DrawTargetTracking(const TargetTracking& target)
|
||||||
targetPos.x = result.x;
|
targetPos.x = result.x;
|
||||||
targetPos.y = result.y;
|
targetPos.y = result.y;
|
||||||
|
|
||||||
|
auto draw = [&](patch_t* patch)
|
||||||
|
{
|
||||||
|
V_DrawFixedPatch(
|
||||||
|
targetPos.x - ((patch->width << FRACBITS) >> 1),
|
||||||
|
targetPos.y - ((patch->height << FRACBITS) >> 1),
|
||||||
|
FRACUNIT,
|
||||||
|
V_SPLITSCREEN,
|
||||||
|
patch,
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
if (useNear == true)
|
if (useNear == true)
|
||||||
{
|
{
|
||||||
timer = (leveltime / 2);
|
timer = (leveltime / 2);
|
||||||
targetPatch = kp_capsuletarget_near[timer % 8];
|
draw(kp_capsuletarget_near[timer % 8]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
timer = (leveltime / 3);
|
timer = (leveltime / 3);
|
||||||
targetPatch = kp_capsuletarget_far[timer & 1];
|
draw(kp_capsuletarget_far[timer & 1]);
|
||||||
|
|
||||||
|
if (r_splitscreen <= 1)
|
||||||
|
{
|
||||||
|
draw(kp_capsuletarget_far_text[timer & 1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
targetPos.x -= (targetPatch->width << FRACBITS) >> 1;
|
|
||||||
targetPos.y -= (targetPatch->height << FRACBITS) >> 1;
|
|
||||||
|
|
||||||
V_DrawFixedPatch(targetPos.x, targetPos.y, FRACUNIT, V_SPLITSCREEN, targetPatch, nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue