mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix Lua roulette hooks not knowing what the fuck a ringbox is
This commit is contained in:
parent
5c0a03f696
commit
5ce7cf0a99
3 changed files with 22 additions and 8 deletions
|
|
@ -841,6 +841,20 @@ void K_PushToRouletteItemList(itemroulette_t *const roulette, INT32 item)
|
|||
#else
|
||||
I_Assert(roulette->itemList.items != NULL);
|
||||
|
||||
CONS_Printf("HC: trying push %d\n", item);
|
||||
|
||||
if (!roulette->ringbox && item >= NUMKARTRESULTS)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Item Roulette rejected an out-of-range item.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (roulette->ringbox && item >= KSM__MAX)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Casino Roulette rejected an out-of-range item.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (roulette->itemList.len >= roulette->itemList.cap)
|
||||
{
|
||||
roulette->itemList.cap *= 2;
|
||||
|
|
@ -1186,7 +1200,7 @@ void K_FillItemRoulette(player_t *const player, itemroulette_t *const roulette,
|
|||
|
||||
CONS_Printf("HC: prehook\n");
|
||||
// Lua may want to intercept reelbuilder entirely.
|
||||
LUA_HookPreFillItemRoulette(player, roulette);
|
||||
LUA_HookPreFillItemRoulette(player, roulette, ringbox);
|
||||
|
||||
CONS_Printf("HC: bail\n");
|
||||
|
||||
|
|
@ -1202,7 +1216,7 @@ void K_FillItemRoulette(player_t *const player, itemroulette_t *const roulette,
|
|||
CONS_Printf("HC: posthook\n");
|
||||
|
||||
// Lua can modify the final result.
|
||||
LUA_HookFillItemRoulette(player, roulette);
|
||||
LUA_HookFillItemRoulette(player, roulette, ringbox);
|
||||
|
||||
CONS_Printf("HC: out\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ 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);
|
||||
int LUA_HookFillItemRoulette(player_t *player, itemroulette_t *const roulette);
|
||||
int LUA_HookPreFillItemRoulette(player_t *player, itemroulette_t *const roulette, boolean ringbox);
|
||||
int LUA_HookFillItemRoulette(player_t *player, itemroulette_t *const roulette, boolean ringbox);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
|
|
@ -1034,15 +1034,15 @@ static int roulette_hook(
|
|||
return hook.status;
|
||||
}
|
||||
|
||||
int LUA_HookPreFillItemRoulette(player_t *player, itemroulette_t *const roulette)
|
||||
int LUA_HookPreFillItemRoulette(player_t *player, itemroulette_t *const roulette, boolean ringbox)
|
||||
{
|
||||
return roulette_hook(player, roulette, false, HOOK(PreFillItemRoulette), res_true);
|
||||
return roulette_hook(player, roulette, ringbox, HOOK(PreFillItemRoulette), res_true);
|
||||
}
|
||||
|
||||
|
||||
int LUA_HookFillItemRoulette(player_t *player, itemroulette_t *const roulette)
|
||||
int LUA_HookFillItemRoulette(player_t *player, itemroulette_t *const roulette, boolean ringbox)
|
||||
{
|
||||
return roulette_hook(player, roulette, false, HOOK(FillItemRoulette), res_true);
|
||||
return roulette_hook(player, roulette, ringbox, HOOK(FillItemRoulette), res_true);
|
||||
}
|
||||
|
||||
boolean hook_cmd_running = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue