Skip to content
This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
/ DF Public archive

Commit

Permalink
Triggers: Turret now targets the center of the object
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed Jan 2, 2016
1 parent afd75b6 commit b780cc8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions DF Sources/g_triggers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1393,8 +1393,8 @@ function ActivateTrigger(var Trigger: TTrigger; actType: Byte): Boolean;
if (gMonsters[i] <> nil) and gMonsters[i].Live and
g_Obj_Collide(X, Y, Width, Height, @(gMonsters[i].Obj)) then
begin
xd := gMonsters[i].GameX;
yd := gMonsters[i].GameY;
xd := gMonsters[i].GameX + gMonsters[i].Obj.Rect.Width div 2;
yd := gMonsters[i].GameY + gMonsters[i].Obj.Rect.Height div 2;
TargetUID := gMonsters[i].UID;
break;
end;
Expand All @@ -1405,8 +1405,8 @@ function ActivateTrigger(var Trigger: TTrigger; actType: Byte): Boolean;
if (gPlayers[i] <> nil) and gPlayers[i].Live and
g_Obj_Collide(X, Y, Width, Height, @(gPlayers[i].Obj))then
begin
xd := gPlayers[i].GameX;
yd := gPlayers[i].GameY;
xd := gPlayers[i].GameX + PLAYER_RECT_CX;
yd := gPlayers[i].GameY + PLAYER_RECT_CY;
TargetUID := gPlayers[i].UID;
break;
end;
Expand All @@ -1418,8 +1418,8 @@ function ActivateTrigger(var Trigger: TTrigger; actType: Byte): Boolean;
(gPlayers[i].Team = TEAM_RED) and
g_Obj_Collide(X, Y, Width, Height, @(gPlayers[i].Obj)) then
begin
xd := gPlayers[i].GameX;
yd := gPlayers[i].GameY;
xd := gPlayers[i].GameX + PLAYER_RECT_CX;
yd := gPlayers[i].GameY + PLAYER_RECT_CY;
TargetUID := gPlayers[i].UID;
break;
end;
Expand All @@ -1431,8 +1431,8 @@ function ActivateTrigger(var Trigger: TTrigger; actType: Byte): Boolean;
(gPlayers[i].Team = TEAM_BLUE) and
g_Obj_Collide(X, Y, Width, Height, @(gPlayers[i].Obj)) then
begin
xd := gPlayers[i].GameX;
yd := gPlayers[i].GameY;
xd := gPlayers[i].GameX + PLAYER_RECT_CX;
yd := gPlayers[i].GameY + PLAYER_RECT_CY;
TargetUID := gPlayers[i].UID;
break;
end;
Expand All @@ -1446,7 +1446,7 @@ function ActivateTrigger(var Trigger: TTrigger; actType: Byte): Boolean;
case Data.ShotType of
TRIGGER_SHOT_BULLET:
begin
g_Weapon_Pistol(wx, wy, xd, yd, 0);
g_Weapon_mgun(wx, wy, xd, yd, 0);
Projectile := False;
snd := 'SOUND_WEAPON_FIREPISTOL';
end;
Expand Down

0 comments on commit b780cc8

Please sign in to comment.