DEADSOFTWARE

generalize warmup stuff
[d2df-sdl.git] / src / game / g_triggers.pas
index 680d9ed266f26a8fbf486ba76376360b4ba0f8f6..55057b622a11f6b54475ee9d4265d580a7312097 100644 (file)
@@ -2,8 +2,7 @@
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -106,7 +105,7 @@ uses
   Math,
   g_player, g_map, g_panel, g_gfx, g_game, g_textures,
   g_console, g_monsters, g_items, g_phys, g_weapons,
-  wadreader, g_main, e_log, g_language,
+  wadreader, g_main, e_log, g_language, e_res,
   g_options, g_net, g_netmsg, utils, xparser, xstreams;
 
 const
@@ -1225,7 +1224,7 @@ begin
 
   if not Trigger.Enabled then exit;
   if (Trigger.TimeOut <> 0) and (actType <> ACTIVATE_CUSTOM) then exit;
-  if (gLMSRespawn = LMS_RESPAWN_WARMUP) then exit;
+  if (gLMSRespawn > LMS_RESPAWN_NONE) then exit;
 
   if (Trigger.exoCheck <> nil) then
   begin
@@ -2345,7 +2344,7 @@ end;
 function g_Triggers_Create (aTrigger: TTrigger; trec: TDynRecord; forceInternalIndex: Integer=-1): DWORD;
 var
   find_id: DWORD;
-  fn, mapw: AnsiString;
+  fn: AnsiString;
   f, olen: Integer;
   ptg: PTrigger;
 begin
@@ -2519,17 +2518,7 @@ begin
     // Åùå íåò òàêîãî çâóêà
     if not g_Sound_Exists(ptg.tgcSoundName) then
     begin
-      fn := g_ExtractWadName(ptg.tgcSoundName);
-      if (fn = '') then
-      begin // Çâóê â ôàéëå ñ êàðòîé
-        mapw := g_ExtractWadName(gMapInfo.Map);
-        fn := mapw+':'+g_ExtractFilePathName(ptg.tgcSoundName);
-      end
-      else // Çâóê â îòäåëüíîì ôàéëå
-      begin
-        fn := GameDir + '/wads/' + ptg.tgcSoundName;
-      end;
-
+      fn := e_GetResourcePath(WadDirs, ptg.tgcSoundName, g_ExtractWadName(gMapInfo.Map));
       //e_LogWritefln('loading trigger sound ''%s''', [fn]);
       if not g_Sound_CreateWADEx(ptg.tgcSoundName, fn) then
       begin
@@ -2555,18 +2544,7 @@ begin
     // Åùå íåò òàêîé ìóçûêè
     if not g_Sound_Exists(ptg.tgcMusicName) then
     begin
-      fn := g_ExtractWadName(ptg.tgcMusicName);
-
-      if fn = '' then
-      begin // Ìóçûêà â ôàéëå ñ êàðòîé
-        mapw := g_ExtractWadName(gMapInfo.Map);
-        fn := mapw+':'+g_ExtractFilePathName(ptg.tgcMusicName);
-      end
-      else // Ìóçûêà â ôàéëå ñ êàðòîé
-      begin
-        fn := GameDir+'/wads/'+ptg.tgcMusicName;
-      end;
-
+      fn := e_GetResourcePath(WadDirs, ptg.tgcMusicName, g_ExtractWadName(gMapInfo.Map));
       if not g_Sound_CreateWADEx(ptg.tgcMusicName, fn, True) then
       begin
         g_FatalError(Format(_lc[I_GAME_ERROR_TR_SOUND], [fn, ptg.tgcMusicName]));