48 ChangeAmmo:= false; |
48 ChangeAmmo:= false; |
49 slot:= HHGear^.MsgParam; |
49 slot:= HHGear^.MsgParam; |
50 |
50 |
51 with HHGear^.Hedgehog^ do |
51 with HHGear^.Hedgehog^ do |
52 begin |
52 begin |
53 HHGear^.Message:= HHGear^.Message and not gmSlot; |
53 HHGear^.Message:= HHGear^.Message and (not gmSlot); |
54 ammoidx:= 0; |
54 ammoidx:= 0; |
55 if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) or |
55 if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) or |
56 ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or |
56 ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or |
57 ((HHGear^.State and gstHHDriven) = 0) then exit; |
57 ((HHGear^.State and gstHHDriven) = 0) then exit; |
58 ChangeAmmo:= true; |
58 ChangeAmmo:= true; |
60 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); |
60 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); |
61 |
61 |
62 if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(HHGear^.Hedgehog^); |
62 if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(HHGear^.Hedgehog^); |
63 |
63 |
64 MultiShootAttacks:= 0; |
64 MultiShootAttacks:= 0; |
65 HHGear^.Message:= HHGear^.Message and not (gmLJump or gmHJump); |
65 HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); |
66 |
66 |
67 if Ammoz[CurAmmoType].Slot = slot then |
67 if Ammoz[CurAmmoType].Slot = slot then |
68 begin |
68 begin |
69 i:= 0; |
69 i:= 0; |
70 repeat |
70 repeat |
108 |
108 |
109 HHGear^.MsgParam:= Ammoz[weap].Slot; |
109 HHGear^.MsgParam:= Ammoz[weap].Slot; |
110 |
110 |
111 t:= cMaxSlotAmmoIndex; |
111 t:= cMaxSlotAmmoIndex; |
112 |
112 |
113 HHGear^.Message:= HHGear^.Message and not gmWeapon; |
113 HHGear^.Message:= HHGear^.Message and (not gmWeapon); |
114 |
114 |
115 with Hedgehog^ do |
115 with Hedgehog^ do |
116 while (CurAmmoType <> weap) and (t >= 0) do |
116 while (CurAmmoType <> weap) and (t >= 0) do |
117 begin |
117 begin |
118 s:= ChangeAmmo(HHGear); |
118 s:= ChangeAmmo(HHGear); |
124 |
124 |
125 procedure HHSetTimer(Gear: PGear); |
125 procedure HHSetTimer(Gear: PGear); |
126 var CurWeapon: PAmmo; |
126 var CurWeapon: PAmmo; |
127 color: LongWord; |
127 color: LongWord; |
128 begin |
128 begin |
129 Gear^.Message:= Gear^.Message and not gmTimer; |
129 Gear^.Message:= Gear^.Message and (not gmTimer); |
130 CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); |
130 CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); |
131 with Gear^.Hedgehog^ do |
131 with Gear^.Hedgehog^ do |
132 if ((Gear^.Message and gmPrecise) <> 0) and ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then |
132 if ((Gear^.Message and gmPrecise) <> 0) and ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then |
133 begin |
133 begin |
134 color:= Gear^.Hedgehog^.Team^.Clan^.Color; |
134 color:= Gear^.Hedgehog^.Team^.Clan^.Color; |
187 ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or |
187 ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or |
188 ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and |
188 ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and |
189 ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then |
189 ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then |
190 begin |
190 begin |
191 State:= State or gstAttacking; |
191 State:= State or gstAttacking; |
192 if Power = cMaxPower then Message:= Message and not gmAttack |
192 if Power = cMaxPower then Message:= Message and (not gmAttack) |
193 else if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) = 0 then Message:= Message and not gmAttack |
193 else if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) = 0 then Message:= Message and (not gmAttack) |
194 else begin |
194 else begin |
195 if Power = 0 then |
195 if Power = 0 then |
196 begin |
196 begin |
197 AttackBar:= CurrentTeam^.AttackBar; |
197 AttackBar:= CurrentTeam^.AttackBar; |
198 PlaySound(sndThrowPowerUp) |
198 PlaySound(sndThrowPowerUp) |
419 end else begin |
419 end else begin |
420 if not CurrentTeam^.ExtDriven and |
420 if not CurrentTeam^.ExtDriven and |
421 ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then SendIPC('a'); |
421 ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then SendIPC('a'); |
422 AfterAttack; |
422 AfterAttack; |
423 end |
423 end |
424 end else Message:= Message and not gmAttack; |
424 end else Message:= Message and (not gmAttack); |
425 end; |
425 end; |
426 TargetPoint.X := NoPointX; |
426 TargetPoint.X := NoPointX; |
427 ScriptCall('onHogAttack'); |
427 ScriptCall('onHogAttack'); |
428 end; |
428 end; |
429 |
429 |
430 procedure AfterAttack; |
430 procedure AfterAttack; |
431 var s: shortstring; |
431 var s: shortstring; |
432 a: TAmmoType; |
432 a: TAmmoType; |
433 begin |
433 begin |
434 with CurrentHedgehog^.Gear^, |
434 with CurrentHedgehog^.Gear^, |
435 CurrentHedgehog^ do |
435 CurrentHedgehog^ do |
436 begin |
436 begin |
437 a:= CurAmmoType; |
437 a:= CurAmmoType; |
438 State:= State and not gstAttacking; |
438 State:= State and (not gstAttacking); |
439 if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then |
439 if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then |
440 begin |
440 begin |
441 Inc(MultiShootAttacks); |
441 Inc(MultiShootAttacks); |
442 |
442 |
443 if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then |
443 if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then |
635 Gear^.Pos:= 0 |
635 Gear^.Pos:= 0 |
636 end; |
636 end; |
637 |
637 |
638 if ((Gear^.Message and gmLJump ) <> 0) then |
638 if ((Gear^.Message and gmLJump ) <> 0) then |
639 begin |
639 begin |
640 Gear^.Message:= Gear^.Message and not gmLJump; |
640 Gear^.Message:= Gear^.Message and (not gmLJump); |
641 DeleteCI(Gear); |
641 DeleteCI(Gear); |
642 if TestCollisionYwithGear(Gear, -1) = 0 then |
642 if TestCollisionYwithGear(Gear, -1) = 0 then |
643 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else |
643 if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else |
644 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
644 if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
645 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
645 if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
808 CheckHHDamage(Gear); |
808 CheckHHDamage(Gear); |
809 |
809 |
810 if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) and |
810 if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) and |
811 (Gear^.dX.QWordValue < _0_02.QWordValue) then Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump |
811 (Gear^.dX.QWordValue < _0_02.QWordValue) then Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump |
812 |
812 |
813 Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump); |
813 Gear^.State:= Gear^.State and (not (gstHHJumping or gstHHHJump)); |
814 Gear^.dY:= _0; |
814 Gear^.dY:= _0; |
815 end else Gear^.dY:= Gear^.dY + cGravity; |
815 end else Gear^.dY:= Gear^.dY + cGravity; |
816 |
816 |
817 if ((Gear^.State and gstMoving) <> 0) then |
817 if ((Gear^.State and gstMoving) <> 0) then |
818 begin |
818 begin |
841 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9 ; Gear^.Y:= Gear^.Y - _3 end else |
841 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9 ; Gear^.Y:= Gear^.Y - _3 end else |
842 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - _4 end else |
842 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - _4 end else |
843 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - _5 end else |
843 if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - _5 end else |
844 if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
844 if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
845 else begin |
845 else begin |
846 Gear^.State:= Gear^.State and not gstMoving; |
846 Gear^.State:= Gear^.State and (not gstMoving); |
847 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
847 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
848 SetLittle(Gear^.dX) |
848 SetLittle(Gear^.dX) |
849 end |
849 end |
850 else begin |
850 else begin |
851 Gear^.State:= Gear^.State and not gstMoving; |
851 Gear^.State:= Gear^.State and (not gstMoving); |
852 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
852 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
853 SetLittle(Gear^.dX) |
853 SetLittle(Gear^.dX) |
854 end |
854 end |
855 else if (hwAbs(Gear^.dX) > cLittle) |
855 else if (hwAbs(Gear^.dX) > cLittle) |
856 and ((Gear^.State and gstHHJumping) = 0) |
856 and ((Gear^.State and gstHHJumping) = 0) |
858 else SetLittle(Gear^.dX); |
858 else SetLittle(Gear^.dX); |
859 |
859 |
860 if (not isFalling) and |
860 if (not isFalling) and |
861 (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
861 (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
862 begin |
862 begin |
863 Gear^.State:= Gear^.State and not gstWinner; |
863 Gear^.State:= Gear^.State and (not gstWinner); |
864 Gear^.State:= Gear^.State and not gstMoving; |
864 Gear^.State:= Gear^.State and (not gstMoving); |
865 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
865 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1; |
866 SetLittle(Gear^.dX); |
866 SetLittle(Gear^.dX); |
867 Gear^.dY:= _0 |
867 Gear^.dY:= _0 |
868 end else Gear^.State:= Gear^.State or gstMoving; |
868 end else Gear^.State:= Gear^.State or gstMoving; |
869 |
869 |
870 if (Gear^.State and gstMoving) <> 0 then |
870 if (Gear^.State and gstMoving) <> 0 then |
871 begin |
871 begin |
872 Gear^.State:= Gear^.State and not gstAnimation; |
872 Gear^.State:= Gear^.State and (not gstAnimation); |
873 // ARTILLERY but not being moved by explosions |
873 // ARTILLERY but not being moved by explosions |
874 Gear^.X:= Gear^.X + Gear^.dX; |
874 Gear^.X:= Gear^.X + Gear^.dX; |
875 Gear^.Y:= Gear^.Y + Gear^.dY; |
875 Gear^.Y:= Gear^.Y + Gear^.dY; |
876 if (not Gear^.dY.isNegative) and |
876 if (not Gear^.dY.isNegative) and |
877 (not TestCollisionYKick(Gear, 1)) and |
877 (not TestCollisionYKick(Gear, 1)) and |
921 if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then |
921 if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then |
922 begin |
922 begin |
923 if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft; |
923 if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft; |
924 TurnTimeLeft:= 0; |
924 TurnTimeLeft:= 0; |
925 isCursorVisible:= false; |
925 isCursorVisible:= false; |
926 HHGear^.State:= HHGear^.State and not (gstHHDriven or gstAnimation or gstAttacking); |
926 HHGear^.State:= HHGear^.State and (not (gstHHDriven or gstAnimation or gstAttacking)); |
927 AttackBar:= 0; |
927 AttackBar:= 0; |
928 if HHGear^.Damage > 0 then |
928 if HHGear^.Damage > 0 then |
929 HHGear^.State:= HHGear^.State and not (gstHHJumping or gstHHHJump); |
929 HHGear^.State:= HHGear^.State and (not (gstHHJumping or gstHHHJump)); |
930 exit |
930 exit |
931 end; |
931 end; |
932 |
932 |
933 if (HHGear^.State and gstAnimation) <> 0 then |
933 if (HHGear^.State and gstAnimation) <> 0 then |
934 begin |
934 begin |
969 if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
969 if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
970 and ((HHGear^.Message and gmLJump) <> 0) |
970 and ((HHGear^.Message and gmLJump) <> 0) |
971 and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then |
971 and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then |
972 begin |
972 begin |
973 Attack(HHGear); |
973 Attack(HHGear); |
974 HHGear^.Message:= HHGear^.Message and not gmLJump |
974 HHGear^.Message:= HHGear^.Message and (not gmLJump) |
975 end; |
975 end; |
976 |
976 |
977 if (CurAmmoGear = nil) |
977 if (CurAmmoGear = nil) |
978 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
978 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
979 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then |
979 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then |
1008 HHGear^.dY:= -_0_25; |
1008 HHGear^.dY:= -_0_25; |
1009 if not cArtillery then HHGear^.dX:= -SignAs(_0_02, HHGear^.dX); |
1009 if not cArtillery then HHGear^.dX:= -SignAs(_0_02, HHGear^.dX); |
1010 PlaySound(sndJump2, Hedgehog^.Team^.voicepack) |
1010 PlaySound(sndJump2, Hedgehog^.Team^.voicepack) |
1011 end; |
1011 end; |
1012 |
1012 |
1013 HHGear^.Message:= HHGear^.Message and not (gmLJump or gmHJump); |
1013 HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); |
1014 |
1014 |
1015 if (not cArtillery) and wasJumping and |
1015 if (not cArtillery) and wasJumping and |
1016 TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
1016 TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
1017 |
1017 |
1018 if Hedgehog^.Gear <> nil then doStepHedgehogMoving(HHGear); |
1018 if Hedgehog^.Gear <> nil then doStepHedgehogMoving(HHGear); |
1064 Gear^.Hedgehog^.Effects[hePoisoned] := false; |
1064 Gear^.Hedgehog^.Effects[hePoisoned] := false; |
1065 if Gear^.Hedgehog^.Effects[heResurrectable] then begin |
1065 if Gear^.Hedgehog^.Effects[heResurrectable] then begin |
1066 ResurrectHedgehog(Gear); |
1066 ResurrectHedgehog(Gear); |
1067 end else |
1067 end else |
1068 begin |
1068 begin |
1069 Gear^.State:= (Gear^.State or gstHHDeath) and not gstAnimation; |
1069 Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation); |
1070 Gear^.doStep:= @doStepHedgehogDead; |
1070 Gear^.doStep:= @doStepHedgehogDead; |
1071 // Death message |
1071 // Death message |
1072 AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
1072 AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
1073 end; |
1073 end; |
1074 end |
1074 end |
1075 else |
1075 else |
1076 begin |
1076 begin |
1077 Gear^.State:= Gear^.State and not gstAnimation; |
1077 Gear^.State:= Gear^.State and (not gstAnimation); |
1078 Gear^.doStep:= @doStepHedgehogGone; |
1078 Gear^.doStep:= @doStepHedgehogGone; |
1079 |
1079 |
1080 // Gone message |
1080 // Gone message |
1081 AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
1081 AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
1082 end |
1082 end |