fix right scroll treshold
[rofl0r-openDOW.git] / gameobj.h
blobd93bd9d1940b2705fb0ffd907fb08fc9b00d2745
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,
42 typedef uint8_t anim_step;
43 #define ANIM_STEP_INIT (anim_step) -1
45 typedef struct gameobj {
46 vec2f pos;
47 vec2f vel;
48 enum sprite_index spritemap_id;
49 anim_step anim_curr;
50 enum animation_id animid;
51 uint8_t anim_frame;
52 enum objtype objtype;
53 union objspec {
54 struct {
55 int step_max;
56 int step_curr;
57 } bullet;
58 struct enemy enemy;
59 struct {
60 unsigned score;
61 } playerdata;
62 } objspecific;
63 } gameobj;
65 int gameobj_alloc(void);
66 void gameobj_free(int id);
68 void gameobj_start_anim(int obj_id, enum animation_id aid);
69 void gameobj_init(int id, vec2f *pos, vec2f* vel,
70 enum sprite_index spritemap_id,
71 enum animation_id animid, enum objtype objtype);
73 void gameobj_init_bulletdata(int id, int steps);
76 #define OBJ_MAX 255
77 extern gameobj objs[OBJ_MAX];
78 extern uint8_t obj_slot_used[OBJ_MAX];
79 extern uint8_t obj_count;
81 //RcB: DEP "gameobj.c"
83 #endif