Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1.  
  2. Private Sub Light_Render(ByVal light_index As Long)
  3.  
  4. Dim min_x As Integer
  5. Dim min_y As Integer
  6. Dim max_x As Integer
  7. Dim max_y As Integer
  8. Dim X As Long
  9. Dim Y As Long
  10. Dim Color As Long
  11.  
  12. 'Set up light borders
  13. min_x = Light_List(light_index).Map_x - Light_List(light_index).Range
  14. min_y = Light_List(light_index).Map_y - Light_List(light_index).Range
  15. max_x = Light_List(light_index).Map_x + Light_List(light_index).Range
  16. max_y = Light_List(light_index).Map_y + Light_List(light_index).Range
  17.  
  18. 'Set color
  19. Color = Light_List(light_index).Color
  20.  
  21. 'Arrange corners
  22. 'NE
  23. 'If InMapBounds(min_x, min_y) Then
  24. ' MapData(min_x, min_y).light_value(2) = Color
  25. 'End If
  26.  
  27. 'NW
  28. 'If InMapBounds(max_x, min_y) Then
  29. ' MapData(max_x, min_y).light_value(0) = Color
  30. 'End If
  31.  
  32. 'SW
  33. 'If InMapBounds(max_x, max_y) Then
  34. ' MapData(max_x, max_y).light_value(1) = Color
  35. 'End If
  36.  
  37. 'SE
  38. 'If InMapBounds(min_x, max_y) Then
  39. ' MapData(min_x, max_y).light_value(3) = Color
  40. 'End If
  41.  
  42. 'Arrange borders
  43. 'Upper border
  44. 'For X = min_x + 1 To max_x - 1
  45. ' If InMapBounds(X, min_y) Then
  46. ' MapData(X, min_y).light_value(0) = Color
  47. ' MapData(X, min_y).light_value(2) = Color
  48. ' End If
  49. 'Next X
  50.  
  51. 'Lower border
  52. 'For X = min_x + 1 To max_x - 1
  53. ' If InMapBounds(X, max_y) Then
  54. ' MapData(X, max_y).light_value(1) = Color
  55. ' MapData(X, max_y).light_value(3) = Color
  56. ' End If
  57. 'Next X
  58.  
  59. 'Left border
  60. 'For Y = min_y + 1 To max_y - 1
  61. ' If InMapBounds(min_x, Y) Then
  62. ' MapData(min_x, Y).light_value(2) = Color
  63. ' MapData(min_x, Y).light_value(3) = Color
  64. ' End If
  65. 'Next Y
  66.  
  67. 'Right border
  68. 'For Y = min_y + 1 To max_y - 1
  69. ' If InMapBounds(max_x, Y) Then
  70. ' MapData(max_x, Y).light_value(0) = Color
  71. ' MapData(max_x, Y).light_value(1) = Color
  72. ' End If
  73. 'Next Y
  74.  
  75. 'Set the inner part of the light
  76. For X = min_x To max_x
  77. For Y = min_y To max_y
  78.  
  79. If InMapBounds(X, Y) Then
  80. MapData(X, Y).light_value(0) = Color
  81. MapData(X, Y).light_value(1) = Color
  82. MapData(X, Y).light_value(2) = Color
  83. MapData(X, Y).light_value(3) = Color
  84.  
  85. End If
  86.  
  87. Next Y
  88. Next X
  89.  
  90. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement