From: FGSFDSFGS Date: Tue, 28 Feb 2017 15:12:45 +0000 (+0300) Subject: make turret explosions ignore the turret trigger X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=00c73a7e4b162b8adb061e4b4715ee35ba9a2df5;p=d2df-sdl.git make turret explosions ignore the turret trigger --- diff --git a/src/game/g_scriptprocs.pas b/src/game/g_scriptprocs.pas index 262ba33..a429704 100644 --- a/src/game/g_scriptprocs.pas +++ b/src/game/g_scriptprocs.pas @@ -1134,7 +1134,7 @@ begin if (ShotTarget > 0) and (ShotTarget < $FFFF) then ShotTargetW := ShotTarget; - lua_pushinteger(L, tr_SpawnShot(ShotType, wx, wy, dx, dy, not Silent, ShotTargetW)); + lua_pushinteger(L, tr_SpawnShot(ShotType, wx, wy, dx, dy, not Silent, ShotTargetW, DWORD(-1))); end; function SP_Lua_SpawnEffect(L: PScriptContext): Integer; cdecl; diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index b8e39d6..40de5b4 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -69,7 +69,7 @@ procedure g_Triggers_Press(ID: DWORD; ActivateType: Byte; ActivateUID: Word = 0) function g_Triggers_PressR(X, Y: Integer; Width, Height: Word; UID: Word; ActivateType: Byte; IgnoreList: DWArray = nil): DWArray; procedure g_Triggers_PressL(X1, Y1, X2, Y2: Integer; UID: DWORD; ActivateType: Byte); -procedure g_Triggers_PressC(CX, CY: Integer; Radius: Word; UID: Word; ActivateType: Byte); +procedure g_Triggers_PressC(CX, CY: Integer; Radius: Word; UID: Word; ActivateType: Byte; IgnoreTrigger: Integer = -1); procedure g_Triggers_OpenAll(); procedure g_Triggers_DecreaseSpawner(ID: DWORD); procedure g_Triggers_Free(); @@ -87,7 +87,7 @@ function tr_Teleport(ActivateUID: Integer; TX, TY: Integer; TDir: Integer; Silen function tr_Push(ActivateUID: Integer; VX, VY: Integer; ResetVel: Boolean): Boolean; procedure tr_MakeEffect(X, Y, VX, VY: Integer; T, ST, CR, CG, CB: Byte; Silent, Send: Boolean); -function tr_SpawnShot(ShotType: Integer; wx, wy, dx, dy: Integer; ShotSound: Boolean; ShotTarget: Word): Integer; +function tr_SpawnShot(ShotType: Integer; wx, wy, dx, dy: Integer; ShotSound: Boolean; ShotTarget: Word; TID: DWORD): Integer; var gTriggerClientID: Integer = 0; @@ -427,7 +427,7 @@ begin end; end; -function tr_SpawnShot(ShotType: Integer; wx, wy, dx, dy: Integer; ShotSound: Boolean; ShotTarget: Word): Integer; +function tr_SpawnShot(ShotType: Integer; wx, wy, dx, dy: Integer; ShotSound: Boolean; ShotTarget: Word; TID: DWORD): Integer; var snd: string; Projectile: Boolean; @@ -435,6 +435,7 @@ var Anim: TAnimation; begin Result := -1; + TextureID := DWORD(-1); snd := 'SOUND_WEAPON_FIREROCKET'; Projectile := True; case ShotType of @@ -556,7 +557,7 @@ begin Anim.Free(); end; Projectile := False; - g_Weapon_Explode(wx, wy, 60, 0); + g_Weapon_Explode(wx, wy, 60, 0, TID); snd := 'SOUND_WEAPON_EXPLODEROCKET'; end; @@ -619,7 +620,7 @@ begin dx := dx + Random(Data.ShotAccuracy) - Random(Data.ShotAccuracy); dy := dy + Random(Data.ShotAccuracy) - Random(Data.ShotAccuracy); - tr_SpawnShot(Data.ShotType, wx, wy, dx, dy, Data.ShotSound, TargetUID); + tr_SpawnShot(Data.ShotType, wx, wy, dx, dy, Data.ShotSound, TargetUID, ID); end else if (Data.ShotIntReload > 0) and (ShotReloadTime = 0) then @@ -2472,7 +2473,7 @@ begin end; end; -procedure g_Triggers_PressC(CX, CY: Integer; Radius: Word; UID: Word; ActivateType: Byte); +procedure g_Triggers_PressC(CX, CY: Integer; Radius: Word; UID: Word; ActivateType: Byte; IgnoreTrigger: Integer = -1); var a: Integer; k: Byte; @@ -2498,7 +2499,8 @@ begin rsq := Radius * Radius; for a := 0 to High(gTriggers) do - if (gTriggers[a].TriggerType <> TRIGGER_NONE) and + if (gTriggers[a].ID <> DWORD(IgnoreTrigger)) and + (gTriggers[a].TriggerType <> TRIGGER_NONE) and (gTriggers[a].TimeOut = 0) and ((gTriggers[a].Keys and k) = gTriggers[a].Keys) and ByteBool(gTriggers[a].ActivateType and ActivateType) then diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas index bcbf4c1..2490827 100644 --- a/src/game/g_weapons.pas +++ b/src/game/g_weapons.pas @@ -76,7 +76,7 @@ procedure g_Weapon_mgun(x, y, xd, yd: Integer; SpawnerUID: Word; Silent: Boolean procedure g_Weapon_shotgun(x, y, xd, yd: Integer; SpawnerUID: Word; Silent: Boolean = False); procedure g_Weapon_dshotgun(x, y, xd, yd: Integer; SpawnerUID: Word; Silent: Boolean = False); -function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word): Boolean; +function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word; IgnoreTrigger: Integer = -1): Boolean; procedure g_Weapon_BFG9000(X, Y: Integer; SpawnerUID: Word); procedure g_Weapon_Update(); procedure g_Weapon_Draw(); @@ -796,14 +796,15 @@ begin end; end; -function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word): Boolean; +function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word; IgnoreTrigger: Integer = -1): Boolean; var i, h, r, dx, dy, m, mm: Integer; _angle: SmallInt; begin Result := False; - g_Triggers_PressC(X, Y, rad, SpawnerUID, ACTIVATE_SHOT); + // don't let turret explosions use the turret + g_Triggers_PressC(X, Y, rad, SpawnerUID, ACTIVATE_SHOT, IgnoreTrigger); r := rad*rad;