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
authornemo
Mon, 22 Oct 2012 22:30:03 -0400
changeset 7791 b937274608ba
parent 7790 040fc517fece
child 7792 5e7bdcc8cff3
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
share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
share/hedgewars/Data/Scripts/Multiplayer/Tunnels.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Mon Oct 22 23:35:12 2012 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Mon Oct 22 22:30:03 2012 -0400
@@ -175,9 +175,9 @@
 
 end
 
-function onNewTurn()
+--function onNewTurn()
 --
-end
+--end
 
 
 function onGameTick20()
--- a/share/hedgewars/Data/Scripts/Multiplayer/Tunnels.lua	Mon Oct 22 23:35:12 2012 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Tunnels.lua	Mon Oct 22 22:30:03 2012 -0400
@@ -31,44 +31,48 @@
         AddPoint(4000,i)
     end
 
-        side = 0
-    for i = 0,GetRandom(15)+30 do
-        size = GetRandom(15)+3
+    side = 0
+    for i = 0,GetRandom(15)+25 do
+        if side > 3 then 
+            size = GetRandom(4)+4
+        else
+            size = GetRandom(12)+4
+        end
         --side = GetRandom(4)
         dx = div(size,4)
         maxshift = dx
         dy = dx
         if side == 0 then
             x = 0
-            y = GetRandom(2048)
+            y = GetRandom(2048-size*4)+size*2
             dy = 0
         elseif side == 1 then
-            x = GetRandom(4096)
+            x = GetRandom(4096-size*4)+size*2
             y = 0
             dx = 0
         elseif side == 2 then
             x = 4096
-            y = GetRandom(2048)
+            y = GetRandom(2048-size*4)+size*2
             dx = -dx
             dy = 0
         elseif side == 3 then
-            x = GetRandom(4096)
+            x = GetRandom(4096-size*4)+size*2
             y = 2048
             dx = 0
             dy = -dy
-        elseif side == 4 then
+        elseif side > 3 then
             x = GetRandom(2500)+500
             y = GetRandom(1250)+250
             dx = GetRandom(maxshift*2)-maxshift
             dy = GetRandom(maxshift*2)-maxshift
         end
-        length = GetRandom(500)+500
+        length = GetRandom(500-size*25)+600
         while (length > 0) and (x > -300) and (y > -300) and (x < 4400) and (y < 2400) do
             length = length - 1
             AddPoint(x,y,size,true)
             x = x + dx
             y = y + dy
-            if GetRandom(4) == 0 then
+            if GetRandom(8) == 0 then
                 shift = GetRandom(10)-5
                 if (shift > 0) and (dx < maxshift) then
                     dx = dx + shift
@@ -83,7 +87,7 @@
                 end
             end
         end
-        if side < 5 then
+        if side < 6 then
             side = side + 1
         else 
             side = 0