author | nemo |
Wed, 21 Nov 2018 15:41:43 -0500 | |
changeset 14287 | 9b5a8147386f |
parent 13215 | bc95df84395f |
child 14571 | 8b66de6c9fb0 |
permissions | -rw-r--r-- |
13215 | 1 |
HedgewarsScriptLoad("/Scripts/Utils.lua") |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
2 |
|
10153 | 3 |
function onPreviewInit() |
13215 | 4 |
onGameInit() |
10153 | 5 |
end |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
6 |
|
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
7 |
function onGameInit() |
10423 | 8 |
MapGen = mgDrawn |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
9 |
TemplateFilter = 0 |
13215 | 10 |
fillMap(false) |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
11 |
side = 0 |
11065 | 12 |
for i = 0,1+MapFeatureSize*2 do |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
13 |
if side > 3 then |
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
14 |
size = GetRandom(4)+4 |
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
15 |
else |
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
16 |
size = GetRandom(12)+4 |
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
17 |
end |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
18 |
--side = GetRandom(4) |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
19 |
dx = div(size,4) |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
20 |
maxshift = dx |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
21 |
dy = dx |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
22 |
if side == 0 then |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
23 |
x = 0 |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
24 |
y = GetRandom(2048-size*4)+size*2 |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
25 |
dy = 0 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
26 |
elseif side == 1 then |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
27 |
x = GetRandom(4096-size*4)+size*2 |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
28 |
y = 0 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
29 |
dx = 0 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
30 |
elseif side == 2 then |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
31 |
x = 4096 |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
32 |
y = GetRandom(2048-size*4)+size*2 |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
33 |
dx = -dx |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
34 |
dy = 0 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
35 |
elseif side == 3 then |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
36 |
x = GetRandom(4096-size*4)+size*2 |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
37 |
y = 2048 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
38 |
dx = 0 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
39 |
dy = -dy |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
40 |
elseif side > 3 then |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
41 |
x = GetRandom(2500)+500 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
42 |
y = GetRandom(1250)+250 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
43 |
dx = GetRandom(maxshift*2)-maxshift |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
44 |
dy = GetRandom(maxshift*2)-maxshift |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
45 |
end |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
46 |
length = GetRandom(500-size*25)+600 |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
47 |
while (length > 0) and (x > -300) and (y > -300) and (x < 4400) and (y < 2400) do |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
48 |
length = length - 1 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
49 |
AddPoint(x,y,size,true) |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
50 |
x = x + dx |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
51 |
y = y + dy |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
52 |
if GetRandom(8) == 0 then |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
53 |
shift = GetRandom(10)-5 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
54 |
if (shift > 0) and (dx < maxshift) then |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
55 |
dx = dx + shift |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
56 |
elseif (shift < 0) and (dx > -maxshift) then |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
57 |
dx = dx + shift |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
58 |
end |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
59 |
shift = GetRandom(10)-5 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
60 |
if (shift > 0) and (dy < maxshift) then |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
61 |
dy = dy + shift |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
62 |
elseif (shift < 0) and (dy > -maxshift) then |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
63 |
dy = dy + shift |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
64 |
end |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
65 |
end |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
66 |
end |
7791
b937274608ba
Completely arbitrary tweaking of tunnel values (avoids a nil) - still needs smooth curves (probably a target dx/dy to aim for, and slow alterations) and taking less CPU. Also disable unused function in Highlander
nemo
parents:
7785
diff
changeset
|
67 |
if side < 6 then |
7785
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
68 |
side = side + 1 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
69 |
else |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
70 |
side = 0 |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
71 |
end |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
72 |
end |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
73 |
|
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
74 |
FlushPoints() |
9b5dceaea976
Someone should look this over to make sure it should stay in
nemo
parents:
diff
changeset
|
75 |
end |