# HG changeset patch # User nemo # Date 1451418272 18000 # Node ID 2f6f8baa2a97fe1b1f8026e2fa99db2393267f36 # Parent f2c36df8c7b14c2655685f30cba5840dcde76d83 Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed.. diff -r f2c36df8c7b1 -r 2f6f8baa2a97 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Mon Dec 28 23:37:44 2015 +0300 +++ b/hedgewars/uGearsHandlersMess.pas Tue Dec 29 14:44:32 2015 -0500 @@ -128,7 +128,7 @@ procedure doStepResurrectorWork(Gear: PGear); procedure doStepResurrector(Gear: PGear); procedure doStepNapalmBomb(Gear: PGear); -procedure doStepStructure(Gear: PGear); +//procedure doStepStructure(Gear: PGear); procedure doStepTardisWarp(Gear: PGear); procedure doStepTardis(Gear: PGear); procedure updateFuel(Gear: PGear); @@ -136,7 +136,7 @@ procedure doStepIceGun(Gear: PGear); procedure doStepAddAmmo(Gear: PGear); procedure doStepGenericFaller(Gear: PGear); -procedure doStepCreeper(Gear: PGear); +//procedure doStepCreeper(Gear: PGear); procedure doStepKnife(Gear: PGear); var @@ -513,10 +513,10 @@ dec(Gear^.Timer); if Gear^.Timer = 1000 then // might need adjustments case Gear^.Kind of - gtGrenade: makeHogsWorry(Gear^.X, Gear^.Y, 50); - gtClusterBomb: makeHogsWorry(Gear^.X, Gear^.Y, 20); - gtWatermelon: makeHogsWorry(Gear^.X, Gear^.Y, 75); - gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, 90); + gtGrenade, + gtClusterBomb, + gtWatermelon, + gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, Gear^.Boom); gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50); end; @@ -524,7 +524,7 @@ begin CheckCollision(Gear); if (Gear^.State and gstCollision) <> 0 then - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx); end; if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then @@ -537,14 +537,14 @@ if Gear^.Timer = 0 then begin case Gear^.Kind of - gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); - gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, Gear^.Hedgehog, EXPLAutoSound); + gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); + gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); gtClusterBomb: begin x := hwRound(Gear^.X); y := hwRound(Gear^.Y); gdX:= Gear^.dX; - doMakeExplosion(x, y, 20, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); for i:= 0 to 4 do begin dX := rndSign(GetRandomf * _0_1) + gdX / 5; @@ -557,7 +557,7 @@ x := hwRound(Gear^.X); y := hwRound(Gear^.Y); gdX:= Gear^.dX; - doMakeExplosion(x, y, 75, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); for i:= 0 to 5 do begin dX := rndSign(GetRandomf * _0_1) + gdX / 5; @@ -570,7 +570,7 @@ begin x := hwRound(Gear^.X); y := hwRound(Gear^.Y); - doMakeExplosion(x, y, 90, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); for i:= 0 to 127 do begin @@ -590,7 +590,7 @@ end; gtGasBomb: begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); for i:= 0 to 2 do begin x:= GetRandom(60); @@ -699,13 +699,12 @@ doStepFallingGear(Gear); if (Gear^.State and gstCollision) <> 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit end; - if (Gear^.Kind = gtMelonPiece) - or (Gear^.Kind = gtBall) then + if (Gear^.Kind = gtMelonPiece) then CalcRotationDirAngle(Gear) else if (GameTicks and $1F) = 0 then AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); @@ -720,7 +719,7 @@ doStepFallingGear(Gear); if (Gear^.State and gstCollision) <> 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit end; @@ -743,7 +742,7 @@ CalcRotationDirAngle(Gear); if (Gear^.State and gstCollision) <> 0 then begin - kick:= hwRound((hwAbs(gdX)+hwAbs(gdY)) * _20); + kick:= hwRound((hwAbs(gdX)+hwAbs(gdY)) * Gear^.Boom / 10000); Gear^.dX:= gdX; Gear^.dY:= gdY; AmmoShove(Gear, 0, kick); @@ -1052,7 +1051,7 @@ if ((Gear^.State and gstCollision) <> 0) then begin StopSoundChan(Gear^.SoundChannel); - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); for i:= 0 to 31 do begin flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); @@ -1098,7 +1097,7 @@ CheckCollision(Gear); if (Gear^.State and gstCollision) <> 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit end; @@ -1280,9 +1279,9 @@ if Gear^.Damage > 5 then begin if Gear^.AmmoType = amDEagle then - AmmoShove(Gear, 7, 20) + AmmoShove(Gear, Gear^.Boom, 20) else - AmmoShove(Gear, Gear^.Timer, 20); + AmmoShove(Gear, Gear^.Timer * Gear^.Boom div 100000, 20); end; CheckGearDrowning(Gear); dec(i) @@ -1471,7 +1470,7 @@ if (Gear^.Timer mod 33) = 0 then begin HHGear^.State := HHGear^.State or gstNoDamage; - doMakeExplosion(x, y + 7, 6, Gear^.Hedgehog, EXPLDontDraw); + doMakeExplosion(x, y + 7, Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw); HHGear^.State := HHGear^.State and (not gstNoDamage) end; @@ -1646,7 +1645,7 @@ Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); end; HHGear^.State := HHGear^.State or gstNoDamage; - AmmoShove(Gear, 2, 15); + AmmoShove(Gear, Gear^.Boom, 15); HHGear^.State := HHGear^.State and (not gstNoDamage) end; end; @@ -1731,7 +1730,7 @@ if (Gear^.Damage > 35) then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit end @@ -1755,7 +1754,7 @@ or (cMineDudPercent = 0) or (getRandom(100) > cMineDudPercent) then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear) end else @@ -1779,12 +1778,6 @@ Gear^.State := Gear^.State or gsttmpFlag; end; -(* -Just keeping track for my own benefit. -Every second, locate new target. Clear if target radius has been set to 0 or no target in range. -Every... 16 milliseconds? Update vector to target. -*) - procedure doStepAirMine(Gear: PGear); var i,t,targDist,tmpDist: LongWord; targ, tmpG: PGear; @@ -1983,7 +1976,8 @@ if ((Gear^.State and gstAttacking) = 0) then begin if ((GameTicks and $1F) = 0) then - if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then +// FIXME - values taken from mine. use a gear val and set both to same + if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State := Gear^.State or gstAttacking end else // gstAttacking <> 0 @@ -1991,7 +1985,7 @@ AllInactive := false; if Gear^.Timer = 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit end @@ -2018,7 +2012,7 @@ makeHogsWorry(Gear^.X, Gear^.Y, 75); if Gear^.Timer = 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit end; @@ -2137,13 +2131,13 @@ if k = gtCase then begin - doMakeExplosion(x, y, 25, hog, EXPLAutoSound); + doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); for i:= 0 to 63 do AddGear(x, y, gtFlame, 0, _0, _0, 0); end else if k = gtExplosives then begin - doMakeExplosion(x, y, 75, hog, EXPLAutoSound); + doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); for i:= 0 to 31 do begin dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1); @@ -2312,7 +2306,7 @@ HHGear^.State := HHGear^.State or gstNoDamage; DeleteCI(HHGear); - AmmoShove(Gear, 30, 115); + AmmoShove(Gear, Gear^.Boom, 115); HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving; Gear^.Timer := 250; @@ -2332,7 +2326,7 @@ for i:= 0 to 3 do begin AddVisualGear(hwRound(Gear^.X) + hwSign(Gear^.dX) * (10 + 6 * i), hwRound(Gear^.Y) + 12 + Random(6), vgtDust); - AmmoShove(Gear, 30, 25); + AmmoShove(Gear, Gear^.Boom, 25); Gear^.X := Gear^.X + Gear^.dX * 5 end; @@ -2370,7 +2364,7 @@ Gear^.dY.QWordValue:= 429496730; Gear^.dX.isNegative:= getrandom(2)<>1; Gear^.dY.isNegative:= true; - AmmoShove(Gear, 2, 125); + AmmoShove(Gear, Gear^.Boom, 125); Gear^.dX:= tdX; Gear^.dY:= tdY; Gear^.Radius := 1 @@ -2449,7 +2443,7 @@ Gear^.dY.QWordValue:= 429496730; Gear^.dX.isNegative:= getrandom(2)<>1; Gear^.dY.isNegative:= true; - AmmoShove(Gear, 2, 125); + AmmoShove(Gear, Gear^.Boom, 125); Gear^.dX:= tdX; Gear^.dY:= tdY; Gear^.Radius := 1 @@ -2475,13 +2469,13 @@ Gear^.dY.QWordValue:= 429496730; Gear^.dX.isNegative:= getrandom(2)<>1; Gear^.dY.isNegative:= true; - AmmoShove(Gear, 6, 100); + AmmoShove(Gear, Gear^.Boom * 3, 100); Gear^.dX:= tdX; Gear^.dY:= tdY; Gear^.Radius := 1; end else if ((GameTicks and $3) = 3) then - doMakeExplosion(gX, gY, 8, Gear^.Hedgehog, 0);//, EXPLNoDamage); + doMakeExplosion(gX, gY, Gear^.Boom * 4, Gear^.Hedgehog, 0);//, EXPLNoDamage); //DrawExplosion(gX, gY, 4); if ((GameTicks and $7) = 0) and (Random(2) = 0) then @@ -2548,7 +2542,7 @@ DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4+2, 2); HHGear^.State := HHGear^.State or gstNoDamage; Gear^.Y := HHGear^.Y; - AmmoShove(Gear, 30, 40); + AmmoShove(Gear, Gear^.Boom, 40); HHGear^.State := HHGear^.State and (not gstNoDamage) end; @@ -2734,7 +2728,7 @@ doStepFallingGear(Gear); if (Gear^.State and gstCollision) <> 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); {$IFNDEF PAS2C} with mobileRecord do @@ -3009,7 +3003,7 @@ doStepFallingGear(Gear); if (Gear^.State and gstCollision) <> 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); gdX.isNegative := not gdX.isNegative; gdY.isNegative := not gdY.isNegative; gdX:= gdX*_0_2; @@ -3101,7 +3095,7 @@ Gear^.Pos := 2; end; - AmmoShove(Gear, 30, 40); + AmmoShove(Gear, Gear^.Boom, 40); DrawTunnel(HHGear^.X - HHGear^.dX * 10, HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2, @@ -3115,7 +3109,7 @@ if Gear^.Health < Gear^.Damage then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); if hasWishes then for i:= 0 to 31 do begin @@ -3186,7 +3180,7 @@ if Gear^.Tag < 2250 then exit; - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); AfterAttack; DeleteGear(Gear) end; @@ -3510,10 +3504,7 @@ begin //out of time or exited ground StopSoundChan(Gear^.SoundChannel); - if (Gear^.State and gsttmpFlag) <> 0 then - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound) - else - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit end @@ -3573,10 +3564,7 @@ else if (t <> nil) then begin //explode right on contact with HH - if (Gear^.State and gsttmpFlag) <> 0 then - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound) - else - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); exit; end; @@ -3596,7 +3584,7 @@ dec(Gear^.Timer) else begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); DeleteGear(Gear); end end; @@ -3764,7 +3752,7 @@ if ((Gear^.State and gstCollision) <> 0) then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, Gear^.Hedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); for i:= 0 to 15 do begin dX := AngleCos(i * 64) * _0_5 * (GetRandomf + _1); @@ -4185,7 +4173,7 @@ if (Gear^.State and gstCollision) <> 0 then begin - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear^.Hedgehog, EXPLPoisoned, $C0E0FFE0); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLPoisoned, $C0E0FFE0); PlaySound(sndEggBreak); AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg); vg := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg); @@ -4795,11 +4783,11 @@ end else if (Gear^.State and gstCollision) <> 0 then begin - r0 := GetRandom(21); - r1 := GetRandom(21); - doMakeExplosion(hwRound(Gear^.X) - 30 - r0, hwRound(Gear^.Y) + 40, 40 + r1, Gear^.Hedgehog, 0); - doMakeExplosion(hwRound(Gear^.X) + 30 + r1, hwRound(Gear^.Y) + 40, 40 + r0, Gear^.Hedgehog, 0); - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 80 + r0, Gear^.Hedgehog, EXPLAutoSound); + r0 := GetRandom(Gear^.Boom div 4 + 1); + r1 := GetRandom(Gear^.Boom div 4 + 1); + doMakeExplosion(hwRound(Gear^.X) - 30 - r0, hwRound(Gear^.Y) + 40, Gear^.Boom div 2 + r1, Gear^.Hedgehog, 0); + doMakeExplosion(hwRound(Gear^.X) + 30 + r1, hwRound(Gear^.Y) + 40, Gear^.Boom div 2 + r0, Gear^.Hedgehog, 0); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom + r0, Gear^.Hedgehog, EXPLAutoSound); for r0:= 0 to 4 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote); Gear^.dY := cGravity * 2 - odY; @@ -4933,7 +4921,7 @@ end; // kick nearby hogs - AmmoShove(Gear, 35, 50); + AmmoShove(Gear, Gear^.Boom, 50); dec(Gear^.Health, Gear^.Damage); @@ -5214,7 +5202,7 @@ Gear^.dX := Gear^.dX + cWindSpeed / 4; Gear^.dY := Gear^.dY + cGravity / 100; if (GameTicks and $FF) = 0 then - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned); if Gear^.State and gstTmpFlag = 0 then AllInactive:= false; end; @@ -5253,18 +5241,13 @@ dmg:= (tmp^.Health - tmp^.Damage); if dmg > 0 then begin - // do 1/2 current hp worth of damage if extra damage is enabled (1/3 damage if not) - if cDamageModifier > _1 then - d:= 2 - else - d:= 3; - // always rounding down - dmg:= dmg div d; + dmg:= dmg div Gear^.Boom; if dmg > 0 then ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown); end; + tmp^.dY:= _0_03 * Gear^.Boom end; if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then @@ -5534,6 +5517,7 @@ dec(Gear^.Timer) end; +(* //////////////////////////////////////////////////////////////////////////////// procedure doStepStructure(Gear: PGear); var @@ -5625,6 +5609,7 @@ doMakeExplosion(x, y, 50, CurrentHedgehog, EXPLAutoSound); end; end; +*) //////////////////////////////////////////////////////////////////////////////// (* @@ -6114,7 +6099,7 @@ end; end end; - +(* procedure doStepCreeper(Gear: PGear); var hogs: PGearArrayS; HHGear: PGear; @@ -6195,7 +6180,7 @@ end; end; end; - +*) //////////////////////////////////////////////////////////////////////////////// procedure doStepKnife(Gear: PGear); //var ox, oy: LongInt; @@ -6214,7 +6199,7 @@ DeleteCI(Gear); Gear^.Radius:= 7; // used for damage and impact calc. needs balancing I think - Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4)); + Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*Gear^.Boom/10000)); doStepFallingGear(Gear); AllInactive := false; a:= Gear^.DirAngle; diff -r f2c36df8c7b1 -r 2f6f8baa2a97 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Mon Dec 28 23:37:44 2015 +0300 +++ b/hedgewars/uGearsHedgehog.pas Tue Dec 29 14:44:32 2015 -0500 @@ -587,7 +587,7 @@ begin Gear^.Hedgehog^.Effects[heFrozen]:= 0; Gear^.State:= Gear^.State or gstNoDamage; - doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound); + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, CurrentHedgehog, EXPLAutoSound); grave:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0); grave^.Hedgehog:= Gear^.Hedgehog; grave^.Pos:= Gear^.uid; diff -r f2c36df8c7b1 -r 2f6f8baa2a97 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Mon Dec 28 23:37:44 2015 +0300 +++ b/hedgewars/uGearsList.pas Tue Dec 29 14:44:32 2015 -0500 @@ -215,6 +215,54 @@ gear^.Z:= cHHZ+1 else gear^.Z:= cUsualZ; +case Kind of + gtFlame: Gear^.Boom := 2; // some additional expl in there are x3, x4 this + gtHedgehog: Gear^.Boom := 30; + gtMine: Gear^.Boom := 50; + gtCase: Gear^.Boom := 25; + gtAirMine: Gear^.Boom := 25; + gtExplosives: Gear^.Boom := 75; + gtGrenade: Gear^.Boom := 50; + gtShell: Gear^.Boom := 50; + gtBee: Gear^.Boom := 50; + gtShotgunShot: Gear^.Boom := 25; + gtPickHammer: Gear^.Boom := 6; +// gtRope: Gear^.Boom := 2; could be funny to have rope attaching to hog deal small amount of dmg? + gtDEagleShot: Gear^.Boom := 7; + gtDynamite: Gear^.Boom := 75; + gtClusterBomb: Gear^.Boom := 20; + gtMelonPiece, + gtCluster: Gear^.Boom := Timer; + gtShover: Gear^.Boom := 30; + gtFirePunch: Gear^.Boom := 30; + gtAirBomb: Gear^.Boom := 30; + gtBlowTorch: Gear^.Boom := 2; + gtMortar: Gear^.Boom := 20; + gtWhip: Gear^.Boom := 30; + gtKamikaze: Gear^.Boom := 30; // both shove and explosion + gtCake: Gear^.Boom := cakeDmg; // why is cake damage a global constant + gtWatermelon: Gear^.Boom := 75; + gtHellishBomb: Gear^.Boom := 90; + gtDrill: if Gear^.State and gsttmpFlag = 0 then + Gear^.Boom := 50 + else Gear^.Boom := 30; + gtBall: Gear^.Boom := 40; + gtRCPlane: Gear^.Boom := 25; +// sniper rifle is distance linked, this Boom is just an arbitrary scaling factor applied to timer-based-damage +// because, eh, why not.. +gtSniperRifleShot: Gear^.Boom := 100000; + gtEgg: Gear^.Boom := 10; + gtPiano: Gear^.Boom := 80; + gtGasBomb: Gear^.Boom := 20; + gtSineGunShot: Gear^.Boom := 35; + gtSMine: Gear^.Boom := 30; + gtSnowball: Gear^.Boom := 200000; // arbitrary scaling for the shove + gtHammer: if cDamageModifier > _1 then // scale it based on cDamageModifier? + Gear^.Boom := 2 + else Gear^.Boom := 3; + gtPoisonCloud: Gear^.Boom := 20; + gtKnife: Gear^.Boom := 40000; // arbitrary scaling factor since impact-based + end; case Kind of gtGrenade, diff -r f2c36df8c7b1 -r 2f6f8baa2a97 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Mon Dec 28 23:37:44 2015 +0300 +++ b/hedgewars/uScript.pas Tue Dec 29 14:44:32 2015 -0500 @@ -921,29 +921,30 @@ lua_pushinteger(L, Integer(gear^.ImpactSound)); lua_pushinteger(L, gear^.nImpactSounds); lua_pushinteger(L, gear^.Tint); - lua_pushinteger(L, gear^.Damage) + lua_pushinteger(L, gear^.Damage); + lua_pushinteger(L, gear^.Boom) end else begin lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); - lua_pushnil(L); lua_pushnil(L) + lua_pushnil(L); lua_pushnil(L); lua_pushnil(L) end end else begin lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); lua_pushnil(L); - lua_pushnil(L); lua_pushnil(L) + lua_pushnil(L); lua_pushnil(L); lua_pushnil(L) end; - lc_getgearvalues:= 12 + lc_getgearvalues:= 13 end; function lc_setgearvalues(L : Plua_State) : LongInt; Cdecl; var gear : PGear; begin -// Currently allows 1-13 params -// if CheckLuaParamCount(L, 13, 'SetGearValues', 'gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, # ImpactSounds, Tint, Damage') then +// Currently allows 1-14 params +// if CheckLuaParamCount(L, 14, 'SetGearValues', 'gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, # ImpactSounds, Tint, Damage, Boom') then // begin gear:= GearByUID(lua_tointeger(L, 1)); if gear <> nil then @@ -972,6 +973,8 @@ gear^.Tint := lua_tointeger(L, 12); if not lua_isnoneornil(L, 13) then gear^.Damage := lua_tointeger(L, 13); + if not lua_isnoneornil(L, 14) then + gear^.Boom := lua_tointeger(L, 14); end; // end // else diff -r f2c36df8c7b1 -r 2f6f8baa2a97 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Mon Dec 28 23:37:44 2015 +0300 +++ b/hedgewars/uTypes.pas Tue Dec 29 14:44:32 2015 -0500 @@ -273,6 +273,7 @@ // DirAngle is a 'real' - if you do not need it for rotation of sprite in uGearsRender, you can use it for any visual-only value DirAngle: real; // These are frequently overridden to serve some other purpose + Boom: Longword; // amount of damage caused by the gear Pos: Longword; // Commonly overridden. Example use is posCase values in uConsts. Angle, Power : Longword; // Used for hog aiming/firing. Angle is rarely used as an Angle otherwise. Timer, WDTimer : LongWord; // Typically used for some sort of gear timer. Time to explosion, remaining fuel...