equal
deleted
inserted
replaced
3295 |
3295 |
3296 procedure doStepMovingPortal(Gear: PGear); |
3296 procedure doStepMovingPortal(Gear: PGear); |
3297 var |
3297 var |
3298 x, y, tx, ty: LongInt; |
3298 x, y, tx, ty: LongInt; |
3299 //, bx, by, tangle: LongInt; |
3299 //, bx, by, tangle: LongInt; |
3300 s, dx, dy: hwFloat; |
3300 s: hwFloat; |
3301 |
3301 |
3302 procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); |
3302 procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); |
3303 var |
3303 var |
3304 flags: LongWord; |
3304 flags: LongWord; |
3305 begin |
3305 begin |
3348 EXIT; |
3348 EXIT; |
3349 end; |
3349 end; |
3350 |
3350 |
3351 // making a normalized normal vector |
3351 // making a normalized normal vector |
3352 s := _1/DistanceI(tx,ty); |
3352 s := _1/DistanceI(tx,ty); |
3353 dx := -s * ty; |
3353 Gear^.dX := s * ty; |
3354 dy := s * tx; |
3354 Gear^.dY := -s * tx; |
3355 |
3355 |
3356 // make sure the vector is pointing outwards |
3356 Gear^.DirAngle := DxDy2Angle(-Gear^.dY,Gear^.dX); |
3357 if not (Gear^.dX*dx + Gear^.dY*dy).isNegative then |
|
3358 begin |
|
3359 dx := -dx; |
|
3360 dy := -dy; |
|
3361 end; |
|
3362 |
|
3363 Gear^.dX := dx; |
|
3364 Gear^.dY := dy; |
|
3365 |
|
3366 Gear^.DirAngle := DxDy2Angle(-dy,dx); |
|
3367 if not Gear^.dX.isNegative then Gear^.DirAngle := 180-Gear^.DirAngle; |
3357 if not Gear^.dX.isNegative then Gear^.DirAngle := 180-Gear^.DirAngle; |
3368 |
3358 |
3369 if ((Gear^.IntersectGear = nil) |
3359 if ((Gear^.IntersectGear = nil) |
3370 or (hwRound(Distance(Gear^.X - Gear^.IntersectGear^.X,Gear^.Y-Gear^.IntersectGear^.Y)) >= |
3360 or (hwRound(Distance(Gear^.X - Gear^.IntersectGear^.X,Gear^.Y-Gear^.IntersectGear^.Y)) >= |
3371 Gear^.Radius*2)) |
3361 Gear^.Radius*2)) |
3392 |
3382 |
3393 // Adds the hog speed (only that part in/directly against shot direction) |
3383 // Adds the hog speed (only that part in/directly against shot direction) |
3394 // to the shot speed (which we triple previously btw) |
3384 // to the shot speed (which we triple previously btw) |
3395 // (This is done my projecting the hog movement vector onto the shot movement vector and then adding the resulting length |
3385 // (This is done my projecting the hog movement vector onto the shot movement vector and then adding the resulting length |
3396 // to the scaler) |
3386 // to the scaler) |
3397 s := _3 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s; |
3387 s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s; |
3398 newPortal^.dX := newPortal^.dX * s; |
3388 newPortal^.dX := newPortal^.dX * s; |
3399 newPortal^.dY := newPortal^.dY * s; |
3389 newPortal^.dY := newPortal^.dY * s; |
3400 |
3390 |
3401 newPortal^.IntersectGear := nil; |
3391 newPortal^.IntersectGear := nil; |
3402 |
3392 |