Exemple #1
0
void		prompt_shell(t_shell *sh, t_prompt *prompt, char *buff)
{
	if (prompt->i < 4500)
	{
		deal_with_charac(prompt, buff);
		deal_with_space(prompt, buff);
	}
	go_down_line(prompt, buff);
	go_up_line(prompt, buff);
	deal_with_backspace(prompt, buff);
	deal_with_delete(prompt, buff);
	deal_with_left(prompt, buff);
	deal_with_right(prompt, buff);
	deal_with_up(sh, prompt, buff);
	deal_with_down(sh, prompt, buff);
	go_to_start_of_line(prompt, buff);
	go_to_previous_word(prompt, buff);
	go_to_next_word(prompt, buff);
	go_to_end(prompt, buff);
	start_copy_mode(prompt, buff);
	copy_string(prompt, buff);
	cut_string(prompt, buff);
	paste_string(prompt, buff);
	start_auto_complete(prompt, buff);
	input_clear(sh, prompt, buff);
}
Exemple #2
0
/* Rename string started. */
void
input_enter_rename(struct input_ctx *ictx)
{
	log_debug("%s", __func__);

	input_clear(ictx);
}
Exemple #3
0
void player_clear_input(void)
{
	int			i;
	
	mouse_last_read_tick=-1;

	weapon_change_key_down=FALSE;
	weapon_target_key_down=FALSE;
	weapon_zoom_key_down=FALSE;
	enter_exit_key_down=FALSE;
	network_score_key_down=FALSE;
	toggle_run_state=FALSE;
	
	for (i=0;i!=4;i++) {
		fire_key_down[i]=FALSE;
	}

    for (i=0;i!=20;i++) {
        command_key_down[i]=FALSE;
        player_key_down[i]=FALSE;
    }
	
	input_clear();

	hud.chat.type_on=FALSE;
}
Exemple #4
0
void setup_game_action_wait_for_input(void)
{
	int					n,ctrl_idx,action_idx;
	char				name[32];
	bool				already_set;
	setup_action_type	*action;
	
		// any input?
		
	if (!input_set_key_wait(name)) return;
	
		// set current action
		
	ctrl_idx=element_get_value(ctrl_action_id);
	if (ctrl_idx==-1) return;
	
	action_idx=setup_find_action_in_setup(setup_key_control_to_action_index_list[ctrl_idx]);
	
	if (action_idx==-1) {					// action doesn't exit, so create new one
		action_idx=setup.action_list.naction;
		strcpy(setup.action_list.actions[action_idx].name,setup_control_names[setup_key_control_to_action_index_list[ctrl_idx]]);
		setup.action_list.naction++;
	}
	
	action=&setup.action_list.actions[action_idx];
	
		// already picked?
		
	already_set=FALSE;
	
	for (n=0;n!=max_setup_action_attach;n++) {
		if (strcasecmp(action->attach[n],name)==0) already_set=TRUE;
	}

		// if not add
	
	if (!already_set) {
		n=setup_game_action_find_free_attach(action);
		if (n!=-1) strcpy(action->attach[n],name);
	}
	
		// don't let set key get back to interface
	
	input_clear();
	
		// rebuild list
		
	setup_game_create_pane();
	element_set_value(ctrl_action_id,ctrl_idx);
	element_set_scroll_position(ctrl_action_id,setup_action_scroll_pos);
	setup_game_action_enable_buttons();
	
		// got action
		
	setup_action_set_flag=FALSE;
}
Exemple #5
0
void
input_init ()
{
  input_clear ();
  input_buffer_number = 0;
}
Exemple #6
0
void setup_game_click(void)
{
	int							id,idx;
	iface_mp_character_type		*mp_character;

	id=-1;

		// keyboard

	if (input_get_keyboard_escape()) id=setup_game_cancel_button_id;
	if (input_get_keyboard_return()) id=setup_game_ok_button_id;

	if (id==-1) id=gui_keyboard();

		// clicking

	if (id==-1) {
		id=gui_click();
		if (id!=-1) hud_click();
	}
		
	if (id==-1) return;

		// handle click
	
	switch (id) {
	
			// tab
			
		case setup_game_tab_id:
			setup_tab_value=element_get_value(setup_game_tab_id);
			setup_game_create_pane();
			return;
			
			// buttons
			
		case setup_game_ok_button_id:
			setup_close_save_flag=TRUE;
			setup_game_done();
			return;
			
		case setup_game_cancel_button_id:
			setup_close_save_flag=FALSE;
			setup_game_done();
			return;

		case setup_game_default_button_id:
			setup_game_default();
			return;
			
		case setup_action_set_button_id:
			setup_action_scroll_pos=element_get_scroll_position(ctrl_action_id);
			setup_action_set_flag=TRUE;
			input_clear();
			input_set_key_start();
			return;
			
		case setup_action_clear_button_id:
			setup_action_scroll_pos=element_get_scroll_position(ctrl_action_id);
			setup_game_action_clear();
			element_set_scroll_position(ctrl_action_id,setup_action_scroll_pos);
			return;
	
			// video pane
			
		case ctrl_screen_gl_size_id:
			idx=element_get_value(ctrl_screen_gl_size_id);
			if (idx==0) {
				setup.screen_wid=setup.screen_high=-1;
			}
			else {
				setup.screen_wid=render_info.screen_sizes[idx-1].wid;
				setup.screen_high=render_info.screen_sizes[idx-1].high;
			}
			break;
			
		case ctrl_decal_on_id:
			setup.decal_on=element_get_value(ctrl_decal_on_id);
			break;

		case ctrl_shadow_on_id:
			setup.shadow_on=element_get_value(ctrl_shadow_on_id);
			break;
			
		case ctrl_fsaa_id:
			setup.fsaa_mode=element_get_value(ctrl_fsaa_id);
			break;
			
		case ctrl_gamma_id:
			setup.gamma=element_get_slider_value(ctrl_gamma_id);
			break;
			
			// audio pane
			
		case ctrl_sound_volume_id:
			setup.sound_volume=element_get_slider_value(ctrl_sound_volume_id);
			break;

		case ctrl_music_on_id:
			setup.music_on=element_get_value(ctrl_music_on_id);
			break;
			
		case ctrl_music_volume_id:
			setup.music_volume=element_get_slider_value(ctrl_music_volume_id);
			break;
			
			// mouse pane
			
		case ctrl_always_run_id:
			setup.always_run=element_get_value(ctrl_always_run_id);
			break;
			
		case ctrl_toggle_run_id:
			setup.toggle_run=element_get_value(ctrl_toggle_run_id);
			break;
			
		case ctrl_invert_look_id:
			setup.invert_look=element_get_value(ctrl_invert_look_id);
			break;

		case ctrl_auto_aim_id:
			setup.auto_aim=element_get_value(ctrl_auto_aim_id);
			break;
			
		case ctrl_mouse_smooth_id:
			setup.mouse_smooth=element_get_value(ctrl_mouse_smooth_id);
			break;
			
		case ctrl_mouse_speed_id:
			setup.mouse.speed=element_get_slider_value(ctrl_mouse_speed_id);
			break;
			
		case ctrl_mouse_accel_id:
			setup.mouse.acceleration=element_get_slider_value(ctrl_mouse_accel_id);
			break;
			
		case ctrl_joystick_speed_id:
			setup.joystick.speed=element_get_slider_value(ctrl_joystick_speed_id);
			break;

		case ctrl_joystick_accel_id:
			setup.joystick.acceleration=element_get_slider_value(ctrl_joystick_accel_id);
			break;
		
			// action pane
			
		case ctrl_action_id:
			setup_game_action_enable_buttons();
			break;

			// player pane

		case ctrl_network_name_id:
			element_get_value_string(ctrl_network_name_id,setup.network.name);
			break;

		case ctrl_network_show_names_id:
			setup.network.show_names=element_get_value(ctrl_network_show_names_id);
			break;

		case ctrl_character_id:
			setup.network.character_idx=element_get_value(ctrl_character_id);
			mp_character=&iface.multiplayer.character_list.characters[setup.network.character_idx];
			element_replace_model(ctrl_character_model_id,mp_character->model_name,"Idle",mp_character->interface_resize,&mp_character->interface_offset,NULL);
			break;

			// debug pane

		case ctrl_debug_engine_windowed_id:
			setup.window=element_get_value(ctrl_debug_engine_windowed_id);
			break;

		case ctrl_debug_editor_windowed_id:
			setup.window_editor=element_get_value(ctrl_debug_editor_windowed_id);
			break;

		case ctrl_debug_no_hud_id:
			setup.no_hud=element_get_value(ctrl_debug_no_hud_id);
			break;

		case ctrl_debug_no_draw_weapon_id:
			setup.no_draw_weapon=element_get_value(ctrl_debug_no_draw_weapon_id);
			break;

		case ctrl_debug_metrics_on_id:
			setup.metrics_on=element_get_value(ctrl_debug_metrics_on_id);
			break;

		case ctrl_debug_debug_on_id:
			setup.debug_on=element_get_value(ctrl_debug_debug_on_id);
			break;

		case ctrl_debug_ignore_fps_lock_id:
			setup.ignore_fps_lock=element_get_value(ctrl_debug_ignore_fps_lock_id);
			break;

	}
}
Exemple #7
0
int main(int argc, char *argv[])
{
    byte keypress;

    client_init();

    if( argc > 1 )    /* Command line arguments */
	handle_cl_args(argc, argv);

    srand( time(NULL) );
    calc_lookup_tables(DEGREES);
    win_init();
    entity_init();
    if( (ent_img_loaded = (char *)malloc(num_entity_types)) == NULL ) {
	perror("Malloc");
	ERR_QUIT("Error allocating ent_img_loaded array", 1);
    } else {
	memset(ent_img_loaded, 0, num_entity_types);
    }

    /* Load client preferences from file */
    read_config_file( &client );
    /* Set view dimensions, which are calculated by tile width & heights */
    client.view_w = client.x_tiles * TILE_W;
    client.view_h = client.y_tiles * TILE_H;
    /* What the client WISHES their dimensions were (this may not be what
       it actually is, ie in demo's etc */
    client.desired_w = client.view_w;
    client.desired_h = client.view_h;

    weapon_type_init();
    particle_init();
    menu_init();

    cl_network_init();

    client.state = MENU;

    if( client.demo == DEMO_PLAY ) {
	cl_network_connect(NULL, 42);
	client.state = GAME_LOAD;
    }

    for( ; ; ) {
	switch( client.state ) {
	case MENU:
	    win_ungrab_pointer();
	    menu_driver();
	    break;

	case GAME_LOAD:
	    win_set_properties(VERSION, client.view_w, client.view_h+STATUS_H);
	    wait_till_expose(5);

	    /* Finished loading, we are ready to play */
	    cl_change_map(client.map, client.gamemode);
	    break;

	case GAME_RESUME: /* Resume game from menu */
	    win_set_properties(VERSION, client.view_w, client.view_h+STATUS_H);
	    wait_till_expose(5);
	    input_clear();
	    draw_status_bar();
	    cl_netmsg_send_ready(); /* Tell server new details */
	    cl_net_finish(); /* Send the NETMSG_READY to the server */
	    client.state = GAME_JOIN;

	    break;

	case GAME_JOIN:

        win_set_cursor( client.mousemode!=MOUSEMODE_ROTATE );
        win_set_cursor( 1 );


	    if( client.mousemode ) {
		win_grab_pointer();
	    }

	    text_buf_clear();
	    particle_clear();

	case GAME_PLAY:
	    cl_net_update();

	    if( client.state == GAME_PLAY ) { /* Maybe changed in net_update */
		draw_crosshair( my_entity );
		if( client.map_target_active )
		    draw_map_target( my_entity );

		text_buf_update();
		if( client.netstats )
		    cl_net_stats();

		win_update();

		/* Keyboard Input */
		client.dir = my_entity.dir;
		keypress = get_input();
		cl_netmsg_send_cl_update(keypress, client.dir);
	    }

	    cl_net_finish(); /* Send things that need sending */
	    cap_fps(client.fps);
	    break;

	case QUIT:
	    game_close();
	    image_close(); /* Free all the images */
	    win_close();
	    write_config_file(&client);
	    if( ent_img_loaded != NULL )
		free(ent_img_loaded);
	    exit(EXIT_SUCCESS);
	    break;
	}

    }

    return EXIT_SUCCESS;

}