36 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); |
36 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); |
37 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt); |
37 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt); |
38 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword); |
38 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword); |
39 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean); |
39 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean); |
40 function LandBackPixel(x, y: LongInt): LongWord; |
40 function LandBackPixel(x, y: LongInt): LongWord; |
|
41 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword); |
41 |
42 |
42 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean; |
43 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean; |
43 |
44 |
44 implementation |
45 implementation |
45 uses SDLh, uLandTexture, uVariables, uUtils, uDebug; |
46 uses SDLh, uLandTexture, uVariables, uUtils, uDebug; |
960 LandBackPixel:= p^[LandBackSurface^.w * (y mod LandBackSurface^.h) + (x mod LandBackSurface^.w)];// or $FF000000; |
961 LandBackPixel:= p^[LandBackSurface^.w * (y mod LandBackSurface^.h) + (x mod LandBackSurface^.w)];// or $FF000000; |
961 end |
962 end |
962 end; |
963 end; |
963 |
964 |
964 |
965 |
|
966 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword); |
|
967 var |
|
968 eX, eY, dX, dY: LongInt; |
|
969 i, sX, sY, x, y, d: LongInt; |
|
970 begin |
|
971 eX:= 0; |
|
972 eY:= 0; |
|
973 dX:= X2 - X1; |
|
974 dY:= Y2 - Y1; |
|
975 |
|
976 if (dX > 0) then sX:= 1 |
|
977 else |
|
978 if (dX < 0) then |
|
979 begin |
|
980 sX:= -1; |
|
981 dX:= -dX |
|
982 end else sX:= dX; |
|
983 |
|
984 if (dY > 0) then sY:= 1 |
|
985 else |
|
986 if (dY < 0) then |
|
987 begin |
|
988 sY:= -1; |
|
989 dY:= -dY |
|
990 end else sY:= dY; |
|
991 |
|
992 if (dX > dY) then d:= dX |
|
993 else d:= dY; |
|
994 |
|
995 x:= X1; |
|
996 y:= Y1; |
|
997 |
|
998 for i:= 0 to d do |
|
999 begin |
|
1000 inc(eX, dX); |
|
1001 inc(eY, dY); |
|
1002 if (eX > d) then |
|
1003 begin |
|
1004 dec(eX, d); |
|
1005 inc(x, sX); |
|
1006 end; |
|
1007 if (eY > d) then |
|
1008 begin |
|
1009 dec(eY, d); |
|
1010 inc(y, sY); |
|
1011 end; |
|
1012 |
|
1013 if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then |
|
1014 Land[y, x]:= Color; |
|
1015 end |
|
1016 end; |
|
1017 |
965 end. |
1018 end. |