-
Notifications
You must be signed in to change notification settings - Fork 0
/
EMD1.h
142 lines (112 loc) · 2.56 KB
/
EMD1.h
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*===========================================*
* Resident Evil 1 EMD *
*-------------------------------------------*
* Load EMD binary data *
*===========================================*
*/
#ifndef EMD_1_H
#define EMD_1_H
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
struct EMD1_DIRECTORY {
unsigned int section0;
unsigned int section1;
unsigned int section2;
unsigned int section3;
};
struct EMD1_SKEL_RELPOS {
short x;
short y;
short z;
};
struct EMD1_SKEL_HEADER {
unsigned short relPosOffset;
unsigned short length;
unsigned short count;
unsigned short size;
};
struct EMD1_SKEL_ARMATURE {
unsigned short meshCount;
unsigned short offset;
};
struct EMD1_SKEL_ANIM {
short xOffset;
short yOffset;
short zOffset;
short xSpeed;
short ySpeed;
short zSpeed;
short angles[45];
short unknown;
};
struct EMD1_ANIM_HEADER {
unsigned short count;
unsigned short offset;
};
struct EMD1_MODEL_HEADER {
unsigned int length;
unsigned int unknown;
unsigned int objCount;
};
struct EMD1_MODEL_TRIANGLES {
unsigned int vertexOffset;
unsigned int vertexCount;
unsigned int normalOffset;
unsigned int normalCount;
unsigned int triOffset;
unsigned int triCount;
unsigned int dummy;
};
struct EMD1_VERTEX {
signed short x;
signed short y;
signed short z;
signed short zero;
};
struct EMD1_NORMAL {
signed short x;
signed short y;
signed short z;
signed short zero;
};
struct EMD1_TRIANGLE {
unsigned int unknown;
unsigned char tu0;
unsigned char tv0;
unsigned short clutid;
unsigned char tu1;
unsigned char tv1;
unsigned short page;
unsigned char tu2;
unsigned char tv2;
unsigned short dummy;
unsigned short n0;
unsigned short v0;
unsigned short n1;
unsigned short v1;
unsigned short n2;
unsigned short v2;
};
class EMD1 {
public:
EMD1();
~EMD1();
void loadFile(std::string fileName);
EMD1_DIRECTORY directory;
EMD1_SKEL_HEADER skeletonHeader;
EMD1_MODEL_HEADER modelHeader;
std::vector<EMD1_ANIM_HEADER> animStepHeader;
std::vector<EMD1_SKEL_RELPOS> relPos;
std::vector<EMD1_SKEL_ARMATURE> armature;
std::vector<EMD1_MODEL_TRIANGLES> modelTriangles;
std::vector<EMD1_SKEL_ANIM> skelAnimList;
unsigned int emdSec1AnimSkelT[100][500];
unsigned char ** meshList;
EMD1_NORMAL** normalList;
EMD1_VERTEX** vertexList;
EMD1_TRIANGLE** triangleList;
};
#endif