mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-28 12:10:42 +00:00
Remove mute boolean from playermsg hook, fix username stuff still being there, potential memory leaks, and added back the ip message.
This commit is contained in:
parent
619dd9d08a
commit
c7060aa5ad
5 changed files with 12 additions and 25 deletions
|
@ -582,7 +582,6 @@ void D_RegisterServerCommands(void)
|
||||||
*/
|
*/
|
||||||
void D_RegisterClientCommands(void)
|
void D_RegisterClientCommands(void)
|
||||||
{
|
{
|
||||||
const char *username;
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAXSKINCOLORS; i++)
|
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||||
|
@ -639,8 +638,6 @@ void D_RegisterClientCommands(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// register these so it is saved to config
|
// register these so it is saved to config
|
||||||
if ((username = I_GetUserName()))
|
|
||||||
cv_playername.defaultvalue = username;
|
|
||||||
CV_RegisterVar(&cv_playername);
|
CV_RegisterVar(&cv_playername);
|
||||||
CV_RegisterVar(&cv_playercolor);
|
CV_RegisterVar(&cv_playercolor);
|
||||||
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
|
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
|
||||||
|
|
|
@ -465,11 +465,8 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||||
{
|
{
|
||||||
// check if nodenum[1] is a space
|
// check if nodenum[1] is a space
|
||||||
if (nodenum[1] == ' ')
|
if (nodenum[1] == ' ')
|
||||||
{
|
|
||||||
spc = 0;
|
spc = 0;
|
||||||
free(nodenum); // don't need this anymore.
|
|
||||||
// let it slide
|
// let it slide
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||||
|
@ -664,7 +661,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUAh_PlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
if (LUAh_PlayerMsg(playernum, target, flags, msg))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -989,11 +986,8 @@ static void HU_queueChatChar(char c)
|
||||||
{
|
{
|
||||||
// check if nodenum[1] is a space
|
// check if nodenum[1] is a space
|
||||||
if (nodenum[1] == ' ')
|
if (nodenum[1] == ' ')
|
||||||
{
|
|
||||||
spc = 0;
|
spc = 0;
|
||||||
free(nodenum);
|
|
||||||
// let it slide
|
// let it slide
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||||
|
|
|
@ -75,7 +75,7 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Ho
|
||||||
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
||||||
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
||||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
||||||
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute); // Hook for chat messages
|
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
|
||||||
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
||||||
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
|
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
|
||||||
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
||||||
|
|
|
@ -952,10 +952,8 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
|
||||||
return hooked;
|
return hooked;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook for player chat
|
|
||||||
// Added the "mute" field. It's set to true if the message was supposed to be eaten by spam protection.
|
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg)
|
||||||
// But for netgame consistency purposes, this hook is ran first reguardless, so this boolean allows for modders to adapt if they so desire.
|
|
||||||
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
|
|
||||||
{
|
{
|
||||||
hook_p hookp;
|
hook_p hookp;
|
||||||
boolean hooked = false;
|
boolean hooked = false;
|
||||||
|
@ -984,19 +982,14 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
|
||||||
LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target
|
LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target
|
||||||
}
|
}
|
||||||
lua_pushstring(gL, msg); // msg
|
lua_pushstring(gL, msg); // msg
|
||||||
if (mute)
|
|
||||||
lua_pushboolean(gL, true); // the message was supposed to be eaten by spamprotecc.
|
|
||||||
else
|
|
||||||
lua_pushboolean(gL, false);
|
|
||||||
}
|
}
|
||||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||||
lua_pushvalue(gL, -6);
|
lua_pushvalue(gL, -5);
|
||||||
lua_pushvalue(gL, -6);
|
lua_pushvalue(gL, -5);
|
||||||
lua_pushvalue(gL, -6);
|
lua_pushvalue(gL, -5);
|
||||||
lua_pushvalue(gL, -6);
|
lua_pushvalue(gL, -5);
|
||||||
lua_pushvalue(gL, -6);
|
if (lua_pcall(gL, 4, 1, 0)) {
|
||||||
if (lua_pcall(gL, 5, 1, 0)) {
|
|
||||||
if (!hookp->error || cv_debug & DBG_LUA)
|
if (!hookp->error || cv_debug & DBG_LUA)
|
||||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||||
lua_pop(gL, 1);
|
lua_pop(gL, 1);
|
||||||
|
|
|
@ -6346,7 +6346,10 @@ static void M_ConnectIP(INT32 choice)
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
||||||
if (*setupm_ip == 0)
|
if (*setupm_ip == 0)
|
||||||
|
{
|
||||||
|
M_StartMessage("You must specify an IP address.\n", NULL, MM_NOTHING);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
COM_BufAddText(va("connect \"%s\"\n", setupm_ip));
|
COM_BufAddText(va("connect \"%s\"\n", setupm_ip));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue