Make emerald hunt shards spawn at correct heights, and add Float option.

This commit is contained in:
sphere 2020-04-22 18:58:40 +02:00
parent 536fb1ef2a
commit 25affe6948
4 changed files with 27 additions and 11 deletions

View file

@ -3900,6 +3900,8 @@ thingtypes
{
title = "Emerald Hunt Location";
sprite = "SHRDA0";
flags8height = 24;
flags8text = "[8] Float";
}
321
{

View file

@ -11616,7 +11616,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
mapthing_t *huntemeralds[MAXHUNTEMERALDS];
INT32 numhuntemeralds;
static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip)
fixed_t P_GetMobjSpawnHeight(mobjtype_t mobjtype, fixed_t x, fixed_t y, fixed_t offset, boolean flip)
{
const subsector_t *ss = R_PointInSubsector(x, y);
@ -11633,7 +11633,7 @@ static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x,
+ offset;
}
static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)
fixed_t P_GetMapThingSpawnHeight(mobjtype_t mobjtype, mapthing_t* mthing, fixed_t x, fixed_t y)
{
fixed_t offset = mthing->z << FRACBITS;
boolean flip = (!!(mobjinfo[mobjtype].flags & MF_SPAWNCEILING) ^ !!(mthing->options & MTF_OBJECTFLIP));
@ -11673,6 +11673,7 @@ static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthin
// Ring-like items, may float additional units with MTF_AMBUSH.
case MT_SPIKEBALL:
case MT_EMERHUNT:
case MT_EMERALDSPAWN:
case MT_TOKEN:
case MT_EMBLEM:

View file

@ -451,6 +451,9 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing);
void P_MovePlayerToStarpost(INT32 playernum);
void P_AfterPlayerSpawn(INT32 playernum);
fixed_t P_GetMobjSpawnHeight(mobjtype_t mobjtype, fixed_t x, fixed_t y, fixed_t offset, boolean flip);
fixed_t P_GetMapThingSpawnHeight(mobjtype_t mobjtype, mapthing_t* mthing, fixed_t x, fixed_t y);
mobj_t *P_SpawnMapThing(mapthing_t *mthing);
void P_SpawnHoop(mapthing_t *mthing);
void P_SetBonusTime(mobj_t *mobj);

View file

@ -695,6 +695,7 @@ static void P_SpawnEmeraldHunt(void)
{
INT32 emer1, emer2, emer3;
INT32 timeout = 0; // keeps from getting stuck
fixed_t x, y, z;
emer1 = emer2 = emer3 = 0;
@ -719,22 +720,31 @@ static void P_SpawnEmeraldHunt(void)
//decrement spawn values to the actual number because zero is valid.
if (emer1--)
P_SpawnMobj(huntemeralds[emer1]->x<<FRACBITS,
huntemeralds[emer1]->y<<FRACBITS,
huntemeralds[emer1]->z<<FRACBITS, MT_EMERHUNT);
{
x = huntemeralds[emer1]->x<<FRACBITS;
y = huntemeralds[emer1]->y<<FRACBITS;
z = P_GetMapThingSpawnHeight(MT_EMERHUNT, huntemeralds[emer1], x, y);
P_SpawnMobj(x, y, z, MT_EMERHUNT);
}
if (emer2--)
P_SetMobjStateNF(P_SpawnMobj(huntemeralds[emer2]->x<<FRACBITS,
huntemeralds[emer2]->y<<FRACBITS,
huntemeralds[emer2]->z<<FRACBITS, MT_EMERHUNT),
{
x = huntemeralds[emer2]->x<<FRACBITS;
y = huntemeralds[emer2]->y<<FRACBITS;
z = P_GetMapThingSpawnHeight(MT_EMERHUNT, huntemeralds[emer2], x, y);
P_SetMobjStateNF(P_SpawnMobj(x, y, z, MT_EMERHUNT),
mobjinfo[MT_EMERHUNT].spawnstate+1);
}
if (emer3--)
P_SetMobjStateNF(P_SpawnMobj(huntemeralds[emer3]->x<<FRACBITS,
huntemeralds[emer3]->y<<FRACBITS,
huntemeralds[emer3]->z<<FRACBITS, MT_EMERHUNT),
{
x = huntemeralds[emer3]->x<<FRACBITS;
y = huntemeralds[emer3]->y<<FRACBITS;
z = P_GetMapThingSpawnHeight(MT_EMERHUNT, huntemeralds[emer3], x, y);
P_SetMobjStateNF(P_SpawnMobj(x, y, z, MT_EMERHUNT),
mobjinfo[MT_EMERHUNT].spawnstate+2);
}
}
static void P_SpawnMapThings(boolean spawnemblems)
{