- Pickhammer sound
authorunc0rr
Tue, 28 Nov 2006 17:14:39 +0000
changeset 282 b1e3387389b6
parent 281 5b483aa9f2ab
child 283 28d105f378f1
- Pickhammer sound
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
hedgewars/uSound.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Sounds/pickhammer.ogg
--- a/hedgewars/GSHandlers.inc	Mon Nov 27 17:29:08 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Nov 28 17:14:39 2006 +0000
@@ -361,6 +361,7 @@
 dec(Gear.Timer);
 if (Gear.Timer = 0)or((Gear.Message and gm_Destroy) <> 0)or((HHGear.State and gstHHDriven) = 0) then
    begin
+   StopSound(sndPickhammer);
    DeleteGear(Gear);
    AfterAttack;
    exit
@@ -417,6 +418,7 @@
    end;
 DrawHLinesExplosions(@ar, 3, round(Gear.Y) - cHHRadius*2, 2, Pred(i));
 Gear.dY:= PHedgehog(Gear.Hedgehog).Gear.dY;
+PlaySound(sndPickhammer, true);
 doStepPickHammerWork(Gear);
 Gear.doStep:= doStepPickHammerWork
 end;
--- a/hedgewars/HHHandlers.inc	Mon Nov 27 17:29:08 2006 +0000
+++ b/hedgewars/HHHandlers.inc	Tue Nov 28 17:14:39 2006 +0000
@@ -45,7 +45,7 @@
         
         if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then
            begin
-           StopTPUSound;
+           StopSound(sndThrowPowerUp);
            PlaySound(sndThrowRelease);
            end;
         xx:= hwSign(dX)*Sin(Angle*pi/cMaxAngle);
--- a/hedgewars/uConsts.pas	Mon Nov 27 17:29:08 2006 +0000
+++ b/hedgewars/uConsts.pas	Tue Nov 28 17:14:39 2006 +0000
@@ -23,11 +23,15 @@
 {$INCLUDE proto.inc}
 type TStuff     = (sConsoleBG, sPowerBar, sQuestion, sWindBar,
                    sWindL, sWindR, sRopeNode);
+
      TGameState = (gsLandGen, gsStart, gsGame, gsConsole, gsExit);
+
      TGameType  = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview);
+
      TPathType  = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps,
                    ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts,
                    ptLocale, ptAmmoMenu);
+
      TSprite    = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
                    sprLag, sprArrow, sprGrenade, sprTargetP, sprUFO,
                    sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
@@ -35,26 +39,35 @@
                    sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont,
                    sprSky, sprAMBorders, sprAMSlot, sprAMSlotName, sprAMAmmos,
                    sprAMSlotKeys, sprAMSelection, sprFinger, sprAirBomb);
+
      TGearType  = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
                    gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite,
                    gtTeamHealthSorter, gtClusterBomb, gtCluster, gtShover, gtFlame,
                    gtFirePunch, gtATStartGame, gtATSmoothWindCh, gtATFinishGame,
                    gtParachute, gtAirAttack, gtAirBomb);
+
      TGearsType = set of TGearType;
-     TSound     = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
-                   sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick);
+
+     TSound     = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease,
+                   sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact,
+                   sndMineTick, sndPickhammer);
+
      TAmmoType  = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
                    amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch,
                    amBaseballBat, amParachute, amAirAttack);
+
      THWFont    = (fnt16, fntBig);
+
      TCapGroup  = (capgrpGameState, capgrpAmmoinfo, capgrpNetSay, capgrpVolume);
+
      THHFont    = record
                   Handle: PTTF_Font;
                   Height: integer;
                   style: integer;
                   Name: string[15];
                   end;
+
      TAmmo = record
              Propz: LongWord;
              Count: LongWord;
@@ -256,6 +269,7 @@
                                        FileName: String[31];
                                        Path    : TPathType;
                                        id      : PMixChunk;
+                                       lastChan: LongInt;
                                        end = (
                                        (FileName: 'grenadeimpact.ogg'; Path: ptSounds  ),// sndGrenadeImpact
                                        (FileName:     'explosion.ogg'; Path: ptSounds  ),// sndExplosion
@@ -265,7 +279,8 @@
                                        (FileName: 'shotgunreload.ogg'; Path: ptSounds  ),// sndShotgunReload
                                        (FileName:   'shotgunfire.ogg'; Path: ptSounds  ),// sndShotgunFire
                                        (FileName:   'graveimpact.ogg'; Path: ptSounds  ),// sndGraveImpact
-                                       (FileName:      'minetick.ogg'; Path: ptSounds  ) // sndMineTicks
+                                       (FileName:      'minetick.ogg'; Path: ptSounds  ),// sndMineTicks
+                                       (FileName:    'pickhammer.ogg'; Path: ptSounds  ) // sndPickhammer
                                        );
 
       Ammoz: array [TAmmoType] of record
--- a/hedgewars/uSound.pas	Mon Nov 27 17:29:08 2006 +0000
+++ b/hedgewars/uSound.pas	Tue Nov 28 17:14:39 2006 +0000
@@ -24,9 +24,9 @@
 procedure InitSound;
 procedure ReleaseSound;
 procedure SoundLoad;
-procedure PlaySound(snd: TSound);
+procedure PlaySound(snd: TSound; const infinite: boolean = false);
 procedure PlayMusic;
-procedure StopTPUSound;
+procedure StopSound(snd: TSound);
 function  ChangeVolume(voldelta: integer): integer;
 
 implementation
@@ -82,18 +82,19 @@
 WriteLnToConsole(msgOK)
 end;
 
-procedure PlaySound(snd: TSound);
+procedure PlaySound(snd: TSound; const infinite: boolean = false);
+var loops: integer;
 begin
 if not isSoundEnabled then exit;
-if snd <> sndThrowPowerUp then Mix_PlayChannelTimed(-1, Soundz[snd].id, 0, -1)
-                          else Mix_PlayChannelTimed(chanTPU, Soundz[snd].id, 0, -1)
+if infinite then loops:= -1 else loops:= 0;
+Soundz[snd].lastChan:= Mix_PlayChannelTimed(-1, Soundz[snd].id, loops, -1)
 end;
 
-procedure StopTPUSound;
+procedure StopSound(snd: TSound);
 begin
 if not isSoundEnabled then exit;
-if Mix_Playing(chanTPU) <> 0 then
-   Mix_HaltChannel(chanTPU)
+if Mix_Playing(Soundz[snd].lastChan) <> 0 then
+   Mix_HaltChannel(Soundz[snd].lastChan)
 end;
 
 procedure PlayMusic;
--- a/hedgewars/uWorld.pas	Mon Nov 27 17:29:08 2006 +0000
+++ b/hedgewars/uWorld.pas	Tue Nov 28 17:14:39 2006 +0000
@@ -57,7 +57,7 @@
 procedure InitWorld;
 begin
 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
-cScreenEdgesDist:= Min(cScreenWidth div 4, cScreenHeight div 4);
+cScreenEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50);
 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
 prevPoint.X:= cScreenWidth div 2;
 prevPoint.Y:= cScreenHeight div 2;
Binary file share/hedgewars/Data/Sounds/pickhammer.ogg has changed