DEADSOFTWARE

Player: Add sounds for CTF game
[d2df-sdl.git] / src / game / g_map.pas
index be752f804f2116d93fb88ea8be5a251586225726..81eb17e904044c36be49914f5172380a7b8cbdd6 100644 (file)
@@ -2515,6 +2515,7 @@ var
   a, d, j: Integer;
   m: Word;
   s: String;
+  b: Byte;
 
   procedure UpdatePanelArray(var panels: TPanelArray);
   var
@@ -2565,6 +2566,15 @@ begin
               s := _lc[I_PLAYER_FLAG_BLUE];
             g_Game_Message(Format(_lc[I_MESSAGE_FLAG_RETURN], [AnsiUpperCase(s)]), 144);
 
+            if (((gPlayer1 <> nil) and (((gPlayer1.Team = TEAM_RED) and (a = FLAG_RED)) or ((gPlayer1.Team = TEAM_BLUE) and (a = FLAG_BLUE))))
+            or ((gPlayer2 <> nil) and (((gPlayer2.Team = TEAM_RED) and (a = FLAG_RED)) or ((gPlayer2.Team = TEAM_BLUE) and (a = FLAG_BLUE))))) then
+              b := 0
+            else
+              b := 1;
+
+            if not sound_ret_flag[b].IsPlaying() then
+              sound_ret_flag[b].Play();
+
             if g_Game_IsNet then
               MH_SEND_FlagEvent(FLAG_STATE_RETURNED, a, 0);
             Continue;