377 SDL_FreeSurface(tmpsurf); |
377 SDL_FreeSurface(tmpsurf); |
378 |
378 |
379 if gameFlags and gfShoppaBorder <> 0 then DrawShoppaBorder; |
379 if gameFlags and gfShoppaBorder <> 0 then DrawShoppaBorder; |
380 |
380 |
381 for x:= LongWord(leftX+2) to LongWord(rightX-2) do |
381 for x:= LongWord(leftX+2) to LongWord(rightX-2) do |
382 for y:= topY+2 to LAND_HEIGHT-3 do |
382 for y:= LongWord(topY+2) to LAND_HEIGHT-3 do |
383 if (Land[y, x] = 0) and |
383 if (Land[y, x] = 0) and |
384 (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or |
384 (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or |
385 ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then |
385 ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then |
386 begin |
386 begin |
387 if (cReducedQuality and rqBlurryLand) = 0 then |
387 if (cReducedQuality and rqBlurryLand) = 0 then |
752 // check for land near top |
752 // check for land near top |
753 c:= 0; |
753 c:= 0; |
754 if (GameFlags and gfBorder) <> 0 then |
754 if (GameFlags and gfBorder) <> 0 then |
755 hasBorder:= true |
755 hasBorder:= true |
756 else |
756 else |
757 for y:= topY to topY + 5 do |
757 for y:= LongWord(topY) to LongWord(topY + 5) do |
758 for x:= LongWord(leftX) to LongWord(rightX) do |
758 for x:= LongWord(leftX) to LongWord(rightX) do |
759 if Land[y, x] <> 0 then |
759 if Land[y, x] <> 0 then |
760 begin |
760 begin |
761 inc(c); |
761 inc(c); |
762 if c > LongWord((LAND_WIDTH div 2)) then // avoid accidental triggering |
762 if c > LongWord((LAND_WIDTH div 2)) then // avoid accidental triggering |
770 begin |
770 begin |
771 if WorldEdge = weNone then |
771 if WorldEdge = weNone then |
772 begin |
772 begin |
773 for y:= 0 to LAND_HEIGHT - 1 do |
773 for y:= 0 to LAND_HEIGHT - 1 do |
774 for x:= 0 to LAND_WIDTH - 1 do |
774 for x:= 0 to LAND_WIDTH - 1 do |
775 if (y < topY) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then |
775 if (y < LongWord(topY)) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then |
776 Land[y, x]:= lfIndestructible; |
776 Land[y, x]:= lfIndestructible; |
777 end |
777 end |
778 else if topY > 0 then |
778 else if topY > 0 then |
779 begin |
779 begin |
780 for y:= 0 to LongInt(topY) - 1 do |
780 for y:= 0 to LongWord(topY - 1) do |
781 for x:= 0 to LAND_WIDTH - 1 do |
781 for x:= 0 to LAND_WIDTH - 1 do |
782 Land[y, x]:= lfIndestructible; |
782 Land[y, x]:= lfIndestructible; |
783 end; |
783 end; |
784 // experiment hardcoding cave |
784 // experiment hardcoding cave |
785 // also try basing cave dimensions on map/template dimensions, if they exist |
785 // also try basing cave dimensions on map/template dimensions, if they exist |
786 for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade |
786 for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade |
787 begin |
787 begin |
788 if (WorldEdge <> weBounce) and (WorldEdge <> weWrap) then |
788 if (WorldEdge <> weBounce) and (WorldEdge <> weWrap) then |
789 for y:= topY to LAND_HEIGHT - 1 do |
789 for y:= LongWord(topY) to LAND_HEIGHT - 1 do |
790 begin |
790 begin |
791 Land[y, leftX + w]:= lfIndestructible; |
791 Land[y, leftX + w]:= lfIndestructible; |
792 Land[y, rightX - w]:= lfIndestructible; |
792 Land[y, rightX - w]:= lfIndestructible; |
793 if (y + leftX + w) mod 32 < 16 then |
793 if (y + leftX + w) mod 32 < 16 then |
794 c:= AMask |
794 c:= AMask |
845 |
845 |
846 if GrayScale then |
846 if GrayScale then |
847 begin |
847 begin |
848 if (cReducedQuality and rqBlurryLand) = 0 then |
848 if (cReducedQuality and rqBlurryLand) = 0 then |
849 for x:= LongWord(leftX) to LongWord(rightX) do |
849 for x:= LongWord(leftX) to LongWord(rightX) do |
850 for y:= topY to LAND_HEIGHT-1 do |
850 for y:= LongWord(topY) to LAND_HEIGHT-1 do |
851 begin |
851 begin |
852 w:= LandPixels[y,x]; |
852 w:= LandPixels[y,x]; |
853 w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + |
853 w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + |
854 (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + |
854 (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + |
855 (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)); |
855 (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)); |
858 w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y,x] and AMask); |
858 w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y,x] and AMask); |
859 LandPixels[y,x]:= w or (LandPixels[y, x] and AMask) |
859 LandPixels[y,x]:= w or (LandPixels[y, x] and AMask) |
860 end |
860 end |
861 else |
861 else |
862 for x:= LongWord(leftX div 2) to LongWord(rightX div 2) do |
862 for x:= LongWord(leftX div 2) to LongWord(rightX div 2) do |
863 for y:= topY div 2 to LAND_HEIGHT-1 div 2 do |
863 for y:= LongWord(topY div 2) to LAND_HEIGHT-1 div 2 do |
864 begin |
864 begin |
865 w:= LandPixels[y div 2,x div 2]; |
865 w:= LandPixels[y div 2,x div 2]; |
866 w:= ((w shr RShift and $FF) + (w shr BShift and $FF) + (w shr GShift and $FF)) div 3; |
866 w:= ((w shr RShift and $FF) + (w shr BShift and $FF) + (w shr GShift and $FF)) div 3; |
867 w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y div 2,x div 2] and AMask); |
867 w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y div 2,x div 2] and AMask); |
868 LandPixels[y,x]:= w or (LandPixels[y div 2, x div 2] and AMask) |
868 LandPixels[y,x]:= w or (LandPixels[y div 2, x div 2] and AMask) |