From b62ed336551aaa6fe2e444be0164e944123ac723 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 2 Dec 2022 03:56:15 -0500 Subject: [PATCH 1/6] Fix Battle mode Egg Capsules bumping Old vanilla-ass code for platform-like objects that is conflicting super hard with bumping / horizontal momentum. If we ever have a moving platform object this code should be brought back only for that object, and not solid objects as a whole. --- src/p_map.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index cb5d030a2..c7047bcde 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1464,6 +1464,11 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) } } + // This code is causing conflicts for Ring Racers, + // as solid objects cause bumping. If you need to + // bring back this code for a moving platform-style + // object, separate it properly. +#if 0 if ((tm.thing->flags & MF_SPRING || tm.thing->type == MT_STEAM || tm.thing->type == MT_SPIKE || tm.thing->type == MT_WALLSPIKE) && (thing->player)) ; // springs, gas jets and springs should never be able to step up onto a player // z checking at last @@ -1562,6 +1567,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) } } } +#endif // not solid not blocked return BMIT_CONTINUE; From bdbd79dd4109772694acd4eeeed90d5c629a1bb9 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 2 Dec 2022 04:12:04 -0500 Subject: [PATCH 2/6] Fix Egg Capsule interp --- src/p_mobj.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0613d816c..91fbbfa52 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9156,9 +9156,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) // Move each piece to the proper position while (cur && !P_MobjWasRemoved(cur)) { - fixed_t newx = mobj->x; - fixed_t newy = mobj->y; - fixed_t newz = bottom; + fixed_t newx = mobj->x + mobj->momx; + fixed_t newy = mobj->y + mobj->momy; + fixed_t newz = bottom + mobj->momz; statenum_t state = (statenum_t)(cur->state-states); cur->scale = mobj->scale; @@ -9202,7 +9202,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) cur->angle = angle + ANGLE_90; } - P_MoveOrigin(cur, newx, newy, newz); + cur->momx = newx - cur->x; + cur->momy = newy - cur->y; + cur->momz = newz - cur->z; cur = cur->hnext; } From e8e02058ef1aee030335b45c2f26435d04aad6bc Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 2 Dec 2022 04:21:23 -0500 Subject: [PATCH 3/6] Bigger Egg Capsule hitbox --- src/info.c | 4 ++-- src/p_mobj.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/info.c b/src/info.c index 3824731d1..dcf6a9f65 100644 --- a/src/info.c +++ b/src/info.c @@ -28661,8 +28661,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 28<radius; - fixed_t offy = mobj->radius; + fixed_t offx = 28 * mobj->scale; + fixed_t offy = 28 * mobj->scale; if (cur->extravalue1 & 1) offx = -offx; From d6bd869b9212a51cef3280f0d295f767eada70ca Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 3 Dec 2022 03:08:44 -0500 Subject: [PATCH 4/6] Give Egg Capsules drop shadows --- src/info.c | 2 +- src/p_mobj.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index dcf6a9f65..61af1efeb 100644 --- a/src/info.c +++ b/src/info.c @@ -28646,7 +28646,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_BATTLECAPSULE 2333, // doomednum - S_INVISIBLE, // spawnstate + S_SHADOW, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound diff --git a/src/p_mobj.c b/src/p_mobj.c index caf725e26..78d27e96a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9998,6 +9998,7 @@ static void P_DefaultMobjShadowScale(mobj_t *thing) { case MT_PLAYER: case MT_KART_LEFTOVER: + case MT_BATTLECAPSULE: thing->shadowscale = FRACUNIT; break; case MT_SMALLMACE: From 226cb7d736b6a4b134feddb93da16a26ecd47a8f Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 3 Dec 2022 04:25:34 -0500 Subject: [PATCH 5/6] Update capsule parts - The pieces do the positioning, instead of the capsule itself. This makes it so that the parts update after the capsule has applied its momentum. - Use proper inradius instead, so the sides line up. - Because of the above change, the capsule as a whole is bigger. This means... - Increased hitbox again - Changed a few of the sprites --- src/info.c | 2 +- src/p_mobj.c | 171 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 107 insertions(+), 66 deletions(-) diff --git a/src/info.c b/src/info.c index 61af1efeb..ae5bce736 100644 --- a/src/info.c +++ b/src/info.c @@ -28661,7 +28661,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 56<extravalue2) + { mobj->frame |= FF_VERTICALFLIP; + } else + { mobj->frame &= ~FF_VERTICALFLIP; + } if (mobj->flags2 & MF2_OBJECTFLIP) + { mobj->eflags |= MFE_VERTICALFLIP; + } if (mobj->tics > 0) + { + // Despawning. mobj->renderflags ^= RF_DONTDRAW; + } + else + { + statenum_t state = (statenum_t)(mobj->state - states); + mobj_t *owner = mobj->target; + fixed_t newx, newy, newz; + SINT8 flip; + + if (owner == NULL || P_MobjWasRemoved(owner) == true) + { + // Exit early. + break; + } + + newx = owner->x; + newy = owner->y; + newz = P_GetMobjFeet(owner); + + flip = P_MobjFlip(owner); // Flying capsules needs flipped sprites, but not flipped gravity + if (owner->extravalue1) + { + flip = -flip; + newz += owner->height; + } + + mobj->scale = owner->scale; + mobj->destscale = owner->destscale; + mobj->scalespeed = owner->scalespeed; + + mobj->extravalue2 = owner->extravalue1; + + mobj->flags2 = (mobj->flags2 & ~MF2_OBJECTFLIP) | (owner->flags2 & MF2_OBJECTFLIP); + + switch (state) + { + case S_BATTLECAPSULE_TOP: + { + newz += (80 * owner->scale * flip); + break; + } + + case S_BATTLECAPSULE_BUTTON: + { + newz += (120 * owner->scale * flip); + break; + } + + case S_BATTLECAPSULE_SUPPORT: + case S_BATTLECAPSULE_SUPPORTFLY: + case S_KARMAWHEEL: + { + fixed_t offx = 36 * owner->scale; + fixed_t offy = 36 * owner->scale; + + if (mobj->extravalue1 & 1) + { + offx = -offx; + } + + if (mobj->extravalue1 > 1) + { + offy = -offy; + } + + newx += offx; + newy += offy; + break; + } + + case S_BATTLECAPSULE_SIDE1: + case S_BATTLECAPSULE_SIDE2: + { +#define inradius 3797355 // Precalculated +#ifndef inradius + fixed_t inradius = FixedDiv(48 << FRACBITS, 2 * FINETANGENT((((ANGLE_180 / 8) + ANGLE_90) >> ANGLETOFINESHIFT) & 4095)); +#endif + fixed_t offset = FixedMul(inradius, owner->scale); + angle_t angle = (ANGLE_45 * mobj->extravalue1); + + newx += FixedMul(offset, FINECOSINE(angle >> ANGLETOFINESHIFT)); + newy += FixedMul(offset, FINESINE(angle >> ANGLETOFINESHIFT)); + newz += (12 * owner->scale * flip); + + mobj->angle = angle + ANGLE_90; + break; +#undef inradius + } + + default: + { + break; + } + } + + mobj->momx = newx - mobj->x; + mobj->momy = newy - mobj->y; + mobj->momz = newz - mobj->z; + } break; case MT_SPINDASHWIND: case MT_DRIFTELECTRICSPARK: @@ -9039,8 +9145,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) { SINT8 realflip = P_MobjFlip(mobj); SINT8 flip = realflip; // Flying capsules needs flipped sprites, but not flipped gravity - fixed_t bottom; - mobj_t *cur; if (mobj->extravalue1) { @@ -9145,69 +9249,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } } } - - if (flip == -1) - bottom = mobj->z + mobj->height; - else - bottom = mobj->z; - - cur = mobj->hnext; - - // Move each piece to the proper position - while (cur && !P_MobjWasRemoved(cur)) - { - fixed_t newx = mobj->x + mobj->momx; - fixed_t newy = mobj->y + mobj->momy; - fixed_t newz = bottom + mobj->momz; - statenum_t state = (statenum_t)(cur->state-states); - - cur->scale = mobj->scale; - cur->destscale = mobj->destscale; - cur->scalespeed = mobj->scalespeed; - - cur->extravalue2 = mobj->extravalue1; - - cur->flags2 = (cur->flags2 & ~MF2_OBJECTFLIP)|(mobj->flags2 & MF2_OBJECTFLIP); - - if (state == S_BATTLECAPSULE_TOP) - newz += (80 * mobj->scale * flip); - else if (state == S_BATTLECAPSULE_BUTTON) - newz += (108 * mobj->scale * flip); - else if (state == S_BATTLECAPSULE_SUPPORT - || state == S_BATTLECAPSULE_SUPPORTFLY - || state == S_KARMAWHEEL) - { - fixed_t offx = 28 * mobj->scale; - fixed_t offy = 28 * mobj->scale; - - if (cur->extravalue1 & 1) - offx = -offx; - - if (cur->extravalue1 > 1) - offy = -offy; - - newx += offx; - newy += offy; - } - else if (state == S_BATTLECAPSULE_SIDE1 - || state == S_BATTLECAPSULE_SIDE2) - { - fixed_t offset = 48 * mobj->scale; - angle_t angle = (ANGLE_45 * cur->extravalue1); - - newx += FixedMul(offset, FINECOSINE(angle >> ANGLETOFINESHIFT)); - newy += FixedMul(offset, FINESINE(angle >> ANGLETOFINESHIFT)); - newz += (12 * mobj->scale * flip); - - cur->angle = angle + ANGLE_90; - } - - cur->momx = newx - cur->x; - cur->momy = newy - cur->y; - cur->momz = newz - cur->z; - - cur = cur->hnext; - } } break; case MT_RANDOMITEM: From 2140c2f6162d42aa75be8ed8f764d7a68f4ec998 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 3 Dec 2022 04:45:59 -0500 Subject: [PATCH 6/6] Use P1-4 starts in Capsules Attack / Bonus Stage Rather than randomized Battle starts. --- src/g_game.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index fe73d8ae6..5cde2d270 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2824,6 +2824,11 @@ mapthing_t *G_FindMapStart(INT32 playernum) spawnpoint = G_FindRaceStartOrFallback(playernum); } + // -- Grand Prix / Time Attack -- + // Order: Race->DM->CTF + else if (grandprixinfo.gp || modeattacking) + spawnpoint = G_FindRaceStartOrFallback(playernum); + // -- CTF -- // Order: CTF->DM->Race else if ((gametyperules & GTR_TEAMSTARTS) && players[playernum].ctfteam)