Direct players to battle UFOs via Obj_PointPlayersToXY

This commit is contained in:
AJ Martinez 2023-06-30 16:02:46 -07:00 committed by VelocitOni
parent a98db957e6
commit 1c633dd9ee
5 changed files with 25 additions and 2 deletions

View file

@ -71,7 +71,8 @@ typedef enum
PF_GAINAX = 1<<3,
PF_KICKSTARTACCEL = 1<<4, // Accessibility feature: Is accelerate in kickstart mode?
// 1<<5 free
PF_POINTME = 1<<5, // An object is calling for my attention (via Obj_PointPlayersToMobj). Unset every frame!
// 1<<6 free
PF_WANTSTOJOIN = 1<<7, // Spectator that wants to join

View file

@ -8353,6 +8353,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
}
K_HandleDelayedHitByEm(player);
player->pflags &= ~PF_POINTME;
}
void K_KartResetPlayerColor(player_t *player)

View file

@ -145,6 +145,7 @@ void Obj_SpawnGachaBomRebound(mobj_t *source, mobj_t *target);
/* Servant Hand */
void Obj_ServantHandHandling(player_t *player);
void Obj_PointPlayersToXY(fixed_t x, fixed_t y);
/* Super Flicky Controller */
void Obj_SpawnSuperFlickySwarm(player_t *owner, tic_t time);

View file

@ -132,6 +132,8 @@ void Obj_BattleUFOThink(mobj_t *mobj)
{
ufo->spawn_beam();
}
Obj_PointPlayersToXY(mobj->x, mobj->y);
}
void Obj_BattleUFODeath(mobj_t *mobj)

View file

@ -5,10 +5,12 @@
#include "../k_kart.h"
#include "../k_objects.h"
#include "../v_video.h"
#include "../r_main.h"
#include "../g_game.h"
void Obj_ServantHandHandling(player_t *player)
{
if (player->pflags & PF_WRONGWAY)
if (player->pflags & PF_WRONGWAY || player->pflags & PF_POINTME)
{
if (player->handtimer < TICRATE)
{
@ -101,3 +103,18 @@ void Obj_ServantHandHandling(player_t *player)
player->hand->renderflags |= (RF_DONTDRAW & ~K_GetPlayerDontDrawFlag(player));
}
}
void Obj_PointPlayersToXY(fixed_t x, fixed_t y)
{
for(int i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator || !players[i].mo)
continue;
angle_t angletotarget = R_PointToAngle2(
players[i].mo->x, players[i].mo->y,
x, y);
players[i].pflags |= PF_POINTME;
players[i].besthanddirection = angletotarget;
}
}