- Increased FPS
- Dynamite, not full implemetation
- Bots can use Desert Eagle
- Various fixes for collisions with hhs and ammo
- Simplified mine code
--- a/hedgewars/GSHandlers.inc Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/GSHandlers.inc Sat Jan 07 15:21:44 2006 +0000
@@ -286,6 +286,7 @@
if t <> nil then
begin
AmmoShove(Gear, t, 12);
+ inc(Gear.Damage, 10);
if t.CollIndex < High(Longword) then DeleteCR(t)
end;
dec(i)
@@ -605,25 +606,25 @@
////////////////////////////////////////////////////////////////////////////////
procedure doStepMine(Gear: PGear);
begin
-if (Gear.dX <> 0) or (Gear.dY <> 0) {or not TestCollisionY(Gear, 1)} then
+if (Gear.dX <> 0) or (Gear.dY <> 0) then
begin
+ if Gear.CollIndex < High(Longword) then DeleteCR(Gear);
doStepFallingGear(Gear);
if Gear.Active = false then
begin
+ if Gear.CollIndex = High(Longword) then AddGearCR(Gear);
Gear.dX:= 0;
Gear.dY:= 0
end;
CalcRotationDirAngle(Gear);
AllInactive:= false
end;
+
if ((Gear.State and gsttmpFlag) <> 0) then
if ((Gear.State and gstAttacking) = 0) then
begin
- if (Gear.Tag = 0) then
- begin
- Gear.Tag:= 10;
+ if ((GameTicks and $F) = 0) then
if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear.State:= Gear.State or gstAttacking
- end else dec(Gear.Tag)
end else // gstAttacking <> 0
begin
AllInactive:= false;
@@ -637,6 +638,34 @@
end else // gsttmpFlag = 0
if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag;
end;
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepDynamite(Gear: PGear);
+begin
+if (Gear.dX <> 0) or (Gear.dY <> 0) {or not TestCollisionY(Gear, 1)} then
+ begin
+ doStepFallingGear(Gear);
+ if Gear.Active = false then
+ begin
+ Gear.dX:= 0;
+ Gear.dY:= 0
+ end;
+// CalcRotationDirAngle(Gear);
+ AllInactive:= false
+ end;
+//if ((Gear.State and gsttmpFlag) <> 0) then
+// if ((Gear.State and gstAttacking) = 0) then
+ begin
+ // AllInactive:= true;
+ if (Gear.Timer and $FF) = 0 then PlaySound(sndMineTick);
+ if Gear.Timer = 0 then
+ begin
+ doMakeExplosion(round(Gear.X), round(Gear.Y), 85, EXPLAutoSound);
+ DeleteGear(Gear)
+ end;
+ dec(Gear.Timer);
+ end;{ else // gsttmpFlag = 0
+ if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag;}
+end;
////////////////////////////////////////////////////////////////////////////////
procedure doStepCase(Gear: PGear);
--- a/hedgewars/HHHandlers.inc Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/HHHandlers.inc Sat Jan 07 15:21:44 2006 +0000
@@ -54,7 +54,8 @@
begin
ar[cnt]:= t;
inc(cnt)
- end else b:= true;
+ end else
+ if not (t.Kind in [gtGrave, gtMine]) then b:= true;
t:= t.NextGear
end;
ar[cnt]:= Gear;
@@ -135,10 +136,12 @@
amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHHalfHeight, gtPickHammer, 0);
amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy);
amMine: AddGear(round(X) + Sign(dX) * 7, round(Y), gtMine, 0, Sign(dX) * 0.01, 0, 3000);
+ amDynamite: AddGear(round(X) + Sign(dX) * 7, round(Y), gtDynamite, 0, Sign(dX) * 0.01, 0, 5000);
end;
Power:= 0;
if CurAmmoGear <> nil then
begin
+ Gear.Message:= Gear.Message or gm_Attack;
CurAmmoGear.Message:= Gear.Message;
exit
end else
@@ -176,7 +179,11 @@
const StepTicks: LongWord = 0;
var t: PGear;
begin
-if isinMultiShoot and (Gear.Damage = 0) then exit;
+if isinMultiShoot and (Gear.Damage = 0) then
+ begin
+ if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
+ exit
+ end;
AllInactive:= false;
if (TurnTimeLeft = 0) or (Gear.Damage > 0) then
begin
@@ -251,7 +258,7 @@
if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
and ((Gear.State and gstHHJumping) <> 0) then Gear.dX:= 0.0000001 * Sign(Gear.dX);
Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
- StepTicks:= 300; writelntoconsole(inttostr(gameticks)+'ooo');
+ StepTicks:= 300;
Gear.dY:= 0
end;
CheckGearDrowning(Gear);
--- a/hedgewars/uAIAmmoTests.pas Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/uAIAmmoTests.pas Sat Jan 07 15:21:44 2006 +0000
@@ -41,6 +41,7 @@
function TestGrenade(Me, Targ: TPoint; Flags: Longword; out Time: Longword; out Angle, Power: integer): boolean;
function TestBazooka(Me, Targ: TPoint; Flags: Longword; out Time: Longword; out Angle, Power: integer): boolean;
function TestShotgun(Me, Targ: TPoint; Flags: Longword; out Time: Longword; out Angle, Power: integer): boolean;
+function TestDEagle(Me, Targ: TPoint; Flags: Longword; out Time: Longword; out Angle, Power: integer): boolean;
type TAmmoTestProc = function (Me, Targ: TPoint; Flags: Longword; out Time: Longword; out Angle, Power: integer): boolean;
const AmmoTests: array[TAmmoType] of
@@ -72,13 +73,16 @@
( Test: nil;
Flags: 0;
),
+ ( Test: TestDEagle;
+ Flags: 0;
+ ),
( Test: nil;
Flags: 0;
)
);
implementation
-uses uMisc, uAIMisc;
+uses uMisc, uAIMisc, uLand;
function TestGrenade(Me, Targ: TPoint; Flags: Longword; out Time: Longword; out Angle, Power: integer): boolean;
var Vx, Vy, r: real;
@@ -198,5 +202,25 @@
Result:= true
end;
+function TestDEagle(Me, Targ: TPoint; Flags: Longword; out Time: Longword; out Angle, Power: integer): boolean;
+var Vx, Vy, x, y: real;
+ d: Longword;
+begin
+Time:= 0;
+Power:= 1;
+Vx:= (Targ.X - Me.X)/1024;
+Vy:= (Targ.Y - Me.Y)/1024;
+x:= Me.X;
+y:= Me.Y;
+Angle:= DxDy2Angle(Vx, -Vy);
+d:= 0;
+repeat
+ x:= x + vX;
+ y:= y + vY;
+ if ((round(x) and $FFFFF800) = 0)and((round(y) and $FFFFFC00) = 0)
+ and (Land[round(y), round(x)] <> 0) then inc(d);
+until (abs(Targ.X - x) + abs(Targ.Y - y) < 2) or (x < 0) or (y < 0) or (x > 2048) or (y > 1024);
+Result:= d < 50
+end;
end.
--- a/hedgewars/uConsole.pas Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/uConsole.pas Sat Jan 07 15:21:44 2006 +0000
@@ -243,6 +243,7 @@
//RegisterVariable('gravity' , vtReal , @cGravity ); гравитация не должна быть доступна вообще
RegisterVariable('c_height', vtInteger, @cConsoleHeight );
RegisterVariable('gmflags' , vtInteger, @GameFlags );
+RegisterVariable('turntime', vtInteger, @cHedgehogTurnTime);
RegisterVariable('showfps' , vtBoolean, @cShowFPS );
RegisterVariable('sound' , vtBoolean, @isSoundEnabled );
RegisterVariable('name' , vtCommand, @chName );
--- a/hedgewars/uConsts.pas Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/uConsts.pas Sat Jan 07 15:21:44 2006 +0000
@@ -47,12 +47,12 @@
sprMineOn, sprCase);
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
- gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot);
+ gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite);
TGearsType = set of TGearType;
TSound = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick);
TAmmoType = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope,
- amMine, amDEagle);
+ amMine, amDEagle, amDynamite);
THWFont = (fnt16, fntBig);
THHFont = record
Handle: PTTF_Font;
@@ -327,7 +327,15 @@
Timer: 0;
AmmoType: amDEagle);
Slot: 2;
- TimeAfterTurn: 3000));
+ TimeAfterTurn: 3000),
+ (Name: 'Dynamite';
+ Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInJump or ammoprop_AttackInFall;
+ Count: 5;
+ NumPerTurn: 0;
+ Timer: 0;
+ AmmoType: amDynamite);
+ Slot: 3;
+ TimeAfterTurn: 5000));
--- a/hedgewars/uGears.pas Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/uGears.pas Sat Jan 07 15:21:44 2006 +0000
@@ -112,7 +112,8 @@
doStepExplosion,
doStepMine,
doStepCase,
- doStepDEagleShot
+ doStepDEagleShot,
+ doStepDynamite
);
function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
@@ -209,6 +210,13 @@
Result.HalfHeight:= 1;
Result.Health:= 50
end;
+ gtDynamite: begin
+ Result.HalfWidth:= 3;
+ Result.HalfHeight:= 3;
+ Result.Elasticity:= 0.03;
+ Result.Friction:= 0.03;
+ Result.Timer:= 5000;
+ end;
end;
if GearsList = nil then GearsList:= Result
else begin
@@ -484,6 +492,11 @@
gtMine: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420)
then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface)
else DrawSprite(sprMineOn , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface);
+ //!!! ACHTUNG!!!!
+ gtDynamite: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420)
+ then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface)
+ else DrawSprite(sprMineOn , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface);
+ //!!! ACHTUNG!!!!
gtCase: DrawSprite(sprCase, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, 0, Surface);
end;
Gear:= Gear.NextGear
@@ -527,7 +540,6 @@
DrawExplosion(X, Y, Radius);
if Radius = 50 then AddGear(X, Y, gtExplosion, 0);
if (Mask and EXPLAutoSound)<>0 then PlaySound(sndExplosion);
-if (Mask and EXPLNoDamage)<>0 then exit;
if (Mask and EXPLAllDamageInRadius)=0 then Radius:= Radius shl 1;
Gear:= GearsList;
while Gear <> nil do
@@ -540,7 +552,7 @@
gtHedgehog,
gtMine,
gtCase: begin
- inc(Gear.Damage, dmg);
+ if (Mask and EXPLNoDamage) = 0 then inc(Gear.Damage, dmg);
Gear.dX:= Gear.dX + dmg / 200 * sign(Gear.X - X);
Gear.dY:= Gear.dY + dmg / 200 * sign(Gear.Y - Y);
Gear.Active:= true;
--- a/hedgewars/uMisc.pas Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/uMisc.pas Sat Jan 07 15:21:44 2006 +0000
@@ -41,7 +41,7 @@
isSoundEnabled : boolean = true;
isInMultiShoot : boolean = false;
- GameState : TGameState = gsLandGen;
+ GameState : TGameState = Low(TGameState);
GameType : TGameType = gmtLocal;
GameFlags : Longword = 0;
TurnTimeLeft : Longword = 0;
@@ -51,7 +51,7 @@
cCloudsNumber : integer = 9;
cConsoleHeight : integer = 320;
cConsoleYAdd : integer = 0;
- cTimerInterval : Cardinal = 15;
+ cTimerInterval : Cardinal = 5;
cScreenWidth : integer = 1024;
cScreenHeight : integer = 768;
cBits : integer = 16;
--- a/hedgewars/uWorld.pas Thu Jan 05 22:55:45 2006 +0000
+++ b/hedgewars/uWorld.pas Sat Jan 07 15:21:44 2006 +0000
@@ -142,7 +142,7 @@
else
if ShowCrosshair then
DrawCaption(Round(Gear.X + Sign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle)*60) + WorldDx,
- Round(Gear.Y - Cos(Gear.Angle*pi/cMaxAngle)*60) + WorldDy - 5,
+ Round(Gear.Y - Cos(Gear.Angle*pi/cMaxAngle)*60) + WorldDy - 4,
Team.CrossHairRect, Surface)
end;
team:= team.Next