From 8e9073f11f96868baf173dbf6be07d00193fd202 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 10 Jan 2021 21:55:25 -0600 Subject: [PATCH 01/17] CR_PTERABYTE tweaks --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index a70dceb8b..27e1498da 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12774,13 +12774,13 @@ void P_PlayerAfterThink(player_t *player) if (!ptera->movefactor) goto dropoff; - if (ptera->cusval >= 50) + if (ptera->cusval >= 30) { player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); player->mo->momz = 9*FRACUNIT; - player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; + player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; } From 058b681660cc002e470a087f37a74fa8ca20cd93 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 10 Jan 2021 22:01:41 -0600 Subject: [PATCH 02/17] P_SetObjectMomz --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 27e1498da..be16a03cc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12779,7 +12779,7 @@ void P_PlayerAfterThink(player_t *player) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); - player->mo->momz = 9*FRACUNIT; + P_SetObjectMomZ(player->mo, 9*FRACUNIT, false); player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; From 1917155adf2a70f867d51e650a7be9bb53d68fb5 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 11 Jan 2021 00:19:56 -0600 Subject: [PATCH 03/17] PF_THOKKED --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index be16a03cc..f5b44d494 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12780,7 +12780,7 @@ void P_PlayerAfterThink(player_t *player) P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); P_SetObjectMomZ(player->mo, 9*FRACUNIT, false); - player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED; + player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; } From 129ac4633c61752d3107f04cd6ae40001cb78377 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 11 Jan 2021 13:25:42 -0600 Subject: [PATCH 04/17] Increased launch height --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index f5b44d494..7e61c91fa 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12779,7 +12779,7 @@ void P_PlayerAfterThink(player_t *player) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); - P_SetObjectMomZ(player->mo, 9*FRACUNIT, false); + P_SetObjectMomZ(player->mo, 16*FRACUNIT, false); player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; From 216f227539b0b9456eae1a55c8f9f89e19cd533d Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Wed, 13 Jan 2021 12:03:02 -0600 Subject: [PATCH 05/17] 12 --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 7e61c91fa..3fdbe4d8f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12779,7 +12779,7 @@ void P_PlayerAfterThink(player_t *player) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); P_KillMobj(ptera, player->mo, player->mo, 0); - P_SetObjectMomZ(player->mo, 16*FRACUNIT, false); + P_SetObjectMomZ(player->mo, 12*FRACUNIT, false); player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; P_SetMobjState(player->mo, S_PLAY_ROLL); break; From 976373dd37fa37531dcfb4df322e56b285b7abc2 Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Tue, 8 Jun 2021 23:45:50 -0400 Subject: [PATCH 06/17] Calculate maxstep for pushables --- src/p_map.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 922c0d9ec..55b8a9d7e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2698,6 +2698,17 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { //All things are affected by their scale. fixed_t maxstep = FixedMul(MAXSTEPMOVE, thing->scale); + + if (thing->flags & MF_PUSHABLE) + { + // If using type Section1:13, double the maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) + maxstep <<= 1; + + // If using type Section1:14, no maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) + maxstep = 0; + } if (thing->player) { From 165be342063012ea694f75734102b003242de72e Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Wed, 9 Jun 2021 12:59:06 -0400 Subject: [PATCH 07/17] Fix player maxstep, oops --- src/p_map.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 55b8a9d7e..fbc7447ce 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2698,17 +2698,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { //All things are affected by their scale. fixed_t maxstep = FixedMul(MAXSTEPMOVE, thing->scale); - - if (thing->flags & MF_PUSHABLE) - { - // If using type Section1:13, double the maxstep. - if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) - maxstep <<= 1; - - // If using type Section1:14, no maxstep. - if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) - maxstep = 0; - } if (thing->player) { @@ -2728,6 +2717,16 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) && P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale)) maxstep = 0; } + else if (thing->flags & MF_PUSHABLE) + { + // If using type Section1:13, double the maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) + maxstep <<= 1; + + // If using type Section1:14, no maxstep. + if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) + maxstep = 0; + } if (thing->type == MT_SKIM) maxstep = 0; From 389cea2bc18a29f34132c41ad1027a1e588b6205 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 22 Jun 2021 01:38:37 -0500 Subject: [PATCH 08/17] You probably don't want to memorise the formula to convert arccos to arcsin so --- src/lua_mathlib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index e6f8c98c1..bd9218a3d 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -88,6 +88,12 @@ static int lib_finetangent(lua_State *L) return 1; } +static int lib_fixedasin(lua_State *L) +{ + lua_pushangle(L, -FixedAcos(luaL_checkfixed(L, 1)) + ANGLE_90); + return 1; +} + static int lib_fixedacos(lua_State *L) { lua_pushangle(L, FixedAcos(luaL_checkfixed(L, 1))); @@ -199,6 +205,7 @@ static luaL_Reg lib_math[] = { {"sin", lib_finesine}, {"cos", lib_finecosine}, {"tan", lib_finetangent}, + {"asin", lib_fixedasin}, {"acos", lib_fixedacos}, {"FixedAngle", lib_fixedangle}, {"fixangle" , lib_fixedangle}, From 86edb1e4caf4798d612ae373a50b0309ca6737da Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Fri, 3 Dec 2021 23:20:07 -0600 Subject: [PATCH 09/17] Fix player disappearing when drowning in painstate --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index f21118a81..ee76d29a8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12206,7 +12206,7 @@ void P_PlayerThink(player_t *player) player->losstime--; // Flash player after being hit. - if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) + if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1) && player->playerstate == PST_LIVE) player->mo->flags2 |= MF2_DONTDRAW; else player->mo->flags2 &= ~MF2_DONTDRAW; From b2d693a54704f08eecca461192753c1f57f44acf Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 5 Dec 2021 02:13:09 -0600 Subject: [PATCH 10/17] minor spike optimisations --- src/info.c | 6 +- src/p_map.c | 152 ++++++++++++++++++++++++--------------------------- src/p_mobj.c | 98 +++++++++++++++++++-------------- 3 files changed, 129 insertions(+), 127 deletions(-) diff --git a/src/info.c b/src/info.c index f56e5d78e..65185517a 100644 --- a/src/info.c +++ b/src/info.c @@ -7977,7 +7977,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_SPIKE, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_SCENERY|MF_NOCLIPHEIGHT, // flags + MF_SOLID|MF_SCENERY, // flags S_NULL // raisestate }, @@ -8004,7 +8004,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_SPIKE, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION, // flags + MF_SOLID|MF_NOGRAVITY|MF_SCENERY|MF_PAPERCOLLISION, // flags S_NULL // raisestate }, @@ -8031,7 +8031,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPTHING, // flags + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIP|MF_NOCLIPTHING, // flags S_NULL // raisestate }, diff --git a/src/p_map.c b/src/p_map.c index 836e75c4e..b2dd52127 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1465,86 +1465,6 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } - // Sprite Spikes! - // Do not return because solidity code comes below. - if (tmthing->type == MT_SPIKE && tmthing->flags & MF_SOLID && thing->player) // moving spike rams into player?! - { - if (tmthing->eflags & MFE_VERTICALFLIP) - { - if (thing->z + thing->height <= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) - && thing->z + thing->height + thing->momz >= tmthing->z + FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz - && !(thing->player->charability == CA_BOUNCE && thing->player->panim == PA_ABILITY && thing->eflags & MFE_VERTICALFLIP)) - P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); - } - else if (thing->z >= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) - && thing->z + thing->momz <= tmthing->z + tmthing->height - FixedMul(FRACUNIT, tmthing->scale) + tmthing->momz - && !(thing->player->charability == CA_BOUNCE && thing->player->panim == PA_ABILITY && !(thing->eflags & MFE_VERTICALFLIP))) - P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); - } - else if (thing->type == MT_SPIKE && thing->flags & MF_SOLID && tmthing->player) // unfortunate player falls into spike?! - { - if (thing->eflags & MFE_VERTICALFLIP) - { - if (tmthing->z + tmthing->height <= thing->z - FixedMul(FRACUNIT, thing->scale) - && tmthing->z + tmthing->height + tmthing->momz >= thing->z - FixedMul(FRACUNIT, thing->scale) - && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && tmthing->eflags & MFE_VERTICALFLIP)) - P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); - } - else if (tmthing->z >= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) - && tmthing->z + tmthing->momz <= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) - && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && !(tmthing->eflags & MFE_VERTICALFLIP))) - P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); - } - - if (tmthing->type == MT_WALLSPIKE && tmthing->flags & MF_SOLID && thing->player) // wall spike impales player - { - fixed_t bottomz, topz; - bottomz = tmthing->z; - topz = tmthing->z + tmthing->height; - if (tmthing->eflags & MFE_VERTICALFLIP) - bottomz -= FixedMul(FRACUNIT, tmthing->scale); - else - topz += FixedMul(FRACUNIT, tmthing->scale); - - if (thing->z + thing->height > bottomz // above bottom - && thing->z < topz) // below top - // don't check angle, the player was clearly in the way in this case - P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); - } - else if (thing->type == MT_WALLSPIKE && thing->flags & MF_SOLID && tmthing->player) - { - fixed_t bottomz, topz; - angle_t touchangle = R_PointToAngle2(thing->tracer->x, thing->tracer->y, tmthing->x, tmthing->y); - - if (P_PlayerInPain(tmthing->player) && (tmthing->momx || tmthing->momy)) - { - angle_t playerangle = R_PointToAngle2(0, 0, tmthing->momx, tmthing->momy) - touchangle; - if (playerangle > ANGLE_180) - playerangle = InvAngle(playerangle); - if (playerangle < ANGLE_90) - return true; // Yes, this is intentionally outside the z-height check. No standing on spikes whilst moving away from them. - } - - bottomz = thing->z; - topz = thing->z + thing->height; - - if (thing->eflags & MFE_VERTICALFLIP) - bottomz -= FixedMul(FRACUNIT, thing->scale); - else - topz += FixedMul(FRACUNIT, thing->scale); - - if (tmthing->z + tmthing->height > bottomz // above bottom - && tmthing->z < topz // below top - && !P_MobjWasRemoved(thing->tracer)) // this probably wouldn't work if we didn't have a tracer - { // use base as a reference point to determine what angle you touched the spike at - touchangle = thing->angle - touchangle; - if (touchangle > ANGLE_180) - touchangle = InvAngle(touchangle); - if (touchangle <= ANGLE_22h) // if you touched it at this close an angle, you get poked! - P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); - } - } - if (thing->flags & MF_PUSHABLE) { if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM) @@ -1623,6 +1543,22 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player) { + if (tmthing->type == MT_WALLSPIKE && (tmthing->flags & MF_SOLID)) // wall spike impales player + { + fixed_t bottomz, topz; + bottomz = tmthing->z; + topz = tmthing->z + tmthing->height; + if (tmthing->eflags & MFE_VERTICALFLIP) + bottomz -= FixedMul(FRACUNIT, tmthing->scale); + else + topz += FixedMul(FRACUNIT, tmthing->scale); + + if (thing->z + thing->height > bottomz // above bottom + && thing->z < topz) // below top + // don't check angle, the player was clearly in the way in this case + P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); + } + // Doesn't matter what gravity player's following! Just do your stuff in YOUR direction only if (tmthing->eflags & MFE_VERTICALFLIP && (tmthing->z + tmthing->height + tmthing->momz < thing->z @@ -1657,6 +1593,55 @@ static boolean PIT_CheckThing(mobj_t *thing) if (!tmthing->health) return true; + if (thing->type == MT_SPIKE && (thing->flags & MF_SOLID)) // unfortunate player falls into spike?! + { + if (thing->eflags & MFE_VERTICALFLIP) + { + if (tmthing->z + tmthing->height <= thing->z - FixedMul(FRACUNIT, thing->scale) + && tmthing->z + tmthing->height + tmthing->momz >= thing->z - FixedMul(FRACUNIT, thing->scale) + && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && tmthing->eflags & MFE_VERTICALFLIP)) + P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); + } + else if (tmthing->z >= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) + && tmthing->z + tmthing->momz <= thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) + && !(tmthing->player->charability == CA_BOUNCE && tmthing->player->panim == PA_ABILITY && !(tmthing->eflags & MFE_VERTICALFLIP))) + P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); + } + + if (thing->type == MT_WALLSPIKE && (thing->flags & MF_SOLID)) + { + fixed_t bottomz, topz; + angle_t touchangle = R_PointToAngle2(thing->tracer->x, thing->tracer->y, tmthing->x, tmthing->y); + + if (P_PlayerInPain(tmthing->player) && (tmthing->momx || tmthing->momy)) + { + angle_t playerangle = R_PointToAngle2(0, 0, tmthing->momx, tmthing->momy) - touchangle; + if (playerangle > ANGLE_180) + playerangle = InvAngle(playerangle); + if (playerangle < ANGLE_90) + return true; // Yes, this is intentionally outside the z-height check. No standing on spikes whilst moving away from them. + } + + bottomz = thing->z; + topz = thing->z + thing->height; + + if (thing->eflags & MFE_VERTICALFLIP) + bottomz -= FixedMul(FRACUNIT, thing->scale); + else + topz += FixedMul(FRACUNIT, thing->scale); + + if (tmthing->z + tmthing->height > bottomz // above bottom + && tmthing->z < topz // below top + && !P_MobjWasRemoved(thing->tracer)) // this probably wouldn't work if we didn't have a tracer + { // use base as a reference point to determine what angle you touched the spike at + touchangle = thing->angle - touchangle; + if (touchangle > ANGLE_180) + touchangle = InvAngle(touchangle); + if (touchangle <= ANGLE_22h) // if you touched it at this close an angle, you get poked! + P_DamageMobj(tmthing, thing, thing, 1, DMG_SPIKE); + } + } + if (thing->type == MT_FAN || thing->type == MT_STEAM) P_DoFanAndGasJet(thing, tmthing); else if (thing->flags & MF_SPRING && tmthing->player->powers[pw_carry] != CR_MINECART) @@ -1721,8 +1706,8 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - if ((tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM || tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) && (thing->player)) - ; // springs, gas jets and springs should never be able to step up onto a player + if ((thing->player) && (tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM)) + ; // 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 @@ -1730,6 +1715,9 @@ static boolean PIT_CheckThing(mobj_t *thing) { fixed_t topz, tmtopz; + if (tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) // do not run height checks if you are a spike + return true; + if (tmthing->eflags & MFE_VERTICALFLIP) { // pass under diff --git a/src/p_mobj.c b/src/p_mobj.c index 83f9ebf3c..e43414a80 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7842,6 +7842,48 @@ static void P_MobjSceneryThink(mobj_t *mobj) if (P_MobjFlip(mobj)*mobj->momz < mobj->info->speed) mobj->momz = P_MobjFlip(mobj)*mobj->info->speed; break; + case MT_SPIKE: + if (mobj->fuse) + { + mobj->fuse--; + break; + } + P_SetMobjState(mobj, mobj->state->nextstate); + mobj->fuse = mobj->info->speed; + if (mobj->spawnpoint) + mobj->fuse += mobj->spawnpoint->angle; + break; + case MT_WALLSPIKE: + if (mobj->fuse) + { + mobj->fuse--; + break; + } + P_SetMobjState(mobj, mobj->state->nextstate); + mobj->fuse = mobj->info->speed; + if (mobj->spawnpoint) + mobj->fuse += (mobj->spawnpoint->angle / 360); + break; + case MT_WALLSPIKEBASE: + if (!mobj->target) + { + P_RemoveMobj(mobj); + return; + } + mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|(mobj->target->frame & FF_FRAMEMASK); +#if 0 + if (mobj->angle != mobj->target->angle + ANGLE_90) // reposition if not the correct angle + { + mobj_t* target = mobj->target; // shortcut + const fixed_t baseradius = target->radius - (target->scale/2); //FixedMul(FRACUNIT/2, target->scale); + P_UnsetThingPosition(mobj); + mobj->x = target->x - P_ReturnThrustX(target, target->angle, baseradius); + mobj->y = target->y - P_ReturnThrustY(target, target->angle, baseradius); + P_SetThingPosition(mobj); + mobj->angle = target->angle + ANGLE_90; + } +#endif + break; case MT_ROCKCRUMBLE1: case MT_ROCKCRUMBLE2: case MT_ROCKCRUMBLE3: @@ -9238,25 +9280,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) switch (mobj->type) { - case MT_WALLSPIKEBASE: - if (!mobj->target) { - P_RemoveMobj(mobj); - return false; - } - mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|(mobj->target->frame & FF_FRAMEMASK); -#if 0 - if (mobj->angle != mobj->target->angle + ANGLE_90) // reposition if not the correct angle - { - mobj_t* target = mobj->target; // shortcut - const fixed_t baseradius = target->radius - (target->scale/2); //FixedMul(FRACUNIT/2, target->scale); - P_UnsetThingPosition(mobj); - mobj->x = target->x - P_ReturnThrustX(target, target->angle, baseradius); - mobj->y = target->y - P_ReturnThrustY(target, target->angle, baseradius); - P_SetThingPosition(mobj); - mobj->angle = target->angle + ANGLE_90; - } -#endif - break; case MT_FALLINGROCK: // Despawn rocks here in case zmovement code can't do so (blame slopes) if (!mobj->momx && !mobj->momy && !mobj->momz @@ -9942,18 +9965,6 @@ static boolean P_FuseThink(mobj_t *mobj) break; case MT_METALSONIC_BATTLE: break; // don't remove - case MT_SPIKE: - P_SetMobjState(mobj, mobj->state->nextstate); - mobj->fuse = mobj->info->speed; - if (mobj->spawnpoint) - mobj->fuse += mobj->spawnpoint->angle; - break; - case MT_WALLSPIKE: - P_SetMobjState(mobj, mobj->state->nextstate); - mobj->fuse = mobj->info->speed; - if (mobj->spawnpoint) - mobj->fuse += (mobj->spawnpoint->angle / 360); - break; case MT_NIGHTSCORE: P_RemoveMobj(mobj); return false; @@ -12956,17 +12967,18 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean // Pop up spikes! if (mthing->options & MTF_OBJECTSPECIAL) { - mobj->flags &= ~MF_SCENERY; mobj->fuse = (16 - mthing->extrainfo)*(mthing->angle + mobj->info->speed)/16; if (mthing->options & MTF_EXTRA) P_SetMobjState(mobj, mobj->info->meleestate); } - // Use per-thing collision for spikes if the deaf flag isn't checked. - if (!(mthing->options & MTF_AMBUSH) && !metalrecording) + else + mobj->flags |= MF_NOTHINK; + // no collision for spikes if the ambush flag is checked + if ((mthing->options & MTF_AMBUSH) || metalrecording) { P_UnsetThingPosition(mobj); - mobj->flags &= ~(MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT); - mobj->flags |= MF_SOLID; + mobj->flags |= (MF_NOBLOCKMAP|MF_NOCLIPHEIGHT); + mobj->flags &= ~MF_SOLID; P_SetThingPosition(mobj); } break; @@ -12974,20 +12986,20 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean // Pop up spikes! if (mthing->options & MTF_OBJECTSPECIAL) { - mobj->flags &= ~MF_SCENERY; mobj->fuse = (16 - mthing->extrainfo)*((mthing->angle/360) + mobj->info->speed)/16; if (mthing->options & MTF_EXTRA) P_SetMobjState(mobj, mobj->info->meleestate); } - // Use per-thing collision for spikes if the deaf flag isn't checked. - if (!(mthing->options & MTF_AMBUSH) && !metalrecording) + else + mobj->flags |= MF_NOTHINK; + // no collision for spikes if the ambush flag is checked + if ((mthing->options & MTF_AMBUSH) || metalrecording) { P_UnsetThingPosition(mobj); - mobj->flags &= ~(MF_NOBLOCKMAP | MF_NOCLIPHEIGHT); - mobj->flags |= MF_SOLID; + mobj->flags |= (MF_NOBLOCKMAP|MF_NOCLIPHEIGHT); + mobj->flags &= ~MF_SOLID; P_SetThingPosition(mobj); } - // spawn base { const angle_t mobjangle = FixedAngle(mthing->angle << FRACBITS); // the mobj's own angle hasn't been set quite yet so... @@ -13001,6 +13013,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean P_SetScale(base, mobj->scale); P_SetTarget(&base->target, mobj); P_SetTarget(&mobj->tracer, base); + if (!(mthing->options & MTF_OBJECTSPECIAL)) + base->flags |= MF_NOTHINK; } break; case MT_RING_BOX: From f271f88c7f3084523a03ca7f47060d6527724796 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sun, 5 Dec 2021 17:59:33 +0100 Subject: [PATCH 11/17] Fix MusicChange hook crashing when called BRUH MOMENT BRUH MOMENT PREPARE THE HALL OF SHAME --- src/lua_hooklib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index a72b22b5a..287a185bc 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1117,7 +1117,7 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param) lua_pushstring(gL, oldname);/* the only constant value */ lua_pushstring(gL, param->newname);/* semi constant */ - for (k = 0; k <= map->numHooks; ++k) + for (k = 0; k < map->numHooks; ++k) { get_hook(&hook, map->ids, k); From 97e2fe18c6d36fae3d1321de3d26e47163ba5d84 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 6 Dec 2021 18:00:30 -0600 Subject: [PATCH 12/17] fix spike sandwich teleportation issue --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 836e75c4e..59756d8a6 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1152,9 +1152,9 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // underneath if (tmthing->eflags & MFE_VERTICALFLIP) - thing->z = tmthing->z - thing->height - FixedMul(FRACUNIT, tmthing->scale); + P_TeleportMove(thing, thing->x, thing->y, tmthing->z - thing->height - FixedMul(FRACUNIT, tmthing->scale)); else - thing->z = tmthing->z + tmthing->height + FixedMul(FRACUNIT, tmthing->scale); + P_TeleportMove(thing, thing->x, thing->y, tmthing->z + tmthing->height + FixedMul(FRACUNIT, tmthing->scale)); if (thing->flags & MF_SHOOTABLE) P_DamageMobj(thing, tmthing, tmthing, 1, DMG_SPIKE); return true; From c420de6f119c8b362dcc4991a544928ccca6bba5 Mon Sep 17 00:00:00 2001 From: John FrostFox Date: Thu, 9 Dec 2021 11:42:06 +0300 Subject: [PATCH 13/17] Include pmomz for mobjs in net savestates and load if it exists --- src/p_saveg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 1270064c0..722340f41 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1603,7 +1603,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 = 0; // not the default but the most probable - if (mobj->momx != 0 || mobj->momy != 0 || mobj->momz != 0) + if (mobj->momx != 0 || mobj->momy != 0 || mobj->momz != 0 || mobj->pmomz !=0) diff |= MD_MOM; if (mobj->radius != mobj->info->radius) diff |= MD_RADIUS; @@ -1778,6 +1778,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, mobj->momx); WRITEFIXED(save_p, mobj->momy); WRITEFIXED(save_p, mobj->momz); + WRITEFIXED(save_p, mobj->pmomz); } if (diff & MD_RADIUS) WRITEFIXED(save_p, mobj->radius); @@ -2776,6 +2777,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->momx = READFIXED(save_p); mobj->momy = READFIXED(save_p); mobj->momz = READFIXED(save_p); + mobj->pmomz = READFIXED(save_p); } // otherwise they're zero, and the memset took care of it if (diff & MD_RADIUS) From 6f5b34f7c16e3012b481a7522613b3dcc744a4fe Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 9 Dec 2021 12:45:18 +0100 Subject: [PATCH 14/17] Don't award end-of-level bonuses to bots. --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index f24436d40..288a821e6 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2023,7 +2023,7 @@ static void Y_AwardCoopBonuses(void) for (i = 0; i < MAXPLAYERS; ++i) { - if (!playeringame[i] || players[i].lives < 1) // not active or game over + if (!playeringame[i] || players[i].lives < 1 || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) // not active, game over or tails bot bonusnum = 0; // all null else bonusnum = mapheaderinfo[prevmap]->bonustype + 1; // -1 is none @@ -2073,7 +2073,7 @@ static void Y_AwardSpecialStageBonus(void) { oldscore = players[i].score; - if (!playeringame[i] || players[i].lives < 1) // not active or game over + if (!playeringame[i] || players[i].lives < 1 || players[i].bot == BOT_2PAI || players[i].bot == BOT_2PHUMAN) // not active, game over or tails bot { Y_SetNullBonus(&players[i], &localbonuses[0]); Y_SetNullBonus(&players[i], &localbonuses[1]); From e7a7a3b2138017b08d19276cb95497f4298aef8c Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 13 Dec 2021 15:20:43 +0100 Subject: [PATCH 15/17] Prevent Pyrefly fire from warping up nearby ledges. --- src/info.c | 4 ++-- src/p_mobj.c | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/info.c b/src/info.c index f56e5d78e..086293cd6 100644 --- a/src/info.c +++ b/src/info.c @@ -5198,11 +5198,11 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // speed 24*FRACUNIT, // radius 34*FRACUNIT, // height - 0, // display offset + 1, // display offset DMG_FIRE, // mass 0, // damage sfx_None, // activesound - MF_NOGRAVITY|MF_NOBLOCKMAP|MF_FIRE|MF_PAIN, // flags + MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_FIRE|MF_PAIN, // flags S_NULL // raisestate }, diff --git a/src/p_mobj.c b/src/p_mobj.c index 83f9ebf3c..4b0337873 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -395,13 +395,13 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) if (skin) { UINT16 stateframe = st->frame; - + // Add/Remove FF_SPR2SUPER based on certain conditions if (player->charflags & SF_NOSUPERSPRITES) stateframe = stateframe & ~FF_SPR2SUPER; else if (player->powers[pw_super]) stateframe = stateframe | FF_SPR2SUPER; - + if (stateframe & FF_SPR2SUPER) { if (mobj->eflags & MFE_FORCENOSUPER) @@ -409,11 +409,11 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) } else if (mobj->eflags & MFE_FORCESUPER) stateframe = stateframe | FF_SPR2SUPER; - + // Get the sprite2 and frame number spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), mobj->player); numframes = skin->sprites[spr2].numframes; - + if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) mobj->tics = -1; // If no super wait, don't wait at all } @@ -541,7 +541,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) if (skin) { UINT16 stateframe = st->frame; - + // Add/Remove FF_SPR2SUPER based on certain conditions if (stateframe & FF_SPR2SUPER) { @@ -550,11 +550,11 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) } else if (mobj->eflags & MFE_FORCESUPER) stateframe = stateframe | FF_SPR2SUPER; - + // Get the sprite2 and frame number spr2 = P_GetSkinSprite2(skin, (stateframe & FF_FRAMEMASK), NULL); numframes = skin->sprites[spr2].numframes; - + if (state == S_PLAY_STND && (spr2 & FF_SPR2SUPER) && skin->sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) mobj->tics = -1; // If no super wait, don't wait at all } @@ -1872,7 +1872,7 @@ void P_XYMovement(mobj_t *mo) // blocked move moved = false; - if (player) + if (player) B_MoveBlocked(player); if (LUA_HookMobjMoveBlocked(mo, tmhitthing, blockingline)) @@ -3323,7 +3323,7 @@ void P_MobjCheckWater(mobj_t *mobj) { // Water removes electric and non-water fire shields... if (electric) P_FlashPal(p, PAL_WHITE, 1); - + p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; } } @@ -7059,6 +7059,8 @@ static void P_PyreFlyBurn(mobj_t *mobj, fixed_t hoffs, INT16 vrange, mobjtype_t fixed_t zoffs = P_RandomRange(-vrange, vrange)*FRACUNIT; mobj_t *particle = P_SpawnMobjFromMobj(mobj, xoffs, yoffs, zoffs, mobjtype); particle->momz = momz; + particle->flags2 |= MF2_LINKDRAW; + P_SetTarget(&particle->tracer, mobj); } static void P_MobjScaleThink(mobj_t *mobj) @@ -10422,7 +10424,7 @@ static fixed_t P_DefaultMobjShadowScale (mobj_t *thing) case MT_RING: case MT_FLINGRING: - + case MT_COIN: case MT_FLINGCOIN: From 243a797efe9fe89c4b51c974b5137afeedded808 Mon Sep 17 00:00:00 2001 From: katsy <205-katsy@users.noreply.git.do.srb2.org> Date: Sun, 26 Dec 2021 12:41:49 +0000 Subject: [PATCH 16/17] Set a default botleader if we don't have one (resolves #717) --- src/b_bot.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index cdd74fc07..bf2dbbb68 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -29,11 +29,16 @@ void B_UpdateBotleader(player_t *player) { if (players[i].bot || players[i].playerstate != PST_LIVE || players[i].spectator || !players[i].mo) continue; - if (!player->mo) //Can't do distance calculations if there's no player object, so we'll just take the first we find + + if (!player->botleader) { - player->botleader = &players[i]; + player->botleader = &players[i]; // set default return; } + + if (!player->mo) + return; + //Update best candidate based on nearest distance dist = R_PointToDist2(player->mo->x, player->mo->y, players[i].mo->x, players[i].mo->y); if (neardist > dist) From bb514d227ca5f2d53e6295c8b599a1dc205c69f1 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 26 Dec 2021 21:12:39 +0100 Subject: [PATCH 17/17] Don't count music.dta as a main wad when using listwad --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cca3102d0..fe7e7678f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3763,7 +3763,7 @@ static void Command_ListWADS_f(void) nameonly(tempname = va("%s", wadfiles[i]->filename)); if (!i) CONS_Printf("\x82 IWAD\x80: %s\n", tempname); - else if (i <= mainwads) + else if (i < mainwads) CONS_Printf("\x82 * %.2d\x80: %s\n", i, tempname); else if (!wadfiles[i]->important) CONS_Printf("\x86 %.2d: %s\n", i, tempname);