hedgewars/uRender.pas
changeset 10431 d8830bd7cb24
parent 10429 e3cdbba07732
child 10494 0eb97cf4c78e
--- a/hedgewars/uRender.pas	Thu Oct 02 13:44:54 2014 +0200
+++ b/hedgewars/uRender.pas	Thu Oct 02 18:04:14 2014 +0200
@@ -849,10 +849,29 @@
 var ft, fb, fl, fr: GLfloat;
     hw, hh, nx, ny: LongInt;
 begin
-
-// note: not taking scale into account
-if isAreaOffscreen(X, Y, w, h) then
-    exit;
+// visibility check only under trivial conditions
+if (Scale <= 1) then
+    begin
+    if Angle <> 0  then
+        begin
+        if (OffsetX = 0) and (OffsetY = 0) then
+            begin
+            // sized doubled because the sprite might occupy up to 1.4 * of it's
+            // original size in each dimension, because it is rotated
+            if isDxAreaOffscreen(X - w, 2 * w) <> 0 then
+                exit;
+            if isDYAreaOffscreen(Y - h, 2 * h) <> 0 then
+                exit;
+            end;
+        end
+    else
+        begin
+        if isDxAreaOffscreen(X + dir * trunc(OffsetX) - w div 2, w) <> 0 then
+            exit;
+        if isDYAreaOffscreen(Y + trunc(OffsetY) - h div 2, h) <> 0 then
+            exit;
+        end;
+    end;
 
 {
 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)