示例#1
0
	int landtileflagsearch( int argc, char **argv )
	{

      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 );

	  Core::USTRUCT_LAND_TILE landtile;

	  int i;
	  for ( i = 0; i < 0x4000; i++ )
	  {
		unsigned short objtype = (unsigned short)i;
		readlandtile( objtype, &landtile );
		if ( ( landtile.flags & flags ) == flags &&
			 ( ~landtile.flags & notflags ) == notflags )
		{
          INFO_PRINT << "Land Tile: 0x" << fmt::hexu( objtype ) << "\n"
            << "\tflags: 0x" << fmt::hexu( landtile.flags ) << "\n"
            << "\t  unk: 0x" << fmt::hexu( landtile.unk ) << "\n"
            << "\t name: " << landtile.name << "\n";
		}
	  }
      Core::clear_tiledata( );
	  return 0;
	}
示例#2
0
	int landtilecfg( int /*argc*/, char** /*argv*/ )
	{
	  Core::USTRUCT_LAND_TILE landtile;

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

	  typedef std::map<std::string, unsigned> M;
	  M tilecount;

	  int i;
	  for ( i = 0; i < 0x4000; i++ )
	  {
		unsigned short objtype = (unsigned short)i;
		readlandtile( objtype, &landtile );
		tilecount[landtile.name] = tilecount[landtile.name] + 1;
	  }

      fmt::Writer tmp;
	  for ( const auto &elem : tilecount )
	  {
		tmp << elem.first << ": " << elem.second << "\n";
	  }
      INFO_PRINT << tmp.str();
      Core::clear_tiledata( );
	  return 0;
	}
示例#3
0
static void read_landtiledata()
{
    for( u16 objtype = 0; objtype < N_LANDTILEDATA; ++objtype )
    {
        USTRUCT_LAND_TILE landtile;
        readlandtile( objtype, &landtile );

        landtile_flags_arr[objtype] = landtile.flags;
    }
}
示例#4
0
	void create_landtiles_cfg()
	{
	  FILE* fp = fopen( "landtiles.cfg", "wt" );
	  unsigned count = 0;

	  for ( u16 i = 0; i <= 0x3FFF; ++i )
	  {
		USTRUCT_LAND_TILE landtile;
		if ( cfg_use_new_hsa_format )
		{
		  USTRUCT_LAND_TILE_HSA newlandtile;
		  readlandtile( i, &newlandtile );
		  landtile.flags = newlandtile.flags;
		  landtile.unk = newlandtile.unk;
		  memcpy( landtile.name, newlandtile.name, sizeof landtile.name );
		}
		else
		  readlandtile( i, &landtile );

		if ( landtile.name[0] || landtile.flags )
		{
		  fprintf( fp, "landtile 0x%x\n", i );
		  fprintf( fp, "{\n" );
		  fprintf( fp, "    Name %s\n", landtile.name );
		  fprintf( fp, "    UoFlags 0x%08lx\n", static_cast<unsigned long>( landtile.flags ) );

		  unsigned int flags = polflags_from_landtileflags( i, landtile.flags );
		  flags &= ~FLAG::MOVABLE; // movable makes no sense for landtiles
		  write_flags( fp, flags );
		  fprintf( fp, "}\n" );
		  fprintf( fp, "\n" );
		  ++count;
		}
	  }
	  fclose( fp );

      INFO_PRINT << count << " landtile definitions written to landtiles.cfg\n";
	}
示例#5
0
static int verlandtile()
{
  Core::USTRUCT_LAND_TILE landtile;

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

  int i;
  for (i = 0; i <= 0x3FFF; i++)
  {
    unsigned short objtype = (unsigned short) i;
    readlandtile(objtype, &landtile);
    if (landtile.flags || landtile.unk || landtile.name[0])
    {
      INFO_PRINT << "Land Tile: 0x" << fmt::hexu(objtype) << "\n"
                 << "\tflags: 0x" << fmt::hexu(landtile.flags) << "\n"
                 << "\t  unk: 0x" << fmt::hexu(landtile.unk) << "\n"
                 << "\t name: " << landtile.name << "\n";
    }
  }
  Core::clear_tiledata();
  return 0;
}
示例#6
0
int verlandtile( int argc, char **argv )
{
	USTRUCT_LAND_TILE landtile;
    
    	open_uo_data_files();
    	read_uo_data();

	int i;
	for( i = 0; i <= 0x3FFF; i++ )
	{
		unsigned short objtype = (unsigned short) i;
		readlandtile( objtype, &landtile );
        if (landtile.flags || landtile.unk || landtile.name[0])
        {
            cout << "Land Tile: " << hex << objtype << dec << endl;
            cout << "\tflags: " << hex << landtile.flags << dec << endl;
            cout << "\t  unk: " << hex << landtile.unk << dec << endl;
            cout << "\t name: " << landtile.name << endl;
        }
	}
	clear_tiledata();
	return 0;
}
示例#7
0
static int mapdump(int argc, char* argv[])
{
  u16 wxl = 5485, wxh = 5500, wyl = 0, wyh = 30;

  if (argc >= 4)
  {
    wxl = wxh = static_cast<u16>(atoi(argv[2]));
    wyl = wyh = static_cast<u16>(atoi(argv[3]));
  }
  if (argc >= 6)
  {
    wxh = static_cast<u16>(atoi(argv[4]));
    wyh = static_cast<u16>(atoi(argv[5]));
  }

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

  std::ofstream ofs("mapdump.html");

  ofs << "<table border=1 cellpadding=5 cellspacing=0>" << std::endl;
  ofs << "<tr><td>&nbsp;</td>";
  for (u16 x = wxl; x <= wxh; ++x)
  {
    ofs << "<td align=center>" << x << "</td>";
  }
  ofs << "</tr>" << std::endl;
  for (u16 y = wyl; y <= wyh; ++y)
  {
    ofs << "<tr><td valign=center>" << y << "</td>" << std::endl;
    for (u16 x = wxl; x <= wxh; ++x)
    {
      ofs << "<td align=left valign=top>";
      short z;
      Core::USTRUCT_MAPINFO mi;
      safe_getmapinfo(x, y, &z, &mi);
      Core::USTRUCT_LAND_TILE landtile;
      readlandtile(mi.landtile, &landtile);
      ofs << "z=" << z << "<br>";
      ofs << "landtile=" << Clib::hexint(mi.landtile) << " "
          << landtile.name << "<br>";
      ofs << "&nbsp;flags=" << Clib::hexint(landtile.flags) << "<br>";
      ofs << "mapz=" << (int) mi.z << "<br>";

      Core::StaticList statics;
      readallstatics(statics, x, y);
      if (!statics.empty())
      {
        ofs << "<table border=1 cellpadding=5 cellspacing=0>"
            << std::endl;
        ofs << "<tr><td>graphic</td><td>z</td><td>flags</td><td>ht</td>"
            << std::endl;
        for (const auto& rec : statics)
        {
          ofs << "<tr>";
          ofs << "<td>" << Clib::hexint(rec.graphic) << "</td>";
          ofs << "<td>" << int(rec.z) << "</td>";
          ofs << "<td>" << Clib::hexint(rec.flags) << "</td>";
          ofs << "<td>" << int(rec.height) << "</td>";
          ofs << "</tr>" << std::endl;
        }
        ofs << "</table>" << std::endl;
      }
      ofs << "</td>" << std::endl;
    }
    ofs << "</tr>" << std::endl;
  }
  ofs << "</table>" << std::endl;
  Core::clear_tiledata();
  return 0;
}