author | vittorio.giovara@gmail.com |
Mon, 27 Apr 2015 17:21:58 +0000 | |
changeset 10911 | 5e3f42553ebc |
parent 10717 | 0810826cdf80 |
child 11006 | cb06b7985261 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
9998 | 3 |
* Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
4 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
4 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10040
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4 | 17 |
*) |
18 |
||
2599 | 19 |
{$INCLUDE "options.inc"} |
2587
0dfa56a8513c
fix a segfault in the iphone simulator by moving options.inc at the beginning of the file
koda
parents:
2376
diff
changeset
|
20 |
|
4 | 21 |
unit uLand; |
22 |
interface |
|
10249 | 23 |
uses SDLh, uLandTemplates, uConsts, uTypes, uAILandMarks; |
4 | 24 |
|
3038 | 25 |
procedure initModule; |
26 |
procedure freeModule; |
|
5717 | 27 |
procedure DrawBottomBorder; |
37 | 28 |
procedure GenMap; |
7079 | 29 |
procedure GenPreview(out Preview: TPreview); |
10162 | 30 |
procedure GenPreviewAlpha(out Preview: TPreviewAlpha); |
4 | 31 |
|
32 |
implementation |
|
7063 | 33 |
uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, SysUtils, |
6626
a447993f2ad7
Further work on propagating types. Now it hopefully works fully, just need to annotate namespace with types first.
unc0rr
parents:
6580
diff
changeset
|
34 |
uVariables, uUtils, uCommands, adler32, uDebug, uLandPainted, uTextures, |
10249 | 35 |
uLandGenMaze, uPhysFSLayer, uScript, uLandGenPerlin, |
10198 | 36 |
uLandGenTemplateBased, uLandUtils; |
365 | 37 |
|
7028 | 38 |
var digest: shortstring; |
4 | 39 |
|
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
40 |
|
10016
59a6d65fcb60
(experimental) make the mysterious borders around land/hats/etc that appear on zoom vanish
sheepluva
parents:
9998
diff
changeset
|
41 |
procedure PrettifyLandAlpha(); |
59a6d65fcb60
(experimental) make the mysterious borders around land/hats/etc that appear on zoom vanish
sheepluva
parents:
9998
diff
changeset
|
42 |
begin |
59a6d65fcb60
(experimental) make the mysterious borders around land/hats/etc that appear on zoom vanish
sheepluva
parents:
9998
diff
changeset
|
43 |
if (cReducedQuality and rqBlurryLand) <> 0 then |
10018
bdf75f0350bd
(experimental) merging the new procedures for different pixel representations (1D/2D arrays) into a single procedure with the algorithm and two procedures for the different mapping. - because redundant code sucks (at least twice)
sheepluva
parents:
10016
diff
changeset
|
44 |
PrettifyAlpha2D(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2) |
bdf75f0350bd
(experimental) merging the new procedures for different pixel representations (1D/2D arrays) into a single procedure with the algorithm and two procedures for the different mapping. - because redundant code sucks (at least twice)
sheepluva
parents:
10016
diff
changeset
|
45 |
else |
bdf75f0350bd
(experimental) merging the new procedures for different pixel representations (1D/2D arrays) into a single procedure with the algorithm and two procedures for the different mapping. - because redundant code sucks (at least twice)
sheepluva
parents:
10016
diff
changeset
|
46 |
PrettifyAlpha2D(LandPixels, LAND_HEIGHT, LAND_WIDTH); |
10016
59a6d65fcb60
(experimental) make the mysterious borders around land/hats/etc that appear on zoom vanish
sheepluva
parents:
9998
diff
changeset
|
47 |
end; |
59a6d65fcb60
(experimental) make the mysterious borders around land/hats/etc that appear on zoom vanish
sheepluva
parents:
9998
diff
changeset
|
48 |
|
9387 | 49 |
procedure DrawBorderFromImage(Surface: PSDL_Surface); |
4 | 50 |
var tmpsurf: PSDL_Surface; |
1182
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
51 |
r, rr: TSDL_Rect; |
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
52 |
x, yd, yu: LongInt; |
4 | 53 |
begin |
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
54 |
tmpsurf:= LoadDataImage(ptCurrTheme, 'Border', ifCritical or ifIgnoreCaps or ifTransparent); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
55 |
for x:= 0 to LAND_WIDTH - 1 do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
56 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
57 |
yd:= LAND_HEIGHT - 1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
58 |
repeat |
10717
0810826cdf80
Tweak to land texturing. Treat any non-lfBasic as edge
nemo
parents:
10661
diff
changeset
|
59 |
while (yd > 0) and (Land[yd, x] <> lfBasic) do dec(yd); |
2376 | 60 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
61 |
if (yd < 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
62 |
yd:= 0; |
1182
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
63 |
|
10717
0810826cdf80
Tweak to land texturing. Treat any non-lfBasic as edge
nemo
parents:
10661
diff
changeset
|
64 |
while (yd < LAND_HEIGHT) and (Land[yd, x] = lfBasic) do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
65 |
inc(yd); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
66 |
dec(yd); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
67 |
yu:= yd; |
2376 | 68 |
|
10717
0810826cdf80
Tweak to land texturing. Treat any non-lfBasic as edge
nemo
parents:
10661
diff
changeset
|
69 |
while (yu > 0 ) and (Land[yu, x] = lfBasic) do dec(yu); |
0810826cdf80
Tweak to land texturing. Treat any non-lfBasic as edge
nemo
parents:
10661
diff
changeset
|
70 |
while (yu < yd ) and (Land[yu, x] <> lfBasic) do inc(yu); |
2376 | 71 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
72 |
if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
73 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
74 |
rr.x:= x; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
75 |
rr.y:= yd - 15; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
76 |
r.x:= x mod tmpsurf^.w; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
77 |
r.y:= 16; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
78 |
r.w:= 1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
79 |
r.h:= 16; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
80 |
SDL_UpperBlit(tmpsurf, @r, Surface, @rr); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
81 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
82 |
if (yu > 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
83 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
84 |
rr.x:= x; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
85 |
rr.y:= yu; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
86 |
r.x:= x mod tmpsurf^.w; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
87 |
r.y:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
88 |
r.w:= 1; |
4374 | 89 |
r.h:= Min(16, yd - yu + 1); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
90 |
SDL_UpperBlit(tmpsurf, @r, Surface, @rr); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
91 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
92 |
yd:= yu - 1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
93 |
until yd < 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
94 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
95 |
SDL_FreeSurface(tmpsurf); |
4 | 96 |
end; |
97 |
||
9387 | 98 |
|
99 |
procedure DrawShoppaBorder; |
|
100 |
var x, y, s, i: Longword; |
|
101 |
c1, c2, c: Longword; |
|
102 |
begin |
|
103 |
c1:= AMask; |
|
104 |
c2:= AMask or RMask or GMask; |
|
105 |
||
106 |
// vertical |
|
107 |
s:= LAND_HEIGHT; |
|
10017 | 108 |
|
9387 | 109 |
for x:= 0 to LAND_WIDTH - 1 do |
110 |
for y:= 0 to LAND_HEIGHT - 1 do |
|
9864 | 111 |
if Land[y, x] = 0 then |
9387 | 112 |
if s < y then |
113 |
begin |
|
114 |
for i:= max(s, y - 8) to y - 1 do |
|
115 |
begin |
|
116 |
if ((x + i) and 16) = 0 then c:= c1 else c:= c2; |
|
10017 | 117 |
|
9387 | 118 |
if (cReducedQuality and rqBlurryLand) = 0 then |
119 |
LandPixels[i, x]:= c |
|
120 |
else |
|
121 |
LandPixels[i div 2, x div 2]:= c |
|
122 |
end; |
|
123 |
s:= LAND_HEIGHT |
|
124 |
end |
|
125 |
else |
|
126 |
else |
|
127 |
begin |
|
128 |
if s > y then s:= y; |
|
129 |
if s + 8 > y then |
|
130 |
begin |
|
131 |
if ((x + y) and 16) = 0 then c:= c1 else c:= c2; |
|
10017 | 132 |
|
9387 | 133 |
if (cReducedQuality and rqBlurryLand) = 0 then |
134 |
LandPixels[y, x]:= c |
|
135 |
else |
|
136 |
LandPixels[y div 2, x div 2]:= c |
|
10017 | 137 |
end; |
9387 | 138 |
end; |
10017 | 139 |
|
9387 | 140 |
// horizontal |
141 |
s:= LAND_WIDTH; |
|
10017 | 142 |
|
9387 | 143 |
for y:= 0 to LAND_HEIGHT - 1 do |
144 |
for x:= 0 to LAND_WIDTH - 1 do |
|
9864 | 145 |
if Land[y, x] = 0 then |
9387 | 146 |
if s < x then |
147 |
begin |
|
148 |
for i:= max(s, x - 8) to x - 1 do |
|
149 |
begin |
|
150 |
if ((y + i) and 16) = 0 then c:= c1 else c:= c2; |
|
10017 | 151 |
|
9387 | 152 |
if (cReducedQuality and rqBlurryLand) = 0 then |
153 |
LandPixels[y, i]:= c |
|
154 |
else |
|
155 |
LandPixels[y div 2, i div 2]:= c |
|
156 |
end; |
|
157 |
s:= LAND_WIDTH |
|
158 |
end |
|
159 |
else |
|
160 |
else |
|
161 |
begin |
|
162 |
if s > x then s:= x; |
|
163 |
if s + 8 > x then |
|
164 |
begin |
|
165 |
if ((x + y) and 16) = 0 then c:= c1 else c:= c2; |
|
10017 | 166 |
|
9387 | 167 |
if (cReducedQuality and rqBlurryLand) = 0 then |
168 |
LandPixels[y, x]:= c |
|
169 |
else |
|
170 |
LandPixels[y div 2, x div 2]:= c |
|
10017 | 171 |
end; |
9387 | 172 |
end |
173 |
end; |
|
174 |
||
175 |
procedure ColorizeLand(Surface: PSDL_Surface); |
|
176 |
var tmpsurf: PSDL_Surface; |
|
177 |
r: TSDL_Rect; |
|
10197 | 178 |
y: LongInt; // stupid SDL 1.2 uses stupid SmallInt for y which limits us to 32767. But is even worse if LandTex is large, can overflow on 32767 map. |
9387 | 179 |
begin |
180 |
tmpsurf:= LoadDataImage(ptCurrTheme, 'LandTex', ifCritical or ifIgnoreCaps); |
|
181 |
r.y:= 0; |
|
9892
5a0a7ef7af2d
allow SDL 1.2 to at least do a 32767 map. We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows. Ditto int version for SDL 2
nemo
parents:
9864
diff
changeset
|
182 |
y:= 0; |
5a0a7ef7af2d
allow SDL 1.2 to at least do a 32767 map. We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows. Ditto int version for SDL 2
nemo
parents:
9864
diff
changeset
|
183 |
while y < LAND_HEIGHT do |
5a0a7ef7af2d
allow SDL 1.2 to at least do a 32767 map. We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows. Ditto int version for SDL 2
nemo
parents:
9864
diff
changeset
|
184 |
begin |
9387 | 185 |
r.x:= 0; |
186 |
while r.x < LAND_WIDTH do |
|
9892
5a0a7ef7af2d
allow SDL 1.2 to at least do a 32767 map. We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows. Ditto int version for SDL 2
nemo
parents:
9864
diff
changeset
|
187 |
begin |
9387 | 188 |
SDL_UpperBlit(tmpsurf, nil, Surface, @r); |
189 |
inc(r.x, tmpsurf^.w) |
|
9892
5a0a7ef7af2d
allow SDL 1.2 to at least do a 32767 map. We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows. Ditto int version for SDL 2
nemo
parents:
9864
diff
changeset
|
190 |
end; |
5a0a7ef7af2d
allow SDL 1.2 to at least do a 32767 map. We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows. Ditto int version for SDL 2
nemo
parents:
9864
diff
changeset
|
191 |
inc(y, tmpsurf^.h); |
5a0a7ef7af2d
allow SDL 1.2 to at least do a 32767 map. We probably should add a TryDo somewhere to assert that limit on SDL 1.2 to avoid overflows. Ditto int version for SDL 2
nemo
parents:
9864
diff
changeset
|
192 |
r.y:= y |
9387 | 193 |
end; |
194 |
SDL_FreeSurface(tmpsurf); |
|
195 |
||
196 |
// freed in freeModule() below |
|
197 |
LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifTransparent); |
|
198 |
if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface); |
|
199 |
end; |
|
200 |
||
23 | 201 |
|
4494
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
202 |
procedure GenDrawnMap; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
203 |
begin |
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
204 |
ResizeLand(4096, 2048); |
4494
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
205 |
uLandPainted.Draw; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
206 |
|
4559 | 207 |
MaxHedgehogs:= 48; |
4494
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
208 |
hasGirders:= true; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
209 |
playHeight:= 2048; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
210 |
playWidth:= 4096; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
211 |
leftX:= ((LAND_WIDTH - playWidth) div 2); |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
212 |
rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
213 |
topY:= LAND_HEIGHT - playHeight; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
214 |
end; |
9585435e20f7
Pass hardcoded drawn map from frontend into engine \o/
unc0rr
parents:
4458
diff
changeset
|
215 |
|
371 | 216 |
function SelectTemplate: LongInt; |
9243
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
217 |
var l: LongInt; |
161 | 218 |
begin |
3612
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
219 |
if (cReducedQuality and rqLowRes) <> 0 then |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
220 |
SelectTemplate:= SmallTemplates[getrandom(Succ(High(SmallTemplates)))] |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
221 |
else |
9243
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
222 |
begin |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
223 |
if cTemplateFilter = 0 then |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
224 |
begin |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
225 |
l:= getRandom(GroupedTemplatesCount); |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
226 |
repeat |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
227 |
inc(cTemplateFilter); |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
228 |
dec(l, TemplateCounts[cTemplateFilter]); |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
229 |
until l < 0; |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
230 |
end else getRandom(1); |
10017 | 231 |
|
3612
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
232 |
case cTemplateFilter of |
9243
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
233 |
0: OutError('Ask unC0Rr about what you did wrong', true); |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
234 |
1: SelectTemplate:= SmallTemplates[getrandom(TemplateCounts[cTemplateFilter])]; |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
235 |
2: SelectTemplate:= MediumTemplates[getrandom(TemplateCounts[cTemplateFilter])]; |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
236 |
3: SelectTemplate:= LargeTemplates[getrandom(TemplateCounts[cTemplateFilter])]; |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
237 |
4: SelectTemplate:= CavernTemplates[getrandom(TemplateCounts[cTemplateFilter])]; |
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
238 |
5: SelectTemplate:= WackyTemplates[getrandom(TemplateCounts[cTemplateFilter])]; |
7567 | 239 |
// For lua only! |
7575
f415b3e0f3b9
Burn a random number in the override. Make sure cirbuf is reset.
nemo
parents:
7571
diff
changeset
|
240 |
6: begin |
7594 | 241 |
SelectTemplate:= min(LuaTemplateNumber,High(EdgeTemplates)); |
7575
f415b3e0f3b9
Burn a random number in the override. Make sure cirbuf is reset.
nemo
parents:
7571
diff
changeset
|
242 |
GetRandom(2) // burn 1 |
10142 | 243 |
end |
9243
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
244 |
end |
3612
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
245 |
end; |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
246 |
|
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
247 |
WriteLnToConsole('Selected template #'+inttostr(SelectTemplate)+' using filter #'+inttostr(cTemplateFilter)); |
161 | 248 |
end; |
249 |
||
1182
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
250 |
procedure LandSurface2LandPixels(Surface: PSDL_Surface); |
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
251 |
var x, y: LongInt; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
252 |
p: PLongwordArray; |
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1085
diff
changeset
|
253 |
begin |
1182
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
254 |
TryDo(Surface <> nil, 'Assert (LandSurface <> nil) failed', true); |
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
255 |
|
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
256 |
if SDL_MustLock(Surface) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
257 |
SDLTry(SDL_LockSurface(Surface) >= 0, true); |
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1085
diff
changeset
|
258 |
|
1182
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
259 |
p:= Surface^.pixels; |
1760 | 260 |
for y:= 0 to LAND_HEIGHT - 1 do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
261 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
262 |
for x:= 0 to LAND_WIDTH - 1 do |
3598 | 263 |
if Land[y, x] <> 0 then |
3595
341e407e3754
partially removing DOWNSCALE ifdef -- only two remain and their removal requires dynamic allocation (btw this breaks low quality mode)
koda
parents:
3551
diff
changeset
|
264 |
if (cReducedQuality and rqBlurryLand) = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
265 |
LandPixels[y, x]:= p^[x] or AMask |
3595
341e407e3754
partially removing DOWNSCALE ifdef -- only two remain and their removal requires dynamic allocation (btw this breaks low quality mode)
koda
parents:
3551
diff
changeset
|
266 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
267 |
LandPixels[y div 2, x div 2]:= p^[x] or AMask; |
2376 | 268 |
|
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10108
diff
changeset
|
269 |
p:= PLongwordArray(@(p^[Surface^.pitch div 4])); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
270 |
end; |
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1085
diff
changeset
|
271 |
|
1182
e2e13aa055c1
Step 3: Maps are rendered correctly, but without objects yet
unc0rr
parents:
1181
diff
changeset
|
272 |
if SDL_MustLock(Surface) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
273 |
SDL_UnlockSurface(Surface); |
1754 | 274 |
end; |
275 |
||
3133 | 276 |
|
1754 | 277 |
procedure GenLandSurface; |
278 |
var tmpsurf: PSDL_Surface; |
|
5225 | 279 |
x,y: Longword; |
1754 | 280 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
281 |
AddProgress(); |
1754 | 282 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
283 |
tmpsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, LAND_WIDTH, LAND_HEIGHT, 32, RMask, GMask, BMask, 0); |
1754 | 284 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
285 |
TryDo(tmpsurf <> nil, 'Error creating pre-land surface', true); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
286 |
ColorizeLand(tmpsurf); |
9387 | 287 |
if gameFlags and gfShoppaBorder = 0 then DrawBorderFromImage(tmpsurf); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
288 |
AddOnLandObjects(tmpsurf); |
1754 | 289 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
290 |
LandSurface2LandPixels(tmpsurf); |
5227 | 291 |
SDL_FreeSurface(tmpsurf); |
10017 | 292 |
|
9387 | 293 |
if gameFlags and gfShoppaBorder <> 0 then DrawShoppaBorder; |
10017 | 294 |
|
5274 | 295 |
for x:= leftX+2 to rightX-2 do |
296 |
for y:= topY+2 to LAND_HEIGHT-3 do |
|
10017 | 297 |
if (Land[y, x] = 0) and |
5274 | 298 |
(((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or |
299 |
((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then |
|
300 |
begin |
|
301 |
if (cReducedQuality and rqBlurryLand) = 0 then |
|
302 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
303 |
if (Land[y, x-1] = lfBasic) and (LandPixels[y, x-1] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
304 |
LandPixels[y, x]:= LandPixels[y, x-1] |
10017 | 305 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
306 |
else if (Land[y, x+1] = lfBasic) and (LandPixels[y, x+1] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
307 |
LandPixels[y, x]:= LandPixels[y, x+1] |
10017 | 308 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
309 |
else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1, x] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
310 |
LandPixels[y, x]:= LandPixels[y-1, x] |
10017 | 311 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
312 |
else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1, x] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
313 |
LandPixels[y, x]:= LandPixels[y+1, x]; |
10017 | 314 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
315 |
if (((LandPixels[y,x] and AMask) shr AShift) > 10) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
316 |
LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (128 shl AShift) |
5274 | 317 |
end; |
318 |
Land[y,x]:= lfObject |
|
319 |
end |
|
320 |
else if (Land[y, x] = 0) and |
|
321 |
(((Land[y, x-1] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y+2,x] = lfBasic)) or |
|
322 |
((Land[y, x-1] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y-2,x] = lfBasic)) or |
|
323 |
((Land[y, x+1] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y+2,x] = lfBasic)) or |
|
324 |
((Land[y, x+1] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y-2,x] = lfBasic)) or |
|
325 |
((Land[y+1, x] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or |
|
326 |
((Land[y-1, x] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or |
|
327 |
((Land[y+1, x] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic)) or |
|
328 |
((Land[y-1, x] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic))) then |
|
10017 | 329 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
330 |
begin |
10017 | 331 |
|
5274 | 332 |
if (cReducedQuality and rqBlurryLand) = 0 then |
10017 | 333 |
|
5274 | 334 |
begin |
10017 | 335 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
336 |
if (Land[y, x-1] = lfBasic) and (LandPixels[y,x-1] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
337 |
LandPixels[y, x]:= LandPixels[y, x-1] |
10017 | 338 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
339 |
else if (Land[y, x+1] = lfBasic) and (LandPixels[y,x+1] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
340 |
LandPixels[y, x]:= LandPixels[y, x+1] |
10017 | 341 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
342 |
else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1,x] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
343 |
LandPixels[y, x]:= LandPixels[y+1, x] |
10017 | 344 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
345 |
else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1,x] and AMask <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
346 |
LandPixels[y, x]:= LandPixels[y-1, x]; |
10017 | 347 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
348 |
if (((LandPixels[y,x] and AMask) shr AShift) > 10) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
349 |
LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (64 shl AShift) |
5274 | 350 |
end; |
351 |
Land[y,x]:= lfObject |
|
352 |
end; |
|
5441
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
353 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
354 |
AddProgress(); |
1754 | 355 |
end; |
356 |
||
357 |
procedure MakeFortsMap; |
|
358 |
var tmpsurf: PSDL_Surface; |
|
359 |
begin |
|
7922 | 360 |
ResizeLand(4096,2048); |
2866 | 361 |
MaxHedgehogs:= 32; |
2171
8208946331ba
Smaxx refactor of LoadImage to use flags, iphone changes by koda (mostly use of rgba instead of rgb)
nemo
parents:
2163
diff
changeset
|
362 |
// For now, defining a fort is playable area as 3072x1200 - there are no tall forts. The extra height is to avoid triggering border with current code, also if user turns on a border, it will give a bit more maneuvering room. |
1784 | 363 |
playHeight:= 1200; |
2096 | 364 |
playWidth:= 2560; |
1776 | 365 |
leftX:= (LAND_WIDTH - playWidth) div 2; |
366 |
rightX:= ((playWidth + (LAND_WIDTH - playWidth) div 2) - 1); |
|
367 |
topY:= LAND_HEIGHT - playHeight; |
|
368 |
||
1754 | 369 |
WriteLnToConsole('Generating forts land...'); |
370 |
||
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
371 |
tmpsurf:= LoadDataImage(ptForts, ClansArray[0]^.Teams[0]^.FortName + 'L', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); |
1784 | 372 |
BlitImageAndGenerateCollisionInfo(leftX+150, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); |
1754 | 373 |
SDL_FreeSurface(tmpsurf); |
374 |
||
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
375 |
tmpsurf:= LoadDataImage(ptForts, ClansArray[1]^.Teams[0]^.FortName + 'R', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); |
1784 | 376 |
BlitImageAndGenerateCollisionInfo(rightX - 150 - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); |
1754 | 377 |
SDL_FreeSurface(tmpsurf); |
378 |
end; |
|
379 |
||
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
380 |
procedure LoadMapConfig; |
8060 | 381 |
var f: PFSFile; |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
382 |
s: shortstring; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
383 |
begin |
8025 | 384 |
s:= cPathz[ptMapCurrent] + '/map.cfg'; |
385 |
||
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
386 |
WriteLnToConsole('Fetching map HH limit'); |
8060 | 387 |
|
388 |
f:= pfsOpenRead(s); |
|
389 |
if f <> nil then |
|
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
390 |
begin |
8060 | 391 |
pfsReadLn(f, s); |
392 |
if not pfsEof(f) then |
|
393 |
begin |
|
394 |
pfsReadLn(f, s); |
|
395 |
val(s, MaxHedgehogs) |
|
396 |
end; |
|
397 |
||
398 |
pfsClose(f) |
|
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
399 |
end; |
8060 | 400 |
|
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
401 |
if (MaxHedgehogs = 0) then |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
402 |
MaxHedgehogs:= 18; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
403 |
end; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
404 |
|
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5231
diff
changeset
|
405 |
// Loads Land[] from an image, allowing overriding standard collision |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
406 |
procedure LoadMask; |
1792 | 407 |
var tmpsurf: PSDL_Surface; |
408 |
p: PLongwordArray; |
|
409 |
x, y, cpX, cpY: Longword; |
|
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
410 |
mapName: shortstring; |
1792 | 411 |
begin |
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
412 |
tmpsurf:= LoadDataImage(ptMapCurrent, 'mask', ifAlpha or ifTransparent or ifIgnoreCaps); |
5770 | 413 |
if tmpsurf = nil then |
414 |
begin |
|
8025 | 415 |
mapName:= ExtractFileName(cPathz[ptMapCurrent]); |
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
416 |
tmpsurf:= LoadDataImage(ptMissionMaps, mapName + '/mask', ifAlpha or ifTransparent or ifIgnoreCaps); |
5770 | 417 |
end; |
3920
a54ca6185307
updated lua loading in the ifrontend and also fixed masked maps
koda
parents:
3912
diff
changeset
|
418 |
|
6096
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
419 |
|
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
420 |
if (tmpsurf <> nil) and (tmpsurf^.format^.BytesPerPixel = 4) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
421 |
begin |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
422 |
if LAND_WIDTH = 0 then |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
423 |
begin |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
424 |
LoadMapConfig; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
425 |
ResizeLand(tmpsurf^.w, tmpsurf^.h); |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
426 |
playHeight:= tmpsurf^.h; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
427 |
playWidth:= tmpsurf^.w; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
428 |
leftX:= (LAND_WIDTH - playWidth) div 2; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
429 |
rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
430 |
topY:= LAND_HEIGHT - playHeight; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
431 |
end; |
6096
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
432 |
disableLandBack:= true; |
2376 | 433 |
|
6096
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
434 |
cpX:= (LAND_WIDTH - tmpsurf^.w) div 2; |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
435 |
cpY:= LAND_HEIGHT - tmpsurf^.h; |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
436 |
if SDL_MustLock(tmpsurf) then |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
437 |
SDLTry(SDL_LockSurface(tmpsurf) >= 0, true); |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
438 |
|
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
439 |
p:= tmpsurf^.pixels; |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
440 |
for y:= 0 to Pred(tmpsurf^.h) do |
8848
e9ebd63f8a03
So. Some themes have objects that seem to be large natural extensions of the landscape. Masks allow maintaining that. Lemme know if it doesn't look good. If it doesn't, can still use for ice/bounce/indestructible. Indestructible bunker object for example.
nemo
parents:
8370
diff
changeset
|
441 |
begin |
6096
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
442 |
for x:= 0 to Pred(tmpsurf^.w) do |
8848
e9ebd63f8a03
So. Some themes have objects that seem to be large natural extensions of the landscape. Masks allow maintaining that. Lemme know if it doesn't look good. If it doesn't, can still use for ice/bounce/indestructible. Indestructible bunker object for example.
nemo
parents:
8370
diff
changeset
|
443 |
SetLand(Land[cpY + y, cpX + x], p^[x]); |
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10108
diff
changeset
|
444 |
p:= PLongwordArray(@(p^[tmpsurf^.pitch div 4])); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
445 |
end; |
2243
b4764993f833
additional touch support and nemo's reduced land array size
koda
parents:
2240
diff
changeset
|
446 |
|
6096
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
447 |
if SDL_MustLock(tmpsurf) then |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
448 |
SDL_UnlockSurface(tmpsurf); |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
449 |
if not disableLandBack then |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
450 |
begin |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
451 |
// freed in freeModule() below |
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
452 |
LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifTransparent); |
6982 | 453 |
if (LandBackSurface <> nil) and GrayScale then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
454 |
Surface2GrayScale(LandBackSurface) |
6096
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
455 |
end; |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
456 |
end; |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
457 |
if (tmpsurf <> nil) then |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
458 |
SDL_FreeSurface(tmpsurf); |
a00dbbf49d6c
Add landbacktex to a few maps, just to see how it looks.
nemo
parents:
6082
diff
changeset
|
459 |
tmpsurf:= nil; |
1792 | 460 |
end; |
461 |
||
1754 | 462 |
procedure LoadMap; |
463 |
var tmpsurf: PSDL_Surface; |
|
3920
a54ca6185307
updated lua loading in the ifrontend and also fixed masked maps
koda
parents:
3912
diff
changeset
|
464 |
mapName: shortstring = ''; |
1754 | 465 |
begin |
466 |
WriteLnToConsole('Loading land from file...'); |
|
467 |
AddProgress; |
|
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
468 |
tmpsurf:= LoadDataImage(ptMapCurrent, 'map', ifAlpha or ifTransparent or ifIgnoreCaps); |
3912
e11df2de6af2
have engine try for a second position when map loading fails (in this way it's possible to move Missions data to any path)
koda
parents:
3836
diff
changeset
|
469 |
if tmpsurf = nil then |
5770 | 470 |
begin |
8025 | 471 |
mapName:= ExtractFileName(cPathz[ptMapCurrent]); |
7640
e9e6b4d740f6
clean up LoadImage and UserPathz/AltPath/etc related redundancy by introducing 3 new functions in uStore.pas
sheepluva
parents:
7594
diff
changeset
|
472 |
tmpsurf:= LoadDataImage(ptMissionMaps, mapName + '/map', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); |
5770 | 473 |
end; |
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
474 |
// (bare) Sanity check. Considering possible LongInt comparisons as well as just how much system memoery it would take |
9243
d8f6a396d98e
First select group of templates, then pick template from selected group
unc0rr
parents:
9080
diff
changeset
|
475 |
TryDo((tmpsurf^.w < $40000000) and (tmpsurf^.h < $40000000) and (QWord(tmpsurf^.w) * tmpsurf^.h < 6*1024*1024*1024), 'Map dimensions too big!', true); |
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
476 |
|
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
477 |
ResizeLand(tmpsurf^.w, tmpsurf^.h); |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
478 |
LoadMapConfig; |
1792 | 479 |
|
1776 | 480 |
playHeight:= tmpsurf^.h; |
481 |
playWidth:= tmpsurf^.w; |
|
482 |
leftX:= (LAND_WIDTH - playWidth) div 2; |
|
483 |
rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1; |
|
484 |
topY:= LAND_HEIGHT - playHeight; |
|
485 |
||
1754 | 486 |
TryDo(tmpsurf^.format^.BytesPerPixel = 4, 'Map should be 32bit', true); |
487 |
||
1772 | 488 |
BlitImageAndGenerateCollisionInfo( |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
489 |
(LAND_WIDTH - tmpsurf^.w) div 2, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
490 |
LAND_HEIGHT - tmpsurf^.h, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
491 |
tmpsurf^.w, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
492 |
tmpsurf); |
1754 | 493 |
SDL_FreeSurface(tmpsurf); |
1792 | 494 |
|
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
495 |
LoadMask; |
1754 | 496 |
end; |
497 |
||
5717 | 498 |
procedure DrawBottomBorder; // broken out from other borders for doing a floor-only map, or possibly updating bottom during SD |
5832
f730c8a9777b
Remove some unused variables and options.inc which uFloat doesn't use, probably should never use, and was getting in the way of my testcase - but most importantly, remove the inline on hwSqrt which was causing very bad math on my compiler/machine. We may have to remove more inlining. A pity.
nemo
parents:
5775
diff
changeset
|
499 |
var x, w, c: Longword; |
5717 | 500 |
begin |
5718
e74de0528ef4
Let's draw the bottom border thicker, so it is more visible
nemo
parents:
5717
diff
changeset
|
501 |
for w:= 0 to 23 do |
5717 | 502 |
for x:= leftX to rightX do |
503 |
begin |
|
6011
519f8a58c021
Fix a bunch of warnings (also improves speed a bit in 32 bit code)
unC0Rr
parents:
5832
diff
changeset
|
504 |
Land[Longword(cWaterLine) - 1 - w, x]:= lfIndestructible; |
5717 | 505 |
if (x + w) mod 32 < 16 then |
506 |
c:= AMask |
|
507 |
else |
|
508 |
c:= AMask or RMask or GMask; // FF00FFFF |
|
509 |
||
510 |
if (cReducedQuality and rqBlurryLand) = 0 then |
|
6011
519f8a58c021
Fix a bunch of warnings (also improves speed a bit in 32 bit code)
unC0Rr
parents:
5832
diff
changeset
|
511 |
LandPixels[Longword(cWaterLine) - 1 - w, x]:= c |
5717 | 512 |
else |
6011
519f8a58c021
Fix a bunch of warnings (also improves speed a bit in 32 bit code)
unC0Rr
parents:
5832
diff
changeset
|
513 |
LandPixels[(Longword(cWaterLine) - 1 - w) div 2, x div 2]:= c |
5718
e74de0528ef4
Let's draw the bottom border thicker, so it is more visible
nemo
parents:
5717
diff
changeset
|
514 |
end |
5717 | 515 |
end; |
516 |
||
1754 | 517 |
procedure GenMap; |
1784 | 518 |
var x, y, w, c: Longword; |
8025 | 519 |
map, mask: shortstring; |
8011 | 520 |
maskOnly: boolean; |
1754 | 521 |
begin |
3463 | 522 |
hasBorder:= false; |
8011 | 523 |
maskOnly:= false; |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2866
diff
changeset
|
524 |
|
3463 | 525 |
LoadThemeConfig; |
3697 | 526 |
|
4900 | 527 |
// is this not needed any more? lets hope setlength sets also 0s |
3630 | 528 |
//if ((GameFlags and gfForts) <> 0) or (Pathz[ptMapCurrent] <> '') then |
529 |
// FillChar(Land,SizeOf(TCollisionArray),0);*) |
|
3697 | 530 |
|
3463 | 531 |
if (GameFlags and gfForts) = 0 then |
8025 | 532 |
if cPathz[ptMapCurrent] <> '' then |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
533 |
begin |
8025 | 534 |
map:= cPathz[ptMapCurrent] + '/map.png'; |
535 |
mask:= cPathz[ptMapCurrent] + '/mask.png'; |
|
8182 | 536 |
if (not(pfsExists(map)) and pfsExists(mask)) then |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
537 |
begin |
8011 | 538 |
maskOnly:= true; |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
539 |
LoadMask; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
540 |
GenLandSurface |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
541 |
end |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
542 |
else LoadMap; |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
543 |
end |
3463 | 544 |
else |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
545 |
begin |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
546 |
WriteLnToConsole('Generating land...'); |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
547 |
case cMapGen of |
10421 | 548 |
mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
549 |
mgMaze : begin ResizeLand(4096,2048); GenMaze; end; |
|
550 |
mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
|
551 |
mgDrawn : GenDrawnMap; |
|
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
552 |
else |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
553 |
OutError('Unknown mapgen', true); |
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
554 |
end; |
3463 | 555 |
GenLandSurface |
8010
195677b0d06b
something bender asked for. allow a mask without a map
nemo
parents:
8003
diff
changeset
|
556 |
end |
3463 | 557 |
else |
558 |
MakeFortsMap; |
|
559 |
||
560 |
AddProgress; |
|
1760 | 561 |
|
1768 | 562 |
// check for land near top |
1784 | 563 |
c:= 0; |
564 |
if (GameFlags and gfBorder) <> 0 then |
|
565 |
hasBorder:= true |
|
566 |
else |
|
567 |
for y:= topY to topY + 5 do |
|
568 |
for x:= leftX to rightX do |
|
569 |
if Land[y, x] <> 0 then |
|
570 |
begin |
|
571 |
inc(c); |
|
8370 | 572 |
if c > LongWord((LAND_WIDTH div 2)) then // avoid accidental triggering |
1784 | 573 |
begin |
574 |
hasBorder:= true; |
|
575 |
break; |
|
576 |
end; |
|
577 |
end; |
|
1768 | 578 |
|
1776 | 579 |
if hasBorder then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
580 |
begin |
10661 | 581 |
if WorldEdge = weNone then |
582 |
begin |
|
583 |
for y:= 0 to LAND_HEIGHT - 1 do |
|
584 |
for x:= 0 to LAND_WIDTH - 1 do |
|
585 |
if (y < topY) or (x < leftX) or (x > rightX) then |
|
586 |
Land[y, x]:= lfIndestructible; |
|
587 |
end |
|
588 |
else if topY > 0 then |
|
589 |
begin |
|
590 |
for y:= 0 to LongInt(topY) - 1 do |
|
591 |
for x:= 0 to LAND_WIDTH - 1 do |
|
3519 | 592 |
Land[y, x]:= lfIndestructible; |
10661 | 593 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
594 |
// experiment hardcoding cave |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
595 |
// also try basing cave dimensions on map/template dimensions, if they exist |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
596 |
for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
597 |
begin |
9524 | 598 |
if (WorldEdge <> weBounce) and (WorldEdge <> weWrap) then |
599 |
for y:= topY to LAND_HEIGHT - 1 do |
|
600 |
begin |
|
601 |
Land[y, leftX + w]:= lfIndestructible; |
|
602 |
Land[y, rightX - w]:= lfIndestructible; |
|
603 |
if (y + w) mod 32 < 16 then |
|
604 |
c:= AMask |
|
605 |
else |
|
606 |
c:= AMask or RMask or GMask; // FF00FFFF |
|
3595
341e407e3754
partially removing DOWNSCALE ifdef -- only two remain and their removal requires dynamic allocation (btw this breaks low quality mode)
koda
parents:
3551
diff
changeset
|
607 |
|
9524 | 608 |
if (cReducedQuality and rqBlurryLand) = 0 then |
609 |
begin |
|
610 |
LandPixels[y, leftX + w]:= c; |
|
611 |
LandPixels[y, rightX - w]:= c; |
|
612 |
end |
|
613 |
else |
|
614 |
begin |
|
615 |
LandPixels[y div 2, (leftX + w) div 2]:= c; |
|
616 |
LandPixels[y div 2, (rightX - w) div 2]:= c; |
|
617 |
end; |
|
5717 | 618 |
end; |
1768 | 619 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
620 |
for x:= leftX to rightX do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
621 |
begin |
5717 | 622 |
Land[topY + w, x]:= lfIndestructible; |
623 |
if (x + w) mod 32 < 16 then |
|
624 |
c:= AMask |
|
625 |
else |
|
626 |
c:= AMask or RMask or GMask; // FF00FFFF |
|
3595
341e407e3754
partially removing DOWNSCALE ifdef -- only two remain and their removal requires dynamic allocation (btw this breaks low quality mode)
koda
parents:
3551
diff
changeset
|
627 |
|
5717 | 628 |
if (cReducedQuality and rqBlurryLand) = 0 then |
629 |
LandPixels[topY + w, x]:= c |
|
630 |
else |
|
631 |
LandPixels[(topY + w) div 2, x div 2]:= c; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
632 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
633 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
634 |
end; |
1768 | 635 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
636 |
if (GameFlags and gfBottomBorder) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
637 |
DrawBottomBorder; |
5717 | 638 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
639 |
if (GameFlags and gfDisableGirders) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
640 |
hasGirders:= false; |
2891
e1f902eb0cfe
Formerly "Draw Girders" by MrMfS - now "Disable Girders" to allow template prefs to still exist
nemo
parents:
2866
diff
changeset
|
641 |
|
8025 | 642 |
if (GameFlags and gfForts = 0) and (maskOnly or (cPathz[ptMapCurrent] = '')) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
643 |
AddObjects |
10017 | 644 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
645 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
646 |
AddProgress(); |
1776 | 647 |
|
3058 | 648 |
FreeLandObjects; |
649 |
||
6982 | 650 |
if GrayScale then |
5441
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
651 |
begin |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
652 |
if (cReducedQuality and rqBlurryLand) = 0 then |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
653 |
for x:= leftX to rightX do |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
654 |
for y:= topY to LAND_HEIGHT-1 do |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
655 |
begin |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
656 |
w:= LandPixels[y,x]; |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
657 |
w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
658 |
(w shr BShift and $FF) * RGB_LUMINANCE_GREEN + |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
659 |
(w shr GShift and $FF) * RGB_LUMINANCE_BLUE)); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
660 |
if w > 255 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
661 |
w:= 255; |
5441
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
662 |
w:= (w and $FF shl RShift) or (w and $FF shl BShift) or (w and $FF shl GShift) or (LandPixels[y,x] and AMask); |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
663 |
LandPixels[y,x]:= w or (LandPixels[y, x] and AMask) |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
664 |
end |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
665 |
else |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
666 |
for x:= leftX div 2 to rightX div 2 do |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
667 |
for y:= topY div 2 to LAND_HEIGHT-1 div 2 do |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
668 |
begin |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
669 |
w:= LandPixels[y div 2,x div 2]; |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
670 |
w:= ((w shr RShift and $FF) + (w shr BShift and $FF) + (w shr GShift and $FF)) div 3; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
671 |
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); |
5441
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
672 |
LandPixels[y,x]:= w or (LandPixels[y div 2, x div 2] and AMask) |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
673 |
end |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5274
diff
changeset
|
674 |
end; |
10016
59a6d65fcb60
(experimental) make the mysterious borders around land/hats/etc that appear on zoom vanish
sheepluva
parents:
9998
diff
changeset
|
675 |
|
59a6d65fcb60
(experimental) make the mysterious borders around land/hats/etc that appear on zoom vanish
sheepluva
parents:
9998
diff
changeset
|
676 |
PrettifyLandAlpha(); |
10626
2562797ab3cf
adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents:
10603
diff
changeset
|
677 |
|
10661 | 678 |
// adjust world edges for borderless maps |
679 |
if (WorldEdge <> weNone) and (not hasBorder) then |
|
680 |
InitWorldEdges(); |
|
10626
2562797ab3cf
adjust position of world edges (at 150 px away from outmost land collision, or less if land array ends earlier)
sheepluva
parents:
10603
diff
changeset
|
681 |
|
37 | 682 |
end; |
683 |
||
7079 | 684 |
procedure GenPreview(out Preview: TPreview); |
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
685 |
var rh, rw, ox, oy, x, y, xx, yy, t, bit, cbit, lh, lw: LongInt; |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
686 |
begin |
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
687 |
WriteLnToConsole('Generating preview...'); |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
688 |
case cMapGen of |
10603
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
689 |
mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
690 |
mgMaze: begin ResizeLand(4096,2048); GenMaze; end; |
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
691 |
mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
692 |
mgDrawn: GenDrawnMap; |
4562 | 693 |
else |
694 |
OutError('Unknown mapgen', true); |
|
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
695 |
end; |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
696 |
|
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
697 |
// strict scaling needed here since preview assumes a rectangle |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
698 |
rh:= max(LAND_HEIGHT,2048); |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
699 |
rw:= max(LAND_WIDTH,4096); |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
700 |
ox:= 0; |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
701 |
if rw < rh*2 then |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
702 |
begin |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
703 |
rw:= rh*2; |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
704 |
end; |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
705 |
if rh < rw div 2 then rh:= rw * 2; |
10017 | 706 |
|
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
707 |
ox:= (rw-LAND_WIDTH) div 2; |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
708 |
oy:= rh-LAND_HEIGHT; |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
709 |
|
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
710 |
lh:= rh div 128; |
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
711 |
lw:= rw div 32; |
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
712 |
for y:= 0 to 127 do |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
713 |
for x:= 0 to 31 do |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
714 |
begin |
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
715 |
Preview[y, x]:= 0; |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
716 |
for bit:= 0 to 7 do |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
717 |
begin |
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
718 |
t:= 0; |
3617 | 719 |
cbit:= bit * 8; |
720 |
for yy:= y * lh to y * lh + 7 do |
|
721 |
for xx:= x * lw + cbit to x * lw + cbit + 7 do |
|
10017 | 722 |
if ((yy-oy) and LAND_HEIGHT_MASK = 0) and ((xx-ox) and LAND_WIDTH_MASK = 0) |
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7293
diff
changeset
|
723 |
and (Land[yy-oy, xx-ox] <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6491
diff
changeset
|
724 |
inc(t); |
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
725 |
if t > 8 then |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
726 |
Preview[y, x]:= Preview[y, x] or ($80 shr bit); |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3287
diff
changeset
|
727 |
end; |
566 | 728 |
end; |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
729 |
end; |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
730 |
|
4398
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
731 |
|
10162 | 732 |
procedure GenPreviewAlpha(out Preview: TPreviewAlpha); |
733 |
var rh, rw, ox, oy, x, y, xx, yy, t, lh, lw: LongInt; |
|
734 |
begin |
|
735 |
WriteLnToConsole('Generating preview...'); |
|
736 |
case cMapGen of |
|
10603
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
737 |
mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
738 |
mgMaze: begin ResizeLand(4096,2048); GenMaze; end; |
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
739 |
mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
bda5c7caf396
switch mapgen to enum. should still try and make sure the values are backwards compatible if possible.
nemo
parents:
10490
diff
changeset
|
740 |
mgDrawn: GenDrawnMap; |
10162 | 741 |
else |
742 |
OutError('Unknown mapgen', true); |
|
743 |
end; |
|
744 |
||
745 |
// strict scaling needed here since preview assumes a rectangle |
|
746 |
rh:= max(LAND_HEIGHT, 2048); |
|
747 |
rw:= max(LAND_WIDTH, 4096); |
|
748 |
ox:= 0; |
|
749 |
if rw < rh*2 then |
|
750 |
begin |
|
751 |
rw:= rh*2; |
|
752 |
end; |
|
753 |
if rh < rw div 2 then rh:= rw * 2; |
|
754 |
||
755 |
ox:= (rw-LAND_WIDTH) div 2; |
|
756 |
oy:= rh-LAND_HEIGHT; |
|
757 |
||
758 |
lh:= rh div 128; |
|
759 |
lw:= rw div 256; |
|
760 |
for y:= 0 to 127 do |
|
761 |
for x:= 0 to 255 do |
|
762 |
begin |
|
763 |
t:= 0; |
|
764 |
||
10165 | 765 |
for yy:= y * lh - oy to y * lh + lh - 1 - oy do |
766 |
for xx:= x * lw - ox to x * lw + lw - 1 - ox do |
|
10162 | 767 |
if (yy and LAND_HEIGHT_MASK = 0) and (xx and LAND_WIDTH_MASK = 0) |
768 |
and (Land[yy, xx] <> 0) then |
|
769 |
inc(t); |
|
770 |
||
10165 | 771 |
Preview[y, x]:= t * 255 div (lh * lw); |
10162 | 772 |
end; |
773 |
end; |
|
774 |
||
4398
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
775 |
procedure chLandCheck(var s: shortstring); |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
776 |
begin |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
777 |
AddFileLog('CheckLandDigest: ' + s + ' digest : ' + digest); |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
778 |
if digest = '' then |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
779 |
digest:= s |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
780 |
else |
6025
cac1d5601d7c
reviewed the build system and parts of the previous merge, performed some code cleanup
koda
parents:
6023
diff
changeset
|
781 |
TryDo(s = digest, 'Different maps generated, sorry', true); |
4398
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
782 |
end; |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
783 |
|
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
784 |
procedure chSendLandDigest(var s: shortstring); |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
785 |
var adler, i: LongInt; |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
786 |
begin |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
787 |
adler:= 1; |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
788 |
for i:= 0 to LAND_HEIGHT-1 do |
6927
ee000959d645
Oh, and I guess this is needed as well, although if many other places in the code do this, pas2c will need
nemo
parents:
6898
diff
changeset
|
789 |
adler:= Adler32Update(adler, @Land[i,0], LAND_WIDTH); |
6254
e90fb60cb46d
Force a desync if there is a script name mismatch. This avoids playing until the game desyncs due to script differences.
nemo
parents:
6096
diff
changeset
|
790 |
s:= 'M' + IntToStr(adler) + cScriptName; |
4398
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
791 |
|
10022 | 792 |
ScriptSetString('LandDigest', s); |
793 |
||
4398
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
794 |
chLandCheck(s); |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
795 |
SendIPCRaw(@s[0], Length(s) + 1) |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
796 |
end; |
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
797 |
|
3038 | 798 |
procedure initModule; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2692
diff
changeset
|
799 |
begin |
6898 | 800 |
RegisterVariable('landcheck', @chLandCheck, false); |
801 |
RegisterVariable('sendlanddigest', @chSendLandDigest, false); |
|
4398
36d7e4b6ca81
Move some command handlers out of uCommands into more appropriate places, thus removing some dependencies. Ideally uCommands shouldn't depend on anything (except for uTypes and uConsts probably)
unc0rr
parents:
4389
diff
changeset
|
802 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2905
diff
changeset
|
803 |
LandBackSurface:= nil; |
3369
c7289e42f0ee
add other controls for map preview, also fix a bug in digest
koda
parents:
3365
diff
changeset
|
804 |
digest:= ''; |
7549 | 805 |
LAND_WIDTH:= 0; |
806 |
LAND_HEIGHT:= 0; |
|
807 |
(* |
|
3612
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
808 |
if (cReducedQuality and rqBlurryLand) = 0 then |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
809 |
SetLength(LandPixels, LAND_HEIGHT, LAND_WIDTH) |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
810 |
else |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
811 |
SetLength(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2); |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
812 |
|
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
813 |
SetLength(Land, LAND_HEIGHT, LAND_WIDTH); |
b50215a8a43d
land arrays are allocated dynamically, so DOWNSCALE and LOWRES macros are now removed and replaced by run time flags rqBlurryLand and rqLowRes
koda
parents:
3608
diff
changeset
|
814 |
SetLength(LandDirty, (LAND_HEIGHT div 32), (LAND_WIDTH div 32)); |
7549 | 815 |
*) |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2692
diff
changeset
|
816 |
end; |
51 | 817 |
|
3038 | 818 |
procedure freeModule; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2692
diff
changeset
|
819 |
begin |
7151 | 820 |
SetLength(Land, 0, 0); |
821 |
SetLength(LandPixels, 0, 0); |
|
822 |
SetLength(LandDirty, 0, 0); |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2692
diff
changeset
|
823 |
end; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2692
diff
changeset
|
824 |
|
4 | 825 |
end. |