示例#1
0
文件: view.cpp 项目: lotuskip/yuxtapa
void redraw_view()
{
	if(clientstate == CS_LIMBO)
		Base::print_view(limboview);
	else if(clientstate == CS_HELP)
	{
		if(!helpshown) // first time to show help
		{
			// replace keys in the view with actual values
			char *kmv;
			short idx;
			for(e_Key_binding kb = KB_8; kb < MAX_KEY_BINDING; kb = e_Key_binding(kb+1))
			{
				kmv = Config::key_map_value(kb);
				idx = kmv_idx[kb];
				while(*kmv)
				{
					helpview[idx] = *kmv;
					idx += 2;
					++kmv;
				}
			}
			helpshown = true;
		}
		Base::print_view(helpview);
	}
	else if(clientstate != CS_TEAM_INFO)
	{
		Base::print_view(viewbuffer);
		if(clientstate == CS_AIMING)
			draw_aimer();
		if(showtitles)
			draw_titles();
	}
}
示例#2
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++;
    }
}
示例#3
0
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;
}