# HG changeset patch # User unc0rr # Date 1126119113 0 # Node ID 7a5db822fd3f224d98a51e433cf4ea647deaf8ff # Parent 366adfa1a727eb5fc51f5065dccdfc4b72a8883d - Show no crosshair when using mine - Fix for ability to play one kind of sound in many channels simultaneously - Sound for activated mine diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Tue Sep 06 19:09:39 2005 +0000 +++ b/hedgewars/CCHandlers.inc Wed Sep 07 18:51:53 2005 +0000 @@ -245,7 +245,7 @@ begin if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then begin - StopSound(sndThrowPowerUp); + StopTPUSound; PlaySound(sndThrowRelease); end; xx:= Sign(dX)*Sin(Angle*pi/cMaxAngle); @@ -261,7 +261,7 @@ amSkip: TurnTimeLeft:= 0; amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHHalfHeight, gtPickHammer, 0); amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy); - amMine: AddGear(round(X) + Sign(dX) + 7, round(Y), gtMine, 0, Sign(dX) * 0.01); + amMine: AddGear(round(X) + Sign(dX) * 7, round(Y), gtMine, 0, Sign(dX) * 0.01, 0, 3000); end; Power:= 0; if CurAmmoGear <> nil then diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/Data/Sounds/minetick.ogg Binary file hedgewars/Data/Sounds/minetick.ogg has changed diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Tue Sep 06 19:09:39 2005 +0000 +++ b/hedgewars/GSHandlers.inc Wed Sep 07 18:51:53 2005 +0000 @@ -576,21 +576,28 @@ if (Gear.dX <> 0) or (Gear.dY <> 0) then begin doStepFallingGear(Gear); + if Gear.Active = false then + begin + Gear.dX:= 0; + Gear.dY:= 0 + end; + CalcRotationDirAngle(Gear); AllInactive:= false end; -CalcRotationDirAngle(Gear); -if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag; if ((Gear.State and gsttmpFlag) <> 0) then if ((Gear.State and gstAttacking) = 0) then - if isGearNear(Gear, gtHedgehog, 42, 25) then Gear.State:= Gear.State or gstAttacking else + if isGearNear(Gear, gtHedgehog, 46, 32) then Gear.State:= Gear.State or gstAttacking else else // gstAttacking <> 0 begin AllInactive:= false; - dec(Gear.Timer); + if (Gear.Timer and $1FF) = 0 then PlaySound(sndMineTick); if Gear.Timer = 0 then begin - doMakeExplosion(round(Gear.X), round(Gear.Y), 50, 0); + doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); + SetAllToActive; DeleteGear(Gear) end; - end; + dec(Gear.Timer); + end else // gsttmpFlag = 0 + if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag; end; diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Tue Sep 06 19:09:39 2005 +0000 +++ b/hedgewars/uConsts.pas Wed Sep 07 18:51:53 2005 +0000 @@ -49,7 +49,7 @@ gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope, gtSmokeTrace, gtExplosion, gtMine); TSound = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash, - sndShotgunReload, sndShotgunFire, sndGraveImpact); + sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick); TAmmoType = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope, amMine); THWFont = (fnt16, fntBig); @@ -141,6 +141,7 @@ ammoprop_ForwMsgs = $00000008; ammoprop_AttackInFall = $00000010; ammoprop_AttackInJump = $00000020; + ammoprop_NoCrosshair = $00000040; AMMO_INFINITE = High(LongWord); capgrpStartGame = 0; @@ -239,7 +240,8 @@ (FileName: 'splash.ogg'; Path: ptSounds ),// sndSplash (FileName: 'shotgunreload.ogg'; Path: ptSounds ),// sndShotgunReload (FileName: 'shotgunfire.ogg'; Path: ptSounds ),// sndShotgunFire - (FileName: 'graveimpact.ogg'; Path: ptSounds ) // sndGraveImpact + (FileName: 'graveimpact.ogg'; Path: ptSounds ),// sndGraveImpact + (FileName: 'minetick.ogg'; Path: ptSounds ) // sndMineTicks ); Ammoz: array [TAmmoType] of record @@ -305,7 +307,7 @@ Slot: 5; TimeAfterTurn: 0), (Name: 'Mine'; - Ammo: (Propz: 0; + Ammo: (Propz: ammoprop_NoCrosshair; Count: 5; NumPerTurn: 0; Timer: 0; diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Tue Sep 06 19:09:39 2005 +0000 +++ b/hedgewars/uMisc.pas Wed Sep 07 18:51:53 2005 +0000 @@ -85,6 +85,7 @@ var cSendEmptyPacketTime : LongWord = 2000; cSendCursorPosTime : LongWord = 50; + ShowCrosshair : boolean; flagMakeCapture: boolean = false; diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/uSound.pas --- a/hedgewars/uSound.pas Tue Sep 06 19:09:39 2005 +0000 +++ b/hedgewars/uSound.pas Wed Sep 07 18:51:53 2005 +0000 @@ -41,10 +41,11 @@ procedure SoundLoad; procedure PlaySound(snd: TSound); procedure PlayMusic; -procedure StopSound(snd: TSound); +procedure StopTPUSound; implementation uses uMisc, uConsole; +const chanTPU = 12; var Mus: PMixMusic; procedure InitSound; @@ -56,7 +57,7 @@ isSoundEnabled:= Mix_OpenAudio(22050, $8010, 2, 512) = 0; if isSoundEnabled then WriteLnToConsole(msgOK) else WriteLnToConsole(msgFailed); -Mix_AllocateChannels(Succ(ord(High(TSound)))); +Mix_AllocateChannels(Succ(chanTPU)); Mix_VolumeMusic(48) end; @@ -93,15 +94,15 @@ procedure PlaySound(snd: TSound); begin if not isSoundEnabled then exit; -if Mix_Playing(ord(snd)) = 0 then - Mix_PlayChannelTimed(ord(snd), Soundz[snd].id, 0, -1) +if snd <> sndThrowPowerUp then Mix_PlayChannelTimed(-1, Soundz[snd].id, 0, -1) + else Mix_PlayChannelTimed(chanTPU, Soundz[snd].id, 0, -1) end; -procedure StopSound(snd: TSound); +procedure StopTPUSound; begin if not isSoundEnabled then exit; -if Mix_Playing(ord(snd)) <> 0 then - Mix_HaltChannel(ord(snd)) +if Mix_Playing(chanTPU) <> 0 then + Mix_HaltChannel(chanTPU) end; procedure PlayMusic; diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Tue Sep 06 19:09:39 2005 +0000 +++ b/hedgewars/uTeams.pas Wed Sep 07 18:51:53 2005 +0000 @@ -228,7 +228,8 @@ Gear.State:= Gear.State and not gstHHChooseTarget; AdjustMPoint; isCursorVisible:= false - end + end; + ShowCrosshair:= (Propz and ammoprop_NoCrosshair) = 0 end end end; diff -r 366adfa1a727 -r 7a5db822fd3f hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Tue Sep 06 19:09:39 2005 +0000 +++ b/hedgewars/uWorld.pas Wed Sep 07 18:51:53 2005 +0000 @@ -139,6 +139,7 @@ if (Gear.State and gstHHThinking) <> 0 then DrawGear(sQuestion, Round(Gear.X) - 10 + WorldDx, Round(Gear.Y) - cHHHalfHeight - 34 + WorldDy, Surface) else + if ShowCrosshair then DrawCaption(Round(Gear.X + Sign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle)*60) + WorldDx, Round(Gear.Y - Cos(Gear.Angle*pi/cMaxAngle)*60) + WorldDy - 5, Team.CrossHairRect, Surface)