The "free" changes from framezero - the crash fixes that have no complexity and therefore no negative consequence to introduce

This commit is contained in:
toaster 2022-01-20 19:27:02 +00:00
parent 334d25d3ab
commit 93dfbf382c
3 changed files with 17 additions and 5 deletions

View file

@ -3811,7 +3811,7 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
y = source->y + source->momy + FixedMul(finalspeed, FINESINE(an>>ANGLETOFINESHIFT)); y = source->y + source->momy + FixedMul(finalspeed, FINESINE(an>>ANGLETOFINESHIFT));
z = source->z; // spawn on the ground please z = source->z; // spawn on the ground please
th = P_SpawnMobj(x, y, z, type); th = P_SpawnMobj(x, y, z, type); // this will never return null because collision isn't processed here
K_FlipFromObject(th, source); K_FlipFromObject(th, source);
@ -3830,7 +3830,10 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
{ {
// floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn // floorz and ceilingz aren't properly set to account for FOFs and Polyobjects on spawn
// This should set it for FOFs // This should set it for FOFs
P_SetOrigin(th, th->x, th->y, th->z); P_SetOrigin(th, th->x, th->y, th->z); // however, THIS can fuck up your day. just absolutely ruin you.
if (P_MobjWasRemoved(th))
return NULL;
// spawn on the ground if the player is on the ground // spawn on the ground if the player is on the ground
if (P_MobjFlip(source) < 0) if (P_MobjFlip(source) < 0)
{ {
@ -3898,7 +3901,7 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, I
P_SetTarget(&throwmo->target, source); P_SetTarget(&throwmo->target, source);
} }
return NULL; return th;
} }
UINT16 K_DriftSparkColor(player_t *player, INT32 charge) UINT16 K_DriftSparkColor(player_t *player, INT32 charge)
@ -4705,10 +4708,11 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing,
{ {
if (mapthing == MT_BALLHOG) // Messy if (mapthing == MT_BALLHOG) // Messy
{ {
mo = NULL; // can't return multiple projectiles
if (dir == -1) if (dir == -1)
{ {
// Shoot backward // Shoot backward
mo = K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x06000000, 0, PROJSPEED/8); K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x06000000, 0, PROJSPEED/8);
K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x03000000, 0, PROJSPEED/8); K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) - 0x03000000, 0, PROJSPEED/8);
K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + ANGLE_180, 0, PROJSPEED/8); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + ANGLE_180, 0, PROJSPEED/8);
K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) + 0x03000000, 0, PROJSPEED/8); K_SpawnKartMissile(player->mo, mapthing, (player->mo->angle + ANGLE_180) + 0x03000000, 0, PROJSPEED/8);
@ -4717,7 +4721,7 @@ mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t mapthing,
else else
{ {
// Shoot forward // Shoot forward
mo = K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x06000000, 0, PROJSPEED); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x06000000, 0, PROJSPEED);
K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x03000000, 0, PROJSPEED); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle - 0x03000000, 0, PROJSPEED);
K_SpawnKartMissile(player->mo, mapthing, player->mo->angle, 0, PROJSPEED); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle, 0, PROJSPEED);
K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + 0x03000000, 0, PROJSPEED); K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + 0x03000000, 0, PROJSPEED);
@ -5329,6 +5333,9 @@ void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source)
mobj_t *cachenext; mobj_t *cachenext;
killnext: killnext:
if (P_MobjWasRemoved(banana))
return;
cachenext = banana->hnext; cachenext = banana->hnext;
if (banana->health) if (banana->health)

View file

@ -3496,6 +3496,9 @@ void P_SlideMove(mobj_t *mo)
vertex_t v1, v2; // fake vertexes vertex_t v1, v2; // fake vertexes
line_t junk; // fake linedef line_t junk; // fake linedef
if (P_MobjWasRemoved(mo))
return;
if (tmhitthing && mo->z + mo->height > tmhitthing->z && mo->z < tmhitthing->z + tmhitthing->height) if (tmhitthing && mo->z + mo->height > tmhitthing->z && mo->z < tmhitthing->z + tmhitthing->height)
{ {
// Don't mess with your momentum if it's a pushable object. Pushables do their own crazy things already. // Don't mess with your momentum if it's a pushable object. Pushables do their own crazy things already.

View file

@ -1689,6 +1689,8 @@ void P_XYMovement(mobj_t *mo)
if (mo->flags & MF_SLIDEME) if (mo->flags & MF_SLIDEME)
{ {
P_SlideMove(mo); P_SlideMove(mo);
if (P_MobjWasRemoved(mo))
return;
xmove = ymove = 0; xmove = ymove = 0;
} }
else else