diff --git a/src/worldgen.mpsrc b/src/worldgen.mpsrc
index ca522107373f7ae63dccc066994cebef4b34d858..d49159a2428d1f9293956bc1a2aefd0c86cab6a3 100644 (file)
--- a/src/worldgen.mpsrc
+++ b/src/worldgen.mpsrc
end;\r
end;\r
\r
+ // Генерирует чанки руды в камне типа block с максимальной вероятность percent процентов\r
+ // Начиная с уровня starty и размером не более maxsize*maxsize\r
+ // С ростом глубины вероятность растёт\r
+ procedure GenOreChunks(block, percent, starty, maxsize : Integer);\r
+ const\r
+ preq = 100000;\r
+ var\r
+ x, y, i, j : Integer;\r
+ begin\r
+ for x := 0 to MAP_W do\r
+ for y := starty to MAP_H do\r
+ if RandomBoolean(y * percent * preq / MAP_H, 100 * preq) then\r
+ for i := 0 to rnd(maxsize) - 1 do\r
+ for j := 0 to rnd(maxsize) - 1 do\r
+ if RandomBoolean(50, 100) and (GetMap(x + i, y + j) = 3) then\r
+ SetMap(block, x + i, y + j);\r
+ end;\r
+\r
procedure genallrudes;\r
- var\r
- ix,iy,iu,iv:integer;\r
begin\r
- //алмазы\r
- for ix:=0 to 255 do\r
- for iy:=111 to 127 do\r
- if (rnd_pr(1,1,0)=1) then\r
- begin\r
- for iu:=0 to 2 do\r
- for iv:=0 to 2 do\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(10,19,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
-\r
- //золото\r
- for ix:=0 to 255 do\r
- for iy:=95 to 127 do\r
- if (rnd_pr(3,1,0)=1) then\r
- begin\r
- for iu:=0 to 2 do\r
- for iv:=0 to 2 do\r
- if (ix+iu<255) and (iy+iv<126) then\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(20,16,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
-\r
- //лазурит\r
- for ix:=0 to 255 do\r
- for iy:=107 to 127 do\r
- if (rnd_pr(2,1,0)=1) then\r
- begin\r
- for iu:=0 to 2 do\r
- for iv:=0 to 2 do\r
- if (ix+iu<255) and (iy+iv<126) then\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(40,54,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
-\r
- //редстоун\r
- for ix:=0 to 255 do\r
- for iy:=107 to 127 do\r
- if (rnd_pr(2,1,0)=1) then\r
- begin\r
- for iu:=0 to 2 do\r
- for iv:=0 to 2 do\r
- if (ix+iu<255) and (iy+iv<126) then\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(40,20,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
-\r
- //железо\r
- for ix:=0 to 255 do\r
- for iy:=63 to 127 do\r
- if (rnd_pr(4,1,0)=1) then\r
- begin\r
- for iu:=0 to 2 do\r
- for iv:=0 to 2 do\r
- if (ix+iu<255) and (iy+iv<126) then\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(40,17,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
-\r
- //уголь\r
- for ix:=0 to 255 do\r
- for iy:=0 to 127 do\r
- if (rnd_pr(6,1,0)=1) then\r
- begin\r
- for iu:=0 to 2 do\r
- for iv:=0 to 2 do\r
- if (ix+iu<255) and (iy+iv<126) then\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(50,18,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
-\r
- //гравий\r
- for ix:=0 to 255 do\r
- for iy:=63 to 126 do\r
- if (rnd_pr(2,1,0)=1) then\r
- begin\r
- for iu:=0 to rnd(5) do\r
- for iv:=0 to rnd(5) do\r
- if (ix+iu<255) and (iy+iv<126) then\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(90,8,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
-\r
- //земля на камне\r
- for ix:=0 to 255 do\r
- for iy:=63 to 127 do\r
- if (rnd_pr(1,1,0)=1) then\r
- begin\r
- for iu:=0 to rnd(5) do\r
- for iv:=0 to rnd(5) do\r
- if (ix+iu<255) and (iy+iv<126) then\r
- if getmap(ix+iu,iy+iv)=3 then setmap(rnd_pr(90,1,getmap(ix+iu,iy+iv)),ix+iu,iy+iv);\r
- ix:=ix+3;\r
- end;\r
+ (* Алмазная руда *)\r
+ GenOreChunks(19, 1, 111, 3);\r
+ (* Золотая руда *)\r
+ GenOreChunks(16, 2, 95, 3);\r
+ (* Лазуритовая руда *)\r
+ GenOreChunks(54, 2, 107, 3);\r
+ (* Красная руда *)\r
+ GenOreChunks(20, 2, 107, 3);\r
+ (* Железная руда *)\r
+ GenOreChunks(17, 3, 63, 3);\r
+ (* Угольная руда *)\r
+ GenOreChunks(18, 4, 0, 6);\r
+ (* Гравий *)\r
+ GenOreChunks(8, 2, 0, 6);\r
+ (* Грязь *)\r
+ GenOreChunks(8, 2, 0, 6);\r
end;\r
\r
procedure dec_0(ix,iy:integer);\r