Engine:
authorsmaxx
Fri, 30 Jul 2010 19:56:28 +0200
changeset 3691 34fe2149f75d
parent 3689 e2be39ee19f0 (diff)
parent 3688 fd8c22a358de (current diff)
child 3693 09892cdb8f95
Engine: * Added/merged support for anaglyph (red/cyan) rendering (might not be supported by very old cards; don't use it if you've got low fps anyway) Frontend: * Added a checkbox to options to enable anaglyph rendering
QTfrontend/game.cpp
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/pages.cpp
QTfrontend/pages.h
hedgewars/adler32.pas
hedgewars/hwengine.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
hedgewars/uWorld.pas
misc/libopenalbridge/openalbridge_t.h
--- a/QTfrontend/game.cpp	Fri Jul 30 13:36:03 2010 +0200
+++ b/QTfrontend/game.cpp	Fri Jul 30 19:56:28 2010 +0200
@@ -292,6 +292,7 @@
     arguments << config->netNick().toUtf8().toBase64();
     arguments << (config->isMusicEnabled() ? "1" : "0");
     arguments << (config->isReducedQuality() ? "1" : "0");
+    arguments << (config->isStereoEnabled() ? "1" : "0");
     return arguments;
 }
 
--- a/QTfrontend/gameuiconfig.cpp	Fri Jul 30 13:36:03 2010 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Fri Jul 30 19:56:28 2010 +0200
@@ -48,6 +48,7 @@
     Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr);
 
     Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool());
+    Form->ui.pageOptions->CBEnableStereo->setChecked(value("video/anaglyph", false).toBool());
     Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
     Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
     Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool());
@@ -116,6 +117,7 @@
     setValue("video/fullscreen", vid_Fullscreen());
 
     setValue("video/reducequality", isReducedQuality());
+    setValue("video/anaglyph", isStereoEnabled());
 
     setValue("frontend/effects", isFrontendEffects());
 
@@ -236,6 +238,11 @@
     return Form->ui.pageOptions->CBAltDamage->isChecked();
 }
 
+bool GameUIConfig::isStereoEnabled() const
+{
+    return Form->ui.pageOptions->CBEnableStereo->isChecked();
+}
+
 bool GameUIConfig::appendDateTimeToRecordName()
 {
     return Form->ui.pageOptions->CBNameWithDate->isChecked();
--- a/QTfrontend/gameuiconfig.h	Fri Jul 30 13:36:03 2010 +0200
+++ b/QTfrontend/gameuiconfig.h	Fri Jul 30 19:56:28 2010 +0200
@@ -55,6 +55,7 @@
     bool isFrontendFullscreen() const;
     bool isWeaponTooltip() const;
     void resizeToConfigValues();
+    bool isStereoEnabled() const;
 
 #ifdef __APPLE__
 #ifdef SPARKLE_ENABLED
--- a/QTfrontend/pages.cpp	Fri Jul 30 13:36:03 2010 +0200
+++ b/QTfrontend/pages.cpp	Fri Jul 30 19:56:28 2010 +0200
@@ -612,6 +612,10 @@
             CBReduceQuality->setText(QCheckBox::tr("Reduced quality"));
             GBAlayout->addWidget(CBReduceQuality);
 
+            CBEnableStereo = new QCheckBox(AGGroupBox);
+            CBEnableStereo->setText(QCheckBox::tr("Anaglyph rendering (red/cyan)"));
+            GBAlayout->addWidget(CBEnableStereo);
+
             hr = new QFrame(AGGroupBox);
             hr->setFrameStyle(QFrame::HLine);
             hr->setLineWidth(3);
--- a/QTfrontend/pages.h	Fri Jul 30 13:36:03 2010 +0200
+++ b/QTfrontend/pages.h	Fri Jul 30 19:56:28 2010 +0200
@@ -221,6 +221,7 @@
     QComboBox *CBResolution;
     QCheckBox *CBEnableSound;
     QCheckBox *CBEnableFrontendSound;
+    QCheckBox *CBEnableStereo;
 #ifdef _WIN32
     QCheckBox *CBHardwareSound;
 #endif
--- a/hedgewars/VGSHandlers.inc	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/VGSHandlers.inc	Fri Jul 30 19:56:28 2010 +0200
@@ -543,3 +543,19 @@
 Gear^.doStep:= @doStepBigExplosionWork;
 if Steps > 1 then Gear^.doStep(Gear, Steps-1);
 end;
+
+procedure doStepChunk(Gear: PVisualGear; Steps: Longword);
+begin
+Gear^.X:= Gear^.X + Gear^.dX * Steps;
+
+Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
+Gear^.dY:= Gear^.dY + cGravityf * Steps;
+
+Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
+
+if round(Gear^.Y) > cWaterLine then
+    begin
+    DeleteVisualGear(Gear);
+    AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtDroplet);
+    end
+end;
--- a/hedgewars/adler32.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/adler32.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -1,152 +1,152 @@
-unit Adler32;
-
-{ZLib - Adler32 checksum function}
-
-
-interface
-
-(*************************************************************************
-
- DESCRIPTION     :  ZLib - Adler32 checksum function
-
- REQUIREMENTS    :  TP5-7, D1-D7/D9-D10/D12, FPC, VP
-
- EXTERNAL DATA   :  ---
-
- MEMORY USAGE    :  ---
-
- DISPLAY MODE    :  ---
-
- REFERENCES      :  RFC 1950 (http://tools.ietf.org/html/rfc1950)
-
-
- Version  Date      Author      Modification
- -------  --------  -------     ------------------------------------------
- 0.10     30.08.03  W.Ehrhardt  Initial version based on MD5 layout
- 2.10     30.08.03  we          Common vers., XL versions for Win32
- 2.20     27.09.03  we          FPC/go32v2
- 2.30     05.10.03  we          STD.INC, TP5.0
- 2.40     10.10.03  we          common version, english comments
- 3.00     01.12.03  we          Common version 3.0
- 3.01     22.05.05  we          Adler32UpdateXL (i,n: integer)
- 3.02     17.12.05  we          Force $I- in Adler32File
- 3.03     07.08.06  we          $ifdef BIT32: (const fname: shortstring...)
- 3.04     10.02.07  we          Adler32File: no eof, XL and filemode via $ifdef
- 3.05     04.07.07  we          BASM16: speed-up factor 15
- 3.06     12.11.08  we          uses BTypes, Ptr2Inc and/or Str255
- 3.07     25.04.09  we          updated RFC URL(s)
- 3.08     19.07.09  we          D12 fix: assign with typecast string(fname)
-**************************************************************************)
-
-(*-------------------------------------------------------------------------
- (C) Copyright 2002-2009 Wolfgang Ehrhardt
-
- This software is provided 'as-is', without any express or implied warranty.
- In no event will the authors be held liable for any damages arising from
- the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
-    claim that you wrote the original software. If you use this software in
-    a product, an acknowledgment in the product documentation would be
-    appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
-    misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source distribution.
-----------------------------------------------------------------------------*)
-
-(*
-As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need.
-That means no btypes, file loading, and the assembly version disabled.
-*)
-
-procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
-
-implementation
-
-(*
-$ifdef BASM16
-
-procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
-  //-update Adler32 with Msg data
-const
-  BASE = 65521; // max. prime < 65536 
-  NMAX =  5552; // max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^32
-type
-  LH    = packed record
-            L,H: word;
-          end;
-var
-  s1,s2: longint;
-  n: integer;
-begin
-  s1 := LH(adler).L;
-  s2 := LH(adler).H;
-  while Len > 0 do begin
-    if Len<NMAX then n := Len else n := NMAX;
-    //BASM increases speed from about 52 cyc/byte to about 3.7 cyc/byte
-    asm
-                    mov  cx,[n]
-            db $66; mov  ax,word ptr [s1]
-            db $66; mov  di,word ptr [s2]
-                    les  si,[msg]
-      @@1:  db $66, $26, $0f, $b6, $1c      // movzx ebx,es:[si]
-                    inc  si
-            db $66; add  ax,bx              // inc(s1, pByte(Msg)^)
-            db $66; add  di,ax              // inc(s2, s1
-                    dec  cx
-                    jnz  @@1
-            db $66; sub  cx,cx
-                    mov  cx,BASE
-            db $66; sub  dx,dx
-            db $66; div  cx
-            db $66; mov  word ptr [s1],dx   // s1 := s1 mod BASE
-            db $66; sub  dx,dx
-            db $66; mov  ax,di
-            db $66; div  cx
-            db $66; mov  word ptr [s2],dx   // s2 := s2 mod BASE
-                    mov  word ptr [msg],si  // save offset for next chunk
-    end;
-    dec(len, n);
-  end;
-  LH(adler).L := word(s1);
-  LH(adler).H := word(s2);
-end;
-*)
-
-procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
-  {-update Adler32 with Msg data}
-const
-  BASE = 65521; {max. prime < 65536 }
-  NMAX =  3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31}
-type
-  LH    = packed record
-            L,H: word;
-          end;
-var
-  s1,s2: longint;
-  i,n: integer;
-begin
-  s1 := LH(adler).L;
-  s2 := LH(adler).H;
-  while Len > 0 do begin
-    if Len<NMAX then n := Len else n := NMAX;
-    for i:=1 to n do begin
-      inc(s1, pByte(Msg)^);
-      inc(Msg);
-      inc(s2, s1);
-    end;
-    s1 := s1 mod BASE;
-    s2 := s2 mod BASE;
-    dec(len, n);
-  end;
-  LH(adler).L := word(s1);
-  LH(adler).H := word(s2);
-end;
-
-end.
+unit Adler32;
+
+{ZLib - Adler32 checksum function}
+
+
+interface
+
+(*************************************************************************
+
+ DESCRIPTION     :  ZLib - Adler32 checksum function
+
+ REQUIREMENTS    :  TP5-7, D1-D7/D9-D10/D12, FPC, VP
+
+ EXTERNAL DATA   :  ---
+
+ MEMORY USAGE    :  ---
+
+ DISPLAY MODE    :  ---
+
+ REFERENCES      :  RFC 1950 (http://tools.ietf.org/html/rfc1950)
+
+
+ Version  Date      Author      Modification
+ -------  --------  -------     ------------------------------------------
+ 0.10     30.08.03  W.Ehrhardt  Initial version based on MD5 layout
+ 2.10     30.08.03  we          Common vers., XL versions for Win32
+ 2.20     27.09.03  we          FPC/go32v2
+ 2.30     05.10.03  we          STD.INC, TP5.0
+ 2.40     10.10.03  we          common version, english comments
+ 3.00     01.12.03  we          Common version 3.0
+ 3.01     22.05.05  we          Adler32UpdateXL (i,n: integer)
+ 3.02     17.12.05  we          Force $I- in Adler32File
+ 3.03     07.08.06  we          $ifdef BIT32: (const fname: shortstring...)
+ 3.04     10.02.07  we          Adler32File: no eof, XL and filemode via $ifdef
+ 3.05     04.07.07  we          BASM16: speed-up factor 15
+ 3.06     12.11.08  we          uses BTypes, Ptr2Inc and/or Str255
+ 3.07     25.04.09  we          updated RFC URL(s)
+ 3.08     19.07.09  we          D12 fix: assign with typecast string(fname)
+**************************************************************************)
+
+(*-------------------------------------------------------------------------
+ (C) Copyright 2002-2009 Wolfgang Ehrhardt
+
+ This software is provided 'as-is', without any express or implied warranty.
+ In no event will the authors be held liable for any damages arising from
+ the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+    claim that you wrote the original software. If you use this software in
+    a product, an acknowledgment in the product documentation would be
+    appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+    misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source distribution.
+----------------------------------------------------------------------------*)
+
+(*
+As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need.
+That means no btypes, file loading, and the assembly version disabled.
+*)
+
+procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
+
+implementation
+
+(*
+$ifdef BASM16
+
+procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
+  //-update Adler32 with Msg data
+const
+  BASE = 65521; // max. prime < 65536 
+  NMAX =  5552; // max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^32
+type
+  LH    = packed record
+            L,H: word;
+          end;
+var
+  s1,s2: longint;
+  n: integer;
+begin
+  s1 := LH(adler).L;
+  s2 := LH(adler).H;
+  while Len > 0 do begin
+    if Len<NMAX then n := Len else n := NMAX;
+    //BASM increases speed from about 52 cyc/byte to about 3.7 cyc/byte
+    asm
+                    mov  cx,[n]
+            db $66; mov  ax,word ptr [s1]
+            db $66; mov  di,word ptr [s2]
+                    les  si,[msg]
+      @@1:  db $66, $26, $0f, $b6, $1c      // movzx ebx,es:[si]
+                    inc  si
+            db $66; add  ax,bx              // inc(s1, pByte(Msg)^)
+            db $66; add  di,ax              // inc(s2, s1
+                    dec  cx
+                    jnz  @@1
+            db $66; sub  cx,cx
+                    mov  cx,BASE
+            db $66; sub  dx,dx
+            db $66; div  cx
+            db $66; mov  word ptr [s1],dx   // s1 := s1 mod BASE
+            db $66; sub  dx,dx
+            db $66; mov  ax,di
+            db $66; div  cx
+            db $66; mov  word ptr [s2],dx   // s2 := s2 mod BASE
+                    mov  word ptr [msg],si  // save offset for next chunk
+    end;
+    dec(len, n);
+  end;
+  LH(adler).L := word(s1);
+  LH(adler).H := word(s2);
+end;
+*)
+
+procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
+  {-update Adler32 with Msg data}
+const
+  BASE = 65521; {max. prime < 65536 }
+  NMAX =  3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31}
+type
+  LH    = packed record
+            L,H: word;
+          end;
+var
+  s1,s2: longint;
+  i,n: integer;
+begin
+  s1 := LH(adler).L;
+  s2 := LH(adler).H;
+  while Len > 0 do begin
+    if Len<NMAX then n := Len else n := NMAX;
+    for i:=1 to n do begin
+      inc(s1, pByte(Msg)^);
+      inc(Msg);
+      inc(s2, s1);
+    end;
+    s1 := s1 mod BASE;
+    s2 := s2 mod BASE;
+    dec(len, n);
+  end;
+  LH(adler).L := word(s1);
+  LH(adler).H := word(s2);
+end;
+
+end.
--- a/hedgewars/hwengine.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/hwengine.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -230,9 +230,11 @@
     recordFileName:= gameArgs[8];
     
     val(gameArgs[9], cReducedQuality);
+    isStereoEnabled:= false; // TODO: Enable anaglyph rendering on iPhone?
 {$ENDIF}
 
     initEverything(true);
+
     WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
 {$IFDEF DEBUGFILE}
     AddFileLog('Prefix: "' + PathPrefix +'"');
@@ -437,7 +439,7 @@
 procedure GetParams;
 begin
     case ParamCount of
-        18: begin
+        19: begin
             val(ParamStr(2), cScreenWidth);
             val(ParamStr(3), cScreenHeight);
             cBitsStr:= ParamStr(4);
@@ -455,6 +457,7 @@
             cAltDamage:= ParamStr(15) = '1';
             UserNick:= DecodeBase64(ParamStr(16));
             isMusicEnabled:= ParamStr(17) = '1';
+            isStereoEnabled:= ParamStr(19) = '1';
 
             if (ParamStr(18) = '1') then        //HACK - always disable rqLowRes as it's a game breaker
                 cReducedQuality:= $FFFFFFFF xor rqLowRes
--- a/hedgewars/uConsts.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/uConsts.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -73,7 +73,7 @@
             sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp,
             sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, 
             sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal,
-            sprCheese, sprHandCheese, sprHandFlamethrower
+            sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk
             );
     
     // Gears that interact with other Gears and/or Land
@@ -94,7 +94,7 @@
             vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell,
             vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg,
             vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion,
-            vgtBigExplosion);
+            vgtBigExplosion, vgtChunk);
 
     TGearsType = set of TGearType;
 
@@ -797,7 +797,9 @@
             (FileName:  'amCheese'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
             Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCheese
             (FileName:  'amFlamethrower'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprHandFlamethrower
+            Width:  128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandFlamethrower
+            (FileName:  'Chunk'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
+            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprChunk
             );
 
     Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/uGears.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -1177,6 +1177,7 @@
     dmg, dmgRadius, dmgBase: LongInt;
     fX, fY: hwFloat;
     vg: PVisualGear;
+    i, cnt: LongInt;
 begin
 TargetPoint.X:= NoPointX;
 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
@@ -1261,7 +1262,13 @@
     end;
 
 if (Mask and EXPLDontDraw) = 0 then
-    if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius);
+    if (GameFlags and gfSolidLand) = 0 then
+        begin
+        cnt:= DrawExplosion(X, Y, Radius) div 1608; // approx 2 16x16 circles to erase per chunk
+        if cnt > 0 then
+            for i:= 0 to cnt do
+                AddVisualGear(X, Y, vgtChunk)
+        end;
 
 uAIMisc.AwareOfExplosion(0, 0, 0)
 end;
--- a/hedgewars/uLandGraphics.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/uLandGraphics.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -30,7 +30,7 @@
 function  SweepDirty: boolean;
 function  Despeckle(X, Y: LongInt): boolean;
 function  CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean;
-procedure DrawExplosion(X, Y, Radius: LongInt);
+function DrawExplosion(X, Y, Radius: LongInt): Longword;
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
@@ -181,17 +181,22 @@
 
 end;
 
-procedure FillLandCircleLinesBG(x, y, dx, dy: LongInt);
+function FillLandCircleLinesBG(x, y, dx, dy: LongInt): Longword;
 var i, t: LongInt;
+    cnt: Longword;
 begin
+cnt:= 0;
 t:= y + dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
        if ((Land[t, i] and lfBasic) <> 0) then
+           begin
+           inc(cnt);
            if (cReducedQuality and rqBlurryLand) = 0 then
                LandPixels[t, i]:= LandBackPixel(i, t)
            else
                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           end
        else
            if ((Land[t, i] and lfObject) <> 0) then
                if (cReducedQuality and rqBlurryLand) = 0 then
@@ -203,10 +208,13 @@
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
        if ((Land[t, i] and lfBasic) <> 0) then
+           begin
+           inc(cnt);
            if (cReducedQuality and rqBlurryLand) = 0 then
                LandPixels[t, i]:= LandBackPixel(i, t)
            else
                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           end
        else
            if ((Land[t, i] and lfObject) <> 0) then
                if (cReducedQuality and rqBlurryLand) = 0 then
@@ -218,10 +226,13 @@
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
        if ((Land[t, i] and lfBasic) <> 0) then
+           begin
+           inc(cnt);
            if (cReducedQuality and rqBlurryLand) = 0 then
            LandPixels[t, i]:= LandBackPixel(i, t)
             else 
            LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           end
        else
             if ((Land[t, i] and lfObject) <> 0) then
             if (cReducedQuality and rqBlurryLand) = 0 then
@@ -233,18 +244,20 @@
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
        if ((Land[t, i] and lfBasic) <> 0) then
-            if (cReducedQuality and rqBlurryLand) = 0 then
-          LandPixels[t, i]:= LandBackPixel(i, t)
-        else 
-         LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
-
+           begin
+           inc(cnt);
+           if (cReducedQuality and rqBlurryLand) = 0 then
+               LandPixels[t, i]:= LandBackPixel(i, t)
+           else 
+               LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           end
        else
           if ((Land[t, i] and lfObject) <> 0) then
               if (cReducedQuality and rqBlurryLand) = 0 then
                 LandPixels[t, i]:= 0
               else
                 LandPixels[t div 2, i div 2]:= 0;
-
+FillLandCircleLinesBG:= cnt;
 end;
 
 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
@@ -310,19 +323,21 @@
           end;
 end;
 
-procedure DrawExplosion(X, Y, Radius: LongInt);
+function DrawExplosion(X, Y, Radius: LongInt): Longword;
 var dx, dy, ty, tx, d: LongInt;
+    cnt: Longword;
 begin
 
 // draw background land texture
     begin
+    cnt:= 0;
     dx:= 0;
     dy:= Radius;
     d:= 3 - 2 * Radius;
 
     while (dx < dy) do
         begin
-        FillLandCircleLinesBG(x, y, dx, dy);
+        inc(cnt, FillLandCircleLinesBG(x, y, dx, dy));
         if (d < 0)
         then d:= d + 4 * dx + 6
         else begin
@@ -331,7 +346,7 @@
             end;
         inc(dx)
         end;
-    if (dx = dy) then FillLandCircleLinesBG(x, y, dx, dy);
+    if (dx = dy) then inc(cnt, FillLandCircleLinesBG(x, y, dx, dy));
     end;
 
 // draw a hole in land
@@ -382,7 +397,8 @@
 dx:= min(X + Radius + 1, LAND_WIDTH) - tx;
 ty:= max(Y - Radius - 1, 0);
 dy:= min(Y + Radius + 1, LAND_HEIGHT) - ty;
-UpdateLandTexture(tx, dx, ty, dy)
+UpdateLandTexture(tx, dx, ty, dy);
+DrawExplosion:= cnt
 end;
 
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
--- a/hedgewars/uMisc.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/uMisc.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -35,7 +35,7 @@
     isSpeed         : boolean;
     isFirstFrame    : boolean;
 
-    isStereoEnabled : boolean = true;
+    isStereoEnabled : boolean;
 
     fastUntilLag    : boolean;
 
@@ -759,7 +759,7 @@
     Rewrite(f);
 {$ELSE}
     if (ParamStr(1) <> '') and (ParamStr(2) <> '') then
-        if (ParamCount <> 3) and (ParamCount <> 18) then
+        if (ParamCount <> 3) and (ParamCount <> 19) then
         begin
             for i:= 0 to 7 do
             begin
@@ -784,7 +784,6 @@
 {$ENDIF}
 {$I+}
 {$ENDIF}
-
 end;
 
 procedure freeModule;
--- a/hedgewars/uStore.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/uStore.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -358,8 +358,9 @@
     if TeamsArray[t] <> nil then
         with TeamsArray[t]^ do
             begin
-            if GraveName = '' then GraveName:= 'Simple';
-            texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifCritical or ifTransparent);
+            if GraveName = '' then GraveName:= 'Statue';
+            texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifTransparent);
+            if texsurf = nil then texsurf:= LoadImage(Pathz[ptGraves] + '/Statue', ifCritical or ifTransparent);
             GraveTex:= Surface2Tex(texsurf, false);
             SDL_FreeSurface(texsurf)
             end
--- a/hedgewars/uVisualGears.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/uVisualGears.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -115,7 +115,8 @@
             @doStepSmokeTrace,
             @doStepSmokeTrace,
             @doStepExplosion,
-            @doStepBigExplosion
+            @doStepBigExplosion,
+            @doStepChunk
         );
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0): PVisualGear;
@@ -299,6 +300,15 @@
 vgtBigExplosion: begin
                 gear^.Angle:= random(360);
                 end;
+      vgtChunk: begin
+                gear^.Frame:= random(4);
+                t:= random(1024);
+                sp:= 0.001 * (random(85) + 47);
+                dx:= AngleSin(t).QWordValue/4294967296 * sp;
+                dy:= AngleCos(t).QWordValue/4294967296 * sp;
+                if random(2) = 0 then dx := -dx;
+                (*if random(2) = 0 then*) dy := -2 * dy;
+                end;
         end;
 
 if State <> 0 then gear^.State:= State;
@@ -455,6 +465,7 @@
                             Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF));
                             DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
                             end;
+                vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
             end;
         case Gear^.Kind of
             vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
--- a/hedgewars/uWorld.pas	Fri Jul 30 13:36:03 2010 +0200
+++ b/hedgewars/uWorld.pas	Fri Jul 30 19:56:28 2010 +0200
@@ -674,7 +674,9 @@
         DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset);
         ChangeDepth(RM, -cStereo_Horizon);
         DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset);
-    end;
+    end
+    else
+        ChangeDepth(RM, cStereo_Sky - cStereo_Horizon);
 
     DrawVisualGears(0);
     
@@ -690,10 +692,13 @@
         DrawWaves( 1,  75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32);
         ChangeDepth(RM, -cStereo_Water);
         DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24);
-        ResetDepth(RM);
     end
     else
+    begin
+        ChangeDepth(RM, -4 * cStereo_Water);
         DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0);
+    end;
+    ResetDepth(RM);
 
     DrawLand(WorldDx, WorldDy);
 
@@ -744,11 +749,13 @@
         DrawWater(cWaterOpacity, - offsetY div 10);
         ChangeDepth(RM, cStereo_Water);
         DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0);
-        ResetDepth(RM);
     end
     else
+    begin
+        ChangeDepth(RM, cStereo_Water);
         DrawWaves(-1, 50, - (cWaveHeight shr 1), 0);
-
+    end;
+    ResetDepth(RM);
 
 {$WARNINGS OFF}
 // Target
--- a/misc/libopenalbridge/openalbridge_t.h	Fri Jul 30 13:36:03 2010 +0200
+++ b/misc/libopenalbridge/openalbridge_t.h	Fri Jul 30 19:56:28 2010 +0200
@@ -1,74 +1,74 @@
-/*
- * OpenAL Bridge - a simple portable library for OpenAL interface
- * Copyright (c) 2009 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include <stdint.h>
-#include "al.h"
-
-#ifndef _OALB_INTERFACE_TYPES_H
-#define _OALB_INTERFACE_TYPES_H
-
-enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT};
-typedef enum al_fade_enum al_fade_t;
-
-
-// data type to handle which source source is playing what
-#pragma pack(1)
-typedef struct _al_sound_t {
-    const char *filename;       // name of the sound file
-    ALuint buffer;              // actual sound content
-    uint32_t source_index;      // index of the associated source
-    ALboolean is_used;          // tells if the element can be overwritten
-} al_sound_t;
-#pragma pack()
-
-
-// data type for passing data between threads
-#pragma pack(1)
-typedef struct _fade_t {
-    uint32_t index;
-    uint16_t quantity;
-    al_fade_t type;
-} fade_t;
-#pragma pack()
-
-
-// data type for WAV header
-#pragma pack(1)
-typedef struct _WAV_header_t {
-    uint32_t ChunkID;
-    uint32_t ChunkSize;
-    uint32_t Format;
-    uint32_t Subchunk1ID;
-    uint32_t Subchunk1Size;
-    uint16_t AudioFormat;
-    uint16_t NumChannels;
-    uint32_t SampleRate;
-    uint32_t ByteRate;
-    uint16_t BlockAlign;
-    uint16_t BitsPerSample;
-    uint32_t Subchunk2ID;
-    uint32_t Subchunk2Size;
-} WAV_header_t;
-#pragma pack()
-
-
-#ifdef __CPLUSPLUS
-}
-#endif
-
-#endif /*_OALB_INTERFACE_TYPES_H*/
+/*
+ * OpenAL Bridge - a simple portable library for OpenAL interface
+ * Copyright (c) 2009 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <stdint.h>
+#include "al.h"
+
+#ifndef _OALB_INTERFACE_TYPES_H
+#define _OALB_INTERFACE_TYPES_H
+
+enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT};
+typedef enum al_fade_enum al_fade_t;
+
+
+// data type to handle which source source is playing what
+#pragma pack(1)
+typedef struct _al_sound_t {
+    const char *filename;       // name of the sound file
+    ALuint buffer;              // actual sound content
+    uint32_t source_index;      // index of the associated source
+    ALboolean is_used;          // tells if the element can be overwritten
+} al_sound_t;
+#pragma pack()
+
+
+// data type for passing data between threads
+#pragma pack(1)
+typedef struct _fade_t {
+    uint32_t index;
+    uint16_t quantity;
+    al_fade_t type;
+} fade_t;
+#pragma pack()
+
+
+// data type for WAV header
+#pragma pack(1)
+typedef struct _WAV_header_t {
+    uint32_t ChunkID;
+    uint32_t ChunkSize;
+    uint32_t Format;
+    uint32_t Subchunk1ID;
+    uint32_t Subchunk1Size;
+    uint16_t AudioFormat;
+    uint16_t NumChannels;
+    uint32_t SampleRate;
+    uint32_t ByteRate;
+    uint16_t BlockAlign;
+    uint16_t BitsPerSample;
+    uint32_t Subchunk2ID;
+    uint32_t Subchunk2Size;
+} WAV_header_t;
+#pragma pack()
+
+
+#ifdef __CPLUSPLUS
+}
+#endif
+
+#endif /*_OALB_INTERFACE_TYPES_H*/
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/Chunk.png has changed
Binary file share/hedgewars/Data/Themes/Olympics/Chunk.png has changed