Port support for interpoints for non powerlevel scoring

This commit is contained in:
NepDisk 2025-05-28 16:23:33 -04:00
parent 9dabf34da0
commit 3a38c437c2
5 changed files with 38 additions and 10 deletions

View file

@ -717,6 +717,7 @@ struct player_t
UINT8 confirmVictim; // Player ID that you dealt damage to
UINT8 confirmVictimDelay; // Delay before playing the sound
INT32 interpoints; // BlanKart (port from SRB2Kart CEP): override for number of points earned in intermission
UINT32 roundscore; // battle score this round
UINT8 emeralds;
UINT8 bumper;

View file

@ -5117,6 +5117,8 @@ void G_InitNew(UINT8 pencoremode, INT32 map, boolean resetplayer, boolean skippr
players[i].totalring = 0;
players[i].score = 0;
}
players[i].interpoints = 0;
}
// Reset unlockable triggers

View file

@ -307,6 +307,7 @@ enum player_e
player_breathTimer,
player_lastsafelap,
player_lastsafestarpost,
player_interpoints,
player_roundscore,
player_marescore,
player_emeralds,
@ -486,6 +487,7 @@ static const char *const player_opt[] = {
"breathTimer",
"lastsafelap",
"lastsafestarpost",
"interpoints",
"roundscore",
"marescore",
"emeralds",
@ -913,6 +915,8 @@ static int player_get(lua_State *L)
case player_lastsafestarpost:
lua_pushinteger(L, plr->lastsafestarpost);
break;
case player_interpoints:
lua_pushinteger(L, plr->interpoints);
case player_roundscore:
case player_marescore:
lua_pushinteger(L, plr->roundscore);
@ -1537,6 +1541,8 @@ static int player_set(lua_State *L)
case player_lastsafestarpost:
plr->lastsafestarpost = luaL_checkinteger(L, 3);
break;
case player_interpoints:
plr->interpoints = luaL_checkinteger(L, 3);
case player_roundscore:
case player_marescore:
plr->roundscore = luaL_checkinteger(L, 3);

View file

@ -354,6 +354,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].confirmVictim);
WRITEUINT8(save->p, players[i].confirmVictimDelay);
WRITEINT32(save->p, players[i].interpoints);
WRITEUINT32(save->p, players[i].roundscore);
WRITEUINT8(save->p, players[i].emeralds);
WRITEUINT8(save->p, players[i].bumper);
@ -691,6 +692,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].confirmVictim = READUINT8(save->p);
players[i].confirmVictimDelay = READUINT8(save->p);
players[i].interpoints = READINT32(save->p);
players[i].roundscore = READUINT32(save->p);
players[i].emeralds = READUINT8(save->p);
players[i].bumper = READUINT8(save->p);

View file

@ -71,7 +71,7 @@ typedef struct
char levelstring[64]; // holds levelnames up to 64 characters
// SRB2kart
INT16 increase[MAXPLAYERS]; // how much did the score increase by?
INT32 increase[MAXPLAYERS]; // how much did the score increase by?
UINT8 jitter[MAXPLAYERS]; // wiggle
UINT32 val[MAXPLAYERS]; // Gametype-specific value
@ -211,7 +211,7 @@ static void Y_CompareScore(INT32 i)
static void Y_CompareRank(INT32 i)
{
INT16 increase = ((data.increase[i] == INT16_MIN) ? 0 : data.increase[i]);
INT32 increase = ((data.increase[i] == INT32_MIN) ? 0 : data.increase[i]);
UINT32 score = players[i].score;
if (powertype != PWRLV_DISABLED)
@ -291,12 +291,12 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
if (!playeringame[i] || players[i].spectator)
{
data.increase[i] = INT16_MIN;
data.increase[i] = INT32_MIN;
continue;
}
if (!rankingsmode)
data.increase[i] = INT16_MIN;
data.increase[i] = INT32_MIN;
numplayersingame++;
}
@ -336,11 +336,11 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
if (!rankingsmode)
{
if ((powertype == PWRLV_DISABLED)
&& !(players[i].pflags & PF_NOCONTEST)
&& (!(players[i].pflags & PF_NOCONTEST) || players[i].interpoints)
&& (data.pos[data.numplayers] < (numplayersingame + spectateGriefed)))
{
// Online rank is handled further below in this file.
data.increase[i] = K_CalculateGPRankPoints(data.pos[data.numplayers], numplayersingame + spectateGriefed);
data.increase[i] = players[i].interpoints ? players[i].interpoints : K_CalculateGPRankPoints(data.pos[data.numplayers], numplayersingame + spectateGriefed);
players[i].score += data.increase[i];
}
@ -681,9 +681,15 @@ void Y_IntermissionDrawer(void)
}
else
{
if (data.increase[data.num[i]] != INT16_MIN)
if (data.increase[data.num[i]] != INT32_MIN)
{
snprintf(strtime, sizeof strtime, "(%d)", data.increase[data.num[i]]);
// Checking player.interpoints so when "negative increase" reaches 0, it keeps the -
char sign = players[data.num[i]].interpoints < 0 ? '-' : '+';
if (powertype == PWRLV_DISABLED)
snprintf(strtime, sizeof strtime, "(%c%02d)", sign, abs(data.increase[data.num[i]]));
else
snprintf(strtime, sizeof strtime, "(%d)", data.increase[data.num[i]]);
if (data.numplayers > NUMFORNEWCOLUMN)
V_DrawRightAlignedThinString(x+133+gutter, y-1, V_6WIDTHSPACE, strtime);
@ -862,7 +868,7 @@ void Y_Ticker(void)
{
if (data.num[q] == MAXPLAYERS
|| !data.increase[data.num[q]]
|| data.increase[data.num[q]] == INT16_MIN)
|| data.increase[data.num[q]] == INT32_MIN)
{
continue;
}
@ -900,8 +906,19 @@ void Y_Ticker(void)
// Basic bitch points
if (data.increase[data.num[q]])
{
if (--data.increase[data.num[q]])
INT32 diff = 1;
INT32 increase = data.increase[data.num[q]];
if (increase > 25)
diff = increase/10;
// This is wordy... But allows negative "increase"
if (increase < 0)
increase += diff;
else
increase -= diff;
if (increase)
kaching = false;
data.increase[data.num[q]] = increase;
}
}
}