equal
deleted
inserted
replaced
27 |
27 |
28 implementation |
28 implementation |
29 |
29 |
30 uses SDLh, uFloat, uCollisions; |
30 uses SDLh, uFloat, uCollisions; |
31 |
31 |
|
32 |
|
33 |
32 const dirs: array[0..3] of TPoint = ((X: 0; Y: -1), (X: 1; Y: 0),(X: 0; Y: 1),(X: -1; Y: 0)); |
34 const dirs: array[0..3] of TPoint = ((X: 0; Y: -1), (X: 1; Y: 0),(X: 0; Y: 1),(X: -1; Y: 0)); |
33 |
35 |
34 procedure PrevAngle(Gear: PGear; dA: LongInt); inline; |
36 procedure PrevAngle(Gear: PGear; dA: LongInt); inline; |
35 begin |
37 begin |
36 Gear^.Angle := (LongInt(Gear^.Angle) + 4 - dA) mod 4 |
38 Gear^.Angle := (Gear^.Angle - dA) and 3 |
37 end; |
39 end; |
38 |
40 |
39 procedure NextAngle(Gear: PGear; dA: LongInt); inline; |
41 procedure NextAngle(Gear: PGear; dA: LongInt); inline; |
40 begin |
42 begin |
41 Gear^.Angle := (LongInt(Gear^.Angle) + 4 + dA) mod 4 |
43 Gear^.Angle := (Gear^.Angle + dA) and 3 |
42 end; |
44 end; |
43 |
45 |
44 procedure cakeStep(Gear: PGear); |
46 procedure cakeStep(Gear: PGear); |
45 var |
47 var |
46 xx, yy, xxn, yyn: LongInt; |
48 xx, yy, xxn, yyn: LongInt; |
48 tdx, tdy: hwFloat; |
50 tdx, tdy: hwFloat; |
49 begin |
51 begin |
50 dA := hwSign(Gear^.dX); |
52 dA := hwSign(Gear^.dX); |
51 xx := dirs[Gear^.Angle].x; |
53 xx := dirs[Gear^.Angle].x; |
52 yy := dirs[Gear^.Angle].y; |
54 yy := dirs[Gear^.Angle].y; |
53 xxn := dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].x; |
55 xxn := dirs[(Gear^.Angle + dA) and 3].x; |
54 yyn := dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].y; |
56 yyn := dirs[(Gear^.Angle + dA) and 3].y; |
55 |
57 |
56 if (xx = 0) then |
58 if (xx = 0) then |
57 if TestCollisionYwithGear(Gear, yy) <> 0 then |
59 if TestCollisionYwithGear(Gear, yy) <> 0 then |
58 PrevAngle(Gear, dA) |
60 PrevAngle(Gear, dA) |
59 else |
61 else |