From 837960c4774c17070b1a2f8ce311ce1f1bf549fd Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 3 Jan 2021 17:06:33 -0800 Subject: [PATCH] Doodads: Small Key Door + Bigger Crumbly Floor * The crumbly floor doodad was made 50% larger. * New doodad: Small Key and Small Key Door. These work like the colored doors and locks except each Small Key is consumed when it unlocks a door. The door's appearance is of iron bars. * The inventory HUD displays a small quantity label in the lower-right corner of items that have a quantity, such as the Small Key. This is done as a Canvas.CornerLabel string attribute on uix.Canvas. * The "give all keys" cheat adds 99 Small Keys to your inventory. --- .../doodads/crumbly-floor/crumbly-floor.js | 2 +- dev-assets/doodads/crumbly-floor/fall1.png | Bin 1021 -> 1119 bytes dev-assets/doodads/crumbly-floor/fall2.png | Bin 986 -> 1124 bytes dev-assets/doodads/crumbly-floor/fall3.png | Bin 957 -> 1120 bytes dev-assets/doodads/crumbly-floor/fall4.png | Bin 855 -> 1100 bytes dev-assets/doodads/crumbly-floor/fallen.png | Bin 652 -> 415 bytes dev-assets/doodads/crumbly-floor/floor.png | Bin 868 -> 1036 bytes dev-assets/doodads/crumbly-floor/shake1.png | Bin 897 -> 1036 bytes dev-assets/doodads/crumbly-floor/shake2.png | Bin 891 -> 1044 bytes dev-assets/doodads/doors/build.sh | 16 +-- dev-assets/doodads/doors/colored-door.js | 9 +- dev-assets/doodads/doors/keys.js | 3 +- dev-assets/doodads/doors/small-closed.png | Bin 0 -> 1099 bytes dev-assets/doodads/doors/small-key.png | Bin 0 -> 682 bytes dev-assets/doodads/doors/small-left.png | Bin 0 -> 935 bytes dev-assets/doodads/doors/small-right.png | Bin 0 -> 936 bytes dev-assets/doodads/doors/small-unlocked.png | Bin 0 -> 932 bytes pkg/cheats.go | 1 + pkg/play_inventory.go | 115 ++++++++++-------- pkg/uix/actor.go | 6 +- pkg/uix/canvas.go | 4 + pkg/uix/canvas_present.go | 18 +++ 22 files changed, 108 insertions(+), 66 deletions(-) create mode 100644 dev-assets/doodads/doors/small-closed.png create mode 100644 dev-assets/doodads/doors/small-key.png create mode 100644 dev-assets/doodads/doors/small-left.png create mode 100644 dev-assets/doodads/doors/small-right.png create mode 100644 dev-assets/doodads/doors/small-unlocked.png diff --git a/dev-assets/doodads/crumbly-floor/crumbly-floor.js b/dev-assets/doodads/crumbly-floor/crumbly-floor.js index 97c2be0..c7bdf08 100644 --- a/dev-assets/doodads/crumbly-floor/crumbly-floor.js +++ b/dev-assets/doodads/crumbly-floor/crumbly-floor.js @@ -1,6 +1,6 @@ // Crumbly Floor. function main() { - Self.SetHitbox(0, 0, 65, 7); + Self.SetHitbox(0, 0, 98, 11); Self.AddAnimation("shake", 100, ["shake1", "shake2", "floor", "shake1", "shake2", "floor"]); Self.AddAnimation("fall", 100, ["fall1", "fall2", "fall3", "fall4"]); diff --git a/dev-assets/doodads/crumbly-floor/fall1.png b/dev-assets/doodads/crumbly-floor/fall1.png index bc9710c3ae72e969b73fd46d463cd39a4ce41912..fdc1616620ec892f2bda49b8121a6ac38876c0d3 100644 GIT binary patch delta 722 zcmey%exF09Gr-TCmrII^fq{Y7)59eQNGE|X3p0?6?3T7=U|_7tbaoENOitctQps3< z+OwVwD5a3>5#-CjP^HGe(9pub@Czu^@PdJ%)PRBERRRNp)eHs(@q#(K0&Rd25&=FT zu0R?H&YU@umX_vgDczl_Gjrz5|Ns9Rulc(MD8X0~`xh)#T8ieI6gN5g}!>aIEF+VemilaP?Ldx zOSoXxALh1;^Je~F6yY)Tt>W7I|36E){>BYcHtq>;*)V%=j8Kg1oOM&>?tAqcy?$-~ zp*pGLg36`|l94$FB9AdBF-|x=_2`0gCsfvYMs0|lvh?!Iw{jn=>SJc|t9&YZ=C|eY zm7?SgJI&JhH%Oi7u@eo8dRCY*GvIX02Cp`z%un-nuH3h}tVvqt{m%%c^k1uQdUIN) ziQMq_;(!0Q*smlmRNQ^;-&@{KXDxYYl>Mbe$z1Mq@8Zt2Y&qZAq<< zH*2ldn@7s;++(yW$oaC+hsmK*PrtheusFid!T1Vh?u_!xsQbr`On%L%UeBOf;u=ws zl30>zm0Xkxq!^40j0|)Q4RwtyLJSP83{0$yjI<35tPBh!KJGma3^s&@-29Zxv`X9> zGS{#IBZ5I1WCJicSS9BdR2F5XXOu7mlqTh5CM&q)*XAZ>=53p37!6dX1XGuiTAW;z zSx}OhpU2?t=^LPsRGOJnqMMngP#om$}peR2r zGbeSUP9>vVlZl8lPzhU-x4R3&e-K=-cll(X2xoyuWHAE+w=f7ZGR&GI0Tg5}@$_|N zf6OB%&Sq$SUnXO+4YPVZ<5f==$B>F!Z>MeyI&8qx_Es+cV)%(L{il+*9*gc$nJKY* zTC-`g`fl#^2Sn4}MQmCje0N55&z+AWxW4}Q z8@;>V#sAM*`?uq5q}}=sjqJppKrhYE(5XNEeg5lOvoGJ@OLOV0O&-7E-uKlP2F>cI zQRCB9y)dQq{Ew@rf0lgsm-qY1>Gj1rtOxklty-1-c#bgt&F$*4Idh9oI{ds>TYV`= z=a@w9+PAi=U+?Pf{r&&K^^;15j3vQhb(f~J=ASxroKrfvBtrjruzXYLxt9?Q%XDfu zVuTbpj%&>mZJ0k_sG*}qp!;|Kh|p5o013G=S_KY;<@Q=dv&J&OiRv9 nWjPVMz4#9^FfIvzKjC!@l7DsjJ6FWN2PyS*^>bP0l+XkK)RGB; diff --git a/dev-assets/doodads/crumbly-floor/fall2.png b/dev-assets/doodads/crumbly-floor/fall2.png index 1524b6d991e736b351dbfe6010b7ee7dc3c02b2d..ac135c26f095b31d5ef148bb13774d2c530b48c5 100644 GIT binary patch delta 727 zcmcb`{)9uPGr-TCmrII^fq{Y7)59eQNGE|X3p0?6?3T7=U|_7tbaoENOitctQps3< z+OwVwD5a3>5#-CjP^HGe(9pub@Czu^@PdJ%)PRBERRRNp)eHs(@q#(K0&Rd2q5(c3 zu0ZYw#2j@wLlJM zfk$L90|U1(2s1Lwno}S-uzbEW%)$JwcRUY?Z*XtQEy(=vWrbNR&q+LEOLIb=+doXgL=6x$yXUCf;P+7 zHA_A7b}>$zoU&cER<9;j_NL6GiFYqfT&Wy=%W&t`t=hL3o~+g{5VJYav;Efb#7u_Xp;ya}g(3i#j(@>5cC7(iO16Fi-PG7O%selF{r5}E*%^Zg_M delta 563 zcmaFDaf{ugGr-TCmrII^fq{Y7)59eQNIQZs2OE&=`+m}ufq}6l)7d$|)7e>}peR2r zGbeSUP9>vQlZl8lPzhU-x4R3&e-K=-clqSW0!(sTk9p+8+00h%?mRu&ky*W-ag(Qu zV@SoVx6}3(9yZ`{JGkbdXwasQ0&>cqSXLT0oDKDvCiSvQKuza?&utGYDjgU*S?e!D7k z8^mvSuP?5ttd+lRQPiT|WOt`)qmK9IJITU!Z_3xkNB@j4%(+un`TYBjt=G~X-_tR@ zJoo0gTaT`n?(MdHy+Cq#&#b3&W3zMr?!A0Dx%$OXm(A9 zRY0)vL%q&Z)jO;jOSc4_I%|22HLP;I@UDut4gc1pr{+F?-}CXr$;_1OyBj}0-L-Q; z4trJLy)gSX<+@Uh|JH3+e^Yi}it}zukk{vZTJQWi_}(AA@yOltEJym|S5NlFn3?}M zCK0W8>Drk*-8Cn=%yw!_l$=;)XC=P(j@$XO93Qo#Z~yx_!+Y-OjEjB8a?&ok?R0l) r@%!;g{k3{U(x0gU!05vPKJfo!5fU%R%JSMT0aD`W>gTe~DWM4fW>@|L diff --git a/dev-assets/doodads/crumbly-floor/fall3.png b/dev-assets/doodads/crumbly-floor/fall3.png index 5b05d931ad82a00728067a43a505ef1b9bfa696b..cad059da78965ab0cc125fea616844993c6533b4 100644 GIT binary patch delta 723 zcmdnX{(wWLGr-TCmrII^fq{Y7)59eQNGE|X3p0?6?3T7=U|_7tbaoENOitctQps3< z+OwVwD5a3>5#-CjP^HGe(9pub@Czu^@PdJ%)PRBERRRNp)eHs(@q#(K0&Rd2q5(c3 zu0ZYw#2j@wLlJM zfk$L90|U1(2s1Lwno}NL|9Uccn8jl}Wpf(02e zdk;GOn0xb%!ZW#pYtKaRZc~1wBWYH7fwzNi$)7tL-h5#?cz5Qtt-P~NzsU%)%2D}L zTQ(sqdZYrXSI6*!r#c z@T83GHojN#9q)&5T^4#g@%a5K7Sigk_B*Z!(VFVDG-xG|dNuzm6YCp|dCA(=3X@+m zs@F59mbgZgq$HN4S|t~y0x1R~10w@nLqlC7ix2}tD+3cNBO`4C11kdqiI02F1A`8s zAvZrIGp!Q0hRijrz{p^b2H5~i4_3+f1(ija=@}&q0i{VfnaK(+`L(%;nR(kL8b$-v zDZ$jGq!uR^WfqiV=I1fEd-?__B$a07l;~#WDHI2}JNcwL0;88f6s9^iF|RZ&F}b9) oD76Tz+-Kf|Q$PiLa0U4(sW}WFt}peR2r zGbeSUP9>vQlZl8lPzhU-x4R3&e-K=-clqSW0!(sTk9p+8*{l}u9(^#`mRY@?ajK__ zV@SoVx7QEm9##-JRv33hcau~9&XkUxKqJTVvI~ySDOkS3#zoJrjP<;ue}srFhs5$v z5C2cr3ROLLe*VLUQp^&`JuUIeGC#e1@UkT8*xIe9e;Dvgs{2-Cr}y}A?LXsxKfmqj z*<1hD!#8o^yd7-M=a?Ux@%pRQ*5d5arN#BD6_1GfwHiE9@M6qJ+`=N5b&)AT_{j0M zzaQG#iLCFq)9Ur8DY{jm=yTirpxRqq?}K(NjETrTT)phDG1Coifvwl=*TgPLe4ly0 zS3mBS-NR>(?Si5!RxUJO-!hG1i|tC&MHfuk6DM5qG`g35QEKJZYxZ2pv()0b6l(0v z{qNYT)blD{-}#tf3*X&WMRvdLcqXm=npyGjd9s13J)HB|_TWCPgg&ebxsLQ0DKAS$p8QV diff --git a/dev-assets/doodads/crumbly-floor/fall4.png b/dev-assets/doodads/crumbly-floor/fall4.png index 97e8ee0a411680b6958eda2260f596436505919f..11f6c985c0ace3a16282573efd3ef520bcc87c7d 100644 GIT binary patch delta 703 zcmcc4c7{WzGr-TCmrII^fq{Y7)59eQNGE|X3p0?6?3T7=U|_7tbaoENOitctQps3< z+OwVwD5a3>5#-CjP^HGe(9pub@Czu^@PdJ%)PRBERRRNp)eHs(@q#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fc9decc291d98dd48998b8ceaeb5f5..6c16dd05aebb3fe52b78c91e8ebec73ba67a6fb1 100644 GIT binary patch literal 415 zcmeAS@N?(olHy`uVBq!ia0vp^Ng&J!Bp90SSuX}sOiAAEE)0x!yM&hjd7K3vk;M!Q z+`=Ht$S`Y;1W=H@#M9T6{V5}}xB`nF$LB_%kff)JV~EA+cptHiA#a}6ud zFAUNk8#0rVt&;N#DvL7HGfEf&N|SOjlNDU@a}zW3woNpQ1}am6DN9K$PAWc)I$ztaD0e0sy3cc6a~) delta 598 zcmbQw+{0Sm8Q|y6%O%Cdz`(%k>ERLtq#Z$+gAGXbeLv~Sz`)p&>FgZf>FlgfP?VpR znUl)EpfRy_qOHea2brVs(My#?*|j|cPX^4@>4>+;67335yu!8CYDUa2R$r+}BI51` zw?24qJn8Deqmkk4;f?}-7zztZgGwd}{huxpRez+S;7)(}ce(QS4E1}@gltac2{1kF zq58;4ZMPOnyx<{$UxEjx9Pz336Pf%$CjR?}k6-nUZQgVKuVvMgIVTzBJJ_5qIjnR~ zVcxwhCFg!0Ner7J@~HSxV6&dbpA)4wpPHXzZU1XyoU04t`&sKjDZ!5ZW%IJC~pHic%j$;dhWayNDwpNL?QkrT(Tjalg zaF^Ndp*J%|)u2dc0h8#Y$L#-`@86yEv$N1#Q-s|rKIeC`1jjq3-dVZz^0&(#vvAlj zhew@`U&(Adf64Wzs4pBZ?y~8vi=MTIJ?0$)v;VFXk3NwFFWt^RZ~SijYnjf4a_*A# zJNKG?FZ{)@Waa87yafduJt7*_cOT!4eY^K>^|G7y`A>BfooX@>kp{*LTavfC3&Vd9 zT(Ecf@h*Xv5AFKNQE*+UbMP7OP!F9;xV9u7(8A5T-G@yGywp2vG4T& diff --git a/dev-assets/doodads/crumbly-floor/floor.png b/dev-assets/doodads/crumbly-floor/floor.png index f89f16ea50e7f622b27a4a049e4e6a6db588c749..c592c09de8335d378af4daf48e1720a10fcd13e5 100644 GIT binary patch delta 638 zcmaFD*2AIG8Q|y6%O%Cdz`(%k>ERLtq?16Hg&9ajc1znbFfi6+Iy(nsCMRz+sbs7_ z?OD$Tlu}6c2=ZlMs8VBKXlP+z_yrVdc)`F>YQVtoDuIE)Y6b&?c)^@qfi^%1i2$Dv zS0D`pX=!O^&YbbJl*^y}f&%&u3Zh;^T5pO}PrZg`9$asc#F<>@iB@P;3!!0uz5s;{|-P zJFfE|*);hzqk27qYKdz^NlIc#s#S7PDv)9@GB7gGH8j*UvIsFSv@$TUGBVOOFt9Q( zkodUwJkW~>4Y~O#nQ4`{HDs<~1qK>}G{^>E)LA9x7gQEyre~Be1e7M_WF{-PQJCu7 x#Jtk9#N?9FqSPX=a-Vq4Eq~a*Is;`GJYD@<);T3K0RWt*&$a*n delta 469 zcmeC-c*17V8Q|y6%O%Cdz`(%k>ERLtq#Z$+gAGXbeLv~Sz`)p&>FgZf>FlgfP?VpR znUlIvr;^dG$wWjNsDv%a+ueoXKL{?^yL>WGgtNdSvY3H^TNs2H8D`Cq01C2~c>21s zKjx7WXJhM6+L=E2C6jtRqm8GFV@SoVw^t4Q4m$|6K78IW%Z`14PwJ|YE1gF~V|YW? z39y8F91YvaBy`0?BxFgG9{U29M@$Q&GRr<%xs00YPZ=7>1W(hSqDnC1$cRCF1^S*Vae**Z(rGc|72Fzo0R7r*%;WjY@1!ruEN~gV!k0WWTY?eQ&N5Tr%1GKasBZttUqc3-z_Zn wy+7sK-R^7O|L&DCw*I-E85n$+;KTkuOmA0oueASI#{-h}boFyt=akR{07@Ooi2wiq diff --git a/dev-assets/doodads/crumbly-floor/shake1.png b/dev-assets/doodads/crumbly-floor/shake1.png index 4881adf01199f3b6b865ca404103c626adf8286b..b59c2516e0588cf03e37dae3dcaff2f49b73e7c6 100644 GIT binary patch delta 638 zcmZo<@8Qtt4DfU3<&xrJU|`_&^l%9R(n%o9!VDxMyQOUz7#M3Zot*B^XPB{DK)Ap4~_Tagw~~M4$B>A_Z_i)kZ8qR> z4Geq1weAE{BWu@f#(=X7B9;FIf5}W|Je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sh z1V#sgC`@&3VqR%lVsc4oQECxbxzD@_r+^Ch;0p3nQgawUTB8#@oq;k8p00i_>zopr E07zcicmMzZ delta 492 zcmbQj@te)0Gr-TCmrII^fq{Y7)59eQNIQZs2OE&=`+m}ufq}6l)7d$|)7e>}peR2r zGbeSUP9>vVlZl8lPzhU-x4R3&e-K=-cll(X2xoyuWHAE+w=f7ZGR&GI0Tg5}@$_|N zf6OB%&L%eL>PqIxADPta8G}7t978H@y}fFfcgR5G*vIE9jDwELC`232)O22Y&hZh~ z%sZOl3JFt!vSK?Ur5r^-#lX z+4A09T1x_Fx&%+&5q31KY**nd@5P%UrK3fqJ1@ud9Z%kH;dG`vkAuse_8TkKlxOH| zzo%hxa$QXSt^-rIgjZjR-F5r$&g~hO;+6)^)S0$a_nx>z_>^n6q>qF!9BycTeI!$_ za8|YTT5+dXQ8U^2k9p!5YjYD1EA$web!5AxmL2X+wS1)#pWfQ^q1Ett*Uryn;n_F7 zUc6%c;GQkd)`f;?pN>5HQ2O}kmhbN_nqS+y`A+SRdxobZK7aVn2MkqAaNz$Z_71mt V&9$za!0=~a@O1TaS?83{1OVW|(Eb1b diff --git a/dev-assets/doodads/doors/build.sh b/dev-assets/doodads/doors/build.sh index 52d6e18..384d486 100755 --- a/dev-assets/doodads/doors/build.sh +++ b/dev-assets/doodads/doors/build.sh @@ -18,13 +18,9 @@ doodad convert -t "Yellow Door" yellow-closed.png yellow-unlocked.png yellow-rig doodad edit-doodad -q --tag color=yellow door-yellow.doodad doodad install-script colored-door.js door-yellow.doodad -# doodad convert -t "Green Door" green1.png green2.png door-green.doodad -# doodad edit-doodad -q --tag color=green door-green.doodad -# doodad install-script locked-door.js door-green.doodad -# -# doodad convert -t "Yellow Door" yellow1.png yellow2.png door-yellow.doodad -# doodad edit-doodad -q --tag color=yellow door-yellow.doodad -# doodad install-script locked-door.js door-yellow.doodad +doodad convert -t "Small Key Door" small-closed.png small-unlocked.png small-right.png small-left.png small-key-door.doodad +doodad edit-doodad -q --tag color=small small-key-door.doodad +doodad install-script colored-door.js small-key-door.doodad doodad convert -t "Red Key" red-key.png key-red.doodad doodad edit-doodad -q --tag color=red key-red.doodad @@ -42,7 +38,11 @@ doodad convert -t "Yellow Key" yellow-key.png key-yellow.doodad doodad edit-doodad -q --tag color=yellow key-yellow.doodad doodad install-script keys.js key-yellow.doodad +doodad convert -t "Small Key" small-key.png small-key.doodad +doodad edit-doodad -q --tag color=small small-key.doodad +doodad install-script keys.js small-key.doodad + doodad convert -t "Electric Door" electric{1,2,3,4}.png door-electric.doodad doodad install-script electric-door.js door-electric.doodad -cp door-*.doodad key-*.doodad ../../../assets/doodads/ +cp door-*.doodad key-*.doodad small-*.doodad ../../../assets/doodads/ diff --git a/dev-assets/doodads/doors/colored-door.js b/dev-assets/doodads/doors/colored-door.js index eaa1bcf..0bfba60 100644 --- a/dev-assets/doodads/doors/colored-door.js +++ b/dev-assets/doodads/doors/colored-door.js @@ -1,6 +1,6 @@ function main() { var color = Self.GetTag("color"); - var keyname = "key-" + color + ".doodad"; + var keyname = color === "small" ? "small-key.doodad" : "key-" + color + ".doodad"; // Layers in the doodad image. var layer = { @@ -46,7 +46,12 @@ function main() { if (e.Settled) { unlocked = true; Self.ShowLayer(enterSide < 0 ? layer.right : layer.left); - Sound.Play("unlock.wav") + Sound.Play("unlock.wav"); + + // If a Small Key door, consume a small key. + if (color === "small") { + e.Actor.RemoveItem(keyname, 1) + } } } }); diff --git a/dev-assets/doodads/doors/keys.js b/dev-assets/doodads/doors/keys.js index 00cc6d7..593b871 100644 --- a/dev-assets/doodads/doors/keys.js +++ b/dev-assets/doodads/doors/keys.js @@ -1,10 +1,11 @@ function main() { var color = Self.GetTag("color"); + var quantity = color === "small" ? 1 : 0; Events.OnCollide(function(e) { if (e.Settled) { Sound.Play("item-get.wav") - e.Actor.AddItem(Self.Filename, 0); + e.Actor.AddItem(Self.Filename, quantity); Self.Destroy(); } }) diff --git a/dev-assets/doodads/doors/small-closed.png b/dev-assets/doodads/doors/small-closed.png new file mode 100644 index 0000000000000000000000000000000000000000..b97ae465ae3754df1aa959fc4befb9cc0aef5813 GIT binary patch literal 1099 zcmV-R1ho5!P)EX>4Tx04R}tkv&MmP!xqvQ$>-Ag9W8HWT;LSq>4Cd6^c+H)C#RSn7s54nlvOS zE{=k0!NH%!s)LKOt`4q(Aov5~=H{g6A|>9J6k5c1;qgAsyXWxUeSpxYFwN?k05sh; z)5(OG&8><(uLvNBAw&?DnPtpLQVPEHbx++?cQKyj-}h(rt9gq70g-r?8KzCVK|H-_ z8=Uuv!>lB$#OK80CS8#Dk?V@bZ=8!R3p_JyX43P-VPdh^!Ab|SlBp3-5l2-`r+gvn zvC4UivsS6G);;+PLwS8=nd`Jhki;UEAVGwJ8p^1^MvQiy6borOPx$yFu3sXTLas6x zITlcb2HEw4|H1FsT7}8DmlR3>-7k*wF$(nT0?oSPd>=bb^8^S!16O+6Uu^(0pQP8@ zTJ#7Q*aj}H+nTZmTeSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00JXPL_t(|+U=Y%irYXGhJOX0L-iIRg&H-%ix1#syJ6W| zqzMFpG3X+OH0qWu<^X~%w1ptJajA2Jz@&&JW{n(cH;FZJzQ3AhkA|7wPw&%6!jZy} zd*gA@n3H}NihI^t<$2y361^f822NNQh=JoO3S}bJ+E+uQu4`pkHtHH?A^nJ-S5P`x_7-1j=LSZNjg`qGt5QtzPg2Mkjg_9&X8AIU{ z6dn>&1Azz-0U~VWFp#Yr5J4CSg`qGMhQic93ha;qNz#w+pLBmGJw5MKRqTZa>*jW+o7){X6NV^Bk{2}gjq}@~yp<5# zDcn-{!~0?V$iN=?cUK-CuGH7gvMdVamb`(0Z> z;n3+i*;AOunot;F;2FhpVJHlRp)e3Z7zl--FcgNu)IbcxKqx$(Ciz$JKLP0$;wt?_ RuH*m!002ovPDHLkV1n`d^B4dC literal 0 HcmV?d00001 diff --git a/dev-assets/doodads/doors/small-key.png b/dev-assets/doodads/doors/small-key.png new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OYkH}&M25w;xW@MN(M*=9wUgGKN%Kns*g+WAl%QTBXppayVYeb22er|4RUI~M9 zQEFmIYKlU6W=V#EyQgnJcq5-UFuLnKT^vIyZoQpzu(#Pjz_mT})eNN_0j%la4&okq zEtC6A9x&BBcJe-_>LMuZtgt#^)BE{CXFN_`|8W0=lb(wHQCZWY6YYO&Dr^33C-?T1 zMc<`uZ}k_?TGknR-SZloU;P7(si~TluRp!&{ml2_-tmz1CD*=Pdy?~@f5G{ZgjK@R zte)s+`{h5dVPBq8HLZW;*7B@pHTO4Q(KU1%WL(I~+Iq(#~e z1xR!#@U#FaF6Tre0cJx1APrU{;0RNaqQExqr{KKPmhIKm))yp%LqkJCdkiP?-7z?3 z@!Tc!{q@k$RjazLMID==n|$VyRq~lb5|gV^>p4Yn^2Bj3+mG6V2Q1N|YrFuq7#g9mF-c(Se0o5W-gGIpP3zkBAy` zBL~}}En)GeXZT&WH98Z1ZsNJ$3hzW(FLulRNSymlS#utO9tDnm{ Hr-UW|#7mEg literal 0 HcmV?d00001 diff --git a/dev-assets/doodads/doors/small-right.png b/dev-assets/doodads/doors/small-right.png new file mode 100644 index 0000000000000000000000000000000000000000..4f5505602e7fcd633715a28b0265dae098567a80 GIT binary patch literal 936 zcmeAS@N?(olHy`uVBq!ia0vp^0YL1-!3HFMu^RX?Ffg`cIy(n=Iy);A6y>L7=A<$( zXiTh~XzOt}K%~__*mYu8GwV`|loftrOS&wwM7shMuW+rknz82#|11*~O})OR?1KmA zA6?bly?Gtqx+aAm%#WTuTk=9l_1<)ms3R2*KiZw!{rtnd+J*}&49>oq#b9#R?DEN$ z8E4ma*{8 zO?O&nBw;BQ(8_l6YxDnu?{7x6p4>5A#Eapse&1(9t}kzx&hC0#BX8~ZnT5lSIlSt2 zd@h6W{3X|KM}6UtxWT5k?)I!r>@n{c4*R#|oLVQcL{)_Az;DUgU_OaGtiP`9*}3&x z;V*`ijIfo`4;~0eXa{}Ub$)lX_49A}{@Hc*xwDIwa$fVl3XB%EByV>YhW{YAVDIwD zKoQOYkH}&M25w;xW@MN(M*=9wUgGKN%Kns*g+WB_&A$={ppayVYeb22er|4RUI~M9 zQEFmIYKlU6W=V#EyQgnJcq5-UFuEH&T^vIyZoR#;vA5Ykt3g2f7NAGIaYD2{CeqLi#QiX*C&ar74L)dQlA{#b}n+)dVR&+ zL1(zmtZi8;`stkIQSlG;@^h*#$JC$ceLM5>MB9RQzb@UFXZhtovlFAH0@q>#5NhUN zbx9O)10exL5rNh~2@rB@VOj*1UTn}Iz}0a`qvw!@4?l~bz|Oom#cK|%H9V#gDjF)9 zd?sD1=8D-dOZ8P%^1-1y@8+G1I&JoBs^!l2$RjM_|WfmWKcU literal 0 HcmV?d00001 diff --git a/dev-assets/doodads/doors/small-unlocked.png b/dev-assets/doodads/doors/small-unlocked.png new file mode 100644 index 0000000000000000000000000000000000000000..5596796e3d0f52b02a053457149b6ddc03de4486 GIT binary patch literal 932 zcmV;V16%xwP)EX>4Tx04R}tkv&MmP!xqvQ$>-Ag9W8HWT;LSq>4Cd6^c+H)C#RSn7s54nlvOS zE{=k0!NH%!s)LKOt`4q(Aov5~=H{g6A|>9J6k5c1;qgAsyXWxUeSpxYFwN?k05sh; z)5(OG&8><(uLvNBAw&?DnPtpLQVPEHbx++?cQKyj-}h(rt9gq70g-r?8KzCVK|H-_ z8=Uuv!>lB$#OK80CS8#Dk?V@bZ=8!R3p_JyX43P-VPdh^!Ab|SlBp3-5l2-`r+gvn zvC4UivsS6G);;+PLwS8=nd`Jhki;UEAVGwJ8p^1^MvQiy6borOPx$yFu3sXTLas6x zITlcb2HEw4|H1FsT7}8DmlR3>-7k*wF$(nT0?oSPd>=bb^8^S!16O+6Uu^(0pQP8@ zTJ#7Q*aj}H+nTZmTeSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00DeSL_t(|+U=aNk;5PmMVA}bK@m!nsSTP@NHa9B1&}GB z26e(EmWR0+pU<+-fb@PO0vPcO`@9Zpq@CoQ^GwZ`{%VDus*3l117e;S3jjL~00CGx zrj-{_)u$zrQj&R|tM1{_(x;hH>h1(yT6>}GM5$^nPuRUNH4upakYHgXf`zd#0U!Xe zFc!wbSeP1!L;y&z@aZi)48y}Q7Jgvizl^DYNCb%>5n4F_(#jzb0zfQ`g|RRerUn8K zi6D`Gj&m-Hh=dT#J0)^&-9rI%&Sh)u?fK_s_e!K(cO1vOEQ>iDz;cr!BG%g5sd@F( zmFrH^BqH(=h}FNwlpC)xzk3VE7$wG7ZGLwa9>+0Xub9LbWxHmtTDU9^<+_Kv!q<)E z;`uEW4j~xlTwd4pWAK`as%Gzf-aDofp_Kz5p%*?$FZ>&j-og*6)Ib0N5DQ~rEDS&_ zj6?_ku`m|K!dRFZ2tWX0VJwV=u`m`!A_Rb^v9NUdSMcBNKgIITT0D~g00001 quantity, show the quantity in the corner. + if qty := s.Player.HasItem(filename); qty > 0 { + s.invenDoodads[filename].CornerLabel = fmt.Sprintf("%d", qty) } else { - s.invenFrame.Show() + s.invenDoodads[filename].CornerLabel = "" } - // Cache the item list so we don't run the above logic every single tick. - s.invenItems = items + s.invenDoodads[filename].Show() } + // Hide any doodad that used to be in the inventory but now is not. + for filename, canvas := range s.invenDoodads { + if _, ok := seen[filename]; !ok { + canvas.Hide() + } + } + + // Recompute the size of the inventory frame. + // TODO: this works around a bug in ui.Frame, at the bottom of + // compute_packed, a frame Resize's itself to fit the children but this + // trips the "manually set size" boolean... packing more items after a + // computer doesn't resize the frame. So here, we resize-auto it to + // reset that boolean so the next compute, picks the right size. + s.invenFrame.Configure(ui.Config{ + AutoResize: true, + Width: 1, + Height: 1, + }) + s.invenFrame.Compute(s.d.Engine) + + // If we removed all items, hide the frame. + if len(items) == 0 { + s.invenFrame.Hide() + } else { + s.invenFrame.Show() + } + + // Cache the item list so we don't run the above logic every single tick. + s.invenItems = items + // Compute the inventory frame so it positions and wraps the items. s.screen.Compute(s.d.Engine) } diff --git a/pkg/uix/actor.go b/pkg/uix/actor.go index 06a96b4..1756b56 100644 --- a/pkg/uix/actor.go +++ b/pkg/uix/actor.go @@ -207,7 +207,11 @@ func (a *Actor) SetNoclip(v bool) { // Item name is usually the doodad filename. func (a *Actor) AddItem(itemName string, quantity int) { a.muInventory.Lock() - a.inventory[itemName] = quantity + if _, ok := a.inventory[itemName]; ok { + a.inventory[itemName] += quantity + } else { + a.inventory[itemName] = quantity + } a.muInventory.Unlock() } diff --git a/pkg/uix/canvas.go b/pkg/uix/canvas.go index dbdc214..a4e1fe4 100644 --- a/pkg/uix/canvas.go +++ b/pkg/uix/canvas.go @@ -31,6 +31,10 @@ type Canvas struct { Scrollable bool // Cursor keys will scroll the viewport of this canvas. Zoom int // Zoom level on the canvas. + // Custom label to place in the lower-right corner of the canvas. + // Used for e.g. the quantity badge on Inventory items. + CornerLabel string + // Selected draw tool/mode, default Pencil, for editable canvases. Tool drawtool.Tool BrushSize int // thickness of selected brush diff --git a/pkg/uix/canvas_present.go b/pkg/uix/canvas_present.go index aadef58..741e7af 100644 --- a/pkg/uix/canvas_present.go +++ b/pkg/uix/canvas_present.go @@ -152,6 +152,24 @@ func (w *Canvas) Present(e render.Engine, p render.Point) { w.presentStrokes(e) w.presentCursor(e) + // Custom label in the canvas corner? (e.g. for Inventory item counts) + if w.CornerLabel != "" { + label := ui.NewLabel(ui.Label{ + Text: w.CornerLabel, + Font: render.Text{ + FontFilename: balance.ShellFontFilename, + Size: balance.ShellFontSizeSmall, + Color: render.White, + }, + }) + label.SetBackground(render.RGBA(0, 0, 50, 150)) + label.Compute(e) + label.Present(e, render.Point{ + X: p.X + S.W - label.Size().W - w.BoxThickness(1), + Y: p.Y + S.H - label.Size().H - w.BoxThickness(1), + }) + } + // XXX: Debug, show label in canvas corner. if balance.DebugCanvasLabel { rows := []string{