Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.10 KB | None | 0 0
  1. function w2s(localx,localy, tileheight : integer) : TPoint;
  2. var
  3.   rd : TRenderData;
  4.   r : TRender;
  5.   i1, j1, l1, k1, i2: integer;
  6. begin;
  7.   result := point(-1,-1);
  8.   UpdateRenderInfo(r,rd);
  9.  
  10.   i1 := RD.zOff + ( (RD.zX * (localx + RD.zY) * (tileheight + RD.zZ) * localy) shr 15);
  11.  
  12.   writeln('i1 = '+inttostr(i1));
  13.   writeln('zNear: '+inttostr(r.zNear));
  14.   writeln('zFar: '+inttostr(r.zFar));
  15.  
  16.   if( (i1 < R.zNear) or (i1 > R.zFar) )then
  17.   begin
  18.     Writeln('Fail 1.');
  19.     Exit;
  20.   end;
  21.  
  22.   j1 := (R.xMultiplier * (RD.xOff + ((RD.xX * (localx + RD.xY) *
  23.                          (tileHeight + RD.xZ) * localy) shr 15)) ) / i1;
  24.   l1 := (R.yMultiplier * (RD.yOff + ((RD.yX * (localx + RD.yY) *
  25.                          (tileHeight + RD.yZ) * localy) shr 15)) ) / i1;
  26.  
  27.   writeln('j1: '+inttostr(j1));
  28.   writeln('l1: '+inttostr(l1));
  29.  
  30.   if( (j1 >= R.absoluteX1) and (j1 <= r.absoluteY1) and
  31.       (l1 >= r.absoluteY1) and (l1 <= r.absoluteY2) )then
  32.   begin
  33.     Result := Point(j1 - r.absoluteX1, l1 - R.absoluteY1);
  34.     Writeln('Result: ('+inttostr(Result.x)+', '+inttostr(Result.y)+');');
  35.   end;
  36. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement