Commit 0ee50ae0bb36dea0a7abe60e52e3b7991e602305

Authored by DarkGod
1 parent 90b4d099

New Webs of Fate visual effect

... ... @@ -30,6 +30,7 @@ function _M:init(t)
30 30 self.w = assert(t.width, "no entity width")
31 31 self.h = assert(t.height, "no entity height")
32 32 self.back_color = t.back_color
  33 + self.back_image = t.back_image
33 34
34 35 Base.init(self, t)
35 36 end
... ... @@ -37,6 +38,10 @@ end
37 38 function _M:generate()
38 39 self.mouse:reset()
39 40 self.key:reset()
  41 +
  42 + if self.back_image then
  43 + self.back_texture = self:getUITexture(self.back_image)
  44 + end
40 45 end
41 46
42 47 function _M:display(x, y)
... ... @@ -45,6 +50,9 @@ function _M:display(x, y)
45 50 if self.back_color then
46 51 core.display.drawQuad(x, y, self.w, self.h, unpack(self.back_color))
47 52 end
  53 + if self.back_texture then
  54 + self.back_texture.t:toScreenFull(x + (self.w - self.back_texture.w) / 2, y + (self.h - self.back_texture.h) / 2, self.back_texture.w, self.back_texture.h, self.back_texture.tw, self.back_texture.th)
  55 + end
48 56
49 57 self.entity:toScreen(nil, x, y, self.w, self.h)
50 58 end
... ...
... ... @@ -2095,7 +2095,7 @@ function _M:setupCommands()
2095 2095 package.loaded["engine.Chat"] = nil
2096 2096 local Chat = require "engine.Chat"
2097 2097 Chat.chat_dialog = "mod.dialogs.Chat"
2098   - local chat = Chat.new("tareyal+test", engine.Entity.new{name=_t"Imperium courrier"}, game.player)
  2098 + local chat = Chat.new("tareyal+test", engine.Entity.new{name=_t"Imperium courrier", image="talents/arcane_power.png"}, game.player)
2099 2099 chat:invoke()
2100 2100 do return end
2101 2101 DamageType:get(DamageType.ACID).projector(game.player, game.player.x, game.player.y, DamageType.ACID, 100)
... ...
... ... @@ -2482,7 +2482,7 @@ function _M:on_prepickup(who, idx)
2482 2482 end
2483 2483 if who.player and self.force_lore_artifact then
2484 2484 game.party:additionalLore(self.unique, self:getName(), "artifacts", self.desc)
2485   - game.party:learnLore(self.unique)
  2485 + game.party:learnLore(self.unique, false, false, false, nil, self)
2486 2486 end
2487 2487 end
2488 2488
... ... @@ -2501,7 +2501,7 @@ function _M:on_identify()
2501 2501 end
2502 2502 if self.unique and self.desc and not self.no_unique_lore then
2503 2503 game.party:additionalLore(self.unique, self:getName{no_add_name=true, do_color=false, no_count=true}, "artifacts", self.desc)
2504   - game.party:learnLore(self.unique, false, false, true)
  2504 + game.party:learnLore(self.unique, false, false, true, nil, self)
2505 2505 end
2506 2506 end)
2507 2507 end
... ...
... ... @@ -108,7 +108,7 @@ function _M:relearningLore(v)
108 108 self.relearning_lore = v
109 109 end
110 110
111   -function _M:learnLore(lore, nopopup, silent, nostop, after_learn_cb)
  111 +function _M:learnLore(lore, nopopup, silent, nostop, after_learn_cb, display_entity)
112 112 print("[LORE] learning..", lore)
113 113 local l = self:getLore(lore, silent)
114 114 if not l then return end
... ... @@ -124,7 +124,7 @@ function _M:learnLore(lore, nopopup, silent, nostop, after_learn_cb)
124 124 if not self:knownLore(lore) or l.always_pop then
125 125 game.logPlayer(self, "Lore found: #0080FF#%s", l.name)
126 126 if not nopopup then
127   - LorePopup.new(l, game.w * 0.6, 0.8, after_learn_cb)
  127 + LorePopup.new(l, game.w * 0.6, 0.8, after_learn_cb, display_entity)
128 128 game.logPlayer(self, "You can read all your collected lore in the game menu, by pressing Escape.")
129 129 end
130 130 learnt = true
... ...
... ... @@ -19,6 +19,8 @@
19 19 local q = game.player:hasQuest("lost-merchant")
20 20 if q and q:isStatus(q.COMPLETED, "saved") then
21 21
  22 +npc.chat_display_entity = engine.Entity.new{name=_t"Urthol's Wondrous Emporium", image="portrait/shop_urthol_s_wondrous_emporium.png"}
  23 +
22 24 local p = game:getPlayer(true)
23 25
24 26 local trap = p:knowTalentType("cunning/trapping") and not game.state:unlockTalentCheck(player.T_AMBUSH_TRAP, player)
... ...
... ... @@ -3622,9 +3622,7 @@ newEffect{
3622 3622 return {dam=dam}
3623 3623 end,
3624 3624 activate = function(self, eff)
3625   - if core.shader.allow("adv") then
3626   - eff.particle1, eff.particle2 = self:addParticles3D("volumetric", {kind="fast_sphere", shininess=40, density=40, radius=1.4, scrollingSpeed=0.001, growSpeed=0.004, img="squares_x3_01"})
3627   - end
  3625 + eff.particle1 = self:addParticles(Particles.new("circle", 1, {shader=true, toback=true, oversize=1.4, a=155, appear=8, speed=0, img="webs_of_fate_aura", radius=0}))
3628 3626 end,
3629 3627 deactivate = function(self, eff)
3630 3628 self:removeParticles(eff.particle1)
... ...
... ... @@ -70,9 +70,10 @@ function _M:makeUI()
70 70 end
71 71
72 72 function _M:getActorPortraitFull(actor)
73   - print("[ToME:CHAT] Grabbing portrait for ", actor.name, actor.image)
74 73 local e = self:getActorPortrait(actor)
75   - print("[ToME:CHAT] Grabed portrait => ", e.image)
  74 + if e.image and (e.image:find("talents/") or e.image:find("effects/")) then
  75 + e = Entity.new{name=e.name, image=e.image, chat_portrait_background="ui/chat_talents_bg.png", chat_portrait_size=0.75}
  76 + end
76 77 return e
77 78 end
78 79
... ...
... ... @@ -21,12 +21,13 @@ require "engine.class"
21 21 local Dialog = require "engine.ui.Dialog"
22 22 local ListColumns = require "engine.ui.ListColumns"
23 23 local TextzoneList = require "engine.ui.TextzoneList"
  24 +local EntityDisplay = require "engine.ui.EntityDisplay"
24 25 local Image = require "engine.ui.Image"
25 26 local Separator = require "engine.ui.Separator"
26 27
27 28 module(..., package.seeall, class.inherit(Dialog))
28 29
29   -function _M:init(l, w, force_height, after_learn_cb)
  30 +function _M:init(l, w, force_height, after_learn_cb, display_entity)
30 31 self.after_learn_cb = after_learn_cb
31 32 self.title_shadow = false
32 33 self.color = l.text_color or {r=0x3a, g=0x35, b=0x33}
... ... @@ -62,7 +63,7 @@ function _M:init(l, w, force_height, after_learn_cb)
62 63 local required_h = self.font:height() + self.font_h * (#list - 1)
63 64 local h = math.min(force_height and (force_height * game.h) or 999999999, required_h)
64 65 local c_text = require("engine.ui.Textzone").new{
65   - width=w+10, height=h, scrollbar=(h < required_h) and true or false, text=text, color=self.color,
  66 + width=(display_entity and (w - 90) or w)+10, height=h, scrollbar=(h < required_h) and true or false, text=text, color=self.color,
66 67 }
67 68 c_text:setTextShadow(false)
68 69
... ... @@ -86,6 +87,12 @@ function _M:init(l, w, force_height, after_learn_cb)
86 87 {left = 3, top = 3 + image.h, ui=c_text},
87 88 }
88 89 end
  90 + elseif display_entity then
  91 + local frame = EntityDisplay.new{ui="parchment", width=64, height=64, entity=display_entity, back_image="ui/lore_frame_entity.png"}
  92 + uis = {
  93 + {left = 13, top = 3, ui=c_text},
  94 + {right = 13, top = 3, ui=frame},
  95 + }
89 96 end
90 97
91 98 local on_end = function()
... ...
... ... @@ -28,7 +28,7 @@ module(..., package.seeall, class.inherit(Base))
28 28
29 29 function _M:init(t)
30 30 self.side = assert(t.side, "no ChatPortrait side")
31   - assert(t.actor, "no ChatPortrait actor")
  31 + self.actor = assert(t.actor, "no ChatPortrait actor")
32 32
33 33 self.name = t.actor.getName and t.actor:getName() or _t(t.actor.name) or _t"???"
34 34 if t.actor.moddable_tile then
... ... @@ -53,6 +53,7 @@ function _M:init(t)
53 53 self.iy = 0
54 54 self.iw, self.ih = 128, 128
55 55 end
  56 +
56 57 self.h_deco = 0
57 58
58 59 Base.init(self, t)
... ... @@ -68,6 +69,13 @@ function _M:generate()
68 69 self.deco_up = self:getUITexture("ui/chat_ui_deco_padding_"..self.side.."_up.png")
69 70 self.w, self.h = self.front.w, self.front.h
70 71
  72 + if self.actor.chat_portrait_background then
  73 + self.back_texture = self:getUITexture(self.actor.chat_portrait_background)
  74 + if self.actor.chat_portrait_size then
  75 + self.iw, self.ih = self.iw * self.actor.chat_portrait_size, self.ih * self.actor.chat_portrait_size
  76 + end
  77 + end
  78 +
71 79 if self.image then self.item = {self.image:glTexture(false, true)} end
72 80
73 81 self.name_tex = self:drawFontLine(self.font, self.name, nil, 0xff, 0xee, 0xcb)
... ... @@ -92,6 +100,11 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y)
92 100 end
93 101
94 102 self.back.t:toScreenFull(x, y, self.back.w, self.back.h, self.back.tw, self.back.th)
  103 +
  104 + if self.back_texture then
  105 + self.back_texture.t:toScreenFull(x + 15, y + 15, self.back_texture.w, self.back_texture.h, self.back_texture.tw, self.back_texture.th)
  106 + end
  107 +
95 108 core.display.glScissor(true, screen_x + 15, screen_y + 15, 128, 192)
96 109 local dx, dy = x + 15 + (128 - self.iw) / 2, y + 15 + (192 - self.ih) / 2
97 110 if self.ih > 192 then dy = y + 15 end
... ... @@ -101,6 +114,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y)
101 114 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)
102 115 end
103 116 core.display.glScissor(false)
  117 +
104 118 self.front.t:toScreenFull(x, y, self.front.w, self.front.h, self.front.tw, self.front.th)
105 119
106 120 core.display.glScissor(true, screen_x + 4, screen_y + 229, 152, 23)
... ...