Example #1
0
static void sound_load(int config_type, xml_data_node *parentnode)
{
	xml_data_node *channelnode;
	int mixernum;

	/* we only care about game files */
	if (config_type != CONFIG_TYPE_GAME)
		return;

	/* might not have any data */
	if (parentnode == NULL)
		return;

	/* iterate over channel nodes */
	for (channelnode = xml_get_sibling(parentnode->child, "channel"); channelnode; channelnode = xml_get_sibling(channelnode->next, "channel"))
	{
		mixernum = xml_get_attribute_int(channelnode, "index", -1);
		if (mixernum >= 0 && mixernum < MAX_MIXER_CHANNELS)
		{
			float defvol = xml_get_attribute_float(channelnode, "defvol", -1000.0);
			float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0);
			if (defvol == sound_get_default_gain(mixernum) && newvol != -1000.0)
				sound_set_user_gain(mixernum, newvol);
		}
	}
}
Example #2
0
void laserdisc_device::config_load(config_type cfg_type, xml_data_node *parentnode)
{
	// we only care about game files
	if (cfg_type != config_type::CONFIG_TYPE_GAME)
		return;

	// might not have any data
	if (parentnode == nullptr)
		return;

	// iterate over overlay nodes
	for (xml_data_node *ldnode = xml_get_sibling(parentnode->child, "device"); ldnode != nullptr; ldnode = xml_get_sibling(ldnode->next, "device"))
	{
		const char *devtag = xml_get_attribute_string(ldnode, "tag", "");
		if (strcmp(devtag, tag().c_str()) == 0)
		{
			// handle the overlay node
			xml_data_node *overnode = xml_get_sibling(ldnode->child, "overlay");
			if (overnode != nullptr)
			{
				// fetch positioning controls
				m_overposx = xml_get_attribute_float(overnode, "hoffset", m_overposx);
				m_overscalex = xml_get_attribute_float(overnode, "hstretch", m_overscalex);
				m_overposy = xml_get_attribute_float(overnode, "voffset", m_overposy);
				m_overscaley = xml_get_attribute_float(overnode, "vstretch", m_overscaley);
			}
		}
	}
}
Example #3
0
File: base_xml.c Project: rzel/dim3
void xml_key_read_float(int setup_tag,char *name,float *value)
{
    int			tag;

    tag=xml_findfirstchild(name,setup_tag);
    if (tag!=-1) *value=xml_get_attribute_float(tag,"value");
}
Example #4
0
bool read_pose_xml(model_type *model)
{
	int						n,k,t,npose,pose_idx,cnt,
							tag,model_head,bone_tag,poses_tag,pose_tag,constraint_bone_idx;
	char					sub_path[1024],path[1024];
	model_tag				constraint_bone_tag;
    model_bone_move_type	*bone_move;
	model_pose_type			*pose;

        // load the pose xml
        
	sprintf(sub_path,"Models/%s",model->name);
	file_paths_data(&modelutility_settings.file_path_setup,path,sub_path,"pose","xml");

	if (!xml_open_file(path)) return(FALSE);

    model_head=xml_findrootchild("Model");
    if (model_head==-1) return(FALSE);
    
        // poses
        
    poses_tag=xml_findfirstchild("Poses",model_head);

    npose=xml_countchildren(poses_tag);
	pose_tag=xml_findfirstchild("Pose",poses_tag);
    
    for (n=0;n!=npose;n++) {

			// add new pose

		pose_idx=model_pose_add(model);
		if (pose_idx==-1) {
			xml_close_file();
			return(FALSE);
		}

		pose=&model->poses[pose_idx];

			// set pose data

        xml_get_attribute_text(pose_tag,"name",pose->name,64);
        
        bone_move=pose->bone_moves;
        for (k=0;k!=model->nbone;k++) {
            bone_move->rot.x=bone_move->rot.z=bone_move->rot.y=0.0f;
            bone_move->mov.x=bone_move->mov.z=bone_move->mov.y=1.0f;
			bone_move->acceleration=0;
			bone_move->skip_blended=FALSE;
			bone_move->constraint.bone_idx=-1;
			bone_move->constraint.offset.x=bone_move->constraint.offset.y=bone_move->constraint.offset.z=0;
			bone_move++;
        }
            
        bone_tag=xml_findfirstchild("Bones",pose_tag);
        
        cnt=xml_countchildren(bone_tag);
		tag=xml_findfirstchild("Bone",bone_tag);
        
        for (k=0;k!=cnt;k++) {
		
            t=model_find_bone(model,xml_get_attribute_model_tag(tag,"tag"));
            if (t!=-1) {
                bone_move=&pose->bone_moves[t];
                xml_get_attribute_3_coord_float(tag,"rot",&bone_move->rot.x,&bone_move->rot.y,&bone_move->rot.z);
				xml_get_attribute_3_coord_float(tag,"move",&bone_move->mov.x,&bone_move->mov.y,&bone_move->mov.z);
				
				bone_move->acceleration=xml_get_attribute_float(tag,"acceleration");
				bone_move->skip_blended=xml_get_attribute_boolean(tag,"skip_blended");
				
				bone_move->constraint.bone_idx=-1;
				bone_move->constraint.offset.x=bone_move->constraint.offset.y=bone_move->constraint.offset.z=0;
				
				constraint_bone_tag=xml_get_attribute_model_tag(tag,"constraint_bone");
				if (constraint_bone_tag!=model_null_tag) {
					constraint_bone_idx=model_find_bone(model,constraint_bone_tag);
					if (constraint_bone_idx!=-1) {
						bone_move->constraint.bone_idx=constraint_bone_idx;
						xml_get_attribute_3_coord_int(tag,"constraint_offset",&bone_move->constraint.offset.x,&bone_move->constraint.offset.y,&bone_move->constraint.offset.z);
					}
				}
			}
		  
			tag=xml_findnextchild(tag);
        }
    
		pose_tag=xml_findnextchild(pose_tag);
    }

    xml_close_file();
    
    return(TRUE);
}
Example #5
0
void iface_read_settings_halo(iface_type *iface)
{
	int					nhalo,halos_head_tag,halo_tag,tag;
	char				path[1024];
	iface_halo_type		*halo;

		// read in interface from setting files
		
	file_paths_data(&file_path_setup,path,"Settings","Halos","xml");
	if (!xml_open_file(path)) return;
	
		// get counts
		
    halos_head_tag=xml_findrootchild("Halos");
    if (halos_head_tag==-1) {
		xml_close_file();
		return;
	}

	nhalo=xml_countchildren(halos_head_tag);

	if (nhalo==0) {
		xml_close_file();
		return;
	}

		// read the halos

	halo_tag=xml_findfirstchild("Halo",halos_head_tag);
	
	while (halo_tag!=-1) {
	
			// create a new halo

		if (iface->halo_list.nhalo>=max_iface_halo) {
			xml_close_file();
			return;
		}
			
		halo=&iface->halo_list.halos[iface->halo_list.nhalo];
		iface->halo_list.nhalo++;
			
			// read settings
			
		xml_get_attribute_text(halo_tag,"name",halo->name,name_str_len);
		
		tag=xml_findfirstchild("Image",halo_tag);
		if (tag!=-1) {
			xml_get_attribute_text(tag,"file",halo->bitmap_name,file_str_len);
		}
		
		halo->min_dist=3000;
		halo->max_dist=50000;
		halo->min_size=500;
		halo->max_size=200;
		halo->min_alpha=0.8f;
		halo->max_alpha=0.05f;
		halo->no_clip_object=FALSE;
		halo->no_clip_self=TRUE;

		tag=xml_findfirstchild("Distance",halo_tag);
		if (tag!=-1) {
			halo->min_dist=xml_get_attribute_int(tag,"min");
			halo->max_dist=xml_get_attribute_int(tag,"max");
		}

		tag=xml_findfirstchild("Size",halo_tag);
		if (tag!=-1) {
			halo->min_size=xml_get_attribute_int(tag,"min");
			halo->max_size=xml_get_attribute_int(tag,"max");
		}

		tag=xml_findfirstchild("Alpha",halo_tag);
		if (tag!=-1) {
			halo->min_alpha=xml_get_attribute_float(tag,"min");
			halo->max_alpha=xml_get_attribute_float(tag,"max");
		}

		tag=xml_findfirstchild("Option",halo_tag);
		if (tag!=-1) {
			halo->no_clip_object=xml_get_attribute_boolean(tag,"no_clip_object");
			halo->no_clip_self=xml_get_attribute_boolean(tag,"no_clip_self");
		}
		
			// move on to next halo
			
		halo_tag=xml_findnextchild(halo_tag);
	}
	
	xml_close_file();
}
Example #6
0
void read_settings_ring(void)
{
	int					nring,ring_head_tag,ring_tag,tag;
	char				path[1024];
	ring_type			*ring;

		// no rings yet

	server.rings=NULL;
	server.count.ring=0;

		// read in rings from setting files
		
	file_paths_data(&setup.file_path_setup,path,"Settings","Rings","xml");
	if (!xml_open_file(path)) return;
	
		// get counts
       
    ring_head_tag=xml_findrootchild("Rings");
    if (ring_head_tag==-1) {
		xml_close_file();
		return;
	}

	nring=xml_countchildren(ring_head_tag);

	if (nring==0) {
		xml_close_file();
		return;
	}

	server.rings=(ring_type*)malloc(sizeof(ring_type)*nring);
	if (server.rings==NULL) {
		xml_close_file();
		return;
	}

		// read in the rings

	ring_tag=xml_findfirstchild("Ring",ring_head_tag);
    
	while (ring_tag!=-1) {
	
			// create a new ring
			
		ring=&server.rings[server.count.ring];
		
		xml_get_attribute_text(ring_tag,"name",ring->name,name_str_len);
		
		ring->life_msec=1000;
		ring->blend_add=FALSE;

        tag=xml_findfirstchild("Settings",ring_tag);
        if (tag!=-1) {
            ring->life_msec=xml_get_attribute_int(tag,"time");
            ring->blend_add=xml_get_attribute_boolean(tag,"additive");
        }
		
		ring->animate.image_count=1;
		ring->animate.image_per_row=1;
		ring->animate.msec=200;
		ring->animate.loop=TRUE;
		ring->animate.loop_back=FALSE;
		
        tag=xml_findfirstchild("Image",ring_tag);
        if (tag!=-1) {
            xml_get_attribute_text(tag,"file",ring->bitmap_name,file_str_len);
            ring->animate.image_count=xml_get_attribute_int(tag,"count");
			ring->animate.image_per_row=(int)sqrt((float)ring->animate.image_count);
			ring->animate.msec=xml_get_attribute_int(tag,"time");
            ring->animate.loop=xml_get_attribute_boolean(tag,"loop");
            ring->animate.loop_back=xml_get_attribute_boolean(tag,"loop_back");
		}
		
        tag=xml_findfirstchild("Outer",ring_tag);
        if (tag!=-1) {
            ring->start_outer_size=xml_get_attribute_int(tag,"start");
            ring->end_outer_size=xml_get_attribute_int(tag,"end");
        }

        tag=xml_findfirstchild("Inner",ring_tag);
        if (tag!=-1) {
            ring->start_inner_size=xml_get_attribute_int(tag,"start");
            ring->end_inner_size=xml_get_attribute_int(tag,"end");
        }

        tag=xml_findfirstchild("Rotate",ring_tag);
        if (tag!=-1) {
            ring->ang.x=xml_get_attribute_float(tag,"x");
            ring->ang.y=xml_get_attribute_float(tag,"y");
            ring->ang.z=xml_get_attribute_float(tag,"z");
            ring->rot.x=xml_get_attribute_float_default(tag,"x_add",0.0f);
            ring->rot.y=xml_get_attribute_float_default(tag,"y_add",0.0f);
            ring->rot.z=xml_get_attribute_float_default(tag,"z_add",0.0f);
            ring->rot_accel.x=xml_get_attribute_float_default(tag,"x_accel",0.0f);
            ring->rot_accel.y=xml_get_attribute_float_default(tag,"y_accel",0.0f);
            ring->rot_accel.z=xml_get_attribute_float_default(tag,"z_accel",0.0f);
		}

        tag=xml_findfirstchild("Move",ring_tag);
        if (tag!=-1) {
            ring->vct.x=xml_get_attribute_float(tag,"x");
            ring->vct.y=xml_get_attribute_float(tag,"y");
            ring->vct.z=xml_get_attribute_float(tag,"z");
        }
		
		ring->start_color.r=ring->start_color.g=ring->start_color.b=1.0f;
		ring->end_color.r=ring->end_color.g=ring->end_color.b=1.0f;
		ring->team_tint=FALSE;

        tag=xml_findfirstchild("Color",ring_tag);
        if (tag!=-1) {
			xml_get_attribute_color(tag,"start",&ring->start_color);
			xml_get_attribute_color(tag,"end",&ring->end_color);
			ring->team_tint=xml_get_attribute_boolean(tag,"team");
       }
		
        tag=xml_findfirstchild("Alpha",ring_tag);
        if (tag!=-1) {
            ring->start_alpha=xml_get_attribute_float(tag,"start");
            ring->end_alpha=xml_get_attribute_float(tag,"end");
        }
	
			// move on to next ring
			
		server.count.ring++;
		
		ring_tag=xml_findnextchild(ring_tag);
	}
	
	xml_close_file();
}
Example #7
0
bool decode_map_v1_xml(map_type *map,int map_head)
{
	int						i,k,j,y,idx,nportal,seg_cnt,
							main_portal_tag,portal_tag,msg_tag,
							main_seg_tag,seg_tag,main_light_tag,light_tag,main_sound_tag,sound_tag,
							main_particle_tag,particle_tag,main_node_tag,node_tag,
							main_obj_tag,obj_tag,tag,cnt;
	bool					convert_ok;
    portal_type				*portals,*portal;
    segment_type			*seg_list,*seg;
    map_light_type			*light;
    map_sound_type			*sound;
	map_particle_type		*particle;
    node_type				*node;
    spot_type				*spot;
	map_scenery_type		*scenery;
	
		// temporary segments and portals for converting from v1 to v3
		
	seg_cnt=0;
	
	seg_list=(segment_type*)malloc(max_segment*sizeof(segment_type));
	if (seg_list==NULL) return(FALSE);

	nportal=0;

	portals=(portal_type*)malloc(max_portal*sizeof(portal_type));
	if (portals==NULL) {
		free(seg_list);
		return(FALSE);
	}
	        
        // portals

    main_portal_tag=xml_findfirstchild("Portals",map_head);
    if (main_portal_tag!=-1) {
    
        nportal=xml_countchildren(main_portal_tag);
		portal_tag=xml_findfirstchild("Portal",main_portal_tag);
		
        portal=portals;
    
        for (i=0;i!=nportal;i++) {
            xml_get_attribute_3_coord_int(portal_tag,"tl_c3",&portal->x,&y,&portal->z);
            xml_get_attribute_3_coord_int(portal_tag,"br_c3",&portal->ex,&y,&portal->ez);
   
            portal->msg.entry_on=portal->msg.exit_on=portal->msg.base_on=portal->msg.map_change_on=FALSE;
            portal->msg.entry_id=portal->msg.exit_id=0;
			portal->msg.map_name[0]=0x0;
			strcpy(portal->msg.map_spot_name,"Start");
			strcpy(portal->msg.map_spot_type,"Player");
            
            msg_tag=xml_findfirstchild("Messages",portal_tag);
            if (msg_tag!=-1) {
                tag=xml_findfirstchild("Entry",msg_tag);
                if (tag!=-1) {
                    portal->msg.entry_on=xml_get_attribute_boolean(tag,"on");
                    portal->msg.entry_id=xml_get_attribute_int(tag,"id");
                }
                tag=xml_findfirstchild("Exit",msg_tag);
                if (tag!=-1) {
                    portal->msg.exit_on=xml_get_attribute_boolean(tag,"on");
                    portal->msg.exit_id=xml_get_attribute_int(tag,"id");
                }
                tag=xml_findfirstchild("Base",msg_tag);
                if (tag!=-1) {
                    portal->msg.base_on=xml_get_attribute_boolean(tag,"on");
                    portal->msg.base_team=xml_get_attribute_int(tag,"team");
                }
                tag=xml_findfirstchild("Map",msg_tag);
                if (tag!=-1) {
                    portal->msg.map_change_on=xml_get_attribute_boolean(tag,"on");
					xml_get_attribute_text(tag,"name", portal->msg.map_name,name_str_len);
					xml_get_attribute_text(tag,"spot_name", portal->msg.map_spot_name,name_str_len);
					xml_get_attribute_text(tag,"spot_type", portal->msg.map_spot_type,name_str_len);
                }
            }

				// walls
				
            main_seg_tag=xml_findfirstchild("Walls",portal_tag);
            if (main_seg_tag!=-1) {
                
                cnt=xml_countchildren(main_seg_tag);
				seg_tag=xml_findfirstchild("Wall",main_seg_tag);
                
                for (k=0;k!=cnt;k++) {
					seg=&seg_list[seg_cnt];
					seg_cnt++;
					
					read_single_segment(seg_tag,seg,i,sg_wall);

					tag=xml_findfirstchild("v",seg_tag);
					xml_get_attribute_3_coord_int(tag,"c3",&seg->data.wall.lx,&seg->data.wall.ty,&seg->data.wall.lz);
					tag=xml_findnextchild(tag);
					xml_get_attribute_3_coord_int(tag,"c3",&seg->data.wall.rx,&seg->data.wall.by,&seg->data.wall.rz);

					seg_tag=xml_findnextchild(seg_tag);
				}
			}

				// floors

            main_seg_tag=xml_findfirstchild("Floors",portal_tag);
            if (main_seg_tag!=-1) {
                
                cnt=xml_countchildren(main_seg_tag);
				seg_tag=xml_findfirstchild("Floor",main_seg_tag);
                
                for (k=0;k!=cnt;k++) {
					seg=&seg_list[seg_cnt];
					seg_cnt++;
					
					read_single_segment(seg_tag,seg,i,sg_floor);
					
					seg->data.fc.ptsz=xml_countchildren(seg_tag);
					tag=xml_findfirstchild("v",seg_tag);
					
					for (j=0;j!=seg->data.fc.ptsz;j++) {
						xml_get_attribute_3_coord_int(tag,"c3",&seg->data.fc.x[j],&seg->data.fc.y[j],&seg->data.fc.z[j]);
						tag=xml_findnextchild(tag);
					}
					
					seg_tag=xml_findnextchild(seg_tag);
				}
			}
			
				// ceilings
				
            main_seg_tag=xml_findfirstchild("Ceilings",portal_tag);
            if (main_seg_tag!=-1) {
                
                cnt=xml_countchildren(main_seg_tag);
				seg_tag=xml_findfirstchild("Ceiling",main_seg_tag);
                
                for (k=0;k!=cnt;k++) {
					seg=&seg_list[seg_cnt];
					seg_cnt++;
					
					read_single_segment(seg_tag,seg,i,sg_ceiling);
					
					seg->data.fc.ptsz=xml_countchildren(seg_tag);
					tag=xml_findfirstchild("v",seg_tag);
					
					for (j=0;j!=seg->data.fc.ptsz;j++) {
						xml_get_attribute_3_coord_int(tag,"c3",&seg->data.fc.x[j],&seg->data.fc.y[j],&seg->data.fc.z[j]);
						tag=xml_findnextchild(tag);
					}
					
					seg_tag=xml_findnextchild(seg_tag);
				}
			}

				// liquids
				
            main_seg_tag=xml_findfirstchild("Liquids",portal_tag);
            if (main_seg_tag!=-1) {
                
                cnt=xml_countchildren(main_seg_tag);
				seg_tag=xml_findfirstchild("Liquid",main_seg_tag);
                
                for (k=0;k!=cnt;k++) {
					seg=&seg_list[seg_cnt];
					seg_cnt++;
					
					read_single_segment(seg_tag,seg,i,sg_liquid);
					
					tag=xml_findfirstchild("v",seg_tag);
					xml_get_attribute_3_coord_int(tag,"c3",&seg->data.liquid.lft,&seg->data.liquid.y,&seg->data.liquid.top);
					tag=xml_findnextchild(tag);
					xml_get_attribute_3_coord_int(tag,"c3",&seg->data.liquid.rgt,&seg->data.liquid.y,&seg->data.liquid.bot);
					
					seg_tag=xml_findnextchild(seg_tag);
				}
			}

				// ambient walls
				
            main_seg_tag=xml_findfirstchild("Ambients",portal_tag);
            if (main_seg_tag!=-1) {
                
                cnt=xml_countchildren(main_seg_tag);
				seg_tag=xml_findfirstchild("Ambient",main_seg_tag);
                
                for (k=0;k!=cnt;k++) {
					seg=&seg_list[seg_cnt];
					seg_cnt++;
					
					read_single_segment(seg_tag,seg,i,sg_ambient_wall);
					
					tag=xml_findfirstchild("v",seg_tag);
					xml_get_attribute_3_coord_int(tag,"c3",&seg->data.ambient_wall.lx,&seg->data.ambient_wall.ty,&seg->data.ambient_wall.lz);
					tag=xml_findnextchild(tag);
					xml_get_attribute_3_coord_int(tag,"c3",&seg->data.ambient_wall.rx,&seg->data.ambient_wall.by,&seg->data.ambient_wall.rz);
					
					seg_tag=xml_findnextchild(seg_tag);
				}
			}
			
				// ambient floor/ceilings

            main_seg_tag=xml_findfirstchild("Ambient_FCs",portal_tag);
            if (main_seg_tag!=-1) {
                
                cnt=xml_countchildren(main_seg_tag);
				seg_tag=xml_findfirstchild("Ambient_FC",main_seg_tag);
                
                for (k=0;k!=cnt;k++) {
					seg=&seg_list[seg_cnt];
					seg_cnt++;
					
					read_single_segment(seg_tag,seg,i,sg_ambient_fc);
					
					seg->data.ambient_fc.ptsz=xml_countchildren(seg_tag);
					tag=xml_findfirstchild("v",seg_tag);
					
					for (j=0;j!=seg->data.ambient_fc.ptsz;j++) {
						xml_get_attribute_3_coord_int(tag,"c3",&seg->data.ambient_fc.x[j],&seg->data.ambient_fc.y[j],&seg->data.ambient_fc.z[j]);
						tag=xml_findnextchild(tag);
					}
					
					seg_tag=xml_findnextchild(seg_tag);
				}
			}

				// scenery
		
			main_obj_tag=xml_findfirstchild("Sceneries",portal_tag);
			if (main_obj_tag!=-1) {
			
				cnt=xml_countchildren(main_obj_tag);
				obj_tag=xml_findfirstchild("Scenery",main_obj_tag);
				
				for (k=0;k!=cnt;k++) {
					if (map->nscenery>=max_map_scenery) break;
					
					scenery=&map->sceneries[map->nscenery];
					map->nscenery++;
					
					xml_get_attribute_3_coord_int(obj_tag,"c3",&scenery->pnt.x,&scenery->pnt.y,&scenery->pnt.z);
					
					xml_get_attribute_text(obj_tag,"model_name",scenery->model_name,name_str_len);
					xml_get_attribute_text(obj_tag,"animation_name",scenery->animation_name,name_str_len);
					xml_get_attribute_3_coord_float(obj_tag,"angle",&scenery->ang.x,&scenery->ang.y,&scenery->ang.z);
					scenery->contact_object_on=xml_get_attribute_boolean(obj_tag,"contact");
					scenery->contact_projectile_on=xml_get_attribute_boolean(obj_tag,"contact_projectile");
					scenery->contact_hit_box=xml_get_attribute_boolean(obj_tag,"contact_hit_box");
					scenery->face_forward=xml_get_attribute_boolean(obj_tag,"face_forward");
					scenery->shadow=xml_get_attribute_boolean(obj_tag,"shadow");

					scenery->pnt.x=(scenery->pnt.x*map_enlarge)+(portal->x*map_enlarge);
					scenery->pnt.y=(scenery->pnt.y+1)*map_enlarge;
					scenery->pnt.z=(scenery->pnt.z*map_enlarge)+(portal->z*map_enlarge);
					
					scenery->resize=1.0f;
					
					obj_tag=xml_findnextchild(obj_tag);
				}
			}

				// lights
			
			main_light_tag=xml_findfirstchild("Lights",portal_tag);
			if (main_light_tag!=-1) {
			
				cnt=xml_countchildren(main_light_tag);
				light_tag=xml_findfirstchild("Light",main_light_tag);
				
				for (k=0;k!=cnt;k++) {
					if (map->nlight>=max_map_light) break;
					
					light=&map->lights[map->nlight];
					map->nlight++;
					
					light->type=xml_get_attribute_list(light_tag,"type",(char*)light_type_str);
					xml_get_attribute_3_coord_int(light_tag,"c3",&light->pnt.x,&light->pnt.y,&light->pnt.z);
					light->intensity=xml_get_attribute_int(light_tag,"intensity");
					xml_get_attribute_color(light_tag,"rgb",&light->col);
					light->on=!xml_get_attribute_boolean(light_tag,"off");
					
					light->pnt.x=(light->pnt.x*map_enlarge)+(portal->x*map_enlarge);
					light->pnt.y=(light->pnt.y+1)*map_enlarge;
					light->pnt.z=(light->pnt.z*map_enlarge)+(portal->z*map_enlarge);

					light->intensity*=map_enlarge;
					
					light->exponent=1.0f;
					light->direction=ld_all;
				
					light_tag=xml_findnextchild(light_tag);
				}
			}
			
				// sounds
				
			main_sound_tag=xml_findfirstchild("Sounds",portal_tag);
			if (main_sound_tag!=-1) {
			
				cnt=xml_countchildren(main_sound_tag);
				sound_tag=xml_findfirstchild("Sound",main_sound_tag);
				
				for (k=0;k!=cnt;k++) {
					if (map->nsound>=max_map_sound) break;
					
					sound=&map->sounds[map->nsound];
					map->nsound++;
					
					xml_get_attribute_text(sound_tag,"name",sound->name,file_str_len);
					xml_get_attribute_3_coord_int(sound_tag,"c3",&sound->pnt.x,&sound->pnt.y,&sound->pnt.z);
					sound->pitch=xml_get_attribute_float(sound_tag,"pitch");
					sound->on=!xml_get_attribute_boolean(sound_tag,"off");
					
					sound->pnt.x=(sound->pnt.x*map_enlarge)+(portal->x*map_enlarge);
					sound->pnt.y=(sound->pnt.y+1)*map_enlarge;
					sound->pnt.z=(sound->pnt.z*map_enlarge)+(portal->z*map_enlarge);
					
					sound_tag=xml_findnextchild(sound_tag);
				}
			}
			
				// particles
				
			main_particle_tag=xml_findfirstchild("Particles",portal_tag);
			if (main_particle_tag!=-1) {
			
				cnt=xml_countchildren(main_particle_tag);
				particle_tag=xml_findfirstchild("Particle",main_particle_tag);
				
				for (k=0;k!=cnt;k++) {
					if (map->nparticle>=max_map_particle) break;
					
					particle=&map->particles[map->nparticle];
					map->nparticle++;
					
					xml_get_attribute_text(particle_tag,"name",particle->name,file_str_len);
					xml_get_attribute_3_coord_int(particle_tag,"c3",&particle->pnt.x,&particle->pnt.y,&particle->pnt.z);
					particle->spawn_tick=xml_get_attribute_int(particle_tag,"spawn_tick");
					particle->slop_tick=xml_get_attribute_int(particle_tag,"slop_tick");
					particle->on=!xml_get_attribute_boolean(particle_tag,"off");
					
					particle->pnt.x=(particle->pnt.x*map_enlarge)+(portal->x*map_enlarge);
					particle->pnt.y=(particle->pnt.y+1)*map_enlarge;
					particle->pnt.z=(particle->pnt.z*map_enlarge)+(portal->z*map_enlarge);
					
					particle_tag=xml_findnextchild(particle_tag);
				}
			}
        
				// nodes
		
			main_node_tag=xml_findfirstchild("Nodes",portal_tag);
			if (main_node_tag!=-1) {
			
				cnt=xml_countchildren(main_node_tag);
				node_tag=xml_findfirstchild("Node",main_node_tag);
				
				for (k=0;k!=cnt;k++) {
				
					idx=xml_get_attribute_int(node_tag,"id");
					node=&map->nodes[idx];
					if (idx>=map->nnode) map->nnode=idx+1;

					node->idx=idx;

					for (j=0;j!=max_node_link;j++) {
						node->link[j]=-1;
					}
					for (j=0;j!=max_node;j++) {
						node->path_hint[j]=-1;
					}
					
					xml_get_attribute_3_coord_int(node_tag,"c3",&node->pnt.x,&node->pnt.y,&node->pnt.z);

					xml_get_attribute_3_coord_float(node_tag,"angle",&node->ang.x,&node->ang.y,&node->ang.z);

					xml_get_attribute_text(node_tag,"name",node->name,name_str_len);
					node->event_id=xml_get_attribute_int_default(node_tag,"event_id",0);
					
					tag=xml_findfirstchild("Link",node_tag);
					xml_get_attribute_short_array(tag,"node",node->link,max_node_link);
					
					tag=xml_findfirstchild("Hint",node_tag);
					xml_get_attribute_short_array(tag,"node",node->path_hint,map->nnode);

					node->pnt.x=(node->pnt.x*map_enlarge)+(portal->x*map_enlarge);
					node->pnt.y=(node->pnt.y+1)*map_enlarge;
					node->pnt.z=(node->pnt.z*map_enlarge)+(portal->z*map_enlarge);

					node->follow_camera=FALSE;
					
					node_tag=xml_findnextchild(node_tag);
				}
			}

				// spots
		
			main_obj_tag=xml_findfirstchild("Spots",portal_tag);
			if (main_obj_tag!=-1) {
			
				cnt=xml_countchildren(main_obj_tag);
				obj_tag=xml_findfirstchild("Spot",main_obj_tag);
				
				for (k=0;k!=cnt;k++) {
				
					idx=xml_get_attribute_int(obj_tag,"id");
					spot=&map->spots[idx];
					if (idx>=map->nspot) map->nspot=idx+1;
					
					xml_get_attribute_3_coord_int(obj_tag,"c3",&spot->pnt.x,&spot->pnt.y,&spot->pnt.z);
					
					xml_get_attribute_text(obj_tag,"name",spot->name,name_str_len);
					xml_get_attribute_text(obj_tag,"type",spot->type,name_str_len);
					if (!xml_get_attribute_text(obj_tag,"script",spot->script,name_str_len)) {		// supergumba -- remove later -- here to fix XML from older version
						strcpy(spot->script,spot->name);
					}
					xml_get_attribute_text(obj_tag,"display_model",spot->display_model,name_str_len);
					xml_get_attribute_text(obj_tag,"params",spot->params,param_str_len);
					spot->ang.y=xml_get_attribute_float(obj_tag,"angle");
					
					spot->skill=skill_easy;
					spot->spawn=spawn_always;

					spot->pnt.x=(spot->pnt.x*map_enlarge)+(portal->x*map_enlarge);
					spot->pnt.y=(spot->pnt.y+1)*map_enlarge;
					spot->pnt.z=(spot->pnt.z*map_enlarge)+(portal->z*map_enlarge);
					
					obj_tag=xml_findnextchild(obj_tag);
				}
			}
             
            portal++;
			portal_tag=xml_findnextchild(portal_tag);
        }
    }

	convert_ok=map_convert_v1(map,nportal,portals,seg_cnt,seg_list);
	
	free(portals);
	free(seg_list);
	
		// center map
		
	map_center(map);
	
	return(convert_ok);
}