palpic2png.c: improve, make usable with ppic binary files
[rofl0r-openDOW.git] / gameobj.h
blobedf602aa6af9bba7dadef7e60840ecf9f7207409
1 #ifndef GAMEOBJ_H
2 #define GAMEOBJ_H
4 #include "vec2f.h"
5 #include "anim.h"
6 #include "spritemaps.h"
7 #include "enemy.h"
8 #include <stdint.h>
10 enum objtype {
11 OBJ_P1 = 0,
12 OBJ_P2,
13 OBJ_BULLET,
14 OBJ_CROSSHAIR,
15 OBJ_FLASH,
16 OBJ_FLAME,
17 OBJ_GRENADE,
18 OBJ_GRENADE_EXPLOSION,
19 OBJ_ROCKET,
20 OBJ_BIG_EXPLOSION,
21 OBJ_ENEMY_SHOOTER,
22 OBJ_ENEMY_BOMBER,
23 OBJ_JEEP,
24 OBJ_TANK_SMALL,
25 OBJ_TANK_BIG,
26 OBJ_TRANSPORTER,
27 OBJ_GUNTURRET_MOVABLE_MAN,
28 OBJ_GUNTURRET_MOVABLE_MACHINE,
29 OBJ_MINE_FLAT,
30 OBJ_MINE_CROSSED,
31 OBJ_FLAMETURRET,
32 OBJ_GUNTURRET_FIXED_SOUTH,
33 OBJ_GUNTURRET_FIXED_NORTH,
34 OBJ_BUNKER1,
35 OBJ_BUNKER2,
36 OBJ_BUNKER3,
37 OBJ_BUNKER4,
38 OBJ_BUNKER5,
39 OBJ_BOSS,
40 OBJ_BLOOD,
43 typedef uint8_t anim_step;
44 #define ANIM_STEP_INIT (anim_step) -1
46 typedef struct gameobj {
47 vec2f pos;
48 vec2f vel;
49 enum sprite_index spritemap_id;
50 anim_step anim_curr;
51 enum animation_id animid;
52 uint8_t anim_frame;
53 enum objtype objtype;
54 union objspec {
55 struct {
56 int step_max;
57 int step_curr;
58 } bullet;
59 struct enemy enemy;
60 } objspecific;
61 } gameobj;
63 int gameobj_alloc(void);
64 void gameobj_free(int id);
66 void gameobj_start_anim(int obj_id, enum animation_id aid);
67 void gameobj_init(int id, vec2f *pos, vec2f* vel,
68 enum sprite_index spritemap_id,
69 enum animation_id animid, enum objtype objtype);
71 void gameobj_init_bulletdata(int id, int steps);
74 #define OBJ_MAX 255
75 extern gameobj objs[OBJ_MAX];
76 extern uint8_t obj_slot_used[OBJ_MAX];
77 extern uint8_t obj_count;
79 #pragma RcB2 DEP "gameobj.c"
81 #endif