mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
WIP basic exp
modifies item odds based on checkpoint and finishlin grading
This commit is contained in:
parent
cd625acab7
commit
b4827de43d
7 changed files with 29 additions and 3 deletions
|
|
@ -914,6 +914,7 @@ struct player_t
|
||||||
UINT8 laps; // Number of laps (optional)
|
UINT8 laps; // Number of laps (optional)
|
||||||
UINT8 latestlap;
|
UINT8 latestlap;
|
||||||
UINT32 lapPoints; // Points given from laps
|
UINT32 lapPoints; // Points given from laps
|
||||||
|
INT32 exp;
|
||||||
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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2131,6 +2131,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
UINT8 laps;
|
UINT8 laps;
|
||||||
UINT8 latestlap;
|
UINT8 latestlap;
|
||||||
UINT32 lapPoints;
|
UINT32 lapPoints;
|
||||||
|
INT32 exp;
|
||||||
UINT16 skincolor;
|
UINT16 skincolor;
|
||||||
INT32 skin;
|
INT32 skin;
|
||||||
UINT8 availabilities[MAXAVAILABILITY];
|
UINT8 availabilities[MAXAVAILABILITY];
|
||||||
|
|
@ -2319,6 +2320,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
laps = 0;
|
laps = 0;
|
||||||
latestlap = 0;
|
latestlap = 0;
|
||||||
lapPoints = 0;
|
lapPoints = 0;
|
||||||
|
exp = FRACUNIT;
|
||||||
roundscore = 0;
|
roundscore = 0;
|
||||||
exiting = 0;
|
exiting = 0;
|
||||||
khudfinish = 0;
|
khudfinish = 0;
|
||||||
|
|
@ -2356,6 +2358,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
laps = players[player].laps;
|
laps = players[player].laps;
|
||||||
latestlap = players[player].latestlap;
|
latestlap = players[player].latestlap;
|
||||||
lapPoints = players[player].lapPoints;
|
lapPoints = players[player].lapPoints;
|
||||||
|
exp = players[player].exp;
|
||||||
|
|
||||||
roundscore = players[player].roundscore;
|
roundscore = players[player].roundscore;
|
||||||
|
|
||||||
|
|
@ -2470,6 +2473,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
p->laps = laps;
|
p->laps = laps;
|
||||||
p->latestlap = latestlap;
|
p->latestlap = latestlap;
|
||||||
p->lapPoints = lapPoints;
|
p->lapPoints = lapPoints;
|
||||||
|
p->exp = exp;
|
||||||
p->totalring = totalring;
|
p->totalring = totalring;
|
||||||
|
|
||||||
for (i = 0; i < LAP__MAX; i++)
|
for (i = 0; i < LAP__MAX; i++)
|
||||||
|
|
|
||||||
|
|
@ -6512,6 +6512,9 @@ void K_drawKartHUD(void)
|
||||||
if (cv_kartdebugdistribution.value)
|
if (cv_kartdebugdistribution.value)
|
||||||
K_drawDistributionDebugger();
|
K_drawDistributionDebugger();
|
||||||
|
|
||||||
|
// temp debug
|
||||||
|
V_DrawSmallString(8, 2, V_SNAPTOTOP, va("Exp/Dist mult: %.2f", FixedToFloat(stplyr->exp)));
|
||||||
|
|
||||||
if (cv_kartdebugnodes.value)
|
if (cv_kartdebugnodes.value)
|
||||||
{
|
{
|
||||||
UINT8 p;
|
UINT8 p;
|
||||||
|
|
|
||||||
|
|
@ -423,13 +423,14 @@ static UINT32 K_UndoMapScaling(UINT32 distance)
|
||||||
as well as Frantic Items.
|
as well as Frantic Items.
|
||||||
|
|
||||||
Input Arguments:-
|
Input Arguments:-
|
||||||
|
player - The player to get the distance of.
|
||||||
distance - Original distance.
|
distance - Original distance.
|
||||||
numPlayers - Number of players in the game.
|
numPlayers - Number of players in the game.
|
||||||
|
|
||||||
Return:-
|
Return:-
|
||||||
New distance after scaling.
|
New distance after scaling.
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static UINT32 K_ScaleItemDistance(UINT32 distance, UINT8 numPlayers)
|
static UINT32 K_ScaleItemDistance(const player_t* player, UINT32 distance, UINT8 numPlayers)
|
||||||
{
|
{
|
||||||
if (franticitems == true)
|
if (franticitems == true)
|
||||||
{
|
{
|
||||||
|
|
@ -443,6 +444,9 @@ static UINT32 K_ScaleItemDistance(UINT32 distance, UINT8 numPlayers)
|
||||||
FRACUNIT + (K_ItemOddsScale(numPlayers) / 2)
|
FRACUNIT + (K_ItemOddsScale(numPlayers) / 2)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Distance is reduced based on the player's exp
|
||||||
|
distance = FixedMul(distance, min(FRACUNIT, player->exp));
|
||||||
|
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -509,7 +513,7 @@ UINT32 K_GetItemRouletteDistance(const player_t *player, UINT8 numPlayers)
|
||||||
}
|
}
|
||||||
|
|
||||||
pdis = K_UndoMapScaling(pdis);
|
pdis = K_UndoMapScaling(pdis);
|
||||||
pdis = K_ScaleItemDistance(pdis, numPlayers);
|
pdis = K_ScaleItemDistance(player, pdis, numPlayers);
|
||||||
|
|
||||||
if (player->bot && (player->botvars.rival || cv_levelskull.value))
|
if (player->bot && (player->botvars.rival || cv_levelskull.value))
|
||||||
{
|
{
|
||||||
|
|
@ -1150,7 +1154,7 @@ static void K_InitRoulette(itemroulette_t *const roulette)
|
||||||
&& roulette->secondDist > roulette->firstDist)
|
&& roulette->secondDist > roulette->firstDist)
|
||||||
{
|
{
|
||||||
roulette->secondToFirst = roulette->secondDist - roulette->firstDist;
|
roulette->secondToFirst = roulette->secondDist - roulette->firstDist;
|
||||||
roulette->secondToFirst = K_ScaleItemDistance(roulette->secondToFirst, 16 - roulette->playing); // Reversed scaling
|
roulette->secondToFirst = K_ScaleItemDistance(&players[i], roulette->secondToFirst, 16 - roulette->playing); // Reversed scaling
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -669,12 +669,18 @@ void __attribute__((optimize("O0"))) Obj_CrossCheckpoints(player_t* player, fixe
|
||||||
if (player->position == 1)
|
if (player->position == 1)
|
||||||
{
|
{
|
||||||
player->lapPoints += 2;
|
player->lapPoints += 2;
|
||||||
|
player->exp += FRACUNIT/10;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player->lapPoints += 1;
|
player->lapPoints += 1;
|
||||||
|
player->exp += FRACUNIT/20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (K_IsPlayerLosing(player))
|
||||||
|
{
|
||||||
|
player->exp -= FRACUNIT/20;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mobj_t* Obj_FindCheckpoint(INT32 id)
|
mobj_t* Obj_FindCheckpoint(INT32 id)
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
WRITEUINT8(save->p, players[i].laps);
|
WRITEUINT8(save->p, players[i].laps);
|
||||||
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].cheatchecknum);
|
WRITEINT32(save->p, players[i].cheatchecknum);
|
||||||
WRITEINT32(save->p, players[i].checkpointId);
|
WRITEINT32(save->p, players[i].checkpointId);
|
||||||
|
|
||||||
|
|
@ -937,6 +938,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
players[i].laps = READUINT8(save->p); // Number of laps (optional)
|
players[i].laps = READUINT8(save->p); // Number of laps (optional)
|
||||||
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].cheatchecknum = READINT32(save->p);
|
players[i].cheatchecknum = READINT32(save->p);
|
||||||
players[i].checkpointId = READINT32(save->p);
|
players[i].checkpointId = READINT32(save->p);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2111,15 +2111,21 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
if (inDuel == false && player->position == 1) // 1st place in 1v1 uses thumbs up
|
if (inDuel == false && player->position == 1) // 1st place in 1v1 uses thumbs up
|
||||||
{
|
{
|
||||||
player->lapPoints += 2;
|
player->lapPoints += 2;
|
||||||
|
player->exp += FRACUNIT/10;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player->lapPoints++;
|
player->lapPoints++;
|
||||||
|
player->exp += FRACUNIT/20;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->laps <= numlaps)
|
if (player->laps <= numlaps)
|
||||||
K_SpawnAmps(player, 10*(D_NumPlayersInRace() - player->position), player->mo);
|
K_SpawnAmps(player, 10*(D_NumPlayersInRace() - player->position), player->mo);
|
||||||
}
|
}
|
||||||
|
else if (K_IsPlayerLosing(player))
|
||||||
|
{
|
||||||
|
player->exp -= FRACUNIT/20;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->position == 1 && !(gametyperules & GTR_CHECKPOINTS))
|
if (player->position == 1 && !(gametyperules & GTR_CHECKPOINTS))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue