diff --git a/source/fx/fxfallingtile.cpp b/source/fx/fxfallingtile.cpp index d34c72e8c..9b38f3b35 100644 --- a/source/fx/fxfallingtile.cpp +++ b/source/fx/fxfallingtile.cpp @@ -9,6 +9,7 @@ #include "gfx\sprbank.h" #include #include "level\level.h" +#include "level\layertile3d.h" #include "FX\FXfallingTile.h" @@ -74,21 +75,23 @@ VECTOR ThisRenderPos; ThisRenderPos.vx=PXOfs+RenderPos.vx; ThisRenderPos.vy=PYOfs+RenderPos.vy; - gte_SetRotMatrix(&Mtx); + u16 TileIdx=Tile>>2; + u16 Flip=Tile&3; + sFlipTable *FTab=&FlipTable[Flip]; + sElem3d *Elem=&ElemBank3d[TileIdx]; + int TriCount=Elem->TriCount; + sTri *TList=&TriList[Elem->TriStart]; + CMX_SetTransMtxXY(&ThisRenderPos); - - sElem3d *ThisTile=&ElemBank3d[Tile]; - int TriCount=ThisTile->TriCount; - sTri *TList=&TriList[ThisTile->TriStart]; - + CMX_SetRotMatrixXY(&FTab->Mtx); while (TriCount--) { P0=&VtxList[TList->P0]; P1=&VtxList[TList->P1]; P2=&VtxList[TList->P2]; gte_ldv3(P0,P1,P2); setlen(TPrimPtr, GPU_PolyFT3Tag); TPrimPtr->code=TList->PolyCode; - setRGB0(TPrimPtr,128,128,128); gte_rtpt_b(); + setShadeTex(TPrimPtr,1); T0=*(u32*)&TList->uv0; // Get UV0 & TPage T1=*(u32*)&TList->uv1; // Get UV1 & Clut @@ -97,12 +100,13 @@ VECTOR ThisRenderPos; *(u32*)&TPrimPtr->u1=T1; // Set UV1 *(u16*)&TPrimPtr->u2=T2; // Set UV2 - ThisOT=OtPtr; + ThisOT=OtPtr+TList->OTOfs; TList++; gte_nclip_b(); gte_stsxy3_ft3(TPrimPtr); gte_stopz(&ClipZ); - if (ClipZ<=0) + ClipZ^=FTab->ClipCode; + if (ClipZ<0) { addPrim(ThisOT,TPrimPtr); TPrimPtr++; diff --git a/source/level/layertile3d.cpp b/source/level/layertile3d.cpp index 6e1e8a67c..2c72072c1 100644 --- a/source/level/layertile3d.cpp +++ b/source/level/layertile3d.cpp @@ -111,20 +111,6 @@ void CLayerTile3d::think(DVECTOR &MapPos) /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ -#define CMX_SetRotMatrixXY( r0 ) __asm__ ( \ - "lw $12, 0( %0 );" \ - "lw $13, 4( %0 );" \ - "ctc2 $12, $0;" \ - "ctc2 $13, $2;" \ - : \ - : "r"( r0 ) \ - : "$12", "$13") - -struct sFlipTable -{ - s16 Mtx[4]; - s32 ClipCode; -}; sFlipTable FlipTable[4]= { @@ -165,10 +151,10 @@ VECTOR BlkPos; sTri *TList=&TriList[Elem->TriStart]; P0=&VtxList[TList->P0]; P1=&VtxList[TList->P1]; P2=&VtxList[TList->P2]; + CMX_SetTransMtxXY(&BlkPos); + CMX_SetRotMatrixXY(&FTab->Mtx); while (TriCount--) // Blank tiles rejected here (as no tri-count) { - CMX_SetTransMtxXY(&BlkPos); - CMX_SetRotMatrixXY(&FTab->Mtx); gte_ldv3(P0,P1,P2); setlen(TPrimPtr, GPU_PolyFT3Tag); TPrimPtr->code=TList->PolyCode; diff --git a/source/level/layertile3d.h b/source/level/layertile3d.h index 7cbbd32ee..2d5e706b3 100644 --- a/source/level/layertile3d.h +++ b/source/level/layertile3d.h @@ -6,6 +6,22 @@ #define __LAYER_TILE_3D_Hx__ +#define CMX_SetRotMatrixXY( r0 ) __asm__ ( \ + "lw $12, 0( %0 );" \ + "lw $13, 4( %0 );" \ + "ctc2 $12, $0;" \ + "ctc2 $13, $2;" \ + : \ + : "r"( r0 ) \ + : "$12", "$13") + +struct sFlipTable +{ + s16 Mtx[4]; + s32 ClipCode; +}; +extern sFlipTable FlipTable[]; + /*****************************************************************************/ class FontBank; class CLayerTile3d : public CLayerTile