equal
deleted
inserted
replaced
651 |
651 |
652 procedure GenMaze; |
652 procedure GenMaze; |
653 const small_cell_size = 128; |
653 const small_cell_size = 128; |
654 medium_cell_size = 192; |
654 medium_cell_size = 192; |
655 large_cell_size = 256; |
655 large_cell_size = 256; |
656 braidness = 25; |
656 braidness = 10; |
657 maze_inverted = false; //false makes more sense for now |
657 maze_inverted = false; //false makes more sense for now |
658 |
658 |
659 var x, y: Longint; |
659 var x, y: Longint; |
660 bg_color, fg_color: Longint; |
660 bg_color, fg_color: Longint; |
661 cellsize: LongInt; //selected by the user in the gui |
661 cellsize: LongInt; //selected by the user in the gui |
752 tries := tries + 1; |
752 tries := tries + 1; |
753 end; |
753 end; |
754 |
754 |
755 end; |
755 end; |
756 procedure add_vertex(x, y: Longint); |
756 procedure add_vertex(x, y: Longint); |
757 begin |
757 var tmp_x, tmp_y: Longint; |
758 writelntoconsole('add_vertex('+inttostr(x)+', '+inttostr(y)+')'); |
758 begin |
759 if x = NTPX then |
759 if x = NTPX then |
760 begin |
760 begin |
761 pa.ar[num_vertices].x := NTPX; |
761 if pa.ar[num_vertices - 6].x = NTPX then |
762 pa.ar[num_vertices].y := 0; |
762 begin |
|
763 num_vertices := num_vertices - 6; |
|
764 end |
|
765 else |
|
766 begin |
|
767 pa.ar[num_vertices].x := NTPX; |
|
768 pa.ar[num_vertices].y := 0; |
|
769 end |
763 end |
770 end |
764 else |
771 else |
765 begin |
772 begin |
766 pa.ar[num_vertices].x := x*cellsize; |
773 if x mod 2 = 0 then tmp_x := cellsize |
767 pa.ar[num_vertices].y := y*cellsize + off_y; |
774 else tmp_x := cellsize * 2 div 3; |
|
775 if y mod 2 = 0 then tmp_y := cellsize |
|
776 else tmp_y := cellsize * 2 div 3; |
|
777 |
|
778 pa.ar[num_vertices].x := (x-1)*cellsize + tmp_x; |
|
779 pa.ar[num_vertices].y := (y-1)*cellsize + tmp_y + off_y; |
768 end; |
780 end; |
769 num_vertices := num_vertices + 1; |
781 num_vertices := num_vertices + 1; |
770 end; |
782 end; |
771 |
783 |
772 procedure add_edge(x, y: Longint; dir: direction); |
784 procedure add_edge(x, y: Longint; dir: direction); |
958 pa.count := num_vertices; |
970 pa.count := num_vertices; |
959 |
971 |
960 RandomizePoints(pa); |
972 RandomizePoints(pa); |
961 BezierizeEdge(pa, _0_25); |
973 BezierizeEdge(pa, _0_25); |
962 RandomizePoints(pa); |
974 RandomizePoints(pa); |
963 BezierizeEdge(pa, _0_5); |
975 BezierizeEdge(pa, _0_25); |
964 |
976 |
965 DrawEdge(pa, 0); |
977 DrawEdge(pa, 0); |
966 |
978 |
967 for x := 0 to num_cells_x - 1 do |
979 x := 0; |
968 for y := 0 to num_cells_y - 1 do |
980 while Land[cellsize div 2 + cellsize + off_y, x] = bg_color do |
969 if maze[x, y] then begin |
981 x := x + 1; |
970 FillLand(cellsize div 2 + cellsize * x, cellsize div 2 + cellsize * y + off_y); |
982 while Land[cellsize div 2 + cellsize + off_y, x] = fg_color do |
971 break; |
983 x := x + 1; |
972 end; |
984 FillLand(x+1, cellsize div 2 + cellsize + off_y); |
973 |
985 |
974 MaxHedgehogs:= 32; |
986 MaxHedgehogs:= 32; |
975 hasGirders:= false; |
987 hasGirders:= false; |
976 leftX:= 0; |
988 leftX:= 0; |
977 rightX:= playWidth; |
989 rightX:= playWidth; |