Skip to content

Commit

Permalink
Hexen: Add optional fix for vanilla bug with Heresiarch zero cast time
Browse files Browse the repository at this point in the history
Bug:
When Heresiarch loses his target, he switches to Spawn state and
spawns another set of his cubes. Each additional cube reduces cast time
until it becomes instant. This leads to permanent invulnerability spell.

Fix:
When Heresiarch loses his target, switch to the third frame of Spawn state, skipping spawn of cubes.

Switch available in config as `heresiarch_zero_cast_time_fix` parameter. 1 - fix enabled, 0 - fix disabled.
Enabled by default in Recommended settings and disabled in Vanilla settings.
  • Loading branch information
Dasperal committed May 27, 2024
1 parent e289ee9 commit b7c0532
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/hexen/h2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ int breathing = 0;
int skip_unused_artifact = 0;
int pistol_start = 0;

// [Dasperal] Vanila bugs fixes
int heresiarch_zero_cast_time_fix = 1;

int selective_class = 0;
int selective_skill = 2;
int selective_episode = 1;
Expand Down Expand Up @@ -409,6 +412,9 @@ void D_BindVariables(void)
M_BindIntVariable("skip_unused_artifact", &skip_unused_artifact);
M_BindIntVariable("pistol_start", &pistol_start);

// [Dasperal] Vanila bugs fixes
M_BindIntVariable("heresiarch_zero_cast_time_fix", &heresiarch_zero_cast_time_fix);

// Gameplay: Crosshair
M_BindIntVariable("crosshair_draw", &crosshair_draw);
M_BindIntVariable("crosshair_shape", &crosshair_shape);
Expand Down
3 changes: 3 additions & 0 deletions src/hexen/h2def.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ extern boolean skippsprinterp;

extern int artiskip; // whether shift-enter skips an artifact

// [Dasperal] Vanila bugs fixes
extern int heresiarch_zero_cast_time_fix;

/*
===============================================================================
Expand Down
2 changes: 2 additions & 0 deletions src/hexen/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5919,6 +5919,7 @@ void M_RD_BackToDefaults_Recommended (void)
weapon_widget = 0;
skip_unused_artifact = 0;
pistol_start = 0;
heresiarch_zero_cast_time_fix = 1;
// Gameplay (4)
crosshair_draw = 0;
crosshair_shape = 0;
Expand Down Expand Up @@ -6038,6 +6039,7 @@ static void M_RD_BackToDefaults_Original(void)
weapon_widget = 0;
skip_unused_artifact = 1;
pistol_start = 0;
heresiarch_zero_cast_time_fix = 0;
// Gameplay (4)
crosshair_draw = 0;
crosshair_shape = 0;
Expand Down
26 changes: 21 additions & 5 deletions src/hexen/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,29 @@ void A_Chase(mobj_t *actor, player_t *player, pspdef_t *psp)
}
}

if (!actor->target || !(actor->target->flags & MF_SHOOTABLE))
{ // look for a new target
if (P_LookForPlayers(actor, true))
{ // got a new target
if(!actor->target || !(actor->target->flags & MF_SHOOTABLE))
{
// look for a new target
if(P_LookForPlayers(actor, true))
{
// got a new target
return;
}
P_SetMobjState(actor, actor->info->spawnstate);

if(heresiarch_zero_cast_time_fix && actor->type == MT_SORCBOSS)
{
// Bug:
// When Heresiarch loses his target, he switches to Spawn state and
// spawns another set of his cubes. Each additional cube reduces cast time
// until it becomes instant. This leads to permanent invulnerability spell.
// Fix:
// When Heresiarch looses his target, switch to the third frame of Spawn state, skipping spawn of cubes.
P_SetMobjState(actor, S_SORC_LOOK1);
}
else
{
P_SetMobjState(actor, actor->info->spawnstate);
}
return;
}

Expand Down
3 changes: 3 additions & 0 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ static default_t defaults_list[] =
CONFIG_VARIABLE_INT(fast_quickload),
CONFIG_VARIABLE_INT(skip_unused_artifact),

// [Dasperal] Vanila bugs fixes
CONFIG_VARIABLE_INT(heresiarch_zero_cast_time_fix),

// Gameplay: Demos
CONFIG_VARIABLE_INT(demotimer),
CONFIG_VARIABLE_INT(demotimerdir),
Expand Down

0 comments on commit b7c0532

Please sign in to comment.