Battle: make sure Overtime lasers are visible during round end camera

This commit is contained in:
James R 2024-01-21 18:25:52 -08:00
parent 418f2a14c4
commit 8f53d34325
3 changed files with 39 additions and 22 deletions

View file

@ -25,6 +25,7 @@
#include "hu_stuff.h"
#include "m_easing.h"
#include "k_endcam.h"
#include "p_tick.h"
#define BARRIER_MIN_RADIUS (768 * mapobjectscale)
@ -727,6 +728,36 @@ static void K_SpawnOvertimeLaser(fixed_t x, fixed_t y, fixed_t scale)
}
}
void K_SpawnOvertimeBarrier(void)
{
if (battleovertime.radius <= 0)
{
return;
}
const INT32 orbs = 32;
const angle_t angoff = ANGLE_MAX / orbs;
const UINT8 spriteSpacing = 128;
fixed_t circumference = FixedMul(M_PI_FIXED, battleovertime.radius * 2);
fixed_t scale = max(circumference / spriteSpacing / orbs, mapobjectscale);
fixed_t size = FixedMul(mobjinfo[MT_OVERTIME_PARTICLE].radius, scale);
fixed_t posOffset = max(battleovertime.radius - size, 0);
INT32 i;
for (i = 0; i < orbs; i++)
{
angle_t ang = (i * angoff) + FixedAngle((leveltime * FRACUNIT) / 4);
fixed_t x = battleovertime.x + P_ReturnThrustX(NULL, ang, posOffset);
fixed_t y = battleovertime.y + P_ReturnThrustY(NULL, ang, posOffset);
K_SpawnOvertimeLaser(x, y, scale);
}
}
void K_RunBattleOvertime(void)
{
if (battleovertime.enabled < 10*TICRATE)
@ -784,29 +815,9 @@ void K_RunBattleOvertime(void)
}
}
if (battleovertime.radius > 0)
if (!P_LevelIsFrozen())
{
const INT32 orbs = 32;
const angle_t angoff = ANGLE_MAX / orbs;
const UINT8 spriteSpacing = 128;
fixed_t circumference = FixedMul(M_PI_FIXED, battleovertime.radius * 2);
fixed_t scale = max(circumference / spriteSpacing / orbs, mapobjectscale);
fixed_t size = FixedMul(mobjinfo[MT_OVERTIME_PARTICLE].radius, scale);
fixed_t posOffset = max(battleovertime.radius - size, 0);
INT32 i;
for (i = 0; i < orbs; i++)
{
angle_t ang = (i * angoff) + FixedAngle((leveltime * FRACUNIT) / 4);
fixed_t x = battleovertime.x + P_ReturnThrustX(NULL, ang, posOffset);
fixed_t y = battleovertime.y + P_ReturnThrustY(NULL, ang, posOffset);
K_SpawnOvertimeLaser(x, y, scale);
}
K_SpawnOvertimeBarrier();
}
}

View file

@ -45,6 +45,7 @@ mobj_t *K_SpawnSphereBox(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 f
void K_DropEmeraldsFromPlayer(player_t *player, UINT32 emeraldType);
UINT8 K_NumEmeralds(player_t *player);
void K_RunPaperItemSpawners(void);
void K_SpawnOvertimeBarrier(void);
void K_RunBattleOvertime(void);
void K_SetupMovingCapsule(mapthing_t *mt, mobj_t *mobj);
void K_SpawnPlayerBattleBumpers(player_t *p);

View file

@ -15,6 +15,7 @@
#include "doomdef.h"
#include "doomtype.h"
#include "g_game.h"
#include "k_battle.h"
#include "k_endcam.h"
#include "m_easing.h"
#include "p_local.h"
@ -168,6 +169,10 @@ EndCam& endcam_cast()
void K_CommitEndCamera(void)
{
// Level will be frozen, so make sure the lasers are
// spawned before that happens.
K_SpawnOvertimeBarrier();
endcam_cast().Start();
}