Binary file hedgewars/Data/Forts/IslandL.png has changed
Binary file hedgewars/Data/Forts/IslandR.png has changed
--- a/hedgewars/Data/Locale/en.txt Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/Data/Locale/en.txt Sun Jul 23 21:22:44 2006 +0000
@@ -12,6 +12,7 @@
00:09=DEagle
00:10=Dynamite
00:11=BaseballBat
+00:12=Fire Punch
01:00=Let's fight!
01:01=sec
\ No newline at end of file
--- a/hedgewars/Data/Locale/ru.txt Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/Data/Locale/ru.txt Sun Jul 23 21:22:44 2006 +0000
@@ -12,6 +12,7 @@
00:09=Дезерт
00:10=Динамит
00:11=Бейсбольная бита
+00:12=Огненный удар
01:00=Вперёд к победе!
01:01=сек
\ No newline at end of file
--- a/hedgewars/GSHandlers.inc Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/GSHandlers.inc Sun Jul 23 21:22:44 2006 +0000
@@ -803,6 +803,58 @@
if (((GameTicks div 8) mod 64) = Gear.Angle) then
AmmoFlameWork(Gear);
-if Gear.Health = 0 then
+if Gear.Health = 0 then
DeleteGear(Gear)
end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepFirePunchWork(Gear: PGear);
+var HHGear: PGear;
+begin
+AllInactive:= false;
+if ((Gear.Message and gm_Destroy) <> 0) then
+ begin
+ DeleteGear(Gear);
+ AfterAttack;
+ exit
+ end;
+
+HHGear:= PHedgehog(Gear.Hedgehog).Gear;
+if round(HHGear.Y) <= Gear.Tag - 2 then
+ begin
+ Gear.Tag:= round(HHGear.Y);
+ DrawTunnel(HHGear.X - cHHRadius, HHGear.Y - 1, 0.5, 0.0, cHHRadius * 4, 2);
+ HHGear.State:= HHGear.State or gstNoDamage;
+ Gear.Y:= HHGear.Y;
+ AmmoShove(Gear, 30, 40);
+ HHGear.State:= HHGear.State and not gstNoDamage
+ end;
+
+HHGear.dY:= HHGear.dY + cGravity;
+if HHGear.dY >= 0 then
+ begin
+ HHGear.State:= HHGear.State or gstFalling;
+ DeleteGear(Gear);
+ AfterAttack;
+ exit
+ end;
+HHGear.Y:= HHGear.Y + HHGear.dY
+end;
+
+procedure doStepFirePunch(Gear: PGear);
+var HHGear: PGear;
+begin
+AllInactive:= false;
+HHGear:= PHedgehog(Gear.Hedgehog).Gear;
+HHGear.X:= round(HHGear.X) - 0.5;
+HHGear.dX:= 0.0000001 * Sign(HHGear.dX);
+HHGear.dY:= -0.30;
+
+Gear.X:= HHGear.X;
+Gear.dX:= Sign(HHGear.dX)* 0.45;
+Gear.dY:= -0.9;
+Gear.doStep:= doStepFirePunchWork;
+DrawTunnel(HHGear.X - cHHRadius, HHGear.Y + 1, 0.5, 0.0, cHHRadius * 4, 5);
+end;
+
+
--- a/hedgewars/HHHandlers.inc Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/HHHandlers.inc Sun Jul 23 21:22:44 2006 +0000
@@ -38,17 +38,12 @@
with Gear^,
CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
begin
- {$IFDEF DEBUGFILE}AddFileLog('Attack: Gear.State = '+inttostr(State)+' CurAmmoGear = '+inttostr(longword(CurAmmoGear)));{$ENDIF}
- if CurAmmoGear <> nil then
- begin
- Message:= Message and not gm_Attack;
- if not CurrentTeam.ExtDriven then SendIPC('a')
- end;
+ {$IFDEF DEBUGFILE}AddFileLog('Attack: Gear.State = '+inttostr(State));{$ENDIF}
+
if (((State and (gstHHDriven or gstAttacking)) = (gstHHDriven or gstAttacking))and
((State and (gstAttacked or gstMoving or gstHHChooseTarget)) = 0)and
(((State and gstFalling ) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInFall) <> 0))and
- (((State and gstHHJumping) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInJump) <> 0)))and
- (CurAmmoGear = nil) then
+ (((State and gstHHJumping) = 0)or((Ammo[CurSlot, CurAmmo].Propz and ammoprop_AttackInJump) <> 0))) then
begin
if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then
begin
@@ -70,24 +65,20 @@
amSkip: TurnTimeLeft:= 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.02, 0, 3000);
- amDEagle: begin
- FollowGear:= AddGear(round(X), round(Y), gtDEagleShot, 0, xx * 0.5, yy * 0.5);
- end;
+ amDEagle: AddGear(round(X), round(Y), gtDEagleShot, 0, xx * 0.5, yy * 0.5);
amDynamite: AddGear(round(X) + Sign(dX) * 7, round(Y), gtDynamite, 0, Sign(dX) * 0.035, 0, 5000);
- amBaseballBat: AddGear(round(X) + Sign(dX) * 10, round(Y), gtShover, 0, xx * 0.5, yy * 0.5).Radius:= 15
+ amBaseballBat: AddGear(round(X) + Sign(dX) * 10, round(Y), gtShover, 0, xx * 0.5, yy * 0.5).Radius:= 20;
+ amFirePunch: CurAmmoGear:= AddGear(round(X) + Sign(dX) * 10, round(Y), gtFirePunch, 0);
end;
Power:= 0;
if CurAmmoGear <> nil then
begin
- Gear.Message:= Gear.Message or gm_Attack;
- CurAmmoGear.Message:= Gear.Message;
- exit
- end else
- begin
- Message:= Message and not gm_Attack;
- if not CurrentTeam.ExtDriven then SendIPC('a')
- end;
- AfterAttack
+ Message:= Message or gm_Attack;
+ CurAmmoGear.Message:= Message
+ end else begin
+ if not CurrentTeam.ExtDriven then SendIPC('a');
+ AfterAttack
+ end
end
end
end;
@@ -200,7 +191,7 @@
if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.dX:= 0.0000001 * Sign(Gear.dX);
Gear.X:= Gear.X + Gear.dX;
Gear.dY:= Gear.dY + cGravity;
- if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
+ if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
Gear.Y:= Gear.Y + Gear.dY;
if (Gear.dY >= 0)and TestCollisionYwithGear(Gear, 1) then
begin
@@ -273,6 +264,7 @@
or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
end;
if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX;
+ Gear.dX:= 0.0000001 * Sign(Gear.dX);
SetAllHHToActive;
if not TestCollisionYwithGear(Gear, 1) then
@@ -363,6 +355,7 @@
Gear.Y:= Gear.Y + Gear.dY;
if (Gear.dY > 0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then
begin
+ CheckHHDamage(Gear);
Gear.dY:= 0;
Gear.Y:= Gear.Y + 1
end;
--- a/hedgewars/uAI.pas Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/uAI.pas Sun Jul 23 21:22:44 2006 +0000
@@ -143,6 +143,19 @@
end
end;
+ function PosInThinkStack(Me: PGear): boolean;
+ var i: Longword;
+ begin
+ i:= 0;
+ Result:= false;
+ while (i < Stack.Count) and not Result do
+ begin
+ Result:= abs(Stack.States[i].Hedgehog.X - Me.X) +
+ abs(Stack.States[i].Hedgehog.Y - Me.Y) <= 2;
+ inc(i)
+ end
+ end;
+
var Actions: TActions;
ticks, maxticks, steps: Longword;
@@ -173,8 +186,8 @@
AddAction(Actions, aia_WaitX, round(Me.X), 0);
AddAction(Actions, Me.Message, aim_release, 0);
steps:= 0;
-
- while true do
+
+ while (not StopThinking) and (not PosInThinkStack(Me)) do
begin
CanGo:= HHGo(Me, @AltMe, GoInfo);
inc(ticks, GoInfo.Ticks);
@@ -205,7 +218,6 @@
and ((steps mod 4) = 0) then TestAmmos(Actions, Me);
if GoInfo.FallPix >= FallPixForBranching then
Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
- if StopThinking then exit
end;
if BestRate > BaseRate then exit
@@ -226,7 +238,7 @@
if Targets.Count > 0 then
begin
Walk(@WalkMe);
- if (StartTicks > GameTicks - 1500) then SDL_Delay(2000);
+ if (StartTicks > GameTicks - 1500) and not StopThinking then SDL_Delay(2000);
end else
else begin
Walk(@WalkMe);
--- a/hedgewars/uAIAmmoTests.pas Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/uAIAmmoTests.pas Sun Jul 23 21:22:44 2006 +0000
@@ -40,6 +40,7 @@
function TestShotgun(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
function TestDesertEagle(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
function TestBaseballBat(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
+function TestFirePunch(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
type TAmmoTestProc = function (Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
const AmmoTests: array[TAmmoType] of TAmmoTestProc =
@@ -55,7 +56,8 @@
{amMine} nil,
{amDEagle} TestDesertEagle,
{amDynamite} nil,
-{amBaseballBat} TestBaseballBat
+{amBaseballBat} TestBaseballBat,
+{amFirePunch} TestFirePunch
);
implementation
@@ -96,11 +98,11 @@
begin
Time:= 0;
-rTime:= 10;
+rTime:= 50;
ExplR:= 0;
Result:= BadTurn;
repeat
- rTime:= rTime + 100 + random*250;
+ rTime:= rTime + 150 + random*250;
Vx:= - cWindSpeed * rTime / 2 + (Targ.X - Me.X) / rTime;
Vy:= cGravity * rTime / 2 - (Targ.Y - Me.Y) / rTime;
r:= sqr(Vx) + sqr(Vy);
@@ -118,7 +120,7 @@
Result:= Score
end;
end
-until (rTime >= 5000)
+until (rTime >= 4500)
end;
function TestGrenade(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
@@ -246,4 +248,21 @@
Result:= RateShove(Me, round(Me.X) + 10 * Sign(Targ.X - Me.X), round(Me.Y), 15, 30)
end;
+function TestFirePunch(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
+var i: integer;
+begin
+ExplR:= 0;
+if (abs(Me.X - Targ.X) > 25) or (abs(Me.Y - 50 - Targ.Y) > 50) then
+ begin
+ Result:= BadTurn;
+ exit
+ end;
+Time:= 0;
+Power:= 1;
+Angle:= DxDy2AttackAngle(Sign(Targ.X - Me.X), 1);
+Result:= 0;
+for i:= 0 to 4 do
+ Result:= Result + RateShove(Me, round(Me.X) + 10 * Sign(Targ.X - Me.X), round(Me.Y) - 20 * i - 5, 10, 30)
+end;
+
end.
--- a/hedgewars/uAIMisc.pas Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/uAIMisc.pas Sun Jul 23 21:22:44 2006 +0000
@@ -269,7 +269,7 @@
Gear.dY:= -0.15;
Gear.dX:= Sign(Gear.dX) * 0.15;
Gear.State:= Gear.State or gstFalling or gstHHJumping
- end
+ end else exit
end
end;
@@ -334,7 +334,7 @@
if Gear.dY > 0.40 then
begin
Goinfo.FallPix:= 0;
- HHJump(AltGear, jmpLJump, GoInfo);
+ HHJump(AltGear, jmpLJump, GoInfo); // try ljump enstead of fall with damage
exit
end;
Gear.Y:= Gear.Y + Gear.dY;
@@ -345,7 +345,7 @@
Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
Gear.dY:= 0;
Result:= true;
- HHJump(AltGear, jmpLJump, GoInfo);
+ HHJump(AltGear, jmpLJump, GoInfo); // try ljump instead of fall
exit
end;
continue
--- a/hedgewars/uConsts.pas Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/uConsts.pas Sun Jul 23 21:22:44 2006 +0000
@@ -51,12 +51,14 @@
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite,
- gtTeamHealthSorter, gtClusterBomb, gtCluster, gtShover, gtFlame);
+ gtTeamHealthSorter, gtClusterBomb, gtCluster, gtShover, gtFlame,
+ gtFirePunch);
TGearsType = set of TGearType;
TSound = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick);
- TAmmoType = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope,
- amMine, amDEagle, amDynamite, amBaseballBat);
+ TAmmoType = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
+ amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch,
+ amBaseballBat);
THWFont = (fnt16, fntBig);
THHFont = record
Handle: PTTF_Font;
@@ -366,6 +368,14 @@
AmmoType: amDynamite);
Slot: 4;
TimeAfterTurn: 5000),
+ (NameId: sidFirePunch;
+ Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_ForwMsgs or ammoprop_AttackInJump or ammoprop_AttackInFall;
+ Count: AMMO_INFINITE;
+ NumPerTurn: 0;
+ Timer: 0;
+ AmmoType: amFirePunch);
+ Slot: 3;
+ TimeAfterTurn: 3000),
(NameId: sidBaseballBat;
Ammo: (Propz: 0;
Count: 1;
--- a/hedgewars/uGears.pas Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/uGears.pas Sun Jul 23 21:22:44 2006 +0000
@@ -122,7 +122,8 @@
doStepBomb,
doStepCluster,
doStepShover,
- doStepFlame
+ doStepFlame,
+ doStepFirePunch
);
function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
@@ -231,6 +232,10 @@
Result.dY:= (getrandom - 0.8) * 0.03;
Result.dX:= (getrandom - 0.5) * 0.4
end;
+ gtFirePunch: begin
+ Result.Radius:= 15;
+ Result.Tag:= Y
+ end;
end;
if GearsList = nil then GearsList:= Result
else begin
@@ -257,8 +262,7 @@
PHedgehog(Gear.Hedgehog).Gear:= nil;
RecountTeamHealth(team);
end;
-if CurAmmoGear = Gear then
- CurAmmoGear:= nil;
+if CurAmmoGear = Gear then CurAmmoGear:= nil;
if FollowGear = Gear then FollowGear:= nil;
{$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF}
if Gear.NextGear <> nil then Gear.NextGear.PrevGear:= Gear.PrevGear;
@@ -621,14 +625,20 @@
end;
procedure AssignHHCoords;
-var Gear: PGear;
+var Team: PTeam;
+ i, t: integer;
begin
-Gear:= GearsList;
-while Gear <> nil do
+Team:= TeamsList;
+t:= 0;
+while Team <> nil do
begin
- if Gear.Kind = gtHedgehog then
- FindPlace(Gear, false, 0, 2048);
- Gear:= Gear.NextGear
+ for i:= 0 to cMaxHHIndex do
+ with Team.Hedgehogs[i] do
+ if Gear <> nil then
+ if (GameFlags and gfForts) = 0 then FindPlace(Gear, false, 0, 2048)
+ else FindPlace(Gear, false, t, t + 1024);
+ inc(t, 1024);
+ Team:= Team.Next
end
end;
--- a/hedgewars/uLocale.pas Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/uLocale.pas Sun Jul 23 21:22:44 2006 +0000
@@ -35,7 +35,7 @@
interface
type TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidUFO, sidShotgun,
sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
- sidDynamite, sidBaseballBat);
+ sidDynamite, sidBaseballBat, sidFirePunch);
TMsgStrId = (sidStartFight, sidSeconds);
var trammo: array[TAmmoStrId] of shortstring;
trmsg: array[TMsgStrId] of shortstring;
--- a/hedgewars/uWorld.pas Fri Jul 21 20:37:44 2006 +0000
+++ b/hedgewars/uWorld.pas Sun Jul 23 21:22:44 2006 +0000
@@ -84,11 +84,11 @@
team: PTeam;
tdx, tdy: real;
- procedure DrawRepeated(spr: TSprite);
+ procedure DrawRepeated(spr: TSprite; Shift: integer);
var i, w: integer;
begin
w:= SpritesData[spr].Width;
- i:= WorldDx mod w;
+ i:= Shift mod w;
if i > 0 then dec(i, w);
repeat
DrawSprite(spr, i, WorldDy + 1024 - SpritesData[spr].Height, 0, Surface);
@@ -109,8 +109,8 @@
SDL_FillRect(Surface, @r, cSkyColor)
end;
// background
-DrawRepeated(sprSky);
-DrawRepeated(sprHorizont);
+DrawRepeated(sprSky, WorldDx * 3 div 8);
+DrawRepeated(sprHorizont, WorldDx * 3 div 5);
// Waves
{$WARNINGS OFF}