28 procedure doStepHedgehogMoving(Gear: PGear); |
28 procedure doStepHedgehogMoving(Gear: PGear); |
29 procedure HedgehogChAngle(HHGear: PGear); |
29 procedure HedgehogChAngle(HHGear: PGear); |
30 procedure PickUp(HH, Gear: PGear); |
30 procedure PickUp(HH, Gear: PGear); |
31 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
31 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
32 procedure CheckIce(Gear: PGear); inline; |
32 procedure CheckIce(Gear: PGear); inline; |
|
33 procedure PlayTaunt(taunt: Longword); |
33 |
34 |
34 implementation |
35 implementation |
35 uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, |
36 uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, |
36 uCommands, uLocale, uUtils, uStats, uIO, uScript, |
37 uCommands, uLocale, uUtils, uStats, uIO, uScript, |
37 uGearsList, uCollisions, uRandom, uStore, uTeams, |
38 uGearsList, uCollisions, uRandom, uStore, uTeams, |
323 amSniperRifle: begin |
324 amSniperRifle: begin |
324 PlaySound(sndSniperReload); |
325 PlaySound(sndSniperReload); |
325 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0); |
326 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0); |
326 end; |
327 end; |
327 amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000); |
328 amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000); |
|
329 amDuck: begin |
|
330 // Does duck spawn inside water? |
|
331 if (LeftX > hwRound(Gear^.X) - Gear^.Karma) or (RightX < hwRound(Gear^.X) + Gear^.Karma) or (cWaterLine < hwRound(Gear^.Y) + Gear^.Karma) then |
|
332 PlaySound(sndDroplet2) |
|
333 else |
|
334 // Duck spawned in air, normal drop sound |
|
335 PlaySound(sndDuckDrop); |
|
336 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDuck, 0, SignAs(_0_03, dX), _0, 0); |
|
337 if not ((not dX.isNegative) xor ((State and gstHHHJump) <> 0)) then |
|
338 newGear^.Tag:= -1 |
|
339 else |
|
340 newGear^.Tag:= 1; |
|
341 end; |
328 amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0); |
342 amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0); |
329 amWhip: begin |
343 amWhip: begin |
330 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0); |
344 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0); |
331 PlaySound(sndWhipCrack) |
345 PlaySound(sndWhipCrack) |
332 end; |
346 end; |
376 newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0); |
390 newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0); |
377 end; |
391 end; |
378 amLowGravity: begin |
392 amLowGravity: begin |
379 PlaySound(sndLowGravity); |
393 PlaySound(sndLowGravity); |
380 cGravity:= cMaxWindSpeed; |
394 cGravity:= cMaxWindSpeed; |
381 cGravityf:= 0.00025 |
395 cGravityf:= 0.00025; |
|
396 cLowGravity := true |
382 end; |
397 end; |
383 amExtraDamage: begin |
398 amExtraDamage: begin |
384 PlaySound(sndHellishImpact4); |
399 PlaySound(sndHellishImpact4); |
385 cDamageModifier:= _1_5 |
400 cDamageModifier:= _1_5 |
386 end; |
401 end; |
387 amInvulnerable: Effects[heInvulnerable]:= 1; |
402 amInvulnerable: begin |
|
403 PlaySound(sndInvulnerable); |
|
404 Effects[heInvulnerable]:= 1 |
|
405 end; |
388 amExtraTime: begin |
406 amExtraTime: begin |
389 PlaySound(sndExtraTime); |
407 PlaySound(sndExtraTime); |
390 TurnTimeLeft:= TurnTimeLeft + 30000 |
408 TurnTimeLeft:= TurnTimeLeft + 30000 |
391 end; |
409 end; |
392 amLaserSight: cLaserSighting:= true; |
410 amLaserSight: begin |
|
411 PlaySound(sndLaserSight); |
|
412 cLaserSighting:= true |
|
413 end; |
393 amVampiric: begin |
414 amVampiric: begin |
394 PlaySoundV(sndOw1, Team^.voicepack); |
415 PlaySoundV(sndOw1, Team^.voicepack); |
395 cVampiric:= true; |
416 cVampiric:= true; |
396 end; |
417 end; |
397 amPiano: begin |
418 amPiano: begin |
550 if TagTurnTimeLeft = 0 then |
571 if TagTurnTimeLeft = 0 then |
551 TagTurnTimeLeft:= TurnTimeLeft; |
572 TagTurnTimeLeft:= TurnTimeLeft; |
552 if (CurAmmoGear <> nil) and (CurAmmoGear^.State and gstSubmersible <> 0) and CheckCoordInWater(hwRound(CurAmmoGear^.X), hwRound(CurAmmoGear^.Y)) then |
573 if (CurAmmoGear <> nil) and (CurAmmoGear^.State and gstSubmersible <> 0) and CheckCoordInWater(hwRound(CurAmmoGear^.X), hwRound(CurAmmoGear^.Y)) then |
553 TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 25 |
574 TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 25 |
554 else TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100; |
575 else TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100; |
|
576 IsGetAwayTime := true; |
555 end; |
577 end; |
556 if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (HHGear <> nil) then |
578 if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (HHGear <> nil) then |
557 HHGear^.State:= HHGear^.State or gstAttacked; |
579 HHGear^.State:= HHGear^.State or gstAttacked; |
558 if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then |
580 if (a = amNothing) or ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) or |
|
581 (((GameFlags and gfInfAttack) <> 0) and ((Ammoz[a].Ammo.Propz and ammoprop_ForceTurnEnd) = 0)) then |
559 ApplyAmmoChanges(CurrentHedgehog^) |
582 ApplyAmmoChanges(CurrentHedgehog^) |
560 end; |
583 end; |
561 end |
584 end |
562 else |
585 else |
563 begin |
586 begin |
653 end |
676 end |
654 end; |
677 end; |
655 |
678 |
656 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
679 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
657 var s: ansistring; |
680 var s: ansistring; |
|
681 name: ansistring; |
658 vga: PVisualGear; |
682 vga: PVisualGear; |
659 begin |
683 begin |
660 if cnt <> 0 then AddAmmo(HH, ammo, cnt) |
684 if cnt <> 0 then AddAmmo(HH, ammo, cnt) |
661 else AddAmmo(HH, ammo); |
685 else AddAmmo(HH, ammo); |
662 |
686 |
663 if (not (HH.Team^.ExtDriven |
687 if IsHogLocal(@HH) then |
664 or (HH.BotLevel > 0))) |
688 begin |
665 or (HH.Team^.Clan^.ClanIndex = LocalClan) |
689 if length(trluaammo[Ammoz[ammo].NameId]) > 0 then |
666 or (GameType = gmtDemo) then |
690 name:= trluaammo[Ammoz[ammo].NameId] |
667 begin |
|
668 if cnt <> 0 then |
|
669 s:= trammo[Ammoz[ammo].NameId] + ansistring(' (+' + IntToStr(cnt) + ')') |
|
670 else |
691 else |
671 s:= trammo[Ammoz[ammo].NameId] + ansistring(' (+' + IntToStr(Ammoz[ammo].NumberInCase) + ')'); |
692 name:= trammo[Ammoz[ammo].NameId]; |
|
693 |
|
694 if cnt = 0 then |
|
695 cnt:= Ammoz[ammo].NumberInCase; |
|
696 |
|
697 if (ammo = amNothing) or (cnt = 0) then |
|
698 s:= trmsg[sidEmptyCrate] |
|
699 else if cnt >= AMMO_INFINITE then |
|
700 s:= name + ansistring(' (+∞)') |
|
701 else |
|
702 s:= name + ansistring(' (+' + IntToStr(cnt) + ')'); |
|
703 |
672 AddCaption(s, HH.Team^.Clan^.Color, capgrpAmmoinfo); |
704 AddCaption(s, HH.Team^.Clan^.Color, capgrpAmmoinfo); |
673 |
705 |
674 // show ammo icon |
706 // show ammo icon (if not empty) |
675 vga:= AddVisualGear(X, Y, vgtAmmo); |
707 if (ammo <> amNothing) and (cnt <> 0) then |
676 if vga <> nil then |
708 begin |
677 vga^.Frame:= Longword(ammo); |
709 vga:= AddVisualGear(X, Y, vgtAmmo); |
|
710 if vga <> nil then |
|
711 vga^.Frame:= Longword(ammo); |
|
712 end |
|
713 |
678 end; |
714 end; |
679 end; |
715 end; |
680 |
716 |
681 //////////////////////////////////////////////////////////////////////////////// |
717 //////////////////////////////////////////////////////////////////////////////// |
682 procedure PickUp(HH, Gear: PGear); |
718 procedure PickUp(HH, Gear: PGear); |
683 var s: shortstring; |
719 var s: ansistring; |
684 i: LongInt; |
720 i: LongInt; |
685 vga: PVisualGear; |
721 vga: PVisualGear; |
686 ag, gi: PGear; |
722 ag, gi: PGear; |
687 begin |
723 begin |
688 if Gear^.State and gstFrozen <> 0 then exit; |
724 if Gear^.State and gstFrozen <> 0 then exit; |
730 end; |
766 end; |
731 posCaseHealth: begin |
767 posCaseHealth: begin |
732 PlaySound(sndShotgunReload); |
768 PlaySound(sndShotgunReload); |
733 inc(HH^.Health, Gear^.Health); |
769 inc(HH^.Health, Gear^.Health); |
734 HH^.Hedgehog^.Effects[hePoisoned] := 0; |
770 HH^.Hedgehog^.Effects[hePoisoned] := 0; |
735 s:= '+' + IntToStr(Gear^.Health); |
771 s:= IntToStr(Gear^.Health); |
736 AddCaption(ansistring(s), HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); |
772 AddCaption(FormatA(trmsg[sidHealthGain], s), HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); |
737 RenderHealth(HH^.Hedgehog^); |
773 RenderHealth(HH^.Hedgehog^); |
738 RecountTeamHealth(HH^.Hedgehog^.Team); |
774 RecountTeamHealth(HH^.Hedgehog^.Team); |
739 |
775 |
740 i:= 0; |
776 i:= 0; |
741 while i < Gear^.Health do |
777 while (i < Gear^.Health) and (i <= 1000) do |
742 begin |
778 begin |
743 vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot); |
779 vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot); |
744 if vga <> nil then |
780 if vga <> nil then |
745 with vga^ do |
781 with vga^ do |
746 begin |
782 begin |
1176 begin |
1213 begin |
1177 inc(Gear^.FlightTime); |
1214 inc(Gear^.FlightTime); |
1178 if (Gear^.FlightTime > 1500) and ((hwRound(Gear^.X) < LongInt(leftX)-250) or (hwRound(Gear^.X) > LongInt(rightX)+250)) then |
1215 if (Gear^.FlightTime > 1500) and ((hwRound(Gear^.X) < LongInt(leftX)-250) or (hwRound(Gear^.X) > LongInt(rightX)+250)) then |
1179 begin |
1216 begin |
1180 Gear^.FlightTime:= 0; |
1217 Gear^.FlightTime:= 0; |
1181 AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage); |
1218 s:= ansistring(CurrentHedgehog^.Name); |
|
1219 AddCaption(FormatA(GetEventString(eidHomerun), s), cWhiteColor, capgrpMessage); |
1182 PlaySound(sndHomerun) |
1220 PlaySound(sndHomerun) |
1183 end; |
1221 end; |
1184 end |
1222 end |
1185 else |
1223 else |
1186 begin |
1224 begin |
1192 |
1230 |
1193 procedure doStepHedgehogDriven(HHGear: PGear); |
1231 procedure doStepHedgehogDriven(HHGear: PGear); |
1194 var t: PGear; |
1232 var t: PGear; |
1195 wasJumping: boolean; |
1233 wasJumping: boolean; |
1196 Hedgehog: PHedgehog; |
1234 Hedgehog: PHedgehog; |
|
1235 s: ansistring; |
1197 begin |
1236 begin |
1198 Hedgehog:= HHGear^.Hedgehog; |
1237 Hedgehog:= HHGear^.Hedgehog; |
1199 if not isInMultiShoot then |
1238 if not isInMultiShoot then |
1200 AllInactive:= false |
1239 AllInactive:= false |
1201 else if Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle] then |
1240 else if Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle] then |
1202 HHGear^.Message:= 0; |
1241 HHGear^.Message:= HHGear^.Message and gmPrecise; |
1203 |
1242 |
1204 if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Utility) <> 0) and isInMultiShoot then |
1243 if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Utility) <> 0) and isInMultiShoot then |
1205 AllInactive:= true |
1244 AllInactive:= true |
1206 else if not isInMultiShoot then |
1245 else if not isInMultiShoot then |
1207 AllInactive:= false; |
1246 AllInactive:= false; |
1208 |
1247 |
1209 if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then |
1248 if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) or (LuaEndTurnRequested = true) then |
1210 begin |
1249 begin |
1211 if (Hedgehog^.CurAmmoType = amKnife) then |
1250 if (Hedgehog^.CurAmmoType = amKnife) then |
1212 LoadHedgehogHat(Hedgehog^, Hedgehog^.Hat); |
1251 LoadHedgehogHat(Hedgehog^, Hedgehog^.Hat); |
1213 if TagTurnTimeLeft = 0 then |
1252 if TagTurnTimeLeft = 0 then |
1214 TagTurnTimeLeft:= TurnTimeLeft; |
1253 TagTurnTimeLeft:= TurnTimeLeft; |
1215 TurnTimeLeft:= 0; |
1254 TurnTimeLeft:= 0; |
|
1255 if (GameOver = false) and ((GameFlags and gfInfAttack) = 0) and ((HHGear^.State and gstAttacked) = 0) and (HHGear^.Damage = 0) and (LuaNoEndTurnTaunts = false) then |
|
1256 begin |
|
1257 AddVoice(sndBoring, Hedgehog^.Team^.voicepack); |
|
1258 if (GameFlags and gfInfAttack = 0) then |
|
1259 begin |
|
1260 s:= Hedgehog^.Name; |
|
1261 AddCaption(FormatA(GetEventString(eidTimeout), s), cWhiteColor, capgrpMessage); |
|
1262 end; |
|
1263 end; |
1216 isCursorVisible:= false; |
1264 isCursorVisible:= false; |
1217 HHGear^.State:= HHGear^.State and (not (gstHHDriven or gstAnimation or gstAttacking)); |
1265 HHGear^.State:= HHGear^.State and (not (gstHHDriven or gstAnimation or gstAttacking)); |
1218 AttackBar:= 0; |
1266 AttackBar:= 0; |
|
1267 StopSound(sndThrowPowerUp); |
|
1268 LuaEndTurnRequested:= false; |
|
1269 LuaNoEndTurnTaunts:= false; |
1219 if HHGear^.Damage > 0 then |
1270 if HHGear^.Damage > 0 then |
1220 HHGear^.State:= HHGear^.State and (not (gstHHJumping or gstHHHJump)); |
1271 HHGear^.State:= HHGear^.State and (not (gstHHJumping or gstHHHJump)); |
1221 exit |
1272 exit |
1222 end; |
1273 end; |
1223 |
1274 |
1373 begin |
1424 begin |
1374 Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation); |
1425 Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation); |
1375 Gear^.doStep:= @doStepHedgehogDead; |
1426 Gear^.doStep:= @doStepHedgehogDead; |
1376 // Death message |
1427 // Death message |
1377 s:= ansistring(Gear^.Hedgehog^.Name); |
1428 s:= ansistring(Gear^.Hedgehog^.Name); |
1378 AddCaption(FormatA(GetEventString(eidDied), s), cWhiteColor, capgrpMessage); |
1429 if Gear^.Hedgehog^.King then |
|
1430 AddCaption(FormatA(GetEventString(eidKingDied), s), cWhiteColor, capgrpMessage) |
|
1431 else |
|
1432 AddCaption(FormatA(GetEventString(eidDied), s), cWhiteColor, capgrpMessage); |
1379 end; |
1433 end; |
1380 end |
1434 end |
1381 else |
1435 else |
1382 begin |
1436 begin |
1383 Gear^.State:= Gear^.State and (not gstAnimation); |
1437 Gear^.State:= Gear^.State and (not gstAnimation); |