darkess fix

This commit is contained in:
Ruben Müller 2011-08-21 13:54:12 +02:00
parent 15e8e95aa4
commit f6f7f0250e

View file

@ -58,30 +58,31 @@ EndProcedure
; Shadowmap
Procedure CalculateShadow()
Define X.i, Y.i
Define MapX.i, MapY.i, Strength.i, CentercheckX.i, CentercheckY.i
Define MapX.i, MapY.i, Strength.i, Centercheck.i, CentercheckX.i, CentercheckY.i
For X.i=0 To #SHADOW_RADIUS*2
For Y.i=0 To #SHADOW_RADIUS*2
MapX = (Player\X-#SHADOW_RADIUS) + X
MapY = (Player\Y-#SHADOW_RADIUS) + Y
For X.i=-#SHADOW_RADIUS To #SHADOW_RADIUS*2
For Y.i=-#SHADOW_RADIUS To #SHADOW_RADIUS*2
MapX = Player\X + X
MapY = Player\Y + Y
CentercheckX = X - #SHADOW_RADIUS
CentercheckX = X
If CentercheckX < 0
CentercheckX * -1
EndIf
CentercheckX = 5-CentercheckX
CentercheckY = Y - #SHADOW_RADIUS
CentercheckY = Y
If CentercheckY < 0
CentercheckY * -1
EndIf
CentercheckY = 5-CentercheckY
If CentercheckX > CentercheckY
CentercheckX = CentercheckY
Centercheck = CentercheckX
Else
Centercheck = CentercheckY
EndIf
Centercheck = #SHADOW_RADIUS - Centercheck;
Strength = (255 / #SHADOW_RADIUS) * (CentercheckX+1)
Strength = (255 / #SHADOW_RADIUS) * (Centercheck)
If MapX >= 0 And MapY >= 0
If ShadowMap(MapX, MapY)\Strength < Strength