mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Fixed crash in act_dile()
This commit is contained in:
parent
c7edf85ad9
commit
9b23b7dab4
1 changed files with 3 additions and 2 deletions
|
@ -129,7 +129,7 @@ s32 act_idle(struct MarioState *m) {
|
||||||
|
|
||||||
extern bool gDjuiInMainMenu;
|
extern bool gDjuiInMainMenu;
|
||||||
if (m->actionState == 3) {
|
if (m->actionState == 3) {
|
||||||
if ((m->area->terrainType & TERRAIN_MASK) == TERRAIN_SNOW) {
|
if (m->area && ((m->area->terrainType & TERRAIN_MASK) == TERRAIN_SNOW)) {
|
||||||
return set_mario_action(m, ACT_SHIVERING, 0);
|
return set_mario_action(m, ACT_SHIVERING, 0);
|
||||||
} else {
|
} else {
|
||||||
if (!gDjuiInMainMenu) {
|
if (!gDjuiInMainMenu) {
|
||||||
|
@ -168,7 +168,7 @@ s32 act_idle(struct MarioState *m) {
|
||||||
// actionTimer is used to track how many cycles have passed.
|
// actionTimer is used to track how many cycles have passed.
|
||||||
if (++m->actionState == 3) {
|
if (++m->actionState == 3) {
|
||||||
f32 deltaYOfFloorBehindMario = m->pos[1] - find_floor_height_relative_polar(m, -0x8000, 60.0f);
|
f32 deltaYOfFloorBehindMario = m->pos[1] - find_floor_height_relative_polar(m, -0x8000, 60.0f);
|
||||||
if (deltaYOfFloorBehindMario < -24.0f || 24.0f < deltaYOfFloorBehindMario || m->floor->flags & SURFACE_FLAG_DYNAMIC) {
|
if (deltaYOfFloorBehindMario < -24.0f || 24.0f < deltaYOfFloorBehindMario || (m->floor && (m->floor->flags & SURFACE_FLAG_DYNAMIC)) {
|
||||||
m->actionState = 0;
|
m->actionState = 0;
|
||||||
} else {
|
} else {
|
||||||
// If Mario hasn't turned his head 10 times yet, stay idle instead of going to sleep.
|
// If Mario hasn't turned his head 10 times yet, stay idle instead of going to sleep.
|
||||||
|
@ -188,6 +188,7 @@ s32 act_idle(struct MarioState *m) {
|
||||||
|
|
||||||
void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound) {
|
void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound) {
|
||||||
if (!m) { return; }
|
if (!m) { return; }
|
||||||
|
if (!m->marioObj) { return; }
|
||||||
if (m->actionState == actionState && m->marioObj->header.gfx.animInfo.animFrame == animFrame) {
|
if (m->actionState == actionState && m->marioObj->header.gfx.animInfo.animFrame == animFrame) {
|
||||||
play_sound(sound, m->marioObj->header.gfx.cameraToObject);
|
play_sound(sound, m->marioObj->header.gfx.cameraToObject);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue