From 81bf0dceb21bd20de5896e205d8c7a4518ef433a Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 21 Dec 2021 18:12:38 +0100 Subject: [PATCH] Turn makesoftwarecorona into a function --- src/p_mobj.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4810d3623..65c337cf2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12656,6 +12656,15 @@ static boolean P_SetupBooster(mapthing_t* mthing, mobj_t* mobj, boolean strong) return true; } +static mobj_t *P_MakeSoftwareCorona(mobj_t *mo, INT32 height) +{ + mobj_t *corona = P_SpawnMobjFromMobj(mo, 0, 0, height<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) { 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) mobj->color = ((mthing->angle - 1) % (numskincolors - 1)) + 1; break; -#define makesoftwarecorona(mo, h) \ - corona = P_SpawnMobjFromMobj(mo, 0, 0, h<sprite = SPR_FLAM;\ - corona->frame = (FF_FULLBRIGHT|FF_TRANS90|12);\ - corona->tics = -1 case MT_FLAME: if (mthing->options & MTF_EXTRA) { - mobj_t *corona; - makesoftwarecorona(mobj, 20); + mobj_t *corona = P_MakeSoftwareCorona(mobj, 20); P_SetScale(corona, (corona->destscale = mobj->scale*3)); P_SetTarget(&mobj->tracer, corona); } @@ -12753,8 +12756,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean flame->flags2 |= MF2_BOSSNOTRAP; if (mthing->options & MTF_EXTRA) { - mobj_t *corona; - makesoftwarecorona(flame, 20); + mobj_t *corona = P_MakeSoftwareCorona(flame, 20); P_SetScale(corona, (corona->destscale = flame->scale*3)); 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_CANDLEPRICKET: if (mthing->options & MTF_EXTRA) - { - mobj_t *corona; - makesoftwarecorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176)); - } + P_MakeSoftwareCorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176)); break; -#undef makesoftwarecorona case MT_JACKO1: case MT_JACKO2: case MT_JACKO3: