static void counters_load(running_machine &machine, int config_type, xml_data_node *parentnode)
{
    generic_machine_private *state = machine.generic_machine_data;
    xml_data_node *coinnode, *ticketnode;

    /* on init, reset the counters */
    if (config_type == CONFIG_TYPE_INIT)
    {
        memset(state->coin_count, 0, sizeof(state->coin_count));
        state->dispensed_tickets = 0;
    }

    /* only care about game-specific data */
    if (config_type != CONFIG_TYPE_GAME)
        return;

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

    /* iterate over coins nodes */
    for (coinnode = xml_get_sibling(parentnode->child, "coins"); coinnode; coinnode = xml_get_sibling(coinnode->next, "coins"))
    {
        int index = xml_get_attribute_int(coinnode, "index", -1);
        if (index >= 0 && index < COIN_COUNTERS)
            state->coin_count[index] = xml_get_attribute_int(coinnode, "number", 0);
    }

    /* get the single tickets node */
    ticketnode = xml_get_sibling(parentnode->child, "tickets");
    if (ticketnode != NULL)
        state->dispensed_tickets = xml_get_attribute_int(ticketnode, "number", 0);
}
Beispiel #2
0
cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node &paramnode)
	: m_value(0)
{
	// read the core attributes
	m_minval = number_and_format(xml_get_attribute_int(&paramnode, "min", 0), xml_get_attribute_int_format(&paramnode, "min"));
	m_maxval = number_and_format(xml_get_attribute_int(&paramnode, "max", 0), xml_get_attribute_int_format(&paramnode, "max"));
	m_stepval = number_and_format(xml_get_attribute_int(&paramnode, "step", 1), xml_get_attribute_int_format(&paramnode, "step"));

	// iterate over items
	for (xml_data_node *itemnode = xml_get_sibling(paramnode.child, "item"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "item"))
	{
		// check for NULL text
		if (itemnode->value == NULL || itemnode->value[0] == 0)
			throw emu_fatalerror("%s.xml(%d): item is missing text\n", filename, itemnode->line);

		// check for non-existant value
		if (xml_get_attribute(itemnode, "value") == NULL)
			throw emu_fatalerror("%s.xml(%d): item is value\n", filename, itemnode->line);

		// extract the parameters
		UINT64 value = xml_get_attribute_int(itemnode, "value", 0);
		int format = xml_get_attribute_int_format(itemnode, "value");

		// allocate and append a new item
		item &curitem = m_itemlist.append(*global_alloc(item(itemnode->value, value, format)));

		// ensure the maximum expands to suit
		m_maxval = MAX(m_maxval, curitem.value());
	}

	// add a variable to the symbol table for our value
	symbols.add("param", symbol_table::READ_ONLY, &m_value);
}
Beispiel #3
0
void MemoryWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
{
	WindowQtConfig::recoverFromXmlNode(node);
	m_memoryRegion = xml_get_attribute_int(node, "memoryregion", m_memoryRegion);
	m_reverse = xml_get_attribute_int(node, "reverse", m_reverse);
	m_addressMode = xml_get_attribute_int(node, "addressmode", m_addressMode);
	m_dataFormat = xml_get_attribute_int(node, "dataformat", m_dataFormat);
}
Beispiel #4
0
void WindowQtConfig::recoverFromXmlNode(xml_data_node* node)
{
	m_size.setX(xml_get_attribute_int(node, "size_x", m_size.x()));
	m_size.setY(xml_get_attribute_int(node, "size_y", m_size.y()));
	m_position.setX(xml_get_attribute_int(node, "position_x", m_position.x()));
	m_position.setY(xml_get_attribute_int(node, "position_y", m_position.y()));
	m_type = (WindowQtConfig::WindowType)xml_get_attribute_int(node, "type", m_type);
}
Beispiel #5
0
void read_single_segment(int tag,segment_type *seg,int rn,int seg_type)
{
	int				n;
	
	seg->rn=rn;
	seg->type=seg_type;
	seg->group_idx=xml_get_attribute_int_default(tag,"group",-1);
	
	for (n=0;n!=max_primitive_stack;n++) {
		seg->primitive_uid[n]=-1;
	}
	
	xml_get_attribute_short_array(tag,"primitive",seg->primitive_uid,max_primitive_stack);
	
	seg->clip=xml_get_attribute_list(tag,"clip",(char*)segment_clip_str);
	seg->curve=xml_get_attribute_list(tag,"curve",(char*)segment_curve_str);
	seg->pass_through=xml_get_attribute_boolean(tag,"pass");
	seg->moveable=xml_get_attribute_boolean(tag,"moveable");
	seg->shiftable=xml_get_attribute_boolean(tag,"shiftable");
	seg->climbable=xml_get_attribute_boolean(tag,"climbable");
	seg->on=!xml_get_attribute_boolean(tag,"off");
	
	seg->fill=xml_get_attribute_int(tag,"fill");
	seg->txt_ang=xml_get_attribute_int_default(tag,"ang",0)/90;
	xml_get_attribute_2_coord_float(tag,"uv_off",&seg->x_txtoff,&seg->y_txtoff);
	xml_get_attribute_2_coord_float(tag,"uv_fct",&seg->x_txtfact,&seg->y_txtfact);
	xml_get_attribute_2_coord_float_default(tag,"shift",&seg->x_shift,&seg->y_shift,0.0f,0.0f);
	seg->dark_factor=xml_get_attribute_float_default(tag,"dark_fct",1);
	seg->alpha=xml_get_attribute_float_default(tag,"alpha",1);
	seg->lock=xml_get_attribute_boolean(tag,"lock");
	
	seg->tag=xml_get_attribute_int_default(tag,"tag",0);
	
	if (seg_type==sg_liquid) {
		seg->data.liquid.harm=xml_get_attribute_int(tag,"harm");
		seg->data.liquid.drown_harm=xml_get_attribute_int_default(tag,"drown_harm",10);
		seg->data.liquid.drown_tick=xml_get_attribute_int_default(tag,"drown_tick",10000);
		seg->data.liquid.speed_alter=xml_get_attribute_float_default(tag,"speed_alter",0.1f);
		seg->data.liquid.wavesize=xml_get_attribute_int_default(tag,"wave_size",(map_enlarge<<2));
		seg->data.liquid.tiderate=xml_get_attribute_int(tag,"tide_rate");
		seg->data.liquid.tidesize=xml_get_attribute_int(tag,"tide_size");
		seg->data.liquid.tidedirection=xml_get_attribute_list(tag,"tide_direction",(char*)liquid_tide_direction_str);
		xml_get_attribute_color(tag,"rgb",&seg->data.liquid.col);
		seg->data.liquid.tint_alpha=xml_get_attribute_float_default(tag,"tint_alpha",0.5f);
		
		if (seg->data.liquid.wavesize<=(map_enlarge<<2)) seg->data.liquid.wavesize=map_enlarge<<2;
		if (seg->data.liquid.tiderate<0) seg->data.liquid.tiderate=0;
		if (seg->data.liquid.tidesize<0) seg->data.liquid.tidesize=0;
	}
	
	if (seg_type==sg_ambient_wall) {
		seg->data.ambient_wall.push=xml_get_attribute_list(tag,"push",(char*)segment_push_str);
	}

	if (seg_type==sg_ambient_fc) {
		seg->data.ambient_fc.push=xml_get_attribute_list(tag,"push",(char*)segment_push_str);
	}
}
Beispiel #6
0
void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentnode)
{
    /* Note: crosshair_load() is only registered if croshairs are used */

    xml_data_node *crosshairnode;
    int auto_time;

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

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

    /* loop and get player crosshair info */
    for (crosshairnode = xml_get_sibling(parentnode->child, "crosshair"); crosshairnode; crosshairnode = xml_get_sibling(crosshairnode->next, "crosshair"))
    {
        int  player, mode;

        player = xml_get_attribute_int(crosshairnode, "player", -1);

        // check to make sure we have a valid player
        if (player >= 0 && player < MAX_PLAYERS)
        {
            // check if the player really uses a crosshair
            render_crosshair &crosshair = *m_crosshair[player];
            if (crosshair.is_used())
            {
                // get, check, and store visibility mode
                mode = xml_get_attribute_int(crosshairnode, "mode", CROSSHAIR_VISIBILITY_DEFAULT);
                if (mode >= CROSSHAIR_VISIBILITY_OFF && mode <= CROSSHAIR_VISIBILITY_AUTO)
                {
                    crosshair.set_mode((UINT8)mode);
                    /* set visibility as specified by mode */
                    /* auto mode starts with visibility off */
                    crosshair.set_visible(mode == CROSSHAIR_VISIBILITY_ON);
                }

                // get and store crosshair pic name
                crosshair.set_bitmap_name(xml_get_attribute_string(crosshairnode, "pic", ""));
            }
        }
    }

    /* get, check, and store auto visibility time */
    crosshairnode = xml_get_sibling(parentnode->child, "autotime");
    if (crosshairnode != nullptr)
    {
        auto_time = xml_get_attribute_int(crosshairnode, "val", CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT);
        if ((auto_time >= CROSSHAIR_VISIBILITY_AUTOTIME_MIN) && (auto_time <= CROSSHAIR_VISIBILITY_AUTOTIME_MAX))
            m_auto_time = (UINT8)auto_time;
    }
}
Beispiel #7
0
	void loadFromXmlDataNode(xml_data_node* wnode)
	{
		if (!wnode) return;

		type = xml_get_attribute_int(wnode, "type", type);

		sizeX = xml_get_attribute_int(wnode, "size_x", sizeX);
		sizeY = xml_get_attribute_int(wnode, "size_y", sizeY);
		positionX = xml_get_attribute_int(wnode, "position_x", positionX);
		positionY = xml_get_attribute_int(wnode, "position_y", positionY);
	}
Beispiel #8
0
static void crosshair_load(running_machine &machine, int config_type, xml_data_node *parentnode)
{
	/* Note: crosshair_load() is only registered if croshairs are used */

	xml_data_node *crosshairnode;
	int auto_time;

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

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

	/* loop and get player crosshair info */
	for (crosshairnode = xml_get_sibling(parentnode->child, "crosshair"); crosshairnode; crosshairnode = xml_get_sibling(crosshairnode->next, "crosshair"))
	{
		int  player, mode;

		player = xml_get_attribute_int(crosshairnode, "player", -1);

		/* check to make sure we have a valid player */
		/* also check if the player really uses a crosshair */
		if (player >=0 && player < MAX_PLAYERS && global.used[player])
		{
			/* get, check, and store visibility mode */
			mode = xml_get_attribute_int(crosshairnode, "mode", CROSSHAIR_VISIBILITY_DEFAULT);
			if (mode >= CROSSHAIR_VISIBILITY_OFF && mode <= CROSSHAIR_VISIBILITY_AUTO)
			{
				global.mode[player] = (UINT8)mode;
				/* set visibility as specified by mode */
				/* auto mode starts with visibility off */
				global.visible[player] = (mode == CROSSHAIR_VISIBILITY_ON) ? TRUE : FALSE;
			}

			/* get and store crosshair pic name, truncate name to max length */
			strncpy(global.name[player], xml_get_attribute_string(crosshairnode, "pic", ""), CROSSHAIR_PIC_NAME_LENGTH);
			/* update bitmap */
			create_bitmap(machine, player);
		}
	}

	/* get, check, and store auto visibility time */
	crosshairnode = xml_get_sibling(parentnode->child, "autotime");
	if (crosshairnode != NULL)
	{
		auto_time = xml_get_attribute_int(crosshairnode, "val", CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT);
		if ((auto_time >= CROSSHAIR_VISIBILITY_AUTOTIME_MIN) && (auto_time <= CROSSHAIR_VISIBILITY_AUTOTIME_MAX))
			global.auto_time = (UINT8)auto_time;
	}
}
Beispiel #9
0
boolean Room::handle_xml_tag(Tag tag, xml_node *node) {
   switch (tag) {
      case INSIDE_TAG:
			// following called reset_items prior to 240203
			just_add_items(xml_load_sprites(node)); // rewritten on 070203 - below should not have activated since that is redundant
        // Sprites *room_items = xml_load_sprites(node);
        // if (room_items != NULL) {
		      //add_items(room_items);
		      //room_items->recursively_propagate_changes();
        //    room_items->activate();
        //    room_items->remove_all();
        //    delete room_items;
        // };
         return(TRUE);
      case ON_WALL_TAG: {
         Sprite *saved_wall_decoration = xml_get_sprite(node);
         if (saved_wall_decoration != NULL) {
		      saved_wall_decoration->recursively_propagate_changes(); // new on 160601 to get offsets right
		      set_wall_decoration_sprite(saved_wall_decoration);
         };;
         return(TRUE);
                        };
      case NO_MORE_TAGS:
			explosion_time = xml_get_attribute_int(node,L"ExplosionTime",0); // prior to 210404 was explosion_time // new on 030204
         return(TRUE); 
      default:
         return(FALSE); // extra_xml?? 051102
   };
};
Beispiel #10
0
void xml_key_read_int(int setup_tag,char *name,int *value)
{
    int			tag;

    tag=xml_findfirstchild(name,setup_tag);
    if (tag!=-1) *value=xml_get_attribute_int(tag,"value");
}
Beispiel #11
0
void MainWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
{
	WindowQtConfig::recoverFromXmlNode(node);
	const char* state = xml_get_attribute_string(node, "qtwindowstate", "");
	m_windowState = QByteArray::fromPercentEncoding(state);
	m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar);
}
Beispiel #12
0
static void xml_configuration_load(running_machine &machine, int config_type, xml_data_node *parentnode)
{
	// We only care about game files
	if (config_type != CONFIG_TYPE_GAME)
		return;

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

	for (int i = 0; i < xmlConfigurations.size(); i++)
		delete xmlConfigurations[i];
	xmlConfigurations.clear();

	// Configuration load
	xml_data_node* wnode = NULL;
	for (wnode = xml_get_sibling(parentnode->child, "window"); wnode != NULL; wnode = xml_get_sibling(wnode->next, "window"))
	{
		WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN);
		switch (type)
		{
			case WindowQtConfig::WIN_TYPE_MAIN:               xmlConfigurations.push_back(new MainWindowQtConfig()); break;
			case WindowQtConfig::WIN_TYPE_MEMORY:             xmlConfigurations.push_back(new MemoryWindowQtConfig()); break;
			case WindowQtConfig::WIN_TYPE_DASM:               xmlConfigurations.push_back(new DasmWindowQtConfig()); break;
			case WindowQtConfig::WIN_TYPE_LOG:                xmlConfigurations.push_back(new LogWindowQtConfig()); break;
			case WindowQtConfig::WIN_TYPE_BREAK_POINTS:       xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); break;
			case WindowQtConfig::WIN_TYPE_DEVICES:            xmlConfigurations.push_back(new DevicesWindowQtConfig()); break;
			case WindowQtConfig::WIN_TYPE_DEVICE_INFORMATION: xmlConfigurations.push_back(new DeviceInformationWindowQtConfig()); break;
			default: continue;
		}
		xmlConfigurations.back()->recoverFromXmlNode(wnode);
	}
}
Beispiel #13
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);
		}
	}
}
Beispiel #14
0
void bitmap_texture_read_xml(texture_type *texture,int main_tag,bool read_scale)
{
	int						k,scale_tag,main_image_tag,image_tag,frame_count;

		// settings
		
	texture->animate.on=xml_get_attribute_boolean(main_tag,"animate");
	texture->additive=xml_get_attribute_boolean(main_tag,"additive");
	texture->pixelated=xml_get_attribute_boolean(main_tag,"pixelated");
	texture->compress=xml_get_attribute_boolean(main_tag,"compress");
	texture->flip_normal=xml_get_attribute_boolean_default_true(main_tag,"flip_normal");

	texture->shine_factor=xml_get_attribute_float_default(main_tag,"shine_factor",10.0f);
	texture->rl_alpha_type=xml_get_attribute_list(main_tag,"rl_alpha_type",(char*)rtl_alpha_list_str);
	texture->rl_refract_factor=xml_get_attribute_float_default(main_tag,"rl_refract_factor",0.5f);

	texture->glow.rate=xml_get_attribute_int(main_tag,"glow_rate");
	texture->glow.min=xml_get_attribute_float_default(main_tag,"glow_min",0.25f);
	texture->glow.max=xml_get_attribute_float_default(main_tag,"glow_max",0.75f);

	xml_get_attribute_text(main_tag,"shader",texture->shader_name,name_str_len);
	xml_get_attribute_text(main_tag,"material_name",texture->material_name,name_str_len);
	
		// scale

	if (read_scale) {
		scale_tag=xml_findfirstchild("Scale",main_tag);
		texture->scale.uv_size.x=xml_get_attribute_float_default(scale_tag,"x",0.25f);
		texture->scale.uv_size.y=xml_get_attribute_float_default(scale_tag,"y",0.25f);
		texture->scale.uv_offset.x=xml_get_attribute_float_default(scale_tag,"x_off",0.0f);
		texture->scale.uv_offset.y=xml_get_attribute_float_default(scale_tag,"y_off",0.0f);
	}
	
		// images
		
	main_image_tag=xml_findfirstchild("Images",main_tag);
	if (main_image_tag!=-1) {
	
		texture->animate.current_frame=0;
		texture->animate.total_wait=0;
		
		frame_count=xml_countchildren(main_image_tag);
		image_tag=xml_findfirstchild("Image",main_image_tag);
		
		for (k=0;k!=frame_count;k++) {
			texture->animate.wait[k]=xml_get_attribute_int_default(image_tag,"wait",0);
			texture->animate.end_tick[k]=texture->animate.total_wait=texture->animate.total_wait+texture->animate.wait[k];
			xml_get_attribute_text(image_tag,"bitmap",texture->frames[k].name,file_str_len);

			image_tag=xml_findnextchild(image_tag);
		}
	}
}
Beispiel #15
0
boolean Floor::handle_xml_tag(Tag tag, xml_node *node) {
   switch (tag) {
      case ON_FLOOR_TAG: 
		case INSIDE_TAG: // new on 040803
			// following called reset_items prior to 240203
			just_add_items(xml_load_sprites(node),xml_get_attribute_int(node,L"TopLevel",0)); // new on 110803 to add to screen if pasting in the floor by itself		
		   // rewritten on 171202 to just do above rather than below
         // Sprites *floor_items = xml_load_sprites(node);
         // if (floor_items != NULL) {
		      //Sprites *remaining = floor_items;
		      //while (remaining != NULL) {
			     // // new on 101099 if priority of item is fixed then don't reset it
			     // // so Marty, for example, loads in with correct priority
			     // add_item(remaining->first(),FALSE); 
			     // // FALSE replaced !remaining->first()->priority_fixed() above on 211199 since priority is now saved correctly
			     // remaining = remaining->rest();
		      //};
		      //floor_items->recursively_propagate_changes();
		      //floor_items->activate();
         //    floor_items->remove_all();
         //    delete floor_items;
         // };
			current_priority = xml_get_attribute_int(node,L"Z",max_long);
         return(TRUE);
		case PREVIOUS_MOUSE_TAG:
			set_previous_mouse((Mouse *) xml_get_sprite(node,previous_mouse,MOUSE_WITH_HAMMER)); // args added on 070103
			return(TRUE);
		case MAIN_BOX_TAG: 
			body_cubby = (Cubby *) xml_get_sprite(node,body_cubby,CUBBY);
			if (body_cubby != NULL) { // new on 090203 - not clear if better to use set_body_cubby instead but it does much more
				body_cubby->increment_ref_count(); 
			};
			return(body_cubby != NULL);
		case ALTERNATIVES_FOR_MY_BOX_TAG:
			alternative_body_cubbies = xml_load_sprites(node);
			return(alternative_body_cubbies != NULL);
		case INITIAL_ROBOT_TAG: 
			set_initial_robot((Robot *) xml_get_sprite(node,initial_robot,ROBOT));
			return(initial_robot != NULL);
		case HOUSE_LOCATION_TAG: {
			House *house = house_at_location(node);
			if (house == NULL) return(FALSE);
			room = house->pointer_to_room();
			return(room != NULL);
									  };
      case NO_MORE_TAGS:
			// commented out on 041103 since this causes problem when jumping between segments in time travel and is only an optimization anyway
//			toolbox_status = (ToolboxCacheStatus) xml_get_attribute_int(node,L"ToolBoxStatusCode",TOOLBOX_CACHE_STATUS_UNINITIALIZED);
			floor_id = xml_get_attribute_int(node,L"FloorID",floor_id);
			at_left_wall = xml_get_attribute_int(node,L"AtLeftWall",0); // prior to 210404 at_left_wall
			at_right_wall = xml_get_attribute_int(node,L"AtRightWall",0); // prior to 210404 at_right_wall
			at_front_wall = xml_get_attribute_int(node,L"AtFrontWall",0); // prior to 210404 at_front_wall
         return(TRUE); // had been commented out on 090404 to fall through to call to super -- trying to fix time travel bug with containment region
			// restored 090404 since Floor is "self contained"
      default:
 //        return(FALSE); // extra_xml?? 051102
			return(Visible_Background::handle_xml_tag(tag,node)); // new on 090404 - though super doesn't do much better...
   };
};
Beispiel #16
0
cheat_script::script_entry::output_argument::output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node &argnode)
	: m_expression(&symbols),
		m_count(0)
{
	// first extract attributes
	m_count = xml_get_attribute_int(&argnode, "count", 1);

	// read the expression
	const char *expression = argnode.value;
	if (expression == nullptr || expression[0] == 0)
		throw emu_fatalerror("%s.xml(%d): missing expression in argument tag\n", filename, argnode.line);

	// parse it
	try
	{
		m_expression.parse(expression);
	}
	catch (expression_error &err)
	{
		throw emu_fatalerror("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, argnode.line, expression, err.code_string());
	}
}
Beispiel #17
0
void cheat_manager::load_cheats(const char *filename)
{
	xml_data_node *rootnode = NULL;
	emu_file cheatfile(machine().options().cheat_path(), OPEN_FLAG_READ);
	try
	{
		// open the file with the proper name
		file_error filerr = cheatfile.open(filename, ".xml");

		// loop over all instrances of the files found in our search paths
		while (filerr == FILERR_NONE)
		{
			mame_printf_verbose("Loading cheats file from %s\n", cheatfile.fullpath());

			// read the XML file into internal data structures
			xml_parse_options options = { 0 };
			xml_parse_error error;
			options.error = &error;
			rootnode = xml_file_read(cheatfile, &options);

			// if unable to parse the file, just bail
			if (rootnode == NULL)
				throw emu_fatalerror("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);

			// find the layout node
			xml_data_node *mamecheatnode = xml_get_sibling(rootnode->child, "mamecheat");
			if (mamecheatnode == NULL)
				throw emu_fatalerror("%s.xml: missing mamecheatnode node", filename);

			// validate the config data version
			int version = xml_get_attribute_int(mamecheatnode, "version", 0);
			if (version != CHEAT_VERSION)
				throw emu_fatalerror("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);

			// parse all the elements
			for (xml_data_node *cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != NULL; cheatnode = xml_get_sibling(cheatnode->next, "cheat"))
			{
				// load this entry
				cheat_entry *curcheat = global_alloc(cheat_entry(*this, m_symtable, filename, *cheatnode));

				// make sure we're not a duplicate
				cheat_entry *scannode = NULL;
				if (REMOVE_DUPLICATE_CHEATS)
					for (scannode = m_cheatlist.first(); scannode != NULL; scannode = scannode->next())
						if (strcmp(scannode->description(), curcheat->description()) == 0)
						{
							mame_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), cheatfile.fullpath());
							break;
						}

				// add to the end of the list
				if (scannode == NULL)
					m_cheatlist.append(*curcheat);
				else
					global_free(curcheat);
			}

			// free the file and loop for the next one
			xml_file_free(rootnode);

			// open the next file in sequence
			filerr = cheatfile.open_next();
		}
	}

	// handle errors cleanly
	catch (emu_fatalerror &err)
	{
		mame_printf_error("%s\n", err.string());
		m_cheatlist.reset();
		if (rootnode != NULL)
			xml_file_free(rootnode);
	}
}
Beispiel #18
0
void decode_mesh_v2_xml(model_type *model,int model_head)
{
	int						i,n,k,j,bone_idx,nbone,hit_box_idx,nhit_box,
							mesh_idx,nmesh,nfill,ntrig,
							tag,hit_box_tag,meshes_tag,mesh_tag,
							vertex_tag,bone_tag,vtag,trig_tag,
							materials_tag,material_tag,fills_tag,fill_tag;
	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;

        // options
    
    tag=xml_findfirstchild("Options",model_head);
    if (tag!=-1) {
		model->deform_mode=xml_get_attribute_list(tag,"deform",(char*)deform_mode_str);
	}
	
        // center
    
    tag=xml_findfirstchild("Center",model_head);
    if (tag!=-1) {
		xml_get_attribute_3_coord_int(tag,"offset",&model->center.x,&model->center.y,&model->center.z);
    }
    
        // boxes
    
    tag=xml_findfirstchild("View_Box",model_head);
    if (tag!=-1) {
        xml_get_attribute_3_coord_int(tag,"size",&model->view_box.size.x,&model->view_box.size.y,&model->view_box.size.z);
        xml_get_attribute_3_coord_int(tag,"offset",&model->view_box.offset.x,&model->view_box.offset.y,&model->view_box.offset.z);
    }
	
        // light
        
    tag=xml_findfirstchild("Light",model_head);
    if (tag!=-1) {

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

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

        model->tags.name_bone_tag=xml_get_attribute_model_tag(tag,"name_bone");
    }
	
        // hit boxes
    
    hit_box_tag=xml_findfirstchild("Hit_Boxes",model_head);
	if (hit_box_tag!=-1) {
	
		nhit_box=xml_countchildren(hit_box_tag);
		tag=xml_findfirstchild("Hit_Box",hit_box_tag);
		
		for (i=0;i!=nhit_box;i++) {
 				
				// add new hit box

			hit_box_idx=model_hit_box_add(model);
			if (hit_box_idx==-1) break;

				// fill in hit box

			hit_box=&model->hit_boxes[hit_box_idx];

			xml_get_attribute_text(tag,"name",hit_box->name,64);
			xml_get_attribute_3_coord_int(tag,"size",&hit_box->box.size.x,&hit_box->box.size.y,&hit_box->box.size.z);
			xml_get_attribute_3_coord_int(tag,"offset",&hit_box->box.offset.x,&hit_box->box.offset.y,&hit_box->box.offset.z);
			
			tag=xml_findnextchild(tag);
		}
    }
	else {
		model->nhit_box=0;
	}
    
        // bones
 
    bone_tag=xml_findfirstchild("Bones",model_head);

    nbone=xml_countchildren(bone_tag);
	tag=xml_findfirstchild("Bone",bone_tag);
    
    for (i=0;i!=nbone;i++) {

 			// add new bone

		bone_idx=model_bone_add(model,0,0,0);
		if (bone_idx==-1) break;

			// fill in bone

		bone=&model->bones[bone_idx];
		
		bone->tag=xml_get_attribute_model_tag(tag,"tag");
		xml_get_attribute_text(tag,"name",bone->name,name_str_len);
        
        xml_get_attribute_3_coord_int(tag,"c3",&bone->pnt.x,&bone->pnt.y,&bone->pnt.z);
        bone_parent_tag[i]=xml_get_attribute_model_tag(tag,"parent");
    
		tag=xml_findnextchild(tag);
    }
	
		// find the light bone
		
	for (k=0;k!=max_model_light;k++) {
		model->tags.light_bone_idx[k]=model_find_bone(model,model->tags.light_bone_tag[k]);
	}

	for (k=0;k!=max_model_halo;k++) {
		model->tags.halo_bone_idx[k]=model_find_bone(model,model->tags.halo_bone_tag[k]);
	}

	model->tags.name_bone_idx=model_find_bone(model,model->tags.name_bone_tag);
		
		// reset the bones from tags to indexes
		
	bone=model->bones;
	
	for (i=0;i!=model->nbone;i++) {
		bone->parent_idx=model_find_bone(model,bone_parent_tag[i]);
		bone++;
	}
	
		// meshes
		
	meshes_tag=xml_findfirstchild("Meshes",model_head);

    nmesh=xml_countchildren(meshes_tag);
	mesh_tag=xml_findfirstchild("Mesh",meshes_tag);
	
	model->nmesh=1;				// new models have a single mesh
	
	for (j=0;j!=nmesh;j++) {
	
			// need new mesh?
			
		mesh_idx=j;
		if (j>0) {
			mesh_idx=model_mesh_add(model);
		}
		
		if (mesh_idx==-1) break;
	
			// mesh settings
			
		mesh=&model->meshes[mesh_idx];
		xml_get_attribute_text(mesh_tag,"name",mesh->name,name_str_len);
		mesh->no_lighting=xml_get_attribute_boolean(mesh_tag,"no_lighting");
		mesh->blend_add=xml_get_attribute_boolean(mesh_tag,"additive");
		mesh->tintable=xml_get_attribute_boolean(mesh_tag,"tintable");
		
			// don't allow blank mesh names
			
		if (mesh->name[0]==0x0) {
			if (mesh_idx==0) {
				strcpy(mesh->name,"Default");
			}
			else {
				sprintf(mesh->name,"Mesh %d",mesh_idx);
			}
		}
		
			// vertexes
		
		vertex_tag=xml_findfirstchild("Vertexes",mesh_tag);

		mesh->nvertex=xml_countchildren(vertex_tag);
		tag=xml_findfirstchild("v",vertex_tag);
		
		vertex=mesh->vertexes;
		
		for (i=0;i!=mesh->nvertex;i++) {
			xml_get_attribute_3_coord_int(tag,"c3",&vertex->pnt.x,&vertex->pnt.y,&vertex->pnt.z);
			xml_get_attribute_3_coord_float(tag,"n3",&vertex->normal.x,&vertex->normal.y,&vertex->normal.z);
			
			major_bone_tag[i]=xml_get_attribute_model_tag(tag,"major");
			minor_bone_tag[i]=xml_get_attribute_model_tag(tag,"minor");
			vertex->bone_factor=xml_get_attribute_float_default(tag,"factor",1);
		
			vertex++;
			tag=xml_findnextchild(tag);
		}
		
			// materials
			
		materials_tag=xml_findfirstchild("Materials",mesh_tag);
		
		ntrig=0;
		trig=mesh->trigs;

		texture=model->textures;
		material=mesh->materials;
		
		nfill=xml_countchildren(materials_tag);
		material_tag=xml_findfirstchild("Material",materials_tag);
		
		for (n=0;n!=nfill;n++) {
		
			trig_tag=xml_findfirstchild("Triangles",material_tag);
			
			material->trig_start=ntrig;
			material->trig_count=xml_countchildren(trig_tag)/3;
			
			vtag=xml_findfirstchild("v",trig_tag);
		
			for (i=0;i!=material->trig_count;i++) {
		
				for (k=0;k!=3;k++) {
					trig->v[k]=xml_get_attribute_int(vtag,"id");
					xml_get_attribute_2_coord_float(vtag,"uv",&trig->gx[k],&trig->gy[k]);

					vtag=xml_findnextchild(vtag);
				}
				
				trig++;
				ntrig++;
			}
			
			texture++;
			material++;
			
			material_tag=xml_findnextchild(material_tag);
		}
		
		mesh->ntrig=ntrig;
		
			// reset the vertexes from tags to indexes
			
		vertex=mesh->vertexes;
		
		for (i=0;i!=mesh->nvertex;i++) {
			vertex->major_bone_idx=model_find_bone(model,major_bone_tag[i]);
			vertex->minor_bone_idx=model_find_bone(model,minor_bone_tag[i]);
			if ((vertex->major_bone_idx==-1) || (vertex->minor_bone_idx==-1)) vertex->bone_factor=1;
			vertex++;
		}
		
		mesh_tag=xml_findnextchild(mesh_tag);
	}
	
	model->nmesh=nmesh;
  
        // fills

    fills_tag=xml_findfirstchild("Fills",model_head);
	nfill=xml_countchildren(fills_tag);

	texture=model->textures;
	
	fill_tag=xml_findfirstchild("Fill",fills_tag);
    
    for (n=0;n!=nfill;n++) {
	
		texture->animate.current_frame=0;
		texture->animate.total_wait=0;
		
		bitmap_texture_read_xml(texture,fill_tag,FALSE);
		texture++;
		
		fill_tag=xml_findnextchild(fill_tag);
    }
}
Beispiel #19
0
void cheat_manager::load_cheats(const char *filename)
{
	xml_data_node *rootnode = nullptr;
	std::string searchstr(machine().options().cheat_path());
	path_iterator path(searchstr.c_str());
	std::string curpath;
	while (path.next(curpath))
	{
		searchstr.append(";").append(curpath).append(PATH_SEPARATOR).append("cheat");
	}
	emu_file cheatfile(searchstr.c_str(), OPEN_FLAG_READ);
	try
	{
		// open the file with the proper name
		osd_file::error filerr = cheatfile.open(filename, ".xml");

		// loop over all instrances of the files found in our search paths
		while (filerr == osd_file::error::NONE)
		{
			osd_printf_verbose("Loading cheats file from %s\n", cheatfile.fullpath());

			// read the XML file into internal data structures
			xml_parse_options options = { nullptr };
			xml_parse_error error;
			options.error = &error;
			rootnode = xml_file_read(cheatfile, &options);

			// if unable to parse the file, just bail
			if (rootnode == nullptr)
				throw emu_fatalerror("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);

			// find the layout node
			xml_data_node *mamecheatnode = xml_get_sibling(rootnode->child, "mamecheat");
			if (mamecheatnode == nullptr)
				throw emu_fatalerror("%s.xml: missing mamecheatnode node", filename);

			// validate the config data version
			int version = xml_get_attribute_int(mamecheatnode, "version", 0);
			if (version != CHEAT_VERSION)
				throw emu_fatalerror("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);

			// parse all the elements
			for (xml_data_node *cheatnode = xml_get_sibling(mamecheatnode->child, "cheat"); cheatnode != nullptr; cheatnode = xml_get_sibling(cheatnode->next, "cheat"))
			{
				// load this entry
				auto curcheat = std::make_unique<cheat_entry>(*this, m_symtable, filename, *cheatnode);

				// make sure we're not a duplicate
				if (REMOVE_DUPLICATE_CHEATS && curcheat->is_duplicate())
				{
					osd_printf_verbose("Ignoring duplicate cheat '%s' from file %s\n", curcheat->description(), cheatfile.fullpath());
				}
				else // add to the end of the list
					m_cheatlist.push_back(std::move(curcheat));
			}

			// free the file and loop for the next one
			xml_file_free(rootnode);

			// open the next file in sequence
			filerr = cheatfile.open_next();
		}
	}

	// handle errors cleanly
	catch (emu_fatalerror &err)
	{
		osd_printf_error("%s\n", err.string());
		m_cheatlist.clear();
		if (rootnode != nullptr)
			xml_file_free(rootnode);
	}
}
Beispiel #20
0
void decode_mesh_v1_xml(model_type *model,int model_head)
{
	int						i,n,k,bone_idx,nbone,hit_box_idx,nhit_box,
							nfill,ntrig,frame_count,
							tag,hit_box_tag,vertex_tag,bone_tag,vtag,trig_tag,image_tag,
							fills_tag,fill_tag;
	model_hit_box_type		*hit_box;
    model_vertex_type		*vertex;
	model_material_type		*material;
    model_bone_type			*bone;
    model_trig_type			*trig;
    texture_type			*texture;
	
        // options
    
    tag=xml_findfirstchild("Options",model_head);
    if (tag!=-1) {
		model->deform_mode=xml_get_attribute_list(tag,"deform",(char*)deform_mode_str);
	}
	
        // center
    
    tag=xml_findfirstchild("Center",model_head);
    if (tag!=-1) {
		xml_get_attribute_3_coord_int(tag,"offset",&model->center.x,&model->center.y,&model->center.z);
    }
    
        // boxes
    
    tag=xml_findfirstchild("View_Box",model_head);
    if (tag!=-1) {
        xml_get_attribute_3_coord_int(tag,"size",&model->view_box.size.x,&model->view_box.size.y,&model->view_box.size.z);
        xml_get_attribute_3_coord_int(tag,"offset",&model->view_box.offset.x,&model->view_box.offset.y,&model->view_box.offset.z);
    }
	
        // light
        
    tag=xml_findfirstchild("Light",model_head);
    if (tag!=-1) {
        model->tags.light_bone_tag[0]=xml_get_attribute_model_tag(tag,"light_bone");
        model->tags.halo_bone_tag[0]=xml_get_attribute_model_tag(tag,"halo_bone");
    }
	
        // hit boxes
    
    hit_box_tag=xml_findfirstchild("Hit_Boxes",model_head);
	if (hit_box_tag!=-1) {
	
		nhit_box=xml_countchildren(hit_box_tag);
		tag=xml_findfirstchild("Hit_Box",hit_box_tag);
		
		for (i=0;i!=model->nhit_box;i++) {
 				
				// add new hit box

			hit_box_idx=model_hit_box_add(model);
			if (hit_box_idx==-1) break;

				// fill in hit box

			hit_box=&model->hit_boxes[hit_box_idx];

			xml_get_attribute_text(tag,"name",hit_box->name,64);
			xml_get_attribute_3_coord_int(tag,"size",&hit_box->box.size.x,&hit_box->box.size.y,&hit_box->box.size.z);
			xml_get_attribute_3_coord_int(tag,"offset",&hit_box->box.offset.x,&hit_box->box.offset.y,&hit_box->box.offset.z);
			
			tag=xml_findnextchild(tag);
		}
    }
	else {
		model->nhit_box=0;
	}
	
		// single mesh
		
	model->nmesh=1;
	strcpy(model->meshes[0].name,"Default");
	
        // vertexes
    
    vertex_tag=xml_findfirstchild("Vertexes",model_head);

    model->meshes[0].nvertex=xml_countchildren(vertex_tag);
	tag=xml_findfirstchild("v",vertex_tag);
	
    vertex=model->meshes[0].vertexes;
    
    for (i=0;i!=model->meshes[0].nvertex;i++) {
        xml_get_attribute_3_coord_int(tag,"c3",&vertex->pnt.x,&vertex->pnt.y,&vertex->pnt.z);
        xml_get_attribute_3_coord_float(tag,"n3",&vertex->normal.x,&vertex->normal.y,&vertex->normal.z);
		
        major_bone_tag[i]=xml_get_attribute_model_tag(tag,"major");
        minor_bone_tag[i]=xml_get_attribute_model_tag(tag,"minor");
        vertex->bone_factor=xml_get_attribute_float_default(tag,"factor",1);
    
        vertex++;
		tag=xml_findnextchild(tag);
    }
    
        // bones

    bone_tag=xml_findfirstchild("Bones",model_head);

    nbone=xml_countchildren(bone_tag);
	tag=xml_findfirstchild("Bone",bone_tag);
    
    for (i=0;i!=nbone;i++) {

			// add new bone

		bone_idx=model_bone_add(model,0,0,0);
		if (bone_idx==-1) break;

			// fill in bone

		bone=&model->bones[bone_idx];

        bone->tag=xml_get_attribute_model_tag(tag,"tag");
		xml_get_attribute_text(tag,"name",bone->name,name_str_len);
        
        xml_get_attribute_3_coord_int(tag,"c3",&bone->pnt.x,&bone->pnt.y,&bone->pnt.z);
        bone_parent_tag[i]=xml_get_attribute_model_tag(tag,"parent");
    
		tag=xml_findnextchild(tag);
    }
	
		// find the light bone
		
	model->tags.light_bone_idx[0]=model_find_bone(model,model->tags.light_bone_tag[0]);
	model->tags.halo_bone_idx[0]=model_find_bone(model,model->tags.halo_bone_tag[0]);
   
		// reset the vertexes from tags to indexes
		
	vertex=model->meshes[0].vertexes;
	
	for (i=0;i!=model->meshes[0].nvertex;i++) {
		vertex->major_bone_idx=model_find_bone(model,major_bone_tag[i]);
		vertex->minor_bone_idx=model_find_bone(model,minor_bone_tag[i]);
        if ((vertex->major_bone_idx==-1) || (vertex->minor_bone_idx==-1)) vertex->bone_factor=1;
		vertex++;
	}
		
		// reset the bones from tags to indexes
		
	bone=model->bones;
	
	for (i=0;i!=model->nbone;i++) {
		bone->parent_idx=model_find_bone(model,bone_parent_tag[i]);
		bone++;
	}
    
        // fills

	bzero(model->textures,(max_model_texture*sizeof(texture_type)));

		// count total # of trigs
		
    fills_tag=xml_findfirstchild("Fills",model_head);
	
    nfill=xml_countchildren(fills_tag);
	fill_tag=xml_findfirstchild("Fill",fills_tag);
    
	ntrig=0;
	
    for (n=0;n!=nfill;n++) {
        trig_tag=xml_findfirstchild("Triangles",fill_tag);
        ntrig+=xml_countchildren(trig_tag)/3;
		fill_tag=xml_findnextchild(fill_tag);
	}

		// load the fills and trigs
		
    ntrig=0;
    trig=model->meshes[0].trigs;

	texture=model->textures;
	material=model->meshes[0].materials;
	
	fill_tag=xml_findfirstchild("Fill",fills_tag);
    
    for (n=0;n!=nfill;n++) {
		texture->animate.current_frame=0;
		texture->animate.total_wait=0;
		
      	texture->animate.on=xml_get_attribute_boolean(fill_tag,"animate");
         
		image_tag=xml_findfirstchild("Images",fill_tag);
			
		frame_count=xml_countchildren(image_tag);
		tag=xml_findfirstchild("Image",image_tag);
		
		for (k=0;k!=frame_count;k++) {
			texture->animate.wait[k]=xml_get_attribute_int(tag,"wait");
			texture->animate.end_tick[k]=texture->animate.total_wait=texture->animate.total_wait+texture->animate.wait[k];
			xml_get_attribute_text(tag,"bitmap",texture->frames[k].name,file_str_len);
			
			tag=xml_findnextchild(tag);
		}
        
            // fill triangles
    
        trig_tag=xml_findfirstchild("Triangles",fill_tag);
        
        material->trig_start=ntrig;
        material->trig_count=xml_countchildren(trig_tag)/3;
		
		vtag=xml_findfirstchild("v",trig_tag);
    
        for (i=0;i!=material->trig_count;i++) {
    
            for (k=0;k!=3;k++) {
                trig->v[k]=xml_get_attribute_int(vtag,"id");
				xml_get_attribute_2_coord_float(vtag,"uv",&trig->gx[k],&trig->gy[k]);

				vtag=xml_findnextchild(vtag);
            }
            
            trig++;
            ntrig++;
        }
		
		texture++;
		material++;
		
		fill_tag=xml_findnextchild(fill_tag);
    }
    
    model->meshes[0].ntrig=ntrig;
}
Beispiel #21
0
static int config_load_xml(running_machine &machine, emu_file &file, int which_type)
{
	xml_data_node *root, *confignode, *systemnode;
	config_type *type;
	const char *srcfile;
	int version, count;

	/* read the file */
	root = xml_file_read(file, NULL);
	if (!root)
		goto error;

	/* find the config node */
	confignode = xml_get_sibling(root->child, "mameconfig");
	if (!confignode)
		goto error;

	/* validate the config data version */
	version = xml_get_attribute_int(confignode, "version", 0);
	if (version != CONFIG_VERSION)
		goto error;

	/* strip off all the path crap from the source filename */
	srcfile = strrchr(machine.system().source_file, '/');
	if (!srcfile)
		srcfile = strrchr(machine.system().source_file, '\\');
	if (!srcfile)
		srcfile = strrchr(machine.system().source_file, ':');
	if (!srcfile)
		srcfile = machine.system().source_file;
	else
		srcfile++;

	/* loop over all system nodes in the file */
	count = 0;
	for (systemnode = xml_get_sibling(confignode->child, "system"); systemnode; systemnode = xml_get_sibling(systemnode->next, "system"))
	{
		/* look up the name of the system here; skip if none */
		const char *name = xml_get_attribute_string(systemnode, "name", "");

		/* based on the file type, determine whether we have a match */
		switch (which_type)
		{
			case CONFIG_TYPE_GAME:
				/* only match on the specific game name */
				if (strcmp(name, machine.system().name) != 0)
					continue;
				break;

			case CONFIG_TYPE_DEFAULT:
				/* only match on default */
				if (strcmp(name, "default") != 0)
					continue;
				break;

			case CONFIG_TYPE_CONTROLLER:
			{
				int clone_of;
				/* match on: default, game name, source file name, parent name, grandparent name */
				if (strcmp(name, "default") != 0 &&
					strcmp(name, machine.system().name) != 0 &&
					strcmp(name, srcfile) != 0 &&
					((clone_of = driver_list::clone(machine.system())) == -1 || strcmp(name, driver_list::driver(clone_of).name) != 0) &&
					(clone_of == -1 || ((clone_of = driver_list::clone(clone_of)) == -1) || strcmp(name, driver_list::driver(clone_of).name) != 0))
					continue;
				break;
			}
		}

		/* log that we are processing this entry */
		if (DEBUG_CONFIG)
			osd_printf_debug("Entry: %s -- processing\n", name);

		/* loop over all registrants and call their load function */
		for (type = typelist; type; type = type->next)
			type->load(which_type, xml_get_sibling(systemnode->child, type->name));
		count++;
	}

	/* error if this isn't a valid game match */
	if (count == 0)
		goto error;

	/* free the parser */
	xml_file_free(root);
	return 1;

error:
	if (root)
		xml_file_free(root);
	return 0;
}
Beispiel #22
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();
}
Beispiel #23
0
cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node &entrynode, bool isaction)
	: m_next(NULL),
		m_condition(&symbols),
		m_expression(&symbols)
{
	const char *expression = NULL;
	try
	{
		// read the condition if present
		expression = xml_get_attribute_string(&entrynode, "condition", NULL);
		if (expression != NULL)
			m_condition.parse(expression);

		// if this is an action, parse the expression
		if (isaction)
		{
			expression = entrynode.value;
			if (expression == NULL || expression[0] == 0)
				throw emu_fatalerror("%s.xml(%d): missing expression in action tag\n", filename, entrynode.line);
			m_expression.parse(expression);
		}

		// otherwise, parse the attributes and arguments
		else
		{
			// extract format
			const char *format = xml_get_attribute_string(&entrynode, "format", NULL);
			if (format == NULL || format[0] == 0)
				throw emu_fatalerror("%s.xml(%d): missing format in output tag\n", filename, entrynode.line);
			m_format.cpy(format);

			// extract other attributes
			m_line = xml_get_attribute_int(&entrynode, "line", 0);
			m_justify = JUSTIFY_LEFT;
			const char *align = xml_get_attribute_string(&entrynode, "align", "left");
			if (strcmp(align, "center") == 0)
				m_justify = JUSTIFY_CENTER;
			else if (strcmp(align, "right") == 0)
				m_justify = JUSTIFY_RIGHT;
			else if (strcmp(align, "left") != 0)
				throw emu_fatalerror("%s.xml(%d): invalid alignment '%s' specified\n", filename, entrynode.line, align);

			// then parse arguments
			int totalargs = 0;
			for (xml_data_node *argnode = xml_get_sibling(entrynode.child, "argument"); argnode != NULL; argnode = xml_get_sibling(argnode->next, "argument"))
			{
				output_argument &curarg = m_arglist.append(*global_alloc(output_argument(manager, symbols, filename, *argnode)));

				// verify we didn't overrun the argument count
				totalargs += curarg.count();
				if (totalargs > MAX_ARGUMENTS)
					throw emu_fatalerror("%s.xml(%d): too many arguments (found %d, max is %d)\n", filename, argnode->line, totalargs, MAX_ARGUMENTS);
			}

			// validate the format against the arguments
			validate_format(filename, entrynode.line);
		}
	}
	catch (expression_error &err)
	{
		throw emu_fatalerror("%s.xml(%d): error parsing cheat expression \"%s\" (%s)\n", filename, entrynode.line, expression, err.code_string());
	}
}
Beispiel #24
0
cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, xml_data_node &cheatnode)
	: m_manager(manager),
		m_next(NULL),
		m_on_script(NULL),
		m_off_script(NULL),
		m_change_script(NULL),
		m_run_script(NULL),
		m_symbols(&manager.machine(), &globaltable),
		m_state(SCRIPT_STATE_OFF),
		m_numtemp(DEFAULT_TEMP_VARIABLES),
		m_argindex(0)
{
	// reset scripts
	try
	{
		// pull the variable count out ahead of things
		int tempcount = xml_get_attribute_int(&cheatnode, "tempvariables", DEFAULT_TEMP_VARIABLES);
		if (tempcount < 1)
			throw emu_fatalerror("%s.xml(%d): invalid tempvariables attribute (%d)\n", filename, cheatnode.line, tempcount);

		// allocate memory for the cheat
		m_numtemp = tempcount;

		// get the description
		const char *description = xml_get_attribute_string(&cheatnode, "desc", NULL);
		if (description == NULL || description[0] == 0)
			throw emu_fatalerror("%s.xml(%d): empty or missing desc attribute on cheat\n", filename, cheatnode.line);
		m_description = description;

		// create the symbol table
		m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex);
		astring tempname;
		for (int curtemp = 0; curtemp < tempcount; curtemp++)
			m_symbols.add(tempname.format("temp%d", curtemp), symbol_table::READ_WRITE);

		// read the first comment node
		xml_data_node *commentnode = xml_get_sibling(cheatnode.child, "comment");
		if (commentnode != NULL)
		{
			// set the value if not NULL
			if (commentnode->value != NULL && commentnode->value[0] != 0)
				m_comment.cpy(commentnode->value);

			// only one comment is kept
			commentnode = xml_get_sibling(commentnode->next, "comment");
			if (commentnode != NULL)
				mame_printf_warning("%s.xml(%d): only one comment node is retained; ignoring additional nodes\n", filename, commentnode->line);
		}

		// read the first parameter node
		xml_data_node *paramnode = xml_get_sibling(cheatnode.child, "parameter");
		if (paramnode != NULL)
		{
			// load this parameter
			m_parameter.reset(global_alloc(cheat_parameter(manager, m_symbols, filename, *paramnode)));

			// only one parameter allowed
			paramnode = xml_get_sibling(paramnode->next, "parameter");
			if (paramnode != NULL)
				mame_printf_warning("%s.xml(%d): only one parameter node allowed; ignoring additional nodes\n", filename, paramnode->line);
		}

		// read the script nodes
		for (xml_data_node *scriptnode = xml_get_sibling(cheatnode.child, "script"); scriptnode != NULL; scriptnode = xml_get_sibling(scriptnode->next, "script"))
		{
			// load this entry
			cheat_script *curscript = global_alloc(cheat_script(manager, m_symbols, filename, *scriptnode));

			// if we have a script already for this slot, it is an error
			auto_pointer<cheat_script> &slot = script_for_state(curscript->state());
			if (slot != NULL)
				mame_printf_warning("%s.xml(%d): only one on script allowed; ignoring additional scripts\n", filename, scriptnode->line);
			else
				slot.reset(curscript);
		}
	}
	catch (emu_fatalerror &)
	{
		// call our destructor to clean up and re-throw
		this->~cheat_entry();
		throw;
	}
}
Beispiel #25
0
void DasmWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
{
	WindowQtConfig::recoverFromXmlNode(node);
	m_cpu = xml_get_attribute_int(node, "cpu", m_cpu);
	m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar);
}
Beispiel #26
0
void BreakpointsWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
{
	WindowQtConfig::recoverFromXmlNode(node);
	m_bwType = xml_get_attribute_int(node, "bwtype", m_bwType);
}
static int debug_comment_load_xml(mame_file *fp)
{
	int i, j;
	xml_data_node *root, *commentnode, *systemnode, *cpunode, *datanode;
	const char *name;
	int version;

	/* read the file */
	root = xml_file_read(fp, NULL);
	if (!root)
		goto error;

	/* find the config node */
	commentnode = xml_get_sibling(root->child, "mamecommentfile");
	if (!commentnode)
		goto error;

	/* validate the config data version */
	version = xml_get_attribute_int(commentnode, "version", 0);
	if (version != COMMENT_VERSION)
		goto error;

	/* check to make sure the file is applicable */
	systemnode = xml_get_sibling(commentnode->child, "system");
	name = xml_get_attribute_string(systemnode, "name", "");
	if (strcmp(name, Machine->gamedrv->name) != 0)
		goto error;

	i = 0;

	for (cpunode = xml_get_sibling(systemnode->child, "cpu"); cpunode; cpunode = xml_get_sibling(cpunode->next, "cpu"))
	{
		j = 0;

		for (datanode = xml_get_sibling(cpunode->child, "comment"); datanode; datanode = xml_get_sibling(datanode->next, "comment"))
		{
			/* Malloc the comment */
			debug_comments[i].comment_info[j] = (debug_comment*) malloc(sizeof(debug_comment));

			debug_comments[i].comment_info[j]->address = xml_get_attribute_int(datanode, "address", 0);
			debug_comments[i].comment_info[j]->color = xml_get_attribute_int(datanode, "color", 0);
			sscanf(xml_get_attribute_string(datanode, "crc", 0), "%08X", &debug_comments[i].comment_info[j]->crc);
			strcpy(debug_comments[i].comment_info[j]->text, datanode->value);
			debug_comments[i].comment_info[j]->is_valid = 1;

			j++;
		}

		debug_comments[i].comment_count = j;

		i++;
	}

	/* free the parser */
	xml_file_free(root);

	return 1;

error:
	if (root)
		xml_file_free(root);
	return 0;
}
Beispiel #28
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();
}
Beispiel #29
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);
}