mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-27 02:12:46 +00:00
WIP: Duel ruleset
This commit is contained in:
parent
2b0f597909
commit
d2b2178143
6 changed files with 38 additions and 1 deletions
|
|
@ -926,6 +926,8 @@ struct player_t
|
|||
INT32 cheatchecknum; // The number of the last cheatcheck you hit
|
||||
INT32 checkpointId; // Players respawn here, objects/checkpoint.cpp
|
||||
|
||||
INT16 duelscore;
|
||||
|
||||
UINT8 ctfteam; // 0 == Spectator, 1 == Red, 2 == Blue
|
||||
|
||||
UINT8 checkskip; // Skipping checkpoints? Oh no no no
|
||||
|
|
|
|||
|
|
@ -2997,6 +2997,15 @@ static void K_drawKartLaps(void)
|
|||
// I do not understand the way this system of offsets is laid out at all,
|
||||
// so it's probably going to be pretty bad to maintain. Sorry.
|
||||
|
||||
if (inDuel)
|
||||
{
|
||||
UINT8 flashflag = (leveltime % 2 && abs(stplyr->duelscore >= 2)) ? V_TRANSLUCENT : 0;
|
||||
if (stplyr->duelscore >= 0)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, V_BLUEMAP|flashflag, va("+%d", stplyr->duelscore));
|
||||
else
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 5, V_REDMAP|flashflag, va("%d", stplyr->duelscore));
|
||||
}
|
||||
|
||||
if (numlaps != 1)
|
||||
{
|
||||
if (r_splitscreen > 1)
|
||||
|
|
|
|||
18
src/k_kart.c
18
src/k_kart.c
|
|
@ -4144,6 +4144,24 @@ void K_CheckpointCrossAward(player_t *player)
|
|||
{
|
||||
player->exp += K_GetExpAdjustment(player);
|
||||
K_AwardPlayerRings(player, (player->bot ? 20 : 10), true);
|
||||
|
||||
// Update Duel scoring.
|
||||
if (inDuel && player->position == 1)
|
||||
{
|
||||
player->duelscore += 1;
|
||||
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator && &players[i] != player)
|
||||
players[i].duelscore -= 1;
|
||||
}
|
||||
|
||||
if (player->duelscore == 3)
|
||||
{
|
||||
P_DoPlayerExit(player, 0);
|
||||
P_DoAllPlayersExit(PF_NOCONTEST, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boolean K_Overdrive(player_t *player)
|
||||
|
|
|
|||
|
|
@ -675,6 +675,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->checkskip);
|
||||
else if (fastcmp(field,"cheatchecknum"))
|
||||
lua_pushinteger(L, plr->cheatchecknum);
|
||||
else if (fastcmp(field,"duelscore"))
|
||||
lua_pushinteger(L, plr->duelscore);
|
||||
else if (fastcmp(field,"lastsidehit"))
|
||||
lua_pushinteger(L, plr->lastsidehit);
|
||||
else if (fastcmp(field,"lastlinehit"))
|
||||
|
|
@ -1246,6 +1248,8 @@ static int player_set(lua_State *L)
|
|||
plr->checkskip = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"cheatchecknum"))
|
||||
plr->cheatchecknum = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"duelscore"))
|
||||
plr->duelscore = (INT16)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"lastsidehit"))
|
||||
plr->lastsidehit = (INT16)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"lastlinehit"))
|
||||
|
|
|
|||
|
|
@ -284,6 +284,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEUINT32(save->p, players[i].lapPoints);
|
||||
WRITEINT32(save->p, players[i].exp);
|
||||
WRITEUINT16(save->p, players[i].gradingpointnum);
|
||||
WRITEINT16(save->p, players[i].duelscore);
|
||||
WRITEINT32(save->p, players[i].cheatchecknum);
|
||||
WRITEINT32(save->p, players[i].checkpointId);
|
||||
|
||||
|
|
@ -955,6 +956,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
players[i].lapPoints = READUINT32(save->p);
|
||||
players[i].exp = READINT32(save->p);
|
||||
players[i].gradingpointnum = READUINT16(save->p);
|
||||
players[i].duelscore = READINT16(save->p);
|
||||
players[i].cheatchecknum = READINT32(save->p);
|
||||
players[i].checkpointId = READINT32(save->p);
|
||||
|
||||
|
|
|
|||
|
|
@ -1991,8 +1991,10 @@ static void K_HandleLapIncrement(player_t *player)
|
|||
player->latestlap = player->laps;
|
||||
}
|
||||
|
||||
boolean specialduelexit = (inDuel && !(mapheaderinfo[gamemap-1]->levelflags & LF_SECTIONRACE));
|
||||
|
||||
// finished race exit setup
|
||||
if (player->laps > numlaps)
|
||||
if (player->laps > numlaps && !specialduelexit)
|
||||
{
|
||||
pflags_t applyflags = 0;
|
||||
if (specialstageinfo.valid == true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue