equal
deleted
inserted
replaced
6 |
6 |
7 procedure GenMaze; |
7 procedure GenMaze; |
8 |
8 |
9 implementation |
9 implementation |
10 |
10 |
11 uses uRandom, uLandOutline, uLandTemplates, uVariables, uFloat, uConsts, uLandGenTemplateBased, uUtils; |
11 uses uRandom, uLandOutline, uLandTemplates, uVariables, uFloat, uConsts, |
|
12 uLandGenTemplateBased, uUtils, uLandUtils; |
12 |
13 |
13 type direction = record x, y: LongInt; end; |
14 type direction = record x, y: LongInt; end; |
14 const DIR_N: direction = (x: 0; y: -1); |
15 const DIR_N: direction = (x: 0; y: -1); |
15 DIR_E: direction = (x: 1; y: 0); |
16 DIR_E: direction = (x: 1; y: 0); |
16 DIR_S: direction = (x: 0; y: 1); |
17 DIR_S: direction = (x: 0; y: 1); |
401 playWidth := num_cells_x * cellsize; |
402 playWidth := num_cells_x * cellsize; |
402 off_y := LAND_HEIGHT - playHeight; |
403 off_y := LAND_HEIGHT - playHeight; |
403 |
404 |
404 for x := 0 to playWidth do |
405 for x := 0 to playWidth do |
405 for y := 0 to off_y - 1 do |
406 for y := 0 to off_y - 1 do |
406 Land[y, x] := 0; |
407 LandSet(y, x, 0); |
407 |
408 |
408 for x := 0 to playWidth do |
409 for x := 0 to playWidth do |
409 for y := off_y to LAND_HEIGHT - 1 do |
410 for y := off_y to LAND_HEIGHT - 1 do |
410 Land[y, x] := lfBasic; |
411 LandSet(y, x, lfBasic); |
411 |
412 |
412 for y := 0 to num_cells_y - 1 do |
413 for y := 0 to num_cells_y - 1 do |
413 for x := 0 to num_cells_x - 1 do |
414 for x := 0 to num_cells_x - 1 do |
414 maze[x, y] := false; |
415 maze[x, y] := false; |
415 |
416 |
525 if maze_inverted then |
526 if maze_inverted then |
526 FillLand(1, 1 + off_y, 0, 0) |
527 FillLand(1, 1 + off_y, 0, 0) |
527 else |
528 else |
528 begin |
529 begin |
529 x := 0; |
530 x := 0; |
530 while Land[cellsize div 2 + cellsize + off_y, x] = lfBasic do |
531 while LandGet(cellsize div 2 + cellsize + off_y, x) = lfBasic do |
531 x := x + 1; |
532 x := x + 1; |
532 while Land[cellsize div 2 + cellsize + off_y, x] = 0 do |
533 while LandGet(cellsize div 2 + cellsize + off_y, x) = 0 do |
533 x := x + 1; |
534 x := x + 1; |
534 FillLand(x+1, cellsize div 2 + cellsize + off_y, 0, 0); |
535 FillLand(x+1, cellsize div 2 + cellsize + off_y, 0, 0); |
535 end; |
536 end; |
536 |
537 |
537 MaxHedgehogs:= 32; |
538 MaxHedgehogs:= 32; |