diff --git a/source/fx/fxfallingtile.cpp b/source/fx/fxfallingtile.cpp index e1ab4ec24..cbf04b83c 100644 --- a/source/fx/fxfallingtile.cpp +++ b/source/fx/fxfallingtile.cpp @@ -38,7 +38,6 @@ sLevelHdr *LevelHdr=CLevel::getLevelHdr(); Velocity.vy=FallingTile_DefVY; Life=FallingTile_DefLife; CSoundMediator::playSfx(CSoundMediator::SFX_ANY_OBJECT_FALLING,false,true); - Flags |=FX_FLAG_NO_THINK_KILL; } /*****************************************************************************/ @@ -46,10 +45,13 @@ sLevelHdr *LevelHdr=CLevel::getLevelHdr(); /*****************************************************************************/ void CFXFallingTile::think(int _frames) { + if (Tile==0) setToShutdown(); CFX::think(_frames); Pos.vx+=Velocity.vx; Pos.vy+=Velocity.vy; Velocity.vy++; + Flags |=FX_FLAG_NO_THINK_KILL; + } /*****************************************************************************/ @@ -65,43 +67,4 @@ DVECTOR &RenderPos=getRenderPos(); u16 TileIdx=Tile>>2; CModelGfx::RenderTile(RenderPos,TileIdx); -/* u16 Flip=Tile&3; - sFlipTable *FTab=&FlipTable[Flip]; - sElem3d *Elem=&ElemBank3d[TileIdx]; - int TriCount=Elem->TriCount; - sTri *TList=&TriList[Elem->TriStart]; - - CMX_SetTransMtxXY(&ThisRenderPos); - 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; - gte_rtpt_b(); - setShadeTex(TPrimPtr,1); - - T0=*(u32*)&TList->uv0; // Get UV0 & TPage - T1=*(u32*)&TList->uv1; // Get UV1 & Clut - T2=*(u16*)&TList->uv2; // Get UV2 - *(u32*)&TPrimPtr->u0=T0; // Set UV0 - *(u32*)&TPrimPtr->u1=T1; // Set UV1 - *(u16*)&TPrimPtr->u2=T2; // Set UV2 - - ThisOT=OtPtr+TList->OTOfs; - TList++; - gte_nclip_b(); - gte_stsxy3_ft3(TPrimPtr); - gte_stopz(&ClipZ); - ClipZ^=FTab->ClipCode; - if (ClipZ<0) - { - addPrim(ThisOT,TPrimPtr); - TPrimPtr++; - } - } - - SetPrimPtr((u8*)TPrimPtr); -*/ } diff --git a/source/fx/fxtvexplode.cpp b/source/fx/fxtvexplode.cpp index 1c0d51cf2..3b72ebd3e 100644 --- a/source/fx/fxtvexplode.cpp +++ b/source/fx/fxtvexplode.cpp @@ -19,13 +19,13 @@ CFXBaseAnim::sFXBaseData FXCogBaseData= { FRM__COG01,FRM__COG01,3, - FX_FLAG_LOOP | FX_FLAG_COLLIDE_BOUNCE | FX_FLAG_HAS_GRAVITY | FX_FLAG_NO_THINK_KILL, + FX_FLAG_LOOP | FX_FLAG_COLLIDE_BOUNCE | FX_FLAG_HAS_GRAVITY, }; CFXBaseAnim::sFXBaseData FXValveBaseData= { FRM__ELECVALVE,FRM__ELECVALVE,1, - FX_FLAG_LOOP | FX_FLAG_COLLIDE_BOUNCE | FX_FLAG_HAS_GRAVITY | FX_FLAG_NO_THINK_KILL, + FX_FLAG_LOOP | FX_FLAG_COLLIDE_BOUNCE | FX_FLAG_HAS_GRAVITY, }; diff --git a/source/gfx/actor.cpp b/source/gfx/actor.cpp index d0dea2a2f..32c05a930 100644 --- a/source/gfx/actor.cpp +++ b/source/gfx/actor.cpp @@ -700,10 +700,10 @@ MATRIX Mtx; VECTOR Scale; int ScaleInc=Angle&1023; int Quad=0; - XScale+=ScaleXAspect; Angle&=4095; - + if (Angle==0 && XScale==YScale==ONE) return(Ft4); + XScale+=ScaleXAspect; Quad=Angle>>10; switch(Quad) { @@ -881,12 +881,12 @@ void CModelGfx::RenderElem(sElem3d *ThisElem,DVECTOR &Pos,SVECTOR *Angle,VECTOR { u8 *PrimPtr=GetPrimPtr(); u32 T0,T1,T2,T3; -u32 P0,P1,P2,P3; s32 ClipZ; sOT *ThisOT; VECTOR RenderPos; MATRIX Mtx; -u32 const *XYList=(u32*)SCRATCH_RAM; +//u32 const *XYList=(u32*)SCRATCH_RAM; +u8 const *XYList=(u8*)SCRATCH_RAM; // If has scale && angle then need to use PSX scale matrix, otherwise, force values @@ -950,12 +950,12 @@ u32 const *XYList=(u32*)SCRATCH_RAM; { POLY_GT3 *ThisPrim=(POLY_GT3*)PrimPtr; - P0=XYList[TList->P0]; - P1=XYList[TList->P1]; - P2=XYList[TList->P2]; - gte_ldsxy0(P0); - gte_ldsxy1(P1); - gte_ldsxy2(P2); + T0=*(u32*)(XYList+TList->P0); + T1=*(u32*)(XYList+TList->P1); + T2=*(u32*)(XYList+TList->P2); + gte_ldsxy0(T0); + gte_ldsxy1(T1); + gte_ldsxy2(T2); setlen(ThisPrim, GPU_PolyGT3Tag); ThisPrim->code=TList->PolyCode; @@ -963,12 +963,12 @@ u32 const *XYList=(u32*)SCRATCH_RAM; setShadeTex(ThisPrim,1); + *(u32*)&ThisPrim->x0=T0; // Set XY0 + *(u32*)&ThisPrim->x1=T1; // Set XY1 + *(u32*)&ThisPrim->x2=T2; // Set XY2 T0=*(u32*)&TList->uv0; // Get UV0 & TPage T1=*(u32*)&TList->uv1; // Get UV1 & Clut T2=*(u32*)&TList->uv2; // Get UV2 - *(u32*)&ThisPrim->u0=T0; // Set UV0 - *(u32*)&ThisPrim->u1=T1; // Set UV1 - *(u32*)&ThisPrim->u2=T2; // Set UV2 gte_stopz(&ClipZ); ThisOT=OtPtr+TList->OTOfs; @@ -976,9 +976,9 @@ u32 const *XYList=(u32*)SCRATCH_RAM; TList++; if (ClipZ<0) { - *(u32*)&ThisPrim->x0=P0; // Set XY0 - *(u32*)&ThisPrim->x1=P1; // Set XY1 - *(u32*)&ThisPrim->x2=P2; // Set XY2 + *(u32*)&ThisPrim->u0=T0; // Set UV0 + *(u32*)&ThisPrim->u1=T1; // Set UV1 + *(u32*)&ThisPrim->u2=T2; // Set UV2 addPrim(ThisOT,ThisPrim); PrimPtr+=sizeof(POLY_GT3); } @@ -991,13 +991,13 @@ u32 const *XYList=(u32*)SCRATCH_RAM; { POLY_GT4 *ThisPrim=(POLY_GT4*)PrimPtr; - P0=XYList[QList->P0]; - P1=XYList[QList->P1]; - P2=XYList[QList->P2]; - P3=XYList[QList->P3]; - gte_ldsxy0(P0); - gte_ldsxy1(P1); - gte_ldsxy2(P2); + T0=*(u32*)(XYList+QList->P0); + T1=*(u32*)(XYList+QList->P1); + T2=*(u32*)(XYList+QList->P2); + T3=*(u32*)(XYList+QList->P3); + gte_ldsxy0(T0); + gte_ldsxy1(T1); + gte_ldsxy2(T2); setlen(ThisPrim, GPU_PolyGT4Tag); ThisPrim->code=QList->PolyCode; @@ -1005,24 +1005,24 @@ u32 const *XYList=(u32*)SCRATCH_RAM; setShadeTex(ThisPrim,1); + *(u32*)&ThisPrim->x0=T0; // Set XY0 + *(u32*)&ThisPrim->x1=T1; // Set XY1 + *(u32*)&ThisPrim->x2=T2; // Set XY2 + *(u32*)&ThisPrim->x3=T3; // Set XY3 T0=*(u32*)&QList->uv0; // Get UV0 & TPage T1=*(u32*)&QList->uv1; // Get UV1 & Clut T2=*(u32*)&QList->uv2; // Get UV2 T3=*(u32*)&QList->uv3; // Get UV2 - *(u32*)&ThisPrim->u0=T0; // Set UV0 - *(u32*)&ThisPrim->u1=T1; // Set UV1 - *(u32*)&ThisPrim->u2=T2; // Set UV2 - *(u32*)&ThisPrim->u3=T3; // Set UV2 gte_stopz(&ClipZ); ThisOT=OtPtr+QList->OTOfs; ClipZ|=ClipFlag; // <-- Evil!! QList++; if (ClipZ<0) { - *(u32*)&ThisPrim->x0=P0; // Set XY0 - *(u32*)&ThisPrim->x1=P1; // Set XY1 - *(u32*)&ThisPrim->x2=P2; // Set XY2 - *(u32*)&ThisPrim->x3=P3; // Set XY3 + *(u32*)&ThisPrim->u0=T0; // Set UV0 + *(u32*)&ThisPrim->u1=T1; // Set UV1 + *(u32*)&ThisPrim->u2=T2; // Set UV2 + *(u32*)&ThisPrim->u3=T3; // Set UV2 addPrim(ThisOT,ThisPrim); PrimPtr+=sizeof(POLY_GT4); } diff --git a/source/level/layertile3d.cpp b/source/level/layertile3d.cpp index b9e42ff32..3518f7d51 100644 --- a/source/level/layertile3d.cpp +++ b/source/level/layertile3d.cpp @@ -13,12 +13,14 @@ #include "LayerTile3d.h" +#if 1 #if defined(__USER_sbart__) || defined(__USER_daveo__) #define _SHOW_POLYZ_ 1 #include "gfx\font.h" static FontBank *Font; int ShowPolyz=0; #endif +#endif static const int BLOCK_SIZE =16; static const int SCREEN_TILE_ADJ_U =2; @@ -279,9 +281,8 @@ int MapOfs=GetMapOfs(); sTileMapElem *MapPtr=Map+MapOfs; u8 *RGBMapPtr=RGBMap+MapOfs; u8 *PrimPtr=GetPrimPtr(); -u32 *XYList=(u32*)SCRATCH_RAM; +u8 const *XYList=(u8*)SCRATCH_RAM; u32 T0,T1,T2,T3; -u32 P0,P1,P2,P3; s32 ClipZ; sOT *ThisOT; VECTOR BlkPos; @@ -326,7 +327,6 @@ s16 TCount=0,QCount=0; CMX_SetRotMatrixXY(&FTab->Mtx); // --- Cache Vtx ---------- -// CacheElemVtx(Elem); { int Count=Elem->VtxTriCount; sVtx *V0,*V1,*V2; @@ -356,7 +356,6 @@ s16 TCount=0,QCount=0; } - s16 FL=DeltaFX[0]+DeltaFOfs.vx; s16 FR=DeltaFX[1]+DeltaFOfs.vx; s16 FU=DeltaFY[0]+DeltaFOfs.vy; @@ -396,12 +395,12 @@ s16 TCount=0,QCount=0; { POLY_GT3 *ThisPrim=(POLY_GT3*)PrimPtr; - P0=XYList[TList->P0]; - P1=XYList[TList->P1]; - P2=XYList[TList->P2]; - gte_ldsxy0(P0); - gte_ldsxy1(P1); - gte_ldsxy2(P2); + T0=*(u32*)(XYList+TList->P0); + T1=*(u32*)(XYList+TList->P1); + T2=*(u32*)(XYList+TList->P2); + gte_ldsxy0(T0); + gte_ldsxy1(T1); + gte_ldsxy2(T2); setlen(ThisPrim, GPU_PolyGT3Tag); gte_nclip_b(); // 8 cycles @@ -410,20 +409,20 @@ s16 TCount=0,QCount=0; if (ShowPolyz) {setRGB0(ThisPrim,127,0,0); setRGB1(ThisPrim,255,0,0); setRGB2(ThisPrim,255,0,0);} #endif + *(u32*)&ThisPrim->x0=T0; // Set XY0 + *(u32*)&ThisPrim->x1=T1; // Set XY1 + *(u32*)&ThisPrim->x2=T2; // Set XY2 T0=*(u32*)&TList->uv0; // Get UV0 & TPage T1=*(u32*)&TList->uv1; // Get UV1 & Clut T2=*(u32*)&TList->uv2; // Get UV2 - *(u32*)&ThisPrim->u0=T0; // Set UV0 - *(u32*)&ThisPrim->u1=T1; // Set UV1 - *(u32*)&ThisPrim->u2=T2; // Set UV2 gte_stopz(&ClipZ); ThisOT=OtPtr+TList->OTOfs; ClipZ^=FTab->ClipCode; if (ClipZ<0) { - *(u32*)&ThisPrim->x0=P0; // Set XY0 - *(u32*)&ThisPrim->x1=P1; // Set XY1 - *(u32*)&ThisPrim->x2=P2; // Set XY2 + *(u32*)&ThisPrim->u0=T0; // Set UV0 + *(u32*)&ThisPrim->u1=T1; // Set UV1 + *(u32*)&ThisPrim->u2=T2; // Set UV2 addPrim(ThisOT,ThisPrim); #if defined(_SHOW_POLYZ_) @@ -453,13 +452,13 @@ s16 TCount=0,QCount=0; { POLY_GT4 *ThisPrim=(POLY_GT4*)PrimPtr; - P0=XYList[QList->P0]; - P1=XYList[QList->P1]; - P2=XYList[QList->P2]; - P3=XYList[QList->P3]; - gte_ldsxy0(P0); - gte_ldsxy1(P1); - gte_ldsxy2(P2); + T0=*(u32*)(XYList+(QList->P0/*4*/)); + T1=*(u32*)(XYList+(QList->P1/*4*/)); + T2=*(u32*)(XYList+(QList->P2/*4*/)); + T3=*(u32*)(XYList+(QList->P3/*4*/)); + gte_ldsxy0(T0); + gte_ldsxy1(T1); + gte_ldsxy2(T2); setlen(ThisPrim, GPU_PolyGT4Tag); gte_nclip_b(); // 8 cycles @@ -468,23 +467,23 @@ s16 TCount=0,QCount=0; if (ShowPolyz) {setRGB0(ThisPrim,0,127,0);setRGB1(ThisPrim,0,255,0); setRGB2(ThisPrim,0,255,0); setRGB3(ThisPrim,0,255,0);} #endif + *(u32*)&ThisPrim->x0=T0; // Set XY0 + *(u32*)&ThisPrim->x1=T1; // Set XY1 + *(u32*)&ThisPrim->x2=T2; // Set XY2 + *(u32*)&ThisPrim->x3=T3; // Set XY3 T0=*(u32*)&QList->uv0; // Get UV0 & TPage T1=*(u32*)&QList->uv1; // Get UV1 & Clut T2=*(u32*)&QList->uv2; // Get UV2 T3=*(u32*)&QList->uv3; // Get UV2 - *(u32*)&ThisPrim->u0=T0; // Set UV0 - *(u32*)&ThisPrim->u1=T1; // Set UV1 - *(u32*)&ThisPrim->u2=T2; // Set UV2 - *(u32*)&ThisPrim->u3=T3; // Set UV2 gte_stopz(&ClipZ); ThisOT=OtPtr+QList->OTOfs; ClipZ^=FTab->ClipCode; if (ClipZ<0) { - *(u32*)&ThisPrim->x0=P0; // Set XY0 - *(u32*)&ThisPrim->x1=P1; // Set XY1 - *(u32*)&ThisPrim->x2=P2; // Set XY2 - *(u32*)&ThisPrim->x3=P3; // Set XY3 + *(u32*)&ThisPrim->u0=T0; // Set UV0 + *(u32*)&ThisPrim->u1=T1; // Set UV1 + *(u32*)&ThisPrim->u2=T2; // Set UV2 + *(u32*)&ThisPrim->u3=T3; // Set UV2 #if defined(_SHOW_POLYZ_) if (!ShowPolyz) #endif