--- a/hedgewars/GSHandlers.inc Sun Mar 22 21:51:30 2009 +0000
+++ b/hedgewars/GSHandlers.inc Mon Mar 23 19:03:51 2009 +0000
@@ -1414,21 +1414,19 @@
procedure doStepGirder(Gear: PGear);
var HHGear: PGear;
- x, y, tx, ty: LongInt;
+ x, y, tx, ty: hwFloat;
begin
AllInactive:= false;
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
-tx:= TargetPoint.X;
-ty:= TargetPoint.Y;
-x:= hwRound(HHGear^.X);
-y:= hwRound(HHGear^.Y);
+tx:= int2hwFloat(TargetPoint.X);
+ty:= int2hwFloat(TargetPoint.Y);
+x:= HHGear^.X;
+y:= HHGear^.Y;
-// use a circle instead?
-if (abs(tx-x) > 256) or
- (abs(ty-y) > 256) or
- not TryPlaceOnLand(tx - SpritesData[sprAmGirder].Width div 2,
- ty - SpritesData[sprAmGirder].Height div 2,
+if (Distance(tx - x, ty - y) > _256) or
+ not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2,
+ TargetPoint.Y - SpritesData[sprAmGirder].Height div 2,
sprAmGirder, Gear^.State, true) then
begin
PlaySound(sndDenied, false, nil);
--- a/hedgewars/uAmmos.pas Sun Mar 22 21:51:30 2009 +0000
+++ b/hedgewars/uAmmos.pas Mon Mar 23 19:03:51 2009 +0000
@@ -227,13 +227,13 @@
begin
with Hedgehog do
if ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_DontHold) <> 0) or
- (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber > 0) then
+ (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0) then
begin
CurAmmo:= 0;
CurSlot:= 0;
while (CurSlot <= cMaxSlotIndex) and
(Ammo^[CurSlot, CurAmmo].Count = 0) and
- (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber > 0)
+ (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0)
do inc(CurSlot)
end
end;
--- a/hedgewars/uFloat.pas Sun Mar 22 21:51:30 2009 +0000
+++ b/hedgewars/uFloat.pas Mon Mar 23 19:03:51 2009 +0000
@@ -121,6 +121,7 @@
_25: hwFloat = (isNegative: false; QWordValue: 4294967296 * 25);
_30: hwFloat = (isNegative: false; QWordValue: 4294967296 * 30);
_128: hwFloat = (isNegative: false; QWordValue: 4294967296 * 128);
+ _256: hwFloat = (isNegative: false; QWordValue: 4294967296 * 256);
_300: hwFloat = (isNegative: false; QWordValue: 4294967296 * 300);
_450: hwFloat = (isNegative: false; QWordValue: 4294967296 * 450);
_1024: hwFloat = (isNegative: false; QWordValue: 4294967296 * 1024);
--- a/hedgewars/uWorld.pas Sun Mar 22 21:51:30 2009 +0000
+++ b/hedgewars/uWorld.pas Mon Mar 23 19:03:51 2009 +0000
@@ -178,13 +178,48 @@
procedure MoveCamera; forward;
+procedure DrawWater;
+var VertexBuffer: array [0..3] of TVertex2f;
+ r: TSDL_Rect;
+begin
+// Water
+r.y:= WorldDy + cWaterLine + 32;
+if r.y < cScreenHeight then
+ begin
+ if r.y < 0 then r.y:= 0;
+
+ glDisable(GL_TEXTURE_2D);
+ VertexBuffer[0].X:= 0;
+ VertexBuffer[0].Y:= r.y;
+ VertexBuffer[1].X:= cScreenWidth;
+ VertexBuffer[1].Y:= r.y;
+ VertexBuffer[2].X:= cScreenWidth;
+ VertexBuffer[2].Y:= cScreenHeight;
+ VertexBuffer[3].X:= 0;
+ VertexBuffer[3].Y:= cScreenHeight;
+
+ glEnableClientState (GL_COLOR_ARRAY);
+ glColorPointer(3, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
+
+ glEnableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+
+ glColor4f(1, 1, 1, 1); // disable coloring
+ glEnable(GL_TEXTURE_2D)
+ end
+end;
+
procedure DrawWorld(Lag: LongInt);
var i, t: LongInt;
r: TSDL_Rect;
tdx, tdy: Double;
grp: TCapGroup;
s: string[15];
- VertexBuffer: array [0..3] of TVertex2f;
procedure DrawRepeated(spr: TSprite; Shift: LongInt);
var i, w: LongInt;
@@ -225,36 +260,8 @@
DrawLand(WorldDx, WorldDy);
-// Water
-r.y:= WorldDy + cWaterLine + 32;
-if r.y < cScreenHeight then
- begin
- if r.y < 0 then r.y:= 0;
- glDisable(GL_TEXTURE_2D);
- VertexBuffer[0].X:= 0;
- VertexBuffer[0].Y:= r.y;
- VertexBuffer[1].X:= cScreenWidth;
- VertexBuffer[1].Y:= r.y;
- VertexBuffer[2].X:= cScreenWidth;
- VertexBuffer[2].Y:= cScreenHeight;
- VertexBuffer[3].X:= 0;
- VertexBuffer[3].Y:= cScreenHeight;
-
- glEnableClientState (GL_COLOR_ARRAY);
- glColorPointer(3, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
-
- glEnableClientState(GL_COLOR_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
-
- glColor4f(1, 1, 1, 1); // disable coloring
- glEnable(GL_TEXTURE_2D)
- end;
+DrawWater;
// Attack bar
if CurrentTeam <> nil then