bool write_mesh_xml(model_type *model) { char path[1024]; bool ok; // start xml_new_file(); xml_add_tagstart("Model"); xml_add_attribute_int("version",2); xml_add_tagend(FALSE); // encode encode_mesh_v2_xml(model); // save model xml_add_tagclose("Model"); sprintf(path,"%s/mesh.xml",model->load_base_path); ok=xml_save_file(path); xml_close_file(); return(ok); }
bool iface_write_settings_singleplayer(iface_type *iface,char *err_str) { int n; char path[1024]; bool ok; iface_sp_option_type *sp_option; // start new file xml_new_file(); // singleplayer xml_add_tagstart("Singleplayer"); xml_add_tagend(FALSE); // settings xml_add_tagstart("Settings"); xml_add_attribute_boolean("skill",iface->singleplayer.skill); xml_add_attribute_boolean("map_pick",iface->singleplayer.map_pick); xml_add_attribute_int("map_pick_ss_reveal_id",iface->singleplayer.map_pick_ss_reveal_id); xml_add_tagend(TRUE); // options xml_add_tagstart("Options"); xml_add_tagend(FALSE); sp_option=iface->singleplayer.option_list.options; for (n=0;n!=iface->singleplayer.option_list.noption;n++) { xml_add_tagstart("Option"); xml_add_attribute_text("name",sp_option->name); xml_add_attribute_text("description",sp_option->descript); xml_add_attribute_int("ss_reveal_id",sp_option->ss_reveal_id); xml_add_tagend(TRUE); sp_option++; } xml_add_tagclose("Options"); xml_add_tagclose("Singleplayer"); // write the xml file_paths_data(&file_path_setup,path,"Settings","Singleplayer","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],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 write_pose_xml(model_type *model) { int n,k; char path[1024]; bool ok; model_bone_move_type *bone_move; model_pose_type *pose; xml_new_file(); xml_add_tagstart("Model"); xml_add_tagend(FALSE); // model info xml_add_tagstart("Creator"); xml_add_attribute_text("name","dim3 Animator"); xml_add_attribute_text("version","1.0"); xml_add_tagend(TRUE); // poses xml_add_tagstart("Poses"); xml_add_tagend(FALSE); pose=model->poses; for (n=0;n!=model->npose;n++) { xml_add_tagstart("Pose"); xml_add_attribute_text("name",pose->name); xml_add_tagend(FALSE); xml_add_tagstart("Bones"); xml_add_tagend(FALSE); bone_move=pose->bone_moves; for (k=0;k!=model->nbone;k++) { if (write_bone_move(bone_move)) { xml_add_tagstart("Bone"); xml_add_attribute_model_tag("tag",model->bones[k].tag); xml_add_attribute_3_coord_float("rot",bone_move->rot.x,bone_move->rot.y,bone_move->rot.z); xml_add_attribute_3_coord_float("move",bone_move->mov.x,bone_move->mov.y,bone_move->mov.z); xml_add_attribute_float("acceleration",bone_move->acceleration); xml_add_attribute_boolean("skip_blended",bone_move->skip_blended); if (bone_move->constraint.bone_idx!=-1) { xml_add_attribute_model_tag("constraint_bone",model->bones[bone_move->constraint.bone_idx].tag); xml_add_attribute_3_coord_int("constraint_offset",bone_move->constraint.offset.x,bone_move->constraint.offset.y,bone_move->constraint.offset.z); } xml_add_tagend(TRUE); } bone_move++; } xml_add_tagclose("Bones"); xml_add_tagclose("Pose"); pose++; } xml_add_tagclose("Poses"); // finish model xml_add_tagclose("Model"); sprintf(path,"%s/pose.xml",model->load_base_path); ok=xml_save_file(path); xml_close_file(); return(ok); }
bool iface_write_settings_halo(iface_type *iface,char *err_str) { int n; char path[1024]; bool ok; iface_halo_type *halo; // start new file xml_new_file(); xml_add_tagstart("Halos"); xml_add_tagend(FALSE); halo=iface->halo_list.halos; for (n=0;n!=iface->halo_list.nhalo;n++) { xml_add_tagstart("Halo"); xml_add_attribute_text("name",halo->name); xml_add_tagend(FALSE); xml_add_tagstart("Image"); xml_add_attribute_text("file",halo->bitmap_name); xml_add_tagend(TRUE); xml_add_tagstart("Distance"); xml_add_attribute_int("min",halo->min_dist); xml_add_attribute_int("max",halo->max_dist); xml_add_tagend(TRUE); xml_add_tagstart("Size"); xml_add_attribute_int("min",halo->min_size); xml_add_attribute_int("max",halo->max_size); xml_add_tagend(TRUE); xml_add_tagstart("Alpha"); xml_add_attribute_float("min",halo->min_alpha); xml_add_attribute_float("max",halo->max_alpha); xml_add_tagend(TRUE); xml_add_tagstart("Option"); xml_add_attribute_boolean("no_clip_object",halo->no_clip_object); xml_add_attribute_boolean("no_clip_self",halo->no_clip_self); xml_add_tagend(TRUE); xml_add_tagclose("Halo"); halo++; } xml_add_tagclose("Halos"); // write the xml file_paths_data(&file_path_setup,path,"Settings","Halos","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); }
bool iface_write_settings_ring(iface_type *iface,char *err_str) { int n; char path[1024]; bool ok; iface_ring_type *ring; // start new file xml_new_file(); xml_add_tagstart("Rings"); xml_add_tagend(FALSE); ring=iface->ring_list.rings; for (n=0;n!=iface->ring_list.nring;n++) { xml_add_tagstart("Ring"); xml_add_attribute_text("name",ring->name); xml_add_tagend(FALSE); xml_add_tagstart("Settings"); xml_add_attribute_int("time",ring->life_msec); xml_add_attribute_boolean("additive",ring->blend_add); xml_add_tagend(TRUE); xml_add_tagstart("Image"); xml_add_attribute_text("file",ring->bitmap_name); xml_add_attribute_int("count",ring->animate.image_count); xml_add_attribute_int("time",ring->animate.msec); xml_add_attribute_boolean("loop",ring->animate.loop); xml_add_attribute_boolean("loop_back",ring->animate.loop_back); xml_add_tagend(TRUE); xml_add_tagstart("Outer"); xml_add_attribute_int("start",ring->start_outer_size); xml_add_attribute_int("end",ring->end_outer_size); xml_add_tagend(TRUE); xml_add_tagstart("Inner"); xml_add_attribute_int("start",ring->start_inner_size); xml_add_attribute_int("end",ring->end_inner_size); xml_add_tagend(TRUE); xml_add_tagstart("Rotate"); xml_add_attribute_float("x",ring->ang.x); xml_add_attribute_float("y",ring->ang.y); xml_add_attribute_float("z",ring->ang.z); xml_add_attribute_float("x_add",ring->rot.x); xml_add_attribute_float("y_add",ring->rot.y); xml_add_attribute_float("z_add",ring->rot.z); xml_add_attribute_float("x_accel",ring->rot_accel.x); xml_add_attribute_float("y_accel",ring->rot_accel.y); xml_add_attribute_float("z_accel",ring->rot_accel.z); xml_add_tagend(TRUE); xml_add_tagstart("Move"); xml_add_attribute_float("x",ring->vct.x); xml_add_attribute_float("y",ring->vct.y); xml_add_attribute_float("z",ring->vct.z); xml_add_tagend(TRUE); xml_add_tagstart("Color"); xml_add_attribute_color("start",&ring->start_color); xml_add_attribute_color("end",&ring->end_color); xml_add_tagend(TRUE); xml_add_tagstart("Alpha"); xml_add_attribute_float("start",ring->start_alpha); xml_add_attribute_float("end",ring->end_alpha); xml_add_tagend(TRUE); xml_add_tagclose("Ring"); ring++; } xml_add_tagclose("Rings"); // write the xml file_paths_data(&file_path_setup,path,"Settings","Rings","xml"); ok=xml_save_file(path,err_str); xml_close_file(); return(ok); }