equal
deleted
inserted
replaced
23 uses uConsts, uFloat, uTypes, uAIMisc; |
23 uses uConsts, uFloat, uTypes, uAIMisc; |
24 const |
24 const |
25 amtest_Rare = $00000001; // check only several positions |
25 amtest_Rare = $00000001; // check only several positions |
26 amtest_NoTarget = $00000002; // each pos, but no targetting |
26 amtest_NoTarget = $00000002; // each pos, but no targetting |
27 amtest_MultipleAttacks = $00000004; // test could result in multiple attacks, set AttacksNum |
27 amtest_MultipleAttacks = $00000004; // test could result in multiple attacks, set AttacksNum |
28 amtest_NoTrackFall = $00000008; // skip fall tracing. |
28 amtest_NoTrackFall = $00000008; // skip fall tracing. |
29 amtest_LaserSight = $00000010; // supports laser sighting |
29 amtest_LaserSight = $00000010; // supports laser sighting |
30 amtest_NoVampiric = $00000020; // don't use vampirism with this ammo |
30 amtest_NoVampiric = $00000020; // don't use vampirism with this ammo |
31 amtest_NoInvulnerable = $00000040; // don't use invulnerable with this with ammo |
31 amtest_NoInvulnerable = $00000040; // don't use invulnerable with this with ammo |
32 amtest_NoLowGravity = $00000080; // don't use low gravity with this with ammo |
32 amtest_NoLowGravity = $00000080; // don't use low gravity with this with ammo |
33 |
33 |
149 (proc: @TestMinigun; flags: amtest_LaserSight), // amMinigun |
149 (proc: @TestMinigun; flags: amtest_LaserSight), // amMinigun |
150 (proc: nil; flags: 0) // amSentry |
150 (proc: nil; flags: 0) // amSentry |
151 ); |
151 ); |
152 |
152 |
153 implementation |
153 implementation |
154 uses uVariables, uUtils, uGearsHandlers; |
154 uses uVariables, uUtils, uGearsHandlers, uLandUtils; |
155 |
155 |
156 function Metric(x1, y1, x2, y2: LongInt): LongInt; inline; |
156 function Metric(x1, y1, x2, y2: LongInt): LongInt; |
157 begin |
157 begin |
158 Metric:= abs(x1 - x2) + abs(y1 - y2) |
158 Metric:= abs(x1 - x2) + abs(y1 - y2) |
159 end; |
159 end; |
160 |
160 |
161 function TestBazooka(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams; Flags: LongWord): LongInt; |
161 function TestBazooka(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams; Flags: LongWord): LongInt; |
1079 ix:= trunc(x); |
1079 ix:= trunc(x); |
1080 iy:= trunc(y); |
1080 iy:= trunc(y); |
1081 |
1081 |
1082 if ((ix and LAND_WIDTH_MASK) = 0) and ((iy and LAND_HEIGHT_MASK) = 0) then |
1082 if ((ix and LAND_WIDTH_MASK) = 0) and ((iy and LAND_HEIGHT_MASK) = 0) then |
1083 repeat |
1083 repeat |
1084 if Land[iy, ix] <> 0 then |
1084 if LandGet(iy, ix) <> 0 then |
1085 inc(d); |
1085 inc(d); |
1086 x:= x + vX; |
1086 x:= x + vX; |
1087 y:= y + vY; |
1087 y:= y + vY; |
1088 ix:= trunc(x); |
1088 ix:= trunc(x); |
1089 iy:= trunc(y); |
1089 iy:= trunc(y); |
1135 |
1135 |
1136 repeat |
1136 repeat |
1137 x:= x + vX; |
1137 x:= x + vX; |
1138 y:= y + vY; |
1138 y:= y + vY; |
1139 if ((trunc(x) and LAND_WIDTH_MASK) = 0)and((trunc(y) and LAND_HEIGHT_MASK) = 0) |
1139 if ((trunc(x) and LAND_WIDTH_MASK) = 0)and((trunc(y) and LAND_HEIGHT_MASK) = 0) |
1140 and (Land[trunc(y), trunc(x)] <> 0) then |
1140 and (LandGet(trunc(y), trunc(x)) <> 0) then |
1141 inc(d); |
1141 inc(d); |
1142 until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 4) |
1142 until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 4) |
1143 or (x < 0) |
1143 or (x < 0) |
1144 or (y < 0) |
1144 or (y < 0) |
1145 or (trunc(x) > LAND_WIDTH) |
1145 or (trunc(x) > LAND_WIDTH) |