Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
void bitmap_texture_write_xml(texture_type *texture,int frame_count,bool write_scale)
{
	int						k;
	
		// settings
		
	xml_add_attribute_boolean("animate",texture->animate.on);
	xml_add_attribute_boolean("additive",texture->additive);
	xml_add_attribute_boolean("pixelated",texture->pixelated);
	xml_add_attribute_boolean("compress",texture->compress);
	xml_add_attribute_boolean("flip_normal",texture->flip_normal);

	xml_add_attribute_float("shine_factor",texture->shine_factor);
	xml_add_attribute_list("rl_alpha_type",(char*)rtl_alpha_list_str,texture->rl_alpha_type);
	xml_add_attribute_float("rl_refract_factor",texture->rl_refract_factor);
	
	xml_add_attribute_int("glow_rate",texture->glow.rate);
	xml_add_attribute_float("glow_min",texture->glow.min);
	xml_add_attribute_float("glow_max",texture->glow.max);
	
	xml_add_attribute_text("shader",texture->shader_name);
	xml_add_attribute_text("material_name",texture->material_name);
	
	xml_add_tagend(FALSE);

		// scale
		
	if (write_scale) {
		xml_add_tagstart("Scale");
		xml_add_attribute_float("x",texture->scale.uv_size.x);
		xml_add_attribute_float("y",texture->scale.uv_size.y);
		xml_add_attribute_float("x_off",texture->scale.uv_offset.x);
		xml_add_attribute_float("y_off",texture->scale.uv_offset.y);
		xml_add_tagend(TRUE);
	}
	
		// images
		
	xml_add_tagstart("Images");
	xml_add_tagend(FALSE);
		
	for (k=0;k!=frame_count;k++) {
		xml_add_tagstart("Image");
		if (texture->animate.wait[k]!=0) xml_add_attribute_int("wait",texture->animate.wait[k]);
		if (texture->frames[k].name[0]!=0x0) xml_add_attribute_text("bitmap",texture->frames[k].name);
		xml_add_tagend(TRUE);
	}
	
	xml_add_tagclose("Images");
}
Exemplo n.º 4
0
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);
}
Exemplo n.º 5
0
void encode_mesh_v2_xml(model_type *model)
{
	int						i,n,k,j,frame_count;
	char					tag_name[32];
	model_hit_box_type		*hit_box;
	model_mesh_type			*mesh;
    model_vertex_type		*vertex;
	model_material_type		*material;
    model_bone_type			*bone;
    model_trig_type			*trig;
    texture_type			*texture;
    
        // model info
    
    xml_add_tagstart("Creator");
    xml_add_attribute_text("name","dim3 Animator");
    xml_add_attribute_text("version","1.0");
    xml_add_tagend(TRUE);
	
        // options
    
    xml_add_tagstart("Options");
	xml_add_attribute_list("deform",(char*)deform_mode_str,model->deform_mode);
    xml_add_tagend(TRUE);
 	
        // center
	
    xml_add_tagstart("Center");
    xml_add_attribute_3_coord_int("offset",model->center.x,model->center.y,model->center.z);
    xml_add_tagend(TRUE);
    
        // boxes
    
    xml_add_tagstart("View_Box");
    xml_add_attribute_3_coord_int("size",model->view_box.size.x,model->view_box.size.y,model->view_box.size.z);
    xml_add_attribute_3_coord_int("offset",model->view_box.offset.x,model->view_box.offset.y,model->view_box.offset.z);
    xml_add_tagend(TRUE);
	
		// light
	
    xml_add_tagstart("Light");

	for (k=0;k!=max_model_light;k++) {
		if (k==0) {
			strcpy(tag_name,"light_bone");
		}
		else {
			sprintf(tag_name,"light_bone_%d",k);
		}
		xml_add_attribute_model_tag(tag_name,model->tags.light_bone_tag[k]);
	}

	for (k=0;k!=max_model_halo;k++) {
		if (k==0) {
			strcpy(tag_name,"halo_bone");
		}
		else {
			sprintf(tag_name,"halo_bone_%d",k);
		}
 		xml_add_attribute_model_tag(tag_name,model->tags.halo_bone_tag[k]);
	}

 	xml_add_attribute_model_tag("name_bone",model->tags.name_bone_tag);

	xml_add_tagend(TRUE);
	
		// hit boxes
		
    xml_add_tagstart("Hit_Boxes");
    xml_add_tagend(FALSE);
    
    hit_box=model->hit_boxes;
    
    for (i=0;i!=model->nhit_box;i++) {
		xml_add_tagstart("Hit_Box");
		xml_add_attribute_text("name",hit_box->name);
		xml_add_attribute_3_coord_int("size",hit_box->box.size.x,hit_box->box.size.y,hit_box->box.size.z);
		xml_add_attribute_3_coord_int("offset",hit_box->box.offset.x,hit_box->box.offset.y,hit_box->box.offset.z);
		xml_add_tagend(TRUE);
		
		hit_box++;
	}
	
    xml_add_tagclose("Hit_Boxes");
    
        // bones
        
    xml_add_tagstart("Bones");
    xml_add_tagend(FALSE);
    
    bone=model->bones;
    
    for (i=0;i!=model->nbone;i++) {
    
        xml_add_tagstart("Bone");
        
        xml_add_attribute_model_tag("tag",bone->tag);
		xml_add_attribute_text("name",bone->name);
		
        xml_add_attribute_3_coord_int("c3",bone->pnt.x,bone->pnt.y,bone->pnt.z);
		
        if (bone->parent_idx!=-1) xml_add_attribute_model_tag("parent",model->bones[bone->parent_idx].tag);
        
        xml_add_tagend(TRUE);
    
        bone++;
    }

    xml_add_tagclose("Bones");
	
        // meshes
        
    xml_add_tagstart("Meshes");
    xml_add_tagend(FALSE);
	
	for (j=0;j!=model->nmesh;j++) {
	
		mesh=&model->meshes[j];
	
		xml_add_tagstart("Mesh");
		xml_add_attribute_text("name",mesh->name);
		xml_add_attribute_boolean("no_lighting",mesh->no_lighting);
		xml_add_attribute_boolean("additive",mesh->blend_add);
		xml_add_attribute_boolean("tintable",mesh->tintable);
		xml_add_tagend(FALSE);
	   
			// vertexes
			
		xml_add_tagstart("Vertexes");
		xml_add_tagend(FALSE);
		
		vertex=mesh->vertexes;
		
		for (i=0;i!=mesh->nvertex;i++) {
		
			xml_add_tagstart("v");
			
			xml_add_attribute_3_coord_int("c3",vertex->pnt.x,vertex->pnt.y,vertex->pnt.z);
			xml_add_attribute_3_coord_float("n3",vertex->normal.x,vertex->normal.y,vertex->normal.z);

			if (vertex->major_bone_idx!=-1) {
				xml_add_attribute_model_tag("major",model->bones[vertex->major_bone_idx].tag);
			}
			if (vertex->minor_bone_idx!=-1) {
				xml_add_attribute_model_tag("minor",model->bones[vertex->minor_bone_idx].tag);
				xml_add_attribute_float("factor",vertex->bone_factor);
			}
			
			xml_add_tagend(TRUE);
		
			vertex++;
		}
						
		xml_add_tagclose("Vertexes");
		
			// materials
			
		xml_add_tagstart("Materials");
		xml_add_tagend(FALSE);
		
		texture=model->textures;
		material=mesh->materials;
		
		for (n=0;n!=max_model_texture;n++) {
		
			if (texture->frames[0].name[0]==0x0) {
				texture++;
				material++;
				continue;
			}
			
			xml_add_tagstart("Material");
			xml_add_tagend(FALSE);

				// triangles
				
			xml_add_tagstart("Triangles");
			xml_add_tagend(FALSE);
		
			trig=&mesh->trigs[material->trig_start];
		
			for (i=0;i!=material->trig_count;i++) {
		
				for (k=0;k!=3;k++) {
					xml_add_tagstart("v");
					
					xml_add_attribute_int("id",trig->v[k]);
					xml_add_attribute_2_coord_float("uv",trig->gx[k],trig->gy[k]);
					
					xml_add_tagend(TRUE);
				}
				
				trig++;
			}
			
			xml_add_tagclose("Triangles");
			xml_add_tagclose("Material");
			
			texture++;
			material++;
		}
		
		xml_add_tagclose("Materials");
		
		xml_add_tagclose("Mesh");
	}
	
	xml_add_tagclose("Meshes");
   
         // fills
         
    xml_add_tagstart("Fills");
    xml_add_tagend(FALSE);
    
    texture=model->textures;
    
    for (n=0;n!=max_model_texture;n++) {
    
        if (texture->frames[0].name[0]==0x0) {
            texture++;
            continue;
        }

		frame_count=model_count_texture_frames(model,n);
        
        xml_add_tagstart("Fill");
		bitmap_texture_write_xml(texture,frame_count,FALSE);
        xml_add_tagclose("Fill");
        
		texture++;
    }
    
    xml_add_tagclose("Fills");
}
Exemplo n.º 6
0
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);
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
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);
}
Exemplo n.º 9
0
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);
}