bool setup_xml_write(void) { int n,k; char path[1024],tag_name[32],err_str[256]; bool ok; setup_action_type *action; // start the setup file xml_new_file(); xml_add_tagstart("Setup"); xml_add_tagend(FALSE); // keys xml_key_write_int("Screen_Width",setup.screen_wid); xml_key_write_int("Screen_Height",setup.screen_high); xml_key_write_float("Gamma",setup.gamma); xml_key_write_int("FSAA_Mode",setup.fsaa_mode); xml_key_write_boolean("Decal_On",setup.decal_on); xml_key_write_boolean("Shadow_On",setup.shadow_on); xml_key_write_float("Sound_Volume",setup.sound_volume); xml_key_write_boolean("Music_On",setup.music_on); xml_key_write_float("Music_Volume",setup.music_volume); xml_key_write_boolean("Always_Run",setup.always_run); xml_key_write_boolean("Toggle_Run",setup.toggle_run); xml_key_write_boolean("Invert_Look",setup.invert_look); xml_key_write_boolean("Auto_Aim",setup.auto_aim); xml_key_write_boolean("Mouse_Smooth",setup.mouse_smooth); xml_key_write_float("Mouse_Speed",setup.mouse.speed); xml_key_write_float("Mouse_Acceleration",setup.mouse.acceleration); xml_key_write_float("Joystick_Speed",setup.joystick.speed); xml_key_write_float("Joystick_Acceleration",setup.joystick.acceleration); xml_key_write_text("Network_Name",setup.network.name); xml_key_write_int("Character",setup.network.character_idx); xml_key_write_int("Tint",setup.network.tint_color_idx); xml_key_write_text("Network_Custom_Host_IP",setup.network.custom_host_ip); xml_key_write_int("Host_Bot_Count",setup.network.bot.count); xml_key_write_int("Host_Bot_Skill",setup.network.bot.skill); xml_key_write_int("Host_Game_Type",setup.network.game_type); xml_key_write_int("Host_Score_Limit",setup.network.score_limit); xml_key_write_int("Host_Game_Reset_Secs",setup.network.game_reset_secs); xml_key_write_int("Host_Respawn_Secs",setup.network.respawn_secs); xml_key_write_boolean("Network_Show_Names",setup.network.show_names); xml_key_write_boolean("Network_Map_Rotation",setup.network.map_rotation); xml_key_write_boolean("Window",setup.window); xml_key_write_boolean("Window_Editor",setup.window_editor); xml_key_write_boolean("No_HUD",setup.no_hud); xml_key_write_boolean("No_Draw_Weapon",setup.no_draw_weapon); xml_key_write_boolean("Metrics_On",setup.metrics_on); xml_key_write_boolean("Debug_On",setup.debug_on); xml_key_write_boolean("Ignore_FPS_Lock",setup.ignore_fps_lock); xml_key_write_int("Screen_dim3RTL_Width",setup.screen_rtl_wid); xml_key_write_int("Screen_dim3RTL_Height",setup.screen_rtl_high); xml_key_write_boolean("Screen_dim3RTL_Full_Window",setup.screen_rtl_full_window); // actions xml_add_tagstart("Actions"); xml_add_tagend(FALSE); action=setup.action_list.actions; for (n=0;n!=setup.action_list.naction;n++) { xml_add_tagstart("Action"); xml_add_attribute_text("name",action->name); for (k=0;k!=max_setup_action_attach;k++) { if (action->attach[k][0]!=0x0) { sprintf(tag_name,"attach_%d",k); xml_add_attribute_text(tag_name,action->attach[k]); } } xml_add_tagend(TRUE); action++; } xml_add_tagclose("Actions"); // maps xml_add_tagstart("Maps"); xml_add_tagend(FALSE); for (n=0;n!=setup.network.map_list.count;n++) { xml_add_tagstart("Map"); xml_add_attribute_text("name",setup.network.map_list.maps[n].name); xml_add_tagend(TRUE); } xml_add_tagclose("Maps"); // options xml_add_tagstart("Options"); xml_add_tagend(FALSE); for (n=0;n!=setup.network.option_list.count;n++) { xml_add_tagstart("Option"); xml_add_attribute_text("name",setup.network.option_list.options[n].name); xml_add_tagend(TRUE); } xml_add_tagclose("Options"); // close setup xml_add_tagclose("Setup"); // save the setup // always save to user specific data file_paths_app_data(&file_path_setup,path,"Settings","Setup","xml"); ok=xml_save_file(path,err_str); xml_close_file(); return(ok); }
bool setup_xml_write(void) { int n,k; char path[1024],tag_name[32]; bool ok; setup_action_type *action; setup_network_hosts_type *host; setup_network_option_type *option; // start the setup file xml_new_file(); xml_add_tagstart("Setup"); xml_add_tagend(FALSE); // keys xml_key_write_int("Screen_Width",setup.screen_wid); xml_key_write_int("Screen_Height",setup.screen_high); xml_key_write_boolean("Lock_FPS_Refresh",setup.lock_fps_refresh); xml_key_write_float("Gamma",setup.gamma); xml_key_write_int("Tint",setup.tint_color_idx); xml_key_write_boolean("Texture_Compression",setup.texture_compression); xml_key_write_int("Anisotropic_Mode",setup.anisotropic_mode); xml_key_write_int("Mipmap_Mode",setup.mipmap_mode); xml_key_write_int("FSAA_Mode",setup.fsaa_mode); xml_key_write_boolean("Decal_On",setup.decal_on); xml_key_write_boolean("Shadow_On",setup.shadow_on); xml_key_write_float("Sound_Volume",setup.sound_volume); xml_key_write_boolean("Music_On",setup.music_on); xml_key_write_float("Music_Volume",setup.music_volume); xml_key_write_boolean("Always_Run",setup.always_run); xml_key_write_boolean("Toggle_Run",setup.toggle_run); xml_key_write_boolean("Invert_Look",setup.invert_look); xml_key_write_boolean("Mouse_Smooth",setup.mouse_smooth); xml_key_write_float("Mouse_X_Speed",setup.mouse_x.speed); xml_key_write_float("Mouse_X_Speed_Min",setup.mouse_x.speed_min); xml_key_write_float("Mouse_X_Speed_Max",setup.mouse_x.speed_max); xml_key_write_float("Mouse_X_Acceleration",setup.mouse_x.acceleration); xml_key_write_float("Mouse_X_Acceleration_Min",setup.mouse_x.acceleration_min); xml_key_write_float("Mouse_X_Acceleration_Max",setup.mouse_x.acceleration_max); xml_key_write_float("Mouse_Y_Speed",setup.mouse_y.speed); xml_key_write_float("Mouse_Y_Speed_Min",setup.mouse_y.speed_min); xml_key_write_float("Mouse_Y_Speed_Max",setup.mouse_y.speed_max); xml_key_write_float("Mouse_Y_Acceleration",setup.mouse_y.acceleration); xml_key_write_float("Mouse_Y_Acceleration_Min",setup.mouse_y.acceleration_min); xml_key_write_float("Mouse_Y_Acceleration_Max",setup.mouse_y.acceleration_max); xml_key_write_float("Joystick_X_Speed",setup.joystick_x.speed); xml_key_write_float("Joystick_X_Speed_Min",setup.joystick_x.speed_min); xml_key_write_float("Joystick_X_Speed_Max",setup.joystick_x.speed_max); xml_key_write_float("Joystick_X_Acceleration",setup.joystick_x.acceleration); xml_key_write_float("Joystick_X_Acceleration_Min",setup.joystick_x.acceleration_min); xml_key_write_float("Joystick_X_Acceleration_Max",setup.joystick_x.acceleration_max); xml_key_write_float("Joystick_Y_Speed",setup.joystick_y.speed); xml_key_write_float("Joystick_Y_Speed_Min",setup.joystick_y.speed_min); xml_key_write_float("Joystick_Y_Speed_Max",setup.joystick_y.speed_max); xml_key_write_float("Joystick_Y_Acceleration",setup.joystick_y.acceleration); xml_key_write_float("Joystick_Y_Acceleration_Min",setup.joystick_y.acceleration_min); xml_key_write_float("Joystick_Y_Acceleration_Max",setup.joystick_y.acceleration_max); xml_key_write_int("Joystick_Mode",setup.joystick_mode); xml_key_write_text("Network_Name",setup.network.name); xml_key_write_text("Network_Last_Map",setup.network.last_map); xml_key_write_int("Host_Bot_Count",setup.network.bot.count); xml_key_write_int("Host_Bot_Skill",setup.network.bot.skill); xml_key_write_int("Host_Game_Type",setup.network.game_type); xml_key_write_int("Host_Score_Limit",setup.network.score_limit); xml_key_write_boolean("Network_Show_Names",setup.network.show_names); xml_key_write_boolean("Debug_Console",setup.debug_console); xml_key_write_boolean("Window",setup.window); xml_key_write_boolean("Window_Editor",setup.window_editor); // actions xml_add_tagstart("Actions"); xml_add_tagend(FALSE); action=setup.action_list.actions; for (n=0;n!=setup.action_list.naction;n++) { xml_add_tagstart("Action"); xml_add_attribute_text("name",action->name); for (k=0;k!=max_setup_action_attach;k++) { if (action->attach[k][0]!=0x0) { sprintf(tag_name,"attach_%d",k); xml_add_attribute_text(tag_name,action->attach[k]); } } xml_add_tagend(TRUE); action++; } xml_add_tagclose("Actions"); // hosts xml_add_tagstart("Hosts"); xml_add_tagend(FALSE); host=setup.network.hosts; for (n=0;n!=setup.network.nhost;n++) { xml_add_tagstart("Host"); xml_add_attribute_text("ip",host->ip); xml_add_tagend(TRUE); host++; } xml_add_tagclose("Hosts"); // options xml_add_tagstart("Options"); xml_add_tagend(FALSE); option=setup.network.options; for (n=0;n!=setup.network.noption;n++) { xml_add_tagstart("Option"); xml_add_attribute_text("name",option->name); xml_add_tagend(TRUE); option++; } xml_add_tagclose("Options"); // close setup xml_add_tagclose("Setup"); // save the setup // always save to user specific data file_paths_documents(&setup.file_path_setup,path,"Settings","Setup","xml"); ok=xml_save_file(path); xml_close_file(); return(ok); }