Skip to content

Commit

Permalink
Riot Mode cheat improvements
Browse files Browse the repository at this point in the history
Now, only enemies alerted by the player perform the search for targets.
  • Loading branch information
MrAlaux committed Jan 10, 2025
1 parent dc2639f commit 52113e5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
4 changes: 3 additions & 1 deletion docs/cheats.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ Shortcut to toggle the two cheats mentioned above, and IDFA.
Force gibbing on dying enemies, independently of damage dealt.

`RIOTMODE`
Make enemies attack all sentient entities (including other enemies),
Make enemies alerted by the player attack all sentient entities (including other enemies),
and allow entities to damage their same species.

Note that when both the no-target cheat and this one are enabled, enemies will still be alerted normally, but they won't target the player.

`IDFLY`
Toggle Fly Mode (uses jumping/crouching keys).

Expand Down
25 changes: 19 additions & 6 deletions src/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ 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))
if (target && target->player && (target->player->cheats & CF_NOTARGET)
&& !riotmode) // [Nugget]
return;

validcount++;
Expand Down Expand Up @@ -1047,8 +1048,13 @@ static boolean P_LookForMonsters(mobj_t *actor, boolean allaround)
}

// [Nugget]
static boolean P_LookForAnyTargets(mobj_t *actor)
static boolean P_LookForAnyTargets(mobj_t *const actor, const boolean force)
{
// Only perform the search if this actor was alerted by the player,
// through sound (represented by `force`) or sight
if (!force && !P_CheckSight(players[0].mo, actor))
{ return false; }

thinker_t *currentthinker = &thinkercap;

mobj_t *closest = NULL;
Expand Down Expand Up @@ -1102,7 +1108,7 @@ static boolean P_LookForTargets(mobj_t *actor, int allaround)
{
// [Nugget]
if (riotmode && !(actor->flags & MF_FRIEND))
{ return P_LookForAnyTargets(actor); }
{ return P_LookForAnyTargets(actor, false); }

return actor->flags & MF_FRIEND ?
P_LookForMonsters(actor, allaround) || P_LookForPlayers (actor, allaround):
Expand Down Expand Up @@ -1164,10 +1170,9 @@ void A_Look(mobj_t *actor)

targ = actor->subsector->sector->soundtarget;

if (riotmode) { targ = NULL; } // [Nugget]

// [crispy] monsters don't look for players with NOTARGET cheat
if (targ && targ->player && (targ->player->cheats & CF_NOTARGET))
if (targ && targ->player && (targ->player->cheats & CF_NOTARGET)
&& !riotmode) // [Nugget]
return;

// killough 7/18/98:
Expand All @@ -1176,6 +1181,14 @@ void A_Look(mobj_t *actor)
// cannot find any targets. A marine's best friend :)

actor->threshold = actor->pursuecount = 0;

// [Nugget]
if (riotmode && !(actor->flags & MF_FRIEND) && targ)
{
P_LookForAnyTargets(actor, true);
}
else

if (!(actor->flags & MF_FRIEND && P_LookForTargets(actor, false)) &&
!(targ &&
targ->flags & MF_SHOOTABLE &&
Expand Down

0 comments on commit 52113e5

Please sign in to comment.