From 373dfc7da34a534ecbb6f9bf13ec0f381cc4342a Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 8 Apr 2017 20:06:52 +1000 Subject: [PATCH] Allow non-humanoid models to use humanoid animations --- ClassicalSharp/Entities/Components/AnimatedComponent.cs | 2 +- ClassicalSharp/Entities/Model/HumanoidModel.cs | 4 +++- ClassicalSharp/Entities/Model/IModel.cs | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ClassicalSharp/Entities/Components/AnimatedComponent.cs b/ClassicalSharp/Entities/Components/AnimatedComponent.cs index dbd8e9abf..b40a199a1 100644 --- a/ClassicalSharp/Entities/Components/AnimatedComponent.cs +++ b/ClassicalSharp/Entities/Components/AnimatedComponent.cs @@ -71,7 +71,7 @@ namespace ClassicalSharp.Entities { tiltY = (float)Math.Sin(walkTime) * swing * (0.15f * Utils.Deg2Rad); } - if (entity.Model is HumanoidModel) + if (entity.Model.CalcHumanAnims) CalcHumanAnim(idleXRot, idleZRot); } diff --git a/ClassicalSharp/Entities/Model/HumanoidModel.cs b/ClassicalSharp/Entities/Model/HumanoidModel.cs index 9e07aca96..3f2523e98 100644 --- a/ClassicalSharp/Entities/Model/HumanoidModel.cs +++ b/ClassicalSharp/Entities/Model/HumanoidModel.cs @@ -10,7 +10,9 @@ namespace ClassicalSharp.Model { public class HumanoidModel : IModel { public ModelSet Set, SetSlim, Set64; - public HumanoidModel(Game window) : base(window) { } + public HumanoidModel(Game window) : base(window) { + CalcHumanAnims = true; + } protected BoxDesc head, torso, lLeg, rLeg, lArm, rArm; protected float offset = 0.5f; diff --git a/ClassicalSharp/Entities/Model/IModel.cs b/ClassicalSharp/Entities/Model/IModel.cs index 7a54ed41e..27d11eb6a 100644 --- a/ClassicalSharp/Entities/Model/IModel.cs +++ b/ClassicalSharp/Entities/Model/IModel.cs @@ -30,6 +30,9 @@ namespace ClassicalSharp.Model { /// Whether this entity requires downloading of a skin texture. public bool UsesSkin = true; + /// Whether humanoid animations should be calculated, instead of normal animations. + public bool CalcHumanAnims; + /// Gravity applied to this entity. public virtual float Gravity { get { return 0.08f; } }