git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7663 c06c8d41-db1a-0410-9941-cceddc491573
FG7PALO63I4PMK3AFWUOXQX3WM5ECQHYGFGSM2FRSKZNUYBYVDIAC QUBF42IFKP3BUZWT4I4VKFCOK43GAADT7A2FNNFZQZ7YBZDY2ZWAC GLDM7OPM3D2DFU5QFKOSZY36EWJJJEV6CH6GPQLDZO35X7CWAIRQC NKONHW4JNY6HP2M63MNPM3H64ZWSUNUT5FX2STW4KTS4AMXJXXVQC NCKCO6W5HW7C6OPJG4EVHKQCDX6AL7S4ACORY45STKQTNPMAJ7IQC X7MFMKQTNZ2IWBFVGS6WQV7NRNKJ3DWQAW2X7IQMFQQXW24AHPZQC Y4WCLUMXXAYCZK4QMOEFK6JACNGO7RDASZ2GZWBYLJFQVWGFJE4QC IHV7JHD4E67NEGLZEO3FPQGJPJF3IAV6QV5A63FPG4SU2VRFV47QC 66PPHRP2IW7VAVENBJ4KRO6MEF2HKYZHO4RWCISXC2ZXM6CK2XEAC CPBVQFT7NWEYLYD34D5VYZIEOZ32YADXYTSFMS635YNXX4OFIZVAC MT3256427VMCV4JUFWCN7ULY4KXSND5ZL5THDKYNWWYOXXR5DLIQC local function rectangle_dimensions()local area = map_area()local cx, cy = dgn.GXM / 2, dgn.GYM / 2local function rectangle_eccentricity()-- exc is the local eccentricity for the two rectangles-- exc grows with depth as 0-1, 1, 1-2, 2, 2-3 ...local exc = math.floor(zig().depth / 2)if ((zig().depth-1) % 2) == 0 and crawl.coinflip() thenexc = exc + 1endreturn excend
local exc = rectangle_eccentricity()local b = math.floor(math.sqrt(area+4*exc*exc))local a = b-2*exclocal a2 = math.floor(a / 2) + (a % 2)local b2 = math.floor(b / 2) + (b % 2)local x1, y1 = clamp_in_bounds(cx - a2, cy - b2)local x2, y2 = clamp_in_bounds(cx + a2, cy + b2)return x1, y1, x2, y2end
local function flip_rectangle(x1, y1, x2, y2)local cx = math.floor((x1 + x2) / 2)local cy = math.floor((y1 + y2) / 2)local nx1, ny1 = clamp_in_bounds(cx + y1 - cy, cy + x1 - cx)local nx2, ny2 = clamp_in_bounds(cx + y2 - cy, cy + x2 - cx)return { nx1, ny1, nx2, ny2 }end
local x1, y1, x2, y2 = rectangle_dimensions()
-- exc is the local eccentricity for the two rectangles-- exc grows with depth as 0-1, 1, 1-2, 2, 2-3 ...local exc = math.floor(zig().depth / 2)if ((zig().depth-1) % 2) == 0 and crawl.coinflip() thenexc = exc + 1endlocal a = math.floor(math.sqrt(area+4*exc*exc))local b = a - 2*exclocal a2 = math.floor(a / 2) + (a % 2)local b2 = math.floor(b / 2) + (b % 2)local x1, y1 = clamp_in_bounds(cx - a2, cy - b2)local x2, y2 = clamp_in_bounds(cx + a2, cy + b2)
dgn.fill_area(unpack( util.catlist(flip_rectangle(x1, y1, x2, y2),{ "floor" }) ) )
local zig_exc = zig().zig_exclocal nx1 = cx + y1 - cylocal ny1 = cy + x1 - cx + math.floor(zig().depth/2*(200-zig_exc)/300)local nx2 = cx + y2 - cylocal ny2 = cy + x2 - cx - math.floor(zig().depth/2*(200-zig_exc)/300)nx1, ny1 = clamp_in_bounds(nx1, ny1)nx2, ny2 = clamp_in_bounds(nx2, ny2)dgn.fill_area(nx1, ny1, nx2, ny2, "floor")