X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_triggers.pas;h=a4dcc0afbf82de2c2c7543b62bd60bad97afc9ec;hb=55f201758f237cac6c889e98572e6eda7c4067fc;hp=1673cefedadeab37f1f565cd3b100a7a6684119c;hpb=281969a1bea9afbf36babebcf9208549929a96f4;p=d2df-sdl.git diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index 1673cef..a4dcc0a 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -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 @@ -20,7 +19,7 @@ interface uses SysUtils, Variants, Classes, - MAPDEF, e_graphics, g_basic, g_sound, + MAPDEF, g_basic, g_sound, xdynrec, hashtable, exoma; type @@ -102,12 +101,19 @@ var implementation -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, - g_options, g_net, g_netmsg, utils, xparser, xstreams; + uses + {$IFDEF ENABLE_GFX} + g_gfx, + {$ENDIF} + {$IFDEF ENABLE_SHELLS} + g_shells, + {$ENDIF} + Math, + g_player, g_map, g_panel, g_game, + g_console, g_monsters, g_items, g_phys, g_weapons, + wadreader, e_log, g_language, e_res, + g_options, g_net, g_netmsg, utils, xparser, xstreams + ; const TRIGGER_SIGNATURE = $58475254; // 'TRGX' @@ -665,11 +671,8 @@ function tr_SpawnShot (ShotType: Integer; wx, wy, dx, dy: Integer; ShotSound: Bo var snd: string; Projectile: Boolean; - TextureID: DWORD; - Anim: TAnimation; begin result := -1; - TextureID := DWORD(-1); snd := 'SOUND_WEAPON_FIREROCKET'; Projectile := true; @@ -681,7 +684,9 @@ begin Projectile := False; if ShotSound then begin - g_Player_CreateShell(wx, wy, 0, -2, SHELL_BULLET); + {$IFDEF ENABLE_SHELLS} + g_Shells_Create(wx, wy, 0, -2, SHELL_BULLET); + {$ENDIF} if g_Game_IsNet then MH_SEND_Effect(wx, wy, 0, NET_GFX_SHELL1); end; end; @@ -694,7 +699,9 @@ begin Projectile := False; if ShotSound then begin - g_Player_CreateShell(wx, wy, 0, -2, SHELL_BULLET); + {$IFDEF ENABLE_SHELLS} + g_Shells_Create(wx, wy, 0, -2, SHELL_BULLET); + {$ENDIF} if g_Game_IsNet then MH_SEND_Effect(wx, wy, 0, NET_GFX_SHELL1); end; end; @@ -706,7 +713,9 @@ begin Projectile := False; if ShotSound then begin - g_Player_CreateShell(wx, wy, 0, -2, SHELL_SHELL); + {$IFDEF ENABLE_SHELLS} + g_Shells_Create(wx, wy, 0, -2, SHELL_SHELL); + {$ENDIF} if g_Game_IsNet then MH_SEND_Effect(wx, wy, 0, NET_GFX_SHELL2); end; end; @@ -718,8 +727,10 @@ begin Projectile := False; if ShotSound then begin - g_Player_CreateShell(wx, wy, 0, -2, SHELL_SHELL); - g_Player_CreateShell(wx, wy, 0, -2, SHELL_SHELL); + {$IFDEF ENABLE_SHELLS} + g_Shells_Create(wx, wy, 0, -2, SHELL_SHELL); + g_Shells_Create(wx, wy, 0, -2, SHELL_SHELL); + {$ENDIF} if g_Game_IsNet then MH_SEND_Effect(wx, wy, 0, NET_GFX_SHELL3); end; end; @@ -780,13 +791,9 @@ begin TRIGGER_SHOT_EXPL: begin - if g_Frames_Get(TextureID, 'FRAMES_EXPLODE_ROCKET') then - begin - Anim := TAnimation.Create(TextureID, False, 6); - Anim.Blending := False; - g_GFX_OnceAnim(wx-64, wy-64, Anim); - Anim.Free(); - end; + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, wx - 64, wy - 64); + {$ENDIF} Projectile := False; g_Weapon_Explode(wx, wy, 60, 0); snd := 'SOUND_WEAPON_EXPLODEROCKET'; @@ -794,13 +801,9 @@ begin TRIGGER_SHOT_BFGEXPL: begin - if g_Frames_Get(TextureID, 'FRAMES_EXPLODE_BFG') then - begin - Anim := TAnimation.Create(TextureID, False, 6); - Anim.Blending := False; - g_GFX_OnceAnim(wx-64, wy-64, Anim); - Anim.Free(); - end; + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, wx - 64, wy - 64); + {$ENDIF} Projectile := False; g_Weapon_BFG9000(wx, wy, 0); snd := 'SOUND_WEAPON_EXPLODEBFG'; @@ -867,59 +870,49 @@ end; procedure tr_MakeEffect (X, Y, VX, VY: Integer; T, ST, CR, CG, CB: Byte; Silent, Send: Boolean); -var - FramesID: DWORD; - Anim: TAnimation; begin - if T = TRIGGER_EFFECT_PARTICLE then - begin - case ST of - TRIGGER_EFFECT_SLIQUID: - begin - if (CR = 255) and (CG = 0) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 1, 0, 0, 0) - else if (CR = 0) and (CG = 255) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 2, 0, 0, 0) - else if (CR = 0) and (CG = 0) and (CB = 255) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 3, 0, 0, 0) - else g_GFX_SimpleWater(X, Y, 1, VX, VY, 0, 0, 0, 0); - end; - TRIGGER_EFFECT_LLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 4, CR, CG, CB); - TRIGGER_EFFECT_DLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 5, CR, CG, CB); - TRIGGER_EFFECT_BLOOD: g_GFX_Blood(X, Y, 1, VX, VY, 0, 0, CR, CG, CB); - TRIGGER_EFFECT_SPARK: g_GFX_Spark(X, Y, 1, GetAngle2(VX, VY), 0, 0); - TRIGGER_EFFECT_BUBBLE: g_GFX_Bubbles(X, Y, 1, 0, 0); + {$IFDEF ENABLE_GFX} + if T = TRIGGER_EFFECT_PARTICLE then + begin + case ST of + TRIGGER_EFFECT_SLIQUID: + begin + if (CR = 255) and (CG = 0) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 1, 0, 0, 0) + else if (CR = 0) and (CG = 255) and (CB = 0) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 2, 0, 0, 0) + else if (CR = 0) and (CG = 0) and (CB = 255) then g_GFX_SimpleWater(X, Y, 1, VX, VY, 3, 0, 0, 0) + else g_GFX_SimpleWater(X, Y, 1, VX, VY, 0, 0, 0, 0); + end; + TRIGGER_EFFECT_LLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 4, CR, CG, CB); + TRIGGER_EFFECT_DLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 5, CR, CG, CB); + TRIGGER_EFFECT_BLOOD: g_GFX_Blood(X, Y, 1, VX, VY, 0, 0, CR, CG, CB); + TRIGGER_EFFECT_SPARK: g_GFX_Spark(X, Y, 1, GetAngle2(VX, VY), 0, 0); + TRIGGER_EFFECT_BUBBLE: g_GFX_Bubbles(X, Y, 1, 0, 0); + end; end; - end; + {$ENDIF} if T = TRIGGER_EFFECT_ANIMATION then begin case ST of EFFECT_TELEPORT: begin - if g_Frames_Get(FramesID, 'FRAMES_TELEPORT') then - begin - Anim := TAnimation.Create(FramesID, False, 3); - if not Silent then g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y); - g_GFX_OnceAnim(X-32, Y-32, Anim); - Anim.Free(); - end; + if not Silent then g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X - 32, Y - 32); + {$ENDIF} if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X, Y, Byte(not Silent), NET_GFX_TELE); end; EFFECT_RESPAWN: begin - if g_Frames_Get(FramesID, 'FRAMES_ITEM_RESPAWN') then - begin - Anim := TAnimation.Create(FramesID, False, 4); - if not Silent then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y); - g_GFX_OnceAnim(X-16, Y-16, Anim); - Anim.Free(); - end; + if not Silent then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X - 16, Y - 16); + {$ENDIF} if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X-16, Y-16, Byte(not Silent), NET_GFX_RESPAWN); end; EFFECT_FIRE: begin - if g_Frames_Get(FramesID, 'FRAMES_FIRE') then - begin - Anim := TAnimation.Create(FramesID, False, 4); - if not Silent then g_Sound_PlayExAt('SOUND_FIRE', X, Y); - g_GFX_OnceAnim(X-32, Y-128, Anim); - Anim.Free(); - end; + if not Silent then g_Sound_PlayExAt('SOUND_FIRE', X, Y); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect(R_GFX_FIRE, X - 32, Y - 128); + {$ENDIF} if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X-32, Y-128, Byte(not Silent), NET_GFX_FIRE); end; end; @@ -1174,8 +1167,6 @@ var iid: LongWord; coolDown: Boolean; pAngle: Real; - FramesID: DWORD; - Anim: TAnimation; UIDType: Byte; TargetUID: Word; it: PItem; @@ -1225,7 +1216,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 @@ -1350,11 +1341,13 @@ begin begin Enabled := False; Result := True; - if gLMSRespawn = LMS_RESPAWN_NONE then + p := g_Player_Get(ActivateUID); + p.GetSecret(); + Inc(gCoopSecretsFound); + if g_Game_IsNet then begin - g_Player_Get(ActivateUID).GetSecret(); - Inc(gCoopSecretsFound); - if g_Game_IsNet then MH_SEND_GameStats(); + MH_SEND_GameStats(); + MH_SEND_GameEvent(NET_EV_SECRET, p.UID, ''); end; end; @@ -1467,7 +1460,7 @@ begin 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; @@ -1497,50 +1490,50 @@ begin 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 - if g_Frames_Get(FramesID, 'FRAMES_TELEPORT') then - begin - Anim := TAnimation.Create(FramesID, False, 3); - g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); - g_GFX_OnceAnim(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, - mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-32, Anim); - Anim.Free(); - end; + EFFECT_TELEPORT: + begin + g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_TELEPORT_FAST, + mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, + mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-32 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-32, 1, NET_GFX_TELE); end; - EFFECT_RESPAWN: begin - if g_Frames_Get(FramesID, 'FRAMES_ITEM_RESPAWN') then - begin - Anim := TAnimation.Create(FramesID, False, 4); - g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); - g_GFX_OnceAnim(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-16, - mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-16, Anim); - Anim.Free(); - end; + EFFECT_RESPAWN: + begin + g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_ITEM_RESPAWN, + mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-16, + mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-16 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-16, mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-16, 1, NET_GFX_RESPAWN); end; - EFFECT_FIRE: begin - if g_Frames_Get(FramesID, 'FRAMES_FIRE') then - begin - Anim := TAnimation.Create(FramesID, False, 4); - g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); - g_GFX_OnceAnim(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, - mon.Obj.Y+mon.Obj.Rect.Y+mon.Obj.Rect.Height-128, Anim); - Anim.Free(); - end; + EFFECT_FIRE: + begin + g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_FIRE, + mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, + mon.Obj.Y+mon.Obj.Rect.Y+mon.Obj.Rect.Height-128 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32, mon.Obj.Y+mon.Obj.Rect.Y+mon.Obj.Rect.Height-128, 1, @@ -1582,7 +1575,7 @@ 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; @@ -1591,54 +1584,54 @@ begin 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 + EFFECT_TELEPORT: + begin it := g_Items_ByIdx(iid); - if g_Frames_Get(FramesID, 'FRAMES_TELEPORT') then - begin - Anim := TAnimation.Create(FramesID, False, 3); - g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); - g_GFX_OnceAnim(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, - it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-32, Anim); - Anim.Free(); - end; + g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_TELEPORT_FAST, + it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, + it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-32 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-32, 1, NET_GFX_TELE); end; - EFFECT_RESPAWN: begin + EFFECT_RESPAWN: + begin it := g_Items_ByIdx(iid); - if g_Frames_Get(FramesID, 'FRAMES_ITEM_RESPAWN') then - begin - Anim := TAnimation.Create(FramesID, False, 4); - g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); - g_GFX_OnceAnim(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-16, - it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-16, Anim); - Anim.Free(); - end; + g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_ITEM_RESPAWN, + it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-16, + it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-16 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-16, it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-16, 1, NET_GFX_RESPAWN); end; - EFFECT_FIRE: begin + EFFECT_FIRE: + begin it := g_Items_ByIdx(iid); - if g_Frames_Get(FramesID, 'FRAMES_FIRE') then - begin - Anim := TAnimation.Create(FramesID, False, 4); - g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); - g_GFX_OnceAnim(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, - it.Obj.Y+it.Obj.Rect.Y+it.Obj.Rect.Height-128, Anim); - Anim.Free(); - end; + g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY); + {$IFDEF ENABLE_GFX} + g_GFX_QueueEffect( + R_GFX_FIRE, + it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, + it.Obj.Y+it.Obj.Rect.Y+it.Obj.Rect.Height-128 + ); + {$ENDIF} if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32, it.Obj.Y+it.Obj.Rect.Y+it.Obj.Rect.Height-128, 1, @@ -2107,7 +2100,14 @@ 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 @@ -2127,7 +2127,10 @@ begin // Íàíîñèì óðîí ìîíñòðó if (TriggerType = TRIGGER_DAMAGE) and (tgcAmount > 0) then - m.Damage(tgcAmount, 0, 0, 0, HIT_SOME); + begin + m.Damage(tgcAmount, 0, 0, 0, tgcKind); + if (tgcKind = HIT_FLAME) then m.CatchFire(0); + end; // Ëå÷èì ìîíñòðà if (TriggerType = TRIGGER_HEALTH) and (tgcAmount > 0) then @@ -2335,7 +2338,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 @@ -2509,17 +2512,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 @@ -2545,18 +2538,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])); @@ -2611,8 +2593,9 @@ var begin if (tgMonsList = nil) then tgMonsList := TSimpleMonsterList.Create(); - if gTriggers = nil then - Exit; + if gTriggers = nil then Exit; + if gLMSRespawn > LMS_RESPAWN_NONE then Exit; // don't update triggers at all + SetLength(Affected, 0); for a := 0 to High(gTriggers) do @@ -2698,17 +2681,14 @@ begin begin if (SoundPlayCount > 0) and (not Sound.IsPlaying()) then begin - if tgcPlayCount > 0 then SoundPlayCount -= 1; // Åñëè 0 - èãðàåì çâóê áåñêîíå÷íî + if tgcPlayCount > 0 then Dec(SoundPlayCount); (* looped sound if zero *) if tgcLocal then - begin - Sound.PlayVolumeAt(X+(Width div 2), Y+(Height div 2), tgcVolume/255.0); - end + Sound.PlayVolumeAtRect(X, Y, Width, Height, tgcVolume / 255.0) else - begin - Sound.PlayPanVolume((tgcPan-127.0)/128.0, tgcVolume/255.0); - end; - if Sound.IsPlaying() and g_Game_IsNet and g_Game_IsServer then MH_SEND_TriggerSound(gTriggers[a]); - end; + Sound.PlayPanVolume((tgcPan - 127.0) / 128.0, tgcVolume / 255.0); + if Sound.IsPlaying() and g_Game_IsNet and g_Game_IsServer then + MH_SEND_TriggerSound(gTriggers[a]) + end end; // Òðèããåð "Ëîâóøêà" - ïîðà îòêðûâàòü @@ -3068,11 +3048,20 @@ end; 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;