diff --git a/game/engines/default/engine/BSP.lua b/game/engines/default/engine/BSP.lua index 8d70ce689cde8fecaa77425811a9b945c2a1f8d4..26aab303f91419abada6b1278408b5d7c63b8ef2 100644 --- a/game/engines/default/engine/BSP.lua +++ b/game/engines/default/engine/BSP.lua @@ -27,6 +27,7 @@ function _M:init(w, h, min_w, min_h, max_depth) self.max_depth = max_depth or 8 self.min_w, self.min_h = min_w, min_h self.node_id = 1 + self.splits = { vert={}, hor={} } self.leafs = {} self.bsp = {x=0, y=0, rx=0, ry=0, w=w, h=h, nodes={}, id=0, depth=0} print("[BSP] ", w, h) @@ -52,6 +53,7 @@ function _M:partition(store) -- print("[BSP] vertical split", s) store.nodes[1] = {depth=store.depth+1, x=0, y=0, rx=store.rx, ry=store.ry, w=store.w, h=s, nodes={}, id=self.node_id} self.node_id = self.node_id + 1 store.nodes[2] = {depth=store.depth+1, x=0, y=s, rx=store.rx, ry=store.ry + s, w=store.w, h=store.h - s, nodes={}, id=self.node_id} self.node_id = self.node_id + 1 + self.splits.vert[store.ry + s] = true self:partition(store.nodes[1]) self:partition(store.nodes[2]) @@ -60,6 +62,7 @@ function _M:partition(store) -- print("[BSP] horizontal split", s) store.nodes[1] = {depth=store.depth+1, x=0, y=0, rx=store.rx, ry=store.ry, w=s, h=store.h, nodes={}, id=self.node_id} self.node_id = self.node_id + 1 store.nodes[2] = {depth=store.depth+1, x=s, y=0, rx=store.rx + s, ry=store.ry, w=store.w -s , h=store.h, nodes={}, id=self.node_id} self.node_id = self.node_id + 1 + self.splits.hor[store.rx + s] = true self:partition(store.nodes[1]) self:partition(store.nodes[2]) end diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 9311a5e4035bb1a46de4df9f2d8ab0d13786d9be..5584be2605ebb8b02bd4a2607bc70dcca54d9577 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -937,7 +937,7 @@ function _M:setupCommands() -- self.state:debugRandomZone() -- local m = game.zone:makeEntity(game.level, "actor", {random_boss=true}, nil, true) -- if m then game.zone:addEntity(game.level, m, "actor", game.player.x, game.player.y + 1) end - self:registerDialog(require("mod.dialogs.Donation").new()) + self:changeLevel(1, "test") end end, } diff --git a/game/modules/tome/data/zones/test/zone.lua b/game/modules/tome/data/zones/test/zone.lua index ce251ea338a7bd0c9827133ccdb28450adc20495..ce8b0749210b038a4ed2c4db1dcd2f4848093eee 100644 --- a/game/modules/tome/data/zones/test/zone.lua +++ b/game/modules/tome/data/zones/test/zone.lua @@ -28,17 +28,17 @@ return { all_remembered = true, all_lited = true, -- persistent = "zone", + no_level_connectivity = true, generator = { map = { - class = "engine.generator.map.Octopus", - main_radius = {0.3, 0.4}, - arms_radius = {0.1, 0.2}, - arms_range = {0.7, 0.8}, - nb_rooms = {5, 9}, - ['.'] = "FLOOR", - ['#'] = "WALL", - up = "FLOOR", - down = "FLOOR", + class = "engine.generator.map.Building", + max_building_w = 5, max_building_h = 5, + floor = "FLOOR", + external_floor = "FLOOR", + wall = "WALL", + up = "FLAT_UP6", + down = "FLAT_DOWN4", + door = "DOOR", }, actor = { class = "engine.generator.actor.Random", diff --git a/game/modules/tome/dialogs/LorePopup.lua b/game/modules/tome/dialogs/LorePopup.lua index 2a4a11d76d8662f5658ef3c25780f4e5394eaefa..d7d5c1c6518b8e1280ba64bff7643070bc364727 100644 --- a/game/modules/tome/dialogs/LorePopup.lua +++ b/game/modules/tome/dialogs/LorePopup.lua @@ -49,11 +49,13 @@ function _M:init(l, w, force_height) end local h = math.min(force_height and (force_height * game.h) or 999999999, self.font_h * #list) + local c_text = require("engine.ui.Textzone").new{ + width=w+10, height=h, scrollbar=(h < self.font_h * #list) and true or false, text=text, color={r=0x3a, g=0x35, b=0x33}, + } + c_text:setTextShadow(false) + self:loadUI{ - {left = 3, top = 3, ui=require("engine.ui.Textzone").new{ - width=w+10, height=h, scrollbar=(h < self.font_h * #list) and true or false, text=text, color={r=0x3a, g=0x35, b=0x33}, - } - } + {left = 3, top = 3, ui=c_text} } self.key:addBind("EXIT", function() game:unregisterDialog(self) if fct then fct() end end) self.key:addBind("ACCEPT", function() game:unregisterDialog(self) if fct then fct() end end)