diff --git a/game/engine/Entity.lua b/game/engine/Entity.lua index d3f371ab2fa16d96a14847bfa6e57450c62509ba..7d5df66baa3e64972e39c1a02885c47af6df36f0 100644 --- a/game/engine/Entity.lua +++ b/game/engine/Entity.lua @@ -218,6 +218,14 @@ function _M:getMapObjects(tiles, mos, z) until not mo end +function _M:getDisplayString(mo) + if core.display.FBOActive() then + return "#UID:"..self.uid..":"..(mo or 0).."#" + else + return "" + end +end + --- Resolves an entity -- This is called when generatingthe final clones of an entity for use in a level.<br/> -- This can be used to make random enchants on objects, random properties on actors, ...<br/> diff --git a/game/engine/Map.lua b/game/engine/Map.lua index 3e7ad1fc87865bca3b675c50a2ceccd3e8873861..2b8e393356d8aff5a0b48feea1f8c71c471f9b94 100644 --- a/game/engine/Map.lua +++ b/game/engine/Map.lua @@ -165,6 +165,7 @@ end function _M:resetTiles() Entity:invalidateAllMO() self.tiles = Tiles.new(self.tile_w, self.tile_h, self.fontname, self.fontsize, true, self.allow_backcolor) + self.tilesSDL = Tiles.new(self.tile_w, self.tile_h, self.fontname, self.fontsize, false, self.allow_backcolor) self.tilesTactic = Tiles.new(self.tile_w, self.tile_h, self.fontname, self.fontsize, true, false) self.tilesSurface = Tiles.new(self.tile_w, self.tile_h, self.fontname, self.fontsize, true, true) end diff --git a/game/engine/Tooltip.lua b/game/engine/Tooltip.lua index 3721812b11a2925b8b2711e517b4c8cdc2f2735f..00ffe5eb6afb9cd7b900c139d18a6707c2e1601b 100644 --- a/game/engine/Tooltip.lua +++ b/game/engine/Tooltip.lua @@ -83,13 +83,17 @@ function _M:display() end local i = 1 + local y = 0 + local r, g, b, max_h = self.color[1], self.color[2], self.color[3], nil for ii, l in ipairs(self.text) do if self.text[i] == "---" then - self:drawWBorder(self.surface, 4, 4 + (i-1 + 0.5) * self.font_h, self.w - 8) + self:drawWBorder(self.surface, 4, 4 + y + 0.5 * self.font_h, self.w - 8) i = i + 1 + y = y + self.font_h else - self.surface:drawColorString(self.font, self.text[i], 4, 4 + (i-1) * self.font_h, self.color[1], self.color[2], self.color[3]) + r, g, b, max_h = self.surface:drawColorStringBlended(self.font, self.text[i], 4, 4 + y, r, g, b) i = i + 1 + y = y + max_h end end self.texture = self.surface:glTexture() diff --git a/game/engine/utils.lua b/game/engine/utils.lua index 20bf1cf5eb5b967e6ece634cad207c4e2fb53c09..62fccb618edc2fdf79c1cfd30dabc3b68556d659 100644 --- a/game/engine/utils.lua +++ b/game/engine/utils.lua @@ -160,12 +160,16 @@ function string.splitLine(str, max_width, font) -- Ignore the size of color markers local _, _, color1 = v:find("(#%x%x%x%x%x%x#)") local _, _, color2 = v:find("(#[A-Z_]+#)") + local _, _, uid = v:find("(#UID:[0-9]+:[0-9]#)") if color1 then local color_w = font:size(color1) w = w - color_w elseif color2 then local color_w = font:size(color2) w = w - color_w + elseif uid then + local color_w = font:size(uid) + w = w - color_w end if cur_size + space_w + w < max_width then @@ -277,18 +281,22 @@ getmetatable(tmps).__index.drawColorStringCentered = function(s, font, str, dx, end getmetatable(tmps).__index.drawColorStringBlended = function(s, font, str, x, y, r, g, b) + local Puid = "UID:" * lpeg.R"09"^1 * ":" * lpeg.R"09" + local Puid_cap = "UID:" * lpeg.C(lpeg.R"09"^1) * ":" * lpeg.C(lpeg.R"09") local Pcolorname = (lpeg.R"AZ" + "_")^3 local Pcode = (lpeg.R"af" + lpeg.R"09" + lpeg.R"AF") local Pcolorcode = Pcode * Pcode - local list = str:split("#" * ((Pcolorcode * Pcolorcode * Pcolorcode) + Pcolorname) * "#", true) + local list = str:split("#" * (Puid + (Pcolorcode * Pcolorcode * Pcolorcode) + Pcolorname) * "#", true) r = r or 255 g = g or 255 b = b or 255 local oldr, oldg, oldb = r, g, b + local max_h = 0 for i, v in ipairs(list) do local nr, ng, nb = lpeg.match("#" * lpeg.C(Pcolorcode) * lpeg.C(Pcolorcode) * lpeg.C(Pcolorcode) * "#", v) local col = lpeg.match("#" * lpeg.C(Pcolorname) * "#", v) + local uid, mo = lpeg.match("#" * Puid_cap * "#", v) if nr and ng and nb then oldr, oldg, oldb = r, g, b r, g, b = nr:parseHex(), ng:parseHex(), nb:parseHex() @@ -299,13 +307,29 @@ getmetatable(tmps).__index.drawColorStringBlended = function(s, font, str, x, y, oldr, oldg, oldb = r, g, b r, g, b = colors[col].r, colors[col].g, colors[col].b end + elseif uid and mo then + os.exit("FINISH UID DISPLAY IN STRING") + uid = tonumber(uid) + mo = tonumber(mo) + local e = __uids[uid] + if e then + local surfs = e:getEntitySurfaces(game.level.map.tilesSDL) + local w, h = nil, nil + for i = 1, #surfs do + if not w then w, h = surfs[i]:getSize() end + s:merge(surfs[i], x, y) + end + if h > max_h then max_h = h end + x = x + (w or 0) + end else local w, h = font:size(v) + if h > max_h then max_h = h end s:drawStringBlended(font, v, x, y, r, g, b) x = x + w end end - return r, g, b + return r, g, b, max_h end getmetatable(tmps).__index.drawColorStringBlendedCentered = function(s, font, str, dx, dy, dw, dh, r, g, b) diff --git a/game/modules/tome/class/Object.lua b/game/modules/tome/class/Object.lua index a01e5106d03b10aca6c0666864f0d18ab5ec50a2..27ef74cb59488cfeb4b9efa5ea5e0921d4b87dd7 100644 --- a/game/modules/tome/class/Object.lua +++ b/game/modules/tome/class/Object.lua @@ -151,8 +151,9 @@ function _M:getName(t) end else local _, c = self:getDisplayColor() + local ds = self:getDisplayString() if qty == 1 or t.no_count then return c..name.."#LAST#" - else return c..qty.." "..name.."#LAST#" + else return c..qty.." "..ds..name.."#LAST#" end end end @@ -340,7 +341,7 @@ function _M:getDesc() end if self.encumber then - desc[#desc+1] = ("#67AD00#%0.2f Encumbrance."):format(self.encumber) + desc[#desc+1] = ("#67AD00#%0.2f Encumbrance.#LAST#"):format(self.encumber) end local textdesc = table.concat(self:getTextualDesc(), "\n") diff --git a/game/modules/tome/data/general/objects/2haxes.lua b/game/modules/tome/data/general/objects/2haxes.lua index c8aa2a6d5cb3a25f94989f51f24ae18bcedc3adc..31123d61d816b409d5b91e87da584c46cab7935a 100644 --- a/game/modules/tome/data/general/objects/2haxes.lua +++ b/game/modules/tome/data/general/objects/2haxes.lua @@ -21,7 +21,7 @@ newEntity{ define_as = "BASE_BATTLEAXE", slot = "MAINHAND", slot_forbid = "OFFHAND", - type = "weapon", subtype="battleaxe", + type = "weapon", subtype="battleaxe", image = resolvers.image_material("2haxe", "metal"), add_name = " (#COMBAT#)", display = "/", color=colors.SLATE, encumber = 3, @@ -34,7 +34,7 @@ newEntity{ } newEntity{ base = "BASE_BATTLEAXE", - name = "iron battleaxe", image = "object/2haxe_iron.png", + name = "iron battleaxe", level_range = {1, 10}, require = { stat = { str=11 }, }, cost = 5, @@ -48,7 +48,7 @@ newEntity{ base = "BASE_BATTLEAXE", } newEntity{ base = "BASE_BATTLEAXE", - name = "steel battleaxe", image = "object/2haxe_steel.png", + name = "steel battleaxe", level_range = {10, 20}, require = { stat = { str=16 }, }, cost = 10, @@ -62,7 +62,7 @@ newEntity{ base = "BASE_BATTLEAXE", } newEntity{ base = "BASE_BATTLEAXE", - name = "dwarven-steel battleaxe", image = "object/2haxe_dsteel.png", + name = "dwarven-steel battleaxe", level_range = {20, 30}, require = { stat = { str=24 }, }, cost = 15, @@ -76,7 +76,7 @@ newEntity{ base = "BASE_BATTLEAXE", } newEntity{ base = "BASE_BATTLEAXE", - name = "galvorn battleaxe", image = "object/2haxe_galvorn.png", + name = "galvorn battleaxe", level_range = {30, 40}, require = { stat = { str=35 }, }, cost = 25, @@ -90,7 +90,7 @@ newEntity{ base = "BASE_BATTLEAXE", } newEntity{ base = "BASE_BATTLEAXE", - name = "mithril battleaxe", image = "object/2haxe_mithril.png", + name = "mithril battleaxe", level_range = {40, 50}, require = { stat = { str=48 }, }, cost = 35, diff --git a/game/modules/tome/data/general/objects/2hmaces.lua b/game/modules/tome/data/general/objects/2hmaces.lua index 6a1ad98fa4401d61f923262c0ddf339d241264ff..6b66a6f064d3626fa1da9e99d92e1fe05a4d6091 100644 --- a/game/modules/tome/data/general/objects/2hmaces.lua +++ b/game/modules/tome/data/general/objects/2hmaces.lua @@ -23,7 +23,7 @@ newEntity{ slot_forbid = "OFFHAND", type = "weapon", subtype="greatmaul", add_name = " (#COMBAT#)", - display = "\\", color=colors.SLATE, + display = "\\", color=colors.SLATE, image = resolvers.image_material("2hmace", "metal"), encumber = 5, rarity = 5, metallic = true, @@ -34,7 +34,7 @@ newEntity{ } newEntity{ base = "BASE_GREATMAUL", - name = "iron greatmaul", image = "object/2hmace_iron.png", + name = "iron greatmaul", level_range = {1, 10}, require = { stat = { str=11 }, }, cost = 5, @@ -48,7 +48,7 @@ newEntity{ base = "BASE_GREATMAUL", } newEntity{ base = "BASE_GREATMAUL", - name = "steel greatmaul", image = "object/2hmace_steel.png", + name = "steel greatmaul", level_range = {10, 20}, require = { stat = { str=16 }, }, cost = 10, @@ -62,7 +62,7 @@ newEntity{ base = "BASE_GREATMAUL", } newEntity{ base = "BASE_GREATMAUL", - name = "dwarven-steel greatmaul", image = "object/2hmace_dsteel.png", + name = "dwarven-steel greatmaul", level_range = {20, 30}, require = { stat = { str=24 }, }, cost = 15, @@ -76,7 +76,7 @@ newEntity{ base = "BASE_GREATMAUL", } newEntity{ base = "BASE_GREATMAUL", - name = "galvorn greatmaul", image = "object/2hmace_galvorn.png", + name = "galvorn greatmaul", level_range = {30, 40}, require = { stat = { str=35 }, }, cost = 25, @@ -90,7 +90,7 @@ newEntity{ base = "BASE_GREATMAUL", } newEntity{ base = "BASE_GREATMAUL", - name = "mithril greatmaul", image = "object/2hmace_mithril.png", + name = "mithril greatmaul", level_range = {40, 50}, require = { stat = { str=48 }, }, cost = 35, diff --git a/game/modules/tome/data/general/objects/2hswords.lua b/game/modules/tome/data/general/objects/2hswords.lua index 4e3c1486991b3e4507551dc5b12f6690b7802863..6296db5e52bc6de9a78da39ab6523920201dd917 100644 --- a/game/modules/tome/data/general/objects/2hswords.lua +++ b/game/modules/tome/data/general/objects/2hswords.lua @@ -23,7 +23,7 @@ newEntity{ slot_forbid = "OFFHAND", type = "weapon", subtype="greatsword", add_name = " (#COMBAT#)", - display = "/", color=colors.SLATE, + display = "/", color=colors.SLATE, image = resolvers.image_material("2hsword", "metal"), encumber = 3, rarity = 5, combat = { talented = "sword", damrange = 1.6, sound = "actions/melee", sound_miss = "actions/melee_miss", }, @@ -34,7 +34,7 @@ newEntity{ } newEntity{ base = "BASE_GREATSWORD", - name = "iron greatsword", image = "object/2hsword_iron.png", + name = "iron greatsword", level_range = {1, 10}, require = { stat = { str=11 }, }, cost = 5, @@ -47,7 +47,7 @@ newEntity{ base = "BASE_GREATSWORD", }, } -newEntity{ base = "BASE_GREATSWORD", image = "object/2hsword_dsteel.png", +newEntity{ base = "BASE_GREATSWORD", name = "steel greatsword", level_range = {10, 20}, require = { stat = { str=16 }, }, @@ -62,7 +62,7 @@ newEntity{ base = "BASE_GREATSWORD", image = "object/2hsword_dsteel.png", } newEntity{ base = "BASE_GREATSWORD", - name = "dwarven-steel greatsword", image = "object/2hsword_dsteel.png", + name = "dwarven-steel greatsword", level_range = {20, 30}, require = { stat = { str=24 }, }, cost = 15, @@ -76,7 +76,7 @@ newEntity{ base = "BASE_GREATSWORD", } newEntity{ base = "BASE_GREATSWORD", - name = "galvorn greatsword", image = "object/2hsword_galvorn.png", + name = "galvorn greatsword", level_range = {30, 40}, require = { stat = { str=35 }, }, cost = 25, @@ -90,7 +90,7 @@ newEntity{ base = "BASE_GREATSWORD", } newEntity{ base = "BASE_GREATSWORD", - name = "mithril greatsword", image = "object/2hsword_mithril.png", + name = "mithril greatsword", level_range = {40, 50}, require = { stat = { str=48 }, }, cost = 35, diff --git a/game/modules/tome/data/general/objects/axes.lua b/game/modules/tome/data/general/objects/axes.lua index e35a035d0f3543197274c637456e7872166b4c1c..9f433f9a5c7bdc832a39640f610f1e782b7feb05 100644 --- a/game/modules/tome/data/general/objects/axes.lua +++ b/game/modules/tome/data/general/objects/axes.lua @@ -22,7 +22,7 @@ newEntity{ slot = "MAINHAND", type = "weapon", subtype="waraxe", add_name = " (#COMBAT#)", - display = "/", color=colors.SLATE, + display = "/", color=colors.SLATE, image = resolvers.image_material("axe", "metal"), encumber = 3, rarity = 3, metallic = true, @@ -32,7 +32,7 @@ newEntity{ } newEntity{ base = "BASE_WARAXE", - name = "iron waraxe", image = "object/axe_iron.png", + name = "iron waraxe", level_range = {1, 10}, require = { stat = { str=11 }, }, cost = 5, @@ -46,7 +46,7 @@ newEntity{ base = "BASE_WARAXE", } newEntity{ base = "BASE_WARAXE", - name = "steel waraxe", image = "object/axe_steel.png", + name = "steel waraxe", level_range = {10, 20}, require = { stat = { str=16 }, }, cost = 10, @@ -60,7 +60,7 @@ newEntity{ base = "BASE_WARAXE", } newEntity{ base = "BASE_WARAXE", - name = "dwarven-steel waraxe", image = "object/axe_dsteel.png", + name = "dwarven-steel waraxe", level_range = {20, 30}, require = { stat = { str=24 }, }, cost = 15, @@ -74,7 +74,7 @@ newEntity{ base = "BASE_WARAXE", } newEntity{ base = "BASE_WARAXE", - name = "galvorn waraxe", image = "object/axe_galvorn.png", + name = "galvorn waraxe", level_range = {30, 40}, require = { stat = { str=35 }, }, cost = 25, @@ -88,7 +88,7 @@ newEntity{ base = "BASE_WARAXE", } newEntity{ base = "BASE_WARAXE", - name = "mithril waraxe", image = "object/axe_mithril.png", + name = "mithril waraxe", level_range = {40, 50}, require = { stat = { str=48 }, }, cost = 35, diff --git a/game/modules/tome/data/general/objects/bows.lua b/game/modules/tome/data/general/objects/bows.lua index d7f748e409b9c00d8a65bf6e1dde4cc384852de3..143adc46e7cc4f459ac270ab503bb4a3d6dc5842 100644 --- a/game/modules/tome/data/general/objects/bows.lua +++ b/game/modules/tome/data/general/objects/bows.lua @@ -22,7 +22,7 @@ newEntity{ slot = "MAINHAND", slot_forbid = "OFFHAND", type = "weapon", subtype="longbow", - display = "}", color=colors.UMBER, + display = "}", color=colors.UMBER, image = resolvers.image_material("longbow", "wood"), encumber = 4, rarity = 5, combat = { talented = "bow", damrange = 1.4, sound = "actions/arrow", sound_miss = "actions/arrow",}, @@ -32,7 +32,7 @@ newEntity{ } newEntity{ base = "BASE_LONGBOW", - name = "elm longbow", image = "object/longbow_elm.png", + name = "elm longbow", level_range = {1, 10}, require = { stat = { dex=11 }, }, cost = 5, @@ -44,7 +44,7 @@ newEntity{ base = "BASE_LONGBOW", } newEntity{ base = "BASE_LONGBOW", - name = "ash longbow", image = "object/longbow_ash.png", + name = "ash longbow", level_range = {10, 20}, require = { stat = { dex=16 }, }, cost = 10, @@ -56,7 +56,7 @@ newEntity{ base = "BASE_LONGBOW", } newEntity{ base = "BASE_LONGBOW", - name = "yew longbow", image = "object/longbow_yew.png", + name = "yew longbow", level_range = {20, 30}, require = { stat = { dex=24 }, }, cost = 15, @@ -68,7 +68,7 @@ newEntity{ base = "BASE_LONGBOW", } newEntity{ base = "BASE_LONGBOW", - name = "elven-wood longbow", image = "object/longbow_elvenyew.png", + name = "elven-wood longbow", level_range = {30, 40}, require = { stat = { dex=35 }, }, cost = 25, @@ -80,7 +80,7 @@ newEntity{ base = "BASE_LONGBOW", } newEntity{ base = "BASE_LONGBOW", - name = "dragonbone longbow", image = "object/longbow_dragonbone.png", + name = "dragonbone longbow", level_range = {40, 50}, require = { stat = { dex=48 }, }, cost = 35, @@ -98,7 +98,7 @@ newEntity{ slot = "QUIVER", type = "ammo", subtype="arrow", add_name = " (#COMBAT#)", - display = "{", color=colors.UMBER, + display = "{", color=colors.UMBER, image = resolvers.image_material("arrow", "wood"), encumber = 0.03, rarity = 5, combat = { talented = "bow", damrange = 1.4}, @@ -110,7 +110,7 @@ newEntity{ } newEntity{ base = "BASE_ARROW", - name = "elm arrow", image = "object/arrow_elm.png", + name = "elm arrow", level_range = {1, 10}, require = { stat = { dex=11 }, }, cost = 0.05, @@ -124,7 +124,7 @@ newEntity{ base = "BASE_ARROW", } newEntity{ base = "BASE_ARROW", - name = "ash arrow", image = "object/arrow_ash.png", + name = "ash arrow", level_range = {10, 20}, require = { stat = { dex=16 }, }, cost = 0.1, @@ -138,7 +138,7 @@ newEntity{ base = "BASE_ARROW", } newEntity{ base = "BASE_ARROW", - name = "yew arrow", image = "object/arrow_yew.png", + name = "yew arrow", level_range = {20, 30}, require = { stat = { dex=24 }, }, cost = 0.15, @@ -152,7 +152,7 @@ newEntity{ base = "BASE_ARROW", } newEntity{ base = "BASE_ARROW", - name = "elven-wood arrow", image = "object/arrow_elvenyew.png", + name = "elven-wood arrow", level_range = {30, 40}, require = { stat = { dex=35 }, }, cost = 0.25, @@ -166,7 +166,7 @@ newEntity{ base = "BASE_ARROW", } newEntity{ base = "BASE_ARROW", - name = "dragonbone arrow", image = "object/arrow_dragonbone.png", + name = "dragonbone arrow", level_range = {40, 50}, require = { stat = { dex=48 }, }, cost = 0.35, diff --git a/game/modules/tome/data/general/objects/cloth-armors.lua b/game/modules/tome/data/general/objects/cloth-armors.lua index a02fe0c5d4440abe1788e5bfd6f83cc7770e435d..2f97b181a3771171bd9ee22e8afcd2efffaeb155 100644 --- a/game/modules/tome/data/general/objects/cloth-armors.lua +++ b/game/modules/tome/data/general/objects/cloth-armors.lua @@ -22,7 +22,7 @@ newEntity{ slot = "BODY", type = "armor", subtype="cloth", add_name = " (#ARMOR#)", - display = "[", color=colors.SLATE, + display = "[", color=colors.SLATE, image = resolvers.image_material("robe", "cloth"), encumber = 2, rarity = 5, desc = [[A cloth vestment. It offers no intrinsic protection but can be enchanted.]], @@ -30,21 +30,21 @@ newEntity{ } newEntity{ base = "BASE_CLOTH_ARMOR", - name = "linen robe", image = "object/robe_linen.png", + name = "linen robe", level_range = {1, 10}, cost = 0.5, material_level = 1, } newEntity{ base = "BASE_CLOTH_ARMOR", - name = "woollen robe", image = "object/robe_woolen.png", + name = "woollen robe", level_range = {10, 20}, cost = 1.5, material_level = 2, } newEntity{ base = "BASE_CLOTH_ARMOR", - name = "cashmere robe", image = "object/robe_cashmere.png", + name = "cashmere robe", level_range = {20, 30}, cost = 2.5, material_level = 3, @@ -52,7 +52,7 @@ newEntity{ base = "BASE_CLOTH_ARMOR", } newEntity{ base = "BASE_CLOTH_ARMOR", - name = "silk robe", image = "object/robe_silk.png", + name = "silk robe", level_range = {30, 40}, cost = 3.5, material_level = 4, @@ -60,7 +60,7 @@ newEntity{ base = "BASE_CLOTH_ARMOR", } newEntity{ base = "BASE_CLOTH_ARMOR", - name = "elven-silk robe", image = "object/robe_elvensilk.png", + name = "elven-silk robe", level_range = {40, 50}, cost = 5.5, material_level = 5, diff --git a/game/modules/tome/data/general/objects/heavy-armors.lua b/game/modules/tome/data/general/objects/heavy-armors.lua index 71a318bd5dce5f68956e3dfc557b43bc92022c6c..a2125b7b97807a36690b66baa19e0838bb6523a5 100644 --- a/game/modules/tome/data/general/objects/heavy-armors.lua +++ b/game/modules/tome/data/general/objects/heavy-armors.lua @@ -22,7 +22,7 @@ local Talents = require "engine.interface.ActorTalents" newEntity{ define_as = "BASE_HEAVY_ARMOR", slot = "BODY", - type = "armor", subtype="heavy", + type = "armor", subtype="heavy", image = resolvers.image_material("mail", "metal"), add_name = " (#ARMOR#)", display = "[", color=colors.SLATE, require = { talent = { Talents.T_HEAVY_ARMOUR_TRAINING }, }, @@ -34,7 +34,7 @@ newEntity{ } newEntity{ base = "BASE_HEAVY_ARMOR", - name = "iron mail armour", image = "object/mail_iron.png", + name = "iron mail armour", level_range = {1, 10}, require = { stat = { str=14 }, }, cost = 20, @@ -47,7 +47,7 @@ newEntity{ base = "BASE_HEAVY_ARMOR", } newEntity{ base = "BASE_HEAVY_ARMOR", - name = "steel mail armour", image = "object/mail_steel.png", + name = "steel mail armour", level_range = {10, 20}, require = { stat = { str=20 }, }, cost = 25, @@ -60,7 +60,7 @@ newEntity{ base = "BASE_HEAVY_ARMOR", } newEntity{ base = "BASE_HEAVY_ARMOR", - name = "dwarven-steel mail armour", image = "object/mail_dsteel.png", + name = "dwarven-steel mail armour", level_range = {20, 30}, require = { stat = { str=28 }, }, cost = 30, @@ -73,7 +73,7 @@ newEntity{ base = "BASE_HEAVY_ARMOR", } newEntity{ base = "BASE_HEAVY_ARMOR", - name = "galvorn mail armour", image = "object/mail_galvorn.png", + name = "galvorn mail armour", level_range = {30, 40}, cost = 40, material_level = 4, @@ -86,7 +86,7 @@ newEntity{ base = "BASE_HEAVY_ARMOR", } newEntity{ base = "BASE_HEAVY_ARMOR", - name = "mithril mail armour", image = "object/mail_mithril.png", + name = "mithril mail armour", level_range = {40, 50}, require = { stat = { str=48 }, }, cost = 50, diff --git a/game/modules/tome/data/general/objects/heavy-boots.lua b/game/modules/tome/data/general/objects/heavy-boots.lua index c2b9aa277a6865775f08ad3dfc4eb748c774c86e..8f7b7870a684aa3653678705a6f3bbc46535411e 100644 --- a/game/modules/tome/data/general/objects/heavy-boots.lua +++ b/game/modules/tome/data/general/objects/heavy-boots.lua @@ -22,7 +22,7 @@ local Talents = require "engine.interface.ActorTalents" newEntity{ define_as = "BASE_HEAVY_BOOTS", slot = "FEET", - type = "armor", subtype="feet", + type = "armor", subtype="feet", image = resolvers.image_material("hboots", "metal"), add_name = " (#ARMOR#)", display = "]", color=colors.SLATE, require = { talent = { Talents.T_HEAVY_ARMOUR_TRAINING }, }, diff --git a/game/modules/tome/data/general/objects/helms.lua b/game/modules/tome/data/general/objects/helms.lua index a8034d71ef2d79d7234704bd8cc0a0f3e9e67bda..5454afc19c03fff227488e5b32ab3fad1791653c 100644 --- a/game/modules/tome/data/general/objects/helms.lua +++ b/game/modules/tome/data/general/objects/helms.lua @@ -24,7 +24,7 @@ newEntity{ slot = "HEAD", type = "armor", subtype="head", add_name = " (#ARMOR#)", - display = "]", color=colors.SLATE, + display = "]", color=colors.SLATE, image = resolvers.image_material("helm", "metal"), require = { talent = { Talents.T_HEAVY_ARMOUR_TRAINING }, }, encumber = 3, rarity = 7, diff --git a/game/modules/tome/data/general/objects/jewelry.lua b/game/modules/tome/data/general/objects/jewelry.lua index 9eb35692e94f85c8da0750267ff7b9b747c8ceb6..7a6fffaf3fba6fd4306196876e4feb1b2bf812af 100644 --- a/game/modules/tome/data/general/objects/jewelry.lua +++ b/game/modules/tome/data/general/objects/jewelry.lua @@ -20,7 +20,7 @@ newEntity{ define_as = "BASE_RING", slot = "FINGER", - type = "jewelry", subtype="ring", + type = "jewelry", subtype="ring", image = resolvers.image_material("ring", {"copper", "steel", "gold", "galvorn", "mithril"}), display = "=", encumber = 0.1, rarity = 6, @@ -31,7 +31,7 @@ newEntity{ newEntity{ define_as = "BASE_AMULET", slot = "NECK", - type = "jewelry", subtype="amulet", + type = "jewelry", subtype="amulet", image = resolvers.image_material("amulet", {"copper", "steel", "gold", "galvorn", "mithril"}), display = '"', encumber = 0.1, rarity = 8, diff --git a/game/modules/tome/data/general/objects/knifes.lua b/game/modules/tome/data/general/objects/knifes.lua index c2a58c0f83c2086d5fa5be770a601ae7c28ef01f..d8b06364e005a3a28da0d3019348e4399fec5799 100644 --- a/game/modules/tome/data/general/objects/knifes.lua +++ b/game/modules/tome/data/general/objects/knifes.lua @@ -22,7 +22,7 @@ newEntity{ slot = "MAINHAND", offslot = "OFFHAND", type = "weapon", subtype="dagger", add_name = " (#COMBAT#)", - display = "/", color=colors.WHITE, + display = "/", color=colors.WHITE, image = resolvers.image_material("knife", "metal"), encumber = 1, rarity = 5, metallic = true, diff --git a/game/modules/tome/data/general/objects/leather-boots.lua b/game/modules/tome/data/general/objects/leather-boots.lua index b401e21fb7a796e8a7f356b1928cc54e0ad8f016..cb848b8bd6010172391df9277268187d978f4bdb 100644 --- a/game/modules/tome/data/general/objects/leather-boots.lua +++ b/game/modules/tome/data/general/objects/leather-boots.lua @@ -22,7 +22,7 @@ newEntity{ slot = "FEET", type = "armor", subtype="feet", add_name = " (#ARMOR#)", - display = "]", color=colors.UMBER, + display = "]", color=colors.UMBER, image = resolvers.image_material("boots", "leather"), encumber = 2, rarity = 6, desc = [[A pair of boots made of leather.]], diff --git a/game/modules/tome/data/general/objects/leather-caps.lua b/game/modules/tome/data/general/objects/leather-caps.lua index a4b83f74ac251e289081099c98ce30c5fa588d12..084b96bb18add244595bb187787e92e3a1dff480 100644 --- a/game/modules/tome/data/general/objects/leather-caps.lua +++ b/game/modules/tome/data/general/objects/leather-caps.lua @@ -22,7 +22,7 @@ newEntity{ slot = "HEAD", type = "armor", subtype="head", add_name = " (#ARMOR#)", - display = "]", color=colors.UMBER, + display = "]", color=colors.UMBER, image = resolvers.image_material("cap", "leather"), encumber = 2, rarity = 6, desc = [[A cap made of leather.]], diff --git a/game/modules/tome/data/general/objects/light-armors.lua b/game/modules/tome/data/general/objects/light-armors.lua index 6e0a45462ab9d04e0d611ca9f1d9cd5247f620e1..622fdaa5c4efe50c04679780b1f6ab3a1b01b975 100644 --- a/game/modules/tome/data/general/objects/light-armors.lua +++ b/game/modules/tome/data/general/objects/light-armors.lua @@ -22,7 +22,7 @@ newEntity{ slot = "BODY", type = "armor", subtype="light", add_name = " (#ARMOR#)", - display = "[", color=colors.SLATE, + display = "[", color=colors.SLATE, image = resolvers.image_material("leather", "leather"), encumber = 17, rarity = 5, desc = [[A suit of armour made of leather.]], diff --git a/game/modules/tome/data/general/objects/lites.lua b/game/modules/tome/data/general/objects/lites.lua index e75aa4f2a22bab8971b895be9762a91b0874bec5..a5e8c8af193018cddac18a9f581c3ff626e7379b 100644 --- a/game/modules/tome/data/general/objects/lites.lua +++ b/game/modules/tome/data/general/objects/lites.lua @@ -20,7 +20,7 @@ newEntity{ define_as = "BASE_LITE", slot = "LITE", - type = "lite", subtype="lite", + type = "lite", subtype="lite", image = resolvers.image_material("lite", {"brass","","dwarven","","faenorian"}), display = "~", desc = [[Lite up the dark places of the world!]], egos = "/data/general/objects/egos/lite.lua", egos_chance = { prefix=resolvers.mbonus(15, 3), suffix=resolvers.mbonus(15, 3) }, diff --git a/game/modules/tome/data/general/objects/maces.lua b/game/modules/tome/data/general/objects/maces.lua index 903bfd685587599ecf12ddee51a1891d13c33405..a016ec83c619c5f13ba76079cd80c54086ac53a9 100644 --- a/game/modules/tome/data/general/objects/maces.lua +++ b/game/modules/tome/data/general/objects/maces.lua @@ -22,7 +22,7 @@ newEntity{ slot = "MAINHAND", type = "weapon", subtype="mace", add_name = " (#COMBAT#)", - display = "/", color=colors.SLATE, + display = "/", color=colors.SLATE, image = resolvers.image_material("mace", "metal"), encumber = 3, rarity = 5, metallic = true, diff --git a/game/modules/tome/data/general/objects/massive-armors.lua b/game/modules/tome/data/general/objects/massive-armors.lua index e3f2dec27045a5a53447ad29a5da25d2705265a9..01d0d3d7130d2ebca6c5a4188e36bb9016db7e7b 100644 --- a/game/modules/tome/data/general/objects/massive-armors.lua +++ b/game/modules/tome/data/general/objects/massive-armors.lua @@ -24,7 +24,7 @@ newEntity{ slot = "BODY", type = "armor", subtype="massive", add_name = " (#ARMOR#)", - display = "[", color=colors.SLATE, + display = "[", color=colors.SLATE, image = resolvers.image_material("plate", "metal"), require = { talent = { Talents.T_MASSIVE_ARMOUR_TRAINING }, }, encumber = 17, rarity = 5, @@ -34,7 +34,7 @@ newEntity{ } newEntity{ base = "BASE_MASSIVE_ARMOR", - name = "iron plate armour", image = "object/plate_iron.png", + name = "iron plate armour", level_range = {1, 10}, require = { stat = { str=22 }, }, cost = 20, @@ -47,7 +47,7 @@ newEntity{ base = "BASE_MASSIVE_ARMOR", } newEntity{ base = "BASE_MASSIVE_ARMOR", - name = "steel plate armour", image = "object/plate_steel.png", + name = "steel plate armour", level_range = {10, 20}, require = { stat = { str=28 }, }, cost = 25, @@ -60,7 +60,7 @@ newEntity{ base = "BASE_MASSIVE_ARMOR", } newEntity{ base = "BASE_MASSIVE_ARMOR", - name = "dwarven-steel plate armour", image = "object/plate_dsteel.png", + name = "dwarven-steel plate armour", level_range = {20, 30}, require = { stat = { str=35 }, }, cost = 30, @@ -73,7 +73,7 @@ newEntity{ base = "BASE_MASSIVE_ARMOR", } newEntity{ base = "BASE_MASSIVE_ARMOR", - name = "galvorn plate armour", image = "object/plate_galvorn.png", + name = "galvorn plate armour", level_range = {30, 40}, cost = 40, material_level = 4, @@ -86,7 +86,7 @@ newEntity{ base = "BASE_MASSIVE_ARMOR", } newEntity{ base = "BASE_MASSIVE_ARMOR", - name = "mithril plate armour", image = "object/plate_mithril.png", + name = "mithril plate armour", level_range = {40, 50}, require = { stat = { str=60 }, }, cost = 50, diff --git a/game/modules/tome/data/general/objects/mummy-wrappings.lua b/game/modules/tome/data/general/objects/mummy-wrappings.lua index 1f98dba086b75f565dd9228dde3b2429550a0eb5..c9ca53045a856eac01dc4097a36fcbc94fc9bb33 100644 --- a/game/modules/tome/data/general/objects/mummy-wrappings.lua +++ b/game/modules/tome/data/general/objects/mummy-wrappings.lua @@ -24,7 +24,7 @@ newEntity{ slot = "BODY", type = "armor", subtype="mummy", add_name = " (#ARMOR#)", - display = "[", color=colors.ANTIQUE_WHITE, + display = "[", color=colors.ANTIQUE_WHITE, image="object/mummy_wrappings.png" encumber = 6, rarity = 5, desc = [[Decaying mummy wrappings.]], diff --git a/game/modules/tome/data/general/objects/quest-artifacts.lua b/game/modules/tome/data/general/objects/quest-artifacts.lua index 69e8a51bbb3692f414eaeed4fd052abaaae3f887..98e382b19a420d774ed1d48d9dc1088e0735e37d 100644 --- a/game/modules/tome/data/general/objects/quest-artifacts.lua +++ b/game/modules/tome/data/general/objects/quest-artifacts.lua @@ -25,7 +25,7 @@ newEntity{ define_as = "STAFF_ABSORPTION", unided_name = "dark runed staff", name = "Staff of Absorption", level_range = {30, 30}, - display = "\\", color=colors.VIOLET, + display = "\\", color=colors.VIOLET, image = "object/staff_dragonbone.png", encumber = 7, desc = [[Carved with runes of power, this staff seems to have been made long ago. Yet it bears no signs of tarnishment. Light around it seems to dim and you can feel its tremendous power simply by touching it.]], @@ -69,7 +69,7 @@ newEntity{ define_as = "ORB_MANY_WAYS", unided_name = "swirling orb", name = "Orb of Many Ways", level_range = {30, 30}, - display = "*", color=colors.VIOLET, + display = "*", color=colors.VIOLET, image = "object/pearl.png", encumber = 1, desc = [[The orb projects images of distance places, some that seem to not be of this world, switching rapidly. If used near a portal it could probably activate it.]], @@ -104,7 +104,7 @@ newEntity{ define_as = "ORB_UNDEATH", unided_name = "orb of command", name = "Orb of Undeath (Orb of Command)", level_range = {50, 50}, - display = "*", color=colors.VIOLET, + display = "*", color=colors.VIOLET, image = "object/pearl.png", encumber = 1, desc = [[Dark visions fill you mind as you lift the orb. It is cold to the touch.]], @@ -123,7 +123,7 @@ newEntity{ define_as = "ORB_DRAGON", unided_name = "orb of command", name = "Dragon Orb (Orb of Command)", level_range = {50, 50}, - display = "*", color=colors.VIOLET, + display = "*", color=colors.VIOLET, image = "object/pearl.png", encumber = 1, desc = [[This orb is warm to the touch.]], @@ -142,7 +142,7 @@ newEntity{ define_as = "ORB_ELEMENTS", unided_name = "orb of command", name = "Elemental Orb (Orb of Command)", level_range = {50, 50}, - display = "*", color=colors.VIOLET, + display = "*", color=colors.VIOLET, image = "object/pearl.png", encumber = 1, desc = [[Flames swirl on the icy surface of this orb.]], @@ -161,7 +161,7 @@ newEntity{ define_as = "ORB_DESTRUCTION", unided_name = "orb of command", name = "Orb of Destruction (Orb of Command)", level_range = {50, 50}, - display = "*", color=colors.VIOLET, + display = "*", color=colors.VIOLET, image = "object/pearl.png", encumber = 1, desc = [[Visions of death and destruction fill your mind as you lift this orb.]], diff --git a/game/modules/tome/data/general/objects/scrolls.lua b/game/modules/tome/data/general/objects/scrolls.lua index 3044c227594d4ef9d0547a953e9ee6095d407642..54fdf32ed12f6da55d198d6890bede310ac67f05 100644 --- a/game/modules/tome/data/general/objects/scrolls.lua +++ b/game/modules/tome/data/general/objects/scrolls.lua @@ -21,7 +21,7 @@ newEntity{ define_as = "BASE_SCROLL", type = "scroll", subtype="scroll", unided_name = "scroll", id_by_type = true, - display = "?", color=colors.WHITE, image="object/scroll-0x0.png", + display = "?", color=colors.WHITE, image="object/scroll.png", encumber = 0.1, stacking = true, use_sound = "actions/read", diff --git a/game/modules/tome/data/general/objects/shields.lua b/game/modules/tome/data/general/objects/shields.lua index aaece6191171b37125bf139ac47ff40780bb46ad..51e73f36124e13c0cf79e43cb783bd8402455f51 100644 --- a/game/modules/tome/data/general/objects/shields.lua +++ b/game/modules/tome/data/general/objects/shields.lua @@ -22,7 +22,7 @@ newEntity{ slot = "OFFHAND", type = "armor", subtype="shield", add_name = " (#ARMOR#)", - display = ")", color=colors.UMBER, + display = ")", color=colors.UMBER, image = resolvers.image_material("shield", "metal"), rarity = 5, encumber = 7, metallic = true, diff --git a/game/modules/tome/data/general/objects/slings.lua b/game/modules/tome/data/general/objects/slings.lua index c1bf3faf5462273bc17e028664d5bd9832afdf4a..b600aad5a347ea70e5b6ef8a542f40625a29fecb 100644 --- a/game/modules/tome/data/general/objects/slings.lua +++ b/game/modules/tome/data/general/objects/slings.lua @@ -21,7 +21,7 @@ newEntity{ define_as = "BASE_SLING", slot = "MAINHAND", type = "weapon", subtype="sling", - display = "}", color=colors.UMBER, + display = "}", color=colors.UMBER, image = resolvers.image_material("sling", "leather"), encumber = 4, rarity = 5, combat = { talented = "sling", sound = "actions/arrow", sound_miss = "actions/arrow", }, @@ -97,7 +97,7 @@ newEntity{ slot = "QUIVER", type = "ammo", subtype="shot", add_name = " (#COMBAT#)", - display = "{", color=colors.UMBER, + display = "{", color=colors.UMBER, image = resolvers.image_material("shot", "metal"), encumber = 0.03, rarity = 5, combat = { talented = "sling", damrange = 1.2}, diff --git a/game/modules/tome/data/general/objects/staves.lua b/game/modules/tome/data/general/objects/staves.lua index 4c8c51ccfbc7d596f5ce990e7f23ad7ae69e6d51..65eba5c8fdf563c55ff4b5cf0ef3da745490f357 100644 --- a/game/modules/tome/data/general/objects/staves.lua +++ b/game/modules/tome/data/general/objects/staves.lua @@ -23,7 +23,7 @@ newEntity{ slot_forbid = "OFFHAND", type = "weapon", subtype="staff", add_name = " (#COMBAT_DAMTYPE#)", - display = "\\", color=colors.LIGHT_RED, + display = "\\", color=colors.LIGHT_RED, image = resolvers.image_material("staff", "wood"), encumber = 5, rarity = 4, combat = { diff --git a/game/modules/tome/data/general/objects/swords.lua b/game/modules/tome/data/general/objects/swords.lua index 77337a722caff3668a237b18ff12e344a6329789..4ac693dee4a880e854119ff6f77fd8918d85dd05 100644 --- a/game/modules/tome/data/general/objects/swords.lua +++ b/game/modules/tome/data/general/objects/swords.lua @@ -22,7 +22,7 @@ newEntity{ slot = "MAINHAND", type = "weapon", subtype="longsword", add_name = " (#COMBAT#)", - display = "/", color=colors.SLATE, + display = "/", color=colors.SLATE, image = resolvers.image_material("sword", "metal"), encumber = 3, rarity = 5, metallic = true, diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua index a82bdc7b05f02c16ded8258189a2fa3b66c99e6b..c85d8bbd8f1d05b8e0c78dba9cffe5b26f4a2cab 100644 --- a/game/modules/tome/data/general/objects/world-artifacts.lua +++ b/game/modules/tome/data/general/objects/world-artifacts.lua @@ -29,6 +29,7 @@ newEntity{ base = "BASE_STAFF", rarity = 100, desc = [[This unique looking staff is carved with runes of destruction.]], cost = 500, + material_level = 3, require = { stat = { mag=24 }, }, combat = { @@ -54,6 +55,7 @@ newEntity{ base = "BASE_RING", level_range = {10, 20}, rarity = 150, cost = 500, + material_level = 2, max_power = 60, power_regen = 1, use_power = { name = "summon a tidal wave", power = 60, @@ -95,6 +97,7 @@ newEntity{ base = "BASE_RING", level_range = {15, 30}, rarity = 150, cost = 500, + material_level = 3, wielder = { inc_stats = { [Stats.STAT_CUN] = 3, }, diff --git a/game/modules/tome/data/gfx/object/arrow_elvenyew.png b/game/modules/tome/data/gfx/object/arrow_elvenyew.png deleted file mode 100644 index a258329c8d5ea726e5207a85ca701ab8919ab5c4..0000000000000000000000000000000000000000 Binary files a/game/modules/tome/data/gfx/object/arrow_elvenyew.png and /dev/null differ diff --git a/game/modules/tome/data/gfx/object/longbow_elvenyew.png b/game/modules/tome/data/gfx/object/longbow_elvenyew.png deleted file mode 100644 index 953b78166f332b25a94416dd54ce2b85529a85e3..0000000000000000000000000000000000000000 Binary files a/game/modules/tome/data/gfx/object/longbow_elvenyew.png and /dev/null differ diff --git a/game/modules/tome/data/gfx/object/robe_woolen.png b/game/modules/tome/data/gfx/object/robe_woolen.png deleted file mode 100644 index 38d036f7b898a7c426ca0c79b26f689b7634ed7c..0000000000000000000000000000000000000000 Binary files a/game/modules/tome/data/gfx/object/robe_woolen.png and /dev/null differ diff --git a/game/modules/tome/resolvers.lua b/game/modules/tome/resolvers.lua index db989a6c84bdd1efd1a549ff7817d78edbef4faa..1b9225e0ba445072ac9e1db3f4fb2c1ad77d0d51 100644 --- a/game/modules/tome/resolvers.lua +++ b/game/modules/tome/resolvers.lua @@ -206,3 +206,16 @@ function resolvers.calc.random_use_talent(tt, e) e.cost = e.cost + level * 2 return { id=tid, level=level, power=tt[2] } end + +--- Image based on material level +function resolvers.image_material(image, values) + return {__resolver="image_material", image, values} +end +function resolvers.calc.image_material(t, e) + if not t[2] or (type(t[2]) == "string" and t[2] == "metal") then t[2] = {"iron", "steel", "dsteel", "galvorn", "mithril"} end + if type(t[2]) == "string" and t[2] == "leather" then t[2] = {"rough", "cured", "hardened", "reinforced", "drakeskin"} end + if type(t[2]) == "string" and t[2] == "wood" then t[2] = {"elm","ash","yew","elvenwood","dragonbone"} end + if type(t[2]) == "string" and t[2] == "cloth" then t[2] = {"linen","woolen","cashmere","silk","elvensilk"} end + local ml = e.material_level or 1 + return "object/"..t[1].."_"..t[2][ml]..".png" +end diff --git a/src/core_lua.c b/src/core_lua.c index 819f61e3683af08f8a89021acccd96340a4223d3..b8e749165129273f7789bd4765132b0214057949 100644 --- a/src/core_lua.c +++ b/src/core_lua.c @@ -1229,6 +1229,12 @@ static int gl_fbo_toscreen(lua_State *L) return 0; } +static int gl_fbo_is_active(lua_State *L) +{ + lua_pushboolean(L, fbo_active); + return 1; +} + static const struct luaL_reg displaylib[] = { @@ -1239,6 +1245,7 @@ static const struct luaL_reg displaylib[] = {"newSurface", sdl_new_surface}, {"newTile", sdl_new_tile}, {"newFBO", gl_new_fbo}, + {"FBOActive", gl_fbo_is_active}, {"drawStringNewSurface", sdl_surface_drawstring_newsurface}, {"drawStringBlendedNewSurface", sdl_surface_drawstring_newsurface_aa}, {"loadImage", sdl_load_image}, diff --git a/src/map.c b/src/map.c index 7b8b605eda885bddbbe418fc8bdbd7ceb6d3d65d..2db407e5bb7a739ae200a2db239d9d2454c7b46b 100644 --- a/src/map.c +++ b/src/map.c @@ -31,6 +31,14 @@ //#include "shaders.h" #include "useshader.h" +#define DO_QUAD(dx, dy, dz, zoom) {\ + glBegin(GL_QUADS); \ + glTexCoord2f(0,0); glVertex3f((dx), (dy), (dz)); \ + glTexCoord2f(1,0); glVertex3f(map->tile_w * (zoom) + (dx), (dy), (dz)); \ + glTexCoord2f(1,1); glVertex3f(map->tile_w * (zoom) + (dx), map->tile_h * (zoom) + (dy), (dz)); \ + glTexCoord2f(0,1); glVertex3f((dx), map->tile_h * (zoom) + (dy), (dz)); \ + glEnd(); } + static int map_object_new(lua_State *L) { int nb_textures = luaL_checknumber(L, 1); @@ -120,6 +128,41 @@ static int map_object_is_valid(lua_State *L) return 1; } +static int map_object_display(lua_State *L) +{ + map_object *m = (map_object*)auxiliar_checkclass(L, "core{mapobj}", 1); + SDL_Surface **s = (SDL_Surface**)auxiliar_checkclass(L, "sdl{surface}", 2); + int dx = luaL_checknumber(L, 3); + int dy = luaL_checknumber(L, 4); + int w = luaL_checknumber(L, 5); + int h = luaL_checknumber(L, 6); + float r = luaL_checknumber(L, 7); + float g = luaL_checknumber(L, 8); + float b = luaL_checknumber(L, 9); + float a = luaL_checknumber(L, 10); + + glColor4f(r, g, b, (a > 1) ? 1 : ((a < 0) ? 0 : a)); + + int z; + if (m->shader) useShader(m->shader, 1, 1, 1,1, r, g, b, a); + for (z = (!shaders_active) ? 0 : (m->nb_textures - 1); z >= 0; z--) + { + if (multitexture_active && shaders_active) glActiveTexture(GL_TEXTURE0+z); + glBindTexture(m->textures_is3d[z] ? GL_TEXTURE_3D : GL_TEXTURE_2D, m->textures[z]); + } + + int dz = 99; + glBegin(GL_QUADS); + glTexCoord2f(0,0); glVertex3f((dx), (dy), (dz)); + glTexCoord2f(1,0); glVertex3f(w + (dx), (dy), (dz)); + glTexCoord2f(1,1); glVertex3f(w + (dx), h + (dy), (dz)); + glTexCoord2f(0,1); glVertex3f((dx), h + (dy), (dz)); + glEnd(); + + if (m->shader) glUseProgramObjectARB(0); + return 0; +} + // Minimap defines #define MM_FLOOR 1 @@ -382,14 +425,6 @@ static int map_set_scroll(lua_State *L) return 0; } -#define DO_QUAD(dx, dy, dz, zoom) {\ - glBegin(GL_QUADS); \ - glTexCoord2f(0,0); glVertex3f((dx), (dy), (dz)); \ - glTexCoord2f(1,0); glVertex3f(map->tile_w * (zoom) + (dx), (dy), (dz)); \ - glTexCoord2f(1,1); glVertex3f(map->tile_w * (zoom) + (dx), map->tile_h * (zoom) + (dy), (dz)); \ - glTexCoord2f(0,1); glVertex3f((dx), map->tile_h * (zoom) + (dy), (dz)); \ - glEnd(); } - inline void display_map_quad(map_type *map, int dx, int dy, float dz, map_object *m, int i, int j, float a, bool obscure) ALWAYS_INLINE; void display_map_quad(map_type *map, int dx, int dy, float dz, map_object *m, int i, int j, float a, bool obscure) @@ -665,6 +700,7 @@ static const struct luaL_reg map_object_reg[] = {"shader", map_object_shader}, {"invalidate", map_object_invalid}, {"isValid", map_object_is_valid}, + {"display", map_object_display}, {NULL, NULL}, };