2.4 Lua roulette fixup FINAL?

This commit is contained in:
Antonio Martinez 2025-07-04 16:40:48 -04:00
parent b082816278
commit bed1feb1a0
4 changed files with 2 additions and 23 deletions

View file

@ -1201,20 +1201,6 @@ void K_FillItemRouletteData(player_t *player, itemroulette_t *const roulette, bo
K_CalculateRouletteSpeed(roulette);
}
// The roulette should be init'd first, and the speed should be
// set if applicable before you can override anything.
{
if (LUA_HookPreFillItemRoulette(player, roulette, ringbox))
{
// If somehow there's no items, add sad.
if (roulette->itemList.len == 0) {
K_AddItemToReel(player, roulette, KITEM_SAD);
}
return;
}
}
if (ringbox == true)
{
// If this is being invoked by a Ring Box, it should literally never produce items.

View file

@ -79,7 +79,6 @@ automatically.
X (GameQuit),\
X (PlayerCmd),/* building the player's ticcmd struct */\
X (VoteThinker),/* Y_VoteTicker */\
X (PreFillItemRoulette),/* K_FillItemRouletteData, before special conditions but after roulette speed calc */\
X (FillItemRoulette),/* K_FillItemRouletteData, right at the end */\
#define STRING_HOOK_LIST(X) \
@ -148,7 +147,6 @@ void LUA_HookPlayerQuit(player_t *, kickreason_t);
//int LUA_HookTeamSwitch(player_t *, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble);
int LUA_HookViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced);
int LUA_HookSeenPlayer(player_t *player, player_t *seenfriend);
int LUA_HookPreFillItemRoulette(player_t *player, itemroulette_t *const roulette, boolean ringbox);
int LUA_HookFillItemRoulette(player_t *player, itemroulette_t *const roulette);
#ifdef __cplusplus

View file

@ -1034,11 +1034,6 @@ static int roulette_hook(
return hook.status;
}
int LUA_HookPreFillItemRoulette(player_t *player, itemroulette_t *const roulette, boolean ringbox)
{
return roulette_hook(player, roulette, ringbox, HOOK(PreFillItemRoulette), res_true);
}
int LUA_HookFillItemRoulette(player_t *player, itemroulette_t *const roulette)
{
return roulette_hook(player, roulette, false, HOOK(FillItemRoulette), res_true);

View file

@ -1449,7 +1449,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
{
if (players[i].itemRoulette.itemList.items == NULL)
{
players[i].itemRoulette.itemList.items = Z_Calloc(
players[i].itemRoulette.itemList.items = (SINT8*)Z_Calloc(
sizeof(SINT8) * players[i].itemRoulette.itemList.cap,
PU_STATIC,
NULL
@ -1457,7 +1457,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
}
else
{
players[i].itemRoulette.itemList.items = Z_Realloc(
players[i].itemRoulette.itemList.items = (SINT8*)Z_Realloc(
players[i].itemRoulette.itemList.items,
sizeof(SINT8) * players[i].itemRoulette.itemList.cap,
PU_STATIC,