From 694cdf5f70958caa54c7ea411cc4bbdc48294507 Mon Sep 17 00:00:00 2001 From: Kiri Date: Wed, 22 Mar 2023 22:58:41 -0700 Subject: [PATCH] Knocking out TODO items. --- TODO.md | 21 +++++++ sprites/jmpra0.aseprite | Bin 0 -> 3346 bytes sprites/jmpra0.png | Bin 0 -> 1609 bytes textures.txt | 16 ++++++ zscript.zs | 119 ++++++++++++++++++++++++++++++++++------ 5 files changed, 140 insertions(+), 16 deletions(-) create mode 100644 TODO.md create mode 100644 sprites/jmpra0.aseprite create mode 100644 sprites/jmpra0.png create mode 100644 textures.txt diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..3dea199 --- /dev/null +++ b/TODO.md @@ -0,0 +1,21 @@ +# TODO + +n Deployed sprites for every angle (wall) +n - Showing charge level +n Deployed sprites for every angle (ceiling) +n - Showing charge level +x flat sprite? Advantages: One direction, can probably be used on ceiling and wall. +x - Showing charge level + +- Pickup sprites for every angle + - Spool of wire, a tool, and some electical tape + +- 1st-person sprites + - Wire cutters and electrical tape + +x Sparks +x Debris when destroyed + +- Switching to mag manager goes to batteries screen + +- Show remaining batteries as ammo diff --git a/sprites/jmpra0.aseprite b/sprites/jmpra0.aseprite new file mode 100644 index 0000000000000000000000000000000000000000..acefa324e3c499e08e8fd2100d5769a6d06498ad GIT binary patch literal 3346 zcmcJRe{hra9mk(i`ePI*v^Oeb(qh>vbPyzHknGI3Fe0Y6;Idu7$O>zB8O9oBz@TMh zE@M^OGprFJ#$9kl<3y+{gG8j346U+3WKyyK%QW|J&2+ ztKUA)ljr;We81oK>q*f#O*{2smUf#~spV@~nx@tAJ91o>KUrCFQk%ff|Kn&Lt7%uy z7pPtf=wK4Rd1b208@ij4t7((V)bKc~-*81WIZ;|t080wyHRzYlD|}?t~XwTHsJD1~ZWe9B62O z{q^;*HxPiGJ|FC;sex&a2e!N2Fy(Z@R=XW0tyb7#vB0>=1Y<@cj8sbRjpfpNxKu_M zQsWPnl+X^SDtv`9X0NKHTGirFbS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NiYFaBN6_sz%7J!X4m zuI1#^*85^%`#)x08@~0u4b%IYwuLk4`?7o8iKh7c!pO|iXHRxzOl#ll=*ex_(N%S5 z;-w{fXEa}_eWk;;xb|q%_kLKh{H`Uo`TLgD&Uq|a+v3~rJ^lCZd|tF`Z~nLDMg1Qh zxisJT!cYHDWvIEdye_n&d7o)Y)9$9(O|idi|GjDJZ~u7wo%1~(b*-6m@`2XB&hYu? t#J1n@{u%SnR^2~kQImV|;8Tz9+hkglIec!yg~G$zET87w{MLETzXAQn)~^5n literal 0 HcmV?d00001 diff --git a/sprites/jmpra0.png b/sprites/jmpra0.png new file mode 100644 index 0000000000000000000000000000000000000000..42665d7a2336eb58b8ddf3d194e2e7c8570bb48c GIT binary patch literal 1609 zcmd^A0dG@P6h32wj&)nNm90XT6jqleEAnI=zCnTK_BP)}b#Ly0WxhZOMG8D!fd?sB zBZU<$OVJKGX=2ezMrdNqDyySnBgIXqQrv_>iYZdUhQ&=X1tN~1*Ejqb-rRFf&P~pD z&b{AvbGurasr=k|xd4#g)L7pt_{D;$bFzi?7fE+Qa9MmSRR?{;WxonRj%jD@#%V8D zUZi8&A%JXXd3kk%5G!P2nM9=1=@3G4xm+rhip64)NQB`ErCK6Wh$J$gwQ5SEB-C;g z4nGP69`yE3csv=GEA4Qktkwk2$2l%$G)7rAqSuFLI!IA|g6P$1y&8=N!(3{$Q>nBo z6gIisB9rk_DJPMb#A1U;#EL|WNJIlr03-mKNTbmNO2tqjf<{6p=0{O4invk8{wQFb z?Bz3FF6}lZo$QF6iQDL?RTtu^fSK&&2(MA=GT;uq#>QY4TFp@^1F2*Pg$|b!m`tOV zs+E$-$;nJ6lTN2osZ=77h{xlxSS%WihQr}dC=>_;{C>aB=ks_xZnxX%blUB9o6Tmi zSj=WK$8koZk!4xEUQg3BMNuS4YPDJ%$1x03sZ>g((t^z9Ns}pUFpTKgD9r>ZosS^h zIAOGp{#sG;5?7y_TXi1f|9a6+-+( zN}r67LtZRsRd`vcgB0;<5V%IE6pBQU*Nd!HWH2CtKneu{m;@LFNCLzGq5vTPKY$m& z319=@0ZafafIykRS0;mEF%$?OmkaScVi<(uf{FwfVG1w;h5#UB+W|NLX1eY~3MC^b z=0zbZ>Sd8ji)``-yllcONt+}|gE+1i4bc#$AV@y#6D1J}A>=}cLx@61i4gb+@ZsRb zz@ZexsUk5su9RYOu~6cvl(YaCfD%9kAZ!Biktm}>Rv{IQz=#jLX5joBH$0ZVN_Z=< ztF`%QZ`1w#&&GduEF2pDYD{1(E7??EySlOK-nH7+iRbfX-FkPfb(a_$2(%wDww!x! zpd)2Dl2?{s_o|zk%2elAVsZEBze3OIw_;P_9aC80sc+5ohw2}$cwIcGC|}oAYM5OS z=^oF%n;boPP~7&yg~!ZcPw~-(MY3fj)vC6GU4?_EUQET;{2~9nXYhlmj)kQ&jxWg3 z67O6BA5^E?mt1#VURp$r)|{Qc z-Vn>ZTDNC=!E-0BvRmd=eqK^}{pPDhLn&(9v3_^qvf^jT%i4?1R#!Cy-#C^U+`Phi zzvqeXj$e1H5_T@4k-?Ch{)a z-Sp$bF~*YY3+0iE+-GD*%U{}k!}Dp&oVE<#Fnn$B{M^REA})ZMjcz~ zD^|IGnmMrY=YpL*qa}}ze^<^_ZVRp~US9G@lU2Sm_ru$Bo($m`)$EZaRkCZt(;o#i MH8j`v)otkf7lhA1)Bpeg literal 0 HcmV?d00001 diff --git a/textures.txt b/textures.txt new file mode 100644 index 0000000..960187a --- /dev/null +++ b/textures.txt @@ -0,0 +1,16 @@ +sprite JMPRA0, 49, 43 { + offset 24, 21 + patch JMPRA0,0,0 { } +} +sprite JMPRB0, 49, 43 { + offset 24, 21 + patch JMPRA0,0,0 { translation "112:120=160:167" } +} +sprite JMPRC0, 49, 43 { + offset 24, 21 + patch JMPRA0,0,0 { translation "112:120=32:47" } +} +sprite JMPRD0, 49, 43 { + offset 24, 21 + patch JMPRA0,0,0 { translation "112:120=96:111" } +} diff --git a/zscript.zs b/zscript.zs index 7e38f1a..8bbf52d 100644 --- a/zscript.zs +++ b/zscript.zs @@ -52,6 +52,7 @@ class JumperCablesMapLoader : EventHandler void RegisterCables(JumperCablesDeployed cableActor) { + Console.printf("REGISTERING %d\n", deployedCables.Find(cableActor)); if(deployedCables.Find(cableActor) == deployedCables.size()) { deployedCables.Push(cableActor); @@ -62,7 +63,7 @@ class JumperCablesMapLoader : EventHandler void UnregisterCables(JumperCablesDeployed cableActor) { - Console.printf("UNREGISTERING\n"); + Console.printf("UNREGISTERING %d\n", deployedCables.Find(cableActor)); int index = deployedCables.find(cableActor); if(index != deployedCables.size()) { deployedCables.delete(index); @@ -80,23 +81,58 @@ class JumperCablesDeployed : HDUPK default { + radius 2; + height 4; + +SpriteAngle; + Scale 0.4; } states { spawn: - DERP A -1 nodelay { - invoker.bNoGravity = true; - - // Register us with the global event handler so we can - // respond to the linedef getting used. - JumperCablesMapLoader loader = JumperCablesMapLoader.Get(); - loader.RegisterCables(self); - } + JMPR CABD -1; stop; - give: - DERP A 0; - goto spawn; + } + + override void PostBeginPlay() + { + Console.printf("IS THIS EVEN GETTING CALLED!?\n"); + bNoGravity = true; + + // Register us with the global event handler so we can + // respond to the linedef getting used. + JumperCablesMapLoader loader = JumperCablesMapLoader.Get(); + loader.RegisterCables(self); + + UpdateSprite(); + } + + void SetWallSprite(Vector2 lineDir) + { + bFlatSprite = false; + bWallSprite = true; + A_SetAngle(atan2(lineDir) + 90); + } + + void SetFlatSprite(float angle) + { + bFlatSprite = true; + bWallSprite = false; + A_SetAngle(angle); + } + + void UpdateSprite() + { + // Charge levels correspond to battery sprite charge levels. + if(charges > 13) { + frame = 0; + } else if(charges > 6) { + frame = 1; + } else if(charges > 0) { + frame = 2; + } else { + frame = 3; + } } void DecrementBattery() @@ -106,6 +142,8 @@ class JumperCablesDeployed : HDUPK if(charges <= 0) { DespawnToBattery(); } + + UpdateSprite(); } void DespawnToBattery() @@ -116,7 +154,23 @@ class JumperCablesDeployed : HDUPK // Spawn a battery, with the same level of charge. HDMagAmmo.SpawnMag(self, "HDBattery", self.charges); - // TODO: Spawn debris. + // Spawn some smoke. + int smokeCount = random(1, 4); + float smokeVel = 20.0; + for(int k = 0; k < smokeCount; k++) { + A_SpawnItemEx( + "HDSmokeChunk", + 0.0, 0.0, 0.0, + frandom(-smokeVel, smokeVel), + frandom(-smokeVel, smokeVel), + frandom(-smokeVel, smokeVel)); + } + + // Spawn a bunch of sparks. + int sparkAmount = random(3,6); + for(int k = 0; k < sparkAmount; k++) { + SpawnSpark(); + } JumperCablesMapLoader loader = JumperCablesMapLoader.Get(); loader.UnregisterCables(self); @@ -130,8 +184,34 @@ class JumperCablesDeployed : HDUPK return false; } - // TODO: Tick function where we add sparks and stuff? - // TODO: Tick function where we set the sprite to indicate the charge level. + void SpawnSpark() + { + A_StartSound("misc/arccrackle", CHAN_AUTO); + A_SpawnParticle( + "white", + SPF_RELATIVE | SPF_FULLBRIGHT, + random(1, 10), // lifetime + frandom(1, 7), // size + 0, // angle + // offset... + frandom(-1.0, 1.0), + frandom(-1.0, 1.0), + frandom(-1.0, 1.0), + // vel... + frandom(-1.0, 1.0), + frandom(-1.0, 1.0), + frandom(-1.0, 1.0)); + } + + override void Tick() + { + if(frandom(0.0, 1.0) < 0.02) { + SpawnSpark(); + } + + } + + // TODO: Tick function (or whatever) where we set the sprite to indicate the charge level. // TODO: Despawn if the sector gets broken *again*? } @@ -403,12 +483,19 @@ class JumperCablesUsable : HDWeapon JumperCablesDeployed deployed = JumperCablesDeployed( Spawn( "JumperCablesDeployed", - linetraceData.hitLocation - linetraceData.hitDir * 8)); + linetraceData.hitLocation - linetraceData.hitDir * 4)); deployed.lineDefIndex = brokenLine.index(); deployed.bNoGravity = true; deployed.charges = batteryCharges; + if(linetraceData.hitType == TRACE_HitFloor || linetraceData.hitType == TRACE_HitCeiling) { + deployed.SetFlatSprite(invoker.owner.angle); + } else { + Vector2 lineDir = linetraceData.hitLine.v2.p - linetraceData.hitLine.v1.p; + deployed.SetWallSprite(lineDir); + } + brokenLine.special = originalSpecial; } }