author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 13 May 2019 21:26:13 +0200 | |
changeset 14950 | f112847eb93e |
parent 14479 | 99117df5a3d3 |
permissions | -rw-r--r-- |
14479
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
1 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
2 |
local overrideFeatureSize = true |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
3 |
local mazeScale = 0 |
10604 | 4 |
|
5 |
function onPreviewInit() |
|
6 |
onGameInit() |
|
7 |
end |
|
8 |
||
14479
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
9 |
function onParameters() |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
10 |
parseParams() |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
11 |
if params["scalemap"] ~= nil then |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
12 |
overrideFeatureSize = false |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
13 |
end |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
14 |
if params["mazescale"] ~= nil then |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
15 |
mazeScale = tonumber(params["mazescale"]) |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
16 |
end |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
17 |
end |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
18 |
|
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
19 |
|
10604 | 20 |
function onGameInit() |
14479
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
21 |
local step |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
22 |
local width |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
23 |
|
10604 | 24 |
MapGen = mgDrawn |
25 |
TemplateFilter = 0 |
|
14479
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
26 |
|
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
27 |
if mazeScale > 0 then |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
28 |
step = 80 + 10 * mazeScale |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
29 |
width = 1 + div(math.max(0, mazeScale-12), 6) |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
30 |
else |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
31 |
step = 80 + 10 * MapFeatureSize |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
32 |
width = 1 + div(math.max(0, MapFeatureSize-12), 6) |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
33 |
end |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
34 |
-- reset feature size after use, to disable scaling |
99117df5a3d3
fix DiagonalMaze after the drawing scaling change, add some params since ginormous maze is kinda entertaining
nemo
parents:
11064
diff
changeset
|
35 |
if overrideFeatureSize then MapFeatureSize = 12 end |
11064 | 36 |
-- center maze |
37 |
local xoff = div((4000 % step), 2) |
|
11063 | 38 |
for y = 48,2048,step do |
11064 | 39 |
for x = 48+xoff,4048-step,step do |
10604 | 40 |
if GetRandom(2) == 0 then |
11064 | 41 |
AddPoint(x,y,width) |
11063 | 42 |
AddPoint(x+step,y+step) |
10604 | 43 |
else |
11064 | 44 |
AddPoint(x,y+step,width) |
11063 | 45 |
AddPoint(x+step,y) |
10604 | 46 |
end |
47 |
end |
|
48 |
end |
|
49 |
FlushPoints() |
|
50 |
end |