|
@@ -12,7 +12,7 @@
|
12
|
12
|
#include "SkeletalModel.h"
|
13
|
13
|
#include "World.h"
|
14
|
14
|
|
15
|
|
-BoneTag::BoneTag(TombRaider &tr, unsigned int index, int j, unsigned int *l, unsigned int frame_offset) {
|
|
15
|
+BoneTag::BoneTag(TombRaider &tr, unsigned int index, unsigned int i, unsigned int *l, unsigned int frame_offset) {
|
16
|
16
|
tr2_moveable_t *moveable = tr.Moveable();
|
17
|
17
|
tr2_meshtree_t *meshtree = tr.MeshTree();
|
18
|
18
|
unsigned short *frame = tr.Frame();
|
|
@@ -24,10 +24,10 @@ BoneTag::BoneTag(TombRaider &tr, unsigned int index, int j, unsigned int *l, uns
|
24
|
24
|
rot[0] = 0.0;
|
25
|
25
|
rot[1] = 0.0;
|
26
|
26
|
rot[2] = 0.0;
|
27
|
|
- mesh = moveable[index].starting_mesh + j;
|
|
27
|
+ mesh = moveable[index].starting_mesh + i;
|
28
|
28
|
|
29
|
29
|
// Setup offsets to produce skeleton
|
30
|
|
- if (j == 0) {
|
|
30
|
+ if (i == 0) {
|
31
|
31
|
// Always push tag[0], this isn't really used either
|
32
|
32
|
flag = 0x02;
|
33
|
33
|
} else { // Nonprimary tag - position relative to first tag
|
|
@@ -36,7 +36,7 @@ BoneTag::BoneTag(TombRaider &tr, unsigned int index, int j, unsigned int *l, uns
|
36
|
36
|
// into mesh_tree[], so we have to convert to index
|
37
|
37
|
int *tree = (int *)(void *)meshtree;
|
38
|
38
|
tr2_meshtree_t *mesh_tree = (tr2_meshtree_t *)(tree
|
39
|
|
- + moveable[index].mesh_tree + ((j - 1) * 4));
|
|
39
|
+ + moveable[index].mesh_tree + ((i - 1) * 4));
|
40
|
40
|
|
41
|
41
|
off[0] = mesh_tree->x;
|
42
|
42
|
off[1] = mesh_tree->y;
|
|
@@ -68,23 +68,18 @@ char BoneTag::getFlag() {
|
68
|
68
|
return flag;
|
69
|
69
|
}
|
70
|
70
|
|
71
|
|
-BoneFrame::BoneFrame(TombRaider &tr, unsigned int index, unsigned int i, unsigned int frame_offset) {
|
|
71
|
+BoneFrame::BoneFrame(TombRaider &tr, unsigned int index, unsigned int frame_offset) {
|
72
|
72
|
tr2_moveable_t *moveable = tr.Moveable();
|
73
|
|
- tr2_item_t *item = tr.Item();
|
74
|
73
|
unsigned short *frame = tr.Frame();
|
75
|
74
|
|
76
|
|
- pos[0] = (short)(frame[frame_offset + 6]);
|
77
|
|
- pos[1] = (short)(frame[frame_offset + 7]);
|
78
|
|
- pos[2] = (short)(frame[frame_offset + 8]);
|
79
|
|
-
|
80
|
|
- yaw = ((item[i].angle >> 14) & 0x03);
|
81
|
|
- yaw *= 90;
|
|
75
|
+ pos[0] = (short)frame[frame_offset + 6];
|
|
76
|
+ pos[1] = (short)frame[frame_offset + 7];
|
|
77
|
+ pos[2] = (short)frame[frame_offset + 8];
|
82
|
78
|
|
83
|
79
|
unsigned int l = 9; // First angle offset in this Frame
|
84
|
80
|
|
85
|
|
- // Run through the tag and calculate the rotation and offset
|
86
|
|
- for (int j = 0; j < (int)moveable[index].num_meshes; ++j)
|
87
|
|
- tag.push_back(new BoneTag(tr, index, j, &l, frame_offset));
|
|
81
|
+ for (unsigned int i = 0; i < moveable[index].num_meshes; i++)
|
|
82
|
+ tag.push_back(new BoneTag(tr, index, i, &l, frame_offset));
|
88
|
83
|
}
|
89
|
84
|
|
90
|
85
|
BoneFrame::~BoneFrame() {
|
|
@@ -107,7 +102,7 @@ void BoneFrame::getPosition(vec3_t p) {
|
107
|
102
|
p[2] = pos[2];
|
108
|
103
|
}
|
109
|
104
|
|
110
|
|
-AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, unsigned int i, int a) {
|
|
105
|
+AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, int a) {
|
111
|
106
|
tr2_moveable_t *moveable = tr.Moveable();
|
112
|
107
|
tr2_animation_t *animation = tr.Animation();
|
113
|
108
|
|
|
@@ -144,12 +139,12 @@ AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, unsigned int
|
144
|
139
|
}
|
145
|
140
|
|
146
|
141
|
if (frame_offset > tr.NumFrames()) {
|
147
|
|
- getConsole().print("WARNING: Bad animation frame %i > %i (%u.%u.%d)",
|
148
|
|
- frame_offset, tr.NumFrames(), index, i, a);
|
|
142
|
+ getConsole().print("WARNING: Bad animation frame %i > %i (%u.%d)",
|
|
143
|
+ frame_offset, tr.NumFrames(), index, a);
|
149
|
144
|
return;
|
150
|
145
|
}
|
151
|
146
|
|
152
|
|
- frame.push_back(new BoneFrame(tr, index, i, frame_offset));
|
|
147
|
+ frame.push_back(new BoneFrame(tr, index, frame_offset));
|
153
|
148
|
}
|
154
|
149
|
}
|
155
|
150
|
|
|
@@ -167,7 +162,7 @@ BoneFrame &AnimationFrame::get(unsigned int i) {
|
167
|
162
|
return *frame.at(i);
|
168
|
163
|
}
|
169
|
164
|
|
170
|
|
-SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, unsigned int i, int objectId) {
|
|
165
|
+SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
|
171
|
166
|
tr2_moveable_t *moveable = tr.Moveable();
|
172
|
167
|
tr2_animation_t *anim = tr.Animation();
|
173
|
168
|
tr2_mesh_t *mesh = tr.Mesh();
|
|
@@ -252,7 +247,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, unsigned int i,
|
252
|
247
|
return;
|
253
|
248
|
} else {
|
254
|
249
|
for (; a < tr.getNumAnimsForMoveable(index); a++) {
|
255
|
|
- animation.push_back(new AnimationFrame(tr, index, i, a));
|
|
250
|
+ animation.push_back(new AnimationFrame(tr, index, a));
|
256
|
251
|
}
|
257
|
252
|
}
|
258
|
253
|
}
|