hedgewars/uLandUtils.pas
author unC0Rr
Tue, 03 Jan 2023 12:05:59 +0100
branchtransitional_engine
changeset 15901 f39f0f614dbf
parent 15900 128ace913837
child 15904 33798b649d9c
permissions -rw-r--r--
Use LandPixels array allocate in hwengine-future library
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
     1
unit uLandUtils;
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
     2
interface
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
     3
uses SDLh;
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
     4
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
     5
procedure ResizeLand(width, height: LongWord);
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
     6
procedure DisposeLand();
10626
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
     7
procedure InitWorldEdges();
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
     8
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
     9
function  LandGet(y, x: LongInt): Word;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    10
procedure LandSet(y, x: LongInt; value: Word);
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    11
function  LandRow(row: LongInt): PWordArray;
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    12
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    13
procedure FillLand(x, y: LongInt; border, value: Word);
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    14
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    15
function  LandPixelGet(y, x: LongInt): Longword;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    16
procedure LandPixelSet(y, x: LongInt; value: Longword);
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    17
function  LandPixelRow(row: LongInt): PLongwordArray;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    18
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    19
implementation
10626
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
    20
uses uUtils, uConsts, uVariables, uTypes;
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    21
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    22
const LibFutureName = 'hwengine_future';
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    23
function  create_game_field(width, height: Longword): pointer; cdecl; external LibFutureName;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    24
procedure dispose_game_field(game_field: pointer); cdecl; external LibFutureName;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    25
function  land_get(game_field: pointer; x, y: LongInt): Word; cdecl; external LibFutureName;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    26
procedure land_set(game_field: pointer; x, y: LongInt; value: Word); cdecl; external LibFutureName;
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    27
function  land_row(game_field: pointer; row: LongInt): PWordArray; cdecl; external LibFutureName;
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    28
procedure land_fill(game_field: pointer; x, y: LongInt; border, fill: Word); cdecl; external LibFutureName;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    29
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    30
function  land_pixel_get(game_field: pointer; x, y: LongInt): Longword; cdecl; external LibFutureName;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    31
procedure land_pixel_set(game_field: pointer; x, y: LongInt; value: Longword); cdecl; external LibFutureName;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    32
function  land_pixel_row(game_field: pointer; row: LongInt): PLongwordArray; cdecl; external LibFutureName;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    33
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    34
var gameField: pointer;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    35
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    36
function  LandGet(y, x: LongInt): Word;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    37
begin
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    38
    LandGet:= land_get(gameField, x, y)
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    39
end;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    40
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    41
procedure LandSet(y, x: LongInt; value: Word);
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    42
begin
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    43
    land_set(gameField, x, y, value)
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    44
end;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    45
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    46
function  LandRow(row: LongInt): PWordArray;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    47
begin
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    48
    LandRow:= land_row(gameField, row)
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    49
end;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    50
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    51
procedure FillLand(x, y: LongInt; border, value: Word);
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    52
begin
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    53
    land_fill(gameField, x, y, border, value)
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    54
end;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    55
15901
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    56
function  LandPixelGet(y, x: LongInt): Longword;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    57
begin
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    58
    LandPixelGet:= land_pixel_get(gameField, x, y)
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    59
end;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    60
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    61
procedure LandPixelSet(y, x: LongInt; value: Longword);
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    62
begin
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    63
    land_pixel_set(gameField, x, y, value)
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    64
end;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    65
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    66
function  LandPixelRow(row: LongInt): PLongwordArray;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    67
begin
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    68
    LandPixelRow:= land_pixel_row(gameField, row)
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    69
end;
f39f0f614dbf Use LandPixels array allocate in hwengine-future library
unC0Rr
parents: 15900
diff changeset
    70
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    71
procedure ResizeLand(width, height: LongWord);
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    72
var potW, potH: LongInt;
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    73
begin
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    74
potW:= toPowerOf2(width);
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    75
potH:= toPowerOf2(height);
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    76
if (potW <> LAND_WIDTH) or (potH <> LAND_HEIGHT) then
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    77
    begin
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    78
    LAND_WIDTH:= potW;
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    79
    LAND_HEIGHT:= potH;
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    80
    LAND_WIDTH_MASK:= not(LAND_WIDTH-1);
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    81
    LAND_HEIGHT_MASK:= not(LAND_HEIGHT-1);
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    82
    cWaterLine:= LAND_HEIGHT;
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    83
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    84
    gameField:= create_game_field(LAND_WIDTH, LAND_HEIGHT);
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    85
    SetLength(LandDirty, (LAND_HEIGHT div 32), (LAND_WIDTH div 32));
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    86
    // 0.5 is already approaching on unplayable
10994
cd7f918eed30 bit friendlier if the uVariables values get changed
nemo
parents: 10626
diff changeset
    87
    if (width div 4096 >= 2) or (height div 2048 >= 2) then cMaxZoomLevel:= cMaxZoomLevel/2;
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    88
    cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    89
    end;
11704
1694b379c83f fix clouds/flakes area not being adjusted after ResizeLand()
sheepluva
parents: 10994
diff changeset
    90
initScreenSpaceVars();
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    91
end;
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
    92
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    93
procedure DisposeLand();
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    94
begin
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    95
    dispose_game_field(gameField)
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    96
end;
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
    97
10626
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
    98
procedure InitWorldEdges();
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
    99
var cy, cx, lx, ly: LongInt;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   100
    found: boolean;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   101
begin
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   102
playHeight:= LAND_HEIGHT;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   103
topY:= 0;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   104
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   105
lx:= LongInt(LAND_WIDTH) - 1;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   106
15143
794dc7237ca1 Fix world edge positions for drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 12311
diff changeset
   107
// don't change world edges for drawn maps
794dc7237ca1 Fix world edge positions for drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 12311
diff changeset
   108
if (cMapGen = mgDrawn) then
794dc7237ca1 Fix world edge positions for drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 12311
diff changeset
   109
    // edges were adjusted already in GenDrawnMap() in uLand
794dc7237ca1 Fix world edge positions for drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 12311
diff changeset
   110
    EXIT;
794dc7237ca1 Fix world edge positions for drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 12311
diff changeset
   111
12311
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   112
// use maximum available map width if there is no special world edge
10626
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   113
if WorldEdge = weNone then
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   114
    begin
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   115
    playWidth:= LAND_WIDTH;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   116
    leftX := 0;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   117
    rightX:= lx;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   118
    EXIT;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   119
    end;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   120
12311
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   121
// keep fort distance consistent if we're in wrap mode on fort map
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   122
if (cMapGen = mgForts) and (WorldEdge = weWrap) then
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   123
    begin
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   124
    // edges were adjusted already in MakeFortsMap() in uLand
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   125
    EXIT;
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   126
    end;
1b5a4807f8f4 fix fort mode's edge adjustments getting lost with weWrap. issue #181
sheepluva
parents: 11704
diff changeset
   127
10626
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   128
ly:= LongInt(LAND_HEIGHT) - 1;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   129
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   130
// find most left land pixels and set leftX accordingly
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   131
found:= false;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   132
for cx:= 0 to lx do
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   133
    begin
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   134
    for cy:= ly downto 0 do
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
   135
        if LandGet(cy, cx) <> 0 then
10626
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   136
            begin
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   137
            leftX:= max(0, cx - cWorldEdgeDist);
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   138
            // break out of both loops
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   139
            found:= true;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   140
            break;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   141
            end;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   142
    if found then break;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   143
    end;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   144
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   145
// find most right land pixels and set rightX accordingly
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   146
found:= false;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   147
for cx:= lx downto 0 do
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   148
    begin
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   149
    for cy:= ly downto 0 do
15900
128ace913837 Introduce hwengine-future library, use Land allocated in it
unC0Rr
parents: 15143
diff changeset
   150
        if LandGet(cy, cx) <> 0 then
10626
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   151
            begin
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   152
            rightX:= min(lx, cx + cWorldEdgeDist);
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   153
            // break out of both loops
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   154
            found:= true;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   155
            break;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   156
            end;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   157
    if found then break;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   158
    end;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   159
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   160
playWidth := rightX + 1 - leftX;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   161
end;
2562797ab3cf adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents: 10198
diff changeset
   162
10198
e9cbe111c0df Move template-based generator into its own file
unc0rr
parents:
diff changeset
   163
end.