equal
deleted
inserted
replaced
122 function CheckTrace: LongInt; |
122 function CheckTrace: LongInt; |
123 var x, y, dX, dY: hwFloat; |
123 var x, y, dX, dY: hwFloat; |
124 t: LongInt; |
124 t: LongInt; |
125 value: LongInt; |
125 value: LongInt; |
126 begin |
126 begin |
127 with PHedgehog(Me^.Hedgehog)^ do |
127 x:= Me^.X; |
128 begin |
128 y:= Me^.Y; |
129 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
130 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
131 end; |
|
132 dX:= Vx; |
129 dX:= Vx; |
133 dY:= -Vy; |
130 dY:= -Vy; |
134 t:= rTime; |
131 t:= rTime; |
135 repeat |
132 repeat |
136 x:= x + dX; |
133 x:= x + dX; |
180 |
177 |
181 function CheckTrace: LongInt; |
178 function CheckTrace: LongInt; |
182 var x, y, dY: hwFloat; |
179 var x, y, dY: hwFloat; |
183 t: LongInt; |
180 t: LongInt; |
184 begin |
181 begin |
185 with PHedgehog(Me^.Hedgehog)^ do |
182 x:= Me^.X; |
186 begin |
183 y:= Me^.Y; |
187 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
188 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
189 end; |
|
190 dY:= -Vy; |
184 dY:= -Vy; |
191 t:= TestTime; |
185 t:= TestTime; |
192 repeat |
186 repeat |
193 x:= x + Vx; |
187 x:= x + Vx; |
194 y:= y + dY; |
188 y:= y + dY; |
235 |
229 |
236 function CheckTrace: LongInt; |
230 function CheckTrace: LongInt; |
237 var x, y, dY: hwFloat; |
231 var x, y, dY: hwFloat; |
238 t: LongInt; |
232 t: LongInt; |
239 begin |
233 begin |
240 with PHedgehog(Me^.Hedgehog)^ do |
234 x:= Me^.X; |
241 begin |
235 y:= Me^.Y; |
242 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
243 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
244 end; |
|
245 dY:= -Vy; |
236 dY:= -Vy; |
246 t:= TestTime; |
237 t:= TestTime; |
247 repeat |
238 repeat |
248 x:= x + Vx; |
239 x:= x + Vx; |
249 y:= y + dY; |
240 y:= y + dY; |
290 |
281 |
291 function CheckTrace: LongInt; |
282 function CheckTrace: LongInt; |
292 var x, y, dY: hwFloat; |
283 var x, y, dY: hwFloat; |
293 t: LongInt; |
284 t: LongInt; |
294 begin |
285 begin |
295 with PHedgehog(Me^.Hedgehog)^ do |
286 x:= Me^.X; |
296 begin |
287 y:= Me^.Y; |
297 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
298 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
299 end; |
|
300 dY:= -Vy; |
288 dY:= -Vy; |
301 t:= TestTime; |
289 t:= TestTime; |
302 repeat |
290 repeat |
303 x:= x + Vx; |
291 x:= x + Vx; |
304 y:= y + dY; |
292 y:= y + dY; |
349 |
337 |
350 function CheckTrace: LongInt; |
338 function CheckTrace: LongInt; |
351 var x, y, dY: hwFloat; |
339 var x, y, dY: hwFloat; |
352 t: LongInt; |
340 t: LongInt; |
353 begin |
341 begin |
354 with PHedgehog(Me^.Hedgehog)^ do |
342 x:= Me^.X; |
355 begin |
343 y:= Me^.Y; |
356 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
357 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
358 end; |
|
359 dY:= -Vy; |
344 dY:= -Vy; |
360 t:= TestTime; |
345 t:= TestTime; |
361 repeat |
346 repeat |
362 x:= x + Vx; |
347 x:= x + Vx; |
363 y:= y + dY; |
348 y:= y + dY; |
404 |
389 |
405 function CheckTrace: LongInt; |
390 function CheckTrace: LongInt; |
406 var x, y, dY: hwFloat; |
391 var x, y, dY: hwFloat; |
407 value: LongInt; |
392 value: LongInt; |
408 begin |
393 begin |
409 with PHedgehog(Me^.Hedgehog)^ do |
394 x:= Me^.X; |
410 begin |
395 y:= Me^.Y; |
411 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
412 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
413 end; |
|
414 dY:= -Vy; |
396 dY:= -Vy; |
415 |
397 |
416 repeat |
398 repeat |
417 x:= x + Vx; |
399 x:= x + Vx; |
418 y:= y + dY; |
400 y:= y + dY; |
492 range: integer; |
474 range: integer; |
493 begin |
475 begin |
494 ap.ExplR:= 0; |
476 ap.ExplR:= 0; |
495 ap.Time:= 0; |
477 ap.Time:= 0; |
496 ap.Power:= 1; |
478 ap.Power:= 1; |
497 with PHedgehog(Me^.Hedgehog)^ do |
479 x:= Me^.X; |
498 begin |
480 y:= Me^.Y; |
499 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
500 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
501 end; |
|
502 range:= Metric(hwRound(x), hwRound(y), Targ.X, Targ.Y); |
481 range:= Metric(hwRound(x), hwRound(y), Targ.X, Targ.Y); |
503 if ( range < MIN_RANGE ) or ( range > MAX_RANGE ) then exit(BadTurn); |
482 if ( range < MIN_RANGE ) or ( range > MAX_RANGE ) then exit(BadTurn); |
504 Vx:= (int2hwFloat(Targ.X) - x) * _1div1024; |
483 Vx:= (int2hwFloat(Targ.X) - x) * _1div1024; |
505 Vy:= (int2hwFloat(Targ.Y) - y) * _1div1024; |
484 Vy:= (int2hwFloat(Targ.Y) - y) * _1div1024; |
506 ap.Angle:= DxDy2AttackAngle(Vx, -Vy); |
485 ap.Angle:= DxDy2AttackAngle(Vx, -Vy); |
529 begin |
508 begin |
530 Level:= Level; // avoid compiler hint |
509 Level:= Level; // avoid compiler hint |
531 ap.ExplR:= 0; |
510 ap.ExplR:= 0; |
532 ap.Time:= 0; |
511 ap.Time:= 0; |
533 ap.Power:= 1; |
512 ap.Power:= 1; |
534 with PHedgehog(Me^.Hedgehog)^ do |
513 x:= Me^.X; |
535 begin |
514 y:= Me^.Y; |
536 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
537 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
538 end; |
|
539 if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 80 then |
515 if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 80 then |
540 exit(BadTurn); |
516 exit(BadTurn); |
541 t:= _0_5 / Distance(int2hwFloat(Targ.X) - x, int2hwFloat(Targ.Y) - y); |
517 t:= _0_5 / Distance(int2hwFloat(Targ.X) - x, int2hwFloat(Targ.Y) - y); |
542 Vx:= (int2hwFloat(Targ.X) - x) * t; |
518 Vx:= (int2hwFloat(Targ.X) - x) * t; |
543 Vy:= (int2hwFloat(Targ.Y) - y) * t; |
519 Vy:= (int2hwFloat(Targ.Y) - y) * t; |
565 if (Level > 2) or (Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) > 25) then |
541 if (Level > 2) or (Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) > 25) then |
566 exit(BadTurn); |
542 exit(BadTurn); |
567 |
543 |
568 ap.Time:= 0; |
544 ap.Time:= 0; |
569 ap.Power:= 1; |
545 ap.Power:= 1; |
570 with PHedgehog(Me^.Hedgehog)^ do |
546 x:= Me^.X; |
571 begin |
547 y:= Me^.Y; |
572 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
573 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
574 end; |
|
575 if (Targ.X) - hwRound(x) >= 0 then ap.Angle:= cMaxAngle div 4 |
548 if (Targ.X) - hwRound(x) >= 0 then ap.Angle:= cMaxAngle div 4 |
576 else ap.Angle:= - cMaxAngle div 4; |
549 else ap.Angle:= - cMaxAngle div 4; |
577 valueResult:= RateShove(Me, hwRound(x) + 10 * hwSign(int2hwFloat(Targ.X) - x), hwRound(y), 15, 30); |
550 valueResult:= RateShove(Me, hwRound(x) + 10 * hwSign(int2hwFloat(Targ.X) - x), hwRound(y), 15, 30); |
578 if valueResult <= 0 then valueResult:= BadTurn else inc(valueResult); |
551 if valueResult <= 0 then valueResult:= BadTurn else inc(valueResult); |
579 TestBaseballBat:= valueResult; |
552 TestBaseballBat:= valueResult; |
586 Level:= Level; // avoid compiler hint |
559 Level:= Level; // avoid compiler hint |
587 ap.ExplR:= 0; |
560 ap.ExplR:= 0; |
588 ap.Time:= 0; |
561 ap.Time:= 0; |
589 ap.Power:= 1; |
562 ap.Power:= 1; |
590 ap.Angle:= 0; |
563 ap.Angle:= 0; |
591 with PHedgehog(Me^.Hedgehog)^ do |
564 x:= Me^.X; |
592 begin |
565 y:= Me^.Y; |
593 x:= Me^.X + int2hwfloat(round(GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Me^.dX), Me^.Angle))); |
|
594 y:= Me^.Y + int2hwfloat(round(GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Me^.Angle))) |
|
595 end; |
|
596 if (Abs(hwRound(x) - Targ.X) > 25) |
566 if (Abs(hwRound(x) - Targ.X) > 25) |
597 or (Abs(hwRound(y) - 50 - Targ.Y) > 50) then |
567 or (Abs(hwRound(y) - 50 - Targ.Y) > 50) then |
598 begin |
568 begin |
599 if TestColl(hwRound(x), hwRound(y) - 16, 6) |
569 if TestColl(hwRound(x), hwRound(y) - 16, 6) |
600 and (RateShove(Me, hwRound(x) + 10 * hwSign(Me^.dX), hwRound(y) - 40, 30, 30) = 0) then |
570 and (RateShove(Me, hwRound(x) + 10 * hwSign(Me^.dX), hwRound(y) - 40, 30, 30) = 0) then |