From 438c4d1d51502c7cc81bb6379ac58988e47422cb Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Jul 2019 21:33:18 +0100 Subject: [PATCH 1/8] Fix spindash being broken in quicksand # Conflicts: # src/p_mobj.c # src/p_user.c --- src/p_local.h | 2 +- src/p_mobj.c | 2 +- src/p_user.c | 160 ++++++++++++++++++++++++++------------------------ 3 files changed, 84 insertions(+), 80 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index cb8f95533..3c62d6277 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -142,7 +142,7 @@ boolean P_IsObjectOnGround(mobj_t *mo); boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec); boolean P_InSpaceSector(mobj_t *mo); boolean P_InQuicksand(mobj_t *mo); -boolean P_PlayerHitFloor(player_t *player); +boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff); void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); diff --git a/src/p_mobj.c b/src/p_mobj.c index 9a6e0f2bb..a7ab4e30d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3047,7 +3047,7 @@ static void P_PlayerZMovement(mobj_t *mo) } } - clipmomz = P_PlayerHitFloor(mo->player); + clipmomz = P_PlayerHitFloor(mo->player, true); if (!(mo->player->pflags & PF_SPINNING) && mo->player->powers[pw_carry] != CR_NIGHTSMODE) mo->player->pflags &= ~PF_STARTDASH; diff --git a/src/p_user.c b/src/p_user.c index 6761d567d..3427ed168 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2007,7 +2007,7 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space // // Handles player hitting floor surface. // Returns whether to clip momz. -boolean P_PlayerHitFloor(player_t *player) +boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) { boolean clipmomz; @@ -2015,92 +2015,96 @@ boolean P_PlayerHitFloor(player_t *player) if ((clipmomz = !(P_CheckDeathPitCollide(player->mo))) && player->mo->health && !player->spectator) { - if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) + if (dorollstuff) { - player->pflags |= PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - S_StartSound(player->mo, sfx_spin); + if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) + { + player->pflags |= PF_SPINNING; + P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); + S_StartSound(player->mo, sfx_spin); + } + else + player->pflags &= ~PF_SPINNING; } - else + + if (player->pflags & PF_GLIDING) // ground gliding { - player->pflags &= ~PF_SPINNING; - - if (player->pflags & PF_GLIDING) // ground gliding - { + if (!player->skidtime) player->skidtime = TICRATE; - player->mo->tics = -1; - } - else if (player->charability2 == CA2_MELEE && (player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING)) + player->mo->tics = -1; + } + else if (player->charability2 == CA2_MELEE && (player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING)) + { + mobjtype_t type = player->revitem; + P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING); + player->mo->tics = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS; + S_StartSound(player->mo, sfx_s3k8b); + player->pflags |= PF_FULLSTASIS; + + // hearticles + if (type) { - mobjtype_t type = player->revitem; - P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING); - player->mo->tics = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS; - S_StartSound(player->mo, sfx_s3k8b); - player->pflags |= PF_FULLSTASIS; - - // hearticles - if (type) + UINT8 i = 0; + angle_t throwang = -(2*ANG30); + fixed_t xo = P_ReturnThrustX(player->mo, player->drawangle, 16*player->mo->scale); + fixed_t yo = P_ReturnThrustY(player->mo, player->drawangle, 16*player->mo->scale); + fixed_t zo = 6*player->mo->scale; + fixed_t mu = FixedMul(player->maxdash, player->mo->scale); + fixed_t mu2 = FixedHypot(player->mo->momx, player->mo->momy); + fixed_t ev; + mobj_t *missile; + if (mu2 < mu) + mu2 = mu; + ev = (50*FRACUNIT - (mu/25))/50; + while (i < 5) { - UINT8 i = 0; - angle_t throwang = -(2*ANG30); - fixed_t xo = P_ReturnThrustX(player->mo, player->drawangle, 16*player->mo->scale); - fixed_t yo = P_ReturnThrustY(player->mo, player->drawangle, 16*player->mo->scale); - fixed_t zo = 6*player->mo->scale; - fixed_t mu = FixedMul(player->maxdash, player->mo->scale); - fixed_t mu2 = FixedHypot(player->mo->momx, player->mo->momy); - fixed_t ev; - mobj_t *missile; - if (mu2 < mu) - mu2 = mu; - ev = (50*FRACUNIT - (mu/25))/50; - while (i < 5) - { - missile = P_SpawnMobjFromMobj(player->mo, xo, yo, zo, type); - P_SetTarget(&missile->target, player->mo); - missile->angle = throwang + player->drawangle; - P_Thrust(missile, player->drawangle + ANGLE_90, - P_ReturnThrustY(missile, throwang, mu)); // side to side component - P_Thrust(missile, player->drawangle, mu2); // forward component - P_SetObjectMomZ(missile, (4 + ((i&1)<<1))*FRACUNIT, true); - missile->fuse = TICRATE/2; - missile->extravalue2 = ev; + missile = P_SpawnMobjFromMobj(player->mo, xo, yo, zo, type); + P_SetTarget(&missile->target, player->mo); + missile->angle = throwang + player->drawangle; + P_Thrust(missile, player->drawangle + ANGLE_90, + P_ReturnThrustY(missile, throwang, mu)); // side to side component + P_Thrust(missile, player->drawangle, mu2); // forward component + P_SetObjectMomZ(missile, (4 + ((i&1)<<1))*FRACUNIT, true); + missile->fuse = TICRATE/2; + missile->extravalue2 = ev; - i++; - throwang += ANG30; - } - if (mobjinfo[type].seesound) - S_StartSound(missile, missile->info->seesound); + i++; + throwang += ANG30; } + if (mobjinfo[type].seesound) + S_StartSound(missile, missile->info->seesound); } - else if (player->pflags & PF_JUMPED || !(player->pflags & PF_SPINNING) + } + else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2) + ; + else if (player->pflags & PF_JUMPED || !(player->pflags & PF_SPINNING) || player->powers[pw_tailsfly] || player->mo->state-states == S_PLAY_FLY_TIRED) + { + if (player->cmomx || player->cmomy) { - if (player->cmomx || player->cmomy) - { - if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH) - P_SetPlayerMobjState(player->mo, S_PLAY_DASH); - else if (player->speed >= FixedMul(player->runspeed, player->mo->scale) - && (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN)) - P_SetPlayerMobjState(player->mo, S_PLAY_RUN); - else if ((player->rmomx || player->rmomy) - && (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT)) - P_SetPlayerMobjState(player->mo, S_PLAY_WALK); - else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE) - P_SetPlayerMobjState(player->mo, S_PLAY_STND); - } - else - { - if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH) - P_SetPlayerMobjState(player->mo, S_PLAY_DASH); - else if (player->speed >= FixedMul(player->runspeed, player->mo->scale) - && (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN)) - P_SetPlayerMobjState(player->mo, S_PLAY_RUN); - else if ((player->mo->momx || player->mo->momy) - && (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT)) - P_SetPlayerMobjState(player->mo, S_PLAY_WALK); - else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE) - P_SetPlayerMobjState(player->mo, S_PLAY_STND); - } + if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH) + P_SetPlayerMobjState(player->mo, S_PLAY_DASH); + else if (player->speed >= FixedMul(player->runspeed, player->mo->scale) + && (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN)) + P_SetPlayerMobjState(player->mo, S_PLAY_RUN); + else if ((player->rmomx || player->rmomy) + && (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT)) + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); + else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE) + P_SetPlayerMobjState(player->mo, S_PLAY_STND); + } + else + { + if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH) + P_SetPlayerMobjState(player->mo, S_PLAY_DASH); + else if (player->speed >= FixedMul(player->runspeed, player->mo->scale) + && (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN)) + P_SetPlayerMobjState(player->mo, S_PLAY_RUN); + else if ((player->mo->momx || player->mo->momy) + && (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT)) + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); + else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE) + P_SetPlayerMobjState(player->mo, S_PLAY_STND); } } @@ -2537,7 +2541,7 @@ static void P_CheckQuicksand(player_t *player) player->mo->z = ceilingheight - player->mo->height; if (player->mo->momz <= 0) - P_PlayerHitFloor(player); + P_PlayerHitFloor(player, false); } else { @@ -2549,7 +2553,7 @@ static void P_CheckQuicksand(player_t *player) player->mo->z = floorheight; if (player->mo->momz >= 0) - P_PlayerHitFloor(player); + P_PlayerHitFloor(player, false); } friction = abs(rover->master->v1->y - rover->master->v2->y)>>6; From 385d34e67ec7780d7fb57d2c7e00a78e4e04f56b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 25 Sep 2017 20:35:04 +0100 Subject: [PATCH 2/8] * Make busting a FOF through any in-game means (or not providing a target sector to EV_CrumbleChain) bust all FOFs with the same control sector. * Make CA2_GUNSLINGER not get overridden by being in quicksand. --- src/lua_baselib.c | 4 ++-- src/p_floor.c | 46 +++++++++++++++++++++++++++++++++------------- src/p_mobj.c | 4 ++-- src/p_user.c | 4 ++-- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 1d69b238b..712bc4045 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2051,8 +2051,8 @@ static int lib_evCrumbleChain(lua_State *L) ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); NOHUD INLEVEL - if (!sec) - return LUA_ErrInvalid(L, "sector_t"); + /*if (!sec) + return LUA_ErrInvalid(L, "sector_t");*/ if (!rover) return LUA_ErrInvalid(L, "ffloor_t"); EV_CrumbleChain(sec, rover); diff --git a/src/p_floor.c b/src/p_floor.c index c01e568d0..0b20a3b17 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -3029,20 +3029,40 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed) void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) { - size_t i; - size_t leftmostvertex = 0, rightmostvertex = 0; - size_t topmostvertex = 0, bottommostvertex = 0; - fixed_t leftx, rightx; - fixed_t topy, bottomy; - fixed_t topz, bottomz; - fixed_t widthfactor = FRACUNIT, heightfactor = FRACUNIT; - fixed_t a, b, c; - mobjtype_t type = MT_ROCKCRUMBLE1; - fixed_t spacing = (32<master->frontsector + sector_t *controlsec = rover->master->frontsector; + + if (sec == NULL) + { + if (controlsec->numattached) + { + for (i = 0; i < controlsec->numattached; i++) + { + sec = §ors[controlsec->attached[i]]; + if (!sec->ffloors) + continue; + + for (rover = sec->ffloors; rover; rover = rover->next) + { + if (rover->master->frontsector == controlsec) + EV_CrumbleChain(sec, rover); + } + } + } + return; + } + + leftmostvertex = rightmostvertex = topmostvertex = bottommostvertex = 0; + widthfactor = heightfactor = FRACUNIT; + spacing = (32<tag != 0) { diff --git a/src/p_mobj.c b/src/p_mobj.c index a7ab4e30d..6cfad95a0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1784,7 +1784,7 @@ static void P_PushableCheckBustables(mobj_t *mo) continue; } - EV_CrumbleChain(node->m_sector, rover); + EV_CrumbleChain(NULL, rover); // node->m_sector // Run a linedef executor?? if (rover->master->flags & ML_EFFECT5) @@ -3129,7 +3129,7 @@ nightsdone: { // DO THE MARIO! if (rover->flags & FF_SHATTERBOTTOM) // Brick block! - EV_CrumbleChain(node->m_sector, rover); + EV_CrumbleChain(NULL, rover); // node->m_sector else // Question block! EV_MarioBlock(rover, node->m_sector, mo); } diff --git a/src/p_user.c b/src/p_user.c index 3427ed168..706260a61 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2033,7 +2033,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) player->skidtime = TICRATE; player->mo->tics = -1; } - else if (player->charability2 == CA2_MELEE && (player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING)) + else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING) { mobjtype_t type = player->revitem; P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING); @@ -2324,7 +2324,7 @@ static void P_CheckBustableBlocks(player_t *player) //if (metalrecording) // G_RecordBustup(rover); - EV_CrumbleChain(node->m_sector, rover); + EV_CrumbleChain(NULL, rover); // node->m_sector // Run a linedef executor?? if (rover->master->flags & ML_EFFECT5) From 82acf2de6b8aa607cf84ce991f53b4386a92568f Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Jul 2019 23:24:44 +0100 Subject: [PATCH 3/8] Fix Knuckles-in-quicksand messup. --- src/p_user.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 706260a61..9c4e5b6b9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2029,9 +2029,13 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) if (player->pflags & PF_GLIDING) // ground gliding { - if (!player->skidtime) + if (dorollstuff) + { player->skidtime = TICRATE; - player->mo->tics = -1; + player->mo->tics = -1; + } + else + player->pflags &= ~PF_GLIDING; } else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING) { From 1d5e8e249e2195ea4e0c9c6d7a971bd494261aee Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Jul 2019 23:25:49 +0100 Subject: [PATCH 4/8] Successfully cause landing events when the ground moves up to hit you, as opposed to just when you move down to the ground. --- src/p_map.c | 8 +++++++- src/p_user.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index e78dd1e84..767370587 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2820,7 +2820,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) static boolean P_ThingHeightClip(mobj_t *thing) { boolean floormoved; - fixed_t oldfloorz = thing->floorz; + fixed_t oldfloorz = thing->floorz, oldz = thing->z; ffloor_t *oldfloorrover = thing->floorrover; ffloor_t *oldceilingrover = thing->ceilingrover; boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); @@ -2879,6 +2879,12 @@ static boolean P_ThingHeightClip(mobj_t *thing) thing->z = thing->ceilingz - thing->height; } + if (thing->z != oldz) + { + if (thing->player) + P_PlayerHitFloor(thing->player, false); + } + // debug: be sure it falls to the floor thing->eflags &= ~MFE_ONGROUND; diff --git a/src/p_user.c b/src/p_user.c index 9c4e5b6b9..1e293d24c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2069,6 +2069,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) P_ReturnThrustY(missile, throwang, mu)); // side to side component P_Thrust(missile, player->drawangle, mu2); // forward component P_SetObjectMomZ(missile, (4 + ((i&1)<<1))*FRACUNIT, true); + missile->momz += player->mo->pmomz; missile->fuse = TICRATE/2; missile->extravalue2 = ev; @@ -4418,6 +4419,10 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) { player->mo->z += P_MobjFlip(player->mo); P_SetObjectMomZ(player->mo, player->mindash, false); + if (P_MobjFlip(player->mo)*player->mo->pmomz > 0) + player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump. + else + player->mo->pmomz = 0; if (player->mo->eflags & MFE_UNDERWATER) player->mo->momz >>= 1; #if 0 From 64517a136229c251f3e6a94678909a94ff02b1b2 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 18 Jul 2019 00:16:01 +0100 Subject: [PATCH 5/8] Fix !150, too --- src/p_floor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_floor.c b/src/p_floor.c index 0b20a3b17..7887dc530 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -719,6 +719,8 @@ void T_ContinuousFalling(levelspecthink_t *faller) } } + P_CheckSector(faller->sector, false); // you might think this is irrelevant. you would be wrong + faller->sector->floorspeed = faller->speed*faller->direction; faller->sector->ceilspeed = 42; faller->sector->moved = true; From 1d799630af754e7aec7aa01745c21e1d152f0e49 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 28 Jul 2019 22:45:20 +0100 Subject: [PATCH 6/8] Made it possible to just call `EV_CrumbleChain(rover)` in Lua --- src/lua_baselib.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 712bc4045..97d2fdc24 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2047,12 +2047,19 @@ static int lib_pStartQuake(lua_State *L) static int lib_evCrumbleChain(lua_State *L) { - sector_t *sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); - ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + sector_t *sec = NULL; + ffloor_t *rover = NULL; NOHUD INLEVEL - /*if (!sec) - return LUA_ErrInvalid(L, "sector_t");*/ + if (lua_isuserdata(L, 2)) + { + sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + if (!sec) + return LUA_ErrInvalid(L, "sector_t"); + } + else + rover = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR)); if (!rover) return LUA_ErrInvalid(L, "ffloor_t"); EV_CrumbleChain(sec, rover); From 5dc095a47d3ae35c189c482f5ee5c1ad6a8051f9 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 28 Jul 2019 22:53:27 +0100 Subject: [PATCH 7/8] Further improvements on MI's request, just to be safe. --- src/lua_baselib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 97d2fdc24..767ab2dd3 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2051,12 +2051,15 @@ static int lib_evCrumbleChain(lua_State *L) ffloor_t *rover = NULL; NOHUD INLEVEL - if (lua_isuserdata(L, 2)) + if (!lua_isnone(L, 2)) { - sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + if (!lua_isnil(L, 1)) + { + sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + if (!sec) + return LUA_ErrInvalid(L, "sector_t"); + } rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); - if (!sec) - return LUA_ErrInvalid(L, "sector_t"); } else rover = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR)); From f2349c5ce485ef169fcc9322e790e722cd0744c6 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 2 Aug 2019 13:18:57 +0100 Subject: [PATCH 8/8] fixed sphere's CA2_MELEE stasis issue --- src/p_user.c | 77 +++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 29e29d7c1..4a804ace8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2037,47 +2037,50 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) else player->pflags &= ~PF_GLIDING; } - else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING) + else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) { - mobjtype_t type = player->revitem; - P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING); - player->mo->tics = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS; - S_StartSound(player->mo, sfx_s3k8b); - player->pflags |= PF_FULLSTASIS; - - // hearticles - if (type) + if (player->mo->state-states != S_PLAY_MELEE_LANDING) { - UINT8 i = 0; - angle_t throwang = -(2*ANG30); - fixed_t xo = P_ReturnThrustX(player->mo, player->drawangle, 16*player->mo->scale); - fixed_t yo = P_ReturnThrustY(player->mo, player->drawangle, 16*player->mo->scale); - fixed_t zo = 6*player->mo->scale; - fixed_t mu = FixedMul(player->maxdash, player->mo->scale); - fixed_t mu2 = FixedHypot(player->mo->momx, player->mo->momy); - fixed_t ev; - mobj_t *missile = NULL; - if (mu2 < mu) - mu2 = mu; - ev = (50*FRACUNIT - (mu/25))/50; - while (i < 5) - { - missile = P_SpawnMobjFromMobj(player->mo, xo, yo, zo, type); - P_SetTarget(&missile->target, player->mo); - missile->angle = throwang + player->drawangle; - P_Thrust(missile, player->drawangle + ANGLE_90, - P_ReturnThrustY(missile, throwang, mu)); // side to side component - P_Thrust(missile, player->drawangle, mu2); // forward component - P_SetObjectMomZ(missile, (4 + ((i&1)<<1))*FRACUNIT, true); - missile->momz += player->mo->pmomz; - missile->fuse = TICRATE/2; - missile->extravalue2 = ev; + mobjtype_t type = player->revitem; + P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING); + player->mo->tics = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS; + S_StartSound(player->mo, sfx_s3k8b); + player->pflags |= PF_FULLSTASIS; - i++; - throwang += ANG30; + // hearticles + if (type) + { + UINT8 i = 0; + angle_t throwang = -(2*ANG30); + fixed_t xo = P_ReturnThrustX(player->mo, player->drawangle, 16*player->mo->scale); + fixed_t yo = P_ReturnThrustY(player->mo, player->drawangle, 16*player->mo->scale); + fixed_t zo = 6*player->mo->scale; + fixed_t mu = FixedMul(player->maxdash, player->mo->scale); + fixed_t mu2 = FixedHypot(player->mo->momx, player->mo->momy); + fixed_t ev; + mobj_t *missile = NULL; + if (mu2 < mu) + mu2 = mu; + ev = (50*FRACUNIT - (mu/25))/50; + while (i < 5) + { + missile = P_SpawnMobjFromMobj(player->mo, xo, yo, zo, type); + P_SetTarget(&missile->target, player->mo); + missile->angle = throwang + player->drawangle; + P_Thrust(missile, player->drawangle + ANGLE_90, + P_ReturnThrustY(missile, throwang, mu)); // side to side component + P_Thrust(missile, player->drawangle, mu2); // forward component + P_SetObjectMomZ(missile, (4 + ((i&1)<<1))*FRACUNIT, true); + missile->momz += player->mo->pmomz; + missile->fuse = TICRATE/2; + missile->extravalue2 = ev; + + i++; + throwang += ANG30; + } + if (mobjinfo[type].seesound && missile) + S_StartSound(missile, missile->info->seesound); } - if (mobjinfo[type].seesound && missile) - S_StartSound(missile, missile->info->seesound); } } else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2)