mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-21 11:21:11 +00:00
Refactor star post check
This commit is contained in:
parent
693fa7ba81
commit
5918ecc2fe
1 changed files with 23 additions and 26 deletions
49
src/p_mobj.c
49
src/p_mobj.c
|
@ -12665,6 +12665,28 @@ static mobj_t *P_MakeSoftwareCorona(mobj_t *mo, INT32 height)
|
||||||
return corona;
|
return corona;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean P_MapAlreadyHasStarPost(mobj_t *mobj)
|
||||||
|
{
|
||||||
|
thinker_t *th;
|
||||||
|
mobj_t *mo2;
|
||||||
|
|
||||||
|
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||||
|
{
|
||||||
|
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mo2 = (mobj_t *)th;
|
||||||
|
|
||||||
|
if (mo2 == mobj)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mo2->type == MT_STARPOST && mo2->health == mobj->health)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
|
static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
|
||||||
{
|
{
|
||||||
boolean override = LUA_HookMapThingSpawn(mobj, mthing);
|
boolean override = LUA_HookMapThingSpawn(mobj, mthing);
|
||||||
|
@ -12961,35 +12983,10 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MT_STARPOST:
|
case MT_STARPOST:
|
||||||
{
|
|
||||||
thinker_t* th;
|
|
||||||
mobj_t* mo2;
|
|
||||||
boolean foundanother = false;
|
|
||||||
|
|
||||||
mobj->health = mthing->args[0] + 1;
|
mobj->health = mthing->args[0] + 1;
|
||||||
|
if (!P_MapAlreadyHasStarPost(mobj))
|
||||||
// See if other starposts exist in this level that have the same value.
|
|
||||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
|
||||||
{
|
|
||||||
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
mo2 = (mobj_t*)th;
|
|
||||||
|
|
||||||
if (mo2 == mobj)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (mo2->type == MT_STARPOST && mo2->health == mobj->health)
|
|
||||||
{
|
|
||||||
foundanother = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!foundanother)
|
|
||||||
numstarposts++;
|
numstarposts++;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_SPIKE:
|
case MT_SPIKE:
|
||||||
// Pop up spikes!
|
// Pop up spikes!
|
||||||
if (mthing->options & MTF_OBJECTSPECIAL)
|
if (mthing->options & MTF_OBJECTSPECIAL)
|
||||||
|
|
Loading…
Reference in a new issue