Grand Prix Rank Points Hook
Yes this is my own MR lmao https://git.do.srb2.org/KartKrew/RingRacers/-/merge_requests/122
This commit is contained in:
parent
2a0aba3980
commit
1df46f732b
3 changed files with 29 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include "k_kart.h"
|
||||
#include "m_random.h"
|
||||
#include "r_things.h"
|
||||
#include "lua_hook.h" // LUA_HookGPRankPoints
|
||||
|
||||
struct grandprixinfo grandprixinfo;
|
||||
|
||||
|
|
@ -67,6 +68,8 @@ INT16 K_CalculateGPRankPoints(UINT8 position, UINT8 numplayers)
|
|||
points = 0;
|
||||
}
|
||||
|
||||
LUA_HookGPRankPoints(position, numplayers, &points);
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ automatically.
|
|||
X (PlayerCmd),/* building the player's ticcmd struct */\
|
||||
X (MusicChange),\
|
||||
X (VoteThinker),/* Y_VoteTicker */\
|
||||
X (GPRankPoints),/* K_CalculateGPRankPoints */\
|
||||
X (AddonLoaded),\
|
||||
|
||||
#define STRING_HOOK_LIST(X) \
|
||||
|
|
@ -163,6 +164,7 @@ int LUA_HookNameChange(player_t *plr, const char *name);
|
|||
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_HookGPRankPoints(UINT8 position, UINT8 numplayers, INT16 *points);
|
||||
int LUA_HookShouldJingleContinue(player_t *, const char *musname);
|
||||
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
|
||||
|
||||
|
|
|
|||
|
|
@ -1138,6 +1138,30 @@ int LUA_HookShouldJingleContinue(player_t *player, const char *musname)
|
|||
return hook.status;
|
||||
}
|
||||
|
||||
static void res_gprankpoints(Hook_State *hook)
|
||||
{
|
||||
if (!lua_isnil(gL, -1))
|
||||
{
|
||||
INT16 *points = (INT16*)hook->userdata;
|
||||
*points = lua_tointeger(gL, -1);
|
||||
hook->status = true;
|
||||
}
|
||||
}
|
||||
|
||||
int LUA_HookGPRankPoints(UINT8 position, UINT8 numplayers, INT16 *points)
|
||||
{
|
||||
Hook_State hook;
|
||||
if (prepare_hook(&hook, 0, HOOK(GPRankPoints)))
|
||||
{
|
||||
hook.userdata = points;
|
||||
lua_pushinteger(gL, position);
|
||||
lua_pushinteger(gL, numplayers);
|
||||
lua_pushinteger(gL, *points);
|
||||
call_hooks(&hook, 1, res_gprankpoints);
|
||||
}
|
||||
return hook.status;
|
||||
}
|
||||
|
||||
boolean hook_cmd_running = false;
|
||||
|
||||
static void update_music_name(struct MusicChange *musicchange)
|
||||
|
|
|
|||
Loading…
Reference in a new issue