Print chat message from the game module instead of the server

This commit is contained in:
smallmodel 2024-12-29 15:45:15 +01:00
parent 4ec10af1fd
commit 2656000ce4
No known key found for this signature in database
GPG key ID: A96F163ED4891440
2 changed files with 34 additions and 6 deletions

View file

@ -10783,10 +10783,29 @@ void Player::EventDMMessage(Event *ev)
return;
}
//
// Added in OPM
//=============
// Print the dm message to console
sToken = "";
for (i = 2; i <= ev->NumArgs(); i++) {
if (i != 2) {
sToken += " ";
}
sToken += ev->GetString(i);
}
//=============
if (iMode == 0) {
//
// everyone
//
// Added in OPM
gi.Printf("%s (%zu) says to everyone: %s\n", client->pers.netname, edict - g_entities, sToken.c_str());
if (!IsSpectator() || g_spectate_allow_full_chat->integer) {
for (i = 0; i < game.maxclients; i++) {
ent = &g_entities[i];
@ -10831,6 +10850,10 @@ void Player::EventDMMessage(Event *ev)
//
// team message
//
// Added in OPM
gi.Printf("%s (%zu) says to team: %s\n", client->pers.netname, edict - g_entities, sToken.c_str());
if (IsSpectator()) {
for (i = 0; i < game.maxclients; i++) {
ent = &g_entities[i];
@ -10890,6 +10913,9 @@ void Player::EventDMMessage(Event *ev)
return;
}
// Added in OPM
gi.Printf("%s (%zu) says to client #%d: %s\n", client->pers.netname, edict - g_entities, iMode - 1, sToken.c_str());
gi.SendServerCommand(iMode - 1, "%s", szPrintString);
if (ent->entity != this) {

View file

@ -1641,12 +1641,14 @@ void SV_ExecuteClientCommand( client_t *cl, const char *s, qboolean clientOK ) {
}
}
// Added in 1.11 MAC server
// Display chat messages
// NOTE: this should be handled by fgame, not server
if (!Q_stricmp(Cmd_Argv(0), "dmmessage")) {
Com_Printf("%s (%zu): %s", cl->name, (size_t)(cl - svs.clients), s);
}
// Removed in OPM
// Message printing is now handled by fgame
//// Added in 1.11 MAC server
//// Display chat messages
//// NOTE: this should be handled by fgame, not server
////if (!Q_stricmp(Cmd_Argv(0), "dmmessage")) {
//// Com_Printf("%s (%zu): %s", cl->name, (size_t)(cl - svs.clients), s);
////}
if (clientOK) {
// pass unknown strings to the game