Add bit 1 to action flags: use the viewpoint's position relative to the actor when calculating which rotation to display, instead of the viewpoint's angle, for viewtypes 2/3/4/8. 5/7 already do this.

git-svn-id: https://svn.eduke32.com/eduke32@5850 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-09-06 02:15:31 +00:00
parent d8ce0f042d
commit d466b2ae51
2 changed files with 23 additions and 6 deletions

View file

@ -110,6 +110,11 @@ enum actionparams
ACTION_PARAM_COUNT, ACTION_PARAM_COUNT,
}; };
enum actionflags
{
AF_VIEWPOINT = 1u<<0u,
};
#ifdef LUNATIC #ifdef LUNATIC
struct action struct action
{ {

View file

@ -4077,8 +4077,10 @@ PALONLY:
goto skip; goto skip;
l = apScript[scrofs_action + ACTION_VIEWTYPE]; l = apScript[scrofs_action + ACTION_VIEWTYPE];
uint16_t const action_flags = apScript[scrofs_action + ACTION_FLAGS];
#else #else
l = viewtype; l = viewtype;
uint16_t const action_flags = actor[i].ac.flags;
#endif #endif
#ifdef USE_OPENGL #ifdef USE_OPENGL
@ -4092,19 +4094,26 @@ PALONLY:
switch (l) switch (l)
{ {
case 2: case 2:
frameOffset = (((pSprite->ang+3072+128-oura)&2047)>>8)&1; {
int const viewAng = (action_flags & AF_VIEWPOINT) ? getangle(pSprite->x-ourx, pSprite->y-oury) : oura;
frameOffset = (((pSprite->ang + 3072 + 128 - viewAng) & 2047) >> 8) & 1;
break; break;
}
case 3: case 3:
case 4: case 4:
frameOffset = (((pSprite->ang+3072+128-oura)&2047)>>7)&7; {
int const viewAng = (action_flags & AF_VIEWPOINT) ? getangle(pSprite->x-ourx, pSprite->y-oury) : oura;
frameOffset = (((pSprite->ang + 3072 + 128 - viewAng) & 2047) >> 7) & 7;
if (frameOffset > 3) if (frameOffset > 3)
{ {
t->cstat |= 4; t->cstat |= 4;
frameOffset = 7-frameOffset; frameOffset = 7 - frameOffset;
} }
else t->cstat &= ~4; else
t->cstat &= ~4;
break; break;
}
case 5: case 5:
case -5: case -5:
@ -4116,10 +4125,13 @@ PALONLY:
break; break;
case 8: case 8:
case -8: case -8:
frameOffset = (l > 0) ? (((pSprite->ang + 3072 + 128 - oura) & 2047) >> 8) & 7 {
: (((oura + 3072 + 128 - pSprite->ang) & 2047) >> 8) & 7; int const viewAng = (action_flags & AF_VIEWPOINT) ? getangle(pSprite->x-ourx, pSprite->y-oury) : oura;
int const angDiff = l > 0 ? pSprite->ang - viewAng : viewAng - pSprite->ang;
frameOffset = (((angDiff + 3072 + 128) & 2047) >> 8) & 7;
t->cstat &= ~4; t->cstat &= ~4;
break; break;
}
default: default:
frameOffset = 0; frameOffset = 0;
break; break;