Battle UFO: polish drops

- Whip
  - Player gets power-up instantly, no paper item spawned
- Items
  - Put a small delay on the drop appearing
  - Adjusted drop spawn position so it spawns right under
    the UFO
This commit is contained in:
James R 2024-01-15 23:53:52 -08:00
parent 3724dd542b
commit ecf70c6eea
3 changed files with 21 additions and 15 deletions

View file

@ -50,6 +50,8 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time)
Obj_SpawnPowerUpAura(player); Obj_SpawnPowerUpAura(player);
} }
player->flashing = 2*TICRATE;
switch (powerup) switch (powerup)
{ {
case POWERUP_SMONITOR: case POWERUP_SMONITOR:

View file

@ -12,6 +12,7 @@
#include "../p_local.h" #include "../p_local.h"
#include "../k_battle.h" #include "../k_battle.h"
#include "../k_objects.h" #include "../k_objects.h"
#include "../k_powerup.h"
#include "../k_kart.h" #include "../k_kart.h"
#include "../k_hud.h" // K_AddMessage #include "../k_hud.h" // K_AddMessage
@ -151,27 +152,31 @@ void Obj_BattleUFODeath(mobj_t *mobj, mobj_t *inflictor)
{ {
UFO* ufo = static_cast<UFO*>(mobj); UFO* ufo = static_cast<UFO*>(mobj);
const SINT8 flip = P_MobjFlip(ufo); const SINT8 flip = P_MobjFlip(ufo);
const kartitems_t pwrup = static_cast<kartitems_t>(P_RandomRange(PR_BATTLEUFO, FIRSTPOWERUP, LASTPOWERUP));
ufo->momz = -(8*mapobjectscale)/2; ufo->momz = -(8*mapobjectscale)/2;
mobj_t* drop = K_CreatePaperItem( if (!P_MobjWasRemoved(inflictor) && inflictor->type == MT_INSTAWHIP &&
!P_MobjWasRemoved(inflictor->target) && inflictor->target->player)
{
// Just give it to the player, they earned it.
K_GivePowerUp(inflictor->target->player, pwrup, BATTLE_POWERUP_TIME);
}
else
{
mobj_t *drop = K_CreatePaperItem(
ufo->x, ufo->x,
ufo->y, ufo->y,
ufo->z + (flip), ufo->z + ufo->sprzoff() + (flip),
0, 0,
flip, flip,
P_RandomRange(PR_BATTLEUFO, FIRSTPOWERUP, LASTPOWERUP), pwrup,
BATTLE_POWERUP_TIME BATTLE_POWERUP_TIME
); );
if (!P_MobjWasRemoved(inflictor) && inflictor->type == MT_INSTAWHIP) drop->hitlag = ufo->hitlag();
{
// Take momentum of player who whips
inflictor = inflictor->target;
} }
drop->momz = !P_MobjWasRemoved(inflictor) ? inflictor->momz : 0;
if (ufo->spawner()) if (ufo->spawner())
{ {
g_battleufo.previousId = ufo->spawner()->id(); g_battleufo.previousId = ufo->spawner()->id();

View file

@ -402,7 +402,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return; return;
K_GivePowerUp(player, special->threshold, special->movecount); K_GivePowerUp(player, special->threshold, special->movecount);
player->flashing = 2*TICRATE;
} }
else else
{ {