Showing
18 changed files
with
30 additions
and
16 deletions
... | ... | @@ -2094,7 +2094,7 @@ function _M:setupCommands() |
2094 | 2094 | package.loaded["engine.Chat"] = nil |
2095 | 2095 | local Chat = require "engine.Chat" |
2096 | 2096 | Chat.chat_dialog = "mod.dialogs.Chat" |
2097 | - local chat = Chat.new("tareyal+test", engine.Entity.new{name=_t"Imperium courrier", image="npc/undead_risen_mistress_vira.png"}, game.player) | |
2097 | + local chat = Chat.new("tareyal+test", engine.Entity.new{name=_t"Imperium courrier"}, game.player) | |
2098 | 2098 | chat:invoke() |
2099 | 2099 | do return end |
2100 | 2100 | DamageType:get(DamageType.ACID).projector(game.player, game.player.x, game.player.y, DamageType.ACID, 100) | ... | ... |
... | ... | @@ -17,13 +17,14 @@ |
17 | 17 | -- Nicolas Casalini "DarkGod" |
18 | 18 | -- darkgod@te4.org |
19 | 19 | |
20 | - | |
21 | - | |
22 | 20 | local Dialog = require "engine.ui.Dialog" |
23 | 21 | local DamageType = require "engine.DamageType" |
24 | 22 | local o = version |
25 | 23 | local src = game.player |
26 | 24 | |
25 | +-- If staff does not provide a portrait, use the talent | |
26 | +if not npc.has_command_staff_portrait then cur_chat.npc_force_display_entity = src:getTalentFromId(src.T_COMMAND_STAFF) end | |
27 | + | |
27 | 28 | if o.factory_settings then |
28 | 29 | print("Just started the chat, and we apparently have o.factory_settings.") |
29 | 30 | else | ... | ... |

27.4 KB

34.2 KB

27.6 KB

34.2 KB

31.8 KB

3.85 KB

36.3 KB

45.4 KB

18.9 KB

67.9 KB

55.8 KB
... | ... | @@ -59,7 +59,7 @@ on_status_change = function(self, who, status, sub) |
59 | 59 | end |
60 | 60 | |
61 | 61 | local Chat = require"engine.Chat" |
62 | - local chat = Chat.new("sorcerer-end", {name=_t"Endgame", image="winner.png"}, game:getPlayer(true)) | |
62 | + local chat = Chat.new("sorcerer-end", {name=_t"Endgame", image="portrait/win.png"}, game:getPlayer(true)) | |
63 | 63 | chat:invoke() |
64 | 64 | |
65 | 65 | self:end_end_combat() | ... | ... |
... | ... | @@ -180,7 +180,7 @@ newTalent{ |
180 | 180 | local Chat = require("engine.Chat") |
181 | 181 | local chat = Chat.new("command-staff", staff, self, {version=staff, state=state, co=coroutine.running()}) |
182 | 182 | local d = chat:invoke() |
183 | - if not coroutine.yield() then return nil end | |
183 | + self:talentDialog(d) | |
184 | 184 | return true |
185 | 185 | else -- NPC picks a new element |
186 | 186 | local element, aspect = staff:getStaffPreferredElement(self) | ... | ... |
... | ... | @@ -39,8 +39,8 @@ end |
39 | 39 | function _M:makeUI() |
40 | 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} |
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.npc.chat_display_entity or self.npc)} | |
43 | - local player_frame = ChatPortrait.new{ui="chat", actor=self:getActorPortrait(self.player.chat_display_entity or self.player)} | |
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)} | |
44 | 44 | |
45 | 45 | local uis = { |
46 | 46 | {hcenter=0, top=-12, ui=self.c_desc}, |
... | ... | @@ -69,23 +69,35 @@ function _M:getActorPortrait(actor) |
69 | 69 | if self.player.getCurrentTalent and self.player:getCurrentTalent() then |
70 | 70 | local t = self.player:getTalentFromId(self.player:getCurrentTalent()) |
71 | 71 | if t then |
72 | - return Entity.new{name=t.name, image=t.image or "talents/default.png"} | |
72 | + local image = t.image or "portrait/unknown.png" | |
73 | + if image:find("^talents/") and fs.exists("/data/gfx/shockbolt/"..image:gsub("^talents/", "portrait/")) then | |
74 | + image = image:gsub("^talents/", "portrait/") | |
75 | + end | |
76 | + return Entity.new{name=t.name, image=image, chat_ignore_margins=true} | |
73 | 77 | else |
74 | - return Entity.new{name=actor.name, image="talents/default.png"} | |
78 | + return Entity.new{name=actor.name, image="portrait/unknown.png", chat_ignore_margins=true} | |
75 | 79 | end |
76 | 80 | else |
77 | - return Entity.new{name=actor.name, image="talents/default.png"} | |
81 | + return Entity.new{name=actor.name, image="portrait/unknown.png", chat_ignore_margins=true} | |
78 | 82 | end |
79 | 83 | end |
80 | 84 | |
81 | 85 | -- No need for anything special |
82 | 86 | if actor.image:find("^portrait/") then return actor end |
83 | 87 | |
84 | - -- Find the npc portrait | |
88 | + -- Find the portrait | |
85 | 89 | if actor.image == "invis.png" and actor.add_mos and actor.add_mos[1] and actor.add_mos[1].image and actor.add_mos[1].image:find("^npc/") and fs.exists("/data/gfx/shockbolt/"..actor.add_mos[1].image:gsub("^npc/", "portrait/")) then |
86 | 90 | return Entity.new{name=actor.name, image=actor.add_mos[1].image:gsub("^npc/", "portrait/")} |
87 | 91 | elseif actor.image:find("^npc/") and fs.exists("/data/gfx/shockbolt/"..actor.image:gsub("^npc/", "portrait/")) then |
88 | 92 | return Entity.new{name=actor.name, image=actor.image:gsub("^npc/", "portrait/")} |
93 | + elseif actor.image:find("^npc/") and fs.exists("/data/gfx/shockbolt/"..actor.image:gsub("^npc/", "portrait/")) then | |
94 | + return Entity.new{name=actor.name, image=actor.image:gsub("^npc/", "portrait/")} | |
95 | + elseif actor.image:find("^object/") and fs.exists("/data/gfx/shockbolt/"..actor.image:gsub("^object/", "portrait/")) then | |
96 | + return Entity.new{name=actor.name, image=actor.image:gsub("^object/", "portrait/")} | |
97 | + elseif actor.image:find("^object/artifact/") and fs.exists("/data/gfx/shockbolt/"..actor.image:gsub("^object/artifact/", "portrait/")) then | |
98 | + return Entity.new{name=actor.name, image=actor.image:gsub("^object/artifact/", "portrait/")} | |
99 | + elseif actor.image:find("^talents/") and fs.exists("/data/gfx/shockbolt/"..actor.image:gsub("^talents/", "portrait/")) then | |
100 | + return Entity.new{name=actor.name, image=actor.image:gsub("^talents/", "portrait/")} | |
89 | 101 | end |
90 | 102 | |
91 | 103 | -- Last resort, use it as it is | ... | ... |
... | ... | @@ -39,11 +39,12 @@ function _M:init(t) |
39 | 39 | end |
40 | 40 | if self.image then |
41 | 41 | local iw, ih = self.image:getSize() |
42 | + self.oiw, self.oih = iw, ih | |
42 | 43 | if iw <= 64 then iw, ih = iw * 2, ih * 2 end |
43 | 44 | self.iw, self.ih = iw, ih |
44 | - if self.image.getEmptyMargins then | |
45 | + if self.image.getEmptyMargins and not t.actor.ignore_margins then | |
45 | 46 | local x1, x2, y1, y2 = self.image:getEmptyMargins() |
46 | - self.iy = y1 | |
47 | + self.iy = 0 | |
47 | 48 | else |
48 | 49 | self.iy = 0 |
49 | 50 | end |
... | ... | @@ -63,7 +64,7 @@ function _M:generate() |
63 | 64 | self.back = self:getUITexture("ui/portrait_frame_back.png") |
64 | 65 | self.w, self.h = self.front.w, self.front.h |
65 | 66 | |
66 | - if self.image then self.item = {self.image:glTexture(Tiles.sharp_scaling)} end | |
67 | + if self.image then self.item = {self.image:glTexture(false, true)} end | |
67 | 68 | |
68 | 69 | self.name_tex = self:drawFontLine(self.font, self.name, nil, 0xff, 0xee, 0xcb) |
69 | 70 | end |
... | ... | @@ -76,7 +77,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y) |
76 | 77 | if self.actor_frame then |
77 | 78 | self.actor_frame:display(dx, dy - self.iy) |
78 | 79 | elseif self.item then |
79 | - self.item[1]:toScreen(dx, dy - self.iy, self.iw, self.ih) | |
80 | + self.item[1]:toScreenFull(dx, dy - self.iy, self.iw, self.ih, self.item[2] * self.iw / self.oiw, self.item[3] * self.ih / self.oih) | |
80 | 81 | end |
81 | 82 | core.display.glScissor(false) |
82 | 83 | self.front.t:toScreenFull(x, y, self.front.w, self.front.h, self.front.tw, self.front.th) | ... | ... |
... | ... | @@ -243,7 +243,7 @@ Store:loadStores("/data/general/stores/basic.lua") |
243 | 243 | |
244 | 244 | -- Configure chat dialogs |
245 | 245 | require("engine.dialogs.Chat").show_portraits = true |
246 | --- require("engine.Chat").chat_dialog = "mod.dialogs.Chat" | |
246 | +require("engine.Chat").chat_dialog = "mod.dialogs.Chat" | |
247 | 247 | |
248 | 248 | -- Inventory tabs |
249 | 249 | InventoryUI.default_tabslist = function(self) | ... | ... |
-
Please register or login to post a comment