diff --git a/game/engines/default/engine/Entity.lua b/game/engines/default/engine/Entity.lua index b627c54fb1aaf6c36c709ddf673805f3dac26a6c..0d1a702f87c01b4a0f36db0ecffd46f826b7793f 100644 --- a/game/engines/default/engine/Entity.lua +++ b/game/engines/default/engine/Entity.lua @@ -168,7 +168,7 @@ function _M:makeMapObject(tiles, idx) end -- Create the map object with 1 + additional textures - self._mo = core.map.newObject( + self._mo = core.map.newObject(self.uid, 1 + (tiles.use_images and self.textures and #self.textures or 0), self:check("display_on_seen"), self:check("display_on_remember"), diff --git a/game/engines/default/engine/Zone.lua b/game/engines/default/engine/Zone.lua index b0ff7cd431be2a78e269bf8578abe329967abd7f..53fd49951d9cc42962eea43a5425072e43e4c6e0 100644 --- a/game/engines/default/engine/Zone.lua +++ b/game/engines/default/engine/Zone.lua @@ -153,8 +153,9 @@ function _M:checkFilter(e, filter) if filter.type and filter.type ~= e.type then return false end if filter.subtype and filter.subtype ~= e.subtype then return false end if filter.name and filter.name ~= e.name then return false end - if e.checkFilter and not e:checkFilter(filter) then return end - if filter.special and not filter.special(e) then return end + if e.checkFilter and not e:checkFilter(filter) then return false end + if filter.special and not filter.special(e) then return false end + if filter.max_ood and resolvers.current_level and e.level_range and resolvers.current_level + filter.max_ood < e.level_range[1] then print("Refused max_ood", e.name, e.level_range[1]) return false end if e.unique then print("accepted unique", e.name, e.__CLASSNAME.."/"..e.unique) end diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 43e819962d8958bcb2599a04f75096d2cead0c71..4bce13d8ad380729e281390323de386d45edcb74 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -818,11 +818,24 @@ function _M:getMaxEncumbrance() end function _M:getEncumbrance() - -- Compute encumbrance local enc = 0 + + local fct = function(so) enc = enc + so.encumber end + if self:knowTalent(self.T_EFFICIENT_PACKING) then + local reduction = 1 - self:getTalentLevel(self.T_EFFICIENT_PACKING) * 0.1 + fct = function(so) + if so.encumber <= 1 then + enc = enc + so.encumber * reduction + else + enc = enc + so.encumber + end + end + end + + -- Compute encumbrance for inven_id, inven in pairs(self.inven) do for item, o in ipairs(inven) do - o:forAllStack(function(so) enc = enc + so.encumber end) + o:forAllStack(fct) end end -- print("Total encumbrance", enc) @@ -1120,6 +1133,15 @@ function _M:breakStealth() end end +--- Pack Rat chance +function _M:doesPackRat() + if self:knowTalent(self.T_PACK_RAT) then + local chance = 10 + self:getTalentLevel(self.T_PACK_RAT) * 7 + if rng.percent(chance) then return true end + end + return false +end + --- Return the full description of a talent -- You may overload it to add more data (like power usage, ...) function _M:getTalentFullDescription(t, addlevel) diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index b890205c6a8a41a0eb48aff1b256e24819a5fab7..038cb963db425afc797aaca3aebb8d7ac8b7ba27 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -523,21 +523,24 @@ function _M:playerUseItem(object, item, inven) local co = coroutine.create(function() self.changed = true local ret, no_id = o:use(self) - print(ret,no_id) if not no_id then o:identify(true) end if ret and ret == "destroy" then - if o.multicharge and o.multicharge > 1 then - o.multicharge = o.multicharge - 1 + if self:doesPackRat() then + game.logPlayer(self, "Pack Rat!") else - local _, del = self:removeObject(self:getInven(inven), item) - if del then - game.log("You have no more %s.", o:getName{no_count=true, do_color=true}) + if o.multicharge and o.multicharge > 1 then + o.multicharge = o.multicharge - 1 else - game.log("You have %s.", o:getName{do_color=true}) + local _, del = self:removeObject(self:getInven(inven), item) + if del then + game.log("You have no more %s.", o:getName{no_count=true, do_color=true}) + else + game.log("You have %s.", o:getName{do_color=true}) + end + self:sortInven(self:getInven(inven)) end - self:sortInven(self:getInven(inven)) end return true end diff --git a/game/modules/tome/class/interface/Archery.lua b/game/modules/tome/class/interface/Archery.lua index c326e7afa5a258cd7899dccfac22bf0e7f1012e9..0deb0a541510d4b01e814aecd62517e0d8f6ca4f 100644 --- a/game/modules/tome/class/interface/Archery.lua +++ b/game/modules/tome/class/interface/Archery.lua @@ -52,7 +52,12 @@ function _M:archeryAcquireTargets(tg, params) -- Find targets to know how many ammo we use local targets = {} if params.one_shot then - local ammo = self:removeObject(self:getInven("QUIVER"), 1) + local ammo + if self:doesPackRat() then + ammo = self:getInven("QUIVER")[1] + else + ammo = self:removeObject(self:getInven("QUIVER"), 1) + end if ammo then targets = {{x=x, y=y, ammo=ammo.combat}} end @@ -70,7 +75,13 @@ function _M:archeryAcquireTargets(tg, params) end for i = 1, params.multishots or 1 do - local ammo = self:removeObject(self:getInven("QUIVER"), 1) + local ammo + if self:doesPackRat() then + game.logPlayer(self, "Pack Rat!") + ammo = self:getInven("QUIVER")[1] + else + ammo = self:removeObject(self:getInven("QUIVER"), 1) + end if ammo then targets[#targets+1] = {x=tx, y=ty, ammo=ammo.combat} else break end end diff --git a/game/modules/tome/data/birth/classes/archer.lua b/game/modules/tome/data/birth/classes/archer.lua index d47caf4018ebe7caf9598c1a5c1c2fb9e17fc9b3..bf9589a254ea73690a3c79e67d2a40803ccde2f5 100644 --- a/game/modules/tome/data/birth/classes/archer.lua +++ b/game/modules/tome/data/birth/classes/archer.lua @@ -55,6 +55,7 @@ newBirthDescriptor{ ["technique/combat-techniques-passive"]={false, -0.1}, ["technique/combat-training"]={true, 0.3}, ["cunning/survival"]={true, 0}, + ["cunning/packing"]={true, 0.2}, ["cunning/dirty"]={false, 0}, }, talents = { @@ -89,6 +90,7 @@ newBirthDescriptor{ ["technique/combat-techniques-passive"]={false, -0.1}, ["technique/combat-training"]={true, 0.3}, ["cunning/survival"]={true, 0}, + ["cunning/packing"]={true, 0.2}, ["cunning/dirty"]={false, 0}, }, talents = { diff --git a/game/modules/tome/data/birth/classes/rogue.lua b/game/modules/tome/data/birth/classes/rogue.lua index 152783eb0c7d604d0caa910b8414edfd2a1a3f99..bbeb06f79bdd9ab6d91d58831b3244bbf336bafd 100644 --- a/game/modules/tome/data/birth/classes/rogue.lua +++ b/game/modules/tome/data/birth/classes/rogue.lua @@ -63,6 +63,7 @@ newBirthDescriptor{ ["cunning/dirty"]={true, 0.3}, ["cunning/lethality"]={true, 0.3}, ["cunning/survival"]={true, 0.3}, + ["cunning/packing"]={false, 0.1}, }, talents = { [ActorTalents.T_STEALTH] = 1, diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua index 22c69dbd1ae91f7594406c98fdaacdd996dbf56a..38a5824611cd7502e450338b01a1f7df7eebd2ef 100644 --- a/game/modules/tome/data/damage_types.lua +++ b/game/modules/tome/data/damage_types.lua @@ -88,11 +88,17 @@ end) local function tryDestroy(who, inven, dam, destroy_prop, proof_prop, msg) if not inven then return end + + local reduction = 1 + if who:knowTalent(who.T_INSULATING_PACKING) then + reduction = who:getTalentLevel(who.T_INSULATING_PACKING) * 0.14 + end + for i = #inven, 1, -1 do local o = inven[i] if o[destroy_prop] and not o[proof_prop] then for j, test in ipairs(o[destroy_prop]) do - if dam >= test[1] and rng.percent(test[2]) then + if dam >= test[1] and rng.percent(test[2] * reduction) then game.logPlayer(who, msg, o:getName{do_color=true, no_count=true}) local obj = who:removeObject(inven, i) obj:removed() diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua index c2ebad0696e8376c1cabc7efb48c286c35be614c..c7847e59bc8bdbfaa24391c5e95df54f8bb5d92a 100644 --- a/game/modules/tome/data/general/objects/world-artifacts.lua +++ b/game/modules/tome/data/general/objects/world-artifacts.lua @@ -317,7 +317,7 @@ newEntity{ base = "BASE_LONGSWORD", newEntity{ base = "BASE_LEATHER_BOOT", unique = true, name = "Boots of Tom Bombadil", - uided_name = "pair of yellow boots", + unided_name = "pair of yellow boots", desc = [[Old Tom Bombadil is a merry fellow. Bright blue his jacket is, and his boots are yellow.]], color = colors.YELLOW, diff --git a/game/modules/tome/data/quests/escort-duty.lua b/game/modules/tome/data/quests/escort-duty.lua index 7c3507e69de0707f524a2e6ab2366c39e19557ce..4ee0b2eb7999255bcda08c279d013861702123b8 100644 --- a/game/modules/tome/data/quests/escort-duty.lua +++ b/game/modules/tome/data/quests/escort-duty.lua @@ -256,6 +256,7 @@ local function getPortalSpot(npc, dist, min_dist) if game.level.map:isBound(i, j) and core.fov.distance(npc.x, npc.y, i, j) <= dist and core.fov.distance(npc.x, npc.y, i, j) >= min_dist and + game.level.map(i, j, engine.Map.TERRAIN) and not game.level.map(i, j, engine.Map.TERRAIN).change_level and npc:canMove(i, j) then poss[#poss+1] = {i,j} end diff --git a/game/modules/tome/data/talents/cunning/cunning.lua b/game/modules/tome/data/talents/cunning/cunning.lua index 3112ad60f37843e5e62fa0c4e7dc1e604d398508..943fda27644cbb93957da6e5537f4a649ef302a7 100644 --- a/game/modules/tome/data/talents/cunning/cunning.lua +++ b/game/modules/tome/data/talents/cunning/cunning.lua @@ -22,8 +22,9 @@ newTalentType{ type="cunning/stealth", name = "stealth", description = "Allows t newTalentType{ type="cunning/trapping", name = "trapping", description = "The knowledge of trap laying." } newTalentType{ type="cunning/dirty", name = "dirty fighting", description = "Teaches various talents to cripple your foes." } newTalentType{ type="cunning/lethality", name = "lethality", description = "How to make your foes feel the pain." } -newTalentType{ type="cunning/survival", name = "survival", generic = true, description = "The knowledge of the dangers of the world, and how to best avoid them." } newTalentType{ type="cunning/shadow-magic", name = "shadow magic", description = "Blending magic and shadows." } +newTalentType{ type="cunning/survival", name = "survival", generic = true, description = "The knowledge of the dangers of the world, and how to best avoid them." } +newTalentType{ type="cunning/packing", name = "packing", generic = true, description = "Learn to optimize your carrying capacity and even how to protect fragile items." } -- Generic requires for cunning based on talent level cuns_req1 = { @@ -52,4 +53,5 @@ load("/data/talents/cunning/traps.lua") load("/data/talents/cunning/dirty.lua") load("/data/talents/cunning/lethality.lua") load("/data/talents/cunning/survival.lua") +load("/data/talents/cunning/packing.lua") load("/data/talents/cunning/shadow-magic.lua") diff --git a/game/modules/tome/data/talents/cunning/packing.lua b/game/modules/tome/data/talents/cunning/packing.lua new file mode 100644 index 0000000000000000000000000000000000000000..8e07fc5487239ee3be3a3abec95e6d7fb6c824c3 --- /dev/null +++ b/game/modules/tome/data/talents/cunning/packing.lua @@ -0,0 +1,82 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +newTalent{ + name = "Efficient Packing", + type = {"cunning/packing", 1}, + require = cuns_req1, + mode = "passive", + points = 5, + on_learn = function(self, t) + self:checkEncumbrance() + end, + on_unlearn = function(self, t) + self:checkEncumbrance() + end, + info = function(self, t) + return ([[Arrange your small items (of one or less encumberance value) to gain space, reducing their encumberance by %d%%.]]): + format(self:getTalentLevel(t) * 10) + end, +} + +newTalent{ + name = "Insulating Packing", + type = {"cunning/packing", 2}, + require = cuns_req2, + mode = "passive", + points = 5, + on_learn = function(self, t) + self.heightened_senses = 4 + math.ceil(self:getTalentLevel(t)) + end, + on_unlearn = function(self, t) + if self:knowTalent(t) then + self.heightened_senses = 4 + math.ceil(self:getTalentLevel(t)) + else + self.heightened_senses = nil + end + end, + info = function(self, t) + return ([[Arrange your items in better way, protecting those can can easily be destroyed reducing their chance to be destroyed by %d%%.]]): + format(self:getTalentLevel(t) * 14) + end, +} + +newTalent{ + name = "Burden Management", + type = {"cunning/packing", 3}, + require = cuns_req3, + mode = "passive", + points = 5, + info = function(self, t) + return ([[You have learnt to disarm traps (%d disarm power).]]): + format(self:getTalentLevel(t) * self:getCun(25)) + end, +} + +newTalent{ + name = "Pack Rat", + type = {"cunning/packing", 4}, + points = 5, + require = cuns_req4, + mode = "passive", + info = function(self, t) + return ([[Your pack is bigger than you remember, when you use a scroll/potion/ammo you have %d%% to find a new one in your pack.]]): + format(10 + self:getTalentLevel(t) * 7) + end, +} diff --git a/game/modules/tome/data/talents/spells/conveyance.lua b/game/modules/tome/data/talents/spells/conveyance.lua index 754e6d26c887f2085e8adac283db9e256f79780c..06cca04e45e1d4a8b91fb4521c5c117d1057e631 100644 --- a/game/modules/tome/data/talents/spells/conveyance.lua +++ b/game/modules/tome/data/talents/spells/conveyance.lua @@ -77,9 +77,9 @@ newTalent{ end, info = function(self, t) return ([[Teleports you randomly with a small range (%d). - At level 4 it allows one to choose the target area. + At level 4 it allows one to choose the target area (radius %d). At level 5 it allows one to specify the exact target. - The range will increase with the Magic stat]]):format(10 + self:combatSpellpower(0.1)) + The range will increase with the Magic stat]]):format(10 + self:combatSpellpower(0.1), 7 - self:getTalentLevel(t)) end, } @@ -145,9 +145,9 @@ newTalent{ end, info = function(self, t) return ([[Teleports you randomly with a large range (%d), with a minimum range of 15. - At level 4 it allows one to choose the target area. + At level 4 it allows one to choose the target area (radius %d). At level 5 it allows one to specify the exact target. - The range will increase with the Magic stat]]):format(100 + self:combatSpellpower(0.1)) + The range will increase with the Magic stat]]):format(100 + self:combatSpellpower(0.1), 20 - self:getTalentLevel(t)) end, } diff --git a/game/modules/tome/data/zones/paths-of-the-dead/zone.lua b/game/modules/tome/data/zones/paths-of-the-dead/zone.lua index 81ab623f97e3a7eb54927412c7d7ffe97b86e63b..4d13b5bb744bc955659d69b1c67345ba66773c12 100644 --- a/game/modules/tome/data/zones/paths-of-the-dead/zone.lua +++ b/game/modules/tome/data/zones/paths-of-the-dead/zone.lua @@ -46,12 +46,13 @@ return { actor = { class = "engine.generator.actor.Random", nb_npc = {20, 30}, + filters = { {max_ood=2}, }, guardian = "HALF_BONE_GIANT", guardian_level = 1, }, object = { class = "engine.generator.object.Random", nb_object = {6, 9}, - filters = { {type="potion" }, {type="potion" }, {type="potion" }, {type="scroll" }, {}, {} } + filters = { {type="potion" }, {type="potion" }, {type="potion" }, {type="scroll" }, {max_ood=7}, {max_ood=7} } }, trap = { class = "engine.generator.trap.Random", diff --git a/game/modules/tome/data/zones/tower-amon-sul/zone.lua b/game/modules/tome/data/zones/tower-amon-sul/zone.lua index 02ba83c8b8a5362f72c5e9cbf0d7d8cc895c3289..9fbc81370948753d9bad708f8afbb696552a2c2f 100644 --- a/game/modules/tome/data/zones/tower-amon-sul/zone.lua +++ b/game/modules/tome/data/zones/tower-amon-sul/zone.lua @@ -44,12 +44,13 @@ return { actor = { class = "engine.generator.actor.Random", nb_npc = {20, 30}, + filters = { {max_ood=2}, }, -- guardian = "SHADE_OF_ANGMAR", -- The gardian is set in the static map }, object = { class = "engine.generator.object.Random", nb_object = {6, 9}, - filters = { {type="potion" }, {type="potion" }, {type="potion" }, {type="scroll" }, {}, {} } + filters = { {type="potion" }, {type="potion" }, {type="potion" }, {type="scroll" }, {max_ood=7}, {max_ood=7} } }, trap = { class = "engine.generator.trap.Random", diff --git a/game/modules/tome/data/zones/trollshaws/zone.lua b/game/modules/tome/data/zones/trollshaws/zone.lua index 3e991330301b123f48650a8c9ed92e607a2c6d38..3aa79d4782b3e89a831e16a6d7bcda694e7d1f41 100644 --- a/game/modules/tome/data/zones/trollshaws/zone.lua +++ b/game/modules/tome/data/zones/trollshaws/zone.lua @@ -49,12 +49,13 @@ return { actor = { class = "engine.generator.actor.Random", nb_npc = {20, 30}, + filters = { {max_ood=2}, }, guardian = "TROLL_BILL", }, object = { class = "engine.generator.object.Random", nb_object = {6, 9}, - filters = { {type="potion" }, {type="potion" }, {type="potion" }, {type="scroll" }, {}, {} } + filters = { {type="potion" }, {type="potion" }, {type="potion" }, {type="scroll" }, {max_ood=7}, {max_ood=7} } }, trap = { class = "engine.generator.trap.Random", diff --git a/ideas/classes.ods b/ideas/classes.ods index 229ca095f1bdf6e146cd66ba1cfca99cfe5006bf..9bed9a433d757c185c7d6d53bb784549886f8949 100644 Binary files a/ideas/classes.ods and b/ideas/classes.ods differ diff --git a/src/main.c b/src/main.c index 69c579de8836ff061814b0afbf1f72d90c0d53bc..f06b745fd87933c940e33f4bd5ac39272f6d1aa6 100644 --- a/src/main.c +++ b/src/main.c @@ -266,14 +266,8 @@ void on_tick() } } -void on_redraw() +void call_draw() { - static int Frames = 0; - static int T0 = 0; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glLoadIdentity(); - if (current_game != LUA_NOREF) { lua_rawgeti(L, LUA_REGISTRYINDEX, current_game); @@ -283,6 +277,17 @@ void on_redraw() lua_rawgeti(L, LUA_REGISTRYINDEX, current_game); docall(L, 1, 0); } +} + +void on_redraw() +{ + static int Frames = 0; + static int T0 = 0; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glLoadIdentity(); + + call_draw(); SDL_GL_SwapBuffers(); @@ -300,6 +305,137 @@ void on_redraw() } } +void gl_selall(GLint hits, GLuint *buff) +{ + GLuint *p; + int i; + + call_draw(); + + p = buff; + for (i = 0; i < 6 * 4; i++) + { + printf("Slot %d: - Value: %d\n", i, p[i]); + } + + printf("Buff size: %x\n", (GLbyte)buff[0]); +} + +void list_hits(GLint hits, GLuint *names) +{ + int i; + + /* + For each hit in the buffer are allocated 4 bytes: + 1. Number of hits selected (always one, + beacuse when we draw each object + we use glLoadName, so we replace the + prevous name in the stack) + 2. Min Z + 3. Max Z + 4. Name of the hit (glLoadName) + */ + + printf("%d hits:\n", hits); + + for (i = 0; i < hits; i++) + printf( "Number: %d\n" + "Min Z: %d\n" + "Max Z: %d\n" + "Name on stack: %d\n", + (GLubyte)names[i * 4], + (GLubyte)names[i * 4 + 1], + (GLubyte)names[i * 4 + 2], + (GLubyte)names[i * 4 + 3] + ); + + printf("\n"); +} + +void gl_select(int x, int y) +{ + GLuint buff[64] = {0}; + GLint hits, view[4]; + int id; + + /* + This choose the buffer where store the values for the selection data + */ + glSelectBuffer(64, buff); + + /* + This retrieve info about the viewport + */ + glGetIntegerv(GL_VIEWPORT, view); + + /* + Switching in selecton mode + */ + glRenderMode(GL_SELECT); + + /* + Clearing the name's stack + This stack contains all the info about the objects + */ + glInitNames(); + + /* + Now fill the stack with one element (or glLoadName will generate an error) + */ + glPushName(0); + + /* + Now modify the vieving volume, restricting selection area around the cursor + */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + /* + restrict the draw to an area around the cursor + */ + gluPickMatrix(x, y, 1.0, 1.0, view); +// gluPerspective(60, 1.0, 0.0001, 1000.0); + glOrtho(0, screen->w, screen->h, 0, -101, 101); + + /* + Draw the objects onto the screen + */ + glMatrixMode(GL_MODELVIEW); + + /* + draw only the names in the stack, and fill the array + */ + call_draw(); + SDL_GL_SwapBuffers(); + + /* + Do you remeber? We do pushMatrix in PROJECTION mode + */ + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + + /* + get number of objects drawed in that area + and return to render mode + */ + hits = glRenderMode(GL_RENDER); + + /* + Print a list of the objects + */ + list_hits(hits, buff); + + /* + uncomment this to show the whole buffer + * / + gl_selall(hits, buff); + */ + + glMatrixMode(GL_MODELVIEW); +} + + void pass_command_args(int argc, char *argv[]) { int i; @@ -696,9 +832,10 @@ int main(int argc, char *argv[]) break; - case SDL_MOUSEMOTION: - case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: +// gl_select(event.button.x, event.button.y); + case SDL_MOUSEBUTTONDOWN: + case SDL_MOUSEMOTION: case SDL_KEYDOWN: case SDL_KEYUP: /* handle key presses */ diff --git a/src/map.c b/src/map.c index 9762ba5b525d8db96ae3f20f146f61e86d35647e..e152b0e59f18a225f8af89f0c932ed44c16d2ee8 100644 --- a/src/map.c +++ b/src/map.c @@ -41,7 +41,8 @@ static int map_object_new(lua_State *L) { - int nb_textures = luaL_checknumber(L, 1); + long uid = luaL_checknumber(L, 1); + int nb_textures = luaL_checknumber(L, 2); int i; map_object *obj = (map_object*)lua_newuserdata(L, sizeof(map_object)); @@ -49,15 +50,16 @@ static int map_object_new(lua_State *L) obj->textures = calloc(nb_textures, sizeof(GLuint)); obj->textures_is3d = calloc(nb_textures, sizeof(bool)); obj->nb_textures = nb_textures; + obj->uid = uid; - obj->on_seen = lua_toboolean(L, 2); - obj->on_remember = lua_toboolean(L, 3); - obj->on_unknown = lua_toboolean(L, 4); + obj->on_seen = lua_toboolean(L, 3); + obj->on_remember = lua_toboolean(L, 4); + obj->on_unknown = lua_toboolean(L, 5); obj->valid = TRUE; - obj->dx = luaL_checknumber(L, 5); - obj->dy = luaL_checknumber(L, 6); - obj->scale = luaL_checknumber(L, 7); + obj->dx = luaL_checknumber(L, 6); + obj->dy = luaL_checknumber(L, 7); + obj->scale = luaL_checknumber(L, 8); obj->shader = 0; obj->tint_r = obj->tint_g = obj->tint_b = 1; for (i = 0; i < nb_textures; i++) @@ -554,6 +556,9 @@ void display_map_quad(map_type *map, int dx, int dy, float dz, map_object *m, in r = map->obscure_r; g = map->obscure_g; b = map->obscure_b; } } + + glLoadName(m->uid); + glColor4f(r, g, b, (a > 1) ? 1 : ((a < 0) ? 0 : a)); int z; diff --git a/src/map.h b/src/map.h index 664e389a1c127ca069d5d67c46c59239e47b7019..3ee372020dfb85bb62d7f60835dc8c051aad124c 100644 --- a/src/map.h +++ b/src/map.h @@ -36,6 +36,7 @@ typedef struct { bool on_remember; bool on_unknown; bool valid; + long uid; } map_object; typedef struct {