diff --git a/Utils/Libs/DaveLib/facestore.cpp b/Utils/Libs/DaveLib/facestore.cpp index 3455da8e1..e8973cba8 100644 --- a/Utils/Libs/DaveLib/facestore.cpp +++ b/Utils/Libs/DaveLib/facestore.cpp @@ -318,7 +318,7 @@ int V=ThisTex.v+H; Out.TPage=ThisTex.Tpage; Out.Clut=ThisTex.Clut; - Out.PolyCode=GPU_PolyFT3Code; + Out.PolyCode=GPU_PolyFT4Code; if (In.TPageFlag) { @@ -676,6 +676,7 @@ int c = FaceList.size(); F.vtx = FaceList[minF].vtx; FaceList[minF].Avail = false; F.Normal= FaceList[minF].Normal; + F.OtOfs=FaceList[minF].OtOfs; if (minC && MaxStrip>F.pts.size()) FollowFace( minF, F ); diff --git a/Utils/MkLevel/MkLevel.cpp b/Utils/MkLevel/MkLevel.cpp index b343a6d4f..ac9ba638f 100644 --- a/Utils/MkLevel/MkLevel.cpp +++ b/Utils/MkLevel/MkLevel.cpp @@ -56,6 +56,7 @@ int Tile2dSize,Tile3dSize; const char *ModelExcludeGroupName="ModelExcludeList"; const char *ModelOtOfsGroupName="ModelOtOfs"; int LocalOptCount=0; + //*************************************************************************** const GString ConfigFilename="MkLevel.ini"; sExpLayerTile BlankTile={0,0}; @@ -625,14 +626,18 @@ CFaceStore &ThisList=ThisElem.FaceStore; } //*************************************************************************** +int OTMin=0; +int OTMax=16-1; + void CMkLevel::CalcOtOfs(vector &PList,vector &VtxList,int Start,int Count) { int ZOfs=+4*Scale; +int PntCount=3; for (int i=0;i15) OtOfs=15; - if (OtOfs<0) OtOfs=0; + if (OtOfs>OTMax) OtOfs=OTMax; + if (OtOfs &PList,vector &VtxList,int Start,int Count) { int ZOfs=+4*Scale; +int PntCount=4; for (int i=0;i15) OtOfs=15; - if (OtOfs<0) OtOfs=0; + if (OtOfs>OTMax) OtOfs=OTMax; + if (OtOfsTriCount; sTri *TList=&TriList[Elem->TriStart]; - - if (TriCount) // Blank tiles rejected here, to prevent over processing (as no tri-count) + int QuadCount=Elem->QuadCount; + sQuad *QList=&QuadList[Elem->QuadStart]; + if (TriCount || QuadCount) // Blank tiles rejected here, to prevent over processing (as no tri-count) { CMX_SetTransMtxXY(&BlkPos); CMX_SetRotMatrixXY(&FTab->Mtx); @@ -351,6 +355,8 @@ s16 *DeltaBY=BTableY[ShiftY]; while (TriCount--) { + POLY_FT3 *ThisPrim=(POLY_FT3*)PrimPtr; + P0=XYList[TList->P0]; P1=XYList[TList->P1]; P2=XYList[TList->P2]; @@ -358,31 +364,86 @@ s16 *DeltaBY=BTableY[ShiftY]; gte_ldsxy1(P1); gte_ldsxy2(P2); - setlen(TPrimPtr, GPU_PolyFT3Tag); - TPrimPtr->code=TList->PolyCode; + setlen(ThisPrim, GPU_PolyFT3Tag); + ThisPrim->code=TList->PolyCode; gte_nclip_b(); // 8 cycles - setShadeTex(TPrimPtr,1); + setShadeTex(ThisPrim,1); +#if defined(_SHOW_POLYZ_) + if (ShowPolyz) {setShadeTex(ThisPrim,0);setRGB0(ThisPrim,0,127,0);} +#endif 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 + 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; TList++; if (ClipZ<0) { - *(u32*)&TPrimPtr->x0=P0; // Set XY0 - *(u32*)&TPrimPtr->x1=P1; // Set XY1 - *(u32*)&TPrimPtr->x2=P2; // Set XY2 - addPrim(ThisOT,TPrimPtr); - TPrimPtr++; + *(u32*)&ThisPrim->x0=P0; // Set XY0 + *(u32*)&ThisPrim->x1=P1; // Set XY1 + *(u32*)&ThisPrim->x2=P2; // Set XY2 + addPrim(ThisOT,ThisPrim); + PrimPtr+=sizeof(POLY_FT3); + #if defined(_SHOW_POLYZ_) + TCount++; + #endif + } } + while (QuadCount--) + { + POLY_FT4 *ThisPrim=(POLY_FT4*)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); + + setlen(ThisPrim, GPU_PolyFT4Tag); + ThisPrim->code=QList->PolyCode; + gte_nclip_b(); // 8 cycles + + setShadeTex(ThisPrim,1); +#if defined(_SHOW_POLYZ_) + if (ShowPolyz) {setShadeTex(ThisPrim,0);setRGB0(ThisPrim,127,0,0);} +#endif + + 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; + 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 + addPrim(ThisOT,ThisPrim); + PrimPtr+=sizeof(POLY_FT4); + #if defined(_SHOW_POLYZ_) + QCount++; + #endif + + } + } + } MapRow++; BlkPos.vx+=BLOCK_SIZE; @@ -394,12 +455,10 @@ s16 *DeltaBY=BTableY[ShiftY]; DeltaFY++; DeltaBY++; } - SetPrimPtr((u8*)TPrimPtr); + SetPrimPtr((u8*)PrimPtr); #if defined(_SHOW_POLYZ_) char Txt[256]; -int TCount=((u8*)TPrimPtr-PrimPtr)/sizeof(POLY_FT3); -int QCount=0; sprintf(Txt,"TC %i\nQC %i",TCount,QCount); Font->print( 128, 32, Txt); #endif diff --git a/tools/Data/bin/MkLevel.exe b/tools/Data/bin/MkLevel.exe index 8647d4688..8fbf48df4 100644 Binary files a/tools/Data/bin/MkLevel.exe and b/tools/Data/bin/MkLevel.exe differ diff --git a/tools/Data/include/dstructs.h b/tools/Data/include/dstructs.h index 04f905f1a..b13e2ece0 100644 --- a/tools/Data/include/dstructs.h +++ b/tools/Data/include/dstructs.h @@ -112,11 +112,30 @@ struct sTri //--------------------------------------------------------------------------- struct sQuad +{ + u16 P0; // 2 + u16 P1; // 2 + u8 uv0[2]; // 2 + u16 Clut; // 2 + u8 uv1[2]; // 2 + u16 TPage; // 2 + u8 uv2[2]; // 2 + u16 P2; // 2 + u8 uv3[2]; // 2 + u16 P3; // 2 + u16 OTOfs; // 2 + u8 PolyCode; // 1 + u8 Pad; // 1 +}; // 24 + + +struct sPoly { u16 P0; // 2 u16 P1; // 2 u16 P2; // 2 u16 P3; // 2 + u8 uv0[2]; // 2 u16 Clut; // 2 u8 uv1[2]; // 2 @@ -125,9 +144,9 @@ struct sQuad u8 uv3[2]; // 2 u16 OTOfs; // 2 u8 PolyCode; // 1 - u8 Pad; // 1 -}; // 24 + u8 PolyTag; // 1 +}; //*************************************************************************** //*** Game Types and Headers ************************************************