|
@@ -12,9 +12,10 @@
|
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 short **frame, unsigned int *frame_offset) {
|
|
15
|
+BoneTag::BoneTag(TombRaider &tr, unsigned int index, int j, unsigned int *l, unsigned int frame_offset) {
|
16
|
16
|
tr2_moveable_t *moveable = tr.Moveable();
|
17
|
17
|
tr2_meshtree_t *meshtree = tr.MeshTree();
|
|
18
|
+ unsigned short *frame = tr.Frame();
|
18
|
19
|
|
19
|
20
|
off[0] = 0.0;
|
20
|
21
|
off[1] = 0.0;
|
|
@@ -44,7 +45,7 @@ BoneTag::BoneTag(TombRaider &tr, unsigned int index, int j, unsigned int *l, uns
|
44
|
45
|
}
|
45
|
46
|
|
46
|
47
|
// Setup tag rotations
|
47
|
|
- tr.computeRotationAngles(frame, frame_offset, l, rot, rot+1, rot+2);
|
|
48
|
+ tr.computeRotationAngles(&frame, &frame_offset, l, rot, rot + 1, rot + 2);
|
48
|
49
|
}
|
49
|
50
|
|
50
|
51
|
void BoneTag::display() {
|
|
@@ -67,18 +68,14 @@ char BoneTag::getFlag() {
|
67
|
68
|
return flag;
|
68
|
69
|
}
|
69
|
70
|
|
70
|
|
-BoneFrame::BoneFrame(TombRaider &tr, unsigned int index, unsigned int i, unsigned short **frame, unsigned int *frame_offset) {
|
|
71
|
+BoneFrame::BoneFrame(TombRaider &tr, unsigned int index, unsigned int i, unsigned int frame_offset) {
|
71
|
72
|
tr2_moveable_t *moveable = tr.Moveable();
|
72
|
73
|
tr2_item_t *item = tr.Item();
|
|
74
|
+ unsigned short *frame = tr.Frame();
|
73
|
75
|
|
74
|
|
- /*!
|
75
|
|
- * \fixme Do we really need to keep frame and frame_offset
|
76
|
|
- * at the top level, passing pointers?!
|
77
|
|
- */
|
78
|
|
-
|
79
|
|
- pos[0] = (short)((*frame)[(*frame_offset) + 6]);
|
80
|
|
- pos[1] = (short)((*frame)[(*frame_offset) + 7]);
|
81
|
|
- pos[2] = (short)((*frame)[(*frame_offset) + 8]);
|
|
76
|
+ pos[0] = (short)(frame[frame_offset + 6]);
|
|
77
|
+ pos[1] = (short)(frame[frame_offset + 7]);
|
|
78
|
+ pos[2] = (short)(frame[frame_offset + 8]);
|
82
|
79
|
|
83
|
80
|
yaw = ((item[i].angle >> 14) & 0x03);
|
84
|
81
|
yaw *= 90;
|
|
@@ -87,7 +84,7 @@ BoneFrame::BoneFrame(TombRaider &tr, unsigned int index, unsigned int i, unsigne
|
87
|
84
|
|
88
|
85
|
// Run through the tag and calculate the rotation and offset
|
89
|
86
|
for (int j = 0; j < (int)moveable[index].num_meshes; ++j)
|
90
|
|
- tag.push_back(new BoneTag(tr, index, j, &l, frame, frame_offset));
|
|
87
|
+ tag.push_back(new BoneTag(tr, index, j, &l, frame_offset));
|
91
|
88
|
}
|
92
|
89
|
|
93
|
90
|
BoneFrame::~BoneFrame() {
|
|
@@ -113,7 +110,6 @@ void BoneFrame::getPosition(vec3_t p) {
|
113
|
110
|
AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, unsigned int i, int a) {
|
114
|
111
|
tr2_moveable_t *moveable = tr.Moveable();
|
115
|
112
|
tr2_animation_t *animation = tr.Animation();
|
116
|
|
- unsigned short *fr = tr.Frame();
|
117
|
113
|
|
118
|
114
|
unsigned int frame_offset = animation[a].frame_offset / 2;
|
119
|
115
|
int frame_step = animation[a].frame_size;
|
|
@@ -148,12 +144,12 @@ AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, unsigned int
|
148
|
144
|
}
|
149
|
145
|
|
150
|
146
|
if (frame_offset > tr.NumFrames()) {
|
151
|
|
- getConsole().print("WARNING: Bad animation frame %i > %i",
|
152
|
|
- frame_offset, tr.NumFrames());
|
|
147
|
+ getConsole().print("WARNING: Bad animation frame %i > %i (%u.%u.%d)",
|
|
148
|
+ frame_offset, tr.NumFrames(), index, i, a);
|
153
|
149
|
return;
|
154
|
150
|
}
|
155
|
151
|
|
156
|
|
- frame.push_back(new BoneFrame(tr, index, i, &fr, &frame_offset));
|
|
152
|
+ frame.push_back(new BoneFrame(tr, index, i, frame_offset));
|
157
|
153
|
}
|
158
|
154
|
}
|
159
|
155
|
|
|
@@ -273,11 +269,6 @@ void SkeletalModel::display(unsigned int aframe, unsigned int bframe) {
|
273
|
269
|
AnimationFrame &anim = get(aframe);
|
274
|
270
|
BoneFrame &boneframe = anim.get(bframe);
|
275
|
271
|
|
276
|
|
- if (boneframe.size() == 0) {
|
277
|
|
- printf("Empty bone frame?!?!\n");
|
278
|
|
- return;
|
279
|
|
- }
|
280
|
|
-
|
281
|
272
|
vec3_t pos;
|
282
|
273
|
boneframe.getPosition(pos);
|
283
|
274
|
glTranslatef(pos[0], pos[1], pos[2]);
|