diff --git a/src/d_player.h b/src/d_player.h index 4ff0f5d15..418a08d2c 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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 diff --git a/src/k_hud.c b/src/k_hud.c index 3f4d56413..2e53fef83 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -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) diff --git a/src/k_kart.c b/src/k_kart.c index 33fcd8819..1a02ad382 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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. diff --git a/src/k_roulette.c b/src/k_roulette.c index dc4be35df..0f722a80f 100644 --- a/src/k_roulette.c +++ b/src/k_roulette.c @@ -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 { diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 9ea6e7399..282279a71 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -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")) diff --git a/src/p_saveg.c b/src/p_saveg.c index ba096a480..a69e75128 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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);