DEADSOFTWARE

mplat triggers can make sound now
[d2df-sdl.git] / src / game / g_triggers.pas
index cf039ba3913cddd0cc29331efe034f57377e3861..6e57873ec65f20e77deee928e1b1b7730f5e74c5 100644 (file)
@@ -2140,7 +2140,7 @@ begin
   triggers := gCurrentMap['trigger'];
   if (triggers = nil) then raise Exception.Create('LOAD: map has no triggers');
   if (mapidx < 0) or (mapidx >= triggers.count) then raise Exception.Create('LOAD: invalid map trigger index');
-  Trigger.trigData := triggers.item[mapidx];
+  Trigger.trigData := triggers.itemAt[mapidx];
   if (Trigger.trigData = nil) then raise Exception.Create('LOAD: internal error in trigger loader');
   Trigger.mapId := Trigger.trigData.id;
   Trigger.mapIndex := mapidx;
@@ -2494,6 +2494,11 @@ begin
               TRIGGER_OFF: pan.movingActive := false;
               TRIGGER_ONOFF: pan.movingActive := not pan.movingActive;
             end;
+            if not trigData.trigSilent and (Length(trigData.trigSound) > 0) then
+            begin
+              g_Sound_PlayExAt(trigData.trigSound, X, Y);
+              if g_Game_IsServer and g_Game_IsNet then MH_SEND_Sound(X, Y, trigData.trigSound);
+            end;
           end;
 
           // Âûáèðàåì îäèí èç òðèããåðîâ äëÿ ðàñøèðèòåëÿ, åñëè âêëþ÷åí ðàíäîì: