521 DeleteMe; |
521 DeleteMe; |
522 exit |
522 exit |
523 end; |
523 end; |
524 Gear.dX:= HHGear.X - Gear.X; |
524 Gear.dX:= HHGear.X - Gear.X; |
525 Gear.dY:= HHGear.Y - Gear.Y; |
525 Gear.dY:= HHGear.Y - Gear.Y; |
526 AddFileLog('Rope 1: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')'); |
526 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 1: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')'); |
527 AddFileLog('Rope 2: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')'); |
527 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 2: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')'); |
528 |
528 |
529 if (Gear.Message and gm_Left <> 0) then HHGear.dX:= HHGear.dX - 0.0002 else |
529 if (Gear.Message and gm_Left <> 0) then HHGear.dX:= HHGear.dX - 0.0002 else |
530 if (Gear.Message and gm_Right <> 0) then HHGear.dX:= HHGear.dX + 0.0002; |
530 if (Gear.Message and gm_Right <> 0) then HHGear.dX:= HHGear.dX + 0.0002; |
531 |
531 |
532 if not TestCollisionYwithGear(HHGear, 1) then |
532 if not TestCollisionYwithGear(HHGear, 1) then |
533 begin |
533 begin |
534 HHGear.dY:= HHGear.dY + cGravity; |
534 HHGear.dY:= HHGear.dY + cGravity; |
535 AddFileLog('Rope 4: free fall'); |
535 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 4: free fall'); |
536 end; |
536 end; |
537 |
537 |
538 AddFileLog('Rope 3: ' + floattostr(HHGear.dY)); |
538 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 3: ' + floattostr(HHGear.dY)); |
539 |
539 |
540 cs:= Gear.dY + HHGear.dY; |
540 cs:= Gear.dY + HHGear.dY; |
541 cc:= Gear.dX + HHGear.dX; |
541 cc:= Gear.dX + HHGear.dX; |
542 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
542 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
543 cc:= cc * len; |
543 cc:= cc * len; |
544 cs:= cs * len; |
544 cs:= cs * len; |
545 |
545 |
546 AddFileLog('Rope 5: (' + floattostr(cc) + ',' + floattostr(cs) + ')'); |
546 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 5: (' + floattostr(cc) + ',' + floattostr(cs) + ')'); |
547 |
547 |
548 flCheck:= not flCheck; |
548 flCheck:= not flCheck; |
549 if flCheck then // check whether rope needs dividing |
549 if flCheck then // check whether rope needs dividing |
550 begin |
550 begin |
551 len:= Gear.Elasticity - 20; |
551 len:= Gear.Elasticity - 20; |
553 begin |
553 begin |
554 tx:= cc*len; |
554 tx:= cc*len; |
555 ty:= cs*len; |
555 ty:= cs*len; |
556 lx:= round(Gear.X + tx) + hwSign(HHGear.dX); |
556 lx:= round(Gear.X + tx) + hwSign(HHGear.dX); |
557 ly:= round(Gear.Y + ty) + hwSign(HHGear.dY); |
557 ly:= round(Gear.Y + ty) + hwSign(HHGear.dY); |
|
558 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope b: (' + inttostr(lx) + ',' + inttostr(ly) + ')'); |
558 if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then |
559 if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then |
559 begin |
560 begin |
|
561 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope b: !!'); |
560 with RopePoints.ar[RopePoints.Count] do |
562 with RopePoints.ar[RopePoints.Count] do |
561 begin |
563 begin |
562 X:= Gear.X; |
564 X:= Gear.X; |
563 Y:= Gear.Y; |
565 Y:= Gear.Y; |
564 if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle32(Gear.dY, Gear.dX); |
566 if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle32(Gear.dY, Gear.dX); |
577 end else |
579 end else |
578 if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
580 if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
579 begin |
581 begin |
580 tx:= RopePoints.ar[Pred(RopePoints.Count)].X; |
582 tx:= RopePoints.ar[Pred(RopePoints.Count)].X; |
581 ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; |
583 ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; |
|
584 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope a: (' + floattostr(tx) + ',' + floattostr(ty) + ')'); |
582 if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear.X) * (ty - HHGear.Y) > (tx - HHGear.X) * (ty - Gear.Y)) then |
585 if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear.X) * (ty - HHGear.Y) > (tx - HHGear.X) * (ty - Gear.Y)) then |
583 begin |
586 begin |
584 dec(RopePoints.Count); |
587 dec(RopePoints.Count); |
585 Gear.X:=RopePoints.ar[RopePoints.Count].X; |
588 Gear.X:=RopePoints.ar[RopePoints.Count].X; |
586 Gear.Y:=RopePoints.ar[RopePoints.Count].Y; |
589 Gear.Y:=RopePoints.ar[RopePoints.Count].Y; |
590 end; |
593 end; |
591 |
594 |
592 Gear.dX:= HHGear.X - Gear.X; |
595 Gear.dX:= HHGear.X - Gear.X; |
593 Gear.dY:= HHGear.Y - Gear.Y; |
596 Gear.dY:= HHGear.Y - Gear.Y; |
594 |
597 |
595 AddFileLog('Rope 6: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')'); |
598 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 6: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')'); |
596 |
599 |
597 cs:= Gear.dY + HHGear.dY; |
600 cs:= Gear.dY + HHGear.dY; |
598 cc:= Gear.dX + HHGear.dX; |
601 cc:= Gear.dX + HHGear.dX; |
599 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
602 len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
600 cc:= cc * len; |
603 cc:= cc * len; |
615 HHGear.Y:= Gear.Y + cs*Gear.Elasticity; |
618 HHGear.Y:= Gear.Y + cs*Gear.Elasticity; |
616 |
619 |
617 HHGear.dX:= HHGear.X - HHGear.dX; |
620 HHGear.dX:= HHGear.X - HHGear.dX; |
618 HHGear.dY:= HHGear.Y - HHGear.dY; |
621 HHGear.dY:= HHGear.Y - HHGear.dY; |
619 |
622 |
620 AddFileLog('Rope 7: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')'); |
623 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 7: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')'); |
621 AddFileLog('Rope 8: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')'); |
624 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 8: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')'); |
622 |
625 |
623 if TestCollisionXwithGear(HHGear, hwSign(HHGear.dX)) then |
626 if TestCollisionXwithGear(HHGear, hwSign(HHGear.dX)) then |
624 HHGear.dX:= -0.6 * HHGear.dX; |
627 HHGear.dX:= -0.6 * HHGear.dX; |
625 if TestCollisionYwithGear(HHGear, hwSign(HHGear.dY)) then |
628 if TestCollisionYwithGear(HHGear, hwSign(HHGear.dY)) then |
626 HHGear.dY:= -0.6 * HHGear.dY; |
629 HHGear.dY:= -0.6 * HHGear.dY; |
627 |
630 |
628 AddFileLog('Rope 9: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')'); |
631 if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 9: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')'); |
629 |
632 |
630 if (Gear.Message and gm_Attack) <> 0 then |
633 if (Gear.Message and gm_Attack) <> 0 then |
631 if (Gear.State and gsttmpFlag) <> 0 then DeleteMe else |
634 if (Gear.State and gsttmpFlag) <> 0 then DeleteMe else |
632 else if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag; |
635 else if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag; |
633 end; |
636 end; |