implement NOTARGET cheat

This commit is contained in:
Roman Fomin 2022-07-30 22:04:41 +07:00
parent 23f93db25d
commit d8527b281c
3 changed files with 31 additions and 2 deletions

View File

@ -74,7 +74,9 @@ typedef enum
// Not really a cheat, just a debug aid.
CF_NOMOMENTUM = 4,
// BUDDHA cheat
CF_BUDDHA = 8
CF_BUDDHA = 8,
// NOTARGET cheat
CF_NOTARGET = 16
} cheat_t;

View File

@ -85,6 +85,7 @@ static void cheat_nuke();
static void cheat_rate();
static void cheat_buddha();
static void cheat_spechits();
static void cheat_notarget();
static void cheat_autoaim(); // killough 7/19/98
static void cheat_tst();
@ -181,6 +182,9 @@ struct cheat_s cheat[] = {
{"spechits", NULL, not_net | not_demo,
cheat_spechits },
{"notarget", "Notarget mode", not_net | not_demo,
cheat_notarget },
{"iddt", "Map cheat", not_dm,
cheat_ddt }, // killough 2/07/98: moved from am_map.c
@ -390,6 +394,15 @@ static void cheat_buddha()
plyr->message = "Buddha Mode OFF";
}
static void cheat_notarget()
{
plyr->cheats ^= CF_NOTARGET;
if (plyr->cheats & CF_NOTARGET)
plyr->message = "Notarget Mode ON";
else
plyr->message = "Notarget Mode OFF";
}
static void cheat_tst()
{ // killough 10/98: same as iddqd except for message
cheat_god();

View File

@ -121,6 +121,10 @@ static void P_RecursiveSound(sector_t *sec, int soundblocks,
void P_NoiseAlert(mobj_t *target, mobj_t *emitter)
{
// [crispy] monsters are deaf with NOTARGET cheat
if (target && target->player && (target->player->cheats & CF_NOTARGET))
return;
validcount++;
P_RecursiveSound(emitter->subsector->sector, 0, target);
}
@ -869,6 +873,10 @@ static boolean P_LookForPlayers(mobj_t *actor, boolean allaround)
player = &players[actor->lastlook];
// [crispy] monsters don't look for players with NOTARGET cheat
if (player->cheats & CF_NOTARGET)
continue;
if (player->health <= 0)
continue; // dead
@ -1035,6 +1043,12 @@ void A_Look(mobj_t *actor)
{
mobj_t *targ;
targ = actor->subsector->sector->soundtarget;
// [crispy] monsters don't look for players with NOTARGET cheat
if (targ && targ->player && (targ->player->cheats & CF_NOTARGET))
return;
// killough 7/18/98:
// Friendly monsters go after other monsters first, but
// also return to player, without attacking them, if they
@ -1042,7 +1056,7 @@ void A_Look(mobj_t *actor)
actor->threshold = actor->pursuecount = 0;
if (!(actor->flags & MF_FRIEND && P_LookForTargets(actor, false)) &&
!((targ = actor->subsector->sector->soundtarget) &&
!(targ &&
targ->flags & MF_SHOOTABLE &&
(P_SetTarget(&actor->target, targ),
!(actor->flags & MF_AMBUSH) || P_CheckSight(actor, targ))) &&