static int conf_click(int b, int d) { if (gui_click(b, d)) return conf_action(gui_token(gui_active())); return 1; }
static int conf_click(int b, int d) { if (gui_click(b, d)) return conf_action(gui_token(gui_active())); else if (gui_click_right(b, d)) return goto_state(&st_title); return 1; }
int common_click(int b, int d) { if (gui_click(b, d)) { int active = gui_active(); return common_action(gui_token(active), gui_value(active)); } return 1; }
int name_click(int b, int d) { if (gui_click(b, d)) return st_buttn(config_get_d(CONFIG_JOYSTICK_BUTTON_A), 1); else { SDL_StopTextInput(); return 1; } }
static int resol_click(int b, int d) { if (gui_click(b, d)) { int active = gui_active(); return resol_action(gui_token(active), gui_value(active)); } return 1; }
static int party_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return party_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return party_action(PARTY_B); } return 1; }
static int title_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return title_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return title_action(TITLE_EXIT); } return 1; }
static int course_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return course_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return course_action(COURSE_BACK); } return 1; }
static int demo_del_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return demo_del_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return demo_del_action(DEMO_KEEP); } return 1; }
static int set_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return set_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return set_action(GUI_BACK); } return 1; }
static int pause_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return pause_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return pause_action(PAUSE_CONTINUE); } return 1; }
static int time_out_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return time_out_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return time_out_action(TIME_OUT_BACK); } return 1; }
static int start_click(int b, int d) { if (gui_click(b, d)) { return start_buttn(config_get_d(CONFIG_JOYSTICK_BUTTON_A), 1); } else if (gui_click_right(b, d)) { return start_buttn(config_get_d(CONFIG_JOYSTICK_BUTTON_B), 1); } return 1; }
static int start_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return start_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_B, b)) return goto_state(&st_title); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) return goto_state(&st_title); } return 1; }
static int demo_end_buttn(int b, int d) { if (d) { if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b)) return demo_end_action(gui_token(gui_click())); if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b)) { if (demo_paused) return demo_end_action(DEMO_CONTINUE); else return demo_end_action(standalone ? DEMO_QUIT : DEMO_KEEP); } } return 1; }
// returns 0 iff a command is created to be put on the network int mod_mkcmd(FCMD_t *c, int device, int sym, int press) { int i; // apply magic command? if( device==-1 ) { if( !magic_c.datasz ) return -1; memcpy(c, &magic_c, sizeof magic_c); memset(&magic_c, 0, sizeof magic_c); return 0; } for( i=0; i<binds_size; i++ ) { if( binds[i].sym!=sym || binds[i].device!=device || binds[i].press!=press ) continue; memset( c, 0, sizeof *c ); if( binds[i].script ) { command( binds[i].script ); return -1; } c->cmd = binds[i].cmd; if( c->cmd==CMDT_1EPAINT || c->cmd==CMDT_0EPAINT ) if( gui_click( press ) ) return -1; if( editmode ) return proc_edit_cmd(c, device, sym, press); return c->cmd<=CMDT_1CON ? 0 : -1; } return -1; }
static int pause_click(int b, int d) { return d && b == SDL_BUTTON_LEFT ? pause_action(gui_token(gui_click())) : 1; }
void file_click(void) { int id,k; char err_str[256],file_name[256]; id=-1; // keyboard if (input_get_keyboard_escape()) id=file_button_cancel_id; if (input_get_keyboard_return()) id=file_is_save?file_button_save_id:file_button_load_id; // clicking if (id==-1) { id=gui_click(); if (id!=-1) hud_click(); } if (id==-1) return; // handle click switch (id) { case file_button_save_id: if (!game_file_save(FALSE,FALSE,err_str)) console_add_error(err_str); server.next_state=gs_running; break; case file_button_load_id: k=element_get_value(file_info_table_id); if (k==-1) break; element_get_table_column_data(file_info_table_id,k,1,file_name,256); server.next_state=gs_running; if (game_file_load(file_name,FALSE,err_str)) { game_time_pause_end(); break; } if (server.map_open) map_end(); if (server.game_open) game_end(); error_setup(err_str,"Game Load Canceled"); server.next_state=gs_error; break; case file_button_delete_id: file_save_delete(); break; case file_button_cancel_id: server.next_state=file_last_state; break; case file_info_table_id: file_save_selected(); break; } }
static int pause_click(int b, int d) { return gui_click(b, d) ? pause_action(gui_token(gui_active())) : 1; }
static int start_click(int b, int d) { if (d && b < 0) return start_action(gui_token(gui_click())); return 1; }
static int title_click(int b, int d) { if (d && b < 0) return title_action(gui_token(gui_click())); return 1; }
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; } }