Advertisement
Guest User

Untitled

a guest
Aug 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @description Draw Mini-Map
  2.  
  3. // This is essentially the debug script modified to be a mini-map.
  4. // Note that we use the "visited" map entry that the PLAYER object
  5. // adds to the map to decide whether to draw it or not...
  6.  
  7. var num = 0;
  8. var res = 16;
  9. var grid_w = ds_grid_width(global.RoomGen_grid)
  10. var grid_h = ds_grid_height(global.RoomGen_grid)
  11. var cur = RoomGen_GetRoomNumber(global.RoomGen_x, global.RoomGen_y);
  12.  
  13. draw_set_alpha(0.2);
  14. draw_rectangle_colour(32, 32, 32 + (grid_w * res), 32 + (grid_h * res), c_black, c_black, c_black, c_black, false);
  15. draw_set_alpha(1);
  16.  
  17. if output_map
  18. {
  19. var _str = array_create(grid_h, "");
  20. }
  21.  
  22. for (var j = 0; j < grid_h; j++;)
  23. {
  24. for (var i = 0; i < grid_w; i++;)
  25.     {
  26.     var _x = 32 + (i * res);
  27.     var _y = 32 + (j * res);
  28.     draw_set_alpha(0.2);
  29.     draw_rectangle(_x, _y, _x + res, _y + res, true);
  30.     draw_set_alpha(1);
  31.     var _rm = RoomGen_GetRoomNumber(i, j);
  32.     if output_map
  33.         {
  34.         if string_length(string(_rm)) < 2
  35.             {
  36.             _str[j] += "0" + string(_rm) + " | ";
  37.             }
  38.         else _str[j] += string(_rm) + " | ";
  39.         }
  40.     if _rm != -4
  41.         {
  42.         var m = global.RoomGen_list[| _rm];
  43.         if output_map show_debug_message("RoomGen_List Value = " + string(m));
  44.         if m[? "visited"]
  45.             {
  46.             if m[? "end"] draw_circle_colour(_x + (res / 2), _y + (res / 2), res / 4, c_aqua, c_aqua, true);
  47.             if m[? "start"] draw_circle_colour(_x + (res / 2), _y + (res / 2), res / 4, c_lime, c_lime, true);
  48.             draw_set_alpha(0.2);
  49.             draw_rectangle_colour(_x + (res / 10), _y + (res / 10), _x + res - (res / 10), _y + res - (res / 10), c_red, c_red, c_red, c_red, false);
  50.             draw_set_alpha(1);
  51.             draw_rectangle_colour(_x + (res / 10), _y + (res / 10), _x + res - (res / 10), _y + res - (res / 10), c_red, c_red, c_red, c_red, true);
  52.             if m[? "top"] draw_circle_colour(_x + (res / 2), _y, res / 8, c_yellow, c_yellow, true);
  53.             if m[? "bottom"] draw_circle_colour(_x + (res / 2), _y + res, res / 12, c_yellow, c_yellow, true);
  54.             if m[? "left"] draw_circle_colour(_x, _y + (res / 2), res / 8, c_yellow, c_yellow, true);
  55.             if m[? "right"] draw_circle_colour(_x + res, _y + (res / 2), res / 12, c_yellow, c_yellow, true);
  56.             }
  57.         if m[? "room"] == cur
  58.             {
  59.             draw_set_alpha(0.5);
  60.             draw_rectangle_colour(_x + (res / 11), _y + (res / 11), _x + res - (res / 11), _y + res - (res / 11), c_lime, c_lime, c_lime, c_lime, false);
  61.             draw_set_alpha(1);  
  62.             draw_rectangle_colour(_x + (res / 10), _y + (res / 10), _x + res - (res / 10), _y + res - (res / 10), c_lime, c_lime, c_lime, c_lime, true);    
  63.             }
  64.         }
  65.     }
  66. }
  67.  
  68. if output_map
  69. {
  70. var i = 0;
  71. var _a = "";
  72. show_debug_message(_a);
  73. repeat(grid_w * 5) _a += "-";
  74. repeat(grid_h)
  75.     {
  76.     show_debug_message(_str[i++]);
  77.     show_debug_message(_a);
  78.     }
  79. output_map = false;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement