mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Fix more possible crashes
This commit is contained in:
parent
cc1ec3e81f
commit
3478db9655
3 changed files with 11 additions and 9 deletions
|
@ -96,7 +96,7 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
if (m->action != ACT_TWIRLING && m->floor->type != SURFACE_BURNING) {
|
if (m->action != ACT_TWIRLING && m->floor && m->floor->type != SURFACE_BURNING) {
|
||||||
if (m->vel[1] < -55.0f) {
|
if (m->vel[1] < -55.0f) {
|
||||||
if (fallHeight > 3000.0f) {
|
if (fallHeight > 3000.0f) {
|
||||||
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24;
|
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24;
|
||||||
|
|
|
@ -120,7 +120,9 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) {
|
||||||
m->quicksandDepth = 1.1f;
|
m->quicksandDepth = 1.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (m->floor->type) {
|
u32 floorType = m->floor ? m->floor->type : SURFACE_DEFAULT;
|
||||||
|
|
||||||
|
switch (floorType) {
|
||||||
case SURFACE_SHALLOW_QUICKSAND:
|
case SURFACE_SHALLOW_QUICKSAND:
|
||||||
if ((m->quicksandDepth += sinkingSpeed) >= 10.0f) {
|
if ((m->quicksandDepth += sinkingSpeed) >= 10.0f) {
|
||||||
m->quicksandDepth = 10.0f;
|
m->quicksandDepth = 10.0f;
|
||||||
|
@ -355,11 +357,11 @@ s32 perform_ground_step(struct MarioState *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
Vec3f step = {
|
Vec3f step = { 0 };
|
||||||
m->floor->normal.y * (m->vel[0] / 4.0f),
|
if (m->floor) {
|
||||||
0,
|
step[0] = m->floor->normal.y * (m->vel[0] / 4.0f);
|
||||||
m->floor->normal.y * (m->vel[2] / 4.0f),
|
step[2] = m->floor->normal.y * (m->vel[2] / 4.0f);
|
||||||
};
|
}
|
||||||
|
|
||||||
intendedPos[0] = m->pos[0] + step[0];
|
intendedPos[0] = m->pos[0] + step[0];
|
||||||
intendedPos[1] = m->pos[1];
|
intendedPos[1] = m->pos[1];
|
||||||
|
@ -678,7 +680,7 @@ void apply_vertical_wind(struct MarioState *m) {
|
||||||
if (m->action != ACT_GROUND_POUND) {
|
if (m->action != ACT_GROUND_POUND) {
|
||||||
offsetY = m->pos[1] - -1500.0f;
|
offsetY = m->pos[1] - -1500.0f;
|
||||||
|
|
||||||
if (m->floor->type == SURFACE_VERTICAL_WIND && -3000.0f < offsetY && offsetY < 2000.0f) {
|
if (m->floor && m->floor->type == SURFACE_VERTICAL_WIND && -3000.0f < offsetY && offsetY < 2000.0f) {
|
||||||
if (offsetY >= 0.0f) {
|
if (offsetY >= 0.0f) {
|
||||||
maxVelY = 10000.0f / (offsetY + 200.0f);
|
maxVelY = 10000.0f / (offsetY + 200.0f);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -106,7 +106,7 @@ static void update_rumble_pak(void) {
|
||||||
|
|
||||||
if (gCurrRumbleSettings.unk0A >= 5) {
|
if (gCurrRumbleSettings.unk0A >= 5) {
|
||||||
start_rumble();
|
start_rumble();
|
||||||
} else if ((gCurrRumbleSettings.unk0A >= 2) && (gNumVblanks % gCurrRumbleSettings.unk0C == 0)) {
|
} else if ((gCurrRumbleSettings.unk0A >= 2) && gCurrRumbleSettings.unk0C && (gNumVblanks % gCurrRumbleSettings.unk0C == 0)) {
|
||||||
start_rumble();
|
start_rumble();
|
||||||
} else {
|
} else {
|
||||||
stop_rumble();
|
stop_rumble();
|
||||||
|
|
Loading…
Reference in a new issue