share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua
changeset 13283 7476c1a50738
parent 11487 b053f1fb631d
child 13284 9ac674499985
equal deleted inserted replaced
13282:c15af5a5f458 13283:7476c1a50738
    21         SetTag(gear,1)
    21         SetTag(gear,1)
    22         SetGearValues(gear,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,GetClanColor(GetHogClan(CurrentHedgehog)))
    22         SetGearValues(gear,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,GetClanColor(GetHogClan(CurrentHedgehog)))
    23     end
    23     end
    24 end
    24 end
    25 
    25 
    26 
       
    27 -- This could probably use less points and more precision
    26 -- This could probably use less points and more precision
    28 -- 700x700 for object space
    27 -- 700x700 for object space
    29 function DrawStar(x, y, d, f)
    28 function DrawStar(x, y, d, f)
    30 -- default scale is 700x700 or so
    29     -- default scale is 700x700 or so
    31     local s = 700
    30     local s = 700
    32     local i = 0
    31     local i = 0
    33     local j = 0
    32     local j = 0
    34     if not(d == 1) then s = div(s,d) end
    33     if not(d == 1) then s = div(s,d) end
    35     if NoOverlap(x,y,s,s) then
    34     if NoOverlap(x,y,s,s) then
   315     while i<=l do
   314     while i<=l do
   316         ox = ObjectList[i][1]
   315         ox = ObjectList[i][1]
   317         oy = ObjectList[i][2]
   316         oy = ObjectList[i][2]
   318         ox2 = ObjectList[i][3]
   317         ox2 = ObjectList[i][3]
   319         oy2 = ObjectList[i][4]
   318         oy2 = ObjectList[i][4]
   320          --   WriteLnToConsole(ox..' '..oy..' '..ox2..' '..oy2..' - '..x..' '..y..' '..x2..' '..y2)
       
   321         --if (math.abs(ox + ox2 -x - x2) <= (ox2 - ox + x2 - x)) and (math.abs(oy + oy2 - y - y2) <= (oy - oy2 + y - y2)) then
       
   322         if x < ox2 and ox < x2 and y < oy2 and oy < y2 then
   319         if x < ox2 and ox < x2 and y < oy2 and oy < y2 then
   323             return false
   320             return false
   324         end
   321         end
   325         i=i+1
   322         i=i+1
   326     end
   323     end
   327     return true
   324     return true
   328 end
   325 end
   329 
   326 
   330 function dbg()
       
   331     local i = 1
       
   332     local l = table.getn(ObjectList)
       
   333     local ox = 0
       
   334     local oy = 0
       
   335     local ox2 = 0
       
   336     local oy2 = 0
       
   337     while i<=l do
       
   338         ox = ObjectList[i][1]
       
   339         oy = ObjectList[i][2]
       
   340         ox2 = ObjectList[i][3]
       
   341         oy2 = ObjectList[i][4]
       
   342         AddPoint(ox,oy,1)
       
   343         AddPoint(ox2,oy)
       
   344         AddPoint(ox2,oy2)
       
   345         AddPoint(ox,oy2)
       
   346         AddPoint(ox,oy)
       
   347         AddPoint(ox2,oy2)
       
   348         i=i+1
       
   349     end
       
   350 end
       
   351 
       
   352 function onPreviewInit()
   327 function onPreviewInit()
   353 onGameInit()
   328     onGameInit()
   354 end
   329 end
   355 
   330 
   356 function onGameInit()
   331 function onGameInit()
   357     MapGen = mgDrawn
   332     MapGen = mgDrawn
   358     TemplateFilter = 0
   333     TemplateFilter = 0
   453         if DrawCrescent(x,y,w,GetRandom(2)==0) then
   428         if DrawCrescent(x,y,w,GetRandom(2)==0) then
   454             TotGen = TotGen+1
   429             TotGen = TotGen+1
   455         end
   430         end
   456         Tries = Tries + 1
   431         Tries = Tries + 1
   457     end
   432     end
   458 --    Padding = div(Padding,2)
       
   459 --    Tries = 0
       
   460 --    while (TotGen < 21) and (Tries < 10000) do
       
   461 --        r = GetRandom(20-div(Tries,223))+5
       
   462 --        x = GetRandom(4050-r*20)+r*10
       
   463 --        y = GetRandom(2000-r*20)+r*10
       
   464 --        if DrawCircle(x,y,r) then
       
   465 --            TotGen = TotGen+1
       
   466 --        end
       
   467 --        Tries = Tries + 1
       
   468 --    end
       
   469     --dbg()
       
   470     FlushPoints()
   433     FlushPoints()
   471 end 
   434 end