From c21b6d96ba6d5033c7b9024a9616f9512047f787 Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Fri, 30 Jul 2021 23:07:18 -0700 Subject: [PATCH 1/4] Fix map edit layer --- src/mod/elona/api/gui/MapEditLayer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/elona/api/gui/MapEditLayer.lua b/src/mod/elona/api/gui/MapEditLayer.lua index d5516ebc..6be23b5e 100644 --- a/src/mod/elona/api/gui/MapEditLayer.lua +++ b/src/mod/elona/api/gui/MapEditLayer.lua @@ -116,7 +116,7 @@ function MapEditLayer:select_tile(id) self.selected_tile = id self.tile_batch:clear() - local width, height = Draw.get_coords:get_size() + local width, height = Draw.get_coords():get_size() self.tile_batch:add(self.selected_tile, self.width - 80, self.y + 20, width, height) end From 1576dc453a880ab70bff9e1b99296b53cb4098ca Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Wed, 4 Aug 2021 03:16:31 -0700 Subject: [PATCH 2/4] Adjust scrolling speed --- src/ext/table.lua | 10 ++++++++++ src/game/field_layer.lua | 8 ++++---- .../map_editor/api/plugin/MapEditorLayoutPlugin.lua | 1 - 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ext/table.lua b/src/ext/table.lua index 34ad4e57..6b32af4b 100644 --- a/src/ext/table.lua +++ b/src/ext/table.lua @@ -676,3 +676,13 @@ function table.clear(tbl) tbl[k] = nil end end + +function table.reverse(tbl) + local n = #tbl + local i = 1 + while i < n do + tbl[i], tbl[n] = tbl[n], tbl[i] + i = i + 1 + n = n - 1 + end +end diff --git a/src/game/field_layer.lua b/src/game/field_layer.lua index 0f4319f3..6246cc44 100644 --- a/src/game/field_layer.lua +++ b/src/game/field_layer.lua @@ -285,11 +285,11 @@ function field_layer:update_scrolling() if config.base.scroll_type == "classic" then -- >>>>>>>> elona122/shade2/screen.hsp:1224 *screen_scroll ... - local frames = 5 + local frames = 3 if self.scrolling_mode == "fast" then - frames = 3 + frames = 4 -- TODO config option: running speed (?) elseif self.scrolling_mode == "slow" then - frames = 6 + frames = 5 -- TODO config option: walking speed end if self:player_is_running() then frames = 1 @@ -322,7 +322,7 @@ function field_layer:update_scrolling() self.draw_callbacks:update(dt) self.keys:update_repeats(dt) ms = ms + dt - until ms > 33.0 / 1000.0 + until ms > 20.0 / 1000.0 end -- <<<<<<<< elona122/shade2/screen.hsp:1267 return .. else diff --git a/src/mod/map_editor/api/plugin/MapEditorLayoutPlugin.lua b/src/mod/map_editor/api/plugin/MapEditorLayoutPlugin.lua index 10b88e0c..d710fe48 100644 --- a/src/mod/map_editor/api/plugin/MapEditorLayoutPlugin.lua +++ b/src/mod/map_editor/api/plugin/MapEditorLayoutPlugin.lua @@ -12,7 +12,6 @@ local UiMouseMenuButton = require("mod.mouse_ui.api.gui.UiMouseMenuButton") local MapEditorLayoutPlugin = class.class("MapEditorLayoutPlugin", IMapEditorPlugin) function MapEditorLayoutPlugin:init() - self.target_floor = 20 end function MapEditorLayoutPlugin:on_install(map_editor) From 32e5fe578533364c14891af903b6cf2bd5170b35 Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Wed, 25 Aug 2021 00:59:23 -0700 Subject: [PATCH 3/4] Refactor EX help prompt --- src/mod/elona/api/ExHelp.lua | 9 ++++++++- src/mod/elona/api/gui/ExHelpPrompt.lua | 6 +----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mod/elona/api/ExHelp.lua b/src/mod/elona/api/ExHelp.lua index 09a26902..85adf451 100755 --- a/src/mod/elona/api/ExHelp.lua +++ b/src/mod/elona/api/ExHelp.lua @@ -1,6 +1,7 @@ local Chara = require("api.Chara") local ExHelpPrompt = require("mod.elona.api.gui.ExHelpPrompt") local Gui = require("api.Gui") +local I18N = require("api.I18N") local ExHelp = {} @@ -16,13 +17,19 @@ function ExHelp.show(id, force) return end + local text = I18N.get_optional(("elona.ex_help._.%s"):format(id)) + if not text then + Log.error("missing help text for %s", id) + return + end + local player = Chara.player() if not Chara.is_alive(player) or (player:has_activity() and not player:has_activity("elona.traveling")) then return end Gui.update_screen() - ExHelpPrompt:new(id):query() + ExHelpPrompt:new(text):query() save.elona.ex_help_shown[id] = true -- <<<<<<<< shade2/init.hsp:4272 #define global help(%%1,%%2=0) if cfg_extraHelp@:if .. end diff --git a/src/mod/elona/api/gui/ExHelpPrompt.lua b/src/mod/elona/api/gui/ExHelpPrompt.lua index e1f21d3f..a57dc6d5 100644 --- a/src/mod/elona/api/gui/ExHelpPrompt.lua +++ b/src/mod/elona/api/gui/ExHelpPrompt.lua @@ -29,11 +29,7 @@ local function split(str, delimiter) return result end -function ExHelpPrompt:init(help_id) - data["elona.ex_help"]:ensure(help_id) - - local text = assert(I18N.get_optional(("elona.ex_help._.%s"):format(help_id)), "missing help text for " .. help_id) - +function ExHelpPrompt:init(text) self.sections = split(text, "\n\n") if #self.sections == 0 then error("No sections found.") From 817469ec86f42868bb1dbe99fc97eb59d4387d46 Mon Sep 17 00:00:00 2001 From: Ruin0x11 Date: Wed, 25 Aug 2021 01:16:11 -0700 Subject: [PATCH 4/4] Don't draw icon bar if inventory menu is hidden --- src/api/gui/menu/InventoryMenu.lua | 7 +++++-- src/api/gui/menu/InventoryWrapper.lua | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/gui/menu/InventoryMenu.lua b/src/api/gui/menu/InventoryMenu.lua index 322bf9e4..b99f3832 100644 --- a/src/api/gui/menu/InventoryMenu.lua +++ b/src/api/gui/menu/InventoryMenu.lua @@ -86,7 +86,6 @@ function InventoryMenu:init(ctxt, returns_item) self.cargo_weight = 0 self.detail_view = nil self.subtext_column = self.ctxt.proto.window_detail_header or "ui.inv.window.weight" - self.is_drawing = true self.total_weight_text = "" self.text_equip_slots = {} self.play_sound = false @@ -458,8 +457,12 @@ function InventoryMenu:update_filtering(play_sound) end end +function InventoryMenu:is_menu_visible() + return self.ctxt:is_menu_visible() +end + function InventoryMenu:draw() - if not self.ctxt:is_menu_visible() then + if not self:is_menu_visible() then return end diff --git a/src/api/gui/menu/InventoryWrapper.lua b/src/api/gui/menu/InventoryWrapper.lua index e9599630..9f210324 100644 --- a/src/api/gui/menu/InventoryWrapper.lua +++ b/src/api/gui/menu/InventoryWrapper.lua @@ -179,7 +179,7 @@ function InventoryWrapper:relayout(x, y, width, height) end function InventoryWrapper:draw() - if not self.submenu.is_drawing then + if not self.submenu:is_menu_visible() then return end Draw.set_color(255, 255, 255)