equal
deleted
inserted
replaced
164 |
164 |
165 |
165 |
166 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
166 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
167 var gear: PGear; |
167 var gear: PGear; |
168 //c: byte; |
168 //c: byte; |
|
169 cakeData: PCakeData; |
169 begin |
170 begin |
170 inc(GCounter); |
171 inc(GCounter); |
171 |
172 |
172 AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
173 AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
173 |
174 |
191 gear^.Density:= _1; |
192 gear^.Density:= _1; |
192 // Define ammo association, if any. |
193 // Define ammo association, if any. |
193 gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; |
194 gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; |
194 gear^.CollisionMask:= $FFFF; |
195 gear^.CollisionMask:= $FFFF; |
195 gear^.Tint:= $FFFFFFFF; |
196 gear^.Tint:= $FFFFFFFF; |
|
197 gear^.Data:= nil; |
196 |
198 |
197 if CurrentHedgehog <> nil then |
199 if CurrentHedgehog <> nil then |
198 begin |
200 begin |
199 gear^.Hedgehog:= CurrentHedgehog; |
201 gear^.Hedgehog:= CurrentHedgehog; |
200 if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then |
202 if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then |
505 gear^.RenderTimer:= true; |
507 gear^.RenderTimer:= true; |
506 gear^.DirAngle:= -90 * hwSign(Gear^.dX); |
508 gear^.DirAngle:= -90 * hwSign(Gear^.dX); |
507 if not dX.isNegative then |
509 if not dX.isNegative then |
508 gear^.Angle:= 1 |
510 gear^.Angle:= 1 |
509 else |
511 else |
510 gear^.Angle:= 3 |
512 gear^.Angle:= 3; |
|
513 New(cakeData); |
|
514 gear^.Data:= Pointer(cakeData); |
511 end; |
515 end; |
512 gtHellishBomb: begin |
516 gtHellishBomb: begin |
513 gear^.ImpactSound:= sndHellishImpact1; |
517 gear^.ImpactSound:= sndHellishImpact1; |
514 gear^.nImpactSounds:= 4; |
518 gear^.nImpactSounds:= 4; |
515 gear^.AdvBounce:= 1; |
519 gear^.AdvBounce:= 1; |
658 |
662 |
659 procedure DeleteGear(Gear: PGear); |
663 procedure DeleteGear(Gear: PGear); |
660 var team: PTeam; |
664 var team: PTeam; |
661 t,i: Longword; |
665 t,i: Longword; |
662 k: boolean; |
666 k: boolean; |
|
667 cakeData: PCakeData; |
663 begin |
668 begin |
664 |
669 |
665 ScriptCall('onGearDelete', gear^.uid); |
670 ScriptCall('onGearDelete', gear^.uid); |
666 |
671 |
667 DeleteCI(Gear); |
672 DeleteCI(Gear); |
672 if (Gear^.Kind = gtPortal) then |
677 if (Gear^.Kind = gtPortal) then |
673 begin |
678 begin |
674 if (Gear^.LinkedGear <> nil) then |
679 if (Gear^.LinkedGear <> nil) then |
675 if (Gear^.LinkedGear^.LinkedGear = Gear) then |
680 if (Gear^.LinkedGear^.LinkedGear = Gear) then |
676 Gear^.LinkedGear^.LinkedGear:= nil; |
681 Gear^.LinkedGear^.LinkedGear:= nil; |
|
682 end |
|
683 else if Gear^.Kind = gtCake then |
|
684 begin |
|
685 cakeData:= PCakeData(Gear^.Data); |
|
686 Dispose(cakeData); |
|
687 cakeData:= nil; |
677 end |
688 end |
678 else if Gear^.Kind = gtHedgehog then |
689 else if Gear^.Kind = gtHedgehog then |
679 (* |
690 (* |
680 This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS. I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves. I believe it should be removed |
691 This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS. I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves. I believe it should be removed |
681 if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then |
692 if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then |