Knocking out TODO items.

This commit is contained in:
Kiri 2023-03-22 22:58:41 -07:00
parent cebcd7ae97
commit 694cdf5f70
5 changed files with 140 additions and 16 deletions

21
TODO.md Normal file
View File

@ -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

BIN
sprites/jmpra0.aseprite Normal file

Binary file not shown.

BIN
sprites/jmpra0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

16
textures.txt Normal file
View File

@ -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" }
}

View File

@ -52,6 +52,7 @@ class JumperCablesMapLoader : EventHandler
void RegisterCables(JumperCablesDeployed cableActor) void RegisterCables(JumperCablesDeployed cableActor)
{ {
Console.printf("REGISTERING %d\n", deployedCables.Find(cableActor));
if(deployedCables.Find(cableActor) == deployedCables.size()) { if(deployedCables.Find(cableActor) == deployedCables.size()) {
deployedCables.Push(cableActor); deployedCables.Push(cableActor);
@ -62,7 +63,7 @@ class JumperCablesMapLoader : EventHandler
void UnregisterCables(JumperCablesDeployed cableActor) void UnregisterCables(JumperCablesDeployed cableActor)
{ {
Console.printf("UNREGISTERING\n"); Console.printf("UNREGISTERING %d\n", deployedCables.Find(cableActor));
int index = deployedCables.find(cableActor); int index = deployedCables.find(cableActor);
if(index != deployedCables.size()) { if(index != deployedCables.size()) {
deployedCables.delete(index); deployedCables.delete(index);
@ -80,23 +81,58 @@ class JumperCablesDeployed : HDUPK
default default
{ {
radius 2;
height 4;
+SpriteAngle;
Scale 0.4;
} }
states states
{ {
spawn: spawn:
DERP A -1 nodelay { JMPR CABD -1;
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);
}
stop; 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() void DecrementBattery()
@ -106,6 +142,8 @@ class JumperCablesDeployed : HDUPK
if(charges <= 0) { if(charges <= 0) {
DespawnToBattery(); DespawnToBattery();
} }
UpdateSprite();
} }
void DespawnToBattery() void DespawnToBattery()
@ -116,7 +154,23 @@ class JumperCablesDeployed : HDUPK
// Spawn a battery, with the same level of charge. // Spawn a battery, with the same level of charge.
HDMagAmmo.SpawnMag(self, "HDBattery", self.charges); 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(); JumperCablesMapLoader loader = JumperCablesMapLoader.Get();
loader.UnregisterCables(self); loader.UnregisterCables(self);
@ -130,8 +184,34 @@ class JumperCablesDeployed : HDUPK
return false; return false;
} }
// TODO: Tick function where we add sparks and stuff? void SpawnSpark()
// TODO: Tick function where we set the sprite to indicate the charge level. {
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*? // TODO: Despawn if the sector gets broken *again*?
} }
@ -403,12 +483,19 @@ class JumperCablesUsable : HDWeapon
JumperCablesDeployed deployed = JumperCablesDeployed( JumperCablesDeployed deployed = JumperCablesDeployed(
Spawn( Spawn(
"JumperCablesDeployed", "JumperCablesDeployed",
linetraceData.hitLocation - linetraceData.hitDir * 8)); linetraceData.hitLocation - linetraceData.hitDir * 4));
deployed.lineDefIndex = brokenLine.index(); deployed.lineDefIndex = brokenLine.index();
deployed.bNoGravity = true; deployed.bNoGravity = true;
deployed.charges = batteryCharges; 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; brokenLine.special = originalSpecial;
} }
} }