Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Light_Render(ByVal light_index As Long)
- Dim min_x As Integer
- Dim min_y As Integer
- Dim max_x As Integer
- Dim max_y As Integer
- Dim X As Long
- Dim Y As Long
- Dim Color As Long
- 'Set up light borders
- min_x = Light_List(light_index).Map_x - Light_List(light_index).Range
- min_y = Light_List(light_index).Map_y - Light_List(light_index).Range
- max_x = Light_List(light_index).Map_x + Light_List(light_index).Range
- max_y = Light_List(light_index).Map_y + Light_List(light_index).Range
- 'Set color
- Color = Light_List(light_index).Color
- 'Arrange corners
- 'NE
- 'If InMapBounds(min_x, min_y) Then
- ' MapData(min_x, min_y).light_value(2) = Color
- 'End If
- 'NW
- 'If InMapBounds(max_x, min_y) Then
- ' MapData(max_x, min_y).light_value(0) = Color
- 'End If
- 'SW
- 'If InMapBounds(max_x, max_y) Then
- ' MapData(max_x, max_y).light_value(1) = Color
- 'End If
- 'SE
- 'If InMapBounds(min_x, max_y) Then
- ' MapData(min_x, max_y).light_value(3) = Color
- 'End If
- 'Arrange borders
- 'Upper border
- 'For X = min_x + 1 To max_x - 1
- ' If InMapBounds(X, min_y) Then
- ' MapData(X, min_y).light_value(0) = Color
- ' MapData(X, min_y).light_value(2) = Color
- ' End If
- 'Next X
- 'Lower border
- 'For X = min_x + 1 To max_x - 1
- ' If InMapBounds(X, max_y) Then
- ' MapData(X, max_y).light_value(1) = Color
- ' MapData(X, max_y).light_value(3) = Color
- ' End If
- 'Next X
- 'Left border
- 'For Y = min_y + 1 To max_y - 1
- ' If InMapBounds(min_x, Y) Then
- ' MapData(min_x, Y).light_value(2) = Color
- ' MapData(min_x, Y).light_value(3) = Color
- ' End If
- 'Next Y
- 'Right border
- 'For Y = min_y + 1 To max_y - 1
- ' If InMapBounds(max_x, Y) Then
- ' MapData(max_x, Y).light_value(0) = Color
- ' MapData(max_x, Y).light_value(1) = Color
- ' End If
- 'Next Y
- 'Set the inner part of the light
- For X = min_x To max_x
- For Y = min_y To max_y
- If InMapBounds(X, Y) Then
- MapData(X, Y).light_value(0) = Color
- MapData(X, Y).light_value(1) = Color
- MapData(X, Y).light_value(2) = Color
- MapData(X, Y).light_value(3) = Color
- End If
- Next Y
- Next X
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement