Sheepluva thought this was worth adding.
authornemo
Tue, 02 Dec 2014 14:26:16 -0500
changeset 10604 f2f9928ea2e7
parent 10603 bda5c7caf396
child 10605 df7a73db2c43
Sheepluva thought this was worth adding.
share/hedgewars/Data/Scripts/Draw.lua
share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.cfg
share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.lua
share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Draw.lua	Tue Dec 02 14:26:16 2014 -0500
@@ -0,0 +1,25 @@
+local PointsBuffer = ''  -- A string to accumulate points in
+
+function AddPoint(x, y, width, erase)
+ PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff))
+ if width then
+     width = bor(width,0x80)
+     if erase then
+         width = bor(width,0x40)
+     end
+     PointsBuffer = PointsBuffer .. string.char(width)
+ else
+     PointsBuffer = PointsBuffer .. string.char(0)
+ end
+ if #PointsBuffer > 245 then
+     ParseCommand('draw '..PointsBuffer)
+     PointsBuffer = ''
+ end
+end
+
+function FlushPoints()
+ if #PointsBuffer > 0 then
+     ParseCommand('draw '..PointsBuffer)
+     PointsBuffer = ''
+ end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.cfg	Tue Dec 02 14:26:16 2014 -0500
@@ -0,0 +1,2 @@
+Default
+Default
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.lua	Tue Dec 02 14:26:16 2014 -0500
@@ -0,0 +1,22 @@
+HedgewarsScriptLoad("/Scripts/Draw.lua")
+
+function onPreviewInit()
+onGameInit()
+end
+
+function onGameInit()
+    MapGen = mgDrawn
+    TemplateFilter = 0
+    for y = 48,2048,200 do
+       for x = 48,4048,200 do
+            if GetRandom(2) == 0 then
+                AddPoint(x,y,1)
+                AddPoint(x+200,y+200)
+            else
+                AddPoint(x,y+200,1)
+                AddPoint(x+200,y)
+            end
+        end
+    end
+    FlushPoints()
+end 
--- a/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua	Tue Dec 02 13:29:06 2014 -0500
+++ b/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua	Tue Dec 02 14:26:16 2014 -0500
@@ -1,32 +1,10 @@
 ObjectList = {}
-PointsBuffer = ''  -- A string to accumulate points in
+
+HedgewarsScriptLoad("/Scripts/Draw.lua")
 
 -- Overall padding for roping freedom
 Padding = 430
 
-function AddPoint(x, y, width, erase)
- PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff))
- if width then
-     width = bor(width,0x80)
-     if erase then
-         width = bor(width,0x40)
-     end
-     PointsBuffer = PointsBuffer .. string.char(width)
- else
-     PointsBuffer = PointsBuffer .. string.char(0)
- end
- if #PointsBuffer > 245 then
-     ParseCommand('draw '..PointsBuffer)
-     PointsBuffer = ''
- end
-end
-function FlushPoints()
- if #PointsBuffer > 0 then
-     ParseCommand('draw '..PointsBuffer)
-     PointsBuffer = ''
- end
-end
-
 -- This could probably use less points and more precision
 -- 700x700 for object space
 function DrawStar(x, y, d, f)