index 6748a005098b7874218adc0e15af4fcd3fa5a631..2ff21708160b0e1e063545a508f405f87453be4a 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
unit g_triggers;
interface
uses
g_player, g_map, Math, g_gfx, g_game, g_textures,
g_console, g_monsters, g_items, g_phys, g_weapons,
- WADEDITOR, g_main, SysUtils, e_log, g_language,
- g_options, g_net, g_netmsg;
+ wadreader, g_main, SysUtils, e_log, g_language,
+ g_options, g_net, g_netmsg, g_scripts;
const
TRIGGER_SIGNATURE = $52475254; // 'TRGR'
MH_SEND_Sound(X, Y, 'SOUND_GAME_SWITCH1');
end;
-
with gWalls[PanelID] do
begin
if gPlayers <> nil then
TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF:
begin
PressCount := PressCount + 1;
-
+
if PressTime = -1 then
PressTime := Data.Wait;
p := g_Player_Get(ActivateUID);
if p = nil then
Exit;
-
+
if Data.ResetVel then
begin
p.GameVelX := 0;
end;
TimeOut := Data.FXWait;
end;
+
+ TRIGGER_SCRIPT:
+ begin
+ g_Scripts_ProcExec(Data.SCRProc, [ID, ActivateUID, actType, Data.SCRArg], 'map');
+ TimeOut := 0;
+ Result := True;
+ end;
end;
end;
// Åùå íåò òàêîãî çâóêà:
if not g_Sound_Exists(Trigger.Data.SoundName) then
begin
- g_ProcessResourceStr(Trigger.Data.SoundName, @fn, nil, nil);
+ fn := g_ExtractWadName(Trigger.Data.SoundName);
if fn = '' then
begin // Çâóê â ôàéëå ñ êàðòîé
- g_ProcessResourceStr(gMapInfo.Map, @mapw, nil, nil);
- fn := mapw + Trigger.Data.SoundName;
+ mapw := g_ExtractWadName(gMapInfo.Map);
+ fn := mapw+':'+g_ExtractFilePathName(Trigger.Data.SoundName);
end
else // Çâóê â îòäåëüíîì ôàéëå
fn := GameDir + '/wads/' + Trigger.Data.SoundName;
// Åùå íåò òàêîé ìóçûêè:
if not g_Sound_Exists(Trigger.Data.MusicName) then
begin
- g_ProcessResourceStr(Trigger.Data.MusicName, @fn, nil, nil);
+ fn := g_ExtractWadName(Trigger.Data.MusicName);
if fn = '' then
begin // Ìóçûêà â ôàéëå ñ êàðòîé
- g_ProcessResourceStr(gMapInfo.Map, @mapw, nil, nil);
- fn := mapw + Trigger.Data.MusicName;
+ mapw := g_ExtractWadName(gMapInfo.Map);
+ fn := mapw+':'+g_ExtractFilePathName(Trigger.Data.MusicName);
end
else // Ìóçûêà â ôàéëå ñ êàðòîé
fn := GameDir+'/wads/'+Trigger.Data.MusicName;
k: Byte;
p: TPlayer;
begin
+ Result := nil;
+
if gTriggers = nil then Exit;
case g_GetUIDType(UID) of
else k := 0;
end;
- Result := nil;
-
for a := 0 to High(gTriggers) do
if (gTriggers[a].TriggerType <> TRIGGER_NONE) and
(gTriggers[a].TimeOut = 0) and