-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameStruct.h
317 lines (249 loc) · 6.57 KB
/
gameStruct.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/***************************************************************************
** gameStruct é utilizada para todas as estruturas/classes relacionadas **
** ao Player, Inimigos, Objetos(?) e por aí vai **
** Criado por Lucas P. Stark **
** Nightmare Fiction Engine - NFE **
***************************************************************************/
#ifndef GAME_STRUCT_H
#define GAME_STRUCT_H
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include "EMD.h"
/*
* EMD Animation Section
*/
enum EMD_SECTION_LIST {
EMD_SECTION_2 = 0,
EMD_SECTION_4 = 1
};
/*
* Player EMD Animation
* emdSec2 Standard Data
* emdSec4 Standard Data
*/
enum STANDARD_SEC2_ANIMATION {
STAND_SEC2_ANIM_BACKWARD = 0,
STAND_SEC2_ANIM_SBACKWARD = 1,
STAND_SEC2_ANIM_DEATH = 2,
STAND_SEC2_ANIM_HIT = 3,
STAND_SEC2_ANIM_BACK_HIT = 4,
STAND_SEC2_ANIM_HIT_2 = 5,
STAND_SEC2_ANIM_GET_ITEM = 6,
STAND_SEC2_ANIM_PUSH = 7,
STAND_SEC2_ANIM_PUSHING = 8,
STAND_SEC2_ANIM_INJU_WALK = 9
};
enum STANDARD_SEC4_ANIMATION {
STAND_SEC4_ANIM_WALK = 0,
STAND_SEC4_ANIM_RUNNING = 1,
STAND_SEC4_ANIM_IDLE = 2,
STAND_SEC4_ANIM_INJU_WALK = 3,
STAND_SEC4_ANIM_INJU_RUNN = 4,
STAND_SEC4_ANIM_INJU_IDLE = 5,
STAND_SEC4_ANIM_TINJ_WALK = 6,
STAND_SEC4_ANIM_TINJ_RUNN = 7,
STAND_SEC4_ANIM_TINJ_IDLE = 8,
STAND_SEC4_ANIM_S_SHOOT = 9,
STAND_SEC4_ANIM_SHOOTING = 10,
STAND_SEC4_ANIM_AIM = 11,
STAND_SEC4_ANIM_USHOOTING = 12,
STAND_SEC4_ANIM_UAIM = 13,
STAND_SEC4_ANIM_DSHOOTING = 14,
STAND_SEC4_ANIM_DAIM = 15,
STAND_SEC4_ANIM_AMMO = 16
};
/*
* Special EMD Animation
* emdSec2Data
* emdSec4Data
*/
enum SPECIAL_SEC2_ANIMATION {
SPECIAL_SEC2_ANIM_START = 0,
SPECIAL_SEC2_ANIM_POSE = 1,
SPECIAL_SEC2_ANIM_CHOICE = 2
};
enum SPECIAL_SEC4_ANIMATION {
SPECIAL_SEC4_ANIM_BHIT = 0,
SPECIAL_SEC4_ANIM_UP_SHAKE = 1,
SPECIAL_SEC4_ANIM_BHIT_2 = 2,
SPECIAL_SEC4_ANIM_BHIT_3 = 3,
SPECIAL_SEC4_ANIM_EXAUSTED = 4,
SPECIAL_SEC4_ANIM_FALL = 5,
SPECIAL_SEC4_ANIM_RISE = 6,
SPECIAL_SEC4_ANIM_DOWNFALL = 7
};
/*
* Player Stuff
*/
enum PLAYER_STATE {
PLAYER_STATE_NORMAL = 0,
PLAYER_STATE_BEGIN_HIT = 1,
PLAYER_STATE_HIT = 2,
PLAYER_STATE_BEGIN_GUN = 3,
PLAYER_STATE_GUN = 4,
PLAYER_STATE_BEGIN_DEATH = 5,
PLAYER_STATE_DEATH = 6,
PLAYER_STATE_END = 7
};
enum PLAYER_ACTION {
PLAYER_ACTION_R_NONE = 0,
PLAYER_ACTION_R_LEFT = 1,
PLAYER_ACTION_R_RIGHT = 2
};
enum ENGINE_MENU_STATE {
STATE_MAIN_MENU = 1,
STATE_CREDITS = 2,
STATE_SEL_CHAR = 3,
STATE_IN_GAME = 4,
STATE_IN_ROOM = 5,
STATE_IN_DEBUG = 6
};
enum MAIN_MENU_SUB_MENU {
MAIN_MENU_LOGO = 0,
MAIN_MENU_ENGINE_LOGO = 1,
MAIN_MENU_START = 2,
MAIN_MENU_GAME = 3
};
enum SEL_PLAYER_SUB_MENU {
SEL_PLAYER_BEGIN = 0,
SEL_PLAYER_START = 1
};
enum MENU_CREDITS {
MENU_CREDITS_BEGIN = 0,
MENU_CREDITS_END = 1
};
// InGame sub-menus/status
#define IN_GAME_BEGIN 0x0
#define IN_GAME_NORMAL 0x1
// Text Type
#define TEXT_TYPE_NORMAL 0x0
#define TEXT_TYPE_LITTLE 0x1
// Animation Stuff
#define ANIM_TYPE_WALK 0x0
#define ANIM_TYPE_RUNNING 0x1
#define ANIM_TYPE_STOPPED 0x2
class entity {
public:
entity();
~entity();
void setModel(unsigned int modelNum);
void setTmrAnim(unsigned int tmrAnim);
void setState(unsigned int state);
void setHitPoints(unsigned int hitPoints);
void setAnimSection(unsigned int animSection);
void setAnimType(unsigned int animType, bool animRepeat = true);
void setAnimCount(unsigned int animCount);
void setAnimFrame(EMD_SEC2_DATA_T animFrame);
void setAnimRotationDir(unsigned int animRotationDir);
void setX(float x);
void setY(float y);
void setZ(float z);
void setAngle(float angle);
unsigned int getModel();
unsigned int getHitPoints();
unsigned int getTmrAnim();
unsigned int getState();
unsigned int getAnimSection();
unsigned int getAnimType();
unsigned int getAnimCount();
unsigned int getAnimOldSection();
unsigned int getAnimOldCount();
unsigned char getAnimRotationDir();
EMD_SEC2_DATA_T getAnimFrame();
bool getAnimRepeat();
float getX();
float getY();
float getZ();
float getAngle();
private:
unsigned int modelNum;
unsigned int animSection;
unsigned int animCount;
unsigned int animOldSection;
unsigned int animOldCount;
unsigned int animType;
unsigned char animRotationDir;
EMD_SEC2_DATA_T animFrame;
bool animRepeat;
float x;
float y;
float z;
float angle;
unsigned int tmrAnim;
unsigned int hitPoints;
unsigned int state;
};
class enemy : public entity {
public:
enemy();
~enemy();
void setType(unsigned int type);
void setDelta(float delta);
unsigned int getType();
float getDelta();
private:
unsigned int type;
float delta;
};
class player : public entity {
public:
player();
~player();
void setItemID(unsigned char slot, unsigned int iID);
void setCam(unsigned int cam);
unsigned int getCam();
unsigned int getItemID(unsigned char slot);
private:
unsigned int cam;
unsigned int iID[8];
};
enum BITMAP_TYPE_FILE {
BITMAP_TYPE_MONO = 0x1,
BITMAP_TYPE_16COLOR = 0x4,
BITMAP_TYPE_256COLOR = 0x8,
BITMAP_TYPE_16BPP = 0x10,
BITMAP_TYPE_24BPP = 0x18,
BITMAP_TYPE_32BPP = 0x20
};
/*
* NFP - Nightamre Fiction Picture
* for now using SDL_Surface
*/
class NFP {
public:
NFP();
~NFP();
bool loadImage(std::string fileName);
void* getPixelData();
int getWidth();
int getHeight();
private:
SDL_Surface* texture;
};
class BITMAP {
public:
BITMAP();
~BITMAP();
void loaderFile(std::string fileName, int type);
unsigned char *bmpBuffer;
int bmpHeight;
int bmpWidth;
private:
unsigned char bmpHeader[54];
unsigned int bmpDataInit;
unsigned int bmpSize;
unsigned short bpp;
};
/* Debug Stuff to room jump */
typedef struct debugRoom {
float x;
float y;
float z;
int roomNum;
std::string roomName;
} debugRoom;
#endif