Spawn powerup orb on death

Spawns random powerup
This commit is contained in:
SteelT 2023-06-29 21:13:21 -04:00 committed by James R
parent dae2142fbe
commit 06acc1c07f
3 changed files with 14 additions and 0 deletions

View file

@ -190,6 +190,7 @@ typedef enum
POWERUP_BADGE,
POWERUP_SUPERFLICKY,
ENDOFPOWERUPS,
LASTPOWERUP = ENDOFPOWERUPS - 1,
NUMPOWERUPS = ENDOFPOWERUPS - FIRSTPOWERUP,
} kartitems_t;

View file

@ -6896,6 +6896,7 @@ struct int_const_s const INT_CONST[] = {
{"POWERUP_BADGE",POWERUP_BADGE},
{"POWERUP_SUPERFLICKY",POWERUP_SUPERFLICKY},
{"ENDOFPOWERUPS",ENDOFPOWERUPS},
{"LASTPOWERUP",LASTPOWERUP},
{"NUMPOWERUPS",NUMPOWERUPS},
// kartshields_t

View file

@ -7,6 +7,7 @@
#include "../p_local.h"
#include "../k_battle.h"
#include "../k_objects.h"
#include "../k_kart.h"
#define BATTLEUFO_LEG_ZOFFS (3*FRACUNIT) // Spawn height offset from the body
#define BATTLEUFO_LEGS (3) // Number of UFO legs to spawn
@ -136,9 +137,20 @@ void Obj_BattleUFOThink(mobj_t *mobj)
void Obj_BattleUFODeath(mobj_t *mobj)
{
UFO* ufo = static_cast<UFO*>(mobj);
const SINT8 flip = P_MobjFlip(ufo);
ufo->momz = -(8*mapobjectscale)/2;
K_CreatePaperItem(
ufo->x,
ufo->y,
ufo->z + (flip),
0,
flip,
P_RandomRange(PR_BATTLEUFO, FIRSTPOWERUP, LASTPOWERUP),
BATTLE_POWERUP_TIME
);
if (ufo->spawner())
{
g_battleufo.previousId = ufo->spawner()->id();