Commit 9794b6c0b62ed4f34b0bc0338677cbda08abe678
1 parent
2df0c37f
Upscaled the size of many lore pictures
Showing
28 changed files
with
65 additions
and
11 deletions
... | ... | @@ -165,6 +165,13 @@ function _M:makeFrame(base, w, h, iw, ih) |
165 | 165 | f.b5 = self:getUITexture(base.."5.png") |
166 | 166 | if not w then w = iw + f.b4.w + f.b6.w end |
167 | 167 | if not h then h = ih + f.b8.h + f.b2.h end |
168 | + if self.ui_conf[self.ui].specifics and self.ui_conf[self.ui].specifics[base] then | |
169 | + local conf = self.ui_conf[self.ui].specifics[base] | |
170 | + w = w + (conf.offset_w or 0) | |
171 | + h = h + (conf.offset_h or 0) | |
172 | + f.ox = conf.offset_x or 0 | |
173 | + f.oy = conf.offset_y or 0 | |
174 | + end | |
168 | 175 | end |
169 | 176 | f.w = math.floor(w) |
170 | 177 | f.h = math.floor(h) |
... | ... | @@ -179,8 +186,8 @@ function _M:drawFrame(f, x, y, r, g, b, a, w, h, total_w, total_h, loffset_x, lo |
179 | 186 | total_w = total_w or 0 |
180 | 187 | total_h = total_h or 0 |
181 | 188 | |
182 | - x = math.floor(x) | |
183 | - y = math.floor(y) | |
189 | + x = math.floor(x) + (f.ox or 0) | |
190 | + y = math.floor(y) + (f.oy or 0) | |
184 | 191 | |
185 | 192 | f.w = math.floor(w or f.w) |
186 | 193 | f.h = math.floor(h or f.h) | ... | ... |
... | ... | @@ -602,10 +602,16 @@ function _M:setupUI(resizex, resizey, on_resize, addmw, addmh) |
602 | 602 | mw = mw + self.frame.ox1 - self.frame.ox2 |
603 | 603 | end |
604 | 604 | |
605 | - if on_resize then on_resize(resizex and mw or self.w, resizey and mh or self.h) end | |
605 | + if on_resize then | |
606 | + local rw, rh = on_resize(resizex and mw or self.w, resizey and mh or self.h) | |
607 | + if rw and rh then resizex, resizey = true, true mw, mh = rw, rh end | |
608 | + end | |
606 | 609 | nw, nh = resizex and mw or self.w, resizey and mh or self.h |
607 | 610 | else |
608 | - if on_resize then on_resize(self.w, self.h) end | |
611 | + if on_resize then | |
612 | + local rw, rh = on_resize(self.w, self.h) | |
613 | + if rw and rh then self.w, self.h = rw, rh end | |
614 | + end | |
609 | 615 | nw, nh = self.w, self.h |
610 | 616 | end |
611 | 617 | ... | ... |
... | ... | @@ -2087,6 +2087,7 @@ function _M:setupCommands() |
2087 | 2087 | print("===============") |
2088 | 2088 | end end, |
2089 | 2089 | [{"_g","ctrl"}] = function() if config.settings.cheat then |
2090 | + package.loaded["engine.ui.Textzone"] = nil | |
2090 | 2091 | package.loaded["engine.ui.Dialog"] = nil |
2091 | 2092 | package.loaded["engine.dialogs.Chat"] = nil |
2092 | 2093 | package.loaded["mod.dialogs.Chat"] = nil | ... | ... |
... | ... | @@ -109,6 +109,7 @@ function _M:relearningLore(v) |
109 | 109 | end |
110 | 110 | |
111 | 111 | function _M:learnLore(lore, nopopup, silent, nostop, after_learn_cb) |
112 | + print("[LORE] learning..", lore) | |
112 | 113 | local l = self:getLore(lore, silent) |
113 | 114 | if not l then return end |
114 | 115 | local learnt = false | ... | ... |
... | ... | @@ -20,10 +20,16 @@ |
20 | 20 | chat = { |
21 | 21 | frame_alpha = 1, |
22 | 22 | frame_darkness = 0.6, |
23 | - frame_ox1 = -64, | |
24 | - frame_ox2 = 64, | |
23 | + frame_ox1 = -14, | |
24 | + frame_ox2 = 14, | |
25 | 25 | frame_oy1 = -5, |
26 | 26 | frame_oy2 = 10, |
27 | 27 | -- force_min_w = 64 * 4, |
28 | 28 | -- force_min_h = 64 * 4, |
29 | + specifics = { | |
30 | + ["ui/textbox"] = { | |
31 | + offset_w = -(64 - 30) * 2, | |
32 | + offset_x = 64 - 30, | |
33 | + }, | |
34 | + }, | |
29 | 35 | } | ... | ... |
... | ... | @@ -37,24 +37,36 @@ function _M:init(chat, id, width) |
37 | 37 | end |
38 | 38 | |
39 | 39 | function _M:makeUI() |
40 | - self.c_desc = Textzone.new{has_box=true, ui="chat", font=self.chat.dialog_text_font, width=self.iw, height=1, auto_height=true, text=self.text, can_focus=false} | |
40 | + self.c_desc = Textzone.new{has_box=true, ui="chat", font=self.chat.dialog_text_font, width=self.iw - 30, height=1, auto_height=true, text=self.text, can_focus=false} | |
41 | 41 | self.c_list = VariableList.new{font=self.chat.dialog_answer_font, width=self.iw, max_height=game.h * 0.70 - self.c_desc.h, list=self.list, fct=function(item) self:use(item) end, select=function(item) self:select(item) end} |
42 | - local npc_frame = ChatPortrait.new{ui="chat", actor=self:getActorPortrait(self.chat.npc_force_display_entity or self.npc.chat_display_entity or self.npc)} | |
43 | - local player_frame = ChatPortrait.new{ui="chat", actor=self:getActorPortrait(self.chat.player_force_display_entity or self.player.chat_display_entity or self.player)} | |
42 | + local npc_frame = ChatPortrait.new{ui="chat", side="right", actor=self:getActorPortrait(self.chat.npc_force_display_entity or self.npc.chat_display_entity or self.npc)} | |
43 | + local player_frame = ChatPortrait.new{ui="chat", side="left", actor=self:getActorPortrait(self.chat.player_force_display_entity or self.player.chat_display_entity or self.player)} | |
44 | 44 | |
45 | 45 | local uis = { |
46 | 46 | {hcenter=0, top=-12, ui=self.c_desc}, |
47 | 47 | {right=0, bottom=0, ui=self.c_list}, |
48 | - {left=-player_frame.w+self.frame.ox1-5, vcenter=-self.ix-4, ui=player_frame, ignore_size=true}, | |
49 | - {right=-npc_frame.w-self.frame.ox2-5, vcenter=-self.ix-4, ui=npc_frame, ignore_size=true}, | |
48 | + {left=-player_frame.w+self.frame.ox1-5, top=self.frame.oy1-self.iy, ui=player_frame, ignore_size=true}, | |
49 | + {right=-npc_frame.w-self.frame.ox2-5, top=self.frame.oy1-self.iy, ui=npc_frame, ignore_size=true}, | |
50 | 50 | } |
51 | 51 | |
52 | + -- Only for size info | |
53 | + local back = self:getUITexture("ui/portrait_frame_back.png") | |
54 | + local deco_down = self:getUITexture("ui/chat_ui_deco_padding_left_down.png") | |
55 | + | |
52 | 56 | self:loadUI(uis) |
53 | 57 | self:setFocus(self.c_list) |
54 | 58 | self:setupUI(false, true, function(w, h) |
59 | + local frameh = -self.frame.oy1 + self.frame.oy2 | |
60 | + -- Ensure minimal height | |
61 | + if h + frameh < back.h then h = back.h - frameh end | |
62 | + -- Ensure if it's too big but too small to not have the down deco, to increase it a it | |
63 | + if h + frameh > back.h and h + frameh < back.h + deco_down.h / 2 then h = back.h - frameh + deco_down.h / 2 end | |
55 | 64 | self.force_x = game.w / 2 - w / 2 |
56 | 65 | self.force_y = game.h - h - 20 |
66 | + return w, h | |
57 | 67 | end) |
68 | + npc_frame:adjustHeight(self.h) | |
69 | + player_frame:adjustHeight(self.h) | |
58 | 70 | end |
59 | 71 | |
60 | 72 | function _M:getActorPortrait(actor) | ... | ... |
... | ... | @@ -27,6 +27,7 @@ local ActorFrame = require "engine.ui.ActorFrame" |
27 | 27 | module(..., package.seeall, class.inherit(Base)) |
28 | 28 | |
29 | 29 | function _M:init(t) |
30 | + self.side = assert(t.side, "no ChatPortrait side") | |
30 | 31 | assert(t.actor, "no ChatPortrait actor") |
31 | 32 | |
32 | 33 | self.name = t.actor.getName and t.actor:getName() or _t(t.actor.name) or _t"???" |
... | ... | @@ -52,6 +53,7 @@ function _M:init(t) |
52 | 53 | self.iy = 0 |
53 | 54 | self.iw, self.ih = 128, 128 |
54 | 55 | end |
56 | + self.h_deco = 0 | |
55 | 57 | |
56 | 58 | Base.init(self, t) |
57 | 59 | end |
... | ... | @@ -62,6 +64,8 @@ function _M:generate() |
62 | 64 | |
63 | 65 | self.front = self:getUITexture("ui/portrait_frame_front.png") |
64 | 66 | self.back = self:getUITexture("ui/portrait_frame_back.png") |
67 | + self.deco_down = self:getUITexture("ui/chat_ui_deco_padding_"..self.side.."_down.png") | |
68 | + self.deco_up = self:getUITexture("ui/chat_ui_deco_padding_"..self.side.."_up.png") | |
65 | 69 | self.w, self.h = self.front.w, self.front.h |
66 | 70 | |
67 | 71 | if self.image then self.item = {self.image:glTexture(false, true)} end |
... | ... | @@ -69,7 +73,24 @@ function _M:generate() |
69 | 73 | self.name_tex = self:drawFontLine(self.font, self.name, nil, 0xff, 0xee, 0xcb) |
70 | 74 | end |
71 | 75 | |
76 | +function _M:adjustHeight(h) | |
77 | + self.h_deco = h - self.back.h | |
78 | +end | |
79 | + | |
72 | 80 | function _M:display(x, y, nb_keyframes, screen_x, screen_y) |
81 | + local deco_x | |
82 | + if self.h_deco >= self.deco_up.h + self.deco_down.h then | |
83 | + if self.side == "left" then deco_x = x + self.back.w - self.deco_up.w else deco_x = x end | |
84 | + self.deco_up.t:toScreenFull(deco_x, y, self.deco_up.w, self.deco_up.h, self.deco_up.tw, self.deco_up.th) | |
85 | + y = y + self.deco_up.h | |
86 | + screen_y = screen_y + self.deco_up.h | |
87 | + end | |
88 | + if self.h_deco >= 1 then | |
89 | + if self.side == "left" then deco_x = x + self.back.w - self.deco_down.w else deco_x = x end | |
90 | + local deco_h = math.min(self.deco_down.h, self.h_deco) | |
91 | + self.deco_down.t:toScreenFull(deco_x, y + self.back.h, self.deco_down.w, deco_h, self.deco_down.tw, deco_h * self.deco_down.th / self.deco_down.h) | |
92 | + end | |
93 | + | |
73 | 94 | self.back.t:toScreenFull(x, y, self.back.w, self.back.h, self.back.tw, self.back.th) |
74 | 95 | core.display.glScissor(true, screen_x + 15, screen_y + 15, 128, 192) |
75 | 96 | local dx, dy = x + 15 + (128 - self.iw) / 2, y + 15 + (192 - self.ih) / 2 | ... | ... |
-
Please register or login to post a comment