Exemplo n.º 1
0
static void next_round()
{
    ttk_widget_set_timer(wid, 2500);
    switch(ducks_shot) {
    case 0:
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
        duckhunt_message("GAME OVER");
        break;
    case 6:
    case 7:
    case 8:
    case 9:
        duckhunt_message("GOOD");
        round++;
        reset_round();
        break;
    case 10:
        duckhunt_message("PERFECT");
        score += 10000;
        round++;
        reset_round();
        break;
    }
}
Exemplo n.º 2
0
TWindow * mystify_new_window()
{
    TWindow *win;
    TWidget  *wid;
    
    win            = ttk_new_window();
    win->title="Mystify";
    wid            = ttk_new_widget(0,0);
    wid->w         = ttk_screen->w;
    wid->h         = ttk_screen->h - ttk_screen->wy;
    wid->draw      = mystify_draw;
    wid->down      = mystify_down;
    wid->button    = mystify_button;
    wid->scroll    = mystify_scroll;
    wid->timer     = mystify_timer;
    
    wid->focusable = 1;
    
    mystify_init();
    
    ttk_widget_set_timer(wid, sleep_time);
    ttk_add_widget(win, wid);
    ttk_window_hide_header(win);
    
    ttk_show_window(win);
}
Exemplo n.º 3
0
static void dog_walk()
{
    char str[20];

    ttk_widget_set_timer(wid, 700);
    sprintf(str, "ROUND %d", round+1);
    duckhunt_message(str);
    duckhunt_bar();

    if (dogw_frame < 5) {
        if(ttk_screen->w == 220)
            ttk_blit_image (dogw[dogw_frame], duckhunt_srf, dogw_frame*20, 103);
        else if(ttk_screen->w<220)
            ttk_blit_image (dogw[dogw_frame], duckhunt_srf, dogw_frame*15, 77);
        else
            ttk_blit_image (dogw[dogw_frame], duckhunt_srf, dogw_frame*29, 150);
        dogw_frame++;
    }
    else if (dogw_frame >= 5 && dogw_frame < 8) {
        if (dogw_frame == 5) {
            if(ttk_screen->w == 220)
                ttk_blit_image (dogw[dogw_frame], duckhunt_srf, 80, 97);
            else if(ttk_screen->w < 220)
                ttk_blit_image (dogw[dogw_frame], duckhunt_srf, 60, 73);
            else
                ttk_blit_image (dogw[dogw_frame], duckhunt_srf, 116, 141);
        }
        else {
            if(ttk_screen->w == 220)
                ttk_blit_image (dogw[dogw_frame], duckhunt_srf, 80, 75);
            else if(ttk_screen->w<220)
                ttk_blit_image (dogw[dogw_frame], duckhunt_srf, 60, 56);
            else
                ttk_blit_image (dogw[dogw_frame], duckhunt_srf, 116, 109);
        }
        dogw_frame++;
    }
    else if (dogw_frame == 8) {
        pause=2;
        dogw_frame=0;
        draw_aimer (aimerx, aimery);
        ttk_widget_set_timer(wid, 50);
        wid->dirty++;
    }
}
Exemplo n.º 4
0
static void init_duck()
{
    ttk_widget_set_timer(wid, 50);
    duckx = random() % 120;//221;
    ducky = random() % 55;//177;
    ranbounce = random() % MAX_BOUNCE;
    temp_bcx = bounce_cords[ranbounce][0] + round;
    temp_bcy = bounce_cords[ranbounce][1] + round;
    start_duck = 1;
}
Exemplo n.º 5
0
static void duck_flyaway()
{
    ttk_widget_set_timer(wid, 50);
    duckhunt_message ("FLY AWAY");
    ttk_blit_image (duck[duck_frame], duckhunt_srf, duckx, duck_faway);
    duck_faway -= 5;
    duck_frame++;
    if (duck_frame == 3) duck_frame=0;
    if (duck_faway <= -30) {
        duck_timer=0;
        start_duck=4; //DOG LAUGHS AT YOU!
    }
}
Exemplo n.º 6
0
static int mystify_scroll(TWidget *wid, int dir)
{
#ifdef IPOD
    TTK_SCROLLMOD(dir, 4);
#endif
    if(dir > 0){
        sleep_time++;
    }
    else{
        if(sleep_time >= 0)
            sleep_time--;
    }
    ttk_widget_set_timer(wid, sleep_time);
    wid->dirty++;
    return TTK_EV_CLICK;
}
Exemplo n.º 7
0
static void dog_holdduck()
{
    ttk_widget_set_timer(wid, 2500);
    if(ttk_screen->w == 220)
        ttk_blit_image (dog_duck, duckhunt_srf, (bg_w/2)-22, mid-42);
    else if(ttk_screen->w<220)
        ttk_blit_image (dog_duck, duckhunt_srf, (bg_w/2)-17, mid-32);
    else
        ttk_blit_image (dog_duck, duckhunt_srf, (bg_w/2)-32, mid-61);
    duck_count++;
    ducks_shot++;
    if (duck_count == 10)
        start_duck=5;
    else
        start_duck=0;
    shots=3;
}
Exemplo n.º 8
0
static void aimer_shoot (int x, int y)
{
    ttk_fillellipse (duckhunt_srf, x, y, 5, 5, ttk_makecol(WHITE));
    if ((aimerx > duckx && aimerx < duckx+28) && (aimery > ducky && aimery < ducky+30)) {
        //BRAP YOU POPPED THAT PUNKASS DUCK!
        ttk_widget_set_timer(wid, 1500);
        score += score_opts[shots-1];
        mini_ducks[duck_count]=1;
        start_duck=2;
        duck_timer=0;
        dd_fally=ducky;
        ttk_blit_image (duckhunt_bg, duckhunt_srf, 0, 0);
        duckhunt_bar();
        ttk_blit_image (dead_duck, duckhunt_srf, duckx, ducky);
    }
    if (shots > 0) shots--;
    action=0;
}
Exemplo n.º 9
0
static void duck_shot()
{
    ttk_widget_set_timer(wid, 50);
    dd_fally += 4;
    ttk_blit_image (dd_fall, duckhunt_srf, duckx+5, dd_fally);
    if(ttk_screen->w > 220) {
        if (dd_fally >= (mid-45))
            start_duck=3;  //DOG HOLDS DEAD DUCK !!!11ONE+SHIFT!!1
    }
    if(ttk_screen->w == 220) {
        if (dd_fally >= (mid-32))
            start_duck=3;  //DOG HOLDS DEAD DUCK !!!11ONE+SHIFT!!1
    }
    else {
        if (dd_fally < (mid-24))
            start_duck=3;  //DOG HOLDS DEAD DUCK !!!11ONE+SHIFT!!1
    }
}
Exemplo n.º 10
0
static void dog_laughing()
{
    ttk_widget_set_timer(wid, 300);
    if(ttk_screen->w == 220)
        ttk_blit_image (dog_laugh[dogl_frame], duckhunt_srf, (bg_w/2)-15, mid-40);
    else if(ttk_screen->w<220)
        ttk_blit_image (dog_laugh[dogl_frame], duckhunt_srf, (bg_w/2)-11, mid-30);
    else
        ttk_blit_image (dog_laugh[dogl_frame], duckhunt_srf, (bg_w/2)-22, mid-50);
    dogl_frame++;
    if (dogl_frame == 2) dogl_frame=0;
    if (duck_timer >= 10) {
        duck_count++;
        if (duck_count == 10)
            start_duck=5;
        else
            start_duck=0;
        duck_timer=0;
        shots=3;
    }
}
Exemplo n.º 11
0
static void transfer_finished() {
	printf("Transfer finished!\n");

	free(transfer_buffer);
	if (srcFile) {
	  fclose(srcFile);
	  srcFile = NULL;
	}	
	if (dstFile) {
	  fclose(dstFile);
	  dstFile = NULL;
    }

	
	if (dst_ipod_dirty) {
      ipod_flush(trans_list_dst_ipod);
	  if (trans_list_dst_ipod == local_ipod)
		mpd_make_dirty();
	}
		
	rip_status = STATUS_MOUNTED;
	ttk_widget_set_timer(transfer_widget, 0); /* unset timer */
}