Project

General

Profile

Revision 246

convert to lists

View differences:

proj.c
223 223

  
224 224
                                        if (no_interrupts % 180 == 0) gunner_set_pos(shooter2, 775, 75);
225 225

  
226
                                        update_game_state(map1, shooter_list, bullet_list);
226
    while (good) {
227
        /* Get a request message. */
228
        if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
229
            printf("driver_receive failed with %d", r);
230
            continue;
231
        }
232
        if (is_ipc_notify(ipc_status)) { /* received notification */
233
            switch (_ENDPOINT_P(msg.m_source)) {
234
                case HARDWARE: /* hardware interrupt notification */
235
                    for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) {
236
                        if (msg.m_notify.interrupts & n) {
237
                            interrupt_handler(i);
238
                            if ((scancode[0]) == ESC_BREAK_CODE) good = 0;
239
                            #ifdef TELMO
240
                            if (i == 0) {
241
                                if (no_interrupts % refresh_count_value == 0) {
242
                                    update_movement(map1, shooter1, get_key_presses(), shooter_list);
243
                                    //bullet_update_movement(bullet);
227 244

  
228
                                        if(map_collides_gunner(map1, shooter1)){
229
                                            printf("COLLIDING\n");
230
                                        }
231

  
232 245
                                        update_scale();
233

  
234
                                        ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
235
                                                       gunner_get_y(shooter1)-ent_get_YLength()/2.0);
236

  
237 246
                                        sprite_set_pos(sp_crosshair, get_mouse_X(), get_mouse_Y());
238 247
                                        double angle = get_mouse_angle(shooter1);
239 248
                                        gunner_set_angle(shooter1, angle - M_PI_2);
......
246 255
                                        gunner_draw(shooter1);
247 256
                                        bullet_draw_list(bullet_list);
248 257

  
249
                                        t = clock()-t; //printf("%d\n", (t*1000)/CLOCKS_PER_SEC);
250

  
251 258
                                        sprite_draw(sp_crosshair);
252 259
                                        graph_draw();
253 260
                                    }
......
258 265
                                        update_mouse(&pp);
259 266
                                        //printf("X: %d Y: %d\n", get_mouse_X(), get_mouse_Y());
260 267
                                        counter_mouse_ih = 0;
261

  
262
                                        if (last_lb ^ get_key_presses()->lb_pressed && get_key_presses()->lb_pressed) {
263
                                            shoot_bullet(shooter1, bullet_list, bsp_bullet);
264
                                        }
265

  
266 268
                                        last_lb = get_key_presses()->lb_pressed;
267 269
                                    }
268 270
                                }

Also available in: Unified diff