mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Change MapChange so Lua returns the map number you change
This commit is contained in:
parent
b1c41a193b
commit
54cae84849
4 changed files with 11 additions and 9 deletions
|
@ -1749,6 +1749,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
UINT8 flags;
|
||||
INT32 resetplayer = 1, lastgametype;
|
||||
UINT8 skipprecutscene, FLS;
|
||||
#ifdef HAVE_BLUA
|
||||
INT16 mapnumber;
|
||||
#endif
|
||||
|
||||
if (playernum != serverplayer && playernum != adminplayer)
|
||||
{
|
||||
|
@ -1810,7 +1813,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_MapChange();
|
||||
mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||
LUAh_MapChange(mapnumber);
|
||||
#endif
|
||||
|
||||
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene);
|
||||
|
|
|
@ -2547,14 +2547,12 @@ void G_DoReborn(INT32 playernum)
|
|||
}
|
||||
}
|
||||
else
|
||||
#ifdef HAVE_BLUA
|
||||
{
|
||||
LUAh_MapChange();
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_MapChange(gamemap);
|
||||
#endif
|
||||
G_DoLoadLevel(true);
|
||||
#ifdef HAVE_BLUA
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5091,7 +5089,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
demo_start = false;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_MapChange();
|
||||
LUAh_MapChange(gamemap);
|
||||
#endif
|
||||
displayplayer = consoleplayer = 0;
|
||||
memset(playeringame,0,sizeof(playeringame));
|
||||
|
|
|
@ -48,7 +48,7 @@ enum hook {
|
|||
};
|
||||
extern const char *const hookNames[];
|
||||
|
||||
void LUAh_MapChange(void); // Hook for map change (before load)
|
||||
void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
|
||||
void LUAh_MapLoad(void); // Hook for map load
|
||||
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
|
||||
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
||||
|
|
|
@ -314,14 +314,14 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which)
|
|||
}
|
||||
|
||||
// Hook for map change (before load)
|
||||
void LUAh_MapChange(void)
|
||||
void LUAh_MapChange(INT16 mapnumber)
|
||||
{
|
||||
hook_p hookp;
|
||||
if (!gL || !(hooksAvailable[hook_MapChange/8] & (1<<(hook_MapChange%8))))
|
||||
return;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
lua_pushinteger(gL, gamemap);
|
||||
lua_pushinteger(gL, mapnumber);
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
if (hookp->type == hook_MapChange)
|
||||
|
|
Loading…
Reference in a new issue