--- a/hedgewars/GSHandlers.inc Sat May 01 17:29:48 2010 +0000
+++ b/hedgewars/GSHandlers.inc Sat May 01 18:44:25 2010 +0000
@@ -3052,9 +3052,6 @@
3) At end of turn, all gtPortal will be deleted.
*)
-end;
-procedure doStepPortalGun(Gear: PGear);
-begin
(*
Ok. Here's where I plan to go with this.
1) Restrict portal gun to X shots.
@@ -3063,6 +3060,35 @@
*)
end;
+procedure doStepMovingPortal(Gear: PGear);
+var i, x, y: LongWord;
+ oX, oY: hwFloat;
+begin
+oX:= Gear^.X;
+oY:= Gear^.Y;
+Gear^.X:= Gear^.X + Gear^.dX;
+Gear^.Y:= Gear^.Y + Gear^.dY;
+x:= hwRound(Gear^.X);
+y:= hwRound(Gear^.Y);
+(*
+Potential issue, portals embedded in land?
+Also, will need checks on how well portal is placed
+Thought is possibly doing it based on midpoint and two ends, so a bit of rough terrain is still permitted, but not curves.
+*)
+if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then
+ begin
+ inc(Gear^.Tag);
+ Gear^.doStep:= @doStepPortal;
+ AfterAttack
+ end
+// How laser checks for infinite
+else if (y > LAND_HEIGHT + LAND_WIDTH div 4) or (y < - LAND_WIDTH div 4) or (x > LAND_WIDTH + LAND_WIDTH div 4) or (x < - LAND_WIDTH div 4) then
+ begin
+ DeleteGear(Gear);
+ AfterAttack
+ end;
+end;
+
procedure doStepPiano(Gear: PGear);
var r0, r1: LongInt;
begin
--- a/hedgewars/HHHandlers.inc Sat May 01 17:29:48 2010 +0000
+++ b/hedgewars/HHHandlers.inc Sat May 01 18:44:25 2010 +0000
@@ -156,6 +156,13 @@
amMine: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
amDEagle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
amSineGun: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
+(*
+Ok. Here's where I plan to go with this.
+1) Restrict portal gun to X shots.
+2) If on first shot, delete all existing gtPortal
+3) On any other shot, delete any existing portals of type X%2, and spawn a new portal of type X%2 oriented at angle 180° from the portal gun. It might possibly be worth linking portals with a Gear reference, to save time on scanning through the Gear list every time we need a portal.
+*)
+ amPortalGun: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtPortal, 0, xx * _0_3, yy * _0_3, 0);
amSniperRifle: begin
PlaySound(sndSniperReload);
CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
--- a/hedgewars/uConsts.pas Sat May 01 17:29:48 2010 +0000
+++ b/hedgewars/uConsts.pas Sat May 01 18:44:25 2010 +0000
@@ -746,7 +746,7 @@
Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprHandSineGun
(FileName: 'amPortalGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprPortalGun
- (FileName: 'amPortal'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+ (FileName: 'Portal'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false) // sprPortal
);
--- a/hedgewars/uGears.pas Sat May 01 17:29:48 2010 +0000
+++ b/hedgewars/uGears.pas Sat May 01 18:44:25 2010 +0000
@@ -183,7 +183,7 @@
@doStepBirdy,
@doStepBigExplosion,
@doStepEggWork,
- @doStepPortal,
+ @doStepMovingPortal,
@doStepPiano,
@doStepBomb,
@doStepSineGunShot
@@ -478,6 +478,7 @@
gear^.nImpactSounds:= 1;
gear^.AdvBounce:= 0;
gear^.Radius:= 16;
+ gear^.Tag:= 0;
end;
gtPiano: begin
gear^.Radius:= 32
Binary file share/hedgewars/Data/Graphics/Portal.png has changed