From 3dd1edde7e8630a9095bb6e6d8463e35c21d269e Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Wed, 6 Oct 2010 22:11:39 +0000 Subject: [PATCH] When multiple objects are stacked on the map there will be a visual indicator (modules can activate it by simply doing Map.object_stack_count = true) git-svn-id: http://svn.net-core.org/repos/t-engine4@1444 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engines/default/data/gfx/objstack1.png | Bin 0 -> 195 bytes game/engines/default/data/gfx/objstack2.png | Bin 0 -> 324 bytes game/engines/default/data/gfx/objstack3.png | Bin 0 -> 332 bytes game/engines/default/data/gfx/objstack4.png | Bin 0 -> 273 bytes game/engines/default/data/gfx/objstack5.png | Bin 0 -> 309 bytes game/engines/default/data/gfx/objstack6.png | Bin 0 -> 342 bytes game/engines/default/data/gfx/objstack7.png | Bin 0 -> 290 bytes game/engines/default/data/gfx/objstack8.png | Bin 0 -> 344 bytes game/engines/default/data/gfx/objstack9.png | Bin 0 -> 337 bytes .../engines/default/data/gfx/objstackmany.png | Bin 0 -> 261 bytes game/engines/default/engine/Map.lua | 5 ++++- game/engines/default/engine/Object.lua | 21 ++++++++++++++++++ game/modules/tome/class/Actor.lua | 4 ++-- game/modules/tome/class/Game.lua | 2 ++ 14 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 game/engines/default/data/gfx/objstack1.png create mode 100644 game/engines/default/data/gfx/objstack2.png create mode 100644 game/engines/default/data/gfx/objstack3.png create mode 100644 game/engines/default/data/gfx/objstack4.png create mode 100644 game/engines/default/data/gfx/objstack5.png create mode 100644 game/engines/default/data/gfx/objstack6.png create mode 100644 game/engines/default/data/gfx/objstack7.png create mode 100644 game/engines/default/data/gfx/objstack8.png create mode 100644 game/engines/default/data/gfx/objstack9.png create mode 100644 game/engines/default/data/gfx/objstackmany.png 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 GIT binary patch literal 195 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1SGw4HSYi^#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jeS6638;M|T2+WHUn|N}Tg^b5rw5fLsO!=c3falGGH1 z^30M91$R&1fE2w{cA&V9r;B3<$Mxht|Nq-Fv(%)t82$KfY+zupu=@~$a9E&<tby=@ g2G(E>XZEE+3@27{^2^=OGy@sv>FVdQ&MBb@0NLa+n*aa+ literal 0 HcmV?d00001 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 GIT binary patch literal 324 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcsv+<li_RT;c+02lL66gHf+|;}hAeVu`xhOTUBsE2$ zJhLQ2!QIn0AVn{g9Voum)5S3);_%x`ie5(&1&%#TZ`Hk(a$D|Dg3#u(DO;+US649k zZ#XH;G5gG-T>cI00X*Fbdi4P!afg$HUPnAzDg5mFN8YttuSI3A-OBXP;!f-L4P4g~ zgCq_1Kd5Q{ZEWW(X0x*AfDHTeH*IS;^Zq}!_H#;`-B9}VQ)Y!+#mpS0w5g}JAAZ!m zy*8{uXLsWU(Y!+iM}*ejSY7is^oPY$MrOYHw8e`W{uoO2XXSs`o_}Ymb?~7{&k{jC N@^tlcS?83{1OV?od9eTh literal 0 HcmV?d00001 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 GIT binary patch literal 332 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcsi{6IaN9O{CWHUn|N}Tg^b5rw5fLsO!=c3falGGH1 z^30M91$R&1fE2w{cA)rHPZ!6Kh{JC$EBZMH3bb8p*5q`2SZJEV(!Qwe!N;5i*$v&x zIrxG-ojgKWS8=Xnai4t3j^n4`_Us)qETw0>KldcaOLOUzAg`ASF)h;#+I%ZGmfJEv z`+i6EbJbD*6J7eY$_B@O>Z&VRHyy2?^VldQgK_u0!@`@=3^N&>-#0YBu03KbKcmF{ zpt`$a^6dl3>!<TS)RAeMJt37_qMG&0wVb-!;&=9aHp^u^J@5AXx9oMv-ReI785%o0 Uf4-A7Zvpwt)78&qol`;+04o-Dj{pDw literal 0 HcmV?d00001 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 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcstMYZhjzpl4Y-UJAiF1B#Zfaf$kjuc}T$GwvlA5AW zo>`Ki;O^-gkfN8$4ivBQba4!cIQ;g?M&9NC9@mSn0}Nf%PD%9~5_l=85X;sXw3&&Q zmGzQ0qoB~DZL`b8K5YH^_23y05aN8-6uDqk!*qx0hE47EEWw@)3q*VJE5ca6XxB(f ztY(_V$M&F@uVYEW>0D-|qWcd6Kgrj4^K^7~yFZ-2MfNfKdM;BjquZGkAm@3y`njxg HN@xNArv6wi literal 0 HcmV?d00001 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 GIT binary patch literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcsn?kB-7f47pGbEzKIX^cyHLnE7WngeFN=+<DO;IS% zEXh!C_w)@&(Mx3qiqG?OaSVw#{PvQfpR=O~>xIv=mvK!}+hHYkl{Zl!LntIV^x6R> zt*k;870yi7Wx07rBfiuev@Scc_j{_w(kVe+nosvjSGBbK5wtl_a%Ag41KHoNCeJ&$ zKlhvBnnS+tpU#}j`+S1=z21OB!rv8-e`CLPm%C;6g!y3)EMAKI5)ykT#=jxge|p^N w>GC!0ms{6|mu)U<d_M1bd{V!#-N%lbqSfkp-3A(LnIJECy85}Sb4q9e00FsfZ2$lO literal 0 HcmV?d00001 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 GIT binary patch literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcsJJ<55Mg2e_+02lL66gHf+|;}hAeVu`xhOTUBsE2$ zJhLQ2!QIn0AVn{g9Vouv)5S3);_%xm`d%%8BJB^^6Pq%G)q0}~6r*y*X1`15l89~G z%$aM}-NY>H;?tDdb&WCb$j`$cjB9qa&ORrczf=EtjNZ~IL0+0mr??$5*web+AgA_c z;R)Nxx%bXTW=IMiQ{2s>obzx^>H+r?%#oY9^b^;o9<X{cVa^AsPbapA3D)!L&rUfI zcw$fV@g1QDKGz>$wN{)Td!T0VMX_}c7?!^|oLjyx$F%XD>}1KvjdMO-d9PM*_mlOD gheF1G9<cq5e{spLS$F;S6(B!)y85}Sb4q9e0QRea*#H0l literal 0 HcmV?d00001 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 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcsyQ$#k_)S0|+02lL66gHf+|;}hAeVu`xhOTUBsE2$ zJhLQ2!QIn0AVn{g9Vp)I>Eaj?aro_pjl72(1Y9oGtAr%1Dq#H5_<Dnjv|fXq&MSui z)^jlpy*4b>6DI1N-1A}5&+3FU5U39`a%1^r7+2;QJ}qdy?X~SMZ%^|n5X|WKnEvfY zoB{V0w*wPoFL0K$hyVR&X8k}bK>qReHy@i5ViU5J7M$m^;5IqLrsFVK_JhC+k?Z~Q ZzneGw&~HgzRPztyUQbs)mvv4FO#r4?WtIQ{ literal 0 HcmV?d00001 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 GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcshqTvTzfC|P+02lL66gHf+|;}hAeVu`xhOTUBsE2$ zJhLQ2!QIn0AVn{g9VmX#)5S3);_%xmhF;8pBCHpj+3qx6o0Jx1zHqLFQ<Qgjs^li- z+!T+MNm@ts4xWk<;E~i_ceF?EVfg<8*>RusrypOw3JRDGncQhxUzm3&@gzgP;&hw2 zo46~VI<FL1$bVCreNOuu4mq_}uZRPN*A5?kcKF|l5N6-wYAPvbH%T_dOy}Cbu`{XC ztZm0*Uf-1r_v_6!oOkuGH!;vJW!5if;+_1Tb#oB!mhUxrC;9(cpMQJdz^W(pR~8*E co5S~3Ka)Q|W5&A}Q;;t`UHx3vIVCg!04;%iZ2$lO literal 0 HcmV?d00001 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 GIT binary patch literal 337 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcsC*!&!ZJj_N+02lL66gHf+|;}hAeVu`xhOTUBsE2$ zJhLQ2!QIn0AVn{g9Voub)5S3);_%xm3w@gtC0Z{k8zcxy2!*{c;1K#$EvE36MaLoN zAfJU=2GcsBMu))0Mm1Kax~L+-_=tzW?`J+R{2t_`xpYd9*GmPN*4-au?;R?=@mjJ# zy6E7ip7|4`<-T-r$SeMSGUM|E)q`uo5B!iXIGT838LLh;>z(#FlgisB#B$&G!ZpL@ z^H$aMHmz%-53GAGp;lp&D7`6z@%23K8LiC*{E|@z7Ns93N%@m%nlH@Lc5lAPQT4b2 Z&iX0-;hp)O%~l}qdAj<!taD0e0swU|c9Q@A literal 0 HcmV?d00001 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 GIT binary patch literal 261 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#78jcsr^?d<LFa%%vY8<fCC>S|xv6<2KrRD=b5UwyNotBh zd1gt5g1e`0K#E=}J5W5&)5S3);_%x`3k8`1c~~x(e<@jT?jo17>J<mc_)A<TnuYlG z&oB;fV4J9(yy>LQ+O5~3ve#}6(|A(8O*_iwkQ|>%&#TkV#j{T|$5^iB5qxIuePXUm xWzsqx1HCy;YDLMqyc;B=Ih#F8`S;0xa<_AOrTVN<ipd7#Bu`gAmvv4FO#s*2Q9l3x literal 0 HcmV?d00001 diff --git a/game/engines/default/engine/Map.lua b/game/engines/default/engine/Map.lua index 8f88bb7903..1c5d37772d 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 2d88d66d2e..a876b42e8b 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 856c9cec8f..f265dee089 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 815752f3ce..a0635c2fea 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) -- GitLab