Some initial stubs for portal just so Tiy will quit nagging. Also let folks know what approximation of physics I plan to try, here.
authornemo
Thu, 15 Apr 2010 20:46:34 +0000
changeset 3342 b4f01613dcd7
parent 3341 3de60a5986e9
child 3343 6289df7747c0
Some initial stubs for portal just so Tiy will quit nagging. Also let folks know what approximation of physics I plan to try, here.
hedgewars/GSHandlers.inc
hedgewars/uAIAmmoTests.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uLocale.pas
--- a/hedgewars/GSHandlers.inc	Thu Apr 15 14:24:26 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Thu Apr 15 20:46:34 2010 +0000
@@ -3026,3 +3026,25 @@
         exit
     end;
 end;
+
+procedure doStepPortal(Gear: PGear);
+begin
+(*
+A portal will have a few things it does.
+1) At first, it will move through the air until it collides with a surface. Once it does, it will stop.  At this point we might try a check to verify there is enough terrain for it to be spawned against, and delete. Or we could just let it kinda stick out for now.
+
+2) From then on, if doStepPortal is called and a gear of a radius less than or equal to the portal is within X pixels of the portal (we could also check on moving toward the portal I guess, depends how accurate this needs to be) the portal will then locate the first other portal of the opposite type (there should only be one other one), and move that gear's X/Y to that other portal's location, and modify dX/dY to be relative to that other portal's orientation relative to this portal's orientation.  This might require some tweaking with offsets of a few pixels to avoid getting gears stuck in land.
+
+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.
+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.
+*)
+end;
--- a/hedgewars/uAIAmmoTests.pas	Thu Apr 15 14:24:26 2010 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Thu Apr 15 20:46:34 2010 +0000
@@ -89,9 +89,10 @@
             (proc: nil;              flags: 0), // amLaserSight
             (proc: nil;              flags: 0), // amVampiric
             (proc: nil;              flags: 0), // amSniperRifle
-            (proc: nil;              flags: 0),  // amJetpack
+            (proc: nil;              flags: 0), // amJetpack
             (proc: @TestMolotov;     flags: 0), // amMolotov
-			(proc: nil;              flags: 0) // amBirdy
+			(proc: nil;              flags: 0), // amBirdy
+            (proc: nil;              flags: 0)  // amPortalGun
             );
 
 const BadTurn = Low(LongInt) div 4;
--- a/hedgewars/uConsts.pas	Thu Apr 15 14:24:26 2010 +0000
+++ b/hedgewars/uConsts.pas	Thu Apr 15 20:46:34 2010 +0000
@@ -84,7 +84,7 @@
             gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 37
             gtHellishBomb, gtEvilTrace, gtWaterUp, gtDrill, gtBallGun, gtBall,gtRCPlane,
             gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, 
-            gtBigExplosion, gtEgg);
+            gtBigExplosion, gtEgg, gtPortal, gtPortalGun);
 
     TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
             vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
@@ -120,7 +120,7 @@
             amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake,
             amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun,
             amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime,
-            amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy);
+            amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun);
 
     THWFont = (fnt16, fntBig, fntSmall, CJKfnt16, CJKfntBig, CJKfntSmall);
 
@@ -1775,6 +1775,28 @@
             isDamaging: true;
             SkipTurns: 0;
             PosCount: 1;
+            PosSprite: sprWater),
+            (NameId: sidPortalGun;
+            NameTex: nil;
+            Probability: 20;
+            NumberInCase: 1;
+            Ammo: (Propz: ammoprop_NoRoundEndHint or
+                          ammoprop_DontHold or
+                          ammoprop_Utility;
+                Count: 1;
+                InitialCount: 1;
+                NumPerTurn: 3;
+                Timer: 0;
+                Pos: 0;
+                AmmoType: amPortalGun;
+                AttackVoice: sndNone);
+            Slot: 2;
+            TimeAfterTurn: 0;
+            minAngle: 0;
+            maxAngle: 0;
+            isDamaging: true;
+            SkipTurns: 0;
+            PosCount: 1;
             PosSprite: sprWater)
             );
 
--- a/hedgewars/uGears.pas	Thu Apr 15 14:24:26 2010 +0000
+++ b/hedgewars/uGears.pas	Thu Apr 15 20:46:34 2010 +0000
@@ -182,7 +182,9 @@
             @doStepCase,
             @doStepBirdy,
             @doStepBigExplosion,
-            @doStepEggWork
+            @doStepEggWork,
+            @doStepPortal,
+            @doStepPortalGun
             );
 
 procedure InsertGearToList(Gear: PGear);
@@ -468,6 +470,12 @@
                 gear^.Friction:= _0_96;
                 if gear^.Timer = 0 then gear^.Timer:= 3000
                 end;
+      gtPortal: begin
+                gear^.ImpactSound:= sndMelonImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.AdvBounce:= 0;
+                gear^.Radius:= 16;
+                end;
      end;
 InsertGearToList(gear);
 AddGear:= gear;
--- a/hedgewars/uLocale.pas	Thu Apr 15 14:24:26 2010 +0000
+++ b/hedgewars/uLocale.pas	Thu Apr 15 20:46:34 2010 +0000
@@ -28,7 +28,7 @@
             sidKamikaze, sidCake, sidSeduction, sidWatermelon,
             sidHellishBomb, sidDrill, sidBallgun, sidNapalm, sidRCPlane,
             sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime,
-            sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack, sidMolotov, sidBirdy);
+            sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack, sidMolotov, sidBirdy, sidPortalGun);
 
     TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
             sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,