Advertisement
Guest User

Untitled

a guest
May 16th, 2015
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. struct MapBlockMinimapColumn
  2. {
  3. video::SColor surface_color;
  4. u16 surface_level;
  5. bool surface_present;
  6. u16 surface_node_id;
  7. u16 air_nodes_count;
  8. u16 surface_light;
  9. };
  10.  
  11. struct MapBlockMinimapData
  12. {
  13. MapBlockMinimapColumn data[MAP_BLOCKSIZE*MAP_BLOCKSIZE];
  14. };
  15.  
  16.  
  17. // prepare data for minimap
  18. if (g_settings->getBool("enable_minimap")) {
  19. v3s16 p = data->m_blockpos * MAP_BLOCKSIZE;
  20. for(s16 x = 0; x < MAP_BLOCKSIZE; x++) {
  21. for(s16 z = 0; z < MAP_BLOCKSIZE; z++){
  22. bool surface_found = false;
  23. s16 surface_level = 0;
  24. s16 air_count = 0;
  25. MapBlockMinimapColumn* column = &m_minimap_data->data[x + z * MAP_BLOCKSIZE];
  26. for(s16 y = MAP_BLOCKSIZE - 1; y > -1 ; y--){
  27. MapNode &n = data->m_vmanip.getNodeRefUnsafe(v3s16(p.X + x,p.Y + y, p.Z + z));
  28. if (!surface_found && n.param0 != CONTENT_IGNORE && n.param0 != CONTENT_AIR) {
  29. column->surface_node_id = n.param0;
  30. surface_found = true;
  31. surface_level = y;
  32. } else if (n.param0 == CONTENT_AIR) {
  33. air_count++;
  34. }
  35. }
  36. if (!surface_found) {
  37. column->surface_node_id = CONTENT_AIR;
  38. }
  39. column->surface_level = surface_level;
  40. column->surface_present = surface_found;
  41. column->air_nodes_count = air_count;
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement