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