Restore D1 boss always-teleport in D1 missions

In Descent 1, up until commit 8291391, boss robots teleported without
regard to whether the player was visible or active.  Commit 8291391
changed that in an attempt to make the D2 emulation of D1 boss robots
behave well in levels that relied on the D2 quirk of spawning the boss
in a confined segment, then letting it teleport freely once the player
releases it.  However, that change applied even in D1 missions and in
the D1 engine, where maps were designed with the expectation that boss
robots teleported routinely.  Restrict the new rule to the D2 engine
playing D2 levels.  This enables boss robots to teleport freely on D1
missions, regardless of which engine is used.  It would be better if
there were a level flag explaining whether the author wanted the boss to
teleport freely, but there is no such flag, so this heuristic must
suffice.

Reported-by: TheMiracleMatter <https://github.com/dxx-rebirth/dxx-rebirth/issues/434>
Fixes: 8291391b7f ("Fix D2 emulation of D1 boss teleport handling")
This commit is contained in:
Kp 2019-07-13 22:28:57 +00:00
parent 7bd861e374
commit a65e461bb6

View file

@ -2479,6 +2479,10 @@ fix Prev_boss_shields = -1;
namespace dsx {
#if defined(DXX_BUILD_DESCENT_I)
#define do_d1_boss_stuff(FS,FO,PV) do_d1_boss_stuff(FS,FO)
#endif
// --------------------------------------------------------------------------------------------------------------------
// Do special stuff for a boss.
static void do_d1_boss_stuff(fvmsegptridx &vmsegptridx, const vmobjptridx_t objp, const player_visibility_state player_visibility)
@ -2491,8 +2495,10 @@ static void do_d1_boss_stuff(fvmsegptridx &vmsegptridx, const vmobjptridx_t objp
}
#endif
if (!player_is_visible(player_visibility) && !Boss_hit_this_frame)
#if defined(DXX_BUILD_DESCENT_II)
if (!EMULATING_D1 && !player_is_visible(player_visibility) && !Boss_hit_this_frame)
return;
#endif
if (!Boss_dying) {
if (objp->ctype.ai_info.CLOAKED == 1) {
@ -3301,13 +3307,13 @@ _exit_cheat:
compute_vis_and_vec(vmsegptridx, obj, player_info, vis_vec_pos, ailp, player_visibility, robptr);
#if defined(DXX_BUILD_DESCENT_II)
auto pv = player_visibility.visibility;
// If player cloaked, visibility is screwed up and superboss will gate in robots when not supposed to.
if (player_info.powerup_flags & PLAYER_FLAGS_CLOAKED) {
pv = player_visibility_state::no_line_of_sight;
}
#if defined(DXX_BUILD_DESCENT_II)
if (boss_flag != BOSS_D1)
{
do_d2_boss_stuff(vmsegptridx, obj, pv);