Merge remote-tracking branch 'remotes/internal/upsidedown-brain' into HEAD

# Conflicts:
#	src/k_kart.c
#	src/p_mobj.c
This commit is contained in:
fickleheart 2019-03-11 21:59:45 -05:00
commit 9ff8b73936
9 changed files with 104 additions and 41 deletions

View file

@ -269,6 +269,7 @@ typedef enum
k_nextcheck, // Next checkpoint distance; for p_user.c (was "pw_ncd") k_nextcheck, // Next checkpoint distance; for p_user.c (was "pw_ncd")
k_waypoint, // Waypoints. k_waypoint, // Waypoints.
k_starpostwp, // Temporarily stores player waypoint for... some reason. Used when respawning and finishing. k_starpostwp, // Temporarily stores player waypoint for... some reason. Used when respawning and finishing.
k_starpostflip, // the last starpost we hit requires flipping?
k_respawn, // Timer for the DEZ laser respawn effect k_respawn, // Timer for the DEZ laser respawn effect
k_dropdash, // Charge up for respawn Drop Dash k_dropdash, // Charge up for respawn Drop Dash

View file

@ -2375,6 +2375,7 @@ void G_PlayerReborn(INT32 player)
INT32 bumper; INT32 bumper;
INT32 comebackpoints; INT32 comebackpoints;
INT32 wanted; INT32 wanted;
INT32 respawnflip;
boolean songcredit = false; boolean songcredit = false;
score = players[player].score; score = players[player].score;
@ -2416,6 +2417,7 @@ void G_PlayerReborn(INT32 player)
starposty = players[player].starposty; starposty = players[player].starposty;
starpostz = players[player].starpostz; starpostz = players[player].starpostz;
starpostnum = players[player].starpostnum; starpostnum = players[player].starpostnum;
respawnflip = players[player].kartstuff[k_starpostflip]; //SRB2KART
starpostangle = players[player].starpostangle; starpostangle = players[player].starpostangle;
jumpfactor = players[player].jumpfactor; jumpfactor = players[player].jumpfactor;
thokitem = players[player].thokitem; thokitem = players[player].thokitem;
@ -2536,6 +2538,7 @@ void G_PlayerReborn(INT32 player)
p->kartstuff[k_comebacktimer] = comebacktime; p->kartstuff[k_comebacktimer] = comebacktime;
p->kartstuff[k_wanted] = wanted; p->kartstuff[k_wanted] = wanted;
p->kartstuff[k_eggmanblame] = -1; p->kartstuff[k_eggmanblame] = -1;
p->kartstuff[k_starpostflip] = respawnflip;
// Don't do anything immediately // Don't do anything immediately
p->pflags |= PF_USEDOWN; p->pflags |= PF_USEDOWN;

View file

@ -15025,8 +15025,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // xdeathstate S_NULL, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
8, // speed 8, // speed
8*FRACUNIT, // radius 32*FRACUNIT, // radius
8*FRACUNIT, // height 64*FRACUNIT, // height
1, // display offset 1, // display offset
100, // mass 100, // mass
0, // damage 0, // damage

View file

@ -1419,11 +1419,23 @@ static void K_UpdateOffroad(player_t *player)
player->kartstuff[k_offroad] = 0; player->kartstuff[k_offroad] = 0;
} }
// Adds gravity flipping to an object relative to its master and shifts the z coordinate accordingly.
void K_FlipFromObject(mobj_t *mo, mobj_t *master)
{
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP)|(master->eflags & MFE_VERTICALFLIP);
mo->flags2 = (mo->flags2 & ~MF2_OBJECTFLIP)|(master->flags2 & MF2_OBJECTFLIP);
if (mo->eflags & MFE_VERTICALFLIP)
mo->z += master->height - FixedMul(master->scale, mo->height);
}
// These have to go earlier than its sisters because of K_RespawnChecker... // These have to go earlier than its sisters because of K_RespawnChecker...
void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master) void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master)
{ {
// flipping // flipping
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP)|(master->eflags & MFE_VERTICALFLIP); // handle z shifting from there too. This is here since there's no reason not to flip us if needed when we do this anyway;
K_FlipFromObject(mo, master);
// visibility (usually for hyudoro) // visibility (usually for hyudoro)
mo->flags2 = (mo->flags2 & ~MF2_DONTDRAW)|(master->flags2 & MF2_DONTDRAW); mo->flags2 = (mo->flags2 & ~MF2_DONTDRAW)|(master->flags2 & MF2_DONTDRAW);
mo->eflags = (mo->eflags & ~MFE_DRAWONLYFORP1)|(master->eflags & MFE_DRAWONLYFORP1); mo->eflags = (mo->eflags & ~MFE_DRAWONLYFORP1)|(master->eflags & MFE_DRAWONLYFORP1);
@ -2294,7 +2306,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
if (source && source != player->mo && source->player) if (source && source != player->mo && source->player)
K_PlayHitEmSound(source); K_PlayHitEmSound(source);
player->mo->momz = 18*mapobjectscale; player->mo->momz = 18*mapobjectscale*P_MobjFlip(player->mo); // please stop forgetting mobjflip checks!!!!
player->mo->momx = player->mo->momy = 0; player->mo->momx = player->mo->momy = 0;
player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_sneakertimer] = 0;
@ -2536,6 +2548,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
{ {
INT32 i, radius, height; INT32 i, radius, height;
mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING); mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING);
K_MatchGenericExtraFlags(smoldering, source);
mobj_t *dust; mobj_t *dust;
mobj_t *truc; mobj_t *truc;
INT32 speed, speed2; INT32 speed, speed2;
@ -2560,6 +2574,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT, truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT,
source->y + P_RandomRange(-radius, radius)*FRACUNIT, source->y + P_RandomRange(-radius, radius)*FRACUNIT,
source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMEXPLODE); source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMEXPLODE);
K_MatchGenericExtraFlags(truc, source);
P_SetScale(truc, source->scale); P_SetScale(truc, source->scale);
truc->destscale = source->scale*6; truc->destscale = source->scale*6;
truc->scalespeed = source->scale/12; truc->scalespeed = source->scale/12;
@ -2567,7 +2582,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
truc->momx = P_RandomRange(-speed, speed)*FRACUNIT; truc->momx = P_RandomRange(-speed, speed)*FRACUNIT;
truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT;
speed = FixedMul(20*FRACUNIT, source->scale)>>FRACBITS; speed = FixedMul(20*FRACUNIT, source->scale)>>FRACBITS;
truc->momz = P_RandomRange(-speed, speed)*FRACUNIT; truc->momz = P_RandomRange(-speed, speed)*FRACUNIT*P_MobjFlip(truc);
if (truc->eflags & MFE_UNDERWATER) if (truc->eflags & MFE_UNDERWATER)
truc->momz = (117 * truc->momz) / 200; truc->momz = (117 * truc->momz) / 200;
truc->color = color; truc->color = color;
@ -2588,6 +2603,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT, truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT,
source->y + P_RandomRange(-radius, radius)*FRACUNIT, source->y + P_RandomRange(-radius, radius)*FRACUNIT,
source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMPARTICLE); source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMPARTICLE);
K_MatchGenericExtraFlags(truc, source);
P_SetScale(truc, source->scale); P_SetScale(truc, source->scale);
truc->destscale = source->scale*5; truc->destscale = source->scale*5;
truc->scalespeed = source->scale/12; truc->scalespeed = source->scale/12;
@ -2596,7 +2612,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT;
speed = FixedMul(15*FRACUNIT, source->scale)>>FRACBITS; speed = FixedMul(15*FRACUNIT, source->scale)>>FRACBITS;
speed2 = FixedMul(45*FRACUNIT, source->scale)>>FRACBITS; speed2 = FixedMul(45*FRACUNIT, source->scale)>>FRACBITS;
truc->momz = P_RandomRange(speed, speed2)*FRACUNIT; truc->momz = P_RandomRange(speed, speed2)*FRACUNIT*P_MobjFlip(truc);
if (P_RandomChance(FRACUNIT/2)) if (P_RandomChance(FRACUNIT/2))
truc->momz = -truc->momz; truc->momz = -truc->momz;
if (truc->eflags & MFE_UNDERWATER) if (truc->eflags & MFE_UNDERWATER)
@ -2872,7 +2888,8 @@ void K_SpawnBoostTrail(player_t *player)
flame->fuse = TICRATE*2; flame->fuse = TICRATE*2;
flame->destscale = player->mo->scale; flame->destscale = player->mo->scale;
P_SetScale(flame, player->mo->scale); P_SetScale(flame, player->mo->scale);
flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags so that a stolen sneaker can be seen // not K_MatchGenericExtraFlags so that a stolen sneaker can be seen
K_FlipFromObject(flame, player->mo);
flame->momx = 8; flame->momx = 8;
P_XYMovement(flame); P_XYMovement(flame);
@ -2905,6 +2922,7 @@ void K_SpawnSparkleTrail(mobj_t *mo)
fixed_t newz = mo->z + mo->momz + (P_RandomRange(0, mo->height>>FRACBITS)<<FRACBITS); fixed_t newz = mo->z + mo->momz + (P_RandomRange(0, mo->height>>FRACBITS)<<FRACBITS);
sparkle = P_SpawnMobj(newx, newy, newz, MT_SPARKLETRAIL); sparkle = P_SpawnMobj(newx, newy, newz, MT_SPARKLETRAIL);
K_FlipFromObject(sparkle, mo);
//if (i == 0) //if (i == 0)
//P_SetMobjState(sparkle, S_KARTINVULN_LARGE1); //P_SetMobjState(sparkle, S_KARTINVULN_LARGE1);
@ -2912,7 +2930,6 @@ void K_SpawnSparkleTrail(mobj_t *mo)
P_SetTarget(&sparkle->target, mo); P_SetTarget(&sparkle->target, mo);
sparkle->destscale = mo->destscale; sparkle->destscale = mo->destscale;
P_SetScale(sparkle, mo->scale); P_SetScale(sparkle, mo->scale);
sparkle->eflags = (sparkle->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags so that a stolen invincibility can be seen
sparkle->color = mo->color; sparkle->color = mo->color;
//sparkle->colorized = mo->colorized; //sparkle->colorized = mo->colorized;
} }
@ -2946,7 +2963,7 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent)
dust->angle = R_PointToAngle2(0,0,mo->momx,mo->momy); dust->angle = R_PointToAngle2(0,0,mo->momx,mo->momy);
dust->destscale = mo->scale; dust->destscale = mo->scale;
P_SetScale(dust, mo->scale); P_SetScale(dust, mo->scale);
dust->eflags = (dust->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags because hyudoro shouldn't be able to wipeout K_FlipFromObject(dust, mo);
if (translucent) // offroad effect if (translucent) // offroad effect
{ {
@ -3012,10 +3029,6 @@ void K_DriftDustHandling(mobj_t *spawner)
fixed_t spawny = P_RandomRange(-spawnrange, spawnrange)<<FRACBITS; fixed_t spawny = P_RandomRange(-spawnrange, spawnrange)<<FRACBITS;
INT32 speedrange = 2; INT32 speedrange = 2;
mobj_t *dust = P_SpawnMobj(spawner->x + spawnx, spawner->y + spawny, spawner->z, MT_DRIFTDUST); mobj_t *dust = P_SpawnMobj(spawner->x + spawnx, spawner->y + spawny, spawner->z, MT_DRIFTDUST);
if (spawner->eflags & MFE_VERTICALFLIP)
{
dust->z += spawner->height - dust->height;
}
dust->momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<<FRACBITS), 3*(spawner->scale)/4); dust->momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<<FRACBITS), 3*(spawner->scale)/4);
dust->momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<<FRACBITS), 3*(spawner->scale)/4); dust->momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<<FRACBITS), 3*(spawner->scale)/4);
dust->momz = P_MobjFlip(spawner) * (P_RandomRange(1, 4) * (spawner->scale)); dust->momz = P_MobjFlip(spawner) * (P_RandomRange(1, 4) * (spawner->scale));
@ -3164,6 +3177,14 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
{ {
// Shoot forward // Shoot forward
mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, mapthing); mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, mapthing);
//K_FlipFromObject(mo, player->mo);
// These are really weird so let's make it a very specific case to make SURE it works...
if (player->mo->eflags & MFE_VERTICALFLIP)
{
mo->z -= player->mo->height;
mo->flags2 |= MF2_OBJECTFLIP;
mo->eflags |= MFE_VERTICALFLIP;
}
mo->threshold = 10; mo->threshold = 10;
P_SetTarget(&mo->target, player->mo); P_SetTarget(&mo->target, player->mo);
@ -3173,23 +3194,29 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
if (mo) if (mo)
{ {
angle_t fa = player->mo->angle>>ANGLETOFINESHIFT; angle_t fa = player->mo->angle>>ANGLETOFINESHIFT;
fixed_t HEIGHT = (20 + (dir*10))*mapobjectscale + player->mo->momz; fixed_t HEIGHT = (20 + (dir*10))*mapobjectscale + (player->mo->momz*P_MobjFlip(player->mo));
P_SetObjectMomZ(mo, HEIGHT, false);
mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), PROJSPEED*dir); mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), PROJSPEED*dir);
mo->momy = player->mo->momy + FixedMul(FINESINE(fa), PROJSPEED*dir); mo->momy = player->mo->momy + FixedMul(FINESINE(fa), PROJSPEED*dir);
mo->momz = P_MobjFlip(player->mo) * HEIGHT;
mo->extravalue2 = dir; mo->extravalue2 = dir;
if (mo->eflags & MFE_UNDERWATER) if (mo->eflags & MFE_UNDERWATER)
mo->momz = (117 * mo->momz) / 200; mo->momz = (117 * mo->momz) / 200;
if (player->mo->eflags & MFE_VERTICALFLIP)
mo->eflags |= MFE_VERTICALFLIP;
} }
// this is the small graphic effect that plops in you when you throw an item:
throwmo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FIREDITEM); throwmo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FIREDITEM);
P_SetTarget(&throwmo->target, player->mo); P_SetTarget(&throwmo->target, player->mo);
// Ditto:
if (player->mo->eflags & MFE_VERTICALFLIP)
{
throwmo->z -= player->mo->height;
throwmo->flags2 |= MF2_OBJECTFLIP;
throwmo->eflags |= MFE_VERTICALFLIP;
}
throwmo->movecount = 0; // above player throwmo->movecount = 0; // above player
} }
else else
@ -3215,9 +3242,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
} }
mo = P_SpawnMobj(newx, newy, newz, mapthing); // this will never return null because collision isn't processed here mo = P_SpawnMobj(newx, newy, newz, mapthing); // this will never return null because collision isn't processed here
K_FlipFromObject(mo, player->mo);
if (P_MobjFlip(player->mo) < 0)
mo->z = player->mo->z + player->mo->height - mo->height;
mo->threshold = 10; mo->threshold = 10;
P_SetTarget(&mo->target, player->mo); P_SetTarget(&mo->target, player->mo);
@ -3479,6 +3504,7 @@ void K_DoSneaker(player_t *player, INT32 type)
P_SetTarget(&overlay->target, cur); P_SetTarget(&overlay->target, cur);
P_SetTarget(&cur->tracer, overlay); P_SetTarget(&cur->tracer, overlay);
P_SetScale(overlay, (overlay->destscale = 3*cur->scale/4)); P_SetScale(overlay, (overlay->destscale = 3*cur->scale/4));
K_FlipFromObject(overlay, cur);
} }
cur = cur->hnext; cur = cur->hnext;
} }
@ -3489,6 +3515,7 @@ void K_DoSneaker(player_t *player, INT32 type)
mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BOOSTFLAME); mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BOOSTFLAME);
P_SetTarget(&overlay->target, player->mo); P_SetTarget(&overlay->target, player->mo);
P_SetScale(overlay, (overlay->destscale = player->mo->scale)); P_SetScale(overlay, (overlay->destscale = player->mo->scale));
K_FlipFromObject(overlay, player->mo);
} }
} }
@ -3593,7 +3620,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
thrust = 32<<FRACBITS; thrust = 32<<FRACBITS;
} }
mo->momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, vscale)); mo->momz = P_MobjFlip(mo)*FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, vscale));
} }
else else
mo->momz = FixedMul(vertispeed, vscale); mo->momz = FixedMul(vertispeed, vscale);
@ -4023,6 +4050,7 @@ static void K_MoveHeldObjects(player_t *player)
targx = targ->x + P_ReturnThrustX(cur, ang + ANGLE_180, dist); targx = targ->x + P_ReturnThrustX(cur, ang + ANGLE_180, dist);
targy = targ->y + P_ReturnThrustY(cur, ang + ANGLE_180, dist); targy = targ->y + P_ReturnThrustY(cur, ang + ANGLE_180, dist);
targz = targ->z; targz = targ->z;
speed = FixedMul(R_PointToDist2(cur->x, cur->y, targx, targy), 3*FRACUNIT/4); speed = FixedMul(R_PointToDist2(cur->x, cur->y, targx, targy), 3*FRACUNIT/4);
if (P_IsObjectOnGround(targ)) if (P_IsObjectOnGround(targ))
targz = cur->floorz; targz = cur->floorz;
@ -4113,8 +4141,11 @@ static void K_MoveHeldObjects(player_t *player)
{ // bobbing, copy pasted from my kimokawaiii entry { // bobbing, copy pasted from my kimokawaiii entry
const fixed_t pi = (22<<FRACBITS) / 7; // loose approximation, this doesn't need to be incredibly precise const fixed_t pi = (22<<FRACBITS) / 7; // loose approximation, this doesn't need to be incredibly precise
fixed_t sine = 8 * FINESINE((((2*pi*(4*TICRATE)) * leveltime)>>ANGLETOFINESHIFT) & FINEMASK); fixed_t sine = FixedMul(player->mo->scale, 8 * FINESINE((((2*pi*(4*TICRATE)) * leveltime)>>ANGLETOFINESHIFT) & FINEMASK));
targz = (player->mo->z + (player->mo->height/2)) + sine; targz = (player->mo->z + (player->mo->height/2)) + sine;
if (player->mo->eflags & MFE_VERTICALFLIP)
targz += (player->mo->height/2 - 32*player->mo->scale)*6;
} }
if (cur->tracer) if (cur->tracer)
@ -4131,7 +4162,7 @@ static void K_MoveHeldObjects(player_t *player)
} }
P_TeleportMove(cur, targx, targy, targz); P_TeleportMove(cur, targx, targy, targz);
K_FlipFromObject(cur, player->mo); // Update graviflip in real time thanks.
num = (num+1) % 2; num = (num+1) % 2;
cur = cur->hnext; cur = cur->hnext;
} }
@ -4676,8 +4707,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_comebacktimer]) if (player->kartstuff[k_comebacktimer])
player->kartstuff[k_comebackmode] = 0; player->kartstuff[k_comebackmode] = 0;
if (P_IsObjectOnGround(player->mo) && player->mo->momz <= 0 && player->kartstuff[k_pogospring]) if (P_IsObjectOnGround(player->mo) && player->kartstuff[k_pogospring])
{
if (P_MobjFlip(player->mo)*player->mo->momz <= 0)
player->kartstuff[k_pogospring] = 0; player->kartstuff[k_pogospring] = 0;
}
if (cmd->buttons & BT_DRIFT) if (cmd->buttons & BT_DRIFT)
player->kartstuff[k_jmp] = 1; player->kartstuff[k_jmp] = 1;
@ -5318,6 +5352,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
for (moloop = 0; moloop < 2; moloop++) for (moloop = 0; moloop < 2; moloop++)
{ {
mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_ROCKETSNEAKER); mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_ROCKETSNEAKER);
K_MatchGenericExtraFlags(mo, player->mo);
mo->flags |= MF_NOCLIPTHING; mo->flags |= MF_NOCLIPTHING;
mo->angle = player->mo->angle; mo->angle = player->mo->angle;
mo->threshold = 10; mo->threshold = 10;

View file

@ -23,6 +23,7 @@ void K_RegisterKartStuff(void);
boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerLosing(player_t *player);
boolean K_IsPlayerWanted(player_t *player); boolean K_IsPlayerWanted(player_t *player);
void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid);
void K_FlipFromObject(mobj_t *mo, mobj_t *master);
void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master); void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master);
void K_RespawnChecker(player_t *player); void K_RespawnChecker(player_t *player);
void K_KartMoveAnimation(player_t *player); void K_KartMoveAnimation(player_t *player);

View file

@ -8640,6 +8640,7 @@ void A_LightningFollowPlayer(mobj_t *actor)
else // else just teleport to player directly else // else just teleport to player directly
P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z); P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z);
K_MatchGenericExtraFlags(actor, actor->target); // copy our target for graviflip
actor->momx = actor->target->momx; actor->momx = actor->target->momx;
actor->momy = actor->target->momy; actor->momy = actor->target->momy;
actor->momz = actor->target->momz; // Give momentum since we don't teleport to our player literally every frame. actor->momz = actor->target->momz; // Give momentum since we don't teleport to our player literally every frame.

View file

@ -1477,6 +1477,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->starpostz = special->z>>FRACBITS; player->starpostz = special->z>>FRACBITS;
player->starpostangle = special->angle; player->starpostangle = special->angle;
player->starpostnum = special->health; player->starpostnum = special->health;
player->kartstuff[k_starpostflip] = special->spawnpoint->options & MTF_OBJECTFLIP; // store flipping
//S_StartSound(toucher, special->info->painsound); //S_StartSound(toucher, special->info->painsound);
return; return;

View file

@ -6524,7 +6524,7 @@ void P_MobjThinker(mobj_t *mobj)
case MT_SINK_SHIELD: case MT_SINK_SHIELD:
if ((mobj->health > 0 if ((mobj->health > 0
&& (!mobj->target || !mobj->target->player || mobj->target->player->health <= 0 || mobj->target->player->spectator)) && (!mobj->target || !mobj->target->player || mobj->target->player->health <= 0 || mobj->target->player->spectator))
|| (mobj->health <= 0 && mobj->z <= mobj->floorz) || (mobj->health <= 0 && P_IsObjectOnGround(mobj))
|| P_CheckDeathPitCollide(mobj)) // When in death state || P_CheckDeathPitCollide(mobj)) // When in death state
{ {
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
@ -6539,19 +6539,21 @@ void P_MobjThinker(mobj_t *mobj)
fixed_t z = P_RandomRange(0, 70)*mobj->scale; fixed_t z = P_RandomRange(0, 70)*mobj->scale;
mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_SMOKE); mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_SMOKE);
P_SetMobjState(smoke, S_OPAQUESMOKE1); P_SetMobjState(smoke, S_OPAQUESMOKE1);
K_MatchGenericExtraFlags(smoke, mobj);
smoke->scale = mobj->scale * 2; smoke->scale = mobj->scale * 2;
smoke->destscale = mobj->scale * 6; smoke->destscale = mobj->scale * 6;
smoke->momz = P_RandomRange(4, 9)*FRACUNIT; smoke->momz = P_RandomRange(4, 9)*FRACUNIT*P_MobjFlip(smoke);
} }
break; break;
case MT_BOOMPARTICLE: case MT_BOOMPARTICLE:
{ {
fixed_t x = P_RandomRange(-16, 16)*mobj->scale; fixed_t x = P_RandomRange(-16, 16)*mobj->scale;
fixed_t y = P_RandomRange(-16, 16)*mobj->scale; fixed_t y = P_RandomRange(-16, 16)*mobj->scale;
fixed_t z = P_RandomRange(0, 32)*mobj->scale; fixed_t z = P_RandomRange(0, 32)*mobj->scale*P_MobjFlip(mobj);
if (leveltime % 2 == 0) if (leveltime % 2 == 0)
{ {
mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_BOSSEXPLODE); mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_BOSSEXPLODE);
K_MatchGenericExtraFlags(smoke, mobj);
P_SetMobjState(smoke, S_QUICKBOOM1); P_SetMobjState(smoke, S_QUICKBOOM1);
smoke->scale = mobj->scale/2; smoke->scale = mobj->scale/2;
smoke->destscale = mobj->scale; smoke->destscale = mobj->scale;
@ -6561,6 +6563,7 @@ void P_MobjThinker(mobj_t *mobj)
{ {
mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_SMOKE); mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_SMOKE);
P_SetMobjState(smoke, S_OPAQUESMOKE1); P_SetMobjState(smoke, S_OPAQUESMOKE1);
K_MatchGenericExtraFlags(smoke, mobj);
smoke->scale = mobj->scale; smoke->scale = mobj->scale;
smoke->destscale = mobj->scale*2; smoke->destscale = mobj->scale*2;
} }
@ -6666,7 +6669,7 @@ void P_MobjThinker(mobj_t *mobj)
} }
else if ((mobj->health > 0 else if ((mobj->health > 0
&& (!mobj->target || !mobj->target->player || !mobj->target->player->mo || mobj->target->player->health <= 0 || mobj->target->player->spectator)) && (!mobj->target || !mobj->target->player || !mobj->target->player->mo || mobj->target->player->health <= 0 || mobj->target->player->spectator))
|| (mobj->health <= 0 && mobj->z <= mobj->floorz) || (mobj->health <= 0 && P_IsObjectOnGround(mobj))
|| P_CheckDeathPitCollide(mobj)) // When in death state || P_CheckDeathPitCollide(mobj)) // When in death state
{ {
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
@ -7114,6 +7117,9 @@ void P_MobjThinker(mobj_t *mobj)
y = mobj->target->y; y = mobj->target->y;
z = mobj->target->z + (80*mapobjectscale); z = mobj->target->z + (80*mapobjectscale);
} }
if (mobj->target->eflags & MFE_VERTICALFLIP)
z += mobj->target->height - FixedMul(mobj->target->scale, mobj->height);
P_TeleportMove(mobj, x, y, z); P_TeleportMove(mobj, x, y, z);
} }
break; break;
@ -7309,7 +7315,7 @@ void P_MobjThinker(mobj_t *mobj)
case MT_BANANA: case MT_BANANA:
case MT_EGGMANITEM: case MT_EGGMANITEM:
case MT_SPB: case MT_SPB:
if (mobj->z <= mobj->floorz) if (P_IsObjectOnGround(mobj))
{ {
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
return; return;
@ -7322,7 +7328,7 @@ void P_MobjThinker(mobj_t *mobj)
break; break;
case MT_JAWZ: case MT_JAWZ:
case MT_JAWZ_DUD: case MT_JAWZ_DUD:
if (mobj->z <= mobj->floorz) if (P_IsObjectOnGround(mobj))
P_SetMobjState(mobj, mobj->info->xdeathstate); P_SetMobjState(mobj, mobj->info->xdeathstate);
// fallthru // fallthru
case MT_JAWZ_SHIELD: case MT_JAWZ_SHIELD:
@ -7356,7 +7362,7 @@ void P_MobjThinker(mobj_t *mobj)
/* FALLTHRU */ /* FALLTHRU */
case MT_SMK_MOLE: case MT_SMK_MOLE:
mobj->flags2 ^= MF2_DONTDRAW; mobj->flags2 ^= MF2_DONTDRAW;
if (mobj->z <= mobj->floorz) if (P_IsObjectOnGround(mobj))
{ {
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
return; return;
@ -7377,7 +7383,7 @@ void P_MobjThinker(mobj_t *mobj)
} }
mobj->flags2 ^= MF2_DONTDRAW; mobj->flags2 ^= MF2_DONTDRAW;
if (mobj->z <= mobj->floorz) if (P_IsObjectOnGround(mobj))
{ {
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
return; return;
@ -8046,7 +8052,7 @@ void P_MobjThinker(mobj_t *mobj)
mobj->friction = ORIG_FRICTION/4; mobj->friction = ORIG_FRICTION/4;
if (mobj->momx || mobj->momy) if (mobj->momx || mobj->momy)
P_SpawnGhostMobj(mobj); P_SpawnGhostMobj(mobj);
if (mobj->z <= mobj->floorz && mobj->health > 1) if (P_IsObjectOnGround(mobj) && mobj->health > 1)
{ {
S_StartSound(mobj, mobj->info->activesound); S_StartSound(mobj, mobj->info->activesound);
mobj->momx = mobj->momy = 0; mobj->momx = mobj->momy = 0;
@ -8066,7 +8072,7 @@ void P_MobjThinker(mobj_t *mobj)
case MT_SINK: case MT_SINK:
if (mobj->momx || mobj->momy) if (mobj->momx || mobj->momy)
P_SpawnGhostMobj(mobj); P_SpawnGhostMobj(mobj);
if (mobj->z <= mobj->floorz) if (P_IsObjectOnGround(mobj))
{ {
S_StartSound(mobj, mobj->info->deathsound); S_StartSound(mobj, mobj->info->deathsound);
P_SetMobjState(mobj, S_NULL); P_SetMobjState(mobj, S_NULL);
@ -8242,6 +8248,7 @@ void P_MobjThinker(mobj_t *mobj)
break; break;
case MT_INSTASHIELDB: case MT_INSTASHIELDB:
mobj->flags2 ^= MF2_DONTDRAW; mobj->flags2 ^= MF2_DONTDRAW;
K_MatchGenericExtraFlags(mobj, mobj->target);
/* FALLTHRU */ /* FALLTHRU */
case MT_INSTASHIELDA: case MT_INSTASHIELDA:
if (!mobj->target || !mobj->target->health || (mobj->target->player && !mobj->target->player->kartstuff[k_instashield])) if (!mobj->target || !mobj->target->health || (mobj->target->player && !mobj->target->player->kartstuff[k_instashield]))
@ -8250,6 +8257,7 @@ void P_MobjThinker(mobj_t *mobj)
return; return;
} }
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
K_MatchGenericExtraFlags(mobj, mobj->target);
break; break;
case MT_BATTLEPOINT: case MT_BATTLEPOINT:
if (!mobj->target || P_MobjWasRemoved(mobj->target)) if (!mobj->target || P_MobjWasRemoved(mobj->target))
@ -8270,7 +8278,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->movefactor < mobj->target->height) if (mobj->movefactor < mobj->target->height)
mobj->movefactor = mobj->target->height; mobj->movefactor = mobj->target->height;
} }
K_MatchGenericExtraFlags(mobj, mobj->target);
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z + (mobj->target->height/2) + mobj->movefactor); P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z + (mobj->target->height/2) + mobj->movefactor);
break; break;
case MT_THUNDERSHIELD: case MT_THUNDERSHIELD:
@ -8395,6 +8403,10 @@ void P_MobjThinker(mobj_t *mobj)
mobj->flags2 &= ~MF2_DONTDRAW; mobj->flags2 &= ~MF2_DONTDRAW;
} }
// Update mobj antigravity status:
mobj->eflags = (mobj->eflags & ~MFE_VERTICALFLIP)|(mobj->target->eflags & MFE_VERTICALFLIP);
mobj->flags2 = (mobj->flags2 & ~MF2_OBJECTFLIP)|(mobj->target->flags2 & MF2_OBJECTFLIP);
// Now for the wheels // Now for the wheels
{ {
const fixed_t rad = FixedMul(mobjinfo[MT_PLAYER].radius, mobj->target->scale); const fixed_t rad = FixedMul(mobjinfo[MT_PLAYER].radius, mobj->target->scale);
@ -8416,6 +8428,7 @@ void P_MobjThinker(mobj_t *mobj)
P_SetScale(cur, mobj->target->scale); P_SetScale(cur, mobj->target->scale);
cur->color = mobj->target->color; cur->color = mobj->target->color;
cur->colorized = true; cur->colorized = true;
K_FlipFromObject(cur, mobj->target);
if (mobj->flags2 & MF2_DONTDRAW) if (mobj->flags2 & MF2_DONTDRAW)
cur->flags2 |= MF2_DONTDRAW; cur->flags2 |= MF2_DONTDRAW;
@ -11011,7 +11024,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
if (mthing->options >> ZSHIFT) if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS); z -= ((mthing->options >> ZSHIFT) << FRACBITS);
if (p->kartstuff[k_respawn]) if (p->kartstuff[k_respawn])
z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; z -= 128*mapobjectscale;
} }
else else
{ {
@ -11019,7 +11032,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
if (mthing->options >> ZSHIFT) if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS); z += ((mthing->options >> ZSHIFT) << FRACBITS);
if (p->kartstuff[k_respawn]) if (p->kartstuff[k_respawn])
z += 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; z += 128*mapobjectscale;
} }
if (mthing->options & MTF_OBJECTFLIP) // flip the player! if (mthing->options & MTF_OBJECTFLIP) // flip the player!
@ -11080,7 +11093,14 @@ void P_MovePlayerToStarpost(INT32 playernum)
#endif #endif
sector->ceilingheight; sector->ceilingheight;
z = (p->starpostz + 128) << FRACBITS; // Respawn off the ground if (mobj->player->kartstuff[k_starpostflip])
z = (p->starpostz<<FRACBITS) - FixedMul(128<<FRACBITS, mapobjectscale) - mobj->height;
else
z = (p->starpostz<<FRACBITS) + FixedMul(128<<FRACBITS, mapobjectscale);
//z = (p->starpostz + 128) << FRACBITS; // reverse gravity exists, pls
mobj->player->kartstuff[k_starpostflip] = 0;
if (z < floor) if (z < floor)
z = floor; z = floor;
else if (z > ceiling - mobjinfo[MT_PLAYER].height) else if (z > ceiling - mobjinfo[MT_PLAYER].height)

View file

@ -4247,13 +4247,14 @@ DoneSection2:
player->starpostx = player->mo->x>>FRACBITS; player->starpostx = player->mo->x>>FRACBITS;
player->starposty = player->mo->y>>FRACBITS; player->starposty = player->mo->y>>FRACBITS;
player->starpostz = player->mo->floorz>>FRACBITS; player->starpostz = player->mo->floorz>>FRACBITS;
player->kartstuff[k_starpostflip] = player->mo->flags2 & MF2_OBJECTFLIP; // store flipping
player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely... player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely...
} }
else else
{ {
// SRB2kart 200117 // SRB2kart 200117
// Reset starposts (checkpoints) info // Reset starposts (checkpoints) info
player->starpostangle = player->starpostx = player->starposty = player->starpostz = 0; player->starpostangle = player->starpostx = player->starposty = player->starpostz = player->kartstuff[k_starpostflip] = 0;
} }
if (P_IsLocalPlayer(player)) if (P_IsLocalPlayer(player))