// do frame
void multi_df_debrief_do()
{
	int k, new_k;
	char buf[256];
	
	k = chatbox_process();	
	new_k = Multi_df_window.process(k, 0);	

	// process keypresses
	switch(new_k){
	case KEY_ESC:
		multi_debrief_esc_hit();
		break;
	}

	// process buttons	
	multi_df_process_buttons();

	// music stuff
	common_music_do();

	// process debriefing details
	multi_debrief_do_frame();

	// draw the background
	GR_MAYBE_CLEAR_RES(Multi_df_background_bitmap);
	if (Multi_df_background_bitmap >= 0) {
		gr_set_bitmap(Multi_df_background_bitmap);
		gr_bitmap(0, 0, GR_RESIZE_MENU);
	} 

	// draw the window
	Multi_df_window.draw();	

	// kill matrix
	multi_df_blit_kill_matrix();

	// render the chatbox
	chatbox_render();

	// draw the mission title
	strcpy_s(buf, The_mission.name);
	font::force_fit_string(buf, 255, Kill_matrix_title_coords[gr_screen.res][2]);
	gr_set_color_fast(&Color_bright_white);
	gr_string(Kill_matrix_title_coords[gr_screen.res][0], Kill_matrix_title_coords[gr_screen.res][1], buf, GR_RESIZE_MENU);

	// flip
	gr_flip();
}
示例#2
0
int main(int argc, char **argv)
{
    int i, c, *w, down;
    gamestr g;
    player players[5];
    char names[5 * 9], *p;
    int belts[5];
    g.villain = players;

    SDL_Renderer *screen;
    SDL_Event event;
    Tbox t;
    Chatbox out;

    if (argc == 3)
        screen = init_sdl(atoi(argv[1]), atoi(argv[2]), 0, FONT);
    else if (argc == 2)
        screen = init_sdl(W, H, argv[1], FONT);
    else
        screen = init_sdl(W, H, 0, FONT);

    for (i = 0; i < 5; i++) {
        sprintf(&names[9 * i], "Player %1d", i + 1);
        g.villain[i].name = &names[9 * i];
        g.villain[i].water_level = i;
        g.villain[i].points = i;
        g.villain[i].lifebelts = i;
        g.villain[i].played = i + 1;
        g.villain[i].dead = i == 4 ? 1 : 0;
        belts[i] = 6;
    }

    belts[0] = 10;

    for (i = 0; i < 12; i++)
        g.player.weathercards[i] = i + 1;

    g.w_card[0] = 5;
    g.w_card[1] = 12;

    t = create_textbox(screen, getfont(), 36, 532);
    out = create_chatbox(screen, getfont(), 36, 410, 10);

    g.count = 5;

    render(screen, &g, 0, belts);
    textbox_set(t, strdup(""));
    chatbox_append(out, strdup("foobar"));
    chatbox_append(out, strdup("baaz"));
    chatbox_append(out, strdup("quux"));
    chatbox_render(out);
    SDL_RenderPresent(screen);

    down = 0;
    for (i = 9; i; i--) {
        do {
            SDL_WaitEvent(&event);
            c = SDL_GetModState();

            if (event.type == SDL_QUIT)
                exit(0);
            if (event.type == SDL_KEYUP || event.type == SDL_MOUSEBUTTONUP)
                belts[0] = 0;
            if (event.type == SDL_KEYDOWN)
                down = 1;
        } while (belts[0]);
        belts[0] = 10;

        if (down && event.type == SDL_KEYUP) {
            if ((p = handle_keypress(event.key.keysym.sym, c, t, out))) {
                chatbox_append(out, p);
            }
#if 0
            if ((c = getprintkey(event.key.keysym.sym, SDL_GetModState()))) {
                /* append to message */
                p = malloc(strlen(textbox_get(t)) + 2);
                sprintf(p, "%s%c", textbox_get(t), c);

                /* fprintf(stderr, "text is now %s\n", p); */

                free(textbox_get(t));
                textbox_set(t, p);
            }

            switch(event.key.keysym.sym) {
            case SDLK_q:
                exit(0);
            case SDLK_PAGEUP:
                chatbox_scrollup(out);
                break;
            case SDLK_PAGEDOWN:
                chatbox_scrolldown(out);
                break;
            case SDLK_RETURN:
                chatbox_append(out, textbox_get(t));
                textbox_set(t, strdup(""));
                break;
            default:
                break;
            }
#endif /* 0 */
        } else if (event.type == SDL_MOUSEBUTTONUP) {
            w = g.player.weathercards;

            c = card_select(event.button.x, event.button.y, w);

            if (c != -1) {
                g.villain[0].played = w[c];
                w[c] = 0;
            }
        }

    	g.villain[0].lifebelts = i;
        if (i == 1) i = 2;

        render(screen, &g, 0, belts);
        textbox_update(t);
        chatbox_render(out);
        game_over(screen, &g, 0, 0, 0);

        SDL_RenderPresent(screen);
    }

    return 0;
}
void multi_pause_do()
{
	int k;
	
	// make sure we don't enter this state unless we're in the mission itself	
	Netgame.game_state = NETGAME_STATE_PAUSED;

	// server of the game should periodically be sending pause packets for good measure
	if (Net_player->flags & NETINFO_FLAG_AM_MASTER) {		
	}

	if (!(Game_mode & GM_STANDALONE_SERVER)) {
		// restore saved screen data if any
		if (Multi_paused_screen_id >= 0) {
			gr_restore_screen(Multi_paused_screen_id);
		}

		// set the background image
		if (Multi_paused_background >= 0) {
			gr_set_bitmap(Multi_paused_background);
			gr_bitmap(0, 0, GR_RESIZE_MENU);
		}

		// if we're inside of popup code right now, don't process the window
		if(!popup_active()){
			// process chatbox and window stuff
			k = chatbox_process();
			k = Multi_paused_window.process(k);	
		
			switch (k) {
			case KEY_ESC:			
			case KEY_PAUSE:									
				multi_pause_request(0);
				break;
			}
		}

		// check for any button presses
		multi_pause_check_buttons();

		// render the callsign of the guy who paused
		multi_pause_render_callsign();
				
		// render the chatbox
		chatbox_render();
		
		// draw tooltips
		// Multi_paused_window.draw_tooltip();
		Multi_paused_window.draw();

		// display the voice status indicator
		multi_common_voice_display_status();

		// don't flip screen if we are in the popup code right now
		if (!popup_active()) {
			gr_flip();
		}
	}
	// standalone pretty much does nothing here
	else {
		os_sleep(1);
	}
}