From e23da397e4622251ee50a94f29c805e13a6dd4a2 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 14 Oct 2018 17:45:28 -0400 Subject: [PATCH 1/3] Remove most gameplay prints A couple of the extraneous ones (karma interactions, bumper stealing, lap start notifications) have been removed outright. The rest that I could think of have been changed to use CON_LogMessage, so that they still go into log.txt when rereading a fun chat session but not showing themselves in gameplay. Necessary gameplay prints, such as players being defeated or coming back in Battle, have been kept until there's a suitable replacement for them in the future. --- src/d_clisrv.c | 12 ++++++------ src/d_netcmd.c | 6 +++--- src/g_game.c | 8 ++++---- src/k_kart.c | 9 ++------- src/p_inter.c | 6 ------ src/p_spec.c | 12 +++--------- src/p_user.c | 5 +++-- 7 files changed, 21 insertions(+), 37 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ec3aa444..2dd044bc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1635,18 +1635,18 @@ static void CL_LoadReceivedSavegame(void) if (P_LoadNetGame()) { - CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap)); + CON_LogMessage(va(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap))); if (strlen(mapheaderinfo[gamemap-1]->lvlttl) > 0) { - CONS_Printf(": %s", mapheaderinfo[gamemap-1]->lvlttl); + CON_LogMessage(va(": %s", mapheaderinfo[gamemap-1]->lvlttl)); if (strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) - CONS_Printf(" %s", mapheaderinfo[gamemap-1]->zonttl); + CON_LogMessage(va(" %s", mapheaderinfo[gamemap-1]->zonttl)); else if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) - CONS_Printf(M_GetText(" ZONE")); + CON_LogMessage(M_GetText(" ZONE")); if (strlen(mapheaderinfo[gamemap-1]->actnum) > 0) - CONS_Printf(" %s", mapheaderinfo[gamemap-1]->actnum); + CON_LogMessage(va(" %s", mapheaderinfo[gamemap-1]->actnum)); } - CONS_Printf("\"\n"); + CON_LogMessage("\"\n"); } else { diff --git a/src/d_netcmd.c b/src/d_netcmd.c index da303f26..ce2bbecb 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -420,7 +420,7 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, " consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL}; // log elemental hazards -- not a netvar, is local to current player -consvar_t cv_hazardlog = {"hazardlog", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_hazardlog = {"hazardlog", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_forceskin = {"forceskin", "-1", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -3217,11 +3217,11 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80'); } else if (NetPacket.packet.newteam == 3) - /*CONS_Printf(M_GetText("%s entered the game.\n"), player_names[playernum])*/; + CON_LogMessage(va(M_GetText("%s entered the game.\n"), player_names[playernum])); else if (players[playernum].pflags & PF_WANTSTOJOIN) players[playernum].pflags &= ~PF_WANTSTOJOIN; else - CONS_Printf(M_GetText("%s became a spectator.\n"), player_names[playernum]); + CON_LogMessage(va(M_GetText("%s became a spectator.\n"), player_names[playernum])); //reset view if you are changed, or viewing someone who was changed. if (playernum == consoleplayer || displayplayer == playernum) diff --git a/src/g_game.c b/src/g_game.c index 8d706bbf..6e8c01e9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3051,7 +3051,7 @@ void G_ExitLevel(void) } if (netgame || multiplayer) - CONS_Printf(M_GetText("The round has ended.\n")); + CON_LogMessage(M_GetText("The round has ended.\n")); // Remove CEcho text on round end. HU_DoCEcho(""); @@ -4341,13 +4341,13 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool { char *title = G_BuildMapTitle(gamemap); - CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap)); + CON_LogMessage(va(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap))); if (title) { - CONS_Printf(": %s", title); + CON_LogMessage(va(": %s", title)); Z_Free(title); } - CONS_Printf("\"\n"); + CON_LogMessage("\"\n"); } } diff --git a/src/k_kart.c b/src/k_kart.c index 24acd3f2..b7c8721f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2042,13 +2042,8 @@ void K_StealBumper(player_t *player, player_t *victim, boolean force) } } - if (netgame) - { - if (player->kartstuff[k_bumper] <= 0) - CONS_Printf(M_GetText("%s is back in the game!\n"), player_names[player-players]); - else if (cv_hazardlog.value) - CONS_Printf(M_GetText("%s stole a bumper from %s!\n"), player_names[player-players], player_names[victim-players]); - } + if (netgame && player->kartstuff[k_bumper] <= 0) + CONS_Printf(M_GetText("%s is back in the game!\n"), player_names[player-players]); newbumper = player->kartstuff[k_bumper]; if (newbumper <= 1) diff --git a/src/p_inter.c b/src/p_inter.c index cd0ed893..11f2f504 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -510,8 +510,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } special->target->player->kartstuff[k_comebackpoints] += 2 * (K_IsPlayerWanted(player) ? 2 : 1); - if (netgame && cv_hazardlog.value) - CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[special->target->player-players], player_names[player-players]); if (special->target->player->kartstuff[k_comebackpoints] >= 3) K_StealBumper(special->target->player, player, true); special->target->player->kartstuff[k_comebacktimer] = comebacktime; @@ -527,8 +525,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->target->player->kartstuff[k_comebackmode] = 0; special->target->player->kartstuff[k_comebackpoints]++; - if (netgame && cv_hazardlog.value) - CONS_Printf(M_GetText("%s gave an item to %s.\n"), player_names[special->target->player-players], player_names[player-players]); if (special->target->player->kartstuff[k_comebackpoints] >= 3) K_StealBumper(special->target->player, player, true); special->target->player->kartstuff[k_comebacktimer] = comebacktime; @@ -560,8 +556,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->target->player->kartstuff[k_comebackmode] = 0; special->target->player->kartstuff[k_comebackpoints]++; - if (netgame && cv_hazardlog.value) - CONS_Printf(M_GetText("%s gave an \"item\" to %s.\n"), player_names[special->target->player-players], player_names[player-players]); if (special->target->player->kartstuff[k_comebackpoints] >= 3) K_StealBumper(special->target->player, player, true); special->target->player->kartstuff[k_comebacktimer] = comebacktime; diff --git a/src/p_spec.c b/src/p_spec.c index 143efd90..f723a6e7 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -36,6 +36,7 @@ #include "lua_hook.h" // LUAh_LinedefExecute #include "k_kart.h" // SRB2kart +#include "console.h" // CON_LogMessage #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -4215,15 +4216,8 @@ DoneSection2: if (player->pflags & PF_NIGHTSMODE) player->drillmeter += 48*20; - if (netgame) - { - if (player->laps >= (UINT8)cv_numlaps.value) - CONS_Printf(M_GetText("%s has finished the race.\n"), player_names[player-players]); - else if (player->laps == (UINT8)(cv_numlaps.value - 1)) - CONS_Printf("%s started the final lap\n", player_names[player-players]); - else - CONS_Printf(M_GetText("%s started lap %u\n"), player_names[player-players], (UINT32)player->laps+1); - } + if (netgame && player->laps >= (UINT8)cv_numlaps.value) + CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players])); // SRB2Kart: save best lap for record attack if (player == &players[consoleplayer]) diff --git a/src/p_user.c b/src/p_user.c index e49c8fda..71ff53da 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -45,6 +45,7 @@ // SRB2kart #include "m_cond.h" // M_UpdateUnlockablesAndExtraEmblems #include "k_kart.h" +#include "console.h" // CON_LogMessage #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -8732,7 +8733,7 @@ boolean P_SpectatorJoinGame(player_t *player) if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) displayplayer = consoleplayer; - CONS_Printf(M_GetText("%s entered the game.\n"), player_names[player-players]); + CON_LogMessage(va(M_GetText("%s entered the game.\n"), player_names[player-players])); return true; // no more player->mo, cannot continue. } return false; @@ -8878,7 +8879,7 @@ static void P_CalcPostImg(player_t *player) void P_DoTimeOver(player_t *player) { if (netgame && player->health > 0) - CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]); + CON_LogMessage(va(M_GetText("%s ran out of time.\n"), player_names[player-players])); player->pflags |= PF_TIMEOVER; From b81da3f000674fff6ed964ac8aa9f8e3ca1f4ea6 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 14 Oct 2018 17:54:18 -0400 Subject: [PATCH 2/3] restore --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 71ff53da..3c419e64 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8879,7 +8879,7 @@ static void P_CalcPostImg(player_t *player) void P_DoTimeOver(player_t *player) { if (netgame && player->health > 0) - CON_LogMessage(va(M_GetText("%s ran out of time.\n"), player_names[player-players])); + CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]); player->pflags |= PF_TIMEOVER; From d89fb8fcf738993eeb566e3b6a941164c5a031a3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 17:40:25 -0400 Subject: [PATCH 3/3] remove all hit msgs & cv_hazardlog --- src/d_netcmd.c | 5 -- src/d_netcmd.h | 2 - src/p_inter.c | 196 ------------------------------------------------- 3 files changed, 203 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ce2bbecb..de635aa5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -419,9 +419,6 @@ consvar_t cv_numlaps = {"numlaps", "3", CV_NETVAR|CV_CALL|CV_NOINIT, numlaps_con static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "Map default"}, {0, NULL}}; consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL}; -// log elemental hazards -- not a netvar, is local to current player -consvar_t cv_hazardlog = {"hazardlog", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; - consvar_t cv_forceskin = {"forceskin", "-1", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -594,8 +591,6 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_numlaps); CV_RegisterVar(&cv_basenumlaps); - CV_RegisterVar(&cv_hazardlog); - CV_RegisterVar(&cv_autobalance); CV_RegisterVar(&cv_teamscramble); CV_RegisterVar(&cv_scrambleonchange); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index aee243cf..bbd96d69 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -81,8 +81,6 @@ extern consvar_t cv_basenumlaps; extern UINT32 timelimitintics; extern consvar_t cv_allowexitlevel; -extern consvar_t cv_hazardlog; - extern consvar_t cv_autobalance; extern consvar_t cv_teamscramble; extern consvar_t cv_scrambleonchange; diff --git a/src/p_inter.c b/src/p_inter.c index 11f2f504..15cea7b5 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1661,199 +1661,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } -// -/** Prints death messages relating to a dying or hit player. - * - * \param player Affected player. - * \param inflictor The attack weapon used, can be NULL. - * \param source The attacker, can be NULL. - */ -static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *source) -{ - const char *str = NULL; - boolean deathonly = false; - boolean deadsource = false; - boolean deadtarget = false; - // player names complete with control codes - char targetname[MAXPLAYERNAME+4]; - char sourcename[MAXPLAYERNAME+4]; - - if (G_RaceGametype()) - return; // Not in coop, etc. - - if (!player) - return; // Impossible! - - if (player->spectator) - return; // No messages for dying (crushed) spectators. - - if (!netgame) - return; // Presumably it's obvious what's happening in splitscreen. - -#ifdef HAVE_BLUA - if (LUAh_HurtMsg(player, inflictor, source)) - return; -#endif - - deadtarget = (player->health <= 0); - - // Target's name - snprintf(targetname, sizeof(targetname), "%s%s%s", - CTFTEAMCODE(player), - player_names[player - players], - CTFTEAMENDCODE(player)); - - if (source) - { - // inflictor shouldn't be NULL if source isn't - I_Assert(inflictor != NULL); - - if (source->player) - { - // Source's name (now that we know there is one) - snprintf(sourcename, sizeof(sourcename), "%s%s%s", - CTFTEAMCODE(source->player), - player_names[source->player - players], - CTFTEAMENDCODE(source->player)); - - // We don't care if it's us. - // "Player 1's [redacted] killed Player 1." - if (source->player->playerstate == PST_DEAD && source->player != player && - (inflictor->flags2 & MF2_BEYONDTHEGRAVE)) - deadsource = true; - - if (inflictor->flags & MF_PUSHABLE) - { - str = M_GetText("%s%s's playtime with heavy objects %s %s.\n"); - } - else switch (inflictor->type) - { - case MT_PLAYER: - if ((inflictor->player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) - str = M_GetText("%s%s's armageddon blast %s %s.\n"); - else if (inflictor->player->powers[pw_invulnerability]) - str = M_GetText("%s%s's invincibility aura %s %s.\n"); - else if (inflictor->player->powers[pw_super]) - str = M_GetText("%s%s's super aura %s %s.\n"); - else - str = M_GetText("%s%s's tagging hand %s %s.\n"); - break; - case MT_SPINFIRE: - str = M_GetText("%s%s's elemental fire trail %s %s.\n"); - break; - case MT_THROWNBOUNCE: - str = M_GetText("%s%s's bounce ring %s %s.\n"); - break; - case MT_THROWNINFINITY: - str = M_GetText("%s%s's infinity ring %s %s.\n"); - break; - case MT_THROWNAUTOMATIC: - str = M_GetText("%s%s's automatic ring %s %s.\n"); - break; - case MT_THROWNSCATTER: - str = M_GetText("%s%s's scatter ring %s %s.\n"); - break; - // TODO: For next two, figure out how to determine if it was a direct hit or splash damage. -SH - case MT_THROWNEXPLOSION: - str = M_GetText("%s%s's explosion ring %s %s.\n"); - break; - case MT_THROWNGRENADE: - str = M_GetText("%s%s's grenade ring %s %s.\n"); - break; - case MT_REDRING: - if (inflictor->flags2 & MF2_RAILRING) - str = M_GetText("%s%s's rail ring %s %s.\n"); - else - str = M_GetText("%s%s's thrown ring %s %s.\n"); - break; - default: - str = M_GetText("%s%s %s %s.\n"); - break; - } - - CONS_Printf(str, - deadsource ? M_GetText("The late ") : "", - sourcename, - deadtarget ? M_GetText("killed") : M_GetText("hit"), - targetname); - return; - } - else switch (source->type) - { - case MT_NULL: - switch(source->threshold) - { - case 42: - deathonly = true; - str = M_GetText("%s drowned.\n"); - break; - case 43: - str = M_GetText("%s was %s by spikes.\n"); - break; - case 44: - deathonly = true; - str = M_GetText("%s was crushed.\n"); - break; - } - break; - case MT_EGGMANICO: - case MT_EGGMANBOX: - str = M_GetText("%s was %s by Eggman's nefarious TV magic.\n"); - break; - case MT_SPIKE: - str = M_GetText("%s was %s by spikes.\n"); - break; - default: - str = M_GetText("%s was %s by an environmental hazard.\n"); - break; - } - } - else - { - // null source, environment kills - // TERRIBLE HACK for hit damage because P_DoPlayerPain moves the player... - // I'll put it back, I promise! - player->mo->z -= player->mo->momz+1; - if (P_PlayerTouchingSectorSpecial(player, 1, 2)) - str = M_GetText("%s was %s by chemical water.\n"); - else if (P_PlayerTouchingSectorSpecial(player, 1, 3)) - str = M_GetText("%s was %s by molten lava.\n"); - else if (P_PlayerTouchingSectorSpecial(player, 1, 4)) - str = M_GetText("%s was %s by electricity.\n"); - else if (deadtarget) - { - deathonly = true; - if (P_PlayerTouchingSectorSpecial(player, 1, 6) - || P_PlayerTouchingSectorSpecial(player, 1, 7)) - str = M_GetText("%s fell into a bottomless pit.\n"); - else if (P_PlayerTouchingSectorSpecial(player, 1, 12)) - str = M_GetText("%s asphyxiated in space.\n"); - else - str = M_GetText("%s died.\n"); - } - if (!str) - str = M_GetText("%s was %s by an environmental hazard.\n"); - - player->mo->z += player->mo->momz+1; - } - - if (!str) // Should not happen! Unless we missed catching something above. - return; - - // Don't log every hazard hit if they don't want us to. - if (!deadtarget && !cv_hazardlog.value) - return; - - if (deathonly) - { - if (!deadtarget) - return; - CONS_Printf(str, targetname); - } - else - CONS_Printf(str, targetname, deadtarget ? M_GetText("killed") : M_GetText("hit")); -} - /** Checks if the level timer is over the timelimit and the round should end, * unless you are in overtime. In which case leveltime may stretch out beyond * timelimitintics and overtime's status will be checked here each tick. @@ -2813,7 +2620,6 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou /*if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT)) { P_AddPlayerScore(source->player, 1); //award points to tagger. - P_HitDeathMessages(player, inflictor, source); if (gametype == GT_TAG) //survivor { @@ -3503,8 +3309,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (player->health < 0) player->health = 0; - P_HitDeathMessages(player, inflictor, source); - P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); }