Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MapBlockMinimapColumn
- {
- video::SColor surface_color;
- u16 surface_level;
- bool surface_present;
- u16 surface_node_id;
- u16 air_nodes_count;
- u16 surface_light;
- };
- struct MapBlockMinimapData
- {
- MapBlockMinimapColumn data[MAP_BLOCKSIZE*MAP_BLOCKSIZE];
- };
- // prepare data for minimap
- if (g_settings->getBool("enable_minimap")) {
- v3s16 p = data->m_blockpos * MAP_BLOCKSIZE;
- for(s16 x = 0; x < MAP_BLOCKSIZE; x++) {
- for(s16 z = 0; z < MAP_BLOCKSIZE; z++){
- bool surface_found = false;
- s16 surface_level = 0;
- s16 air_count = 0;
- MapBlockMinimapColumn* column = &m_minimap_data->data[x + z * MAP_BLOCKSIZE];
- for(s16 y = MAP_BLOCKSIZE - 1; y > -1 ; y--){
- MapNode &n = data->m_vmanip.getNodeRefUnsafe(v3s16(p.X + x,p.Y + y, p.Z + z));
- if (!surface_found && n.param0 != CONTENT_IGNORE && n.param0 != CONTENT_AIR) {
- column->surface_node_id = n.param0;
- surface_found = true;
- surface_level = y;
- } else if (n.param0 == CONTENT_AIR) {
- air_count++;
- }
- }
- if (!surface_found) {
- column->surface_node_id = CONTENT_AIR;
- }
- column->surface_level = surface_level;
- column->surface_present = surface_found;
- column->air_nodes_count = air_count;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement