--- a/QTfrontend/hwform.cpp Tue Jan 13 22:38:08 2009 +0000
+++ b/QTfrontend/hwform.cpp Wed Jan 14 16:36:16 2009 +0000
@@ -304,8 +304,8 @@
ui.pageGameStats->renderStats();
}
- if ((lastid == ID_PAGE_GAMESTATS) && !hwnet)
- GoBack();
+// if ((lastid == ID_PAGE_GAMESTATS) && !hwnet)
+// GoBack();
}
void HWForm::GoToPage(quint8 id)
--- a/hedgewars/GSHandlers.inc Tue Jan 13 22:38:08 2009 +0000
+++ b/hedgewars/GSHandlers.inc Wed Jan 14 16:36:16 2009 +0000
@@ -25,7 +25,7 @@
CheckGearDrowning:= true;
Gear^.State:= gstDrowning;
Gear^.doStep:= @doStepDrowningGear;
- PlaySound(sndSplash, false)
+ PlaySound(sndSplash, false, nil)
end else
CheckGearDrowning:= false
end;
@@ -43,9 +43,9 @@
if _0_4 < Gear^.dY then
begin
if _0_6 < Gear^.dY then
- PlaySound(sndOw4, false)
+ PlaySound(sndOw4, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
else
- PlaySound(sndOw1, false);
+ PlaySound(sndOw1, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
dmg:= 1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70);
inc(Gear^.Damage, dmg);
@@ -171,7 +171,7 @@
if Gear^.Kind = gtHellishBomb then
begin
- if Gear^.Timer = 3000 then PlaySound(sndHellish, false);
+ if Gear^.Timer = 3000 then PlaySound(sndHellish, false, nil);
if (GameTicks and $3F) = 0 then
if (Gear^.State and gstCollision) = 0 then
@@ -181,13 +181,13 @@
if (Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving) then
if (hwAbs(Gear^.dX) > _0_1) or
(hwAbs(Gear^.dY) > _0_1) then
- PlaySound(sndGrenadeImpact, false)
+ PlaySound(sndGrenadeImpact, false, nil)
end;
procedure doStepWatermelon(Gear: PGear);
begin
AllInactive:= false;
-PlaySound(sndMelon, false);
+PlaySound(sndMelon, false, nil);
Gear^.doStep:= @doStepBomb
end;
@@ -284,7 +284,7 @@
begin
Gear^.Active:= false;
exit
- end else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false)
+ end else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false, nil)
end;
Gear^.Y:= Gear^.Y + Gear^.dY;
@@ -340,7 +340,7 @@
dec(Gear^.Timer);
if Gear^.Timer = 0 then
begin
- PlaySound(sndUFO, true);
+ PlaySound(sndUFO, true, nil);
Gear^.Timer:= 5000;
Gear^.doStep:= @doStepUFOWork
end;
@@ -368,7 +368,7 @@
dec(Gear^.Timer);
if Gear^.Timer = 0 then
begin
- PlaySound(sndShotgunFire, false);
+ PlaySound(sndShotgunFire, false, nil);
Gear^.State:= Gear^.State or gstAnimation
end;
exit
@@ -426,7 +426,7 @@
procedure doStepDEagleShot(Gear: PGear);
begin
-PlaySound(sndGun, false);
+PlaySound(sndGun, false, nil);
Gear^.doStep:= @doStepDEagleShotWork
end;
@@ -542,7 +542,7 @@
Gear^.dY:= HHGear^.dY;
DeleteCI(HHGear);
-PlaySound(sndPickhammer, true);
+PlaySound(sndPickhammer, true, nil);
doStepPickHammerWork(Gear);
Gear^.doStep:= @doStepPickHammerWork
end;
@@ -637,7 +637,7 @@
procedure doStepRopeWork(Gear: PGear);
var HHGear: PGear;
- len, cs, cc, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat;
+ len, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat;
lx, ly: LongInt;
haveCollision,
haveDivided: boolean;
@@ -927,7 +927,7 @@
end else // gstAttacking <> 0
begin
AllInactive:= false;
- if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick, false);
+ if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick, false, nil);
if Gear^.Timer = 0 then
begin
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
@@ -995,7 +995,7 @@
begin
Gear^.dY:= - Gear^.dY * Gear^.Elasticity;
if Gear^.dY > - _0_001 then Gear^.dY:= _0
- else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false);
+ else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false, nil);
end;
CheckGearDrowning(Gear);
end;
@@ -1218,7 +1218,7 @@
Gear^.doStep:= @doStepFirePunchWork;
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5);
-PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), false)
+PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), false, PHedgehog(HHGear^.Hedgehog)^.Team^.voicepack)
end;
////////////////////////////////////////////////////////////////////////////////
@@ -1321,7 +1321,7 @@
Gear^.Health:= 6;
Gear^.doStep:= @doStepAirAttackWork;
-PlaySound(sndIncoming, false)
+PlaySound(sndIncoming, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
end;
////////////////////////////////////////////////////////////////////////////////
@@ -1581,7 +1581,7 @@
if Gear^.Timer = 0 then
begin
Gear^.Pos:= 1;
- PlaySound(sndKamikaze, false);
+ PlaySound(sndKamikaze, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
Gear^.doStep:= @doStepKamikazeWork
end
end;
@@ -1641,7 +1641,7 @@
gi:= gi^.NextGear
end;
Gear^.doStep:= @doStepCakeExpl;
- PlaySound(sndCake, false)
+ PlaySound(sndCake, false, nil)
end else dec(Gear^.Pos)
end;
@@ -1804,7 +1804,7 @@
Gear^.Timer:= 0;
inc(Gear^.Pos);
if Gear^.Pos = 5 then
- PlaySound(sndYoohoo, false)
+ PlaySound(sndYoohoo, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
end;
if Gear^.Pos = 14 then
@@ -1929,7 +1929,7 @@
AngleCos(HHGear^.Angle) * ( - _0_8) + ry,
0);
- PlaySound(sndGun, false);
+ PlaySound(sndGun, false, nil);
end;
if (Gear^.Timer = 0) or (HHGear^.Damage <> 0) then
--- a/hedgewars/HHHandlers.inc Tue Jan 13 22:38:08 2009 +0000
+++ b/hedgewars/HHHandlers.inc Wed Jan 14 16:36:16 2009 +0000
@@ -114,7 +114,7 @@
if Power = 0 then
begin
AttackBar:= CurrentTeam^.AttackBar;
- PlaySound(sndThrowPowerUp, false)
+ PlaySound(sndThrowPowerUp, false, nil)
end;
inc(Power)
end;
@@ -123,7 +123,7 @@
if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then
begin
StopSound(sndThrowPowerUp);
- PlaySound(sndThrowRelease, false);
+ PlaySound(sndThrowRelease, false, nil);
end;
xx:= SignAs(AngleSin(Angle), dX);
yy:= -AngleCos(Angle);
@@ -135,7 +135,7 @@
amBazooka: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Grenade, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
amUFO: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtUFO, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
amShotgun: begin
- PlaySound(sndShotgunReload, false);
+ PlaySound(sndShotgunReload, false, nil);
CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtShotgunShot, 0, xx * _0_5, yy * _0_5, 0);
end;
amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
@@ -143,12 +143,12 @@
amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0);
amMine: begin
AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, SignAs(_0_02, dX), _0, 3000);
- PlaySound(sndLaugh, false)
+ PlaySound(sndLaugh, false, nil)
end;
amDEagle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
amDynamite: begin
AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
- PlaySound(sndLaugh, false)
+ PlaySound(sndLaugh, false, nil)
end;
amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, xx, _0, 0);
amWhip: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
@@ -164,7 +164,7 @@
amKamikaze: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
amCake: begin
CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
- PlaySound(sndLaugh, false)
+ PlaySound(sndLaugh, false, nil)
end;
amSeduction: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius * 2), hwRound(Y + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
@@ -234,7 +234,7 @@
Gear^.Z:= cCurrHHZ;
RemoveGearFromList(Gear);
InsertGearToList(Gear);
- PlaySound(sndByeBye, false);
+ PlaySound(sndByeBye, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
Gear^.Pos:= 0;
Gear^.Timer:= timertime
end
@@ -312,7 +312,7 @@
Gear^.dY:= -_0_15;
Gear^.dX:= SignAs(_0_15, Gear^.dX);
Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
- PlaySound(sndJump1, false);
+ PlaySound(sndJump1, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
exit
end;
end;
@@ -325,7 +325,7 @@
Gear^.dY:= -_0_2;
SetLittle(Gear^.dX);
Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
- PlaySound(sndJump3, false);
+ PlaySound(sndJump3, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
exit
end;
@@ -582,7 +582,7 @@
Gear^.State:= Gear^.State or gstHHHJump or gstMoving;
Gear^.dY:= -_0_25;
Gear^.dX:= -SignAs(_0_02, Gear^.dX);
- PlaySound(sndJump2, false)
+ PlaySound(sndJump2, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
end;
Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
--- a/hedgewars/uGears.pas Tue Jan 13 22:38:08 2009 +0000
+++ b/hedgewars/uGears.pas Wed Jan 14 16:36:16 2009 +0000
@@ -565,7 +565,8 @@
begin
if (TurnTimeLeft = 5000)
and (CurrentHedgehog^.Gear <> nil)
- and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then PlaySound(sndHurry, false);
+ and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then
+ PlaySound(sndHurry, false, CurrentTeam^.voicepack);
dec(TurnTimeLeft)
end;
@@ -1161,7 +1162,7 @@
TargetPoint.X:= NoPointX;
{$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0);
-if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion, false);
+if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion, false, nil);
if (Mask and EXPLAllDamageInRadius) = 0 then
dmgRadius:= Radius shl 1
@@ -1447,7 +1448,7 @@
inc(i);
dec(t, Ammoz[i].Probability)
end;
- PlaySound(sndReinforce, false);
+ PlaySound(sndReinforce, false, CurrentTeam^.voicepack);
FollowGear^.Pos:= posCaseAmmo;
FollowGear^.State:= Longword(i)
end;
--- a/hedgewars/uSound.pas Tue Jan 13 22:38:08 2009 +0000
+++ b/hedgewars/uSound.pas Wed Jan 14 16:36:16 2009 +0000
@@ -30,13 +30,12 @@
procedure InitSound;
procedure ReleaseSound;
procedure SoundLoad;
-procedure PlaySound(snd: TSound; infinite: boolean);
+procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack);
procedure PlayMusic;
procedure StopSound(snd: TSound);
function ChangeVolume(voldelta: LongInt): LongInt;
function AskForVoicepack(name: shortstring): Pointer;
-procedure SetVoicePack(vp: PVoicePack);
var MusicFN: shortstring = '';
@@ -49,7 +48,6 @@
lastChan: array [TSound] of LongInt;
voicepacks: array[0..cMaxTeams] of TVoicepack;
defVoicepack: PVoicepack;
- currentVP: PVoicepack;
function AskForVoicepack(name: shortstring): Pointer;
var i: Longword;
@@ -65,11 +63,6 @@
AskForVoicepack:= @voicepacks[i]
end;
-procedure SetVoicePack(vp: PVoicePack);
-begin
-currentVP:= vp
-end;
-
procedure InitSound;
begin
if not isSoundEnabled then exit;
@@ -109,7 +102,6 @@
if not isSoundEnabled then exit;
defVoicepack:= AskForVoicepack('Default');
-SetVoicePack(defVoicepack);
for i:= Low(TSound) to High(TSound) do
if Soundz[i].Path <> ptVoices then
@@ -136,14 +128,14 @@
end;
end;
-procedure PlaySound(snd: TSound; infinite: boolean);
+procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack);
var loops: LongInt;
begin
if (not isSoundEnabled) or fastUntilLag then exit;
if infinite then loops:= -1 else loops:= 0;
-if currentVP^.chunks[snd] <> nil then
- lastChan[snd]:= Mix_PlayChannelTimed(-1, currentVP^.chunks[snd], loops, -1)
+if (voicepack <> nil) and (voicepack^.chunks[snd] <> nil) then
+ lastChan[snd]:= Mix_PlayChannelTimed(-1, voicepack^.chunks[snd], loops, -1)
else
lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], loops, -1)
end;
--- a/hedgewars/uStats.pas Tue Jan 13 22:38:08 2009 +0000
+++ b/hedgewars/uStats.pas Wed Jan 14 16:36:16 2009 +0000
@@ -94,37 +94,37 @@
inc(CurrentHedgehog^.stats.FinishedTurns);
if (DamageGiven = DamageTotal) and (DamageTotal > 0) then
- PlaySound(sndFirstBlood, false)
+ PlaySound(sndFirstBlood, false, CurrentTeam^.voicepack)
else if CurrentHedgehog^.stats.StepDamageRecv > 0 then
- PlaySound(sndStupid, false)
+ PlaySound(sndStupid, false, CurrentTeam^.voicepack)
else if DamageClan <> 0 then
if DamageTotal > DamageClan then
if random(2) = 0 then
- PlaySound(sndNutter, false)
+ PlaySound(sndNutter, false, CurrentTeam^.voicepack)
else
- PlaySound(sndWatchIt, false)
+ PlaySound(sndWatchIt, false, CurrentTeam^.voicepack)
else
if random(2) = 0 then
- PlaySound(sndSameTeam, false)
+ PlaySound(sndSameTeam, false, CurrentTeam^.voicepack)
else
- PlaySound(sndTraitor, false)
+ PlaySound(sndTraitor, false, CurrentTeam^.voicepack)
else if DamageGiven <> 0 then
if Kills > 0 then
- PlaySound(sndEnemyDown, false)
+ PlaySound(sndEnemyDown, false, CurrentTeam^.voicepack)
else
- PlaySound(sndRegret, false)
+ PlaySound(sndRegret, false, CurrentTeam^.voicepack)
else if AmmoDamagingUsed then
- PlaySound(sndMissed, false)
+ PlaySound(sndMissed, false, CurrentTeam^.voicepack)
else if (AmmoUsedCount > 0) and not isTurnSkipped then
// nothing ?
else if isTurnSkipped then
- PlaySound(sndBoring, false)
+ PlaySound(sndBoring, false, CurrentTeam^.voicepack)
else
- PlaySound(sndCoward, false);
+ PlaySound(sndCoward, false, CurrentTeam^.voicepack);
end;
--- a/hedgewars/uTeams.pas Tue Jan 13 22:38:08 2009 +0000
+++ b/hedgewars/uTeams.pas Wed Jan 14 16:36:16 2009 +0000
@@ -224,14 +224,12 @@
if not CurrentTeam^.ExtDriven then SetBinds(CurrentTeam^.Binds);
-SetVoicePack(CurrentTeam^.voicepack);
-
bShowFinger:= true;
if (CurrentTeam^.ExtDriven or (CurrentHedgehog^.BotLevel > 0)) then
- PlaySound(sndIllGetYou, false)
+ PlaySound(sndIllGetYou, false, CurrentTeam^.voicepack)
else
- PlaySound(sndYesSir, false);
+ PlaySound(sndYesSir, false, CurrentTeam^.voicepack);
TurnTimeLeft:= cHedgehogTurnTime
end;