Revision 236
improved bullet stuff
proj.c | ||
---|---|---|
54 | 54 |
int r; |
55 | 55 |
|
56 | 56 |
#ifdef DIOGO |
57 |
/* |
|
57 | 58 |
uint8_t conf; |
58 | 59 |
if((r = util_sys_inb(0x3F8+3, &conf))) return 1; //printf("0x%02X\n", conf); |
59 | 60 |
conf = 0x19; //00011001 |
60 | 61 |
//printf("0x%02X\n", conf); |
61 | 62 |
if((r = sys_outb(0x3F8+3, conf))) return 1; |
62 | 63 |
if((r = util_sys_inb(0x3F8+3, &conf))) return 1; //printf("0x%02X\n", conf); |
64 |
*/ |
|
63 | 65 |
#endif |
64 | 66 |
|
65 | 67 |
font_t *consolas = font_ctor("/home/lcom/labs/proj/media/font/Consolas/xpm2"); |
... | ... | |
177 | 179 |
#ifdef TELMO |
178 | 180 |
ent_set_scale(DEFAULT_SCALE); |
179 | 181 |
|
182 |
list_t *shooter_list = list_ctor(); |
|
183 |
|
|
180 | 184 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol); if(shooter1 == NULL) printf("Failed to get shooter1\n"); |
181 | 185 |
gunner_set_spawn(shooter1, 75, 75); |
182 | 186 |
gunner_set_pos(shooter1, 75, 75); |
... | ... | |
185 | 189 |
gunner_set_spawn(shooter2, 975, 75); |
186 | 190 |
gunner_set_pos(shooter2, 775, 75); |
187 | 191 |
|
192 |
list_insert(shooter_list, list_end(shooter_list), shooter1); |
|
193 |
list_insert(shooter_list, list_end(shooter_list), shooter2); |
|
194 |
|
|
188 | 195 |
//bullet_t *bullet = bullet_ctor(get_bullet(), 400.0, 400.0, 2.0, -1.0); |
189 | 196 |
|
190 |
list_t *bullet_list = list_ctor(); |
|
197 |
list_t *bullet_list = list_ctor();
|
|
191 | 198 |
|
192 | 199 |
ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0, |
193 | 200 |
gunner_get_y(shooter1)-ent_get_YLength()/2.0); |
... | ... | |
227 | 234 |
|
228 | 235 |
if (no_interrupts % 180 == 0) gunner_set_pos(shooter2, 775, 75); |
229 | 236 |
|
230 |
update_game_state(map1, shooter2, bullet_list);
|
|
237 |
update_game_state(map1, shooter_list, bullet_list);
|
|
231 | 238 |
|
232 | 239 |
if(map_collides_gunner(map1, shooter1)){ |
233 | 240 |
printf("COLLIDING\n"); |
... | ... | |
288 | 295 |
} |
289 | 296 |
|
290 | 297 |
#ifdef TELMO |
291 |
gunner_dtor(shooter1); shooter1 = NULL; |
|
292 |
gunner_dtor(shooter2); shooter2 = NULL; |
|
298 |
//gunner_dtor(shooter1); shooter1 = NULL;
|
|
299 |
//gunner_dtor(shooter2); shooter2 = NULL;
|
|
293 | 300 |
|
301 |
while(list_size(shooter_list) > 0){ |
|
302 |
gunner_t *p = list_erase(shooter_list, list_begin(shooter_list)); |
|
303 |
gunner_dtor(p); |
|
304 |
} |
|
305 |
|
|
294 | 306 |
while(list_size(bullet_list) > 0){ |
295 | 307 |
bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list)); |
296 |
free(p);
|
|
308 |
bullet_dtor(p);
|
|
297 | 309 |
} |
298 | 310 |
if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n"); |
299 | 311 |
#endif |
Also available in: Unified diff