From e5ed1c4be34ba4393a77403329f1c89c1a806172 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 23 Dec 2007 17:03:52 +0000 Subject: [PATCH] - Added Karate Chris's 'sv_degeneration' submission. - Fixed: 'Bot joined the team' message was passing an FString to Printf. SVN r627 (trunk) --- docs/rh-log.txt | 2 ++ src/b_game.cpp | 2 +- src/d_main.cpp | 1 + src/doomdef.h | 2 +- src/m_options.cpp | 1 + src/p_user.cpp | 14 ++++++++++++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f259191fe..f39208178 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ December 23, 2007 (Changes by Graf Zahl) +- Added Karate Chris's 'sv_degeneration' submission. +- Fixed: 'Bot joined the team' message was passing an FString to Printf. - Backported GZDoom's true color font mappings for use with native textures when the time comes. - Added Karate Chris's 'sv_doubleammo' submission. diff --git a/src/b_game.cpp b/src/b_game.cpp index 8d1754279..f51c139e1 100644 --- a/src/b_game.cpp +++ b/src/b_game.cpp @@ -377,7 +377,7 @@ void DCajunMaster::DoAddBot (int bnum, char *info) botingame[bnum] = true; if (teamplay) - Printf ("%s joined the %s team\n", players[bnum].userinfo.netname, teams[players[bnum].userinfo.team].name); + Printf ("%s joined the %s team\n", players[bnum].userinfo.netname, teams[players[bnum].userinfo.team].name.GetChars ()); else Printf ("%s joined the game\n", players[bnum].userinfo.netname); diff --git a/src/d_main.cpp b/src/d_main.cpp index 1656fcfeb..84f3d001a 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -389,6 +389,7 @@ CVAR (Flag, sv_nocrouch, dmflags, DF_NO_CROUCH); CVAR (Int, dmflags2, 0, CVAR_SERVERINFO); CVAR (Flag, sv_weapondrop, dmflags2, DF2_YES_WEAPONDROP); CVAR (Flag, sv_doubleammo, dmflags2, DF2_YES_DOUBLEAMMO); +CVAR (Flag, sv_degeneration, dmflags2, DF2_YES_DEGENERATION); CVAR (Flag, sv_nobfgaim, dmflags2, DF2_NO_FREEAIMBFG); CVAR (Flag, sv_respawnprotect, dmflags2, DF2_YES_INVUL); CVAR (Flag, sv_barrelrespawn, dmflags2, DF2_BARRELS_RESPAWN); diff --git a/src/doomdef.h b/src/doomdef.h index 5d6f548b7..b068d5d6b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -249,7 +249,7 @@ enum DF2_YES_DOUBLEAMMO = 1 << 10, // Doubles ammo like skill 1 and 5 do //#define DF2_NO_CLEARFRAGS 2048 // Don't clear frags after each level //#define DF2_FORCE_NORESPAWN 4096 // Player cannot respawn -//#define DF2_YES_DEGENERATION 8192 // Quake-style degeneration + DF2_YES_DEGENERATION = 1 << 13, // Quake-style degeneration //#define DF2_YES_LOSEFRAG 16384 // Lose a frag when killed. More incentive to try to // // not get yerself killed DF2_NO_FREEAIMBFG = 1 << 15, // Don't allow BFG to be aimed at the ground diff --git a/src/m_options.cpp b/src/m_options.cpp index 01276c193..3096d053e 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1019,6 +1019,7 @@ static menuitem_t DMFlagsItems[] = { { bitflag, "Items respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_ITEMS_RESPAWN} }, { bitflag, "Big powerups respawn", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_RESPAWN_SUPER} }, { bitflag, "Fast monsters", {&dmflags}, {0}, {0}, {0}, {(value_t *)DF_FAST_MONSTERS} }, + { bitflag, "Degeneration", {&dmflags2}, {0}, {0}, {0}, {(value_t *)DF2_YES_DEGENERATION} }, { bitflag, "Allow jump", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_JUMP} }, { bitflag, "Allow crouch", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_CROUCH} }, { bitflag, "Allow freelook", {&dmflags}, {1}, {0}, {0}, {(value_t *)DF_NO_FREELOOK} }, diff --git a/src/p_user.cpp b/src/p_user.cpp index 2110d8de5..2a44ab091 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2196,6 +2196,20 @@ void P_PlayerThink (player_t *player) } } + // Apply degeneration. + if (dmflags2 & DF2_YES_DEGENERATION) + { + if ((gametic % TICRATE) == 0 && player->health > deh.MaxHealth) + { + if (player->health - 5 < deh.MaxHealth) + player->health = deh.MaxHealth; + else + player->health--; + + player->mo->health = player->health; + } + } + // Handle air supply if (level.airsupply > 0) {