]> git.r.bdr.sh - rbdr/pico-engine/blob - actor.h
Update project so it compiles
[rbdr/pico-engine] / actor.h
1 /*
2 * Module Name: Actor
3 * Description: Every action that has to do with actors (playable and NPCs).
4 * It has all the lua stuff, which is messy as fuck.
5 */
6
7 class Actor : public CLuaScript
8 {
9
10 protected:
11
12 int x, y, w, h, clip_x, clip_y, currentframe, oldclip, m_iMethodBase, walk_time;
13 float vertical_speed, falltime, speed, ownspeed, totalspeed, vertical_acc, horizontal_acc;
14
15 Actor *parent;
16
17 //keys
18 int leftkey, rightkey, zkey, xkey, ckey, shotcount;
19
20 SDL_Surface *sprite;
21 Mix_Chunk *walkbg;
22
23 Map *currentmap;
24 Audio *audio;
25 Game_overwatch *overwatch;
26
27 bool colliding[4];
28 bool dying, animating, animup, jumplock, shootlock,
29 switchlock, physics, controllable, noclip;
30
31 Direction currentdirection;
32 Enemy enemy;
33
34
35 public:
36
37 //constructors and destructor.
38 Actor(int, int, const char*, const char*, Map *, Audio *, Game_overwatch *, CLuaVirtualMachine&);
39 Actor(int, int, const char*, const char*, Actor *, Direction, bool, Map *, Audio *, Game_overwatch *, CLuaVirtualMachine&);
40 virtual ~Actor(void);
41
42 //initializer (Common for constructors)
43 void init(int, int, const char*, const char*, Actor *, Direction, bool, Map *, Audio *, Game_overwatch *, CLuaVirtualMachine&);
44
45 //lua required methods
46 int ScriptCalling (CLuaVirtualMachine&, int);
47 void HandleReturns (CLuaVirtualMachine&, const char *);
48
49 //normal methods
50 bool can_move(Direction, int, int);
51 bool can_die(void);
52 void animate(void);
53 void move(void);
54 void add_bullet(const char*, const char*);
55 void remove_bullet(void);
56 void accelerate(float, float);
57 void decelerate(float);
58
59 //set and get stuff
60 int get_x(void);
61 void set_x(int);
62 int get_y(void);
63 void set_y(int);
64 int get_w(void);
65 void set_w(int);
66 int get_h(void);
67 void set_h(int);
68 int get_clip_x(void);
69 void set_clip_x(int);
70 int get_clip_y(void);
71 void set_clip_y(int);
72 int get_currentframe(void);
73 void set_currentframe(int);
74 int get_oldclip(void);
75 void set_oldclip(int);
76 float get_vertical_speed(void);
77 void set_vertical_speed(float);
78 float get_vertical_acc(void);
79 void set_vertical_acc(float);
80 float get_falltime(void);
81 void set_falltime(float);
82 SDL_Surface * get_sprite(void);
83 void set_collision(bool, int);
84 bool get_collision(int);
85 float get_speed(void);
86 void set_speed(float);
87 float get_ownspeed(void);
88 void set_ownspeed(float);
89 float get_totalspeed(void);
90 void set_totalspeed(float);
91 float get_horizontal_acc(void);
92 void set_horizontal_acc(float);
93 Enemy get_enemy(void);
94 Direction get_currentdirection(void);
95 int get_leftkey(void);
96 void set_leftkey(int);
97 int get_rightkey(void);
98 void set_rightkey(int);
99 int get_zkey(void);
100 void set_zkey(int);
101 int get_xkey(void);
102 void set_xkey(int);
103 bool get_physics(void);
104 void set_physics(bool);
105 bool get_dying(void);
106 void set_dying(bool);
107 bool get_controllable(void);
108 void set_ckey(int);
109 bool get_noclip(void);
110
111 //lua accessors (get)
112 int lget_x(CLuaVirtualMachine&);
113 int lget_y(CLuaVirtualMachine&);
114 int lget_w(CLuaVirtualMachine&);
115 int lget_h(CLuaVirtualMachine&);
116 int lget_clip_x(CLuaVirtualMachine&);
117 int lget_clip_y(CLuaVirtualMachine&);
118 int lget_currentframe(CLuaVirtualMachine&);
119 int lget_oldclip(CLuaVirtualMachine&);
120 int lget_vertical_speed(CLuaVirtualMachine&);
121 int lget_falltime(CLuaVirtualMachine&);
122 int lget_speed(CLuaVirtualMachine&);
123 int lget_ownspeed(CLuaVirtualMachine&);
124 int lget_totalspeed(CLuaVirtualMachine&);
125 int lget_currentdirection(CLuaVirtualMachine&);
126 int lget_collision(CLuaVirtualMachine&);
127 int lget_map_sx(CLuaVirtualMachine&);
128 int lget_map_sy(CLuaVirtualMachine&);
129 int lget_cfg_max_map_w(CLuaVirtualMachine&);
130 int lget_cfg_max_map_h(CLuaVirtualMachine&);
131 int lget_cfg_screen_width(CLuaVirtualMachine&);
132 int lget_cfg_screen_height(CLuaVirtualMachine&);
133 int lget_leftkey(CLuaVirtualMachine&);
134 int lget_rightkey(CLuaVirtualMachine&);
135 int lget_zkey(CLuaVirtualMachine&);
136 int lget_xkey(CLuaVirtualMachine&);
137 int lget_jumplock(CLuaVirtualMachine&);
138 int lget_shootlock(CLuaVirtualMachine&);
139 int lget_shotcount(CLuaVirtualMachine&);
140 int lget_ckey(CLuaVirtualMachine&);
141 int lget_switchlock(CLuaVirtualMachine&);
142 int lget_cfg_tile_w(CLuaVirtualMachine&);
143 int lget_cfg_tile_h(CLuaVirtualMachine&);
144 int lget_walk_time(CLuaVirtualMachine&);
145
146 //lua accessors (set)
147 int lset_x(CLuaVirtualMachine&);
148 int lset_y(CLuaVirtualMachine&);
149 int lset_w(CLuaVirtualMachine&);
150 int lset_h(CLuaVirtualMachine&);
151 int lset_clip_x(CLuaVirtualMachine&);
152 int lset_clip_y(CLuaVirtualMachine&);
153 int lset_currentframe(CLuaVirtualMachine&);
154 int lset_oldclip(CLuaVirtualMachine&);
155 int lset_vertical_speed(CLuaVirtualMachine&);
156 int lset_falltime(CLuaVirtualMachine&);
157 int lset_speed(CLuaVirtualMachine&);
158 int lset_ownspeed(CLuaVirtualMachine&);
159 int lset_totalspeed(CLuaVirtualMachine&);
160 int lset_currentdirection(CLuaVirtualMachine&);
161 int lset_collision(CLuaVirtualMachine&);
162 int lset_map_sx(CLuaVirtualMachine&);
163 int lset_map_sy(CLuaVirtualMachine&);
164 int lset_leftkey(CLuaVirtualMachine&);
165 int lset_rightkey(CLuaVirtualMachine&);
166 int lset_zkey(CLuaVirtualMachine&);
167 int lset_xkey(CLuaVirtualMachine&);
168 int lset_jumplock(CLuaVirtualMachine&);
169 int lset_shootlock(CLuaVirtualMachine&);
170 int lset_dying(CLuaVirtualMachine&);
171 int lset_shotcount(CLuaVirtualMachine&);
172 int lset_physics(CLuaVirtualMachine&);
173 int lset_enemy(CLuaVirtualMachine&);
174 int lset_controllable(CLuaVirtualMachine&);
175 int lset_switchlock(CLuaVirtualMachine&);
176 int lset_noclip(CLuaVirtualMachine&);
177 int lset_walk_time(CLuaVirtualMachine&);
178
179 //misc lua methods
180 int lcan_move(CLuaVirtualMachine&);
181 int center_map(CLuaVirtualMachine&);
182 int ladd_bullet(CLuaVirtualMachine&);
183 int lload_clip(CLuaVirtualMachine&);
184 int lplay_sfx(CLuaVirtualMachine&);
185 int lplay_bgm(CLuaVirtualMachine&);
186 int lstop_bgm(CLuaVirtualMachine&);
187 int laccelerate(CLuaVirtualMachine&);
188 int ldecelerate(CLuaVirtualMachine&);
189
190 };