Attached Files |
0001-Improved-draw_circle-LUA-command.patch [^] (2,330 bytes) 2013-04-07 04:22 [Show Content] [Hide Content]From 2eabc4d830221c4027a3663409d2f6fdbbf5e55f Mon Sep 17 00:00:00 2001
From: infiniplex <infiniplex@hotmail.com>
Date: Sat, 6 Apr 2013 20:01:43 -0600
Subject: [PATCH] Improved draw_circle LUA command
---
crawl-ref/source/dat/des/builder/layout.des | 10 ++--------
crawl-ref/source/l_dgnbld.cc | 3 ++-
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/crawl-ref/source/dat/des/builder/layout.des b/crawl-ref/source/dat/des/builder/layout.des
index 12cc8b6..45b7a24 100644
--- a/crawl-ref/source/dat/des/builder/layout.des
+++ b/crawl-ref/source/dat/des/builder/layout.des
@@ -284,12 +284,6 @@ TAGS: overwritable layout no_primary_vault allow_dup unrand
local circle_radius = 2 + crawl.random2(6) + pillar_radius * 2 + num / 2
local fill = crawl.random_element(pillar_fill)
- -- beautification hack: no "circle" pillars of radius 1
- if pfunc == make_circle and pillar_radius == 1 then
- fill = crawl.random_element({"G", "X", "t"})
- kfeat("X = stone_arch")
- end
-
-- Finally, make the pillars
local make_pillar = function(x, y)
return pfunc({
@@ -1093,9 +1087,9 @@ TAGS: overwritable layout allow_dup unrand chance_cocytus
for i = 1, crawl.random_range(40, 60) do
local x = crawl.random_range(map_x_min, map_x_max)
local y = crawl.random_range(map_y_min, map_y_max)
- local radius = crawl.random_range(1, 2)
+ local radius = crawl.random_range(0, 1)
if crawl.one_chance_in(15) then
- radius = crawl.random_range(3, 4)
+ radius = crawl.random_range(2, 4)
end
make_circle ({ x = x, y = y, radius = radius, fill = '.'})
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc
index e0a4150..2d507a6 100644
--- a/crawl-ref/source/l_dgnbld.cc
+++ b/crawl-ref/source/l_dgnbld.cc
@@ -512,9 +512,10 @@ LUAFN(dgn_make_circle)
if (!_valid_coord(ls, lines, x, y))
return 0;
+ float radius_squared_max = (radius + 0.5f) * (radius + 0.5f);
for (int ry = -radius; ry <= radius; ++ry)
for (int rx = -radius; rx <= radius; ++rx)
- if (rx * rx + ry * ry < radius * radius)
+ if (rx * rx + ry * ry < radius_squared_max)
lines(x + rx, y + ry) = fill;
return 0;
--
1.8.1.2
|