Fix many cases of ? with replacements

This commit is contained in:
NepDisk 2025-03-14 20:26:51 -04:00
parent 24d52d593e
commit 0a41771926
7 changed files with 153 additions and 166 deletions

View file

@ -2310,12 +2310,31 @@ Ping_gfx_color (int lag)
return SKINCOLOR_MAGENTA;
}
static const UINT8 *
Ping_gfx_colormap (UINT32 lag, boolean gentleman)
{
const UINT8 *colormap = NULL;
colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE);
if (servermaxping && lag > servermaxping && hu_tick < 4)
{
// flash ping red if too high
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
}
else if (gentleman)
{
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PASTEL, GTC_CACHE);
}
return colormap;
}
//
// HU_drawPing
//
void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags, boolean offline)
{
UINT8 *colormap = NULL;
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
INT32 gfxnum; // gfx to draw
boolean drawlocal = (offline && cv_mindelay.value && lag <= (tic_t)cv_mindelay.value);
@ -2331,25 +2350,14 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags, boolean offline)
if (measureid == 1)
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
if (drawlocal)
V_DrawScaledPatch(x+2, y, flags, pinglocal[0]);
else
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE);
if (servermaxping && lag > servermaxping && hu_tick < 4)
{
// flash ping red if too high
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_WHITE, GTC_CACHE);
}
if (cv_pingmeasurement.value)
{
lag = (INT32)(lag * (1000.00f / TICRATE));
}
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, Ping_gfx_colormap(lag,drawlocal));
if (measureid == 0)
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
@ -2361,6 +2369,9 @@ HU_drawMiniPing (INT32 x, INT32 y, UINT32 lag, INT32 flags)
patch_t *patch;
INT32 w = BASEVIDWIDTH;
// draw new graphics later.
return;
if (r_splitscreen > 1)
{
w /= 2;

View file

@ -64,6 +64,7 @@ enum
X (TALLNUM),
X (NIGHTSNUM),
X (PINGNUM),
X (OPPRNK),
};
#undef X

View file

@ -3517,12 +3517,6 @@ _(BUBBLESHIELDTRAP5)
_(BUBBLESHIELDTRAP6)
_(BUBBLESHIELDTRAP7)
_(BUBBLESHIELDTRAP8)
_(BUBBLESHIELDWAVE1)
_(BUBBLESHIELDWAVE2)
_(BUBBLESHIELDWAVE3)
_(BUBBLESHIELDWAVE4)
_(BUBBLESHIELDWAVE5)
_(BUBBLESHIELDWAVE6)
// Flame Shield
_(FLAMESHIELD1)

View file

@ -47,6 +47,7 @@
static CV_PossibleValue_t speedo_cons_t[]= {
{0, "Default"},
{1, "Small"},
//{2, "P-Meter"}, Readded later need to draw smaller sprites.
{0, NULL}};
consvar_t cv_newspeedometer = CVAR_INIT ("newspeedometer", "Default", CV_SAVE, speedo_cons_t, NULL);
@ -89,6 +90,7 @@ static patch_t *kp_ringdebtminussmall;
static patch_t *kp_speedometersticker;
static patch_t *kp_speedometerlabel[4];
static patch_t *kp_kartzspeedo[25];
static patch_t *kp_rankbumper;
static patch_t *kp_tinybumper[2];
@ -135,17 +137,8 @@ static patch_t *kp_sadface[2];
static patch_t *kp_check[6];
static patch_t *kp_rival[2];
static patch_t *kp_localtag[4][2];
static patch_t *kp_talk;
static patch_t *kp_typdot;
static patch_t *kp_eggnum[4];
static patch_t *kp_flameshieldmeter[104][2];
static patch_t *kp_flameshieldmeter_bg[16][2];
static patch_t *kp_fpview[3];
static patch_t *kp_inputwheel[5];
@ -159,13 +152,6 @@ static patch_t *kp_lapanim_hand[3];
static patch_t *kp_yougotem;
static patch_t *kp_alagles[10];
static patch_t *kp_blagles[6];
static patch_t *kp_cpu;
static patch_t *kp_nametagstem;
static patch_t *kp_bossbar[8];
static patch_t *kp_bossret[4];
@ -271,14 +257,28 @@ void K_LoadKartHUDGraphics(void)
HU_UpdatePatch(&kp_ringdebtminussmall, "K_RNGSM");
// Speedometer
HU_UpdatePatch(&kp_speedometersticker, "K_SPDMBG");
HU_UpdatePatch(&kp_speedometersticker, "SP_SMSTC");
HU_UpdatePatch(&kp_speedometerlabel[0], "SP_MKMH");
HU_UpdatePatch(&kp_speedometerlabel[1], "SP_MMPH");
HU_UpdatePatch(&kp_speedometerlabel[2], "SP_MFRAC");
HU_UpdatePatch(&kp_speedometerlabel[3], "SP_MPERC");
sprintf(buffer, "K_SPDMLx");
for (i = 0; i < 4; i++)
{
buffer[7] = '0'+(i+1);
HU_UpdatePatch(&kp_speedometerlabel[i], "%s", buffer);
const char* patchNames[] = {
"K_KZSP1", "K_KZSP2", "K_KZSP3", "K_KZSP4", "K_KZSP5",
"K_KZSP6", "K_KZSP7", "K_KZSP8", "K_KZSP9", "K_KZSP10",
"K_KZSP11", "K_KZSP12", "K_KZSP13", "K_KZSP14", "K_KZSP15",
"K_KZSP16", "K_KZSP17", "K_KZSP18", "K_KZSP19", "K_KZSP20",
"K_KZSP21", "K_KZSP22", "K_KZSP23", "K_KZSP24", "K_KZSP25"
};
for (size_t m = 0; m < sizeof(patchNames) / sizeof(patchNames[0]); ++m)
{
kp_kartzspeedo[m] = W_CachePatchName(patchNames[m], PU_HUDGFX);
}
}
// Extra ranking icons
HU_UpdatePatch(&kp_rankbumper, "K_BLNICO");
@ -344,23 +344,6 @@ void K_LoadKartHUDGraphics(void)
HU_UpdatePatch(&kp_kitchensink[0], "K_ITSINK");
HU_UpdatePatch(&kp_sadface[0], "K_ITSAD");
sprintf(buffer, "FSMFGxxx");
for (i = 0; i < 104; i++)
{
buffer[5] = '0'+((i+1)/100);
buffer[6] = '0'+(((i+1)/10)%10);
buffer[7] = '0'+((i+1)%10);
HU_UpdatePatch(&kp_flameshieldmeter[i][0], "%s", buffer);
}
sprintf(buffer, "FSMBG0xx");
for (i = 0; i < 16; i++)
{
buffer[6] = '0'+((i+1)/10);
buffer[7] = '0'+((i+1)%10);
HU_UpdatePatch(&kp_flameshieldmeter_bg[i][0], "%s", buffer);
}
// Splitscreen
HU_UpdatePatch(&kp_itembg[2], "K_ISBG");
HU_UpdatePatch(&kp_itembg[3], "K_ISBGD");
@ -395,23 +378,6 @@ void K_LoadKartHUDGraphics(void)
HU_UpdatePatch(&kp_kitchensink[1], "K_ISSINK");
HU_UpdatePatch(&kp_sadface[1], "K_ISSAD");
sprintf(buffer, "FSMFSxxx");
for (i = 0; i < 104; i++)
{
buffer[5] = '0'+((i+1)/100);
buffer[6] = '0'+(((i+1)/10)%10);
buffer[7] = '0'+((i+1)%10);
HU_UpdatePatch(&kp_flameshieldmeter[i][1], "%s", buffer);
}
sprintf(buffer, "FSMBS0xx");
for (i = 0; i < 16; i++)
{
buffer[6] = '0'+((i+1)/10);
buffer[7] = '0'+((i+1)%10);
HU_UpdatePatch(&kp_flameshieldmeter_bg[i][1], "%s", buffer);
}
// CHECK indicators
sprintf(buffer, "K_CHECKx");
for (i = 0; i < 6; i++)
@ -420,30 +386,6 @@ void K_LoadKartHUDGraphics(void)
HU_UpdatePatch(&kp_check[i], "%s", buffer);
}
// Rival indicators
sprintf(buffer, "K_RIVALx");
for (i = 0; i < 2; i++)
{
buffer[7] = '1'+i;
HU_UpdatePatch(&kp_rival[i], "%s", buffer);
}
// Rival indicators
sprintf(buffer, "K_SSPLxx");
for (i = 0; i < 4; i++)
{
buffer[6] = 'A'+i;
for (j = 0; j < 2; j++)
{
buffer[7] = '1'+j;
HU_UpdatePatch(&kp_localtag[i][j], "%s", buffer);
}
}
// Typing indicator
HU_UpdatePatch(&kp_talk, "K_TALK");
HU_UpdatePatch(&kp_typdot, "K_TYPDOT");
// Eggman warning numbers
sprintf(buffer, "K_EGGNx");
for (i = 0; i < 4; i++)
@ -517,24 +459,6 @@ void K_LoadKartHUDGraphics(void)
HU_UpdatePatch(&kp_yougotem, "YOUGOTEM");
sprintf(buffer, "ALAGLESx");
for (i = 0; i < 10; ++i)
{
buffer[7] = '0'+i;
HU_UpdatePatch(&kp_alagles[i], "%s", buffer);
}
sprintf(buffer, "BLAGLESx");
for (i = 0; i < 6; ++i)
{
buffer[7] = '0'+i;
HU_UpdatePatch(&kp_blagles[i], "%s", buffer);
}
HU_UpdatePatch(&kp_cpu, "K_CPU");
HU_UpdatePatch(&kp_nametagstem, "K_NAMEST");
sprintf(buffer, "K_BOSB0x");
for (i = 0; i < 8; i++)
{
@ -1760,7 +1684,6 @@ static void K_drawBossHealthBar(void)
//
void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol)
{
static tic_t alagles_timer = 9;
INT32 i, rightoffset = 240;
const UINT8 *colormap;
INT32 dupadjust = (vid.width/vid.dupx), duptweak = (dupadjust - BASEVIDWIDTH)/2;
@ -1796,7 +1719,7 @@ void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, IN
{
if (players[tab[i].num].bot)
{
V_DrawScaledPatch(x + ((i < 8) ? -25 : rightoffset + 3), y-2, 0, kp_cpu);
V_DrawString(x + ((i < 8) ? -25 : rightoffset + 3), y-2, V_SNAPTOLEFT, "CPU");
}
else if (tab[i].num != serverplayer || !server_lagless)
{
@ -1808,28 +1731,6 @@ void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, IN
y2 = y;
if (netgame && playerconsole[tab[i].num] == 0 && server_lagless && !players[tab[i].num].bot)
{
y2 = ( y - 4 );
V_DrawScaledPatch(x + 20, y2, 0, kp_blagles[(leveltime / 3) % 6]);
// every 70 tics
if (( leveltime % 70 ) == 0)
{
alagles_timer = 9;
}
if (alagles_timer > 0)
{
V_DrawScaledPatch(x + 20, y2, 0, kp_alagles[alagles_timer]);
if (( leveltime % 2 ) == 0)
alagles_timer--;
}
else
V_DrawScaledPatch(x + 20, y2, 0, kp_alagles[0]);
y2 += SHORT (kp_alagles[0]->height) + 1;
}
if (scorelines >= 8)
V_DrawThinString(x + 20, y2, ((tab[i].num == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime);
else
@ -2065,20 +1966,20 @@ static void K_drawKartSpeedometer(void)
{
case 1: // Kilometers
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale) / FRACUNIT; // 2.172409058
labeln = 1;
labeln = 0;
break;
case 2: // Miles
convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale) / FRACUNIT; // 1.349868774
labeln = 2;
labeln = 1;
break;
case 3: // Fracunits
convSpeed = FixedDiv(stplyr->speed, mapobjectscale) / FRACUNIT; // 1.0. duh.
labeln = 3;
labeln = 2;
break;
case 4: // Sonic Drift 2 style percentage
if (stplyr->mo)
convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false, false), ORIG_FRICTION))*100)>>FRACBITS;
labeln = 0;
labeln = 3;
break;
default:
break;
@ -2108,13 +2009,13 @@ static void K_drawKartSpeedometer(void)
V_DrawKartString(LAPS_X, LAPS_Y-18 + battleoffset + ringoffset, V_HUDTRANS|splitflags, va("%3d fu/t", convSpeed));
break;
case 4:
V_DrawKartString(LAPS_X, LAPS_Y-18 + battleoffset + ringoffset, V_HUDTRANS|splitflags, va("%4d P", convSpeed));
V_DrawKartString(LAPS_X, LAPS_Y-18 + battleoffset + ringoffset, V_HUDTRANS|splitflags, va("%4d %%", convSpeed));
break;
default:
break;
}
}
else
else if (cv_newspeedometer.value == 1)
{
numbers[0] = ((convSpeed / 100) % 10);
numbers[1] = ((convSpeed / 10) % 10);
@ -2126,6 +2027,32 @@ static void K_drawKartSpeedometer(void)
V_DrawScaledPatch(LAPS_X+19, LAPS_Y-9 + battleoffset + ringoffset, V_HUDTRANS|splitflags, kp_facenum[numbers[2]]);
V_DrawScaledPatch(LAPS_X+29, LAPS_Y-9 + battleoffset + ringoffset, V_HUDTRANS|splitflags, kp_speedometerlabel[labeln]);
}
// Readded later need to draw smaller graphics.
/*else if (cv_newspeedometer.value == 2)
{
fixed_t fuspeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
INT32 spdpatch = 0;
#define NUM_INTERVALS 22
const int speedIntervals[NUM_INTERVALS] = {2, 5, 7, 10, 12, 15, 17, 20, 22, 25, 27, 30, 32, 35, 37, 40, 42, 45, 47, 50, 52, 55};
for (int i = 0; i < NUM_INTERVALS; ++i)
{
if (fuspeed < speedIntervals[i])
{
spdpatch = i;
break;
}
}
#undef NUM_INTERVALS
if (((fuspeed < 57 && fuspeed > 54) || (fuspeed < 60 && fuspeed > 56) || (fuspeed > 59)) && (leveltime & 4))
spdpatch = 24;
else if (((fuspeed < 57 && fuspeed > 54) || (fuspeed < 60 && fuspeed > 56) || (fuspeed > 59)) && !(leveltime & 4))
spdpatch = 23;
V_DrawScaledPatch(LAPS_X, LAPS_Y-18 + battleoffset + ringoffset, V_HUDTRANS|splitflags, kp_kartzspeedo[spdpatch]);
}*/
K_drawKartAccessibilityIcons(56);
}
@ -2554,35 +2481,60 @@ static boolean K_ShowPlayerNametag(player_t *p)
static void K_DrawLocalTagForPlayer(fixed_t x, fixed_t y, player_t *p, UINT8 id)
{
UINT8 blink = ((leveltime / 7) & 1);
UINT8 *colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS|V_SPLITSCREEN, kp_localtag[id][blink], colormap);
UINT16 chatcolor = skincolors[p->skincolor].chatcolor;
char color_prefix[2];
char letters[4] = {'A', 'B', 'C', 'D'};
if (chatcolor > V_TANMAP)
{
sprintf(color_prefix, "%c", '\x80');
}
else
{
sprintf(color_prefix, "%c", '\x80' + (chatcolor >> V_CHARCOLORSHIFT));
}
V_DrawCenteredSmallStringAtFixed(x, y, V_HUDTRANS|V_ALLOWLOWERCASE|V_SPLITSCREEN, va("%s%c\nv", color_prefix, letters[id]));
}
static void K_DrawRivalTagForPlayer(fixed_t x, fixed_t y)
{
UINT8 blink = ((leveltime / 7) & 1);
V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS|V_SPLITSCREEN, kp_rival[blink], NULL);
UINT16 chatcolor = skincolors[SKINCOLOR_ORANGE].chatcolor;
char color_prefix[2];
if (chatcolor > V_TANMAP)
{
sprintf(color_prefix, "%c", '\x80');
}
else
{
sprintf(color_prefix, "%c", '\x80' + (chatcolor >> V_CHARCOLORSHIFT));
}
static void K_DrawTypingDot(fixed_t x, fixed_t y, UINT8 duration, player_t *p)
{
if (p->typing_duration > duration)
{
V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS|V_SPLITSCREEN, kp_typdot, NULL);
V_DrawCenteredSmallStringAtFixed(x, y, V_HUDTRANS|V_ALLOWLOWERCASE|V_SPLITSCREEN, va("%sRival\nv", color_prefix));
}
static const char *K_StringTypingDot(player_t *p)
{
if (p->typing_duration > 47)
{
return "...";
}
else if (p->typing_duration > 31)
{
return "..";
}
else if (p->typing_duration > 15)
{
return ".";
}
else
return "";
}
static void K_DrawTypingNotifier(fixed_t x, fixed_t y, player_t *p)
{
if (p->cmd.flags & TICCMD_TYPING)
{
V_DrawFixedPatch(x, y, FRACUNIT,V_SPLITSCREEN, kp_talk, NULL);
/* spacing closer with the last two looks a better most of the time */
K_DrawTypingDot(x + 3*FRACUNIT, y, 15, p);
K_DrawTypingDot(x + 6*FRACUNIT - FRACUNIT/3, y, 31, p);
K_DrawTypingDot(x + 9*FRACUNIT - FRACUNIT/3, y, 47, p);
V_DrawCenteredSmallStringAtFixed(x, y, V_SPLITSCREEN, va("Typing%s",K_StringTypingDot(p)));
}
}
@ -2669,7 +2621,6 @@ static void K_DrawNameTagForPlayer(fixed_t x, fixed_t y, player_t *p)
V_DrawFill(barx, bary + vid.dupy, barw, vid.dupy, (colormap ? colormap[0] : 0)|V_NOSCALESTART);
V_DrawFill(stemx+vid.dupx, stemy+vid.dupy, barw - vid.dupx*3, vid.dupy, (colormap ? colormap[0] : 0)|V_NOSCALESTART);
}
//V_DrawFixedPatch(x, y, FRACUNIT, 0, kp_nametagstem, colormap);
// END DRAWFILL DUMBNESS
@ -3513,10 +3464,11 @@ static void K_drawKartStartCountdown(void)
break;
}
if (numplayers == 2)
// Re-enable when graphics are drawn up for this.
/*if (numplayers == 2)
{
pnum++; // DUEL
}
}*/
}
if ((leveltime % (2*5)) / 5) // blink

View file

@ -7367,10 +7367,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
(mobj->target->y - mobj->target->momy) + P_ReturnThrustY(NULL, a, mobj->radius - (21*ws)),
(mobj->target->z - mobj->target->momz), MT_THOK);
wave->colorized = true;
wave->color = SKINCOLOR_BLUE;
wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY);
P_SetScale(wave, (wave->destscale = ws));
P_SetMobjState(wave, S_BUBBLESHIELDWAVE1);
P_SetMobjState(wave, S_SPLISH1);
wave->momx = mobj->target->momx;
wave->momy = mobj->target->momy;
@ -8243,10 +8245,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->y + FixedMul(mobj->radius, FINESINE(aoff>>ANGLETOFINESHIFT)),
mobj->z, MT_THOK);
wave->colorized = true;
wave->color = SKINCOLOR_PERIWINKLE;
wave->flags &= ~(MF_NOCLIPHEIGHT|MF_NOGRAVITY);
P_SetScale(wave, (wave->destscale = mobj->scale/2));
P_SetMobjState(wave, S_BUBBLESHIELDWAVE1);
P_SetMobjState(wave, S_SPLISH1);
if (leveltime & 1)
wave->tics++;

View file

@ -2569,6 +2569,28 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color
return x;
}
// Jaden: Draw a number using the position numbers.
//
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap)
{
INT32 w = SHORT(fontv[PINGNUM_FONT].font[0]->width) - 1;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
if (num < 0)
num = -num;
// draw the number
do
{
x -= (w - 1);
V_DrawFixedPatch(x << FRACBITS, y << FRACBITS, FRACUNIT, flags, fontv[PINGNUM_FONT].font[num % 10], colormap);
num /= 10;
} while (--digits);
}
// Find string width from cred_font chars
//
INT32 V_CreditStringWidth(const char *string)

View file

@ -316,6 +316,9 @@ void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
// This is a separate function because IMO lua should have access to it as well.
INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *colormap);
// Rank numbers.
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap);
// Find string width from lt_font chars
INT32 V_LevelNameWidth(const char *string);
INT32 V_LevelNameHeight(const char *string);