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) diff --git a/src/info.c b/src/info.c index f4a17b28b..3c6612ac4 100644 --- a/src/info.c +++ b/src/info.c @@ -28647,7 +28647,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_BATTLECAPSULE 2333, // doomednum - S_INVISIBLE, // spawnstate + S_SHADOW, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -28662,8 +28662,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed - 28<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; diff --git a/src/p_mobj.c b/src/p_mobj.c index 0613d816c..974550415 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6384,15 +6384,121 @@ static void P_MobjSceneryThink(mobj_t *mobj) break; case MT_BATTLECAPSULE_PIECE: if (mobj->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,67 +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; - fixed_t newy = mobj->y; - fixed_t newz = bottom; - 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 = mobj->radius; - fixed_t offy = mobj->radius; - - 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; - } - - P_MoveOrigin(cur, newx, newy, newz); - - cur = cur->hnext; - } } break; case MT_RANDOMITEM: @@ -9996,6 +10039,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: