diff --git a/docs/rh-log.txt b/docs/rh-log.txt index d3261dc65..a3517d101 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ August 6, 2009 +- Added buddha cheat. - Added TELEFRAG_DAMAGE constant, and changed the two places that still used 1000 as the threshold for god mode damage to use it instead. (Players with MF2_INVULNERABLE set already used 1000000 as their threshold.) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index a80a27a8d..b1d95215a 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -130,6 +130,15 @@ CCMD (iddqd) Net_WriteByte (CHT_IDDQD); } +CCMD (buddha) +{ + if (CheckCheatmode()) + return; + + Net_WriteByte(DEM_GENERICCHEAT); + Net_WriteByte(CHT_BUDDHA); +} + CCMD (notarget) { if (CheckCheatmode ()) diff --git a/src/d_player.h b/src/d_player.h index 1eacd7e39..0e7b017f4 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -197,6 +197,7 @@ typedef enum CF_WEAPONBOBBING = 1 << 24, // [HW] Bob weapon while the player is moving CF_WEAPONREADYALT = 1 << 25, // Weapon can fire its secondary attack CF_WEAPONSWITCHOK = 1 << 26, // It is okay to switch away from this weapon + CF_BUDDHA = 1 << 27, // [SP] Buddha mode - take damage, but don't die } cheat_t; #define WPIECE1 1 diff --git a/src/d_protocol.h b/src/d_protocol.h index 547e20d2a..9f8bde657 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -208,6 +208,7 @@ enum ECheatCommand CHT_GIMMIEI, CHT_GIMMIEJ, CHT_GIMMIEZ, + CHT_BUDDHA }; void StartChunk (int id, BYTE **stream); diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index a76fd1437..fbd99762b 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -100,6 +100,14 @@ void cht_DoCheat (player_t *player, int cheat) SB_state = screen->GetPageCount (); break; + case CHT_BUDDHA: + player->cheats ^= CF_BUDDHA; + if (player->cheats & CF_BUDDHA) + msg = GStrings("TXT_BUDDHAON"); + else + msg = GStrings("TXT_BUDDHAOFF"); + break; + case CHT_NOCLIP: player->cheats ^= CF_NOCLIP; if (player->cheats & CF_NOCLIP) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 6f54445ec..1a5238e45 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1149,9 +1149,20 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage P_AutoUseStrifeHealth (player); player->mo->health = player->health; } - if (player->health < 0) + if (player->health <= 0) { - player->health = 0; + // [SP] Buddha cheat: if the player is about to die, rescue him to 1 health. + // This does not save the player if damage >= TELEFRAG_DAMAGE, still need to + // telefrag him right? ;) (Unfortunately the damage is "absorbed" by armor, + // but telefragging should still do enough damage to kill the player) + if ((player->cheats & CF_BUDDHA) && damage < TELEFRAG_DAMAGE) + { + target->health = player->health = 1; + } + else + { + player->health = 0; + } } player->LastDamageType = mod; player->attacker = source; @@ -1465,18 +1476,25 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, target->health -= damage; if (target->health <= 0) { // Death - target->special1 = damage; - if (player && inflictor && !player->morphTics) - { // Check for flame death - if ((inflictor->DamageType == NAME_Fire) - && (target->health > -50) && (damage > 25)) - { - target->DamageType = NAME_Fire; - } - else target->DamageType = inflictor->DamageType; + if ( player->cheats & CF_BUDDHA ) + { // [SP] Save the player... + player->health = target->health = 1; + } + else + { + target->special1 = damage; + if (player && inflictor && !player->morphTics) + { // Check for flame death + if ((inflictor->DamageType == NAME_Fire) + && (target->health > -50) && (damage > 25)) + { + target->DamageType = NAME_Fire; + } + else target->DamageType = inflictor->DamageType; + } + target->Die (source, source); + return; } - target->Die (source, source); - return; } if (!(level.time&63) && playPainSound) { diff --git a/src/p_user.cpp b/src/p_user.cpp index 4d6b6905b..fe65f55bf 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1820,7 +1820,7 @@ void P_FallingDamage (AActor *actor) { S_Sound (actor, CHAN_AUTO, "*land", 1, ATTN_NORM); P_NoiseAlert (actor, actor, true); - if (damage == 1000000 && (actor->player->cheats & CF_GODMODE)) + if (damage == 1000000 && (actor->player->cheats & (CF_GODMODE | CF_BUDDHA))) { damage = 999; } diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 49a17d312..db9e9405c 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -278,6 +278,8 @@ STSTR_BEHOLD = "inVuln, Str, Inviso, Rad, Allmap, or Lite-amp"; STSTR_BEHOLDX = "Power-up Toggled"; STSTR_CHOPPERS = "... doesn't suck - GM"; STSTR_CLEV = "Changing Level...\n"; +TXT_BUDDHAON = "Buddha mode ON"; +TXT_BUDDHAOFF = "Buddha mode OFF"; E1TEXT = "Once you beat the big badasses and\n"