DEADSOFTWARE

Revert "fixed weapon switching over the network; bumped protocol version"
[d2df-sdl.git] / src / game / g_netmsg.pas
index 29e9223af93c0994aa62eab83b0b70c4a03893a7..a7ff31a9639fe68fdf2efdae7e308b54a1683a5d 100644 (file)
@@ -644,7 +644,7 @@ procedure MH_SEND_Everything(CreatePlayers: Boolean = False; ID: Integer = NET_E
   begin
     result := false; // don't stop
     MH_SEND_PanelState(pan.guid, ID); // anyway, to sync mplats
-    if (pan.GetTextureCount > 1) then MH_SEND_PanelTexture(pan.guid, pan.LastAnimLoop, ID);
+    if (pan.CanChangeTexture) then MH_SEND_PanelTexture(pan.guid, pan.LastAnimLoop, ID);
   end;
 
 var
@@ -2364,17 +2364,9 @@ begin
   TP := g_Map_PanelByGUID(PGUID);
   if (TP <> nil) then
   begin
-    if Loop = 0 then
-    begin
-      // switch texture
-      TP.SetTexture(Tex, Loop);
-      TP.SetFrame(Fr, Cnt);
-    end
-    else
-    begin
-      // looped or non-looped animation
-      TP.NextTexture(Loop);
-    end;
+    // switch texture
+    TP.SetTexture(Tex, Loop);
+    TP.SetFrame(Fr, Cnt);
   end;
 end;
 
@@ -2464,16 +2456,19 @@ begin
       if gTriggers[I].ClientID = SID then
         with gTriggers[I] do
         begin
-          if SPlaying then
+          if Sound <> nil then
           begin
-            if tgcLocal then
-              Sound.PlayVolumeAt(X+(Width div 2), Y+(Height div 2), tgcVolume/255.0)
+            if SPlaying then
+            begin
+              if tgcLocal then
+                Sound.PlayVolumeAt(X+(Width div 2), Y+(Height div 2), tgcVolume/255.0)
+              else
+                Sound.PlayPanVolume((tgcPan-127.0)/128.0, tgcVolume/255.0);
+              Sound.SetPosition(SPos);
+            end
             else
-              Sound.PlayPanVolume((tgcPan-127.0)/128.0, tgcVolume/255.0);
-            Sound.SetPosition(SPos);
-          end
-          else
-            if Sound.IsPlaying then Sound.Stop;
+              if Sound.IsPlaying then Sound.Stop;
+          end;
 
           SoundPlayCount := SCount;
         end;
@@ -3019,10 +3014,10 @@ var
   mapDataMsg: TMapDataMsg;
 begin
   e_WriteLog('NET: Received map request from ' +
-             DecodeIPV4(C.Peer.address.host), TMsgType.Notify);
+             DecodeIPV4(C^.Peer.address.host), TMsgType.Notify);
 
   mapDataMsg := CreateMapDataMsg(MapsDir + gGameSettings.WAD, gExternalResources);
-  peer := NetClients[C.ID].Peer;
+  peer := NetClients[C^.ID].Peer;
 
   MapDataMsgToBytes(payload, mapDataMsg);
   g_Net_SendData(payload, peer, True, NET_CHAN_DOWNLOAD);
@@ -3041,7 +3036,7 @@ var
 begin
   FileName := ExtractFileName(M.ReadString());
   e_WriteLog('NET: Received res request: ' + FileName +
-             ' from ' + DecodeIPV4(C.Peer.address.host), TMsgType.Notify);
+             ' from ' + DecodeIPV4(C^.Peer.address.host), TMsgType.Notify);
 
   if not IsValidFilePath(FileName) then
   begin
@@ -3049,7 +3044,7 @@ begin
     exit;
   end;
 
-  peer := NetClients[C.ID].Peer;
+  peer := NetClients[C^.ID].Peer;
 
   if gExternalResources.IndexOf(FileName) > -1 then
   begin