changeset 3407 | dcc129c4352e |
parent 3369 | c7289e42f0ee |
child 3463 | 23c50be687a9 |
3406:f4bdebced042 | 3407:dcc129c4352e |
---|---|
49 function GenPreview: TPreview; |
49 function GenPreview: TPreview; |
50 procedure CheckLandDigest(s: shortstring); |
50 procedure CheckLandDigest(s: shortstring); |
51 function LandBackPixel(x, y: LongInt): LongWord; |
51 function LandBackPixel(x, y: LongInt): LongWord; |
52 |
52 |
53 implementation |
53 implementation |
54 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uAmmos, uLandTexture; |
54 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uLandTexture; |
55 |
55 |
56 operator=(const a, b: direction) c: Boolean; |
56 operator=(const a, b: direction) c: Boolean; |
57 begin |
57 begin |
58 c := (a.x = b.x) and (a.y = b.y); |
58 c := (a.x = b.x) and (a.y = b.y); |
59 end; |
59 end; |
66 procedure LogLandDigest; |
66 procedure LogLandDigest; |
67 var ctx: TSHA1Context; |
67 var ctx: TSHA1Context; |
68 dig: TSHA1Digest; |
68 dig: TSHA1Digest; |
69 s: shortstring; |
69 s: shortstring; |
70 begin |
70 begin |
71 {$HINTS OFF} |
|
71 SHA1Init(ctx); |
72 SHA1Init(ctx); |
73 {$HINTS ON} |
|
72 SHA1UpdateLongwords(ctx, @Land, sizeof(Land)); |
74 SHA1UpdateLongwords(ctx, @Land, sizeof(Land)); |
73 dig:= SHA1Final(ctx); |
75 dig:= SHA1Final(ctx); |
74 s:='M{'+inttostr(dig[0])+':' |
76 s:='M{'+inttostr(dig[0])+':' |
75 +inttostr(dig[1])+':' |
77 +inttostr(dig[1])+':' |
76 +inttostr(dig[2])+':' |
78 +inttostr(dig[2])+':' |
190 X, Y: LongInt; |
192 X, Y: LongInt; |
191 begin |
193 begin |
192 pi:= EndI; |
194 pi:= EndI; |
193 i:= StartI; |
195 i:= StartI; |
194 ni:= Succ(StartI); |
196 ni:= Succ(StartI); |
197 {$HINTS OFF} |
|
195 Vector(opa.ar[pi], opa.ar[i], opa.ar[ni], NVx, NVy); |
198 Vector(opa.ar[pi], opa.ar[i], opa.ar[ni], NVx, NVy); |
199 {$HINTS ON} |
|
196 repeat |
200 repeat |
197 inc(pi); |
201 inc(pi); |
198 if pi > EndI then pi:= StartI; |
202 if pi > EndI then pi:= StartI; |
199 inc(i); |
203 inc(i); |
200 if i > EndI then i:= StartI; |
204 if i > EndI then i:= StartI; |
294 Stack.Count:= 0; |
298 Stack.Count:= 0; |
295 xl:= x - 1; |
299 xl:= x - 1; |
296 xr:= x; |
300 xr:= x; |
297 Push(xl, xr, y, -1); |
301 Push(xl, xr, y, -1); |
298 Push(xl, xr, y, 1); |
302 Push(xl, xr, y, 1); |
303 dir:= 0; |
|
299 while Stack.Count > 0 do |
304 while Stack.Count > 0 do |
300 begin |
305 begin |
301 Pop(xl, xr, y, dir); |
306 Pop(xl, xr, y, dir); |
302 while (xl > 0) and (Land[y, xl] <> 0) do dec(xl); |
307 while (xl > 0) and (Land[y, xl] <> 0) do dec(xl); |
303 while (xr < LAND_WIDTH - 1) and (Land[y, xr] <> 0) do inc(xr); |
308 while (xr < LAND_WIDTH - 1) and (Land[y, xr] <> 0) do inc(xr); |
403 for i:= 0 to pred(pa.Count) do |
408 for i:= 0 to pred(pa.Count) do |
404 begin |
409 begin |
405 pa.ar[i].x:= BasePoints^[i].x + LongInt(GetRandom(BasePoints^[i].w)); |
410 pa.ar[i].x:= BasePoints^[i].x + LongInt(GetRandom(BasePoints^[i].w)); |
406 if pa.ar[i].x <> NTPX then |
411 if pa.ar[i].x <> NTPX then |
407 pa.ar[i].x:= pa.ar[i].x + ((LAND_WIDTH - Template.TemplateWidth) div 2); |
412 pa.ar[i].x:= pa.ar[i].x + ((LAND_WIDTH - Template.TemplateWidth) div 2); |
408 pa.ar[i].y:= BasePoints^[i].y + LongInt(GetRandom(BasePoints^[i].h)) + LAND_HEIGHT - Template.TemplateHeight |
413 pa.ar[i].y:= BasePoints^[i].y + LongInt(GetRandom(BasePoints^[i].h)) + LAND_HEIGHT - LongInt(Template.TemplateHeight) |
409 end; |
414 end; |
410 |
415 |
411 if canMirror then |
416 if canMirror then |
412 if getrandom(2) = 0 then |
417 if getrandom(2) = 0 then |
413 begin |
418 begin |
550 begin |
555 begin |
551 for y:= 0 to LAND_HEIGHT - 1 do |
556 for y:= 0 to LAND_HEIGHT - 1 do |
552 for x:= 0 to LAND_WIDTH - 1 do |
557 for x:= 0 to LAND_WIDTH - 1 do |
553 Land[y, x]:= COLOR_LAND; |
558 Land[y, x]:= COLOR_LAND; |
554 |
559 |
560 {$HINTS OFF} |
|
555 SetPoints(Template, pa); |
561 SetPoints(Template, pa); |
562 {$HINTS ON} |
|
556 for i:= 1 to Template.BezierizeCount do |
563 for i:= 1 to Template.BezierizeCount do |
557 begin |
564 begin |
558 BezierizeEdge(pa, _0_5); |
565 BezierizeEdge(pa, _0_5); |
559 RandomizePoints(pa); |
566 RandomizePoints(pa); |
560 RandomizePoints(pa) |
567 RandomizePoints(pa) |