Ejemplo n.º 1
0
// maybe process a keypress in text messaging mode, return true if the key was processed
int multi_msg_text_process(int k)
{
	char str[2];

	// keep eating keys for a short period of time
	if((Multi_msg_eat_stamp != -1) && !timestamp_elapsed(Multi_msg_eat_stamp)){
		return 1;
	}	
	
	// if we're not in text message mode, return 0
	if(!Multi_msg_text_enter){
		return 0;
	}

	switch(k){
	// cancel the message
	case KEY_ESC:	
		multi_msg_text_flush();				
		break;

	// send the message
	case KEY_ENTER:				
		multi_msg_eval_text_msg();		
		multi_msg_text_flush();						
		break;

	// backspace
	case KEY_BACKSP:
		if(Multi_msg_text[0] != '\0'){
			Multi_msg_text[strlen(Multi_msg_text)-1] = '\0';
		}
		break;

	// ignore these individual keys
	case KEY_LSHIFT + KEY_SHIFTED:
	case KEY_RSHIFT + KEY_SHIFTED:
	case KEY_LALT + KEY_SHIFTED:
	case KEY_RALT + KEY_SHIFTED:
	case KEY_LCTRL + KEY_SHIFTED:
	case KEY_RCTRL + KEY_SHIFTED:
		break;

	// stick other printable characters onto the text
	default :					
		// if we're not already at the maximum length
		if(strlen(Multi_msg_text) < MULTI_MSG_MAX_LEN){
			str[0] = (char)key_to_ascii(k);
			str[1] = '\0';
			strcat_s(Multi_msg_text,str);		
		}
		break;
	}

	return 1;
}
Ejemplo n.º 2
0
// check to see if we need to be warping out (strange transition possibilities)
void multi_endgame_check_for_warpout()
{
	int need_to_warpout = 0;

	// if we're not in the process of warping out - do nothing
	if(!(Net_player->flags & NETINFO_FLAG_WARPING_OUT)){
		return;
	}

	// determine if sufficient warping-out conditions exist
	if((Game_mode & GM_IN_MISSION) &&										// if i'm still in the mission
		((Netgame.game_state == NETGAME_STATE_ENDGAME)	||				// if the netgame ended
		 (Netgame.game_state == NETGAME_STATE_DEBRIEF))					// if the netgame is now in the debriefing state
	  ) {
		need_to_warpout = 1;
	}

	// if we need to be warping out but are stuck in a dead popup, cancel it
	if(need_to_warpout && (popupdead_is_active() || (Net_player->flags & NETINFO_FLAG_RESPAWNING) || (Net_player->flags & NETINFO_FLAG_OBSERVER)) ){		
		// flush all active pushed state
		multi_handle_state_special();

		// begin the warpout process		
		send_debrief_event();

		// if text input mode is active, clear it
		multi_msg_text_flush();
	}	
}
Ejemplo n.º 3
0
void multi_pause_init()
{
	int i;

	// if we're already paused. do nothing
	if ( Multi_paused ) {
		return;
	}

	Assert( Game_mode & GM_MULTIPLAYER );

	if ( !(Game_mode & GM_MULTIPLAYER) )
		return;

	// pause all beam weapon sounds
	weapon_pause_sounds();

	// standalone shouldn't be doing any freespace interface stuff
	if (Game_mode & GM_STANDALONE_SERVER) {
		std_debug_set_standalone_state_string("Multi paused do");
	} 
	// everyone else should be doing UI stuff
	else {
		// pause all game music
		audiostream_pause_all();

		// switch off the text messaging system if it is active
		multi_msg_text_flush();

		if ( Multi_paused_screen_id == -1 )
			Multi_paused_screen_id = gr_save_screen();

		// create ui window
		Multi_paused_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
		Multi_paused_window.set_mask_bmap(Multi_paused_bg_mask[gr_screen.res]);
		Multi_paused_background = bm_load(Multi_paused_bg_fname[gr_screen.res]);

		for (i=0; i<MULTI_PAUSED_NUM_BUTTONS; i++) {
			// create the button
			Multi_paused_buttons[gr_screen.res][i].button.create(&Multi_paused_window, "", Multi_paused_buttons[gr_screen.res][i].x, Multi_paused_buttons[gr_screen.res][i].y, 1, 1, 0, 1);

			// set the highlight action
			Multi_paused_buttons[gr_screen.res][i].button.set_highlight_action(common_play_highlight_sound);

			// set the ani
			Multi_paused_buttons[gr_screen.res][i].button.set_bmaps(Multi_paused_buttons[gr_screen.res][i].filename);

			// set the hotspot
			Multi_paused_buttons[gr_screen.res][i].button.link_hotspot(Multi_paused_buttons[gr_screen.res][i].hotspot);
		}	

		// add text
		for(i=0; i<MULTI_PAUSED_NUM_TEXT; i++){
			Multi_paused_window.add_XSTR(&Multi_paused_text[gr_screen.res][i]);
		}
		
		// close any instances of a chatbox
		chatbox_close();

		// intialize our custom chatbox
		chatbox_create(CHATBOX_FLAG_MULTI_PAUSED);		
	}

	Multi_paused = 1;

	// reset timestamps
	multi_reset_timestamps();
}