mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
- getangle in animatesprites
This commit is contained in:
parent
478672879e
commit
d700b11887
2 changed files with 17 additions and 15 deletions
|
@ -46,6 +46,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothratio)
|
||||
{
|
||||
DVector2 viewVec(x * inttoworld, y * inttoworld);
|
||||
int k, p;
|
||||
int l, t1, t3, t4;
|
||||
tspritetype* t;
|
||||
|
@ -219,7 +220,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
t->xrepeat = 0;
|
||||
else
|
||||
{
|
||||
t->set_int_ang(getangle(x - t->int_pos().X, y - t->int_pos().Y));
|
||||
t->angle = VecToAngle(viewVec - t->pos.XY());
|
||||
t->pos.X = OwnerAc->spr.pos.X + t->angle.Cos();
|
||||
t->pos.Y = OwnerAc->spr.pos.Y + t->angle.Sin();
|
||||
}
|
||||
|
@ -260,7 +261,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
break;
|
||||
}
|
||||
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
if (k > 6)
|
||||
{
|
||||
|
@ -278,7 +279,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
break;
|
||||
}
|
||||
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
if (h->temp_data[0] < 4)
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
else k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
|
@ -510,7 +511,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
break;
|
||||
|
||||
case 5:
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) >> 8) & 7;
|
||||
if (k > 4)
|
||||
{
|
||||
|
@ -520,7 +521,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
||||
break;
|
||||
case 7:
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
if (k > 6)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothratio)
|
||||
{
|
||||
DVector2 viewVec(x * inttoworld, y * inttoworld);
|
||||
int k, p;
|
||||
int l, t1, t3, t4;
|
||||
tspritetype* t;
|
||||
|
@ -213,7 +214,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
t->xrepeat = 0;
|
||||
else
|
||||
{
|
||||
t->set_int_ang(getangle(x - t->int_pos().X, y - t->int_pos().Y));
|
||||
t->angle = VecToAngle(viewVec - t->pos.XY());
|
||||
t->pos.X = OwnerAc->spr.pos.X + t->angle.Cos();
|
||||
t->pos.Y = OwnerAc->spr.pos.Y + t->angle.Sin();
|
||||
}
|
||||
|
@ -254,7 +255,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
}
|
||||
else if (OwnerAc->spr.picnum == MAMA)
|
||||
{
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) >> 8) & 7;
|
||||
if (k > 4)
|
||||
{
|
||||
|
@ -272,7 +273,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
break;
|
||||
case EMPTYBIKE:
|
||||
if (!isRRRA()) goto default_case;
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
if (k > 6)
|
||||
{
|
||||
|
@ -284,7 +285,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
break;
|
||||
case EMPTYBOAT:
|
||||
if (!isRRRA()) goto default_case;
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
if (k > 6)
|
||||
{
|
||||
|
@ -295,7 +296,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
t->picnum = EMPTYBOAT + k;
|
||||
break;
|
||||
case RPG:
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
if (k > 6)
|
||||
{
|
||||
|
@ -307,7 +308,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
break;
|
||||
case RPG2:
|
||||
if (!isRRRA()) goto default_case;
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
if (k > 6)
|
||||
{
|
||||
|
@ -320,7 +321,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
|
||||
case RECON:
|
||||
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
if (h->temp_data[0] < 4)
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
else k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
|
@ -642,7 +643,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
break;
|
||||
|
||||
case 5:
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) >> 8) & 7;
|
||||
if (k > 4)
|
||||
{
|
||||
|
@ -652,7 +653,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
|
||||
break;
|
||||
case 7:
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) / 170);
|
||||
if (k > 6)
|
||||
{
|
||||
|
@ -669,7 +670,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
bg = badguy(h);
|
||||
if (bg && h->spr.statnum == 2 && h->spr.extra > 0)
|
||||
{
|
||||
k = getangle(h->int_pos().X - x, h->int_pos().Y - y);
|
||||
k = getangle(h->spr.pos - viewVec);
|
||||
k = (((h->int_ang() + 3072 + 128 - k) & 2047) >> 8) & 7;
|
||||
if (k > 4)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue