From 7b9319b9ba752d499ea7052b9790d5a479abb072 Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Wed, 8 Jan 2025 21:51:17 -0300 Subject: [PATCH] Various changes - 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) --- src/g_game.c | 2 ++ src/mn_setup.c | 3 +++ src/p_enemy.c | 7 +++++-- src/p_enemy.h | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 72e8bccbe..4921cbe94 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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) diff --git a/src/mn_setup.c b/src/mn_setup.c index e9f787964..3dd2f4e13 100644 --- a/src/mn_setup.c +++ b/src/mn_setup.c @@ -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 diff --git a/src/p_enemy.c b/src/p_enemy.c index 8bcaa6112..169023f16 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -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 @@ -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)); } diff --git a/src/p_enemy.h b/src/p_enemy.h index 26a471bfe..dc1dd4708 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -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__