- Added buddha cheat.

SVN r1756 (trunk)
This commit is contained in:
Randy Heit 2009-08-07 04:08:38 +00:00
parent 16846fe36d
commit f9088bd2cf
8 changed files with 54 additions and 14 deletions

View file

@ -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.)

View file

@ -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 ())

View file

@ -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

View file

@ -208,6 +208,7 @@ enum ECheatCommand
CHT_GIMMIEI,
CHT_GIMMIEJ,
CHT_GIMMIEZ,
CHT_BUDDHA
};
void StartChunk (int id, BYTE **stream);

View file

@ -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)

View file

@ -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)
{

View file

@ -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;
}

View file

@ -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"