Fix 'classic arms model' not saving, and not updating translation matrix when changed in-game.

This commit is contained in:
UnknownShadow200 2017-08-20 08:45:46 +10:00
parent b4a658d170
commit 62cd4d94b0
2 changed files with 12 additions and 1 deletions

View File

@ -30,7 +30,7 @@ namespace ClassicalSharp.Gui.Screens {
protected override void ContextRecreated() {
widgets = new Widget[] {
// Column 1
MakeBool(-1, -150, "Classic arm model", OptionsKey.SimpleArmsAnim,
MakeBool(-1, -150, "Classic arm model", OptionsKey.ClassicArmModel,
OnWidgetClick, g => g.ClassicArmModel, (g, v) => g.ClassicArmModel = v),
MakeBool(-1, -100, "Classic arms anim", OptionsKey.SimpleArmsAnim, true,
OnWidgetClick, g => !g.SimpleArmsAnim, (g, v) => g.SimpleArmsAnim = !v),

View File

@ -112,9 +112,15 @@ namespace ClassicalSharp.Model {
public class ArmModel : HumanoidModel {
Matrix4 m;
bool classicArms;
public ArmModel(Game window) : base(window) { }
public override void CreateParts() {
classicArms = game.ClassicArmModel;
SetTranslationMatrix();
}
void SetTranslationMatrix() {
if (game.ClassicArmModel) {
// TODO: Position's not quite right.
// Matrix4.Translate(out m, -6 / 16f + 0.2f, -12 / 16f - 0.20f, 0);
@ -133,6 +139,11 @@ namespace ClassicalSharp.Model {
protected override void RenderParts(Entity p) {
HumanoidModel human = (HumanoidModel)game.ModelCache.Models[0].Instance;
vertices = human.vertices;
// If user changes option while game is running
if (classicArms != game.ClassicArmModel) {
classicArms = game.ClassicArmModel;
SetTranslationMatrix();
}
SkinType skinType = p.SkinType;
ModelSet model = skinType == SkinType.Type64x64Slim ? human.SetSlim :