struct duck *create_duck(int state, double x, double y, double v_x, double v_y, int z, float time) { struct duck *duck = alloc_duck(); init_duck(duck, state, x, y, v_x, v_y, z, time); return duck; }
static int draw_duckhunt (TWidget *wid, ttk_surface srf) { ttk_fillrect (srf, 0, 0, ttk_screen->w, ttk_screen->h, ttk_makecol(BLACK)); if (pause == 0) startup_screen(); else if (pause == 1) { ttk_blit_image (duckhunt_bg, duckhunt_srf, 0, 0); dog_walk(); } else if (pause == 2) { if (duck_timer >= 100) ttk_blit_image (duckhunt_lose_bg, duckhunt_srf, 0, 0); else ttk_blit_image (duckhunt_bg, duckhunt_srf, 0, 0); duckhunt_bar(); if (action == 1) aimer_hold (aimerx, aimery); else if (action == 2) aimer_shoot (aimerx, aimery); if (start_duck == 0) init_duck(); else if (start_duck == 1) { if (duck_timer >= 100) duck_flyaway(); else move_duck(); } else if (start_duck == 2) duck_shot(); else if (start_duck == 3) dog_holdduck(); else if (start_duck == 4) dog_laughing(); else if (start_duck == 5) next_round(); draw_aimer(aimerx, aimery); } ttk_blit_image (duckhunt_srf, srf, (ttk_screen->w/2)-(bg_w/2), (ttk_screen->h/2)-(bg_h/2)); return 0; }