Exemplo n.º 1
0
static int loschange(int /*argc*/, char** /*argv*/)
{
  Core::USTRUCT_TILE tile;

  Core::open_uo_data_files();
  Core::read_uo_data();

  for (int i = 0; i <= 0xFFFF; i++)
  {
    unsigned short objtype = (unsigned short) i;
    read_objinfo(objtype, tile);

    bool old_lostest = (tile.flags & Core::USTRUCT_TILE::FLAG_WALKBLOCK)
                       != 0;

    bool new_lostest = (tile.flags
                        & (Core::USTRUCT_TILE::FLAG_WALKBLOCK
                           | Core::USTRUCT_TILE::FLAG_NO_SHOOT)) != 0;

    if (old_lostest != new_lostest)
    {
      display_tileinfo(objtype, tile);
      INFO_PRINT.Format(" Old LOS: %s\n New LOS: %s\n")
          << (old_lostest ? "true" : "false")
          << (new_lostest ? "true" : "false");

    }

  }
  Core::clear_tiledata();
  return 0;
}
Exemplo n.º 2
0
void print_widedata( u16 i, MultiDef* multi )
{
    if (multi->hull.empty())
        return;

    USTRUCT_TILE tile;
    read_objinfo( i+(config.max_tile_id+1), tile );
    cout << "Multi 0x" << hex << i+(config.max_tile_id+1) << dec 
         << " -- " << tile.name << ":" << endl;
    for( short y = multi->minry; y <= multi->maxry; ++y )
    {
        for( short x = multi->minrx; x <= multi->maxrx; ++x )
        {
            const MULTI_ELEM* elem = multi->find_component( x, y );
            if (elem != NULL)
            {
                cout << hex << setw(8) << elem->is_static << dec << ":";
            }
            else
            {
                cout << hex << "        " << dec << ":";
            }
        }
        cout << endl;
    }
    cout << endl;
}
Exemplo n.º 3
0
static int flagsearch(int argc, char** argv)
{
  Core::USTRUCT_TILE tile;

  Core::open_uo_data_files();
  Core::read_uo_data();

  if (argc < 3)
    return 1;

  unsigned int flags = strtoul(argv[2], NULL, 0);
  unsigned int notflags = 0;
  if (argc >= 4)
    notflags = strtoul(argv[3], NULL, 0);

  int i;
  for (i = 0; i <= 0xFFFF; i++)
  {
    unsigned short objtype = (unsigned short) i;
    read_objinfo(objtype, tile);
    if (((tile.flags & flags) == flags)
        && ((~tile.flags & notflags) == notflags))
    {
      display_tileinfo(objtype, tile);
    }
  }
  Core::clear_tiledata();
  return 0;
}
Exemplo n.º 4
0
int loschange( int argc, char **argv )
{
	USTRUCT_TILE tile;
    
    open_uo_data_files();
    read_uo_data();
    
	for( int i = 0; i <= 0xFFFF; i++ )
	{
		unsigned short objtype = (unsigned short) i;
		read_objinfo( objtype, tile );
        
        bool old_lostest = (tile.flags & USTRUCT_TILE::FLAG_WALKBLOCK) != 0;

        bool new_lostest = (tile.flags & (USTRUCT_TILE::FLAG_WALKBLOCK|USTRUCT_TILE::FLAG_NO_SHOOT)) != 0;


        if (old_lostest != new_lostest)
        {
            display_tileinfo( objtype, tile );
            printf( " Old LOS: %s\n", old_lostest?"true":"false" );
            printf( " New LOS: %s\n", new_lostest?"true":"false" );

        }
         
	}
	clear_tiledata();
	return 0;
}
Exemplo n.º 5
0
void print_multihull( u16 i, MultiDef* multi)
{
    if (multi->hull.empty())
        return;

    USTRUCT_TILE tile;
    read_objinfo( i+(config.max_tile_id+1), tile );
    cout << "Multi 0x" << hex << i+i+(config.max_tile_id+1) << dec 
         << " -- " << tile.name << ":" << endl;
    for( short y = multi->minry; y <= multi->maxry; ++y )
    {
        for( short x = multi->minrx; x <= multi->maxrx; ++x )
        {
            unsigned short key = multi->getkey( x,y );
            bool external = multi->hull2.count(key) != 0;
            bool internal = multi->internal_hull2.count(key) != 0;
            bool origin = (x == 0 && y == 0);

            if (external && !internal)
                cout << 'H';
            else if (!external && internal)
                cout << 'i';
            else if (external && internal)
                cout << 'I';
            else if (origin)
                cout << '*';
            else
                cout << ' ';
        }
        cout << endl;
    }
    cout << endl;
}
Exemplo n.º 6
0
	void print_widedata( u16 i, Multi::MultiDef* multi )
	{
	  if ( multi->hull.empty() )
		return;

	  Core::USTRUCT_TILE tile;
      read_objinfo( static_cast<u16>( i + ( Plib::systemstate.config.max_tile_id + 1 ) ), tile );
      INFO_PRINT << "Multi 0x" << fmt::hexu( i + ( Plib::systemstate.config.max_tile_id + 1 ) )
		<< " -- " << tile.name << ":\n";
      fmt::Writer tmp;
	  for ( short y = multi->minry; y <= multi->maxry; ++y )
	  {
		for ( short x = multi->minrx; x <= multi->maxrx; ++x )
		{
		  const Multi::MULTI_ELEM* elem = multi->find_component( x, y );
		  if ( elem != NULL )
		  {
            tmp << "0x" << fmt::pad( fmt::hexu( elem->is_static ), 6 ) << ":";
		  }
		  else
		  {
            tmp << "        " << ":";
		  }
		}
        tmp << "\n";
	  }
      tmp << "\n";
      INFO_PRINT << tmp.str();
	}
Exemplo n.º 7
0
	void print_multihull( u16 i, Multi::MultiDef* multi )
	{
	  if ( multi->hull.empty() )
		return;

	  Core::USTRUCT_TILE tile;
      read_objinfo( static_cast<u16>( i + ( Plib::systemstate.config.max_tile_id + 1 ) ), tile );
      INFO_PRINT << "Multi 0x" << fmt::hexu (i + i + ( Plib::systemstate.config.max_tile_id + 1 ) )
		<< " -- " << tile.name << ":\n";
      fmt::Writer tmp;
	  for ( short y = multi->minry; y <= multi->maxry; ++y )
	  {
		for ( short x = multi->minrx; x <= multi->maxrx; ++x )
		{
		  unsigned short key = multi->getkey( x, y );
		  bool external = multi->hull2.count( key ) != 0;
		  bool internal = multi->internal_hull2.count( key ) != 0;
		  bool origin = ( x == 0 && y == 0 );

		  if ( external && !internal )
            tmp << 'H';
		  else if ( !external && internal )
            tmp << 'i';
		  else if ( external && internal )
            tmp << 'I';
		  else if ( origin )
            tmp << '*';
		  else
            tmp << ' ';
		}
        tmp << "\n";
	  }
      tmp << "\n";
      INFO_PRINT << tmp.str( );
	}
Exemplo n.º 8
0
static int vertile()
{
  Core::USTRUCT_TILE tile;

  Core::open_uo_data_files();
  Core::read_uo_data();

  int i;
  for (i = 0; i <= 0xFFFF; i++)
  {
    unsigned short objtype = (unsigned short) i;
    read_objinfo(objtype, tile);
    display_tileinfo(objtype, tile);
  }
  Core::clear_tiledata();
  return 0;
}
Exemplo n.º 9
0
int vertile( int argc, char **argv )
{
	USTRUCT_TILE tile;
    
    open_uo_data_files();
    read_uo_data();

	int i;
	for( i = 0; i <= 0xFFFF; i++ )
	{
		unsigned short objtype = (unsigned short) i;
		read_objinfo( objtype, tile );
        display_tileinfo( objtype, tile );
	}
	clear_tiledata();
	return 0;
}
Exemplo n.º 10
0
	void print_multidata( u16 i, Multi::MultiDef* multi )
	{
	  if ( multi->hull.empty() )
		return;

	  Core::USTRUCT_TILE tile;
      read_objinfo( static_cast<u16>( i + ( Plib::systemstate.config.max_tile_id + 1 ) ), tile );
      INFO_PRINT << "Multi 0x" << fmt::hexu( i + ( Plib::systemstate.config.max_tile_id + 1 ) )
        << " -- " << tile.name << ":\n";
      fmt::Writer tmp;
	  for ( const auto &_itr : multi->components )
	  {
		const Multi::MULTI_ELEM* elem = _itr.second;
        tmp << "0x" << fmt::hexu( elem->objtype)
		  << " 0x" << fmt::hexu((int)elem->is_static)
		  << ":"  << elem->x << "," << elem->y << "," << elem->z << "\n";
	  }
      INFO_PRINT << tmp.str();
	}
Exemplo n.º 11
0
void print_multidata( u16 i, MultiDef* multi )
{
    if (multi->hull.empty())
        return;

    USTRUCT_TILE tile;
    read_objinfo( i+(config.max_tile_id+1), tile );
    cout << "Multi 0x" << hex << i+(config.max_tile_id+1) << dec 
         << " -- " << tile.name << ":" << endl;
    
    for( MultiDef::Components::iterator itr = multi->components.begin(), end = multi->components.end();
         itr != end;
         ++itr )
    {
        const MULTI_ELEM* elem = itr->second;
        cout << "0x" << hex << elem->objtype
             << " %d" << (int) elem->is_static 
             << ":" << dec <<  elem->x << "," << elem->y << "," << elem->z << endl;

    }
}
Exemplo n.º 12
0
	void create_tiles_cfg()
	{
	  FILE* fp = fopen( "tiles.cfg", "wt" );
	  int mountCount;
	  char name[21];

	  unsigned count = 0;
	  for ( unsigned int graphic_i = 0; graphic_i <= Plib::systemstate.config.max_tile_id; ++graphic_i )
	  {
		u16 graphic = static_cast<u16>( graphic_i );
		USTRUCT_TILE tile;
		if ( cfg_use_new_hsa_format )
		{
		  USTRUCT_TILE_HSA newtile;
		  read_objinfo( graphic, newtile );
		  tile.anim = newtile.anim;
		  tile.flags = newtile.flags;
		  tile.height = newtile.height;
		  tile.layer = newtile.layer;
		  memcpy( tile.name, newtile.name, sizeof tile.name );
		  tile.unk14 = newtile.unk14;
		  tile.unk15 = newtile.unk15;
		  tile.unk6 = newtile.unk6;
		  tile.unk7 = newtile.unk7;
		  tile.unk8 = newtile.unk8;
		  tile.unk9 = newtile.unk9;
		  tile.weight = newtile.weight;
		}
		else
		  read_objinfo( graphic, tile );
		mountCount = static_cast<int>( MountTypes.count( graphic ) );

		if ( tile.name[0] == '\0' &&
			 tile.flags == 0 &&
			 tile.layer == 0 &&
			 tile.height == 0 &&
			 mountCount == 0
			 )
		{
		  continue;
		}
		unsigned int flags = polflags_from_tileflags( graphic, tile.flags, cfg_use_no_shoot, cfg_LOS_through_windows );
		if ( mountCount != 0 )
		{
		  tile.layer = 25;
		  flags |= FLAG::EQUIPPABLE;
		}

		memset( name, 0, sizeof name );
		memcpy( name, tile.name, sizeof tile.name );

		fprintf( fp, "tile 0x%x\n", graphic );
		fprintf( fp, "{\n" );
		fprintf( fp, "    Desc %s\n", name );
		fprintf( fp, "    UoFlags 0x%08lx\n", static_cast<unsigned long>( tile.flags ) );
		if ( tile.layer )
		  fprintf( fp, "    Layer %u\n", tile.layer );
		fprintf( fp, "    Height %u\n", tile.height );
		fprintf( fp, "    Weight %u\n", tile.weight );
		write_flags( fp, flags );
		fprintf( fp, "}\n" );
		fprintf( fp, "\n" );
		++count;
	  }
	  fclose( fp );

      INFO_PRINT << count << " tile definitions written to tiles.cfg\n";
	}