mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Exp hud math for target 500 at 1.0 exp
This commit is contained in:
parent
0a8e6fe15c
commit
ee74b747ac
10 changed files with 64 additions and 14 deletions
|
|
@ -914,6 +914,7 @@ struct player_t
|
||||||
UINT8 latestlap;
|
UINT8 latestlap;
|
||||||
UINT32 lapPoints; // Points given from laps
|
UINT32 lapPoints; // Points given from laps
|
||||||
INT32 exp;
|
INT32 exp;
|
||||||
|
UINT16 gradingpointnum; // how many grading points, checkpoint and finishline, you've passed
|
||||||
INT32 cheatchecknum; // The number of the last cheatcheck you hit
|
INT32 cheatchecknum; // The number of the last cheatcheck you hit
|
||||||
INT32 checkpointId; // Players respawn here, objects/checkpoint.cpp
|
INT32 checkpointId; // Players respawn here, objects/checkpoint.cpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2132,6 +2132,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
UINT8 latestlap;
|
UINT8 latestlap;
|
||||||
UINT32 lapPoints;
|
UINT32 lapPoints;
|
||||||
INT32 exp;
|
INT32 exp;
|
||||||
|
UINT16 gradingpointnum;
|
||||||
|
|
||||||
UINT16 skincolor;
|
UINT16 skincolor;
|
||||||
INT32 skin;
|
INT32 skin;
|
||||||
UINT8 availabilities[MAXAVAILABILITY];
|
UINT8 availabilities[MAXAVAILABILITY];
|
||||||
|
|
@ -2321,6 +2323,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
latestlap = 0;
|
latestlap = 0;
|
||||||
lapPoints = 0;
|
lapPoints = 0;
|
||||||
exp = FRACUNIT;
|
exp = FRACUNIT;
|
||||||
|
gradingpointnum = 0;
|
||||||
roundscore = 0;
|
roundscore = 0;
|
||||||
exiting = 0;
|
exiting = 0;
|
||||||
khudfinish = 0;
|
khudfinish = 0;
|
||||||
|
|
@ -2359,6 +2362,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
latestlap = players[player].latestlap;
|
latestlap = players[player].latestlap;
|
||||||
lapPoints = players[player].lapPoints;
|
lapPoints = players[player].lapPoints;
|
||||||
exp = players[player].exp;
|
exp = players[player].exp;
|
||||||
|
gradingpointnum = players[player].gradingpointnum;
|
||||||
|
|
||||||
roundscore = players[player].roundscore;
|
roundscore = players[player].roundscore;
|
||||||
|
|
||||||
|
|
@ -2474,6 +2478,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
p->latestlap = latestlap;
|
p->latestlap = latestlap;
|
||||||
p->lapPoints = lapPoints;
|
p->lapPoints = lapPoints;
|
||||||
p->exp = exp;
|
p->exp = exp;
|
||||||
|
p->gradingpointnum = gradingpointnum;
|
||||||
p->totalring = totalring;
|
p->totalring = totalring;
|
||||||
|
|
||||||
for (i = 0; i < LAP__MAX; i++)
|
for (i = 0; i < LAP__MAX; i++)
|
||||||
|
|
@ -5255,6 +5260,7 @@ void G_InitNew(UINT8 pencoremode, INT32 map, boolean resetplayer, boolean skippr
|
||||||
if (resetplayer || !(gametyperules & GTR_CHECKPOINTS && map == gamemap))
|
if (resetplayer || !(gametyperules & GTR_CHECKPOINTS && map == gamemap))
|
||||||
{
|
{
|
||||||
players[i].checkpointId = 0;
|
players[i].checkpointId = 0;
|
||||||
|
players[i].gradingpointnum = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2955,6 +2955,33 @@ static void K_drawKartEmeralds(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT32 K_GetTransFlagFromFixed(fixed_t value)
|
||||||
|
{
|
||||||
|
value = std::clamp(value, FRACUNIT/2, FRACUNIT*3/2);
|
||||||
|
|
||||||
|
// Calculate distance from 1.0
|
||||||
|
fixed_t distance = abs(FRACUNIT - value);
|
||||||
|
|
||||||
|
// Map the distance to 0-10 range (10 = closest to 1.0, 0 = farthest from 1.0)
|
||||||
|
INT32 transLevel = 10 - ((distance * 10) / (FRACUNIT/2));
|
||||||
|
|
||||||
|
// Map 0-10 to V_TRANS flags
|
||||||
|
switch (transLevel) {
|
||||||
|
case 10: return V_70TRANS; // Most transparent (closest to 1.0)
|
||||||
|
case 9: return V_60TRANS;
|
||||||
|
case 8: return V_TRANSLUCENT;
|
||||||
|
case 7: return V_40TRANS;
|
||||||
|
case 6: return V_30TRANS;
|
||||||
|
case 5: return V_20TRANS;
|
||||||
|
case 4: return V_20TRANS;
|
||||||
|
case 3: return V_10TRANS;
|
||||||
|
case 2: return V_10TRANS;
|
||||||
|
case 1:
|
||||||
|
case 0: return 0; // Fully opaque (farthest from 1.0)
|
||||||
|
default: return V_90TRANS; // Shouldn't happen, but default to most transparent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void K_drawKartLaps(void)
|
static void K_drawKartLaps(void)
|
||||||
{
|
{
|
||||||
INT32 splitflags = V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_SPLITSCREEN;
|
INT32 splitflags = V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_SPLITSCREEN;
|
||||||
|
|
@ -3035,7 +3062,7 @@ static void K_drawKartLaps(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 displayEXP = std::max(50, FixedInt(100*stplyr->exp));
|
UINT16 displayEXP = std::clamp(FixedMul(std::max(stplyr->exp, FRACUNIT/2), (500/K_GetNumGradingPoints())*stplyr->gradingpointnum), 0, 999);
|
||||||
|
|
||||||
// EXP
|
// EXP
|
||||||
if (r_splitscreen > 1)
|
if (r_splitscreen > 1)
|
||||||
|
|
@ -3075,7 +3102,11 @@ static void K_drawKartLaps(void)
|
||||||
K_DrawMarginSticker(fr-1+(flipflag ? 2 : 0), fy+1, 25+bump, V_HUDTRANS|V_SLIDEIN|splitflags, true, flipflag);
|
K_DrawMarginSticker(fr-1+(flipflag ? 2 : 0), fy+1, 25+bump, V_HUDTRANS|V_SLIDEIN|splitflags, true, flipflag);
|
||||||
// WHAT IS THIS?
|
// WHAT IS THIS?
|
||||||
// WHAT ARE YOU FUCKING TALKING ABOUT?
|
// WHAT ARE YOU FUCKING TALKING ABOUT?
|
||||||
V_DrawScaledPatch(fr, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_exp[1]);
|
V_DrawMappedPatch(fr, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_exp[1], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MUSTARD, GTC_CACHE));
|
||||||
|
auto transflag = K_GetTransFlagFromFixed(stplyr->exp);
|
||||||
|
skincolornum_t overlaycolor = stplyr->exp < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE ;
|
||||||
|
auto colormap = R_GetTranslationColormap(TC_RAINBOW, overlaycolor, GTC_CACHE);
|
||||||
|
V_DrawMappedPatch(fr, fy, transflag|V_SLIDEIN|splitflags, kp_exp[1], colormap);
|
||||||
|
|
||||||
// EXP
|
// EXP
|
||||||
V_DrawScaledPatch(fr+11, fy, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font[displayEXP/100]);
|
V_DrawScaledPatch(fr+11, fy, V_HUDTRANS|V_SLIDEIN|splitflags, fontv[PINGNUM_FONT].font[displayEXP/100]);
|
||||||
|
|
@ -3087,7 +3118,13 @@ static void K_drawKartLaps(void)
|
||||||
if (!drewsticker)
|
if (!drewsticker)
|
||||||
K_DrawSticker(LAPS_X+13, LAPS_Y+5, 25+bump, V_HUDTRANS|V_SLIDEIN|splitflags, false);
|
K_DrawSticker(LAPS_X+13, LAPS_Y+5, 25+bump, V_HUDTRANS|V_SLIDEIN|splitflags, false);
|
||||||
|
|
||||||
V_DrawScaledPatch(LAPS_X+bump, LAPS_Y, V_HUDTRANS|V_SLIDEIN|splitflags, kp_exp[0]);
|
V_DrawMappedPatch(LAPS_X+bump, LAPS_Y, V_HUDTRANS|V_SLIDEIN|splitflags, kp_exp[0], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MUSTARD, GTC_CACHE));
|
||||||
|
|
||||||
|
auto transflag = K_GetTransFlagFromFixed(stplyr->exp);
|
||||||
|
skincolornum_t overlaycolor = stplyr->exp < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE ;
|
||||||
|
auto colormap = R_GetTranslationColormap(TC_RAINBOW, overlaycolor, GTC_CACHE);
|
||||||
|
V_DrawMappedPatch(LAPS_X+bump, LAPS_Y, transflag|V_SLIDEIN|splitflags, kp_exp[0], colormap);
|
||||||
|
|
||||||
using srb2::Draw;
|
using srb2::Draw;
|
||||||
Draw row = Draw(LAPS_X+23+bump, LAPS_Y+3).flags(V_HUDTRANS|V_SLIDEIN|splitflags).font(Draw::Font::kThinTimer);
|
Draw row = Draw(LAPS_X+23+bump, LAPS_Y+3).flags(V_HUDTRANS|V_SLIDEIN|splitflags).font(Draw::Font::kThinTimer);
|
||||||
row.text("{:03}", displayEXP);
|
row.text("{:03}", displayEXP);
|
||||||
|
|
|
||||||
|
|
@ -14871,4 +14871,9 @@ fixed_t K_GetExpAdjustment(player_t *player)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT32 K_GetNumGradingPoints()
|
||||||
|
{
|
||||||
|
return numlaps * (1 + Obj_GetCheckpointCount());
|
||||||
|
}
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,8 @@ boolean K_PlayerCanUseItem(player_t *player);
|
||||||
|
|
||||||
fixed_t K_GetExpAdjustment(player_t *player);
|
fixed_t K_GetExpAdjustment(player_t *player);
|
||||||
|
|
||||||
|
UINT32 K_GetNumGradingPoints();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -512,7 +512,7 @@ void gpRank_t::Update(void)
|
||||||
|
|
||||||
lvl->time = UINT32_MAX;
|
lvl->time = UINT32_MAX;
|
||||||
|
|
||||||
lvl->totalLapPoints = ( K_RaceLapCount(gamemap - 1) + Obj_GetCheckpointCount() )* 2;
|
lvl->totalLapPoints = 500;
|
||||||
lvl->totalPrisons = maptargets;
|
lvl->totalPrisons = maptargets;
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ INT32 level_tally_t::CalculateGrade(void)
|
||||||
// Use a special curve for this.
|
// Use a special curve for this.
|
||||||
// The difference between 0 and 1 lap points is an important difference in skill,
|
// The difference between 0 and 1 lap points is an important difference in skill,
|
||||||
// while the difference between 5 and 6 is not very notable.
|
// while the difference between 5 and 6 is not very notable.
|
||||||
const fixed_t frac = (laps * FRACUNIT) / std::max(1, static_cast<int>(totalLaps));
|
const fixed_t frac = std::min(FRACUNIT, (laps * FRACUNIT) / std::max(1, static_cast<int>(totalLaps)));
|
||||||
ours += Easing_OutSine(frac, 0, bonusWeights[i]);
|
ours += Easing_OutSine(frac, 0, bonusWeights[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -343,13 +343,8 @@ void level_tally_t::Init(player_t *player)
|
||||||
|
|
||||||
if ((gametypes[gt]->rules & GTR_CIRCUIT) == GTR_CIRCUIT)
|
if ((gametypes[gt]->rules & GTR_CIRCUIT) == GTR_CIRCUIT)
|
||||||
{
|
{
|
||||||
laps = player->lapPoints;
|
laps = std::clamp(FixedMul(std::max(stplyr->exp, FRACUNIT/2), (500/K_GetNumGradingPoints())*player->gradingpointnum), 0, 999);
|
||||||
totalLaps = numlaps + numlaps * Obj_GetCheckpointCount();
|
totalLaps = 500;
|
||||||
|
|
||||||
if (inDuel == false)
|
|
||||||
{
|
|
||||||
totalLaps *= 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (battleprisons)
|
if (battleprisons)
|
||||||
|
|
@ -666,8 +661,8 @@ boolean level_tally_t::IncrementLine(void)
|
||||||
break;
|
break;
|
||||||
case TALLY_BONUS_LAP:
|
case TALLY_BONUS_LAP:
|
||||||
dest = laps;
|
dest = laps;
|
||||||
amount = 1;
|
amount = 20;
|
||||||
freq = 4;
|
freq = 1;
|
||||||
break;
|
break;
|
||||||
case TALLY_BONUS_PRISON:
|
case TALLY_BONUS_PRISON:
|
||||||
dest = prisons;
|
dest = prisons;
|
||||||
|
|
|
||||||
|
|
@ -677,6 +677,7 @@ void __attribute__((optimize("O0"))) Obj_CrossCheckpoints(player_t* player, fixe
|
||||||
}
|
}
|
||||||
|
|
||||||
player->exp += K_GetExpAdjustment(player);
|
player->exp += K_GetExpAdjustment(player);
|
||||||
|
player->gradingpointnum++;
|
||||||
|
|
||||||
K_UpdatePowerLevels(player, player->laps, false);
|
K_UpdatePowerLevels(player, player->laps, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
WRITEUINT8(save->p, players[i].latestlap);
|
WRITEUINT8(save->p, players[i].latestlap);
|
||||||
WRITEUINT32(save->p, players[i].lapPoints);
|
WRITEUINT32(save->p, players[i].lapPoints);
|
||||||
WRITEINT32(save->p, players[i].exp);
|
WRITEINT32(save->p, players[i].exp);
|
||||||
|
WRITEUINT16(save->p, players[i].gradingpointnum);
|
||||||
WRITEINT32(save->p, players[i].cheatchecknum);
|
WRITEINT32(save->p, players[i].cheatchecknum);
|
||||||
WRITEINT32(save->p, players[i].checkpointId);
|
WRITEINT32(save->p, players[i].checkpointId);
|
||||||
|
|
||||||
|
|
@ -939,6 +940,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
players[i].latestlap = READUINT8(save->p);
|
players[i].latestlap = READUINT8(save->p);
|
||||||
players[i].lapPoints = READUINT32(save->p);
|
players[i].lapPoints = READUINT32(save->p);
|
||||||
players[i].exp = READINT32(save->p);
|
players[i].exp = READINT32(save->p);
|
||||||
|
players[i].gradingpointnum = READUINT16(save->p);
|
||||||
players[i].cheatchecknum = READINT32(save->p);
|
players[i].cheatchecknum = READINT32(save->p);
|
||||||
players[i].checkpointId = READINT32(save->p);
|
players[i].checkpointId = READINT32(save->p);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2119,6 +2119,7 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
player->exp += K_GetExpAdjustment(player);
|
player->exp += K_GetExpAdjustment(player);
|
||||||
|
player->gradingpointnum++;
|
||||||
|
|
||||||
if (player->position == 1 && !(gametyperules & GTR_CHECKPOINTS))
|
if (player->position == 1 && !(gametyperules & GTR_CHECKPOINTS))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue