# HG changeset patch # User unc0rr # Date 1290016703 -10800 # Node ID 4f2b1a152979ae67b4f49c9eeb08793a63e43d16 # Parent e944cc43f7a4ca3151ddb5a29dd2f4d063252dd3 Remove ugly PHedgehog(Gear^.Hedgehog) cast diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/CCHandlers.inc Wed Nov 17 20:58:23 2010 +0300 @@ -160,7 +160,7 @@ SplitBySpace(s, id); val(s, Gear^.Health); TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true); - PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam; + Gear^.Hedgehog^.Team:= CurrentTeam; if (GameFlags and gfSharedAmmo) <> 0 then CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex else if (GameFlags and gfPerHogAmmo) <> 0 then begin diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/GSHandlers.inc Wed Nov 17 20:58:23 2010 +0300 @@ -131,13 +131,13 @@ if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then if Gear^.Kind = gtHedgehog then begin - if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then + if Gear^.Hedgehog^.Effects[heResurrectable] then ResurrectHedgehog(Gear) else begin Gear^.doStep := @doStepDrowningGear; Gear^.State := Gear^.State and (not gstHHDriven); - AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); end end else @@ -203,9 +203,9 @@ if (Gear^.Invulnerable) then exit; //if _0_6 < Gear^.dY then - // PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) + // PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack) //else - // PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + // PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack); ApplyDamage(Gear, dmg, dsFall); end @@ -626,8 +626,8 @@ dec(Gear^.Timer); if Gear^.Timer = 0 then begin - PHedgehog(Gear^.Hedgehog)^.Gear^.Message:= PHedgehog(Gear^.Hedgehog)^.Gear^.Message and not gmAttack; - PHedgehog(Gear^.Hedgehog)^.Gear^.State:= PHedgehog(Gear^.Hedgehog)^.Gear^.State and not gstAttacking; + Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and not gmAttack; + Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and not gstAttacking; AttackBar:= 0; Gear^.SoundChannel := LoopSound(sndBee); @@ -806,7 +806,7 @@ shell: PVisualGear; begin cArtillery := true; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNotKickable; HedgehogChAngle(HHGear); if not cLaserSighting then @@ -899,7 +899,7 @@ HHGear: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; dec(Gear^.Timer); if (Gear^.Timer = 0)or((Gear^.Message and gmDestroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then @@ -973,7 +973,7 @@ HHGear: PGear; begin i := 0; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; y := hwRound(Gear^.Y) - cHHRadius * 2; while y < hwRound(Gear^.Y) do @@ -1005,7 +1005,7 @@ begin AllInactive := false; dec(Gear^.Timer); - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HedgehogChAngle(HHGear); @@ -1087,7 +1087,7 @@ begin BTPrevAngle := High(LongInt); BTSteps := 0; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := 0; HHGear^.State := HHGear^.State or gstNotKickable; Gear^.doStep := @doStepBlowTorchWork @@ -1102,7 +1102,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if ((HHGear^.State and gstHHDriven) = 0) or (CheckGearDrowning(HHGear)) or TestCollisionYwithGear(HHGear, 1) then @@ -1128,7 +1128,7 @@ Gear^.X := HHGear^.X; Gear^.Y := HHGear^.Y; - ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope); + ApplyAngleBounds(Gear^.Hedgehog^, amRope); Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX); Gear^.dY := -AngleCos(HHGear^.Angle); @@ -1170,7 +1170,7 @@ end; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if ((HHGear^.State and gstHHDriven) = 0) or (CheckGearDrowning(HHGear)) then @@ -1333,7 +1333,7 @@ if (Gear^.Message and gmAttack) <> 0 then if (Gear^.State and gsttmpFlag) <> 0 then - with PHedgehog(Gear^.Hedgehog)^ do + with Gear^.Hedgehog^ do begin PlaySound(sndRopeRelease); if CurAmmoType <> amParachute then @@ -1367,7 +1367,7 @@ Gear^.Y := Gear^.Y - Gear^.dY; Gear^.Elasticity := Gear^.Elasticity + _1; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; DeleteCI(HHGear); if (HHGear^.State and gstMoving) <> 0 then @@ -1447,7 +1447,7 @@ or ((HHGear^.State and gstHHDriven) = 0) or (HHGear^.Damage > 0) then begin - with PHedgehog(Gear^.Hedgehog)^.Gear^ do + with Gear^.Hedgehog^.Gear^ do begin State := State and not gstAttacking; Message := Message and not gmAttack @@ -1808,7 +1808,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -1825,7 +1825,7 @@ HHGear: PGear; i: LongInt; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -1978,7 +1978,7 @@ exit end; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then begin Gear^.Tag := hwRound(HHGear^.Y); @@ -2008,7 +2008,7 @@ HHGear: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; DeleteCI(HHGear); HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5; HHGear^.dX := SignAs(cLittle, Gear^.dX); @@ -2031,7 +2031,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; inc(Gear^.Timer); @@ -2070,7 +2070,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; DeleteCI(HHGear); @@ -2167,7 +2167,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; tx := int2hwFloat(TargetPoint.X); ty := int2hwFloat(TargetPoint.Y); x := HHGear^.X; @@ -2202,8 +2202,8 @@ var HHGear: PGear; begin - PHedgehog(Gear^.Hedgehog)^.Unplaced := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + Gear^.Hedgehog^.Unplaced := false; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Y := HHGear^.Y + HHGear^.dY; // hedgehog falling to collect cases HHGear^.dY := HHGear^.dY + cGravity; @@ -2233,7 +2233,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, sprHHTelepMask, 0, false) then @@ -2275,7 +2275,7 @@ if ((Gear^.Message and not gmSwitch) <> 0) or (TurnTimeLeft = 0) then begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; Msg := Gear^.Message and not gmSwitch; DeleteGear(Gear); OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); @@ -2326,7 +2326,7 @@ begin Gear^.doStep := @doStepSwitcherWork; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; with HHGear^ do begin State := State and not gstAttacking; @@ -2377,7 +2377,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.State := HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -2437,7 +2437,7 @@ if Gear^.Timer = 0 then begin Gear^.Pos := 1; - PlaySound(sndKamikaze, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack); Gear^.doStep := @doStepKamikazeWork end end; @@ -2448,7 +2448,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.dX := Gear^.dX; HHGear^.dY := Gear^.dY; @@ -2637,7 +2637,7 @@ begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and (not gmAttack); DeleteCI(HHGear); Gear^.IntersectGear:= nil; @@ -2687,7 +2687,7 @@ Gear^.Timer := 0; inc(Gear^.Pos); if Gear^.Pos = 5 then - PlaySound(sndYoohoo, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) + PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack) end; if Gear^.Pos = 14 then @@ -2697,7 +2697,7 @@ procedure doStepSeduction(Gear: PGear); begin AllInactive := false; - DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear); + DeleteCI(Gear^.Hedgehog^.Gear); Gear^.doStep := @doStepSeductionWear end; @@ -2836,7 +2836,7 @@ begin AllInactive := false; dec(Gear^.Timer); - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); @@ -2864,7 +2864,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and not (gmUp or gmDown); HHGear^.State := HHGear^.State or gstNotKickable; Gear^.doStep := @doStepBallgunWork @@ -2889,7 +2889,7 @@ if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and ( TimeTrialStartTime = 0) then TimeTrialStartTime := RealTicks; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; FollowGear := Gear; fChanged := false; @@ -3025,7 +3025,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := 0; HHGear^.State := HHGear^.State or gstNotKickable; Gear^.Angle := HHGear^.Angle; @@ -3045,7 +3045,7 @@ isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius; if Gear^.Pos > 0 then dec(Gear^.Pos); AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; //dec(Gear^.Timer); move := _0_2; fuel := 50; @@ -3169,7 +3169,7 @@ Gear^.Pos:= 0; Gear^.doStep := @doStepJetpackWork; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; FollowGear := HHGear; AfterAttack; with HHGear^ do @@ -3427,7 +3427,7 @@ // destroy portal if ground it was attached too is gone if ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0) or (Gear^.Timer < 1) - or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog) + or (Gear^.Hedgehog <> CurrentHedgehog) or (hwRound(Gear^.Y) > cWaterLine) then begin deleteGear(Gear); @@ -3754,7 +3754,7 @@ doPortalColorSwitch(); doStepPerPixel(Gear, @doStepMovingPortal_real, true); if (Gear^.Timer < 1) - or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog) then + or (Gear^.Hedgehog <> CurrentHedgehog) then deleteGear(Gear); end; @@ -4047,7 +4047,7 @@ Fire: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); @@ -4111,7 +4111,7 @@ var HHGear: PGear; begin - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight); HHGear^.State := HHGear^.State or gstNotKickable; Gear^.doStep := @doStepFlamethrowerWork @@ -4140,7 +4140,7 @@ t: PGearArray; i: LongInt; begin -HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; +HHGear:= Gear^.Hedgehog^.Gear; HHGear^.State:= HHGear^.State or gstNoDamage; DeleteCI(HHGear); @@ -4181,7 +4181,7 @@ HHGear: PGear; begin AllInactive := false; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; dec(Gear^.Timer); if (HHGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then begin @@ -4234,7 +4234,7 @@ HHGear: PGear; begin i := 0; - HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; + HHGear := Gear^.Hedgehog^.Gear; y := hwRound(Gear^.Y) - cHHRadius * 2; while y < hwRound(Gear^.Y) do @@ -4265,7 +4265,7 @@ dec(TurnTimeLeft); AllInactive := false; - hh := PHedgehog(Gear^.Hedgehog); + hh := Gear^.Hedgehog; DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy - cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex); (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF, diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/GearDrawing.inc --- a/hedgewars/GearDrawing.inc Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/GearDrawing.inc Wed Nov 17 20:58:23 2010 +0300 @@ -7,7 +7,7 @@ HH: PHedgehog; CurWeapon: PAmmo; begin -HH:= PHedgehog(Gear^.Hedgehog); +HH:= Gear^.Hedgehog; if HH^.Unplaced then exit; m:= 1; if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1; @@ -706,7 +706,7 @@ gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtGrave: begin - DrawTextureF(PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); + DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32); if Gear^.Health > 0 then begin //Tint($33, $33, $FF, max($40, floor($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750)))); @@ -771,8 +771,8 @@ else DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 1); gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtTeleport: begin - HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; - if not PHedgehog(Gear^.Hedgehog)^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); + HHGear:= Gear^.Hedgehog^.Gear; + if not Gear^.Hedgehog^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); end; gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/HHHandlers.inc Wed Nov 17 20:58:23 2010 +0300 @@ -48,7 +48,7 @@ ChangeAmmo:= false; slot:= Gear^.MsgParam; -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do begin Gear^.Message:= Gear^.Message and not gmSlot; ammoidx:= 0; @@ -60,7 +60,7 @@ while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); - if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^); + if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(Gear^.Hedgehog^); MultiShootAttacks:= 0; Gear^.Message:= Gear^.Message and not (gmLJump or gmHJump); @@ -101,7 +101,7 @@ s: boolean; begin weap:= TAmmoType(Gear^.MsgParam); -Hedgehog:= PHedgehog(Gear^.Hedgehog); +Hedgehog:= Gear^.Hedgehog; if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then exit; // weapon is not activated yet @@ -118,15 +118,15 @@ dec(t) end; -if s then ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^) +if s then ApplyAmmoChanges(Gear^.Hedgehog^) end; procedure HHSetTimer(Gear: PGear); var CurWeapon: PAmmo; begin Gear^.Message:= Gear^.Message and not gmTimer; -CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); -with PHedgehog(Gear^.Hedgehog)^ do +CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); +with Gear^.Hedgehog^ do if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then begin CurWeapon^.Timer:= 1000 * Gear^.MsgParam; @@ -143,9 +143,9 @@ altUse: boolean; begin bShowFinger:= false; -CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); +CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); with Gear^, - PHedgehog(Gear^.Hedgehog)^ do + Gear^.Hedgehog^ do begin if ((State and gstHHDriven) <> 0)and ((State and (gstAttacked or gstHHChooseTarget)) = 0) and @@ -386,7 +386,7 @@ const frametime = 200; timertime = frametime * 6; begin -if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; +if Gear^.Hedgehog^.Unplaced then exit; if Gear^.Timer > 1 then begin AllInactive:= false; @@ -406,7 +406,7 @@ Gear^.Z:= cCurrHHZ; RemoveGearFromList(Gear); InsertGearToList(Gear); - PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); Gear^.Pos:= 0; Gear^.Timer:= timertime end @@ -417,7 +417,7 @@ const frametime = 65; timertime = frametime * 11; begin -if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; +if Gear^.Hedgehog^.Unplaced then exit; if Gear^.Timer > 1 then begin AllInactive:= false; @@ -434,7 +434,7 @@ Gear^.Z:= cCurrHHZ; RemoveGearFromList(Gear); InsertGearToList(Gear); - PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); PlaySound(sndWarp); Gear^.Pos:= 0; Gear^.Timer:= timertime @@ -497,11 +497,11 @@ var PrevdX: LongInt; CurWeapon: PAmmo; begin -CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); +CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^); if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then begin if isCursorVisible then - with PHedgehog(Gear^.Hedgehog)^ do + with Gear^.Hedgehog^ do with CurWeapon^ do begin if (Gear^.Message and gmLeft ) <> 0 then @@ -536,7 +536,7 @@ Gear^.dY:= -_0_15; if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; - PlaySound(sndJump1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack); exit end; end; @@ -549,7 +549,7 @@ Gear^.dY:= -_0_2; SetLittle(Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; - PlaySound(sndJump3, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); + PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack); exit end; @@ -570,7 +570,7 @@ end; DeleteCI(Gear); // must be after exit!! (see previous line) - PHedgehog(Gear^.Hedgehog)^.visStepPos:= (PHedgehog(Gear^.Hedgehog)^.visStepPos + 1) and 7; + Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7; if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) @@ -630,7 +630,7 @@ procedure HedgehogChAngle(Gear: PGear); var da: LongWord; begin -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do if (CurAmmoType = amRope) and ((Gear^.State and (gstMoving or gstHHJumping)) = gstMoving) then da:= 2 else da:= 1; @@ -649,7 +649,7 @@ if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862; if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862; -if PHedgehog(Gear^.Hedgehog)^.Unplaced then +if Gear^.Hedgehog^.Unplaced then begin Gear^.dY:= _0; Gear^.dX:= _0; @@ -773,7 +773,7 @@ wasJumping: boolean; Hedgehog: PHedgehog; begin -Hedgehog:= PHedgehog(Gear^.Hedgehog); +Hedgehog:= Gear^.Hedgehog; if not isInMultiShoot then AllInactive:= false else @@ -919,16 +919,16 @@ PrvInactive:= false; AllInactive:= false; - if not PHedgehog(Gear^.Hedgehog)^.Team^.hasGone then + if not Gear^.Hedgehog^.Team^.hasGone then begin - PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] := false; - if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then begin + Gear^.Hedgehog^.Effects[hePoisoned] := false; + if Gear^.Hedgehog^.Effects[heResurrectable] then begin ResurrectHedgehog(Gear); end else begin Gear^.State:= Gear^.State or gstHHDeath; Gear^.doStep:= @doStepHedgehogDead; // Death message - AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); end; end else @@ -936,7 +936,7 @@ Gear^.State:= Gear^.State or gstHHGone; Gear^.doStep:= @doStepHedgehogGone; // Gone message - AddCaption(Format(GetEventString(eidGone), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); end end; exit @@ -974,7 +974,7 @@ doStepHedgehogFree(Gear) else begin - with PHedgehog(Gear^.Hedgehog)^ do + with Gear^.Hedgehog^ do if Team^.hasGone then TeamGoneEffect(Team^); doStepHedgehogDriven(Gear) end; diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/VGSHandlers.inc Wed Nov 17 20:58:23 2010 +0300 @@ -444,16 +444,16 @@ begin if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; -if (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then +if (Gear^.Hedgehog^.Gear <> nil) then begin - Gear^.X:= PHedgehog(Gear^.Hedgehog)^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2 - Gear^.FrameTicks); - Gear^.Y:= PHedgehog(Gear^.Hedgehog)^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h); + Gear^.X:= Gear^.Hedgehog^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2 - Gear^.FrameTicks); + Gear^.Y:= Gear^.Hedgehog^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h); end; if Gear^.Timer = 0 then begin - if PHedgehog(Gear^.Hedgehog)^.SpeechGear = Gear then - PHedgehog(Gear^.Hedgehog)^.SpeechGear:= nil; + if Gear^.Hedgehog^.SpeechGear = Gear then + Gear^.Hedgehog^.SpeechGear:= nil; DeleteVisualGear(Gear) end; end; @@ -462,10 +462,10 @@ begin Steps:= Steps; // avoid compiler hint -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do if SpeechGear <> nil then SpeechGear^.Timer:= 0; -PHedgehog(Gear^.Hedgehog)^.SpeechGear:= Gear; +Gear^.Hedgehog^.SpeechGear:= Gear; Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000); @@ -512,7 +512,7 @@ str(Gear^.State, s); if Gear^.Hedgehog <> nil then - Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16) + Gear^.Tex:= RenderStringTex(s, Gear^.Hedgehog^.Team^.Clan^.Color, fnt16) else Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/uAIMisc.pas Wed Nov 17 20:58:23 2010 +0300 @@ -150,7 +150,7 @@ AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 60, -25) else if isAfterAttack and (ThinkingHH^.Hedgehog <> Gear^.Hedgehog) then - if (MyClan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan) then + if (MyClan = Gear^.Hedgehog^.Team^.Clan) then AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 150, -3) // hedgehog-friend else AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 100, 3) diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/uGears.pas Wed Nov 17 20:58:23 2010 +0300 @@ -558,12 +558,12 @@ uStats.HedgehogDamaged(Gear) end; - team:= PHedgehog(Gear^.Hedgehog)^.Team; + team:= Gear^.Hedgehog^.Team; if CurrentHedgehog^.Gear = Gear then FreeActionsList; // to avoid ThinkThread on drawned gear - PHedgehog(Gear^.Hedgehog)^.Gear:= nil; - if PHedgehog(Gear^.Hedgehog)^.King then + Gear^.Hedgehog^.Gear:= nil; + if Gear^.Hedgehog^.King then begin // are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough k:= false; @@ -614,17 +614,17 @@ else dec(Gear^.Health, dmg); - if (PHedgehog(Gear^.Hedgehog)^.Team = CurrentTeam) and + if (Gear^.Hedgehog^.Team = CurrentTeam) and (Gear^.Damage <> Gear^.Karma) and - not PHedgehog(Gear^.Hedgehog)^.King and - not PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] and + not Gear^.Hedgehog^.King and + not Gear^.Hedgehog^.Effects[hePoisoned] and not SuddenDeathDmg then Gear^.State:= Gear^.State or gstLoser; spawnHealthTagForHH(Gear, dmg); - RenderHealth(PHedgehog(Gear^.Hedgehog)^); - RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team); + RenderHealth(Gear^.Hedgehog^); + RecountTeamHealth(Gear^.Hedgehog^.Team); end; if (not isInMultiShoot) then Gear^.Karma:= 0; @@ -648,20 +648,20 @@ if Gear^.Kind = gtHedgehog then begin tmp:= 0; - if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then + if Gear^.Hedgehog^.Effects[hePoisoned] then begin inc(tmp, ModifyDamage(5, Gear)); - if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth) // does not need a minimum check since <= 1 basically disables it + if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth) // does not need a minimum check since <= 1 basically disables it end; if (TotalRounds > cSuddenDTurns - 1) then begin inc(tmp, cHealthDecrease); - if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, cHealthDecrease) + if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth, cHealthDecrease) end; - if PHedgehog(Gear^.Hedgehog)^.King then + if Gear^.Hedgehog^.King then begin flag:= false; - team:= PHedgehog(Gear^.Hedgehog)^.Team; + team:= Gear^.Hedgehog^.Team; for i:= 0 to Pred(team^.HedgehogsNumber) do if (team^.Hedgehogs[i].Gear <> nil) and (not team^.Hedgehogs[i].King) and @@ -670,7 +670,7 @@ if not flag then begin inc(tmp, 5); - if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, 5) + if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth, 5) end end; if tmp > 0 then @@ -968,7 +968,7 @@ if (Gear^.Kind = gtHedgehog) and (Damage>=1) then begin HHHurt(Gear^.Hedgehog, Source); - AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); + AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color); tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then begin @@ -1033,7 +1033,7 @@ procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt); begin -with PHedgehog(Gear^.Hedgehog)^ do +with Gear^.Hedgehog^ do begin if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then exit; @@ -1048,8 +1048,8 @@ begin rounded[Count].X:= hwRound(Gear^.X); rounded[Count].Y:= hwRound(Gear^.Y); - rounded[Count + 1].X:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X); - rounded[Count + 1].Y:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y); + rounded[Count + 1].X:= hwRound(Gear^.Hedgehog^.Gear^.X); + rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y); end; if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then @@ -1159,11 +1159,11 @@ DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, - hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); + hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy); end else if Gear^.Elasticity.QWordValue > 0 then DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, - hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); + hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy); end; @@ -1308,7 +1308,7 @@ if Gear^.Kind <> gtFlame then FollowGear:= Gear end; if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) then - PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] := true; + Gear^.Hedgehog^.Effects[hePoisoned] := true; end; end; @@ -1432,7 +1432,7 @@ if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch DeleteCI(Gear); - if (Gear^.Kind = gtHedgehog) and PHedgehog(Gear^.Hedgehog)^.King then + if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then begin Gear^.dX:= Ammo^.dX * Power * _0_005; Gear^.dY:= Ammo^.dY * Power * _0_005 @@ -1846,7 +1846,7 @@ else begin OutError('Can''t find place for Gear', false); - if Gear^.Kind = gtHedgehog then PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] := false; + if Gear^.Kind = gtHedgehog then Gear^.Hedgehog^.Effects[heResurrectable] := false; DeleteGear(Gear); Gear:= nil end @@ -1861,7 +1861,7 @@ *) i:= _1; if (CurrentHedgehog <> nil) and CurrentHedgehog^.King then i:= _1_5; -if (Gear^.Hedgehog <> nil) and (PHedgehog(Gear^.Hedgehog)^.King) then +if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.King) then ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent * _0_5) else ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent) diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/uStats.pas --- a/hedgewars/uStats.pas Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/uStats.pas Wed Nov 17 20:58:23 2010 +0300 @@ -52,10 +52,10 @@ procedure HedgehogDamaged(Gear: PGear); begin -if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then +if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack else - vpHurtEnemy:= PHedgehog(Gear^.Hedgehog)^.Team^.voicepack; + vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack; if bBetweenTurns then exit; @@ -64,7 +64,7 @@ if Gear <> CurrentHedgehog^.Gear then inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage); -if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Gear^.Damage); +if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Gear^.Damage); if Gear^.Health <= Gear^.Damage then begin @@ -73,14 +73,14 @@ inc(KillsTotal); inc(CurrentHedgehog^.Team^.stats.Kills); if (CurrentHedgehog^.Team^.TeamName = - PHedgehog(Gear^.Hedgehog)^.Team^.TeamName) then begin + Gear^.Hedgehog^.Team^.TeamName) then begin inc(CurrentHedgehog^.Team^.stats.TeamKills); inc(CurrentHedgehog^.Team^.stats.TeamDamage, Gear^.Damage); end; - if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(KillsClan); + if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan); end; -inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Gear^.Damage); +inc(Gear^.Hedgehog^.stats.StepDamageRecv, Gear^.Damage); inc(DamageGiven, Gear^.Damage); inc(DamageTotal, Gear^.Damage) end; diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/uTypes.pas Wed Nov 17 20:58:23 2010 +0300 @@ -233,7 +233,7 @@ doStep: TVGearStepProcedure; Tex: PTexture; alpha, scale: GLfloat; - Hedgehog: pointer; + Hedgehog: PHedgehog; Text: shortstring; Tint: Longword; end; diff -r e944cc43f7a4 -r 4f2b1a152979 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Wed Nov 17 20:36:35 2010 +0300 +++ b/hedgewars/uVariables.pas Wed Nov 17 20:58:23 2010 +0300 @@ -3,7 +3,7 @@ unit uVariables; interface -uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile, uGlobalStructs; +uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile; var /////// init flags ///////