diff --git a/src/animation.h b/src/animation.h index b950e17..a49e145 100644 --- a/src/animation.h +++ b/src/animation.h @@ -33,11 +33,6 @@ struct Animation { } void setModel(const TR::Model *model) { - if (this->model == model) - return; - - this->model = model; - anims = model ? &level->anims[model->animation] : NULL; time = 0; delta = 0; dir = 1.0f; @@ -46,6 +41,12 @@ struct Animation { next = 0; overrideMask = 0; + if (this->model == model) + return; + + this->model = model; + anims = model ? &level->anims[model->animation] : NULL; + if (overrides) { delete[] overrides; overrides = NULL; diff --git a/src/controller.h b/src/controller.h index ea52312..ba4191f 100644 --- a/src/controller.h +++ b/src/controller.h @@ -1204,7 +1204,7 @@ struct Controller { if (!lockMatrix) { matrix.identity(); matrix.translate(pos); - if (angle.y != 0.0f) matrix.rotateY(angle.y - animation.rot * animation.delta); + if (angle.y != 0.0f) matrix.rotateY(angle.y - (animation.anims != NULL ? (animation.rot * animation.delta) : 0.0f)); if (angle.x != 0.0f) matrix.rotateX(angle.x); if (angle.z != 0.0f) matrix.rotateZ(angle.z); }