# HG changeset patch # User nemo # Date 1302458696 14400 # Node ID 948da1e50205cd7812060afedfbc423eeed54982 # Parent 97827ad5c9046dc2c12d6111829fab3b8d97b48f Fix a few crosshair bugs. Disable ShowCrosshair and just decide when drawing. diff -r 97827ad5c904 -r 948da1e50205 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Sun Apr 10 20:02:25 2011 +0200 +++ b/hedgewars/HHHandlers.inc Sun Apr 10 14:04:56 2011 -0400 @@ -90,14 +90,7 @@ if i <= cMaxSlotAmmoIndex then ammoidx:= i else ammoidx:= -1 end; - if ammoidx >= 0 then - begin - CurAmmoType:= Ammo^[slot, ammoidx].AmmoType; - if (CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then - ShowCrosshair:= (Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0 - else - ShowCrosshair:= (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0; - end + if ammoidx >= 0 then CurAmmoType:= Ammo^[slot, ammoidx].AmmoType; end end; @@ -390,9 +383,6 @@ begin if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft; TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100; - if (CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then - ShowCrosshair:= (Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0 - else ShowCrosshair:= false; end; if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) then State:= State or gstAttacked; if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then ApplyAmmoChanges(CurrentHedgehog^) diff -r 97827ad5c904 -r 948da1e50205 hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Sun Apr 10 20:02:25 2011 +0200 +++ b/hedgewars/uAmmos.pas Sun Apr 10 14:04:56 2011 -0400 @@ -228,7 +228,6 @@ begin PackAmmo(Ammo, Ammoz[AmmoType].Slot); //SwitchNotHeldAmmo(Hedgehog); - ShowCrossHair:= false; CurAmmoType:= amNothing end end @@ -295,10 +294,6 @@ end; TryDo(slot <= cMaxSlotIndex, 'Ammo slot index overflow', true); CurAmmoType:= Ammo^[slot, ammoidx].AmmoType; - if (CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then - ShowCrosshair:= (Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0 - else - ShowCrosshair:= (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0; end end; diff -r 97827ad5c904 -r 948da1e50205 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Sun Apr 10 20:02:25 2011 +0200 +++ b/hedgewars/uGearsRender.pas Sun Apr 10 14:04:56 2011 -0400 @@ -259,7 +259,11 @@ if (Gear^.State and gstHHDriven) <> 0 then begin if ((Gear^.State and gstHHThinking) = 0) and - ShowCrosshair and +/// If current ammo is active, and current ammo has alt attack and uses a crosshair (rope, basically, right now, with no crosshair for parachute/saucer + (((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and + ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or +/// If no current ammo is active, and the selected ammo uses a crosshair + (CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0)) and ((Gear^.State and gstAnimation) = 0) then begin (* These calculations are a little complex for a few reasons: diff -r 97827ad5c904 -r 948da1e50205 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sun Apr 10 20:02:25 2011 +0200 +++ b/hedgewars/uVariables.pas Sun Apr 10 14:04:56 2011 -0400 @@ -124,7 +124,7 @@ bBetweenTurns : boolean; bWaterRising : boolean; - ShowCrosshair : boolean; + //ShowCrosshair : boolean; This variable is inconvenient to set. Easier to decide when rendering CursorMovementX : LongInt; CursorMovementY : LongInt; cDrownSpeed : hwFloat;