From 27c9fe5047ff44357f62375d029cd8c58fcac26d Mon Sep 17 00:00:00 2001 From: lachwright Date: Thu, 3 Oct 2019 02:31:32 +0800 Subject: [PATCH 1/9] Fix false comment --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 56412a3b4..fdb0128ac 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -962,7 +962,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { return true; } - if ((thing->flags & MF_PUSHABLE) // carrying a player + if ((thing->flags & MF_PUSHABLE) // not carrying a player && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) && (P_MobjFlip(tmthing)*tmthing->momz <= 0) From 7850d4372533da2deb53252c24384d3e4753849c Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 13:14:23 +0800 Subject: [PATCH 2/9] Let ridden rollout rocks collide with other players --- src/p_map.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index ed35b0cf1..9751856d0 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -985,7 +985,7 @@ static boolean PIT_CheckThing(mobj_t *thing) tmthing->player->powers[pw_carry] = CR_ROLLOUT; P_SetTarget(&tmthing->tracer, thing); P_SetObjectMomZ(thing, tmthing->momz, true); - return false; + return true; } } else if (tmthing->type == thing->type) @@ -1004,6 +1004,9 @@ static boolean PIT_CheckThing(mobj_t *thing) { if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) return true; + + if (thing == tmthing->target) + return true; if (thing->flags & MF_SPRING) { @@ -1660,8 +1663,8 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - if ((!tmthing->player) && (thing->player)) - ; // no solid thing should ever be able to step up onto a player + if ((tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM) && (thing->player)) + ; // springs and gas jets should never be able to step up onto a player // z checking at last // Treat noclip things as non-solid! else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID From 306779fac0e1d447b0dcda375278aacfa9c31823 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 13:35:10 +0800 Subject: [PATCH 3/9] Readability changes --- src/p_map.c | 57 ++++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 9751856d0..380f85ac3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -963,41 +963,27 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1, 0); } - if (thing->type == MT_ROLLOUTROCK) + if (thing->type == MT_ROLLOUTROCK && tmthing->player) { - if (tmthing->player) + if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) { - if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) - { - return true; - } - if ((thing->flags & MF_PUSHABLE) // not carrying a player - && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) - && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) - && (P_MobjFlip(tmthing)*tmthing->momz <= 0) - && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) - || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) - { - thing->flags &= ~MF_PUSHABLE; - P_SetTarget(&thing->target, tmthing); - P_ResetPlayer(tmthing->player); - P_SetPlayerMobjState(tmthing, S_PLAY_WALK); - tmthing->player->powers[pw_carry] = CR_ROLLOUT; - P_SetTarget(&tmthing->tracer, thing); - P_SetObjectMomZ(thing, tmthing->momz, true); - return true; - } + return true; } - else if (tmthing->type == thing->type) + if ((thing->flags & MF_PUSHABLE) // not carrying a player + && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) + && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) + && (P_MobjFlip(tmthing)*tmthing->momz <= 0) + && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) + || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { - if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height) - return true; - - fixed_t tempmomx = thing->momx, tempmomy = thing->momy; - thing->momx = tmthing->momx; - thing->momy = tmthing->momy; - tmthing->momx = tempmomx; - tmthing->momy = tempmomy; + thing->flags &= ~MF_PUSHABLE; + P_SetTarget(&thing->target, tmthing); + P_ResetPlayer(tmthing->player); + P_SetPlayerMobjState(tmthing, S_PLAY_WALK); + tmthing->player->powers[pw_carry] = CR_ROLLOUT; + P_SetTarget(&tmthing->tracer, thing); + P_SetObjectMomZ(thing, tmthing->momz, true); + return true; } } else if (tmthing->type == MT_ROLLOUTROCK) @@ -1007,6 +993,15 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing == tmthing->target) return true; + + if (thing->type == tmthing->type) + { + fixed_t tempmomx = thing->momx, tempmomy = thing->momy; + thing->momx = tmthing->momx; + thing->momy = tmthing->momy; + tmthing->momx = tempmomx; + tmthing->momy = tempmomy; + } if (thing->flags & MF_SPRING) { From bed9dff077637f2ed5881a26f7b481f252ae45e0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 13:36:36 +0800 Subject: [PATCH 4/9] Readability changes --- src/p_map.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 380f85ac3..734def202 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -976,7 +976,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { - thing->flags &= ~MF_PUSHABLE; + thing->flags &= ~MF_PUSHABLE; // prevent riding player from applying pushable movement logic P_SetTarget(&thing->target, tmthing); P_ResetPlayer(tmthing->player); P_SetPlayerMobjState(tmthing, S_PLAY_WALK); @@ -991,10 +991,21 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) return true; - if (thing == tmthing->target) + if (thing == tmthing->target) // don't collide with rider return true; + + if (thing->flags & MF_SPRING) // bounce on springs + { + P_DoSpring(thing, tmthing); + return true; + } + else if (thing->flags & (MF_MONITOR|MF_SHOOTABLE) == (MF_MONITOR|MF_SHOOTABLE) && !(tmthing->flags & MF_PUSHABLE)) // pop monitors while carrying a player + { + P_KillMobj(thing, tmthing, tmthing->target, 0); + return true; + } - if (thing->type == tmthing->type) + if (thing->type == tmthing->type) // bounce against other rollout rocks { fixed_t tempmomx = thing->momx, tempmomy = thing->momy; thing->momx = tmthing->momx; @@ -1002,17 +1013,6 @@ static boolean PIT_CheckThing(mobj_t *thing) tmthing->momx = tempmomx; tmthing->momy = tempmomy; } - - if (thing->flags & MF_SPRING) - { - P_DoSpring(thing, tmthing); - return true; - } - else if (thing->flags & MF_MONITOR && thing->flags & MF_SHOOTABLE && !(tmthing->flags & MF_PUSHABLE)) // carrying a player - { - P_KillMobj(thing, tmthing, tmthing->target, 0); - return true; - } } if (thing->type == MT_PTERABYTE && tmthing->player) From bfb9bac5bdad44812484422ca3d062a2de76dac9 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 14:51:32 +0800 Subject: [PATCH 5/9] Collision polish --- src/p_map.c | 14 ++++++++------ src/p_user.c | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 734def202..b62e33372 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -963,13 +963,14 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1, 0); } - if (thing->type == MT_ROLLOUTROCK && tmthing->player) + if (thing->type == MT_ROLLOUTROCK && tmthing->player && tmthing->health) { if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) { return true; } if ((thing->flags & MF_PUSHABLE) // not carrying a player + && (tmthing->player->powers[pw_carry] == CR_NONE) // player is not already riding something && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) && (P_MobjFlip(tmthing)*tmthing->momz <= 0) @@ -977,7 +978,7 @@ static boolean PIT_CheckThing(mobj_t *thing) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { thing->flags &= ~MF_PUSHABLE; // prevent riding player from applying pushable movement logic - P_SetTarget(&thing->target, tmthing); + P_SetTarget(&thing->tracer, tmthing); P_ResetPlayer(tmthing->player); P_SetPlayerMobjState(tmthing, S_PLAY_WALK); tmthing->player->powers[pw_carry] = CR_ROLLOUT; @@ -991,7 +992,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) return true; - if (thing == tmthing->target) // don't collide with rider + if (thing == tmthing->tracer) // don't collide with rider return true; if (thing->flags & MF_SPRING) // bounce on springs @@ -999,13 +1000,14 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DoSpring(thing, tmthing); return true; } - else if (thing->flags & (MF_MONITOR|MF_SHOOTABLE) == (MF_MONITOR|MF_SHOOTABLE) && !(tmthing->flags & MF_PUSHABLE)) // pop monitors while carrying a player + else if ((thing->flags & (MF_MONITOR|MF_SHOOTABLE)) == (MF_MONITOR|MF_SHOOTABLE) && !(tmthing->flags & MF_PUSHABLE)) // pop monitors while carrying a player { - P_KillMobj(thing, tmthing, tmthing->target, 0); + P_KillMobj(thing, tmthing, tmthing->tracer, 0); return true; } - if (thing->type == tmthing->type) // bounce against other rollout rocks + if (thing->type == tmthing->type // bounce against other rollout rocks + && (tmthing->momx || tmthing->momy || thing->momx || thing->momy)) { fixed_t tempmomx = thing->momx, tempmomy = thing->momy; thing->momx = tmthing->momx; diff --git a/src/p_user.c b/src/p_user.c index 9d6f3f643..836d7935b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1036,7 +1036,7 @@ void P_ResetPlayer(player_t *player) if (player->mo->tracer && !P_MobjWasRemoved(player->mo->tracer)) { player->mo->tracer->flags |= MF_PUSHABLE; - P_SetTarget(&player->mo->tracer->target, NULL); + P_SetTarget(&player->mo->tracer->tracer, NULL); } P_SetTarget(&player->mo->tracer, NULL); player->powers[pw_carry] = CR_NONE; @@ -4321,7 +4321,7 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->momz = 9*FRACUNIT + player->mo->tracer->momz; player->powers[pw_carry] = CR_NONE; player->mo->tracer->flags |= MF_PUSHABLE; - P_SetTarget(&player->mo->tracer->target, NULL); + P_SetTarget(&player->mo->tracer->tracer, NULL); P_SetTarget(&player->mo->tracer, NULL); } else if (player->mo->eflags & MFE_GOOWATER) From 95f6e2008f594f2223570ba0c35b728812f665c2 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 15:25:32 +0800 Subject: [PATCH 6/9] Better rollout behavior in lava --- src/info.c | 2 +- src/p_enemy.c | 30 ++++++------------------------ src/p_user.c | 5 +++++ 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/info.c b/src/info.c index 2374c8515..5d82fe06e 100644 --- a/src/info.c +++ b/src/info.c @@ -2487,7 +2487,7 @@ state_t states[NUMSTATES] = // Rollout Rock {SPR_NULL, 0, 1, {A_RolloutSpawn}, 256*FRACUNIT, MT_ROLLOUTROCK, S_ROLLOUTSPAWN}, // S_ROLLOUTSPAWN - {SPR_PUMI, 0, 1, {A_RolloutRock}, 63*FRACUNIT/64, 6*FRACUNIT/10, S_ROLLOUTROCK}, // S_ROLLOUTROCK + {SPR_PUMI, 0, 1, {A_RolloutRock}, 63*FRACUNIT/64, 7*FRACUNIT/10, S_ROLLOUTROCK}, // S_ROLLOUTROCK // RVZ scenery {SPR_JPLA, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BIGFERNLEAF diff --git a/src/p_enemy.c b/src/p_enemy.c index e6ca4f2f1..cf074d176 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13958,36 +13958,18 @@ void A_RolloutRock(mobj_t *actor) UINT8 maxframes = actor->info->reactiontime; fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); - fixed_t oldspeed = P_AproxDistance(actor->momx, actor->momy), newspeed, topspeed = actor->info->speed; + fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = actor->info->speed; boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); actor->friction = FRACUNIT; if (inwater) { - fixed_t height; - if (actor->eflags & MFE_VERTICALFLIP) - { - height = actor->waterbottom + (actor->height>>2); - if (actor->z + actor->height > height) - { - actor->z = height; - actor->momz = 0; - } - } - else - { - height = actor->watertop - (actor->height>>2); - if (actor->z < height) - { - actor->z = height; - actor->momz = 0; - } - } + actor->momz = FixedMul(actor->momz, locvar2); actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); } - if (oldspeed > topspeed) + if (speed > topspeed) { actor->momx = FixedMul(FixedDiv(actor->momx, oldspeed), topspeed); actor->momy = FixedMul(FixedDiv(actor->momy, oldspeed), topspeed); @@ -13996,14 +13978,14 @@ void A_RolloutRock(mobj_t *actor) actor->momx = FixedMul(actor->momx, locvar1); actor->momy = FixedMul(actor->momy, locvar1); - newspeed = P_AproxDistance(actor->momx, actor->momy); + speed = P_AproxDistance(actor->momx, actor->momy); - if (newspeed < actor->scale >> 1) + if (speed < actor->scale >> 1) { actor->momx = 0; actor->momy = 0; } - else if (newspeed > actor->scale) + else if (speed > actor->scale) { actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); actor->movefactor += newspeed; diff --git a/src/p_user.c b/src/p_user.c index 836d7935b..5bfb24df4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11919,6 +11919,11 @@ void P_PlayerAfterThink(player_t *player) mo->momx = rock->momx; mo->momy = rock->momy; mo->momz = 0; + + if (player->panim == PA_IDLE && (mo->momx || mo->momy)) + { + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); + } if (player->panim == PA_WALK && mo->tics > walktics) { From c64997bfe5186da521f735c3186f8f0bbac386ec Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 20:55:58 +0800 Subject: [PATCH 7/9] Add Ambush and Flip flag behaviors --- src/p_enemy.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index cf074d176..6fdb68ac4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13935,6 +13935,8 @@ void A_RolloutSpawn(mobj_t *actor) || P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) { actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); + actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)); + actor->target->eflags |= (actor->eflags & MFE_VERTICALFLIP); } } @@ -13958,12 +13960,12 @@ void A_RolloutRock(mobj_t *actor) UINT8 maxframes = actor->info->reactiontime; fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); - fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = actor->info->speed; + fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); actor->friction = FRACUNIT; - if (inwater) + if (inwater && !(actor->flags2 & MF2_AMBUSH)) { actor->momz = FixedMul(actor->momz, locvar2); actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); @@ -13971,8 +13973,8 @@ void A_RolloutRock(mobj_t *actor) if (speed > topspeed) { - actor->momx = FixedMul(FixedDiv(actor->momx, oldspeed), topspeed); - actor->momy = FixedMul(FixedDiv(actor->momy, oldspeed), topspeed); + actor->momx = FixedMul(FixedDiv(actor->momx, speed), topspeed); + actor->momy = FixedMul(FixedDiv(actor->momy, speed), topspeed); } actor->momx = FixedMul(actor->momx, locvar1); @@ -13988,7 +13990,7 @@ void A_RolloutRock(mobj_t *actor) else if (speed > actor->scale) { actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); - actor->movefactor += newspeed; + actor->movefactor += speed; if (actor->movefactor > circumference / maxframes) { actor->reactiontime++; From 77dd5260abc3865a7e8bae446d7309703f5f6177 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 22:22:51 +0800 Subject: [PATCH 8/9] Allow rock to disappear if unridden for 12 seconds --- src/info.c | 4 ++-- src/p_enemy.c | 41 +++++++++++++++++++++++++++-------------- src/p_map.c | 1 + 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/info.c b/src/info.c index 5d82fe06e..3b99615d3 100644 --- a/src/info.c +++ b/src/info.c @@ -12860,10 +12860,10 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound - 8, // reactiontime + 8, // reactiontime (sets number of frames the rock cycles through) sfx_None, // attacksound S_NULL, // painstate - 0, // painchance + 12*TICRATE, // painchance (sets how long an unridden rock should last before disappearing - set to 0 to disable) sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate diff --git a/src/p_enemy.c b/src/p_enemy.c index 6fdb68ac4..20b9f9b03 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13935,7 +13935,7 @@ void A_RolloutSpawn(mobj_t *actor) || P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) { actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); - actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)); + actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)) | MF2_SLIDEPUSH; actor->target->eflags |= (actor->eflags & MFE_VERTICALFLIP); } } @@ -13957,41 +13957,45 @@ void A_RolloutRock(mobj_t *actor) return; #endif - UINT8 maxframes = actor->info->reactiontime; + UINT8 maxframes = actor->info->reactiontime; // number of frames the mobj cycles through fixed_t pi = (22*FRACUNIT/7); - fixed_t circumference = FixedMul(2 * pi, actor->radius); + fixed_t circumference = FixedMul(2 * pi, actor->radius); // used to calculate when to change frame fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); - actor->friction = FRACUNIT; + actor->friction = FRACUNIT; // turns out riding on solids sucks, so let's just make it easier on ourselves - if (inwater && !(actor->flags2 & MF2_AMBUSH)) + if (inwater && !(actor->flags2 & MF2_AMBUSH)) // buoyancy in water (or lava) { actor->momz = FixedMul(actor->momz, locvar2); actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); } - if (speed > topspeed) + if (speed > topspeed) // cap speed { actor->momx = FixedMul(FixedDiv(actor->momx, speed), topspeed); actor->momy = FixedMul(FixedDiv(actor->momy, speed), topspeed); } + + if (P_IsObjectOnGround(actor) || inwater) // apply drag to speed (compensates for lack of friction but also works in liquids) + { + actor->momx = FixedMul(actor->momx, locvar1); + actor->momy = FixedMul(actor->momy, locvar1); + } - actor->momx = FixedMul(actor->momx, locvar1); - actor->momy = FixedMul(actor->momy, locvar1); + speed = P_AproxDistance(actor->momx, actor->momy); // recalculate speed for visual rolling - speed = P_AproxDistance(actor->momx, actor->momy); - - if (speed < actor->scale >> 1) + if (speed < actor->scale >> 1) // stop moving if speed is insignificant { actor->momx = 0; actor->momy = 0; } else if (speed > actor->scale) { - actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); + actor->movecount = 1; // rock has moved; fuse should be set so we don't have a trillion rocks lying around + actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); // set rock's angle to movement direction actor->movefactor += speed; - if (actor->movefactor > circumference / maxframes) + if (actor->movefactor > circumference / maxframes) // if distance moved is enough to change frame, change it! { actor->reactiontime++; actor->reactiontime %= maxframes; @@ -13999,5 +14003,14 @@ void A_RolloutRock(mobj_t *actor) } } - actor->frame = actor->reactiontime % maxframes; + actor->frame = actor->reactiontime % maxframes; // set frame + + if (!(actor->flags & MF_PUSHABLE)) // if being ridden, don't disappear + actor->fuse = 0; + else if (!actor->fuse && actor->movecount == 1) // otherwise if rock has moved, set its fuse + actor->fuse = actor->info->painchance; + + if (actor->fuse && actor->fuse < 2*TICRATE) + actor->flags2 ^= MF2_DONTDRAW; + } diff --git a/src/p_map.c b/src/p_map.c index b62e33372..e470de240 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -978,6 +978,7 @@ static boolean PIT_CheckThing(mobj_t *thing) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { thing->flags &= ~MF_PUSHABLE; // prevent riding player from applying pushable movement logic + thing->flags2 &= ~MF2_DONTDRAW; // don't leave the rock invisible if it was flashing prior to boarding P_SetTarget(&thing->tracer, tmthing); P_ResetPlayer(tmthing->player); P_SetPlayerMobjState(tmthing, S_PLAY_WALK); From 3412eb655af5f6bf0309fc49ac3182dc7448457f Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 22:51:13 +0800 Subject: [PATCH 9/9] Colorize non-buoyant rollout rocks (MF2_AMBUSH distinguishability) --- src/p_enemy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_enemy.c b/src/p_enemy.c index 20b9f9b03..6792623d3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13937,6 +13937,12 @@ void A_RolloutSpawn(mobj_t *actor) actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)) | MF2_SLIDEPUSH; actor->target->eflags |= (actor->eflags & MFE_VERTICALFLIP); + + if (actor->target->flags2 & MF2_AMBUSH) + { + actor->target->color = SKINCOLOR_SUPERRUST3; + actor->target->colorized = true; + } } }