mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-17 10:11:12 +00:00
Minimum bounce speed
This commit is contained in:
parent
5054ce72e0
commit
10818f254b
1 changed files with 11 additions and 0 deletions
11
src/k_kart.c
11
src/k_kart.c
|
@ -1070,6 +1070,17 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce)
|
||||||
|
|
||||||
momdifx = mobj1->momx - mobj2->momx;
|
momdifx = mobj1->momx - mobj2->momx;
|
||||||
momdify = mobj1->momy - mobj2->momy;
|
momdify = mobj1->momy - mobj2->momy;
|
||||||
|
|
||||||
|
// if the speed difference is less than this let's assume they're going proportionately faster from each other
|
||||||
|
if (P_AproxDistance(momdifx, momdify) < 25*FRACUNIT/2)
|
||||||
|
{
|
||||||
|
fixed_t momdiflength = P_AproxDistance(momdifx, momdify);
|
||||||
|
fixed_t normalisedx = FixedDiv(momdifx, momdiflength);
|
||||||
|
fixed_t normalisedy = FixedDiv(momdify, momdiflength);
|
||||||
|
momdifx = FixedMul(25*FRACUNIT/2, normalisedx);
|
||||||
|
momdify = FixedMul(25*FRACUNIT/2, normalisedy);
|
||||||
|
}
|
||||||
|
|
||||||
distx = mobj1->x - mobj2->x;
|
distx = mobj1->x - mobj2->x;
|
||||||
disty = mobj1->y - mobj2->y;
|
disty = mobj1->y - mobj2->y;
|
||||||
dot = FixedMul(momdifx, distx) + FixedMul(momdify, disty);
|
dot = FixedMul(momdifx, distx) + FixedMul(momdify, disty);
|
||||||
|
|
Loading…
Reference in a new issue