Merge branch 'first-person-improvements' into 'master'

First person fixes and tweaks

Closes #180 and #179

See merge request KartKrew/RingRacers!71
This commit is contained in:
Eidolon 2025-02-14 04:13:44 +00:00
commit c192f13d5d
3 changed files with 40 additions and 19 deletions

View file

@ -3859,7 +3859,7 @@ static void K_DrawNameTagItemSpy(INT32 x, INT32 y, player_t *p, INT32 flags)
flip = P_MobjFlip(p->mo); flip = P_MobjFlip(p->mo);
flipboxoffset = 8; flipboxoffset = 8;
} }
Draw bar = Draw(x, y).flags(V_NOSCALESTART|flags); Draw bar = Draw(x, y).flags(V_NOSCALESTART|flags);
Draw box = tiny ? bar.xy(-22 * vid.dupx, (-17+flipboxoffset) * vid.dupy) : bar.xy(-40 * vid.dupx, (-26+flipboxoffset) * vid.dupy); Draw box = tiny ? bar.xy(-22 * vid.dupx, (-17+flipboxoffset) * vid.dupy) : bar.xy(-40 * vid.dupx, (-26+flipboxoffset) * vid.dupy);
@ -4029,8 +4029,8 @@ playertagtype_t K_WhichPlayerTag(player_t *p)
void K_DrawPlayerTag(fixed_t x, fixed_t y, player_t *p, playertagtype_t type, boolean foreground) void K_DrawPlayerTag(fixed_t x, fixed_t y, player_t *p, playertagtype_t type, boolean foreground)
{ {
INT32 flags = P_IsObjectFlipped(p->mo) ? V_VFLIP : 0; INT32 flags = P_IsObjectFlipped(p->mo) ? V_VFLIP : 0;
switch (type) switch (type)
{ {
case PLAYERTAG_LOCAL: case PLAYERTAG_LOCAL:
@ -4261,13 +4261,13 @@ static void K_drawKartProgressionMinimapIcon(UINT32 distancetofinish, INT32 hudx
position_t K_GetKartObjectPosToMinimapPos(fixed_t objx, fixed_t objy) position_t K_GetKartObjectPosToMinimapPos(fixed_t objx, fixed_t objy)
{ {
fixed_t amnumxpos, amnumypos; fixed_t amnumxpos, amnumypos;
amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x); amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y); amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y);
if (encoremode) if (encoremode)
amnumxpos = -amnumxpos; amnumxpos = -amnumxpos;
return (position_t){amnumxpos, amnumypos}; return (position_t){amnumxpos, amnumypos};
} }
@ -4279,10 +4279,10 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32
// am xpos & ypos are the icon's starting position. Withouht // am xpos & ypos are the icon's starting position. Withouht
// it, they wouldn't 'spawn' on the top-right side of the HUD. // it, they wouldn't 'spawn' on the top-right side of the HUD.
position_t amnumpos; position_t amnumpos;
INT32 amxpos, amypos; INT32 amxpos, amypos;
amnumpos = K_GetKartObjectPosToMinimapPos(objx, objy); amnumpos = K_GetKartObjectPosToMinimapPos(objx, objy);
amxpos = amnumpos.x + ((hudx - (SHORT(icon->width))/2)<<FRACBITS); amxpos = amnumpos.x + ((hudx - (SHORT(icon->width))/2)<<FRACBITS);
@ -4370,21 +4370,21 @@ INT32 K_GetMinimapTransFlags(const boolean usingProgressBar)
if (dofade) if (dofade)
{ {
minimaptrans = FixedMul(minimaptrans, (st_translucency * FRACUNIT) / 10); minimaptrans = FixedMul(minimaptrans, (st_translucency * FRACUNIT) / 10);
// If the minimap is fully transparent, just get your 0 back. Bail out with this. // If the minimap is fully transparent, just get your 0 back. Bail out with this.
if (!minimaptrans) if (!minimaptrans)
return minimaptrans; return minimaptrans;
} }
minimaptrans = ((10-minimaptrans)<<V_ALPHASHIFT); minimaptrans = ((10-minimaptrans)<<V_ALPHASHIFT);
return minimaptrans; return minimaptrans;
} }
INT32 K_GetMinimapSplitFlags(const boolean usingProgressBar) INT32 K_GetMinimapSplitFlags(const boolean usingProgressBar)
{ {
INT32 splitflags = 0; INT32 splitflags = 0;
if (usingProgressBar) if (usingProgressBar)
splitflags = (V_SLIDEIN|V_SNAPTOBOTTOM); splitflags = (V_SLIDEIN|V_SNAPTOBOTTOM);
else else
@ -4397,12 +4397,12 @@ INT32 K_GetMinimapSplitFlags(const boolean usingProgressBar)
{ {
if (r_splitscreen == 1) if (r_splitscreen == 1)
splitflags = V_SNAPTORIGHT; // 2P right aligned splitflags = V_SNAPTORIGHT; // 2P right aligned
// 3P lives in the middle of the bottom right // 3P lives in the middle of the bottom right
// viewport and shouldn't fade in OR slide // viewport and shouldn't fade in OR slide
} }
} }
return splitflags; return splitflags;
} }
@ -4450,10 +4450,10 @@ static void K_drawKartMinimap(void)
// distancetofinish for an arbitrary object. ~toast 070423 // distancetofinish for an arbitrary object. ~toast 070423
doprogressionbar = true; doprogressionbar = true;
} }
minimaptrans = K_GetMinimapTransFlags(doprogressionbar); minimaptrans = K_GetMinimapTransFlags(doprogressionbar);
if (!minimaptrans) return; // Exit early if it wouldn't draw anyway. if (!minimaptrans) return; // Exit early if it wouldn't draw anyway.
splitflags = K_GetMinimapSplitFlags(doprogressionbar); splitflags = K_GetMinimapSplitFlags(doprogressionbar);
if (doprogressionbar == false) if (doprogressionbar == false)
@ -5234,7 +5234,7 @@ static void K_drawKartFirstPerson(void)
fixed_t scale; fixed_t scale;
UINT8 *colmap = NULL; UINT8 *colmap = NULL;
if (stplyr->spectator || !stplyr->mo || (stplyr->mo->renderflags & RF_DONTDRAW)) if (stplyr->spectator || !stplyr->mo || (stplyr->mo->renderflags & RF_DONTDRAW || stplyr->mo->state == &states[S_KART_DEAD]))
return; return;
{ {

View file

@ -4092,6 +4092,9 @@ Quaketilt (player_t *player)
static void static void
DoABarrelRoll (player_t *player) DoABarrelRoll (player_t *player)
{ {
UINT8 viewnum = R_GetViewNumber();
camera_t *cam = &camera[viewnum];
angle_t slope; angle_t slope;
angle_t delta; angle_t delta;
@ -4120,9 +4123,17 @@ DoABarrelRoll (player_t *player)
slope = 0; slope = 0;
} }
if (AbsAngle(slope) > ANGLE_45) if (cam->chase)
{ {
slope = slope & ANGLE_180 ? InvAngle(ANGLE_45) : ANGLE_45; if (AbsAngle(slope) > ANGLE_45)
{
slope = slope & ANGLE_180 ? InvAngle(ANGLE_45) : ANGLE_45;
}
} else {
if (AbsAngle(slope) > ANGLE_90)
{
slope = slope & ANGLE_180 ? InvAngle(ANGLE_90) : ANGLE_90;
}
} }
slope -= Quaketilt(player); slope -= Quaketilt(player);
@ -4130,7 +4141,7 @@ DoABarrelRoll (player_t *player)
delta = slope - player->tilt; delta = slope - player->tilt;
smoothing = FixedDiv(AbsAngle(slope), ANGLE_45); smoothing = FixedDiv(AbsAngle(slope), ANGLE_45);
delta = FixedDiv(delta, 33 * delta = FixedDiv(delta, (cam->chase ? 33 : 11) *
FixedDiv(FRACUNIT, FRACUNIT + smoothing)); FixedDiv(FRACUNIT, FRACUNIT + smoothing));
if (delta) if (delta)

View file

@ -307,8 +307,18 @@ angle_t R_PointToAnglePlayer(player_t *player, fixed_t x, fixed_t y)
{ {
refx = cam->x; refx = cam->x;
refy = cam->y; refy = cam->y;
}
// Bandaid for two very specific bugs that arise with chasecam off.
// 1: Camera tilt from slopes wouldn't apply correctly in first person.
// 2: Trick pies would appear strangely in first person.
if (player->mo)
{
if ((!cam->chase) && player->mo->x == x && player->mo->y == y)
{
return player->mo->angle;
}
}
}
return R_PointToAngle2(refx, refy, x, y); return R_PointToAngle2(refx, refy, x, y);
} }