Skip to content

Commit

Permalink
Various changes
Browse files Browse the repository at this point in the history
- Implemented CVAR for the feature
- Made the feature be disabled by strict mode and during critical play
- Made the feature activate only when the player is completely dead (i.e. both player and its mobj have health <= 0)
  • Loading branch information
MrAlaux committed Jan 9, 2025
1 parent a51be45 commit 7b9319b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -4760,6 +4760,8 @@ void G_BindCompVariables(void)
false, ss_comp, wad_no, "Direct vertical aiming");
M_BindBool("pistolstart", &default_pistolstart, &pistolstart,
false, ss_comp, wad_no, "Pistol start");
M_BindBool("infight_upon_death", &infight_upon_death, NULL,
false, ss_comp, wad_no, "Monsters infight upon player death");

#define BIND_COMP(id, v, help) \
M_BindNum(#id, &default_comp[(id)], &comp[(id)], (v), 0, 1, ss_none, wad_yes, help)
Expand Down
3 changes: 3 additions & 0 deletions src/mn_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,9 @@ setup_menu_t comp_settings1[] = {
{"Emulate INTERCEPTS overflow", S_ONOFF | S_VANILLA, M_X, M_SPC,
{"emu_intercepts"}, .action = UpdateInterceptsEmuItem},

{"Infight Upon Player Death", S_ONOFF | S_STRICT, M_X, M_SPC,
{"infight_upon_death"}},

MI_RESET,

MI_END
Expand Down
7 changes: 5 additions & 2 deletions src/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,8 @@ static boolean PIT_FindTarget(mobj_t *mo)
// Returns true if a player is targeted.
//

boolean infight_upon_death;

#define MONS_LOOK_RANGE (20*64*FRACUNIT)
#define MONS_LOOK_LIMIT 64

Expand Down Expand Up @@ -866,8 +868,9 @@ static boolean P_LookForPlayers(mobj_t *actor, boolean allaround)
player_t *player;
int stop, stopc, c;

// Single player game and player is dead, look for monsters
if (!netgame && players[0].health <= 0)
// Casual game and player is dead, look for monsters
if (infight_upon_death && !critical && !strictmode
&& players[0].health <= 0 && players[0].mo->health <= 0)
{
return (P_LookForMonsters_Heretic(actor));
}
Expand Down
1 change: 1 addition & 0 deletions src/p_enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extern struct brain_s { // killough 3/26/98: global state of boss brain
} brain;

extern boolean ghost_monsters;
extern boolean infight_upon_death;

#endif // __P_ENEMY__

Expand Down

0 comments on commit 7b9319b

Please sign in to comment.