From 23bdb14eda8196c49487178e076b96267c31f25c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 27 Jun 2017 20:16:14 +0100 Subject: [PATCH] * Make maces use the x offset of their controlling linedef to set the stage in the cycle the mace should be at, instead of contributing to the tilt of the plane of the maces. * Make the noclimb flag of the mace-controlling linedef turn the mace types that have spiked balls on the ends to also have the middles of the chain be spiked, CEZ3 style. * Partake in some refactoring. https://cdn.discordapp.com/attachments/293238104096112641/329335623250870275/srb20026.png An image of both changes in action! --- src/p_enemy.c | 5 ++-- src/p_mobj.c | 77 +++++++++++++++++++++++++++------------------------ 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 4b8d14170..6c87ebb23 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5206,8 +5206,8 @@ void A_MaceRotate(mobj_t *actor) radius = FixedMul(actor->info->speed * actor->reactiontime, actor->target->scale); // Double the radius if the chain links are made up of maces. - if (actor->target->type == MT_AXIS && (actor->type == MT_SMALLMACE || actor->type == MT_BIGMACE)) - radius *= 2; + /*if (actor->target->type == MT_AXIS && (actor->type == MT_SMALLMACE || actor->type == MT_BIGMACE)) + radius *= 2;*/ // Axis offset for the axis. radius += actor->target->extravalue1; @@ -5261,7 +5261,6 @@ void A_MaceRotate(mobj_t *actor) actor->threshold += actor->target->lastlook; actor->threshold &= FINEMASK; - actor->target->health &= FINEMASK; fa = actor->threshold; v[0] = FixedMul(FINECOSINE(fa), radius); diff --git a/src/p_mobj.c b/src/p_mobj.c index e1ac9f714..e3feef294 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9775,10 +9775,10 @@ void P_SpawnMapThing(mapthing_t *mthing) case MT_HANGMACEPOINT: case MT_SPINMACEPOINT: { - fixed_t mlength, mspeed, mxspeed, mzspeed, mstartangle, mmaxspeed; + fixed_t mlength, mspeed, mxspeed, mzspeed, mstartangle, mmaxspeed, movecountset, thresholdset, radiusfactor = 1; mobjtype_t chainlink = MT_SMALLMACECHAIN; mobjtype_t macetype = MT_SMALLMACE; - boolean firsttime; + const boolean hazard = (mobj->type == MT_MACEPOINT || mobj->type == MT_SWINGMACEPOINT); mobj_t *spawnee; INT32 line; const size_t mthingi = (size_t)(mthing - mapthings); @@ -9820,66 +9820,71 @@ ML_NOCLIMB : Direction not controllable mobj->lastlook = mspeed << 4; mobj->movecount = mobj->lastlook; - mobj->health = (FixedAngle(mzspeed*FRACUNIT)>>ANGLETOFINESHIFT) + (FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT); - mobj->threshold = (FixedAngle(mxspeed*FRACUNIT)>>ANGLETOFINESHIFT) + (FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT); + mobj->health = (FixedAngle(((mzspeed+mstartangle)%360)*FRACUNIT)>>ANGLETOFINESHIFT); + mobj->threshold = (FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT); mobj->movefactor = mobj->threshold; mobj->friction = mmaxspeed; - if (lines[line].flags & ML_NOCLIMB) - mobj->flags |= MF_SLIDEME; - - mobj->reactiontime = 0; - if (mthing->options & MTF_AMBUSH) { chainlink = MT_BIGMACECHAIN; macetype = MT_BIGMACE; } + if (lines[line].flags & ML_NOCLIMB) + { + if (hazard) + { + chainlink = macetype; + radiusfactor = 2; // Double the radius. + } + else + mobj->flags |= MF_SLIDEME; + } + + mobj->reactiontime = 0; + if (mthing->options & MTF_OBJECTSPECIAL) mobj->flags2 |= MF2_BOSSNOTRAP; // shut up maces. - if (mobj->type == MT_HANGMACEPOINT || mobj->type == MT_SPINMACEPOINT) - firsttime = true; + if (mobj->type == MT_HANGMACEPOINT || mobj->type == MT_SWINGMACEPOINT) + movecountset = FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT; else - { - firsttime = false; + movecountset = 0; + thresholdset = FixedAngle(((mxspeed + mstartangle)%360)*FRACUNIT)>>ANGLETOFINESHIFT; + + if (hazard) // outermost mace + { spawnee = P_SpawnMobj(mobj->x, mobj->y, mobj->z, macetype); P_SetTarget(&spawnee->target, mobj); - if (mobj->type == MT_SWINGMACEPOINT) - spawnee->movecount = FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT; - else - spawnee->movecount = 0; + spawnee->movecount = movecountset; + spawnee->threshold = thresholdset; + spawnee->reactiontime = radiusfactor*(mlength+1); + } + else if (mlength) // outermost link + { + spawnee = P_SpawnMobj(mobj->x, mobj->y, mobj->z, chainlink); + P_SetTarget(&spawnee->target, mobj); - spawnee->threshold = FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT; - spawnee->reactiontime = mlength+1; + spawnee->movecount = movecountset; + spawnee->threshold = thresholdset; + spawnee->reactiontime = radiusfactor*(mlength--); + + spawnee->flags2 |= MF2_AMBUSH; } while (mlength > 0) { spawnee = P_SpawnMobj(mobj->x, mobj->y, mobj->z, chainlink); - P_SetTarget(&spawnee->target, mobj); - if (mobj->type == MT_HANGMACEPOINT || mobj->type == MT_SWINGMACEPOINT) - spawnee->movecount = FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT; - else - spawnee->movecount = 0; - - spawnee->threshold = FixedAngle(mstartangle*FRACUNIT)>>ANGLETOFINESHIFT; - spawnee->reactiontime = mlength; - - if (firsttime) - { - // This is the outermost link in the chain - spawnee->flags2 |= MF2_AMBUSH; - firsttime = false; - } - - mlength--; + spawnee->movecount = movecountset; + spawnee->threshold = thresholdset; + spawnee->reactiontime = radiusfactor*(mlength--); } + break; } case MT_PARTICLEGEN: