Compare commits
3 Commits
a7d9909275
...
e57fcd5767
Author | SHA1 | Date | |
---|---|---|---|
e57fcd5767 | |||
421dda74a3 | |||
d99fad4756 |
8
TODO.md
@ -17,11 +17,13 @@ x Pickup sprites for every angle
|
|||||||
n - Spool of wire, a tool, and some electical tape
|
n - Spool of wire, a tool, and some electical tape
|
||||||
x Set bulk
|
x Set bulk
|
||||||
|
|
||||||
- 1st-person sprites
|
x 1st-person sprites
|
||||||
- Wire cutters and electrical tape
|
n Wire cutters and electrical tape
|
||||||
|
|
||||||
- Pickup sound
|
- Pickup sound
|
||||||
|
|
||||||
|
- Fault detection sound
|
||||||
|
|
||||||
|
- ready animation
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,10 +236,12 @@ brightmaps : povsprite.aseprite
|
|||||||
--layer "brightmap_leds" \
|
--layer "brightmap_leds" \
|
||||||
--frame-range 0,2 --save-as brightmap_leds.png
|
--frame-range 0,2 --save-as brightmap_leds.png
|
||||||
|
|
||||||
aseprite -b $^ \
|
|
||||||
--layer "brightmap_digits" \
|
|
||||||
--frame-range 0,0 --save-as brightmap_digits.png
|
|
||||||
|
|
||||||
composite brightmap_display.png brightmap_leds1.png -compose screen ../sprites/jmpr_brightmap_1.png
|
composite brightmap_display.png brightmap_leds1.png -compose screen ../sprites/jmpr_brightmap_1.png
|
||||||
composite brightmap_display.png brightmap_leds2.png -compose screen ../sprites/jmpr_brightmap_2.png
|
composite brightmap_display.png brightmap_leds2.png -compose screen ../sprites/jmpr_brightmap_2.png
|
||||||
composite brightmap_display.png brightmap_leds3.png -compose screen ../sprites/jmpr_brightmap_3.png
|
composite brightmap_display.png brightmap_leds3.png -compose screen ../sprites/jmpr_brightmap_3.png
|
||||||
|
|
||||||
|
rm brightmap_display.png
|
||||||
|
rm brightmap_leds?.png
|
||||||
|
|
||||||
|
rm tmp?.png
|
||||||
|
|
||||||
|
BIN
sprites/jmila0.png
Normal file
After Width: | Height: | Size: 373 B |
BIN
sprites/jmilb0.png
Normal file
After Width: | Height: | Size: 342 B |
BIN
sprites/jmilc0.png
Normal file
After Width: | Height: | Size: 365 B |
BIN
sprites/jmild0.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
sprites/jmile0.png
Normal file
After Width: | Height: | Size: 357 B |
BIN
sprites/jmilf0.png
Normal file
After Width: | Height: | Size: 362 B |
BIN
sprites/jmilg0.png
Normal file
After Width: | Height: | Size: 369 B |
BIN
sprites/jmilh0.png
Normal file
After Width: | Height: | Size: 350 B |
BIN
sprites/jmili0.png
Normal file
After Width: | Height: | Size: 374 B |
BIN
sprites/jmilj0.png
Normal file
After Width: | Height: | Size: 371 B |
BIN
sprites/jmilk0.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
sprites/jmill0.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
sprites/jmilm0.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
sprites/jmiln0.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
sprites/jmilo0.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
sprites/jmilp0.png
Normal file
After Width: | Height: | Size: 360 B |
BIN
sprites/jmira0.png
Normal file
After Width: | Height: | Size: 369 B |
BIN
sprites/jmirb0.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
sprites/jmirc0.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
sprites/jmird0.png
Normal file
After Width: | Height: | Size: 365 B |
BIN
sprites/jmire0.png
Normal file
After Width: | Height: | Size: 357 B |
BIN
sprites/jmirf0.png
Normal file
After Width: | Height: | Size: 361 B |
BIN
sprites/jmirg0.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
sprites/jmirh0.png
Normal file
After Width: | Height: | Size: 350 B |
BIN
sprites/jmiri0.png
Normal file
After Width: | Height: | Size: 370 B |
BIN
sprites/jmirj0.png
Normal file
After Width: | Height: | Size: 369 B |
BIN
sprites/jmirk0.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
sprites/jmirl0.png
Normal file
After Width: | Height: | Size: 360 B |
BIN
sprites/jmirm0.png
Normal file
After Width: | Height: | Size: 360 B |
BIN
sprites/jmirn0.png
Normal file
After Width: | Height: | Size: 360 B |
BIN
sprites/jmiro0.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
sprites/jmirp0.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
sprites/jmpia0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpib0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpic0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpid0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpie0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpif0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpig0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpja0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpjb0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpjc0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpjd0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpje0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpjf0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpjg0.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
sprites/jmpr_brightmap_1.png
Normal file
After Width: | Height: | Size: 684 B |
BIN
sprites/jmpr_brightmap_2.png
Normal file
After Width: | Height: | Size: 629 B |
BIN
sprites/jmpr_brightmap_3.png
Normal file
After Width: | Height: | Size: 656 B |
158
zscript.zs
@ -28,16 +28,6 @@ class JumperCablesMapLoader : EventHandler
|
|||||||
worldScanCompleted = false;
|
worldScanCompleted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
override void WorldLoaded(WorldEvent e)
|
|
||||||
{
|
|
||||||
// JumperCablesMapLoader loader = Get();
|
|
||||||
|
|
||||||
// // Clear out anything from the last level.
|
|
||||||
// deployedCables.Clear();
|
|
||||||
// loader.originalLinedefSpecials2.Clear();
|
|
||||||
// worldScanCompleted = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
override void WorldTick()
|
override void WorldTick()
|
||||||
{
|
{
|
||||||
JumperCablesMapLoader loader = Get();
|
JumperCablesMapLoader loader = Get();
|
||||||
@ -54,21 +44,16 @@ class JumperCablesMapLoader : EventHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
loader.worldScanCompleted = true;
|
loader.worldScanCompleted = true;
|
||||||
|
|
||||||
Console.printf("JMP: World scan completed.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override void WorldLineActivated(WorldEvent e)
|
override void WorldLineActivated(WorldEvent e)
|
||||||
{
|
{
|
||||||
// TODO: Deplete batteries.
|
// Is this line affected by a battery?
|
||||||
//Console.printf("Line activated: %d %d\n", e.ActivatedLine.index(), e.ActivatedLine.special);
|
|
||||||
|
|
||||||
for(int cableIndex = 0; cableIndex < deployedCables.size(); cableIndex++) {
|
for(int cableIndex = 0; cableIndex < deployedCables.size(); cableIndex++) {
|
||||||
if(deployedCables[cableIndex].lineDefIndex == e.ActivatedLine.index()) {
|
if(deployedCables[cableIndex].lineDefIndex == e.ActivatedLine.index()) {
|
||||||
|
// Yes. Deplete the battery.
|
||||||
deployedCables[cableIndex].DecrementBattery();
|
deployedCables[cableIndex].DecrementBattery();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,24 +61,16 @@ 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);
|
||||||
|
|
||||||
// FIXME: Remove this.
|
|
||||||
// Console.printf("Cables registered %d\n", deployedCables.size());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterCables(JumperCablesDeployed cableActor)
|
void UnregisterCables(JumperCablesDeployed cableActor)
|
||||||
{
|
{
|
||||||
// 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);
|
||||||
|
|
||||||
// FIXME: Remove this.
|
|
||||||
// Console.printf("Cables unregistered %d\n", deployedCables.size());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +97,6 @@ class JumperCablesDeployed : HDUPK
|
|||||||
|
|
||||||
override void PostBeginPlay()
|
override void PostBeginPlay()
|
||||||
{
|
{
|
||||||
// Console.printf("IS THIS EVEN GETTING CALLED!?\n");
|
|
||||||
bNoGravity = true;
|
bNoGravity = true;
|
||||||
|
|
||||||
// Register us with the global event handler so we can
|
// Register us with the global event handler so we can
|
||||||
@ -235,10 +211,13 @@ class JumperCablesDeployed : HDUPK
|
|||||||
if(frandom(0.0, 1.0) < 0.02) {
|
if(frandom(0.0, 1.0) < 0.02) {
|
||||||
SpawnSpark();
|
SpawnSpark();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Tick function (or whatever) where we set the sprite to indicate the charge level.
|
// Despawn to battery if the sector gets re-destroyed.
|
||||||
// TODO: Despawn if the sector gets broken *again*?
|
if(level.lines[lineDefIndex].special == 0)
|
||||||
|
{
|
||||||
|
DespawnToBattery();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class JumperCablesUsable : HDWeapon
|
class JumperCablesUsable : HDWeapon
|
||||||
@ -290,18 +269,13 @@ class JumperCablesUsable : HDWeapon
|
|||||||
Actor hpc,
|
Actor hpc,
|
||||||
String whichdot)
|
String whichdot)
|
||||||
{
|
{
|
||||||
// int cx,cy,cw,ch;
|
// Switch reticle colors depending on the LED status.
|
||||||
// [cx,cy,cw,ch]=screen.GetClipRect();
|
|
||||||
// statusBar.SetClipRect(cx,cy,cw,ch);
|
|
||||||
|
|
||||||
String filename = String.Format("graphics/jmpr_reticle%d.png", lastIndicatorStatus + 1);
|
String filename = String.Format("graphics/jmpr_reticle%d.png", lastIndicatorStatus + 1);
|
||||||
// console.printf("blep, %s %d\n", filename, frame);
|
|
||||||
statusBar.drawImage(
|
statusBar.drawImage(
|
||||||
filename,
|
filename,
|
||||||
(0, 0) + bob,
|
(0, 0) + bob,
|
||||||
statusBar.DI_SCREEN_CENTER | statusBar.DI_ITEM_TOP,
|
statusBar.DI_SCREEN_CENTER | statusBar.DI_ITEM_TOP,
|
||||||
scale : (0.5, 0.5));
|
scale : (0.5, 0.5));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
states
|
states
|
||||||
@ -313,9 +287,21 @@ class JumperCablesUsable : HDWeapon
|
|||||||
stop;
|
stop;
|
||||||
|
|
||||||
select:
|
select:
|
||||||
JMPP A 0;
|
JMPP A 1;
|
||||||
|
|
||||||
|
// Raise it back up...
|
||||||
|
JMPP A 1 offset(0, 128);
|
||||||
|
JMPP A 1 offset(0, 96);
|
||||||
|
JMPP A 1 offset(0, 72);
|
||||||
|
JMPP A 1 offset(0, 64);
|
||||||
|
JMPP A 1 offset(0, 48);
|
||||||
|
JMPP A 1 offset(0, 32);
|
||||||
|
JMPP A 1 offset(0, 16);
|
||||||
|
JMPP A 1 offset(0, 0);
|
||||||
|
|
||||||
goto super::select;
|
goto super::select;
|
||||||
|
|
||||||
|
// LCD overlay states.
|
||||||
ledd_left_indicator:
|
ledd_left_indicator:
|
||||||
JMIL A 1 offset(0, -32); wait;
|
JMIL A 1 offset(0, -32); wait;
|
||||||
ledd_right_indicator:
|
ledd_right_indicator:
|
||||||
@ -329,27 +315,18 @@ class JumperCablesUsable : HDWeapon
|
|||||||
}
|
}
|
||||||
A_WeaponReady(WRF_NOFIRE | WRF_ALLOWUSER3); // USER3 = MagManager.
|
A_WeaponReady(WRF_NOFIRE | WRF_ALLOWUSER3); // USER3 = MagManager.
|
||||||
|
|
||||||
|
// Line trace to see what we might be inspecting.
|
||||||
FLineTraceData linetraceData;
|
FLineTraceData linetraceData;
|
||||||
DoLineTrace(HDPlayerPawn(invoker.owner), linetraceData);
|
DoLineTrace(HDPlayerPawn(invoker.owner), linetraceData);
|
||||||
|
|
||||||
Vector3 hitPos;
|
// Overlay setup.
|
||||||
if(linetraceData.hitType != TRACE_HitNone) {
|
|
||||||
hitPos = linetraceData.hitLocation - Vec3Offset(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
A_Overlay(355, "ledd_left_indicator");
|
A_Overlay(355, "ledd_left_indicator");
|
||||||
A_Overlay(356, "ledd_right_indicator");
|
A_Overlay(356, "ledd_right_indicator");
|
||||||
|
|
||||||
SpawnParticleForLineTrace(
|
// Update displays.
|
||||||
|
UpdateVisualsForLineTrace(
|
||||||
HDPlayerPawn(invoker.owner),
|
HDPlayerPawn(invoker.owner),
|
||||||
linetraceData);
|
linetraceData);
|
||||||
|
|
||||||
// console.printf("blep, %d\n", frame);
|
|
||||||
|
|
||||||
//player.getpsprite(PSP_WEAPON).frame = randompick(0, 1, 2);
|
|
||||||
|
|
||||||
// invoker.lastIndicatorStatus += 1;
|
|
||||||
// invoker.lastIndicatorStatus %= 3;
|
|
||||||
}
|
}
|
||||||
goto readyend;
|
goto readyend;
|
||||||
|
|
||||||
@ -358,6 +335,7 @@ class JumperCablesUsable : HDWeapon
|
|||||||
#### # 0 A_Jump(256,"ready");
|
#### # 0 A_Jump(256,"ready");
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
// Lower it down...
|
||||||
JMPP A 1 offset(0, 16);
|
JMPP A 1 offset(0, 16);
|
||||||
JMPP A 1 offset(0, 32);
|
JMPP A 1 offset(0, 32);
|
||||||
JMPP A 1 offset(0, 48);
|
JMPP A 1 offset(0, 48);
|
||||||
@ -366,16 +344,17 @@ class JumperCablesUsable : HDWeapon
|
|||||||
JMPP A 1 offset(0, 96);
|
JMPP A 1 offset(0, 96);
|
||||||
JMPP A 1 offset(0, 128);
|
JMPP A 1 offset(0, 128);
|
||||||
|
|
||||||
|
// Play some sounds.
|
||||||
JMPP A 0 A_JumpIf(!pressingfire(),"ready");
|
JMPP A 0 A_JumpIf(!pressingfire(),"ready");
|
||||||
JMPP A 4 A_StartSound("weapons/pismagclick",CHAN_WEAPON);
|
JMPP A 4 A_StartSound("weapons/pismagclick",CHAN_WEAPON);
|
||||||
JMPP A 2 A_StartSound("derp/crawl",CHAN_WEAPON,CHANF_OVERLAP);
|
JMPP A 2 A_StartSound("derp/crawl",CHAN_WEAPON,CHANF_OVERLAP);
|
||||||
|
|
||||||
|
// Actual cable attachment happens here.
|
||||||
JMPP A 1 {
|
JMPP A 1 {
|
||||||
// invoker.owner.A_Log("Blep");
|
|
||||||
A_WeaponReady(WRF_NOFIRE | WRF_ALLOWRELOAD | WRF_ALLOWUSER4);
|
|
||||||
AttachCables(HDPlayerPawn(invoker.owner));
|
AttachCables(HDPlayerPawn(invoker.owner));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Raise it back up...
|
||||||
JMPP A 1 offset(0, 128);
|
JMPP A 1 offset(0, 128);
|
||||||
JMPP A 1 offset(0, 96);
|
JMPP A 1 offset(0, 96);
|
||||||
JMPP A 1 offset(0, 72);
|
JMPP A 1 offset(0, 72);
|
||||||
@ -397,28 +376,18 @@ class JumperCablesUsable : HDWeapon
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
action void SpawnParticleForLineTrace(HDPlayerPawn pawn, FLineTraceData linetraceData)
|
action void UpdateVisualsForLineTrace(HDPlayerPawn pawn, FLineTraceData linetraceData)
|
||||||
{
|
{
|
||||||
|
|
||||||
Line hitLine = linetraceData.hitLine;
|
Line hitLine = linetraceData.hitLine;
|
||||||
String particleColor = "darkred";
|
String particleColor = "darkred";
|
||||||
|
|
||||||
// if(linetraceData.hitType == TRACE_HitWall) {
|
|
||||||
// JumperCablesMapLoader loader = JumperCablesMapLoader.Get();
|
|
||||||
// int originalSpecial = loader.originalLinedefSpecials2.Get(hitLine.index());
|
|
||||||
// int thisLineSpecial = hitLine.special;
|
|
||||||
|
|
||||||
// if(originalSpecial != thisLineSpecial) {
|
|
||||||
// particleColor = "green";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Line brokenLine = LineTraceFindbrokenLine(linetraceData);
|
Line brokenLine = LineTraceFindbrokenLine(linetraceData);
|
||||||
|
|
||||||
|
// Set main frame (LEDs) based on raytrace status.
|
||||||
if(brokenLine) {
|
if(brokenLine) {
|
||||||
particleColor = "green";
|
|
||||||
|
|
||||||
// Found somethine we can fix!
|
// Found somethine we can fix!
|
||||||
|
particleColor = "green";
|
||||||
player.getpsprite(PSP_WEAPON).frame = 1;
|
player.getpsprite(PSP_WEAPON).frame = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -437,6 +406,9 @@ class JumperCablesUsable : HDWeapon
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set display overlay frames.
|
||||||
|
|
||||||
|
// Default to random numbers.
|
||||||
int frame_left = random(0, 15);
|
int frame_left = random(0, 15);
|
||||||
int frame_right = random(0, 15);
|
int frame_right = random(0, 15);
|
||||||
|
|
||||||
@ -447,19 +419,19 @@ class JumperCablesUsable : HDWeapon
|
|||||||
if(lineForDisplay) {
|
if(lineForDisplay) {
|
||||||
JumperCablesMapLoader loader = JumperCablesMapLoader.Get();
|
JumperCablesMapLoader loader = JumperCablesMapLoader.Get();
|
||||||
int originalSpecial = loader.originalLinedefSpecials2.Get(lineForDisplay.index());
|
int originalSpecial = loader.originalLinedefSpecials2.Get(lineForDisplay.index());
|
||||||
console.printf("Original special: %d", originalSpecial);
|
|
||||||
frame_right = originalSpecial % 16;
|
frame_right = originalSpecial % 16;
|
||||||
frame_left = originalSpecial / 16;
|
frame_left = originalSpecial / 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getpsprite(355).frame = frame_left;
|
player.getpsprite(355).frame = frame_left;
|
||||||
player.getpsprite(356).frame = frame_right;
|
player.getpsprite(356).frame = frame_right;
|
||||||
|
|
||||||
|
// Set indicator status fo the HUD.
|
||||||
invoker.lastIndicatorStatus = player.getpsprite(PSP_WEAPON).frame;
|
invoker.lastIndicatorStatus = player.getpsprite(PSP_WEAPON).frame;
|
||||||
|
|
||||||
|
// Debug particle display for the linetrace.
|
||||||
|
if(hd_debug > 1) {
|
||||||
if(linetraceData.hitType != TRACE_HitNone) {
|
if(linetraceData.hitType != TRACE_HitNone) {
|
||||||
Vector3 hitPos = linetraceData.hitLocation - Vec3Offset(0, 0, 0);
|
Vector3 hitPos = linetraceData.hitLocation - Vec3Offset(0, 0, 0);
|
||||||
// console.printf("hit pos: %f %f %f\n", hitPos.x, hitPos.y, hitPos.z);
|
|
||||||
A_SpawnParticle(
|
A_SpawnParticle(
|
||||||
particleColor,
|
particleColor,
|
||||||
0, 10, 2, 0,
|
0, 10, 2, 0,
|
||||||
@ -468,6 +440,7 @@ class JumperCablesUsable : HDWeapon
|
|||||||
hitPos.z);
|
hitPos.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
action float Vec2Mag(Vector2 v)
|
action float Vec2Mag(Vector2 v)
|
||||||
{
|
{
|
||||||
@ -517,7 +490,7 @@ class JumperCablesUsable : HDWeapon
|
|||||||
48,
|
48,
|
||||||
pawn.pitch,
|
pawn.pitch,
|
||||||
flags : TRF_THRUACTORS | TRF_ABSOFFSET,
|
flags : TRF_THRUACTORS | TRF_ABSOFFSET,
|
||||||
offsetz : pawn.gunPos.z - 1, // * 0.8,
|
offsetz : pawn.gunPos.z - 1,
|
||||||
offsetforward : pawn.gunPos.x,
|
offsetforward : pawn.gunPos.x,
|
||||||
offsetside : pawn.gunPos.y,
|
offsetside : pawn.gunPos.y,
|
||||||
data : linetraceData);
|
data : linetraceData);
|
||||||
@ -590,10 +563,6 @@ class JumperCablesUsable : HDWeapon
|
|||||||
// If we found something broken, then return the closest
|
// If we found something broken, then return the closest
|
||||||
// thing we found.
|
// thing we found.
|
||||||
if(closestLineInRange) {
|
if(closestLineInRange) {
|
||||||
// Console.printf(
|
|
||||||
// "Dist to line: %f\n",
|
|
||||||
// GetDistanceToLine(
|
|
||||||
// closestLineInRange, linetraceData.hitLocation));
|
|
||||||
return closestLineInRange;
|
return closestLineInRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,8 +573,8 @@ class JumperCablesUsable : HDWeapon
|
|||||||
|
|
||||||
action void AttachCables(HDPlayerPawn pawn)
|
action void AttachCables(HDPlayerPawn pawn)
|
||||||
{
|
{
|
||||||
|
// Do we have enough ammo?
|
||||||
HDMagAmmo batteryAmmo = HDMagAmmo(FindInventory("HDBattery"));
|
HDMagAmmo batteryAmmo = HDMagAmmo(FindInventory("HDBattery"));
|
||||||
|
|
||||||
if(!batteryAmmo || batteryAmmo.amount < 1) {
|
if(!batteryAmmo || batteryAmmo.amount < 1) {
|
||||||
invoker.owner.A_Log("You need a battery to use this.");
|
invoker.owner.A_Log("You need a battery to use this.");
|
||||||
return;
|
return;
|
||||||
@ -615,32 +584,36 @@ class JumperCablesUsable : HDWeapon
|
|||||||
FLineTraceData linetraceData;
|
FLineTraceData linetraceData;
|
||||||
DoLineTrace(pawn, linetraceData);
|
DoLineTrace(pawn, linetraceData);
|
||||||
|
|
||||||
|
// Are we even close enough to a line?
|
||||||
Line brokenLine = LineTraceFindbrokenLine(linetraceData);
|
Line brokenLine = LineTraceFindbrokenLine(linetraceData);
|
||||||
|
if(!brokenLine) {
|
||||||
|
invoker.owner.A_Log("Not close enough to repair.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(brokenLine) {
|
if(!loader.originalLinedefSpecials2.CheckKey(brokenLine.index())) {
|
||||||
|
invoker.owner.A_Log("No mechanism present to repair.");
|
||||||
if(loader.originalLinedefSpecials2.CheckKey(brokenLine.index())) {
|
return;
|
||||||
|
}
|
||||||
// pawn.A_Log(string.Format("Blep3 %d",
|
|
||||||
// loader.originalLinedefSpecials2.Get(hitLine.index())));
|
|
||||||
|
|
||||||
|
// Check to see if it's something that actually needs fixing.
|
||||||
int originalSpecial = loader.originalLinedefSpecials2.Get(brokenLine.index());
|
int originalSpecial = loader.originalLinedefSpecials2.Get(brokenLine.index());
|
||||||
int currentSpecial = brokenLine.special;
|
int currentSpecial = brokenLine.special;
|
||||||
|
if(originalSpecial == currentSpecial) {
|
||||||
|
invoker.owner.A_Log("This is already functioning as normal.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(originalSpecial != currentSpecial) {
|
// Remove battery from inventory, but make sure we're actually
|
||||||
|
// getting a charged one.
|
||||||
// Remove battery from inventory.
|
|
||||||
int batteryCharges = batteryAmmo.TakeMag(true);
|
int batteryCharges = batteryAmmo.TakeMag(true);
|
||||||
// Console.printf("batteryCharges: %d", batteryCharges);
|
|
||||||
|
|
||||||
if(batteryCharges < 1) {
|
if(batteryCharges < 1) {
|
||||||
|
|
||||||
// Handle getting an empty battery. Just give it back.
|
|
||||||
invoker.owner.A_Log("No charged batteries available to use.");
|
invoker.owner.A_Log("No charged batteries available to use.");
|
||||||
batteryAmmo.AddAMag(batteryCharges);
|
batteryAmmo.AddAMag(batteryCharges); // Just give it back.
|
||||||
|
return;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// Actually spawn the deployed item.
|
||||||
JumperCablesDeployed deployed = JumperCablesDeployed(
|
JumperCablesDeployed deployed = JumperCablesDeployed(
|
||||||
Spawn(
|
Spawn(
|
||||||
"JumperCablesDeployed",
|
"JumperCablesDeployed",
|
||||||
@ -650,6 +623,8 @@ class JumperCablesUsable : HDWeapon
|
|||||||
deployed.bNoGravity = true;
|
deployed.bNoGravity = true;
|
||||||
deployed.charges = batteryCharges;
|
deployed.charges = batteryCharges;
|
||||||
|
|
||||||
|
// Use a different kind of flat sprite and angle depending on
|
||||||
|
// if we're attaching to wall or floor/ceiling.
|
||||||
if(linetraceData.hitType == TRACE_HitFloor || linetraceData.hitType == TRACE_HitCeiling) {
|
if(linetraceData.hitType == TRACE_HitFloor || linetraceData.hitType == TRACE_HitCeiling) {
|
||||||
deployed.SetFlatSprite(invoker.owner.angle);
|
deployed.SetFlatSprite(invoker.owner.angle);
|
||||||
} else {
|
} else {
|
||||||
@ -657,12 +632,9 @@ class JumperCablesUsable : HDWeapon
|
|||||||
deployed.SetWallSprite(lineDir);
|
deployed.SetWallSprite(lineDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore the damn line special already.
|
||||||
brokenLine.special = originalSpecial;
|
brokenLine.special = originalSpecial;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override void DrawHUDStuff(HDStatusBar statusBar, HDWeapon weapon, HDPlayerPawn pawn)
|
override void DrawHUDStuff(HDStatusBar statusBar, HDWeapon weapon, HDPlayerPawn pawn)
|
||||||
{
|
{
|
||||||
|