Engine:
authorsmxx
Tue, 18 May 2010 13:09:57 +0000
changeset 3475 95345f98da19
parent 3474 c6d308f5a431
child 3476 1ec68b8d3bd1
Engine: * Modified gas grenade and added graphics to it (better get a nose clip!) * Added the ability to tint visual gears * Added the ability to tint explosion effects * Birdy's eggs now cause a small green explosion
hedgewars/GSHandlers.inc
hedgewars/GearDrawing.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uVisualGears.pas
share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png
share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png
share/hedgewars/Data/Graphics/Hedgehog/amCheese.png
share/hedgewars/Data/Graphics/cheese.png
share/hedgewars/Data/Graphics/cheese.psd
share/hedgewars/Data/Locale/de.txt
share/hedgewars/Data/Locale/en.txt
--- a/hedgewars/GSHandlers.inc	Mon May 17 15:50:48 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Tue May 18 13:09:57 2010 +0000
@@ -282,6 +282,7 @@
     i, x, y: LongInt;
     dX, dY: hwFloat;
     Fire: PGear;
+    vg: PVisualGear;
 begin
     AllInactive := false;
 
@@ -304,6 +305,13 @@
             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLDontDraw or EXPLNoGfx);
     end;
 
+    if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then
+    begin
+        vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
+        if vg <> nil then
+            vg^.Tint:= $FFC0C000;
+    end;
+
     if Gear^.Timer = 0 then
     begin
         case Gear^.Kind of 
@@ -349,7 +357,7 @@
         if i mod 2 <> 0 then Fire^.State := Fire^.State or gsttmpFlag;
     end
 end;
-gtGasBomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound or EXPLPoisoned);
+gtGasBomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound or EXPLPoisoned, $FFFFC000);
 end;
 DeleteGear(Gear);
 exit
@@ -3105,8 +3113,7 @@
 
     if (Gear^.State and gstCollision) <> 0 then
     begin
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLPoisoned or EXPLNoGfx);
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLPoisoned or EXPLNoGfx);
+        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 11, EXPLPoisoned, $C000FFC0);
         PlaySound(sndEggBreak);
         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
         vg := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
--- a/hedgewars/GearDrawing.inc	Mon May 17 15:50:48 2010 +0000
+++ b/hedgewars/GearDrawing.inc	Tue May 18 13:09:57 2010 +0000
@@ -384,6 +384,7 @@
             amClusterBomb: DrawRotated(sprHandCluster, hx, hy, hwSign(Gear^.dX), aangle);
             amDynamite: DrawRotated(sprHandDynamite, hx, hy, hwSign(Gear^.dX), aangle);
             amHellishBomb: DrawRotated(sprHandHellish, hx, hy, hwSign(Gear^.dX), aangle);
+            amGasBomb: DrawRotated(sprHandCheese, hx, hy, hwSign(Gear^.dX), aangle);
             amMine: DrawRotated(sprHandMine, hx, hy, hwSign(Gear^.dX), aangle);
             amSeduction: DrawRotated(sprHandSeduction, hx, hy, hwSign(Gear^.dX), aangle);
             amVampiric: DrawRotated(sprHandVamp, hx, hy, hwSign(Gear^.dX), aangle);
@@ -643,7 +644,7 @@
     begin
     case Gear^.Kind of
        gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
-       gtGasBomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
+       gtGasBomb: DrawRotated(sprCheese, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
     gtMolotov: DrawRotated(sprMolotov, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
 
        gtRCPlane: begin
--- a/hedgewars/uConsts.pas	Mon May 17 15:50:48 2010 +0000
+++ b/hedgewars/uConsts.pas	Tue May 18 13:09:57 2010 +0000
@@ -72,7 +72,8 @@
             sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster,
             sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp,
             sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, 
-            sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal
+            sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal,
+            sprCheese, sprHandCheese
             );
     
     // Gears that interact with other Gears and/or Land
@@ -748,7 +749,11 @@
             (FileName:  'amPortalGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
             Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprPortalGun
             (FileName:  'Portal'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false) // sprPortal
+            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprPortal
+            (FileName:  'cheese'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprCheese
+            (FileName:  'amCheese'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false) // sprHandCheese
             );
 
     Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas	Mon May 17 15:50:48 2010 +0000
+++ b/hedgewars/uGears.pas	Tue May 18 13:09:57 2010 +0000
@@ -113,6 +113,7 @@
  
 procedure DeleteGear(Gear: PGear); forward;
 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward;
+procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward;
 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
 //procedure AmmoFlameWork(Ammo: PGear); forward;
 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
@@ -270,9 +271,9 @@
                 gear^.ImpactSound:= sndGrenadeImpact;
                 gear^.nImpactSounds:= 1;
                 gear^.AdvBounce:= 1;
-                gear^.Radius:= 4;
-                gear^.Elasticity:= _0_6;
-                gear^.Friction:= _0_96;
+                gear^.Radius:= 6;
+                gear^.Elasticity:= _0_8;
+                gear^.Friction:= _0_8;
                 gear^.RenderTimer:= true;
                 if gear^.Timer = 0 then gear^.Timer:= 3000
                 end;
@@ -1139,9 +1140,15 @@
 end;
 
 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord);
+begin
+doMakeExplosion(X, Y, Radius, Mask, $FFFFFFFF);
+end;
+
+procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord);
 var Gear: PGear;
     dmg, dmgRadius, dmgBase: LongInt;
     fX, fY: hwFloat;
+    vg: PVisualGear;
 begin
 TargetPoint.X:= NoPointX;
 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
@@ -1149,8 +1156,11 @@
 
 if ((Mask and EXPLNoGfx) = 0) then
     begin
-    if Radius > 50 then AddVisualGear(X, Y, vgtBigExplosion)
-    else if Radius > 10 then AddVisualGear(X, Y, vgtExplosion);
+    vg:= nil;
+    if Radius > 50 then vg:= AddVisualGear(X, Y, vgtBigExplosion)
+    else if Radius > 10 then vg:= AddVisualGear(X, Y, vgtExplosion);
+    if vg <> nil then
+        vg^.Tint:= Tint;
     end;
 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion);
 
--- a/hedgewars/uVisualGears.pas	Mon May 17 15:50:48 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Tue May 18 13:09:57 2010 +0000
@@ -43,7 +43,8 @@
         Tex: PTexture;
         alpha, scale: GLfloat;
         Hedgehog: pointer;
-        Text: shortstring
+        Text: shortstring;
+        Tint: Longword;
         end;
 
 procedure initModule;
@@ -152,6 +153,7 @@
 gear^.Kind := Kind;
 gear^.doStep:= doStepHandlers[Kind];
 gear^.State:= 0;
+gear^.Tint:= $FFFFFFFF;
 
 with gear^ do
     case Kind of
@@ -380,6 +382,7 @@
 case Layer of
     0: while Gear <> nil do
         begin
+        Tint(Gear^.Tint);
         case Gear^.Kind of
             vgtFlake: if vobVelocity = 0 then
                         DrawSprite(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
@@ -391,6 +394,7 @@
         end;
     1: while Gear <> nil do
         begin
+        Tint(Gear^.Tint);
         case Gear^.Kind of
             vgtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
             vgtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
@@ -404,20 +408,18 @@
                             if Gear^.FrameTicks < 255 then
                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
                             DrawRotatedF(sprFeather, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
-                            if Gear^.FrameTicks < 255 then
-                                Tint($FF, $FF, $FF, $FF);
                             end;
                  end;
         Gear:= Gear^.NextGear
         end;
     2: while Gear <> nil do
         begin
+        Tint(Gear^.Tint);
         case Gear^.Kind of
             vgtExplosion: DrawSprite(sprExplosion50, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 32 + WorldDy, Gear^.State);
             vgtBigExplosion: begin
                              Tint($FF, $FF, $FF, floor($FF * (1 - power(Gear^.Timer / 250, 4))));
                              DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle);
-                             Tint($FF, $FF, $FF, $FF);
                              end;
             end;
         if not cReducedQuality then
@@ -431,7 +433,6 @@
                         Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF));
                         DrawTextureF(ropeIconTex, Gear^.scale, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 32, 32);
                         DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
-                        Tint($FF, $FF, $FF, $FF);
                         end;
                 vgtHealth:  begin
                             case Gear^.Frame div 10 of
@@ -439,21 +440,16 @@
                                 1:Tint($FF, 0, 0, floor(Gear^.FrameTicks * $FF / 1000));
                             end;
                             DrawSprite(sprHealth, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, 0);
-                            Tint($FF, $FF, $FF, $FF);
                             end;
                 vgtShell: begin
                             if Gear^.FrameTicks < $FF then
                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
                             DrawRotatedF(sprShell, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
-                            if Gear^.FrameTicks < $FF then
-                                Tint($FF, $FF, $FF, $FF);
                             end;
                   vgtEgg: begin
                             if Gear^.FrameTicks < $FF then
                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
                             DrawRotatedF(sprEgg, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
-                            if Gear^.FrameTicks < $FF then
-                                Tint($FF, $FF, $FF, $FF);
                             end;
                 vgtSplash: DrawSprite(sprSplash, hwRound(Gear^.X) + WorldDx - 40, hwRound(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
                 vgtDroplet: DrawSprite(sprDroplet, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);
@@ -463,12 +459,10 @@
                             else
                                 Tint($FF, $FF, $FF, $80);
                             DrawRotatedF(sprBeeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, (RealTicks shr 4) mod cMaxAngle);
-                            Tint($FF, $FF, $FF, $FF);
                             end;
                 vgtSmokeRing: begin
                             Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF));
                             DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
-                            Tint($FF, $FF, $FF, $FF);
                             end;
             end;
         case Gear^.Kind of
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png has changed
Binary file share/hedgewars/Data/Graphics/AmmoMenu/Ammos_bw.png has changed
Binary file share/hedgewars/Data/Graphics/Hedgehog/amCheese.png has changed
Binary file share/hedgewars/Data/Graphics/cheese.png has changed
Binary file share/hedgewars/Data/Graphics/cheese.psd has changed
--- a/share/hedgewars/Data/Locale/de.txt	Mon May 17 15:50:48 2010 +0000
+++ b/share/hedgewars/Data/Locale/de.txt	Tue May 18 13:09:57 2010 +0000
@@ -43,6 +43,8 @@
 00:40=Molotov-Cocktail
 00:41=Birdy
 
+00:44=Alter Limburger
+
 01:00=Auf in die Schlacht!
 01:01=Unentschieden
 01:02=%1 gewinnt!
@@ -211,6 +213,7 @@
 03:39=Fortbewegungsmittel
 03:40=Brandbombe
 03:41=Riesiger Squawks-Fan
+03:44=Ziemlich alt und stinkig
 
 ; Weapon Descriptions (use | as line breaks)
 04:00=Greife deine Feinde mit einfachen Granaten an.|Der Zeitzünder steuert den Explosionszeitpunkt.|1-5: Zeitzünder einstellen|Angriff: Halten, um mit mehr Kraft zu werfen
@@ -256,6 +259,8 @@
 04:40=Entzünde einen Teil der Landschaft oder auch etwas|mehr mit dieser (schon bald) brennenden Flüssigkeit.|Angriff: Halten, um mit mehr Kraft zu werfen
 04:41=Der Beweis, dass die Natur sogar die fliegende|Untertasse übertreffen könnte. Birdy kann|deinen Igel herumtragen und zudem Eier auf|deine Feinde fallen lassen.|Angriff: Aktivieren und Eier fallen lassen|Hoch/Links/Rechts: In eine Richtung flattern
 
+04:44=Das ist nicht nur Käse, das ist biologische Kriegsführung!|Er wird nicht viel Schaden verursachen, sobald der Zünder|abgelaufen ist, aber er wird garantiert jeden in der Nähe|vergiften!|1-5: Zeitzünder einstellen|Angriff: Halten, um mit mehr Kraft zu werfen
+
 ; Game goal strings
 05:00=Spielmodifikationen
 05:01=Die folgenden Regeln gelten
--- a/share/hedgewars/Data/Locale/en.txt	Mon May 17 15:50:48 2010 +0000
+++ b/share/hedgewars/Data/Locale/en.txt	Tue May 18 13:09:57 2010 +0000
@@ -44,7 +44,7 @@
 00:41=Birdy
 00:42=Portable Portal Device
 00:43=Piano Strike
-00:44=Gas grenade
+00:44=Old Limburger
 00:45=Sine Gun
 
 01:00=Let's fight!
@@ -420,6 +420,7 @@
 03:42=I'm making a note here...
 ; the misspelled "Beethoven" is intentional (-> to beat)
 03:43=Performing Beathoven's deadly sonata
+03:44=Quite old and very smelly
 
 ; Weapon Descriptions (use | as line breaks)
 04:00=Attack your enemies using a simple grenade.|It will explode once its timer reaches zero.|1-5: Set grenade's timer|Attack: Hold to throw with more power
@@ -466,6 +467,7 @@
 04:41=The evidence nature might even top the flying|saucer. Birdy can carry your hog around and|drop eggs on your enemies!|Attack: Activate and drop eggs|Up/Left/Right: Flap in one direction
 04:42=HUGE SUCCESS| | |(but missing texts!)
 04:43=(missing text)
+04:44=This isn't just cheese, it's biological warfare!|It won't cause an huge amount of damage once|the timer reaches zero but it will definitely|poison anyone unlucky to be nearby!|1-5: Set grenade's timer|Attack: Hold to throw with more power
 
 ; Game goal strings
 05:00=Game Modes