DEADSOFTWARE

Game: Add secret notification
authorStas'M <x86corez@gmail.com>
Wed, 20 Feb 2019 13:53:26 +0000 (16:53 +0300)
committerStas'M <x86corez@gmail.com>
Wed, 20 Feb 2019 13:53:26 +0000 (16:53 +0300)
src/game/g_game.pas
src/game/g_language.pas
src/game/g_net.pas
src/game/g_netmsg.pas
src/game/g_player.pas
src/game/g_triggers.pas

index 7d660aa599c1af3773962ac430b7a713f1dc8dce..3014b68338454e5f9f55f549356b816123fce3a0 100644 (file)
@@ -2330,6 +2330,7 @@ begin
   g_Frames_CreateWAD(nil, 'FRAMES_PUNCH_BERSERK_DN', GameWAD+':WEAPONS\PUNCHB_DN', 64, 64, 4, False);
   g_Sound_CreateWADEx('SOUND_GAME_TELEPORT', GameWAD+':SOUNDS\TELEPORT');
   g_Sound_CreateWADEx('SOUND_GAME_NOTELEPORT', GameWAD+':SOUNDS\NOTELEPORT');
+  g_Sound_CreateWADEx('SOUND_GAME_SECRET', GameWAD+':SOUNDS\SECRET');
   g_Sound_CreateWADEx('SOUND_GAME_DOOROPEN', GameWAD+':SOUNDS\DOOROPEN');
   g_Sound_CreateWADEx('SOUND_GAME_DOORCLOSE', GameWAD+':SOUNDS\DOORCLOSE');
   g_Sound_CreateWADEx('SOUND_GAME_BULK1', GameWAD+':SOUNDS\BULK1');
@@ -2450,6 +2451,7 @@ begin
   g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_DN');
   g_Sound_Delete('SOUND_GAME_TELEPORT');
   g_Sound_Delete('SOUND_GAME_NOTELEPORT');
+  g_Sound_Delete('SOUND_GAME_SECRET');
   g_Sound_Delete('SOUND_GAME_DOOROPEN');
   g_Sound_Delete('SOUND_GAME_DOORCLOSE');
   g_Sound_Delete('SOUND_GAME_BULK1');
index 49a5885583595e47f2cc0f253076e3215cf2fcf5..267fcd0fd8b3b083b28365bdc8de3a3e58e68d03 100644 (file)
@@ -414,6 +414,7 @@ type
     I_PLAYER_NAME,
     I_PLAYER_CHTEAM_RED,
     I_PLAYER_CHTEAM_BLUE,
+    I_PLAYER_SECRET,
 
     I_PLAYER_SPECT,
     I_PLAYER_SPECT1,
@@ -1381,6 +1382,8 @@ const
                                        '%s ïåðåøåë â Êðàñíóþ êîìàíäó.'),
     ('PLAYER CHTEAM BLUE',             '%s is now on Blue.',
                                        '%s ïåðåøåë â Ñèíþþ êîìàíäó.'),
+    ('PLAYER SECRET',                  '%s found a secret!',
+                                       '%s íàø¸ë ñåêðåò!'),
 
     ('PLAYER SPECT',                   'Spectating',
                                        'Íàáëþäåíèå'),
index c5bce9648aa54223153106e3caf337bd21707018..7c21ea5a156bb1ed7fcfff2064b718c7f606e1c2 100644 (file)
@@ -22,7 +22,7 @@ uses
   e_log, e_msg, ENet, Classes, MAPDEF{$IFDEF USE_MINIUPNPC}, miniupnpc;{$ELSE};{$ENDIF}
 
 const
-  NET_PROTOCOL_VER = 178;
+  NET_PROTOCOL_VER = 179;
 
   NET_MAXCLIENTS = 24;
   NET_CHANS = 11;
index 6e825fe1215744d3b12123fc1045065e50d26a53..a7219124df1b26292b2d87aafaa4130125879e4e 100644 (file)
@@ -109,6 +109,7 @@ const
   NET_EV_LMS_DRAW     = 16;
   NET_EV_KILLCOMBO    = 17;
   NET_EV_PLAYER_TOUCH = 18;
+  NET_EV_SECRET       = 19;
 
   NET_VE_STARTED      = 1;
   NET_VE_PASSED       = 2;
@@ -1831,6 +1832,16 @@ begin
         pl.Touch();
     end;
 
+    NET_EV_SECRET:
+    begin
+      pl := g_Player_Get(EvNum);
+      if pl <> nil then
+      begin
+        g_Console_Add(Format(_lc[I_PLAYER_SECRET], [pl.Name]), True);
+        g_Sound_PlayEx('SOUND_GAME_SECRET');
+      end;
+    end;
+
   end;
 end;
 
index 4d87ded9c0e2f69978cb5a35c296e3b8c9cffbab..f644d6b7d863fc2d2f59a7f25da74670f9762c59 100644 (file)
@@ -5788,6 +5788,11 @@ end;
 
 procedure TPlayer.GetSecret();
 begin
+  if (self = gPlayer1) or (self = gPlayer2) then
+  begin
+    g_Console_Add(Format(_lc[I_PLAYER_SECRET], [FName]), True);
+    g_Sound_PlayEx('SOUND_GAME_SECRET');
+  end;
   Inc(FSecrets);
 end;
 
index 1673cefedadeab37f1f565cd3b100a7a6684119c..af000f0dda34bff1a628859e0ba878dd6d129ad0 100644 (file)
@@ -1352,9 +1352,15 @@ begin
           Result := True;
           if gLMSRespawn = LMS_RESPAWN_NONE then
           begin
-            g_Player_Get(ActivateUID).GetSecret();
+            p := g_Player_Get(ActivateUID);
+            p.GetSecret();
             Inc(gCoopSecretsFound);
-            if g_Game_IsNet then MH_SEND_GameStats();
+            if g_Game_IsNet then
+            begin
+              MH_SEND_GameStats();
+              if p.FClientID >= 0 then
+                MH_SEND_GameEvent(NET_EV_SECRET, p.UID, '', p.FClientID);
+            end;
           end;
         end;