This commit is contained in:
parent
475cec47a3
commit
c1aeb7ec0e
7 changed files with 127 additions and 39 deletions
|
@ -318,7 +318,7 @@ int V=ThisTex.v+H;
|
||||||
|
|
||||||
Out.TPage=ThisTex.Tpage;
|
Out.TPage=ThisTex.Tpage;
|
||||||
Out.Clut=ThisTex.Clut;
|
Out.Clut=ThisTex.Clut;
|
||||||
Out.PolyCode=GPU_PolyFT3Code;
|
Out.PolyCode=GPU_PolyFT4Code;
|
||||||
|
|
||||||
if (In.TPageFlag)
|
if (In.TPageFlag)
|
||||||
{
|
{
|
||||||
|
@ -676,6 +676,7 @@ int c = FaceList.size();
|
||||||
F.vtx = FaceList[minF].vtx;
|
F.vtx = FaceList[minF].vtx;
|
||||||
FaceList[minF].Avail = false;
|
FaceList[minF].Avail = false;
|
||||||
F.Normal= FaceList[minF].Normal;
|
F.Normal= FaceList[minF].Normal;
|
||||||
|
F.OtOfs=FaceList[minF].OtOfs;
|
||||||
|
|
||||||
if (minC && MaxStrip>F.pts.size()) FollowFace( minF, F );
|
if (minC && MaxStrip>F.pts.size()) FollowFace( minF, F );
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ int Tile2dSize,Tile3dSize;
|
||||||
const char *ModelExcludeGroupName="ModelExcludeList";
|
const char *ModelExcludeGroupName="ModelExcludeList";
|
||||||
const char *ModelOtOfsGroupName="ModelOtOfs";
|
const char *ModelOtOfsGroupName="ModelOtOfs";
|
||||||
int LocalOptCount=0;
|
int LocalOptCount=0;
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
const GString ConfigFilename="MkLevel.ini";
|
const GString ConfigFilename="MkLevel.ini";
|
||||||
sExpLayerTile BlankTile={0,0};
|
sExpLayerTile BlankTile={0,0};
|
||||||
|
@ -625,14 +626,18 @@ CFaceStore &ThisList=ThisElem.FaceStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
int OTMin=0;
|
||||||
|
int OTMax=16-1;
|
||||||
|
|
||||||
void CMkLevel::CalcOtOfs(vector<sTri> &PList,vector<sVtx> &VtxList,int Start,int Count)
|
void CMkLevel::CalcOtOfs(vector<sTri> &PList,vector<sVtx> &VtxList,int Start,int Count)
|
||||||
{
|
{
|
||||||
int ZOfs=+4*Scale;
|
int ZOfs=+4*Scale;
|
||||||
|
int PntCount=3;
|
||||||
|
|
||||||
for (int i=0;i<Count;i++)
|
for (int i=0;i<Count;i++)
|
||||||
{
|
{
|
||||||
sTri &P=PList[Start+i];
|
sTri &P=PList[Start+i];
|
||||||
int OtOfs=0;
|
float OtOfs=0;
|
||||||
int Z[3];
|
int Z[3];
|
||||||
// Get VtxZ
|
// Get VtxZ
|
||||||
|
|
||||||
|
@ -640,17 +645,17 @@ int ZOfs=+4*Scale;
|
||||||
Z[1]=VtxList[P.P1].vz+ZOfs;
|
Z[1]=VtxList[P.P1].vz+ZOfs;
|
||||||
Z[2]=VtxList[P.P2].vz+ZOfs;
|
Z[2]=VtxList[P.P2].vz+ZOfs;
|
||||||
|
|
||||||
for (int p=0; p<3; p++)
|
for (int p=0; p<PntCount; p++)
|
||||||
{
|
{
|
||||||
OtOfs+=Z[p]*Z[p];
|
OtOfs+=Z[p]*Z[p];
|
||||||
}
|
}
|
||||||
|
|
||||||
OtOfs=((int)sqrt(OtOfs/3))/8;
|
OtOfs=sqrt(OtOfs/PntCount);
|
||||||
|
OtOfs/=8;
|
||||||
OtOfs+=P.OTOfs;
|
OtOfs+=P.OTOfs;
|
||||||
|
|
||||||
if (OtOfs>15) OtOfs=15;
|
if (OtOfs>OTMax) OtOfs=OTMax;
|
||||||
if (OtOfs<0) OtOfs=0;
|
if (OtOfs<OTMin) OtOfs=OTMin;
|
||||||
|
|
||||||
P.OTOfs=OtOfs;
|
P.OTOfs=OtOfs;
|
||||||
}
|
}
|
||||||
|
@ -661,11 +666,12 @@ int ZOfs=+4*Scale;
|
||||||
void CMkLevel::CalcOtOfs(vector<sQuad> &PList,vector<sVtx> &VtxList,int Start,int Count)
|
void CMkLevel::CalcOtOfs(vector<sQuad> &PList,vector<sVtx> &VtxList,int Start,int Count)
|
||||||
{
|
{
|
||||||
int ZOfs=+4*Scale;
|
int ZOfs=+4*Scale;
|
||||||
|
int PntCount=4;
|
||||||
|
|
||||||
for (int i=0;i<Count;i++)
|
for (int i=0;i<Count;i++)
|
||||||
{
|
{
|
||||||
sQuad &P=PList[Start+i];
|
sQuad &P=PList[Start+i];
|
||||||
int OtOfs=0;
|
float OtOfs=0;
|
||||||
int Z[4];
|
int Z[4];
|
||||||
// Get VtxZ
|
// Get VtxZ
|
||||||
|
|
||||||
|
@ -674,14 +680,17 @@ int ZOfs=+4*Scale;
|
||||||
Z[2]=VtxList[P.P2].vz+ZOfs;
|
Z[2]=VtxList[P.P2].vz+ZOfs;
|
||||||
Z[3]=VtxList[P.P3].vz+ZOfs;
|
Z[3]=VtxList[P.P3].vz+ZOfs;
|
||||||
|
|
||||||
for (int p=0; p<4; p++) OtOfs+=Z[p]*Z[p];
|
for (int p=0; p<PntCount; p++)
|
||||||
|
{
|
||||||
OtOfs=((int)sqrt(OtOfs/4))/8;
|
OtOfs+=Z[p]*Z[p];
|
||||||
|
}
|
||||||
|
|
||||||
|
OtOfs=sqrt(OtOfs/PntCount);
|
||||||
|
OtOfs/=8;
|
||||||
OtOfs+=P.OTOfs;
|
OtOfs+=P.OTOfs;
|
||||||
|
|
||||||
if (OtOfs>15) OtOfs=15;
|
if (OtOfs>OTMax) OtOfs=OTMax;
|
||||||
if (OtOfs<0) OtOfs=0;
|
if (OtOfs<OTMin) OtOfs=OTMin;
|
||||||
|
|
||||||
P.OTOfs=OtOfs;
|
P.OTOfs=OtOfs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ TEMP_FILE := $(TEMP_BUILD_DIR)/build.tmp
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
#--- Levels -----------------------------------------------------------------
|
#--- Levels -----------------------------------------------------------------
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
LEVELS_OPTS := -t:8,4,1 -s:16 -l -z:0.1
|
LEVELS_OPTS := -t:8,4,1 -s:16 -l -z:0.2
|
||||||
LEVELS_IN_DIR := $(GRAF_DIR)/levels
|
LEVELS_IN_DIR := $(GRAF_DIR)/levels
|
||||||
LEVELS_OUT_DIR := $(DATA_OUT)/levels
|
LEVELS_OUT_DIR := $(DATA_OUT)/levels
|
||||||
LEVELS_MAKEFILE_DIR := $(TEMP_BUILD_DIR)/levels
|
LEVELS_MAKEFILE_DIR := $(TEMP_BUILD_DIR)/levels
|
||||||
|
|
|
@ -29,7 +29,7 @@ enum
|
||||||
{
|
{
|
||||||
OTPOS__DEBUG_INFO=0,
|
OTPOS__DEBUG_INFO=0,
|
||||||
OTPOS__INGAME_UI=0,
|
OTPOS__INGAME_UI=0,
|
||||||
OTPOS__ACTOR_POS=6,
|
OTPOS__ACTOR_POS=5,
|
||||||
OTPOS__PICKUP_POS=OTPOS__ACTOR_POS,
|
OTPOS__PICKUP_POS=OTPOS__ACTOR_POS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#define _SHOW_POLYZ_ 1
|
#define _SHOW_POLYZ_ 1
|
||||||
#include "gfx\font.h"
|
#include "gfx\font.h"
|
||||||
static FontBank *Font;
|
static FontBank *Font;
|
||||||
|
int ShowPolyz=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const int BLOCK_SIZE =16;
|
static const int BLOCK_SIZE =16;
|
||||||
|
@ -274,18 +275,20 @@ void CLayerTile3d::render()
|
||||||
{
|
{
|
||||||
sTileMapElem *MapPtr=GetMapPos();
|
sTileMapElem *MapPtr=GetMapPos();
|
||||||
u8 *PrimPtr=GetPrimPtr();
|
u8 *PrimPtr=GetPrimPtr();
|
||||||
POLY_FT3 *TPrimPtr=(POLY_FT3*)PrimPtr;
|
|
||||||
u32 *XYList=(u32*)SCRATCH_RAM;
|
u32 *XYList=(u32*)SCRATCH_RAM;
|
||||||
u32 T0,T1,T2;
|
u32 T0,T1,T2,T3;
|
||||||
u32 P0,P1,P2;
|
u32 P0,P1,P2,P3;
|
||||||
s32 ClipZ;
|
s32 ClipZ;
|
||||||
sOT *ThisOT;
|
sOT *ThisOT;
|
||||||
VECTOR BlkPos;
|
VECTOR BlkPos;
|
||||||
DVECTOR *DP0,*DP1,*DP2,*DP3;
|
DVECTOR *DP0,*DP1,*DP2,*DP3;
|
||||||
|
|
||||||
s16 *DeltaFY=FTableY[ShiftY];
|
s16 *DeltaFY=FTableY[ShiftY];
|
||||||
s16 *DeltaBY=BTableY[ShiftY];
|
s16 *DeltaBY=BTableY[ShiftY];
|
||||||
|
|
||||||
|
#if defined(_SHOW_POLYZ_)
|
||||||
|
s16 TCount=0,QCount=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Setup Trans Matrix
|
// Setup Trans Matrix
|
||||||
BlkPos.vx=RENDER_X_OFS-(ShiftX)+RenderOfs.vx;
|
BlkPos.vx=RENDER_X_OFS-(ShiftX)+RenderOfs.vx;
|
||||||
BlkPos.vy=RENDER_Y_OFS-(ShiftY)+RenderOfs.vy;
|
BlkPos.vy=RENDER_Y_OFS-(ShiftY)+RenderOfs.vy;
|
||||||
|
@ -307,8 +310,9 @@ s16 *DeltaBY=BTableY[ShiftY];
|
||||||
|
|
||||||
int TriCount=Elem->TriCount;
|
int TriCount=Elem->TriCount;
|
||||||
sTri *TList=&TriList[Elem->TriStart];
|
sTri *TList=&TriList[Elem->TriStart];
|
||||||
|
int QuadCount=Elem->QuadCount;
|
||||||
if (TriCount) // Blank tiles rejected here, to prevent over processing (as no tri-count)
|
sQuad *QList=&QuadList[Elem->QuadStart];
|
||||||
|
if (TriCount || QuadCount) // Blank tiles rejected here, to prevent over processing (as no tri-count)
|
||||||
{
|
{
|
||||||
CMX_SetTransMtxXY(&BlkPos);
|
CMX_SetTransMtxXY(&BlkPos);
|
||||||
CMX_SetRotMatrixXY(&FTab->Mtx);
|
CMX_SetRotMatrixXY(&FTab->Mtx);
|
||||||
|
@ -351,6 +355,8 @@ s16 *DeltaBY=BTableY[ShiftY];
|
||||||
|
|
||||||
while (TriCount--)
|
while (TriCount--)
|
||||||
{
|
{
|
||||||
|
POLY_FT3 *ThisPrim=(POLY_FT3*)PrimPtr;
|
||||||
|
|
||||||
P0=XYList[TList->P0];
|
P0=XYList[TList->P0];
|
||||||
P1=XYList[TList->P1];
|
P1=XYList[TList->P1];
|
||||||
P2=XYList[TList->P2];
|
P2=XYList[TList->P2];
|
||||||
|
@ -358,31 +364,86 @@ s16 *DeltaBY=BTableY[ShiftY];
|
||||||
gte_ldsxy1(P1);
|
gte_ldsxy1(P1);
|
||||||
gte_ldsxy2(P2);
|
gte_ldsxy2(P2);
|
||||||
|
|
||||||
setlen(TPrimPtr, GPU_PolyFT3Tag);
|
setlen(ThisPrim, GPU_PolyFT3Tag);
|
||||||
TPrimPtr->code=TList->PolyCode;
|
ThisPrim->code=TList->PolyCode;
|
||||||
gte_nclip_b(); // 8 cycles
|
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
|
T0=*(u32*)&TList->uv0; // Get UV0 & TPage
|
||||||
T1=*(u32*)&TList->uv1; // Get UV1 & Clut
|
T1=*(u32*)&TList->uv1; // Get UV1 & Clut
|
||||||
T2=*(u16*)&TList->uv2; // Get UV2
|
T2=*(u32*)&TList->uv2; // Get UV2
|
||||||
*(u32*)&TPrimPtr->u0=T0; // Set UV0
|
*(u32*)&ThisPrim->u0=T0; // Set UV0
|
||||||
*(u32*)&TPrimPtr->u1=T1; // Set UV1
|
*(u32*)&ThisPrim->u1=T1; // Set UV1
|
||||||
*(u16*)&TPrimPtr->u2=T2; // Set UV2
|
*(u32*)&ThisPrim->u2=T2; // Set UV2
|
||||||
gte_stopz(&ClipZ);
|
gte_stopz(&ClipZ);
|
||||||
ThisOT=OtPtr+TList->OTOfs;
|
ThisOT=OtPtr+TList->OTOfs;
|
||||||
ClipZ^=FTab->ClipCode;
|
ClipZ^=FTab->ClipCode;
|
||||||
TList++;
|
TList++;
|
||||||
if (ClipZ<0)
|
if (ClipZ<0)
|
||||||
{
|
{
|
||||||
*(u32*)&TPrimPtr->x0=P0; // Set XY0
|
*(u32*)&ThisPrim->x0=P0; // Set XY0
|
||||||
*(u32*)&TPrimPtr->x1=P1; // Set XY1
|
*(u32*)&ThisPrim->x1=P1; // Set XY1
|
||||||
*(u32*)&TPrimPtr->x2=P2; // Set XY2
|
*(u32*)&ThisPrim->x2=P2; // Set XY2
|
||||||
addPrim(ThisOT,TPrimPtr);
|
addPrim(ThisOT,ThisPrim);
|
||||||
TPrimPtr++;
|
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++;
|
MapRow++;
|
||||||
BlkPos.vx+=BLOCK_SIZE;
|
BlkPos.vx+=BLOCK_SIZE;
|
||||||
|
@ -394,12 +455,10 @@ s16 *DeltaBY=BTableY[ShiftY];
|
||||||
DeltaFY++; DeltaBY++;
|
DeltaFY++; DeltaBY++;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetPrimPtr((u8*)TPrimPtr);
|
SetPrimPtr((u8*)PrimPtr);
|
||||||
|
|
||||||
#if defined(_SHOW_POLYZ_)
|
#if defined(_SHOW_POLYZ_)
|
||||||
char Txt[256];
|
char Txt[256];
|
||||||
int TCount=((u8*)TPrimPtr-PrimPtr)/sizeof(POLY_FT3);
|
|
||||||
int QCount=0;
|
|
||||||
sprintf(Txt,"TC %i\nQC %i",TCount,QCount);
|
sprintf(Txt,"TC %i\nQC %i",TCount,QCount);
|
||||||
Font->print( 128, 32, Txt);
|
Font->print( 128, 32, Txt);
|
||||||
#endif
|
#endif
|
||||||
|
|
Binary file not shown.
|
@ -112,11 +112,30 @@ struct sTri
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
struct sQuad
|
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 P0; // 2
|
||||||
u16 P1; // 2
|
u16 P1; // 2
|
||||||
u16 P2; // 2
|
u16 P2; // 2
|
||||||
u16 P3; // 2
|
u16 P3; // 2
|
||||||
|
|
||||||
u8 uv0[2]; // 2
|
u8 uv0[2]; // 2
|
||||||
u16 Clut; // 2
|
u16 Clut; // 2
|
||||||
u8 uv1[2]; // 2
|
u8 uv1[2]; // 2
|
||||||
|
@ -125,9 +144,9 @@ struct sQuad
|
||||||
u8 uv3[2]; // 2
|
u8 uv3[2]; // 2
|
||||||
u16 OTOfs; // 2
|
u16 OTOfs; // 2
|
||||||
u8 PolyCode; // 1
|
u8 PolyCode; // 1
|
||||||
u8 Pad; // 1
|
u8 PolyTag; // 1
|
||||||
}; // 24
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
//*** Game Types and Headers ************************************************
|
//*** Game Types and Headers ************************************************
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue