add support for drawing a dot on the minimap showing player angle

mostly copy pasted from blankart so thx neppy c:
This commit is contained in:
Alug committed 2025-04-16 22:04:34 +02:00
1 parent 7bd835f43e
commit 3e6f028061
6 files changed
+98 -7

No files matched your search

+6
View File
@@ -1221,6 +1221,7 @@ boolean nametaggfx = false; // Nametag stuffs
boolean driftgaugegfx = false; // Driftgauge stuffs
boolean multiitem_icon = false; // Extra icons for Sneakers, Banana and Jawz
boolean joystickicon = false; // Extra icons for the joystick input display
boolean minidoticon = false; // Dot graphic for minimap player angle display
//
static void IdentifyVersion(void)
@@ -1433,6 +1434,11 @@ static void D_CheckSaturnExtraFiles(void)
joystickicon = true;
PUSHCONS(inputdisplay_cons_temp, last_inputdisplay_i, 3, "StickGFX");
}
if (W_LumpExists("MMAPDOT"))
{
minidoticon = true;
}
}
// now check for colour hud stuff
+1
View File
@@ -52,6 +52,7 @@ extern boolean nametaggfx; // Nametag stuffs
extern boolean driftgaugegfx; // Driftgauge stuffs
extern boolean multiitem_icon; // Extra icons for Sneakers, Banana and Jawz
extern boolean joystickicon; // Extra icons for the joystick input display
extern boolean minidoticon; // Dot icon for minimap player angle display
//
// autoload stuff
+2 -1
View File
@@ -149,8 +149,9 @@ extern consvar_t cv_pingstyle;
//extern consvar_t cv_smallpos;
extern consvar_t cv_showminimapnames;
extern consvar_t cv_minihead;
extern consvar_t cv_showminimapangle;
extern consvar_t cv_showlapemblem;
extern consvar_t cv_showlapemblem;
extern consvar_t cv_showviewpointtext;
extern consvar_t cv_showdownloadprompt;
+86 -3
View File
@@ -102,6 +102,7 @@ consvar_t cv_fancyroulette = {"animatedroulette", "Off", CV_SAVE, CV_OnOff, NULL
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showminimapangle = {"showminimapangle", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_highresportrait = {"highresportrait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // make char potraits use their high-res version instead
@@ -952,6 +953,8 @@ void K_RegisterClientKartStuff(void)
CV_RegisterVar(&cv_minihead);
CV_RegisterVar(&cv_showminimapnames);
CV_RegisterVar(&cv_showminimapangle);
CV_RegisterVar(&cv_showlapemblem);
CV_RegisterVar(&cv_stagetitle);
@@ -7614,6 +7617,8 @@ static patch_t *joybacking;
static patch_t *joyknob;
static patch_t *joyshadow;
static patch_t *kp_minimapdot;
void K_LoadKartHUDGraphics(void)
{
INT32 i, j;
@@ -7887,6 +7892,9 @@ void K_LoadKartHUDGraphics(void)
kp_wantedsplit = W_CachePatchName("4PWANTED", PU_HUDGFX);
kp_wantedreticle = W_CachePatchName("MMAPWANT", PU_HUDGFX);
if (minidoticon)
kp_minimapdot = W_CachePatchName("MMAPDOT", PU_HUDGFX);
// Kart Item Windows
kp_itembg[0] = W_CachePatchName("K_ITBG", PU_HUDGFX);
kp_itembg[1] = W_CachePatchName("K_ITBGD", PU_HUDGFX);
@@ -10530,6 +10538,46 @@ static void K_drawKartPlayerCheck(void)
}
}
static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, patch_t *icon, UINT8 *colormap)
{
// amnum xpos & ypos are the icon's speed around the HUD.
// The number being divided by is for how fast it moves.
// The higher the number, the slower it moves.
// am xpos & ypos are the icon's starting position. Withouht
// it, they wouldn't 'spawn' on the top-right side of the HUD.
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos;
fixed_t scale = FRACUNIT;
patch_t *AutomapPic;
AutomapPic = minimapinfo.minimap_pic;
if (AutomapPic == NULL)
{
return; // no pic, just get outta here
}
amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y);
if (encoremode)
amnumxpos = -amnumxpos;
amxpos = amnumxpos + ((hudx + (AutomapPic->width-icon->width)/2)<<FRACBITS);
amypos = amnumypos + ((hudy + (AutomapPic->height-icon->height)/2)<<FRACBITS);
if (cv_minihead.value && !(icon == kp_minimapdot))
{
amxpos += (icon->width / 4)<<FRACBITS;
amypos += (icon->height / 4)<<FRACBITS;
scale /= 2;
}
V_DrawFixedPatch(amxpos, amypos, scale, flags, icon, colormap);
}
static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
{
// amnum xpos & ypos are the icon's speed around the HUD.
@@ -10617,8 +10665,6 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
}
}
#undef lerp
static void K_drawKartMinimap(void)
{
INT32 i = 0;
@@ -10729,14 +10775,51 @@ static void K_drawKartMinimap(void)
splitflags &= ~V_HUDTRANSHALF;
splitflags |= V_HUDTRANS;
const SINT8 icondotradius = (cv_minihead.value && !cv_showminimapnames.value) ? 8 : 10;
for (i = 0; i < numlocalplayers; i++)
{
if (localplayers[i] == -1)
continue; // this doesn't interest us
K_drawKartMinimapHead(players[localplayers[i]].mo, x, y, splitflags);
mobj_t *mobj = players[localplayers[i]].mo;
K_drawKartMinimapHead(mobj, x, y, splitflags);
if (!cv_showminimapangle.value || !minidoticon)
continue;
// dont draw for no contestants
if (mobj->health <= 0 && players[localplayers[i]].pflags & PF_TIMEOVER)
continue;
UINT8 *colormap;
fixed_t interpx, interpy;
angle_t ang = R_InterpolateAngle(mobj->old_angle, mobj->angle);
if (mobj->colorized)
colormap = R_GetTranslationColormap(TC_RAINBOW, mobj->color, GTC_CACHE);
else
colormap = R_GetLocalTranslationColormap(mobj->skin, mobj->localskin, mobj->color, GTC_CACHE, mobj->skinlocal);
interpx = lerp(mobj->old_x, mobj->x);
interpy = lerp(mobj->old_y, mobj->y);
K_drawKartMinimapIcon(
interpx,
interpy,
x + FixedMul(FCOS(ang), icondotradius),
y - FixedMul(FSIN(ang), icondotradius),
splitflags,
kp_minimapdot,
colormap
);
}
}
#undef lerp
static void K_drawKartStartCountdown(void)
{
INT32 pnum = 0, splitflags = K_calcSplitFlags(0); // 3
+2 -2
View File
@@ -278,7 +278,7 @@ void R_SetViewContext(enum viewcontext_e _viewcontext)
}
return (R_LerpFixed(from, to, rendertimefrac));
}
}*/
angle_t R_InterpolateAngle(angle_t from, angle_t to)
{
@@ -288,7 +288,7 @@ angle_t R_InterpolateAngle(angle_t from, angle_t to)
}
return (R_LerpAngle(from, to, rendertimefrac));
}*/
}
void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
{
+1 -1
View File
@@ -134,7 +134,7 @@ void R_RelativeTeleportViewInterpolation(UINT8 p, fixed_t xdiff, fixed_t ydiff,
// Set the current view context (the viewvars pointed to by newview)
void R_SetViewContext(enum viewcontext_e _viewcontext);
fixed_t R_InterpolateFixed(fixed_t from, fixed_t to);
//fixed_t R_InterpolateFixed(fixed_t from, fixed_t to);
angle_t R_InterpolateAngle(angle_t from, angle_t to);
// Evaluate the interpolated mobj state for the given mobj