diff --git a/source/gfx/actor.cpp b/source/gfx/actor.cpp index 552216226..61c1acd57 100644 --- a/source/gfx/actor.cpp +++ b/source/gfx/actor.cpp @@ -663,7 +663,6 @@ int AspectX0,AspectX1; } /*****************************************************************************/ - POLY_FT4 *CActorGfx::Render(DVECTOR &Pos,int Anim,int Frame,bool XFlip,bool YFlip) { sPoolNode *ThisNode=CacheFrame(Anim,Frame); @@ -699,35 +698,17 @@ POLY_FT4 *CActorGfx::RotateScale(POLY_FT4 *Ft4,DVECTOR &Pos,int Angle,int XScale { MATRIX Mtx; VECTOR Scale; -int ScaleInc=Angle&1023; -int Quad=0; Angle&=4095; - if (Angle==0 && XScale==YScale==ONE) return(Ft4); - XScale+=ScaleXAspect; - Quad=Angle>>10; - switch(Quad) - { - case 0: - ScaleInc=+ScaleInc; - break; - case 1: - ScaleInc=1023-ScaleInc; - break; - case 2: - ScaleInc=+ScaleInc; - break; - case 3: - ScaleInc=1023-ScaleInc; - break; - } + if (Angle==0 && XScale==ONE && YScale==ONE) return(Ft4); - Scale.vx=XScale-(ScaleInc*2); - Scale.vy=YScale+(ScaleInc*2); + Scale.vx=XScale; + Scale.vy=YScale; Scale.vz=ONE; SetIdentNoTrans(&Mtx); - ScaleMatrix(&Mtx,&Scale); RotMatrixZ(Angle,&Mtx); + ScaleMatrix(&Mtx,&Scale); + CorrectMatrixScale(&Mtx); gte_SetRotMatrix(&Mtx); CMX_SetTransMtxXY(&ZeroPos); @@ -913,7 +894,6 @@ u8 const *XYList=(u8*)SCRATCH_RAM; RenderPos.vx=(INGAME_SCREENOFS_X)+Pos.vx; RenderPos.vy=(INGAME_SCREENOFS_Y)+Pos.vy; - gte_SetRotMatrix(&Mtx); CMX_SetTransMtxXY(&RenderPos); diff --git a/source/utils/utils.h b/source/utils/utils.h index 0b5587712..12f725d37 100644 --- a/source/utils/utils.h +++ b/source/utils/utils.h @@ -54,6 +54,21 @@ inline void SetIdentNoTrans(MATRIX *Mtx,VECTOR *S) {SetIdentNoTrans(Mtx, //inline void SetIdentNoTrans(MATRIX *Mtx,s32 SX,s32 SY, s32 SZ) {SetIdentNoTrans(Mtx, SX,SY,SZ);} +/*****************************************************************************/ +inline void CorrectMatrixScale(MATRIX *Mtx) +{ +//const s32 scale = (512 << 12) / (320+128); +//const s32 scale = ONE+ScaleXAspect+128; +const s32 scale = ONE+2050+128; + + for (u32 i = 0; i < 3; ++i) + { + Mtx->m[ 0 ][ i ] = ((s32)Mtx->m[ 0 ][ i ] * scale) >> 12; + } +// dont need, as zero'd +// dst_mtx->t[ 0 ] = (dst_mtx->t[ 0 ] * scale) >> 12; +} + /*****************************************************************************/ inline void InverseMatrix(MATRIX *m, MATRIX &im) //assumes no scale, just transformation and rotation {