mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-14 08:21:05 +00:00
Don't make assumptions about framecounts in angled sprites.
This commit is contained in:
parent
88514bda4f
commit
99569251a8
2 changed files with 7 additions and 5 deletions
|
@ -3388,9 +3388,9 @@ static void QCBUILTIN PF_cs_spriteframe(pubprogfuncs_t *prinst, struct globalvar
|
|||
pspriteframe = psprite->frames[frame].frameptr;
|
||||
else if (psprite->frames[frame].type == SPR_ANGLED)
|
||||
{ //just take frametime as 0-1
|
||||
int dir = frametime/8;
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
|
||||
pspriteframe = pspritegroup->frames[dir&7];
|
||||
i = frametime/pspritegroup->numframes;
|
||||
pspriteframe = pspritegroup->frames[i%pspritegroup->numframes];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2518,12 +2518,14 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
|
|||
{
|
||||
float f = DotProduct(vpn,currententity->axis[0]);
|
||||
float r = DotProduct(vright,currententity->axis[0]);
|
||||
int dir = (atan2(r, f)+1.125*M_PI)*(4/M_PI);
|
||||
|
||||
float ang;
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
|
||||
ang = (atan2(r, f)+M_PI)/(2*M_PI); //to give 0 - 1 range
|
||||
i = (ang*pspritegroup->numframes) + 0.5;
|
||||
|
||||
// pspriteframe = pspritegroup->frames[(int)((r_refdef.viewangles[1]-currententity->angles[1])/360*pspritegroup->numframes + 0.5-4)%pspritegroup->numframes];
|
||||
//int dir = (int)((r_refdef.viewangles[1]-currententity->angles[1])/360*8 + 8 + 0.5-4)&7;
|
||||
pspriteframe = pspritegroup->frames[dir&7];
|
||||
pspriteframe = pspritegroup->frames[i%pspritegroup->numframes];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue