Exemplo n.º 1
0
static signed char rawmapinfo( unsigned short x, unsigned short y, USTRUCT_MAPINFO* gi )
{
  // UoTool has a serious problem of not loading data before using this function...
  if ( !rawmap_ready )
    rawmapfullread();

  return rawmap.rawinfo( x, y, gi );
}
Exemplo n.º 2
0
    void update_map(const std::string& realm, unsigned short x, unsigned short y)
	{
	  auto mapwriter = new MapWriter();
	  mapwriter->OpenExistingFiles( realm );
	  rawmapfullread();
	  rawstaticfullread();
	  unsigned short x_base = x / SOLIDX_X_SIZE * SOLIDX_X_SIZE;
	  unsigned short y_base = y / SOLIDX_Y_SIZE * SOLIDX_Y_SIZE;

	  ProcessSolidBlock( x_base, y_base, *mapwriter );
	  delete mapwriter;
      INFO_PRINT << "empty=" << empty << ", nonempty=" << nonempty << "\n"
        << "with more_solids: " << with_more_solids << "\n"
        << "total statics=" << total_statics << "\n";
	}
Exemplo n.º 3
0
    signed char rawmapinfo( unsigned short x, unsigned short y, USTRUCT_MAPINFO* gi )
    {
      if ( !rawmap_init ) // FIXME just for safety cause I'm lazy
        rawmapfullread();
      passert( x < uo_map_width && y < uo_map_height );

      unsigned int x_block = x / 8;
      unsigned int y_block = y / 8;
      unsigned int block = ( x_block * ( uo_map_height / 8 ) + y_block );

      unsigned int x_offset = x & 0x7;
      unsigned int y_offset = y & 0x7;

      *gi = rawmap_buffer_vec.at( block ).cell[y_offset][x_offset];
      return gi->z;
    }
Exemplo n.º 4
0
void create_map( const std::string& realm, unsigned short width, unsigned short height )
{
  auto mapwriter = new MapWriter();
  INFO_PRINT << "Creating map base and solids files.\n"
             << "  Realm: " << realm << "\n"
             << "  Map ID: " << uo_mapid << "\n"
             << "  Use Dif files: " << ( uo_usedif ? "Yes" : "No" ) << "\n"
             << "  Size: " << uo_map_width << "x" << uo_map_height << "\n"
             << "Initializing files: ";
  mapwriter->CreateNewFiles( realm, width, height );
  INFO_PRINT << "Done.\n";
  Tools::Timer<> timer;
  rawmapfullread();
  rawstaticfullread();
  INFO_PRINT << "  Reading mapfiles time: " << timer.ellapsed() << " ms.\n";
  for ( unsigned short y_base = 0; y_base < height; y_base += SOLIDX_Y_SIZE )
  {
    for ( unsigned short x_base = 0; x_base < width; x_base += SOLIDX_X_SIZE )
    {
      ProcessSolidBlock( x_base, y_base, *mapwriter );
    }
    INFO_PRINT << "\rConverting: " << y_base * 100 / height << "%";
  }
  timer.stop();

  mapwriter->WriteConfigFile();
  delete mapwriter;

  INFO_PRINT << "\rConversion complete.              \n"
             << "Conversion details:\n"
             << "  Total blocks: " << empty + nonempty << "\n"
             << "  Blocks with solids: " << nonempty << " ("
             << ( nonempty * 100 / ( empty + nonempty ) ) << "%)"
             << "\n"
             << "  Blocks without solids: " << empty << " ("
             << ( empty * 100 / ( empty + nonempty ) ) << "%)"
             << "\n"
             << "  Locations with solids: " << with_more_solids << "\n"
             << "  Total number of solids: " << total_statics << "\n"
             << "  Elapsed time: " << timer.ellapsed() << " ms.\n";
}