mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Fix crash in set_anim_to_frame()
This commit is contained in:
parent
29d9615f7b
commit
15d657a7be
1 changed files with 5 additions and 2 deletions
|
@ -149,17 +149,20 @@ s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel)
|
||||||
* Sets the animation to a specific "next" frame from the frame given.
|
* Sets the animation to a specific "next" frame from the frame given.
|
||||||
*/
|
*/
|
||||||
void set_anim_to_frame(struct MarioState *m, s16 animFrame) {
|
void set_anim_to_frame(struct MarioState *m, s16 animFrame) {
|
||||||
|
if (m == NULL || m->marioObj == NULL) { return; }
|
||||||
|
|
||||||
struct AnimInfo *animInfo = &m->marioObj->header.gfx.animInfo;
|
struct AnimInfo *animInfo = &m->marioObj->header.gfx.animInfo;
|
||||||
struct Animation *curAnim = animInfo->curAnim;
|
struct Animation *curAnim = animInfo->curAnim;
|
||||||
|
if (animInfo == NULL) { return; }
|
||||||
|
|
||||||
if (animInfo->animAccel) {
|
if (animInfo->animAccel) {
|
||||||
if (curAnim->flags & ANIM_FLAG_FORWARD) {
|
if (curAnim != NULL && curAnim->flags & ANIM_FLAG_FORWARD) {
|
||||||
animInfo->animFrameAccelAssist = (animFrame << 0x10) + animInfo->animAccel;
|
animInfo->animFrameAccelAssist = (animFrame << 0x10) + animInfo->animAccel;
|
||||||
} else {
|
} else {
|
||||||
animInfo->animFrameAccelAssist = (animFrame << 0x10) - animInfo->animAccel;
|
animInfo->animFrameAccelAssist = (animFrame << 0x10) - animInfo->animAccel;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (curAnim->flags & ANIM_FLAG_FORWARD) {
|
if (curAnim != NULL && curAnim->flags & ANIM_FLAG_FORWARD) {
|
||||||
animInfo->animFrame = animFrame + 1;
|
animInfo->animFrame = animFrame + 1;
|
||||||
} else {
|
} else {
|
||||||
animInfo->animFrame = animFrame - 1;
|
animInfo->animFrame = animFrame - 1;
|
||||||
|
|
Loading…
Reference in a new issue