mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-28 12:10:42 +00:00
Making RotateThings a bit nicer??
This commit is contained in:
parent
6616b030bb
commit
5a4d9f885b
1 changed files with 12 additions and 12 deletions
|
@ -1262,6 +1262,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
|
||||||
{
|
{
|
||||||
static INT32 pomovecount = 10000;
|
static INT32 pomovecount = 10000;
|
||||||
INT32 x, y;
|
INT32 x, y;
|
||||||
|
angle_t deltafine = delta >> ANGLETOFINESHIFT;
|
||||||
|
|
||||||
pomovecount++;
|
pomovecount++;
|
||||||
|
|
||||||
|
@ -1304,27 +1305,26 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
{
|
{
|
||||||
fixed_t newxoff, newyoff, oldxoff, oldyoff;
|
fixed_t oldxoff, oldyoff, newxoff, newyoff;
|
||||||
angle_t angletoobj = R_PointToAngle2(origin.x, origin.y, mo->x, mo->y);
|
fixed_t c, s;
|
||||||
fixed_t disttoobj = R_PointToDist2(origin.x, origin.y, mo->x, mo->y);
|
|
||||||
|
c = FINECOSINE(deltafine);
|
||||||
|
s = FINESINE(deltafine);
|
||||||
|
|
||||||
oldxoff = mo->x-origin.x;
|
oldxoff = mo->x-origin.x;
|
||||||
oldyoff = mo->y-origin.y;
|
oldyoff = mo->y-origin.y;
|
||||||
|
|
||||||
if (mo->player) // Hack to fix players sliding off of spinning polys -Red
|
if (mo->player) // Hack to fix players sliding off of spinning polys -Red
|
||||||
{
|
{
|
||||||
angle_t temp;
|
fixed_t temp;
|
||||||
angletoobj += delta;
|
|
||||||
|
|
||||||
temp = angletoobj >> ANGLETOFINESHIFT;
|
temp = FixedMul(oldxoff, c)-FixedMul(oldyoff, s);
|
||||||
oldxoff = FixedMul(FINECOSINE(temp), disttoobj);
|
oldyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s);
|
||||||
oldyoff = FixedMul(FINESINE(temp), disttoobj);
|
oldxoff = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
angletoobj += delta;
|
newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s);
|
||||||
angletoobj >>= ANGLETOFINESHIFT;
|
newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s);
|
||||||
newxoff = FixedMul(FINECOSINE(angletoobj), disttoobj);
|
|
||||||
newyoff = FixedMul(FINESINE(angletoobj), disttoobj);
|
|
||||||
|
|
||||||
Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff);
|
Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue