From a61be91523466a74930f75f7663cefb55ee1e6eb Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 7 Aug 2017 20:33:24 +0100 Subject: [PATCH] Add a new feature to MT_PARTICLEGEN, per Sphere's request - if you give the parameters line a backside, then the backside x offset controls the number of tics between particle spawn. (By default, it's 3.) --- src/info.c | 2 +- src/p_enemy.c | 4 ++-- src/p_mobj.c | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 1f5b394ab..61db2baf8 100644 --- a/src/info.c +++ b/src/info.c @@ -2581,7 +2581,7 @@ state_t states[NUMSTATES] = // Particle sprite {SPR_PRTL, FF_FULLBRIGHT|FF_TRANS70, 2*TICRATE, {NULL}, 0, 0, S_NULL}, // S_PARTICLE - {SPR_NULL, 0, 1, {A_ParticleSpawn}, 0, 0, S_PARTICLEGEN}, // S_PARTICLEGEN + {SPR_NULL, 0, 3, {A_ParticleSpawn}, 0, 0, S_PARTICLEGEN}, // S_PARTICLEGEN {SPR_SCOR, 0, 32, {A_ScoreRise}, 0, 0, S_NULL}, // S_SCRA - 100 {SPR_SCOR, 1, 32, {A_ScoreRise}, 0, 0, S_NULL}, // S_SCRB - 200 diff --git a/src/p_enemy.c b/src/p_enemy.c index c9a173616..77e140689 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3582,12 +3582,12 @@ void A_ParticleSpawn(mobj_t *actor) spawn->tics = (tic_t)actor->health; spawn->flags2 |= (actor->flags2 & MF2_OBJECTFLIP); spawn->angle += P_RandomKey(36)*ANG10; // irrelevant for default objects but might make sense for some custom ones - if (spawn->frame & FF_ANIMATE) - spawn->frame += P_RandomKey(spawn->state->var1); actor->angle += actor->movedir; } + actor->angle += (angle_t)actor->movecount; + actor->tics = (tic_t)actor->reactiontime; } // Function: A_BunnyHop diff --git a/src/p_mobj.c b/src/p_mobj.c index 85c69fa73..f9d31eb31 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10209,7 +10209,7 @@ domaceagain: case MT_PARTICLEGEN: { fixed_t radius, speed, bottomheight, topheight; - INT32 type, numdivisions, time, anglespeed; + INT32 type, numdivisions, time, anglespeed, ticcount; angle_t angledivision; INT32 line; const size_t mthingi = (size_t)(mthing - mapthings); @@ -10232,6 +10232,10 @@ domaceagain: bottomheight = lines[line].frontsector->floorheight; topheight = lines[line].frontsector->ceilingheight - mobjinfo[(mobjtype_t)type].height; + if (!lines[line].backsector + || (ticcount = (sides[lines[line].sidenum[1]].textureoffset >> FRACBITS)) < 1) + ticcount = states[S_PARTICLEGEN].tics; + numdivisions = (mthing->options >> ZSHIFT); if (numdivisions) @@ -10268,8 +10272,9 @@ domaceagain: "Numdivisions is %d\n" "Angledivision is %d\n" "Time is %d\n" - "Type is %d\n", - sizeu1(mthingi), radius, speed, anglespeed, numdivisions, angledivision, time, type); + "Type is %d\n" + "Tic seperation is %d\n", + sizeu1(mthingi), radius, speed, anglespeed, numdivisions, angledivision, time, type, ticcount); mobj->angle = 0; mobj->movefactor = speed; @@ -10279,6 +10284,7 @@ domaceagain: mobj->health = time; mobj->friction = radius; mobj->threshold = type; + mobj->reactiontime = ticcount; break; }