equal
deleted
inserted
replaced
1 |
|
2 -- taken from http://code.google.com/p/hedgewars/wiki/LuaDrawing |
|
3 PointsBuffer = '' -- A string to accumulate points in |
|
4 function AddPoint(x, y, width, erase) |
|
5 PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) |
|
6 if width then |
|
7 width = bor(width,0x80) |
|
8 if erase then |
|
9 width = bor(width,0x40) |
|
10 end |
|
11 PointsBuffer = PointsBuffer .. string.char(width) |
|
12 else |
|
13 PointsBuffer = PointsBuffer .. string.char(0) |
|
14 end |
|
15 if #PointsBuffer > 245 then |
|
16 ParseCommand('draw '..PointsBuffer) |
|
17 PointsBuffer = '' |
|
18 end |
|
19 end |
|
20 function FlushPoints() |
|
21 if #PointsBuffer > 0 then |
|
22 ParseCommand('draw '..PointsBuffer) |
|
23 PointsBuffer = '' |
|
24 end |
|
25 end |
|
26 |
|
27 |
1 |
28 local ta_pointsize = 63 |
2 local ta_pointsize = 63 |
29 local ta_radius = (ta_pointsize * 10 + 6) / 2 |
3 local ta_radius = (ta_pointsize * 10 + 6) / 2 |
30 |
4 |
31 local sqrttwo = math.sqrt(2) |
5 local sqrttwo = math.sqrt(2) |
82 |
56 |
83 -- No damage please |
57 -- No damage please |
84 DamagePercent = 1 |
58 DamagePercent = 1 |
85 |
59 |
86 -- Draw Map |
60 -- Draw Map |
87 AddPoint(10,30,0) -- hog spawn platform |
61 -- AddPoint(10,30,0) -- hog spawn platform |
88 -- test areas |
62 -- test areas |
89 AddTestArea(taa_v1) |
63 AddTestArea(taa_v1) |
90 AddTestArea(taa_v2) |
64 AddTestArea(taa_v2) |
91 AddTestArea(taa_h1) |
65 AddTestArea(taa_h1) |
92 AddTestArea(taa_h2) |
66 AddTestArea(taa_h2) |