Turn makesoftwarecorona into a function

This commit is contained in:
MascaraSnake 2021-12-21 18:12:38 +01:00
parent 4b58b45b5f
commit 81bf0dceb2

View file

@ -12656,6 +12656,15 @@ static boolean P_SetupBooster(mapthing_t* mthing, mobj_t* mobj, boolean strong)
return true; return true;
} }
static mobj_t *P_MakeSoftwareCorona(mobj_t *mo, INT32 height)
{
mobj_t *corona = P_SpawnMobjFromMobj(mo, 0, 0, height<<FRACBITS, MT_PARTICLE);
corona->sprite = SPR_FLAM;
corona->frame = (FF_FULLBRIGHT|FF_TRANS90|12);
corona->tics = -1;
return corona;
}
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);
@ -12731,16 +12740,10 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
if (mthing->angle > 0) if (mthing->angle > 0)
mobj->color = ((mthing->angle - 1) % (numskincolors - 1)) + 1; mobj->color = ((mthing->angle - 1) % (numskincolors - 1)) + 1;
break; break;
#define makesoftwarecorona(mo, h) \
corona = P_SpawnMobjFromMobj(mo, 0, 0, h<<FRACBITS, MT_PARTICLE);\
corona->sprite = SPR_FLAM;\
corona->frame = (FF_FULLBRIGHT|FF_TRANS90|12);\
corona->tics = -1
case MT_FLAME: case MT_FLAME:
if (mthing->options & MTF_EXTRA) if (mthing->options & MTF_EXTRA)
{ {
mobj_t *corona; mobj_t *corona = P_MakeSoftwareCorona(mobj, 20);
makesoftwarecorona(mobj, 20);
P_SetScale(corona, (corona->destscale = mobj->scale*3)); P_SetScale(corona, (corona->destscale = mobj->scale*3));
P_SetTarget(&mobj->tracer, corona); P_SetTarget(&mobj->tracer, corona);
} }
@ -12753,8 +12756,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
flame->flags2 |= MF2_BOSSNOTRAP; flame->flags2 |= MF2_BOSSNOTRAP;
if (mthing->options & MTF_EXTRA) if (mthing->options & MTF_EXTRA)
{ {
mobj_t *corona; mobj_t *corona = P_MakeSoftwareCorona(flame, 20);
makesoftwarecorona(flame, 20);
P_SetScale(corona, (corona->destscale = flame->scale*3)); P_SetScale(corona, (corona->destscale = flame->scale*3));
P_SetTarget(&flame->tracer, corona); P_SetTarget(&flame->tracer, corona);
} }
@ -12763,12 +12765,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
case MT_CANDLE: case MT_CANDLE:
case MT_CANDLEPRICKET: case MT_CANDLEPRICKET:
if (mthing->options & MTF_EXTRA) if (mthing->options & MTF_EXTRA)
{ P_MakeSoftwareCorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176));
mobj_t *corona;
makesoftwarecorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176));
}
break; break;
#undef makesoftwarecorona
case MT_JACKO1: case MT_JACKO1:
case MT_JACKO2: case MT_JACKO2:
case MT_JACKO3: case MT_JACKO3: