Ringbox proto functionality

This commit is contained in:
AJ Martinez 2023-06-25 23:18:06 -07:00
parent 7842032eee
commit f371a21258
6 changed files with 35 additions and 9 deletions

View file

@ -764,6 +764,9 @@ struct player_t
boolean markedfordeath;
UINT8 ringboxdelay; // Delay until Ring Box auto-activates
UINT8 ringboxaward; // Where did we stop?
uint8_t public_key[PUBKEYLENGTH];
#ifdef HWRENDER

View file

@ -1250,12 +1250,6 @@ static void K_drawKartItem(void)
vector2_t rouletteCrop = {7, 7};
INT32 i;
if (stplyr->itemRoulette.ringbox)
{
// Todo: owl
localbg = offset ? kp_ringbg[1] : kp_ringbg[0];
}
if (stplyr->itemRoulette.itemListLen > 0)
{
// Init with item roulette stuff.
@ -1617,6 +1611,11 @@ static void K_drawKartSlotMachine(void)
{
rouletteOffset = K_GetRouletteOffset(&stplyr->itemRoulette, rendertimefrac);
}
else
{
if (!stplyr->ringboxdelay)
return;
}
// pain and suffering defined below
if (offset)

View file

@ -10732,6 +10732,17 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->pflags &= ~PF_USERINGS;
}
if (player->ringboxdelay)
{
player->ringboxdelay--;
if (player->ringboxdelay == 0)
{
// TODO
K_AwardPlayerRings(player, 10 * player->ringboxaward, true);
player->ringboxaward = 0;
}
}
if (player && player->mo && player->mo->health > 0 && !player->spectator && !P_PlayerInPain(player) && !mapreset && leveltime > introtime)
{
// First, the really specific, finicky items that function without the item being directly in your item slot.

View file

@ -1603,9 +1603,8 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd)
if (roulette->ringbox == true)
{
// TODO: add logic to make it give you the rings
//player->slotMachineType = finalItem;
//player->slotMachineDelay = TICRATE;
player->ringboxdelay = TICRATE;
player->ringboxaward = finalItem;
}
else
{

View file

@ -251,6 +251,10 @@ static int player_get(lua_State *L)
lua_pushboolean(L, plr->flipDI);
else if (fastcmp(field,"markedfordeath"))
lua_pushboolean(L, plr->markedfordeath);
else if (fastcmp(field,"ringboxdelay"))
lua_pushinteger(L, plr->ringboxdelay);
else if (fastcmp(field,"ringboxaward"))
lua_pushinteger(L, plr->ringboxaward);
else if (fastcmp(field,"drift"))
lua_pushinteger(L, plr->drift);
else if (fastcmp(field,"driftcharge"))
@ -651,6 +655,10 @@ static int player_set(lua_State *L)
plr->flipDI = luaL_checkboolean(L, 3);
else if (fastcmp(field,"markedfordeath"))
plr->markedfordeath = luaL_checkboolean(L, 3);
else if (fastcmp(field,"ringboxdelay"))
plr->ringboxdelay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"ringboxaward"))
plr->ringboxaward = luaL_checkinteger(L, 3);
else if (fastcmp(field,"drift"))
plr->drift = luaL_checkinteger(L, 3);
else if (fastcmp(field,"driftcharge"))

View file

@ -433,6 +433,9 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].markedfordeath);
WRITEUINT8(save->p, players[i].ringboxdelay);
WRITEUINT8(save->p, players[i].ringboxaward);
// respawnvars_t
WRITEUINT8(save->p, players[i].respawn.state);
WRITEUINT32(save->p, K_GetWaypointHeapIndex(players[i].respawn.wp));
@ -828,6 +831,9 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].markedfordeath = READUINT8(save->p);
players[i].ringboxdelay = READUINT8(save->p);
players[i].ringboxaward = READUINT8(save->p);
// respawnvars_t
players[i].respawn.state = READUINT8(save->p);
players[i].respawn.wp = (waypoint_t *)(size_t)READUINT32(save->p);