Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff

This commit is contained in:
Alug committed 2025-07-05 12:57:03 +02:00
commit 93ce374b07
6 files changed
+50 -30

No files matched your search

+9 -23
View File
@@ -90,9 +90,12 @@ char motd[254], server_context[8]; // Message of the Day, Unique Context (even w
plrinfo playerinfo[MAXPLAYERS];
SINT8 joinnode = 0; // used for CL_VIEWSERVER
boolean player_muted[MAXPLAYERS] = {0};
// Server specific vars
UINT8 playernode[MAXPLAYERS];
// Minimum timeout for sending the savegame
// The actual timeout will be longer depending on the savegame length
tic_t jointimeout = (3*TICRATE);
@@ -3394,6 +3397,8 @@ void CL_Reset(void)
#endif
G_ResetAllDeviceRumbles();
memset(player_muted, 0, sizeof(player_muted));
// D_StartTitle should get done now, but the calling function will handle it
}
@@ -3414,31 +3419,12 @@ static void Command_GetPlayerNum(void)
SINT8 nametonum(const char *name)
{
INT32 playernum, i;
INT32 playernum = D_LookupPlayer(name);
if (!strcmp(name, "0"))
return 0;
if (playernum == -1)
CONS_Printf(M_GetText("There is no player named \"%s\"\n"), name);
playernum = (SINT8)atoi(name);
if (playernum < 0 || playernum >= MAXPLAYERS)
return -1;
if (playernum)
{
if (playeringame[playernum])
return (SINT8)playernum;
else
return -1;
}
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && !stricmp(player_names[i], name))
return (SINT8)i;
CONS_Printf(M_GetText("There is no player named \"%s\"\n"), name);
return -1;
return playernum;
}
/** Lists all players and their player numbers.
+2
View File
@@ -670,6 +670,8 @@ SINT8 nametonum(const char *name);
extern char motd[254], server_context[8];
extern UINT8 playernode[MAXPLAYERS];
extern boolean player_muted[MAXPLAYERS];
INT32 D_NumPlayers(void);
void D_ResetTiccmds(void);
+3 -4
View File
@@ -2085,7 +2085,7 @@ static void Command_ResetCamera_f(void)
}
/* Consider replacing nametonum with this */
static INT32 LookupPlayer(const char *s)
INT32 D_LookupPlayer(const char *s)
{
INT32 playernum;
@@ -2101,8 +2101,7 @@ static INT32 LookupPlayer(const char *s)
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
{
/* Match name case-insensitively: fully, or partially the start. */
if (playeringame[playernum])
if (strnicmp(player_names[playernum], s, strlen(s)) == 0)
if (playeringame[playernum] && (strnicmp(player_names[playernum], s, strlen(s)) == 0))
{
return playernum;
}
@@ -2217,7 +2216,7 @@ static void Command_View_f(void)
}
else
{
if (( playernum = LookupPlayer(COM_Argv(1)) ) == -1)
if (( playernum = D_LookupPlayer(COM_Argv(1)) ) == -1)
{
CONS_Alert(CONS_WARNING, "There is no player by that name!\n");
return;
+1
View File
@@ -323,6 +323,7 @@ void ClearAdminPlayers(void);
void RemoveAdminPlayer(INT32 playernum);
void ItemFinder_OnChange(void);
void D_SetPassword(const char *pw);
INT32 D_LookupPlayer(const char *s);
// used for the player setup menu
UINT8 CanChangeSkin(INT32 playernum);
+34 -2
View File
@@ -705,7 +705,7 @@ static void Command_Sayto_f(void)
return;
}
target = nametonum(COM_Argv(1));
target = D_LookupPlayer(COM_Argv(1));
if (target == -1)
{
CONS_Alert(CONS_NOTICE, M_GetText("No player with that name!\n"));
@@ -953,6 +953,9 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
else
stop_spamming[playernum] = 4; // you can hold off for 4 tics, can you?
if (player_muted[playernum])
spam_eatmsg = 1; // Let lua know we're skipping this message
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
@@ -1184,6 +1187,23 @@ static boolean HU_clearChatSpaces(void)
return nothingbutspaces;
}
static void DoMute(const char *name)
{
INT32 pnum = D_LookupPlayer(name);
if (pnum < 0)
{
HU_AddChatText("\x85""ERROR: \x80Player not found.", false);
return;
}
player_muted[pnum] = !player_muted[pnum];
HU_AddChatText(va("Player '%s' has been %smuted.", player_names[pnum], player_muted[pnum] ? "" : "un"), false);
if (player_muted[pnum])
HU_AddChatText("Use same command to unmute them.", false);
}
static void HU_SendChatMessage(void)
{
char buf[2 + HU_MAXMSGLEN + 1];
@@ -1210,7 +1230,19 @@ static void HU_SendChatMessage(void)
return;
}
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
size_t len = strlen(msg);
if (len >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
{
if (len > 6)
DoMute(msg+6);
else
HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false);
return;
}
if (len > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
{
INT32 spc = 1; // used if nodenum[1] is a space.
char *nodenum = (char*) malloc(3);
+1 -1
View File
@@ -2073,7 +2073,7 @@ static boolean S_SkipIntroMusic(void)
char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
if (maptitle && (!stricmp(maptitle, "Wandering Falls"))) // wandering balls changes its song when the race starts Zzz...
if (maptitle && !stricmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz...
{
Z_Free(maptitle);
return false;