mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
Fix rotation-fixed useractors (those having usertype bit 4 set).
Rotation-fixing happens for a couple of hard-coded statnums that presumably never move (DEFAULT, STANDABLE, FX, FALLER, LIGHT), but for actors it wouldn't make sense since the common case is that they do move. For this reason, bit 4 was introduced in r1934. The position of such useractors will not diverge due to error roundoff accumulation in rotating sectors (SE0, train). git-svn-id: https://svn.eduke32.com/eduke32@3316 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4ea9f799b1
commit
6a4add81bd
5 changed files with 18 additions and 11 deletions
|
@ -632,12 +632,12 @@ void Sect_ClearInterpolation(int32_t sectnum)
|
|||
}
|
||||
}
|
||||
|
||||
static int32_t move_fixed_sprite(int32_t j, int32_t pivotspr, int32_t daang)
|
||||
static int32_t move_rotfixed_sprite(int32_t j, int32_t pivotspr, int32_t daang)
|
||||
{
|
||||
if ((FIXSPR_STATNUMP(sprite[j].statnum) ||
|
||||
if ((ROTFIXSPR_STATNUMP(sprite[j].statnum) ||
|
||||
((sprite[j].statnum==STAT_ACTOR || sprite[j].statnum==STAT_ZOMBIEACTOR) &&
|
||||
A_CheckSpriteTileFlags(sprite[j].picnum, SPRITE_BADGUY)))
|
||||
&& actor[j].t_data[7]==(0x18190000|pivotspr))
|
||||
A_CheckSpriteTileFlags(sprite[j].picnum, SPRITE_ROTFIXED)))
|
||||
&& actor[j].t_data[7]==(ROTFIXSPR_MAGIC|pivotspr))
|
||||
{
|
||||
rotatepoint(0,0, actor[j].t_data[8],actor[j].t_data[9], daang&2047, &sprite[j].x,&sprite[j].y);
|
||||
sprite[j].x += sprite[pivotspr].x;
|
||||
|
@ -1440,7 +1440,7 @@ ACTOR_STATIC void G_MoveStandables(void)
|
|||
KILLIT(i);
|
||||
|
||||
// 'fixed' sprites in rotating sectors already have bpos* updated
|
||||
if ((t[7]&(0xffff0000))!=0x18190000)
|
||||
if ((t[7]&(0xffff0000))!=ROTFIXSPR_MAGIC)
|
||||
Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t));
|
||||
|
||||
IFWITHIN(CRANE,CRANE+3)
|
||||
|
@ -5685,7 +5685,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
actor[p].bpos.x = sprite[p].x;
|
||||
actor[p].bpos.y = sprite[p].y;
|
||||
|
||||
if (move_fixed_sprite(p, j, t[2]))
|
||||
if (move_rotfixed_sprite(p, j, t[2]))
|
||||
rotatepoint(sprite[j].x,sprite[j].y,sprite[p].x,sprite[p].y,(q*l),&sprite[p].x,&sprite[p].y);
|
||||
}
|
||||
}
|
||||
|
@ -5913,7 +5913,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
actor[j].bpos.y = sprite[j].y;
|
||||
}
|
||||
|
||||
if (move_fixed_sprite(j, s-sprite, t[2]))
|
||||
if (move_rotfixed_sprite(j, s-sprite, t[2]))
|
||||
rotatepoint(s->x,s->y,sprite[j].x,sprite[j].y,q,&sprite[j].x,&sprite[j].y);
|
||||
|
||||
sprite[j].x+= m;
|
||||
|
|
|
@ -209,6 +209,9 @@ enum sflags_t {
|
|||
SPRITE_NOTELEPORT = 0x00004000,
|
||||
SPRITE_BADGUYSTAYPUT = 0x00008000,
|
||||
SPRITE_CACHE = 0x00010000,
|
||||
// rotation-fixed wrt a pivot point to prevent position diverging due to
|
||||
// roundoff error accumulation:
|
||||
SPRITE_ROTFIXED = 0x00020000,
|
||||
};
|
||||
|
||||
// custom projectiles
|
||||
|
|
|
@ -98,8 +98,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define TILE_VIEWSCR (MAXTILES-5)
|
||||
|
||||
// sprites with these statnums should be considered for fixing (bitmap)
|
||||
#define FIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
|
||||
#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
|
||||
(k)==STAT_FALLER || (k)==STAT_LIGHT)
|
||||
#define ROTFIXSPR_MAGIC 0x18190000
|
||||
|
||||
// JBF 20040604: sync is a function on some platforms
|
||||
#define sync dsync
|
||||
|
|
|
@ -2771,6 +2771,9 @@ static int32_t C_ParseCommand(int32_t loop)
|
|||
|
||||
if (j & 2)
|
||||
g_tile[*g_scriptPtr].flags |= (SPRITE_BADGUY|SPRITE_BADGUYSTAYPUT);
|
||||
|
||||
if (j & 4)
|
||||
g_tile[*g_scriptPtr].flags |= SPRITE_ROTFIXED;
|
||||
}
|
||||
|
||||
for (j=0; j<4; j++)
|
||||
|
|
|
@ -1003,9 +1003,9 @@ static void premap_setup_fixed_sprites(void)
|
|||
{
|
||||
// TRIPBOMB uses t_data[7] for its own purposes. Wouldn't be
|
||||
// too useful with moving sectors anyway
|
||||
if ((FIXSPR_STATNUMP(sprite[j].statnum) && sprite[j].picnum!=TRIPBOMB) ||
|
||||
if ((ROTFIXSPR_STATNUMP(sprite[j].statnum) && sprite[j].picnum!=TRIPBOMB) ||
|
||||
((sprite[j].statnum==STAT_ACTOR || sprite[j].statnum==STAT_ZOMBIEACTOR) &&
|
||||
A_CheckSpriteTileFlags(sprite[j].picnum, SPRITE_BADGUY)))
|
||||
A_CheckSpriteTileFlags(sprite[j].picnum, SPRITE_ROTFIXED)))
|
||||
{
|
||||
pivot = i;
|
||||
if (sprite[i].lotag==0)
|
||||
|
@ -1013,7 +1013,7 @@ static void premap_setup_fixed_sprites(void)
|
|||
if (j!=i && j!=pivot && pivot>=0 && pivot<MAXSPRITES)
|
||||
{
|
||||
// let's hope we don't step on anyone's toes here
|
||||
actor[j].t_data[7] = 0x18190000 | pivot; // 'rs' magic + pivot SE sprite index
|
||||
actor[j].t_data[7] = ROTFIXSPR_MAGIC | pivot; // 'rs' magic + pivot SE sprite index
|
||||
actor[j].t_data[8] = sprite[j].x - sprite[pivot].x;
|
||||
actor[j].t_data[9] = sprite[j].y - sprite[pivot].y;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue