Separate Emerald Hunt emerald spawning into another function.

This commit is contained in:
Nev3r 2019-12-10 14:21:08 +01:00
parent 6fe6db8e18
commit 3dfa526eea

View file

@ -1017,13 +1017,18 @@ static void P_PrepareRawThings(UINT8 *data, size_t i)
{
mt->x = READINT16(data);
mt->y = READINT16(data);
mt->z = 0;
mt->angle = READINT16(data);
mt->type = READUINT16(data);
mt->options = READUINT16(data);
mt->extrainfo = (UINT8)(mt->type >> 12);
mt->type &= 4095;
if (mt->type == 1705 || (mt->type == 750 && mt->extrainfo)) // NiGHTS Hoops
mt->z = mthing->options;
else
mt->z = mthing->options >> ZSHIFT;
}
}
@ -1034,45 +1039,7 @@ static void P_PrepareThings(lumpnum_t lumpnum)
Z_Free(data);
}
static void P_LoadThings(boolean loademblems)
{
size_t i;
mapthing_t *mt;
// Spawn axis points first so they are at the front of the list for fast searching.
for (i = 0, mt = mapthings; i < nummapthings; i++, mt++)
{
switch (mt->type)
{
case 1700: // MT_AXIS
case 1701: // MT_AXISTRANSFER
case 1702: // MT_AXISTRANSFERLINE
mt->mobj = NULL;
P_SpawnMapThing(mt);
break;
default:
break;
}
}
numhuntemeralds = 0;
for (i = 0, mt = mapthings; i < nummapthings; i++, mt++)
{
if (mt->type == 1700 // MT_AXIS
|| mt->type == 1701 // MT_AXISTRANSFER
|| mt->type == 1702) // MT_AXISTRANSFERLINE
continue; // These were already spawned
if (!loademblems && mt->type == mobjinfo[MT_EMBLEM].doomednum)
continue;
mt->mobj = NULL;
P_SpawnMapThing(mt);
}
// random emeralds for hunt
if (numhuntemeralds)
static void SpawnEmeraldHunt (void)
{
INT32 emer1, emer2, emer3;
INT32 timeout = 0; // keeps from getting stuck
@ -1117,6 +1084,47 @@ static void P_LoadThings(boolean loademblems)
mobjinfo[MT_EMERHUNT].spawnstate+2);
}
static void P_LoadThings(boolean loademblems)
{
size_t i;
mapthing_t *mt;
// Spawn axis points first so they are at the front of the list for fast searching.
for (i = 0, mt = mapthings; i < nummapthings; i++, mt++)
{
switch (mt->type)
{
case 1700: // MT_AXIS
case 1701: // MT_AXISTRANSFER
case 1702: // MT_AXISTRANSFERLINE
mt->mobj = NULL;
P_SpawnMapThing(mt);
break;
default:
break;
}
}
numhuntemeralds = 0;
for (i = 0, mt = mapthings; i < nummapthings; i++, mt++)
{
if (mt->type == 1700 // MT_AXIS
|| mt->type == 1701 // MT_AXISTRANSFER
|| mt->type == 1702) // MT_AXISTRANSFERLINE
continue; // These were already spawned
if (!loademblems && mt->type == mobjinfo[MT_EMBLEM].doomednum)
continue;
mt->mobj = NULL;
P_SpawnMapThing(mt);
}
// random emeralds for hunt
if (numhuntemeralds)
SpawnEmeraldHunt();
if (metalrecording) // Metal Sonic gets no rings to distract him.
return;