Flying portal balls now spawn a few spark effects
This has been adapted from PortalEffects from HedgeEditor.
HedgeEditor already included such effects for some reason, so they have been removed as redundant.
--- a/hedgewars/uGearsRender.pas Sat Mar 24 19:05:46 2018 -0400
+++ b/hedgewars/uGearsRender.pas Mon Mar 26 15:12:33 2018 +0200
@@ -1238,11 +1238,24 @@
end;
gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
- gtPortal: if ((Gear^.Tag and 1) = 0) // still moving?
+ gtPortal: begin
+ if ((Gear^.Tag and 1) = 0) // still moving?
or (Gear^.LinkedGear = nil) or (Gear^.LinkedGear^.LinkedGear <> Gear) // not linked&backlinked?
or ((Gear^.LinkedGear^.Tag and 1) = 0) then // linked portal still moving?
- DrawSpriteRotatedF(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle)
- else DrawSpriteRotatedF(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle);
+ DrawSpriteRotatedF(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle)
+ else
+ DrawSpriteRotatedF(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle);
+
+ // Portal ball trace effects
+ if ((Gear^.Tag and 1) = 0) and ((GameTicks mod 4) = 0) and (not isPaused) then
+ begin
+ vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
+ if Gear^.Tag = 0 then
+ vg^.Tint:= $fab02ab0
+ else if Gear^.Tag = 2 then
+ vg^.Tint:= $364df7b0;
+ end;
+ end;
gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then
DrawSpriteRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX))
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua Sat Mar 24 19:05:46 2018 -0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua Mon Mar 26 15:12:33 2018 +0200
@@ -2464,7 +2464,8 @@
if GetGearType(gear) == gtPortal then
- tag = GetTag(gear)
+ local tag = GetTag(gear)
+ local col
if tag == 0 then
col = 0xfab02aFF -- orange ball
elseif tag == 1 then
@@ -2476,27 +2477,24 @@
end
if (tag == 0) or (tag == 2) then -- i.e ball form
- tempE = AddVisualGear(GetX(gear), GetY(gear), vgtDust, 0, true)
- SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, 1, nil, col )
-
- remLife = getGearValue(gear,"life")
+ local remLife = getGearValue(gear,"life")
remLife = remLife - 1
setGearValue(gear, "life", remLife)
+ -- Destroy portal ball when max. distance reached
if remLife == 0 then
- tempE = AddVisualGear(GetX(gear)+15, GetY(gear), vgtSmoke, 0, true)
- SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
+ local tempE = AddVisualGear(GetX(gear)+15, GetY(gear), vgtSmoke, 0, true)
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
tempE = AddVisualGear(GetX(gear)-15, GetY(gear), vgtSmoke, 0, true)
- SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
tempE = AddVisualGear(GetX(gear), GetY(gear)+15, vgtSmoke, 0, true)
- SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
tempE = AddVisualGear(GetX(gear), GetY(gear)-15, vgtSmoke, 0, true)
- SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, col)
-
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
PlaySound(sndVaporize)
DeleteGear(gear)
--- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Sat Mar 24 19:05:46 2018 -0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Mon Mar 26 15:12:33 2018 +0200
@@ -1255,7 +1255,8 @@
if GetGearType(gear) == gtPortal then
- tag = GetTag(gear)
+ local tag = GetTag(gear)
+ local col
if tag == 0 then
col = 0xfab02aFF -- orange ball
elseif tag == 1 then
@@ -1267,32 +1268,23 @@
end
if (tag == 0) or (tag == 2) then -- i.e ball form
- tempE = AddVisualGear(GetX(gear), GetY(gear), vgtDust, 0, true)
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
- SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, 1, g9, col )
-
- remLife = getGearValue(gear,"life")
+ local remLife = getGearValue(gear,"life")
remLife = remLife - 1
setGearValue(gear, "life", remLife)
if remLife == 0 then
- tempE = AddVisualGear(GetX(gear)+15, GetY(gear), vgtSmoke, 0, true)
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
- SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, col )
+ local tempE = AddVisualGear(GetX(gear)+15, GetY(gear), vgtSmoke, 0, true)
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
tempE = AddVisualGear(GetX(gear)-15, GetY(gear), vgtSmoke, 0, true)
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
- SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, col )
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
tempE = AddVisualGear(GetX(gear), GetY(gear)+15, vgtSmoke, 0, true)
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
- SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, col )
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
tempE = AddVisualGear(GetX(gear), GetY(gear)-15, vgtSmoke, 0, true)
- g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
- SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, col )
-
+ SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, col)
PlaySound(sndVaporize)
DeleteGear(gear)