index ee77fded2fcf6630294bd53e9e3568412fa1ece5..529aabc4781c7520dfae7226792a581a4bce34cc 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
-(* Copyright (C) DooM 2D:Forever Developers
+(* 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
xdynrec, hashtable, exoma;
type
- THashStrVariant = specialize THashBase<AnsiString, Variant>;
-
TActivator = record
UID: Word;
TimeOut: Word;
if (Length(afldname) > 4) and (afldname[1] = 'u') and (afldname[2] = 's') and
(afldname[3] = 'e') and (afldname[4] = 'r') then
begin
- if (me.userVars = nil) then me.userVars := THashStrVariant.Create(hashStrHash, hashStrEqu);
+ if (me.userVars = nil) then me.userVars := THashStrVariant.Create();
me.userVars.put(afldname, aval);
exit;
end;
if (gLifts[PanelID].PanelType = PANEL_LIFTUP) or (gLifts[PanelID].PanelType = PANEL_LIFTDOWN) then
begin
case d of
- 0: t := 0;
- 1: t := 1;
- else t := IfThen(gLifts[PanelID].LiftType = 1, 0, 1);
+ 0: t := LIFTTYPE_UP;
+ 1: t := LIFTTYPE_DOWN;
+ else t := IfThen(gLifts[PanelID].LiftType = LIFTTYPE_DOWN, LIFTTYPE_UP, LIFTTYPE_DOWN);
end
end
else if (gLifts[PanelID].PanelType = PANEL_LIFTLEFT) or (gLifts[PanelID].PanelType = PANEL_LIFTRIGHT) then
begin
case d of
- 0: t := 2;
- 1: t := 3;
- else t := IfThen(gLifts[PanelID].LiftType = 2, 3, 2);
+ 0: t := LIFTTYPE_LEFT;
+ 1: t := LIFTTYPE_RIGHT;
+ else t := IfThen(gLifts[PanelID].LiftType = LIFTTYPE_LEFT, LIFTTYPE_RIGHT, LIFTTYPE_LEFT);
end;
end;
snd := 'SOUND_WEAPON_EXPLODEBFG';
end;
+ TRIGGER_SHOT_FLAME:
+ begin
+ g_Weapon_flame(wx, wy, dx, dy, 0, -1, True);
+ snd := 'SOUND_GAME_BURNING';
+ end;
+
else exit;
end;
dx += Random(tgcAccuracy)-Random(tgcAccuracy);
dy += Random(tgcAccuracy)-Random(tgcAccuracy);
- tr_SpawnShot(tgcShotType, wx, wy, dx, dy, not tgcQuiet, TargetUID);
+ tr_SpawnShot(tgcShotType, wx, wy, dx, dy, tgcShotSound, TargetUID);
end
else
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, '');
+ end;
end;
end;
for k := 1 to tgcMonsCount do
begin
if (actType = ACTIVATE_CUSTOM) and (tgcDelay > 0) then
- SpawnCooldown := tgcDelay;
+ SpawnCooldown := -1; // Çàäåðæêà âûñòàâèòñÿ ìîíñòðîì ïðè óíè÷òîæåíèè
if (tgcMax > 0) and (SpawnedCount >= tgcMax) then
Break;
gMonstersSpawned[High(gMonstersSpawned)] := mon.UID;
end;
- if tgcMax > 0 then
- begin
- mon.SpawnTrigger := ID;
- Inc(SpawnedCount);
- end;
+ mon.SpawnTrigger := ID;
+ if tgcMax > 0 then Inc(SpawnedCount);
case tgcEffect of
EFFECT_TELEPORT: begin
for k := 1 to tgcItemCount do
begin
if (actType = ACTIVATE_CUSTOM) and (tgcDelay > 0) then
- SpawnCooldown := tgcDelay;
+ SpawnCooldown := -1; // Çàäåðæêà âûñòàâèòñÿ èòåìîì ïðè óíè÷òîæåíèè
if (tgcMax > 0) and (SpawnedCount >= tgcMax) then
Break;
Result := True;
- if tgcMax > 0 then
- begin
- it := g_Items_ByIdx(iid);
- it.SpawnTrigger := ID;
- Inc(SpawnedCount);
- end;
+ it := g_Items_ByIdx(iid);
+ it.SpawnTrigger := ID;
+ if tgcMax > 0 then Inc(SpawnedCount);
case tgcEffect of
EFFECT_TELEPORT: begin
// Íàíîñèì óðîí èãðîêó
if (TriggerType = TRIGGER_DAMAGE) and (tgcAmount > 0) then
- p.Damage(tgcAmount, 0, 0, 0, HIT_SOME);
+ begin
+ // Êèñëîòíûé óðîí íå íàíîñèòñÿ êîãäà åñòü êîñòþì
+ // "Âîäÿíîé" óðîí íå íàíîñèòñÿ êîãäà åñòü êèñëîðîä
+ if not (((tgcKind = HIT_ACID) and (p.FMegaRulez[MR_SUIT] > gTime)) or
+ ((tgcKind = HIT_WATER) and (p.Air > 0))) then
+ p.Damage(tgcAmount, 0, 0, 0, tgcKind);
+ if (tgcKind = HIT_FLAME) then p.CatchFire(0);
+ end;
// Ëå÷èì èãðîêà
if (TriggerType = TRIGGER_HEALTH) and (tgcAmount > 0) then
// Íàíîñèì óðîí ìîíñòðó
if (TriggerType = TRIGGER_DAMAGE) and (tgcAmount > 0) then
- m.Damage(tgcAmount, 0, 0, 0, HIT_SOME);
+ begin
+ p.Damage(tgcAmount, 0, 0, 0, tgcKind);
+ if (tgcKind = HIT_FLAME) then m.CatchFire(0);
+ end;
// Ëå÷èì ìîíñòðà
if (TriggerType = TRIGGER_HEALTH) and (tgcAmount > 0) then
Dec(idx);
end;
TimeOut := tgcWait;
+ result := true;
end;
end;
end;
// update cached trigger variables
trigUpdateCacheData(ptg^, ptg.trigDataRec);
- ptg.userVars := nil; //THashStrVariant.Create(hashStrHash, hashStrEqu);
+ ptg.userVars := nil;
try
ptg.exoThink := TExprBase.parseStatList(tgclist, VarToStr(trec.user['exoma_think']));
procedure g_Triggers_DecreaseSpawner(ID: DWORD);
begin
if (gTriggers <> nil) then
- if gTriggers[ID].SpawnedCount > 0 then
- Dec(gTriggers[ID].SpawnedCount);
+ begin
+ if gTriggers[ID].tgcMax > 0 then
+ begin
+ if gTriggers[ID].SpawnedCount > 0 then
+ Dec(gTriggers[ID].SpawnedCount);
+ end;
+ if gTriggers[ID].tgcDelay > 0 then
+ begin
+ if gTriggers[ID].SpawnCooldown < 0 then
+ gTriggers[ID].SpawnCooldown := gTriggers[ID].tgcDelay;
+ end;
+ end;
end;
-
procedure g_Triggers_Free ();
var
a: Integer;
if (uvcount < 0) or (uvcount > 1024*1024) then raise XStreamError.Create('invalid number of user vars in trigger');
if (uvcount > 0) then
begin
- gTriggers[i].userVars := THashStrVariant.Create(hashStrHash, hashStrEqu);
+ gTriggers[i].userVars := THashStrVariant.Create();
vv := Unassigned;
while (uvcount > 0) do
begin