Use sounds 'stupid' and 'missed'
authorunc0rr
Fri, 14 Mar 2008 21:07:31 +0000
changeset 815 82ff416301bd
parent 814 7fb4417b7bc1
child 816 235d56fe19f4
Use sounds 'stupid' and 'missed'
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uStats.pas
--- a/hedgewars/uConsts.pas	Fri Mar 14 19:34:05 2008 +0000
+++ b/hedgewars/uConsts.pas	Fri Mar 14 21:07:31 2008 +0000
@@ -58,7 +58,8 @@
      TSound     = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease,
                    sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact,
                    sndMineTick, sndPickhammer, sndGun, sndUFO, sndJump1, sndJump2,
-                   sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndIncoming);
+                   sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndIncoming,
+                   sndMissed, sndStupid);
 
      TAmmoType  = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
                    amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch,
@@ -369,8 +370,10 @@
                 (FileName:        'Yessir.ogg'; Path: ptVoices; id: nil; lastChan: 0),// sndYesSir
                 (FileName:         'Laugh.ogg'; Path: ptVoices; id: nil; lastChan: 0),// sndLaugh
                 (FileName:     'Illgetyou.ogg'; Path: ptVoices; id: nil; lastChan: 0),// sndIllGetYou
-                (FileName:      'Incoming.ogg'; Path: ptVoices; id: nil; lastChan: 0) // sndIncoming
-);
+                (FileName:      'Incoming.ogg'; Path: ptVoices; id: nil; lastChan: 0),// sndIncoming
+                (FileName:        'Missed.ogg'; Path: ptVoices; id: nil; lastChan: 0),// sndMissed
+                (FileName:        'Stupid.ogg'; Path: ptVoices; id: nil; lastChan: 0) // sndStupid
+                );
 
       Ammoz: array [TAmmoType] of record
                                   NameId: TAmmoStrId;
--- a/hedgewars/uGears.pas	Fri Mar 14 19:34:05 2008 +0000
+++ b/hedgewars/uGears.pas	Fri Mar 14 21:07:31 2008 +0000
@@ -377,7 +377,8 @@
 
 procedure ProcessGears;
 const delay: LongWord = 0;
-      step: (stDelay, stChDmg, stChWin, stTurnReact, stSpawn, stNTurn) = stDelay;
+      step: (stDelay, stChDmg, stChWin, stTurnReact,
+             stAfterDelay, stSpawn, stNTurn) = stDelay;
 var Gear, t: PGear;
 begin
 AllInactive:= true;
@@ -403,9 +404,18 @@
         stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
         stChWin: if not CheckForWin then inc(step) else step:= stDelay;
     stTurnReact: begin
-                 TurnReaction;
+                 if not isInMultiShoot then uStats.TurnReaction;
                  inc(step)
                  end;
+   stAfterDelay: begin
+                 if delay = 0 then
+                    delay:= cInactDelay
+                 else
+                    dec(delay);
+
+                 if delay = 0 then
+                    inc(step)
+                 end;
         stSpawn: begin
                  if not isInMultiShoot then SpawnBoxOfSmth;
                  inc(step)
--- a/hedgewars/uStats.pas	Fri Mar 14 19:34:05 2008 +0000
+++ b/hedgewars/uStats.pas	Fri Mar 14 21:07:31 2008 +0000
@@ -27,7 +27,7 @@
                    StepDamageGiven: Longword;
                    MaxStepDamageRecv,
                    MaxStepDamageGiven: Longword;
-                   Turns: Longword;
+                   FinishedTurns: Longword;
                    end;
 
 procedure HedgehogDamaged(Gear: PGear; Damage: Longword);
@@ -36,16 +36,49 @@
 
 implementation
 uses uTeams, uSound, uConsts;
+var DamageGiven : Longword = 0;
+    DamageClan  : Longword = 0;
 
 procedure HedgehogDamaged(Gear: PGear; Damage: Longword);
 begin
 if Gear <> CurrentHedgehog^.Gear then
    inc(CurrentHedgehog^.stats.StepDamageGiven, Damage);
-inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Damage)
+
+if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Damage);
+
+
+inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Damage);
+inc(DamageGiven, Damage)
 end;
 
 procedure TurnReaction;
+var Gear: PGear;
 begin
+inc(CurrentHedgehog^.stats.FinishedTurns);
+
+if CurrentHedgehog^.stats.StepDamageRecv > 0 then PlaySound(sndStupid, false)
+else if DamageClan <> 0 then
+else if DamageGiven <> 0 then
+else PlaySound(sndMissed, false);
+
+Gear:= GearsList;
+while Gear <> nil do
+  begin
+  if Gear^.Kind = gtHedgehog then
+    with PHedgehog(Gear^.Hedgehog)^.stats do
+      begin
+      inc(DamageRecv, StepDamageRecv);
+      inc(DamageGiven, StepDamageGiven);
+      if StepDamageRecv > MaxStepDamageRecv then MaxStepDamageRecv:= StepDamageRecv;
+      if StepDamageGiven > MaxStepDamageGiven then MaxStepDamageGiven:= StepDamageGiven;
+      StepDamageRecv:= 0;
+      StepDamageGiven:= 0
+      end;
+  Gear:= Gear^.NextGear
+  end;
+
+DamageGiven:= 0;
+DamageClan:= 0
 end;
 
 procedure SendStats;