hedgewars/uStore.pas
changeset 3938 033114a6a960
parent 3922 44804043b691
child 3939 e6fddcb04dc2
equal deleted inserted replaced
3937:494221b5950e 3938:033114a6a960
   556 var ft, fb, fl, fr: GLfloat;
   556 var ft, fb, fl, fr: GLfloat;
   557     hw, nx, ny: LongInt;
   557     hw, nx, ny: LongInt;
   558     VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
   558     VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
   559 begin
   559 begin
   560 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   560 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   561 if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) > cScreenWidth / cScaleFactor) then
   561 if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then
   562     exit;
   562     exit;
   563 if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) > cScreenHeight / cScaleFactor) then
   563 if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then
   564     exit;
   564     exit;
   565 
   565 
   566 glPushMatrix;
   566 glPushMatrix;
   567 glTranslatef(X, Y, 0);
   567 glTranslatef(X, Y, 0);
   568 
   568 
   747         (x: -16; y:  16));
   747         (x: -16; y:  16));
   748 var l, r, t, b: real;
   748 var l, r, t, b: real;
   749     TextureBuffer: array [0..3] of TVertex2f;
   749     TextureBuffer: array [0..3] of TVertex2f;
   750 begin
   750 begin
   751 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   751 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   752 if (abs(X) > 32) and ((abs(X) - 16)> cScreenWidth / cScaleFactor) then
   752 if (abs(X) > 32) and ((abs(X) - 16) * cScaleFactor > cScreenWidth) then
   753     exit;
   753     exit;
   754 if (abs(Y) > 32) and ((abs(Y - 0.5 * cScreenHeight) - 16) > cScreenHeight / cScaleFactor) then
   754 if (abs(Y) > 32) and ((abs(Y - 0.5 * cScreenHeight) - 16) * cScaleFactor > cScreenHeight) then
   755     exit;
   755     exit;
   756 
   756 
   757 t:= Pos * 32 / HHTexture^.h;
   757 t:= Pos * 32 / HHTexture^.h;
   758 b:= (Pos + 1) * 32 / HHTexture^.h;
   758 b:= (Pos + 1) * 32 / HHTexture^.h;
   759 
   759 
   792 
   792 
   793 procedure DrawFillRect(r: TSDL_Rect);
   793 procedure DrawFillRect(r: TSDL_Rect);
   794 var VertexBuffer: array [0..3] of TVertex2f;
   794 var VertexBuffer: array [0..3] of TVertex2f;
   795 begin
   795 begin
   796 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   796 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   797 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) > cScreenWidth / cScaleFactor) then
   797 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then
   798     exit;
   798     exit;
   799 if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) > cScreenHeight / cScaleFactor) then
   799 if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then
   800     exit;
   800     exit;
   801 
   801 
   802 glDisable(GL_TEXTURE_2D);
   802 glDisable(GL_TEXTURE_2D);
   803 
   803 
   804 Tint($00, $00, $00, $80);
   804 Tint($00, $00, $00, $80);