change those to fit rest of style

This commit is contained in:
Alug committed 2024-11-21 20:33:44 +01:00
1 parent a4080980ec
commit f26717954e
3 files changed
+32 -34

No files matched your search

+6 -6
View File
@@ -2312,7 +2312,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
UINT8 scoremultiply = 1;
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
boolean force = false; // Used to check if Lua ShouldSpin should get us damaged reguardless of flashtics or heck knows what.
UINT8 shouldForce = LUAh_ShouldSpin(player, inflictor, source);
UINT8 shouldForce = LUA_HookShouldSpin(player, inflictor, source);
if (P_MobjWasRemoved(player->mo))
return; // mobj was removed (in theory that shouldn't happen)
@@ -2345,7 +2345,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto
}
}
if (LUAh_PlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
if (LUA_HookPlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
return;
if (source && source != player->mo && source->player)
@@ -2453,7 +2453,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
UINT8 scoremultiply = 1;
// PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what.
UINT8 shouldForce = LUAh_ShouldSquish(player, inflictor, source);
UINT8 shouldForce = LUA_HookShouldSquish(player, inflictor, source);
if (P_MobjWasRemoved(player->mo))
return; // mobj was removed (in theory that shouldn't happen)
if (shouldForce == 1)
@@ -2483,7 +2483,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
}
}
if (LUAh_PlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
if (LUA_HookPlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
return;
player->kartstuff[k_sneakertimer] = 0;
@@ -2564,7 +2564,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
fixed_t upgoer;
UINT8 scoremultiply = 1;
boolean force = false; // Used to check if Lua ShouldExplode should get us damaged reguardless of flashtics or heck knows what.
UINT8 shouldForce = LUAh_ShouldExplode(player, inflictor, source);
UINT8 shouldForce = LUA_HookShouldExplode(player, inflictor, source);
if (P_MobjWasRemoved(player->mo))
return; // mobj was removed (in theory that shouldn't happen)
@@ -2597,7 +2597,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
}
}
if (LUAh_PlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah
if (LUA_HookPlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah
return;
if (source && source != player->mo && source->player)
+9 -11
View File
@@ -115,15 +115,13 @@ int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
void LUA_HookPlayerQuit(player_t *, int);
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
int LUA_HookKey(INT32 keycode, int hooktype); // Hooks for key events
// No clue what to do about these
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
+17 -17
View File
@@ -965,17 +965,6 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param)
return hook.status;
}
int LUA_HookKey(INT32 keycode, int hooktype)
{
Hook_State hook;
if (prepare_hook(&hook, 0, hooktype))
{
lua_pushinteger(gL, keycode);
call_hooks(&hook, 1, 0, res_true);
}
return hook.status;
}
static int kartdamage_hook
(
player_t *player,
@@ -996,37 +985,48 @@ static int kartdamage_hook
}
// Hook for K_SpinPlayer. Determines if yes or no we should get damaged reguardless of circumstances.
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
{
return kartdamage_hook(player, inflictor, source, HOOK(ShouldSpin), res_force);
}
// Hook for K_ExplodePlayer. Determines if yes or no we should get damaged reguardless of circumstances.
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
{
return kartdamage_hook(player, inflictor, source, HOOK(ShouldExplode), res_force);
}
// Hook for K_SquishPlayer. Determines if yes or no we should get damaged reguardless of circumstances.
UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
{
return kartdamage_hook(player, inflictor, source, HOOK(ShouldSquish), res_force);
}
// Hook for K_SpinPlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
{
return kartdamage_hook(player, inflictor, source, HOOK(PlayerSpin), res_true);
}
// Hook for K_SquishPlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
{
return kartdamage_hook(player, inflictor, source, HOOK(PlayerSquish), res_true);
}
// Hook for K_ExplodePlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
{
return kartdamage_hook(player, inflictor, source, HOOK(PlayerExplode), res_true);
}
int LUA_HookKey(INT32 keycode, int hooktype)
{
Hook_State hook;
if (prepare_hook(&hook, 0, hooktype))
{
lua_pushinteger(gL, keycode);
call_hooks(&hook, 1, 0, res_true);
}
return hook.status;
}