diff --git a/game/engines/default/data/gfx/objstack1.png b/game/engines/default/data/gfx/objstack1.png new file mode 100644 index 0000000000000000000000000000000000000000..c4a899cc436d93f560614c146e5225fa45ab96eb Binary files /dev/null and b/game/engines/default/data/gfx/objstack1.png differ diff --git a/game/engines/default/data/gfx/objstack2.png b/game/engines/default/data/gfx/objstack2.png new file mode 100644 index 0000000000000000000000000000000000000000..c16e02e17411f3f8c112ad27cbaf199c39918335 Binary files /dev/null and b/game/engines/default/data/gfx/objstack2.png differ diff --git a/game/engines/default/data/gfx/objstack3.png b/game/engines/default/data/gfx/objstack3.png new file mode 100644 index 0000000000000000000000000000000000000000..f06343d5f5ebc6fd754decd023f5af2d45ea7785 Binary files /dev/null and b/game/engines/default/data/gfx/objstack3.png differ diff --git a/game/engines/default/data/gfx/objstack4.png b/game/engines/default/data/gfx/objstack4.png new file mode 100644 index 0000000000000000000000000000000000000000..8ed4883abbf031b9894490e921f8062872f5b412 Binary files /dev/null and b/game/engines/default/data/gfx/objstack4.png differ diff --git a/game/engines/default/data/gfx/objstack5.png b/game/engines/default/data/gfx/objstack5.png new file mode 100644 index 0000000000000000000000000000000000000000..cddadcd3b991bbf2b8caa74826c737419bc1b2fe Binary files /dev/null and b/game/engines/default/data/gfx/objstack5.png differ diff --git a/game/engines/default/data/gfx/objstack6.png b/game/engines/default/data/gfx/objstack6.png new file mode 100644 index 0000000000000000000000000000000000000000..93f1933f95cf1cc337a004d7578efd68f0745ab0 Binary files /dev/null and b/game/engines/default/data/gfx/objstack6.png differ diff --git a/game/engines/default/data/gfx/objstack7.png b/game/engines/default/data/gfx/objstack7.png new file mode 100644 index 0000000000000000000000000000000000000000..f78cb2c8c4acfae6d492dc97ac39bb1f6460d4f8 Binary files /dev/null and b/game/engines/default/data/gfx/objstack7.png differ diff --git a/game/engines/default/data/gfx/objstack8.png b/game/engines/default/data/gfx/objstack8.png new file mode 100644 index 0000000000000000000000000000000000000000..6f8314df55173420ed1ee0126dbded80537fb254 Binary files /dev/null and b/game/engines/default/data/gfx/objstack8.png differ diff --git a/game/engines/default/data/gfx/objstack9.png b/game/engines/default/data/gfx/objstack9.png new file mode 100644 index 0000000000000000000000000000000000000000..76a607349318b05a4a2f0a0a8a4036ed2c4c8562 Binary files /dev/null and b/game/engines/default/data/gfx/objstack9.png differ diff --git a/game/engines/default/data/gfx/objstackmany.png b/game/engines/default/data/gfx/objstackmany.png new file mode 100644 index 0000000000000000000000000000000000000000..68055b6beb15c444e7b7cd2129d14ab7c6f35900 Binary files /dev/null and b/game/engines/default/data/gfx/objstackmany.png differ diff --git a/game/engines/default/engine/Map.lua b/game/engines/default/engine/Map.lua index 8f88bb79036b8ce29cc187549ec18be845e74120..1c5d37772d5e64689d57e3d4754de68afbb7f8fd 100644 --- a/game/engines/default/engine/Map.lua +++ b/game/engines/default/engine/Map.lua @@ -165,7 +165,6 @@ 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 @@ -388,6 +387,10 @@ function _M:updateMap(x, y) end if o then o:getMapObjects(self.tiles, mos, 7) + if self.object_stack_count then + local mo = o:getMapStackMO(self, x, y) + if mo then mos[9] = mo end + end mm = mm + MM_OBJECT end if a then diff --git a/game/engines/default/engine/Object.lua b/game/engines/default/engine/Object.lua index 2d88d66d2e11ad204b9b07415d7a807c035d593f..a876b42e8bec9abcbcf1daff7f22ad4218f587c4 100644 --- a/game/engines/default/engine/Object.lua +++ b/game/engines/default/engine/Object.lua @@ -195,3 +195,24 @@ function _M:getRequirementDesc(who) end return str end + +--- Returns a map object that represents how many are in the stack +local stackmo = {} +function _M:getMapStackMO(map, x, y) + local nb = map:getObjectTotal(x, y) + if nb < 2 then return end + if nb > 9 then nb = "many" end + if stackmo[nb] then return stackmo[nb] end + + local s = core.display.loadImage("/data/gfx/objstack"..nb..".png") + if not s then return end + local tex = s:glTexture() + + -- Create the map object with 1 + additional textures + local _mo = core.map.newObject(0, 1, self:check("display_on_seen"), self:check("display_on_remember"), self:check("display_on_unknown"), 0, 0, 1) + _mo:texture(0, tex) + + stackmo[nb] = _mo + + return _mo +end diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 856c9cec8f5bb33827467ffb3596c7400e4a2601..f265dee089a9b5b6e1cda0ecd18ae6f683548545 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -960,7 +960,7 @@ function _M:getMaxEncumbrance() if self:knowTalent(self.T_BURDEN_MANAGEMENT) then add = add + 20 + self:getTalentLevel(self.T_BURDEN_MANAGEMENT) * 15 end - return math.floor(40 + self:getStr() * 1.8) + (self.max_encumber or 0) + add + return math.floor(40 + self:getStr() * 1.8 + (self.max_encumber or 0) + add) end function _M:getEncumbrance() @@ -985,7 +985,7 @@ function _M:getEncumbrance() end end -- print("Total encumbrance", enc) - return enc + return math.floor(enc) end function _M:checkEncumbrance() diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 815752f3ce637566c63b6be84d1260b8fc116c46..a0635c2fea659df44c726520d0ebfc73d2f1905c 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -226,6 +226,8 @@ function _M:setupDisplayMode(reboot) util.showMainMenu(false, nil, nil, self.__mod_info.short_name, self.save_name, false) end + -- Show a count for stacked objects + Map.object_stack_count = true if self.gfxmode == 1 then print("[DISPLAY MODE] 32x32 GFX") Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 32, 32, nil, 22, true, true)