summaryrefslogtreecommitdiff
path: root/NW4RTools/Models/Animation/CharacterAnim.cs
blob: 2fab9f9d4968848da22387d96c2de528bd2fc156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;

namespace NW4RTools.Models.Animation {
	public class CharacterAnim {
		[FlagsAttribute]
		public enum Flags : uint {
			AlwaysSet = 1,
			Identity = 2,
			RtZero = 4,
			ScaleOne = 8,
			ScaleUniform = 0x10,
			RotateZero = 0x20,
			TranslateZero = 0x40,
			ScaleUseModel = 0x80,
			RotateUseModel = 0x100,
			TranslateUseModel = 0x200,
			ScaleCompensateApply = 0x400,
			ScaleCompensateParent = 0x800,
			ClassicScaleOff = 0x1000,
			ScaleXConstant = 0x2000,
			ScaleYConstant = 0x4000,
			ScaleZConstant = 0x8000,
			RotateXConstant = 0x10000,
			RotateYConstant = 0x20000,
			RotateZConstant = 0x40000,
			TranslateXConstant = 0x80000,
			TranslateYConstant = 0x100000,
			TranslateZConstant = 0x200000,
			CalcScale = 0x400000,
			CalcRotate = 0x800000,
			CalcTranslate = 0x1000000,
			ScaleFormatMask = 0x6000000,
			RotateFormatMask = 0x38000000,
			TranslateFormatMask = 0xC0000000,

			ScaleXNotExist = Identity | ScaleOne | ScaleUseModel,
			ScaleYNotExist = Identity | ScaleOne | ScaleUniform | ScaleUseModel,
			ScaleZNotExist = Identity | ScaleOne | ScaleUniform | ScaleUseModel,
			RotateXNotExist = Identity | RtZero | RotateZero | RotateUseModel,
			RotateYNotExist = Identity | RtZero | RotateZero | RotateUseModel,
			RotateZNotExist = Identity | RtZero | RotateZero | RotateUseModel,
			TranslateXNotExist = Identity | RtZero | TranslateZero | TranslateUseModel,
			TranslateYNotExist = Identity | RtZero | TranslateZero | TranslateUseModel,
			TranslateZNotExist = Identity | RtZero | TranslateZero | TranslateUseModel,

			NonComputableFlags = ScaleCompensateApply | ScaleCompensateParent | ClassicScaleOff,
		}

		public enum STFormatType {
			Constant = 0,
			Data32 = 1,
			Data48 = 2,
			Data96 = 3,
		}

		public enum RotateFormatType {
			Constant = 0,
			Data32 = 1,
			Data48 = 2,
			Data96 = 3,
			DataFrm8 = 4,
			DataFrm16 = 5,
			DataFrm32 = 6,
			Zero = 7,
		}

		public Model.ScaleModeType ScaleMode;
		public bool Loop;

		public UInt16 FrameCount;

		public ResDict<Node> Nodes;

		public class Node {
			public CharacterAnim.Flags Flags;

			public KeyframeAnim ScaleX, ScaleY, ScaleZ;
			public KeyframeAnim RotateX, RotateY, RotateZ;
			public KeyframeAnim TranslateX, TranslateY, TranslateZ;

			public STFormatType ScaleFormat;
			public STFormatType TranslateFormat;
			public RotateFormatType RotateFormat;

			public bool ScaleUseModel, RotateUseModel, TranslateUseModel;
		}

		public CharacterAnim() {
		}
	}
}