Skip to content

Commit

Permalink
Merge pull request #359 from Ruin0x11/fix/walking-speed
Browse files Browse the repository at this point in the history
Random fixes
  • Loading branch information
Ruin0x11 committed Sep 12, 2021
2 parents 5a0aba1 + 817469e commit 89470e0
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 15 deletions.
7 changes: 5 additions & 2 deletions src/api/gui/menu/InventoryMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/api/gui/menu/InventoryWrapper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/ext/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions src/game/field_layer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion src/mod/elona/api/ExHelp.lua
Original file line number Diff line number Diff line change
@@ -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 = {}

Expand All @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/mod/elona/api/gui/ExHelpPrompt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion src/mod/elona/api/gui/MapEditLayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion src/mod/map_editor/api/plugin/MapEditorLayoutPlugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 89470e0

Please sign in to comment.