Port small minimap icons and minimap nametags from saturn/snowy, add minimap angle reticle toggle

This commit is contained in:
NepDisk 2025-02-20 20:32:18 -05:00
parent 71225707bf
commit 0fcf7c7dbd
6 changed files with 96 additions and 2 deletions

View file

@ -524,6 +524,10 @@ consvar_t cv_pingmeasurement = CVAR_INIT ("pingmeasurement", "Frames", CV_SAVE,
consvar_t cv_showlapemblem = CVAR_INIT ("showlapemblem", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_showminimapnames = CVAR_INIT ("showminimapnames", "Off", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_showminimapangle = CVAR_INIT ("showminimapnames", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_minihead = CVAR_INIT ("smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_showviewpointtext = CVAR_INIT ("showviewpointtext", "On", CV_SAVE, CV_OnOff, NULL);
// Intermission time Tails 04-19-2002
@ -822,6 +826,9 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_pingtimeout);
CV_RegisterVar(&cv_showping);
CV_RegisterVar(&cv_pingmeasurement);
CV_RegisterVar(&cv_showminimapnames);
CV_RegisterVar(&cv_showminimapangle);
CV_RegisterVar(&cv_minihead);
CV_RegisterVar(&cv_showlapemblem);
CV_RegisterVar(&cv_showviewpointtext);

View file

@ -116,6 +116,11 @@ extern consvar_t cv_lagless;
extern consvar_t cv_pingtimeout;
extern consvar_t cv_showping;
extern consvar_t cv_pingmeasurement;
extern consvar_t cv_showminimapnames;
extern consvar_t cv_showminimapangle;
extern consvar_t cv_minihead;
extern consvar_t cv_showlapemblem;
extern consvar_t cv_showviewpointtext;

View file

@ -3178,6 +3178,13 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos;
fixed_t scale = FRACUNIT;
if (!cv_showminimapangle.value && (icon == kp_minimapdot))
return;
if (cv_minihead.value)
scale = FRACUNIT / 2;
amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y);
@ -3188,7 +3195,70 @@ static void K_drawKartMinimapIcon(fixed_t objx, fixed_t objy, INT32 hudx, INT32
amxpos = amnumxpos + ((hudx + (SHORT(minimapinfo.minimap_pic->width)-SHORT(icon->width))/2)<<FRACBITS);
amypos = amnumypos + ((hudy + (SHORT(minimapinfo.minimap_pic->height)-SHORT(icon->height))/2)<<FRACBITS);
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, icon, colormap);
if (cv_minihead.value && !(icon == kp_minimapdot))
{
amxpos += 2 * FRACUNIT;
amypos += 2 * FRACUNIT;
}
V_DrawFixedPatch(amxpos, amypos, scale, flags, icon, colormap);
}
static void K_drawKartMinimapNametag(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, player_t *player)
{
// 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.
if (!cv_showminimapnames.value)
{
return;
}
if (!player)
{
return;
}
if (!player->mo)
{
return;
}
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos;
char color_prefix[2];
UINT8 skin = 0;
amnumxpos = (FixedMul(objx, minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(objy, minimapinfo.zoom) - minimapinfo.offs_y);
if (encoremode)
amnumxpos = -amnumxpos;
skin = ((skin_t*)players->mo->skin)-skins;
amxpos = amnumxpos + ((hudx + (SHORT(minimapinfo.minimap_pic->width)-SHORT(faceprefix[skin][FACE_MINIMAP]->width))/2)<<FRACBITS);
amypos = amnumypos + ((hudy + (SHORT(minimapinfo.minimap_pic->height)-SHORT(faceprefix[skin][FACE_MINIMAP]->height))/2)<<FRACBITS);
{
UINT16 chatcolor = skincolors[player->mo->color].chatcolor;
if (chatcolor > V_TANMAP)
{
sprintf(color_prefix, "%c", '\x80');
}
else
{
sprintf(color_prefix, "%c", '\x80' + (chatcolor >> V_CHARCOLORSHIFT));
}
}
const char *player_name = va("%s%s", color_prefix, player_names[player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
static void K_drawKartMinimapDot(fixed_t objx, fixed_t objy, INT32 hudx, INT32 hudy, INT32 flags, UINT8 color, UINT8 size)
@ -3246,7 +3316,7 @@ static void K_drawKartMinimapWaypoint(waypoint_t *wp, INT32 hudx, INT32 hudy, IN
K_drawKartMinimapDot(wp->mobj->x, wp->mobj->y, hudx, hudy, flags | V_NOSCALESTART, pal, size);
}
#define ICON_DOT_RADIUS (10)
#define ICON_DOT_RADIUS cv_minihead.value ? 8 : 10
static void K_drawKartMinimap(void)
{
@ -3589,6 +3659,8 @@ static void K_drawKartMinimap(void)
colormap
);
}
K_drawKartMinimapNametag(interpx, interpy, x, y, splitflags, mobj->player);
}
}

View file

@ -722,6 +722,9 @@ static int libd_drawOnMinimap(lua_State *L)
list = (huddrawlist_h) lua_touserdata(L, -1);
lua_pop(L, 1);
if (cv_minihead.value)
scale /= 2;
if (LUA_HUD_IsDrawListValid(list))
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
else

View file

@ -2341,6 +2341,12 @@ void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *strin
V_DrawSmallString(x, y, option, string);
}
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
{
x -= (V_SmallStringWidth(string, option) / 2)<<FRACBITS;
V_DrawStringScaled(x, y, FRACUNIT/2, FRACUNIT/2, FRACUNIT/2, option, HU_FONT, string);
}
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_SmallStringWidth(string, option);

View file

@ -260,6 +260,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
#define V_DrawSmallString( x,y,option,string ) \
V__DrawDupxString (x,y,FRACUNIT>>1,option,HU_FONT,string)
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
// draw a string using the tny_font