This commit is contained in:
Daveo 2001-07-20 16:17:26 +00:00
parent 475cec47a3
commit c1aeb7ec0e
7 changed files with 127 additions and 39 deletions

View File

@ -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 );

View File

@ -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<sTri> &PList,vector<sVtx> &VtxList,int Start,int Count)
{
int ZOfs=+4*Scale;
int PntCount=3;
for (int i=0;i<Count;i++)
{
sTri &P=PList[Start+i];
int OtOfs=0;
float OtOfs=0;
int Z[3];
// Get VtxZ
@ -640,17 +645,17 @@ int ZOfs=+4*Scale;
Z[1]=VtxList[P.P1].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=((int)sqrt(OtOfs/3))/8;
OtOfs=sqrt(OtOfs/PntCount);
OtOfs/=8;
OtOfs+=P.OTOfs;
if (OtOfs>15) OtOfs=15;
if (OtOfs<0) OtOfs=0;
if (OtOfs>OTMax) OtOfs=OTMax;
if (OtOfs<OTMin) OtOfs=OTMin;
P.OTOfs=OtOfs;
}
@ -661,11 +666,12 @@ int ZOfs=+4*Scale;
void CMkLevel::CalcOtOfs(vector<sQuad> &PList,vector<sVtx> &VtxList,int Start,int Count)
{
int ZOfs=+4*Scale;
int PntCount=4;
for (int i=0;i<Count;i++)
{
sQuad &P=PList[Start+i];
int OtOfs=0;
float OtOfs=0;
int Z[4];
// Get VtxZ
@ -674,14 +680,17 @@ int ZOfs=+4*Scale;
Z[2]=VtxList[P.P2].vz+ZOfs;
Z[3]=VtxList[P.P3].vz+ZOfs;
for (int p=0; p<4; p++) OtOfs+=Z[p]*Z[p];
OtOfs=((int)sqrt(OtOfs/4))/8;
for (int p=0; p<PntCount; p++)
{
OtOfs+=Z[p]*Z[p];
}
OtOfs=sqrt(OtOfs/PntCount);
OtOfs/=8;
OtOfs+=P.OTOfs;
if (OtOfs>15) OtOfs=15;
if (OtOfs<0) OtOfs=0;
if (OtOfs>OTMax) OtOfs=OTMax;
if (OtOfs<OTMin) OtOfs=OTMin;
P.OTOfs=OtOfs;
}

View File

@ -38,7 +38,7 @@ TEMP_FILE := $(TEMP_BUILD_DIR)/build.tmp
#----------------------------------------------------------------------------
#--- 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_OUT_DIR := $(DATA_OUT)/levels
LEVELS_MAKEFILE_DIR := $(TEMP_BUILD_DIR)/levels

View File

@ -29,7 +29,7 @@ enum
{
OTPOS__DEBUG_INFO=0,
OTPOS__INGAME_UI=0,
OTPOS__ACTOR_POS=6,
OTPOS__ACTOR_POS=5,
OTPOS__PICKUP_POS=OTPOS__ACTOR_POS,
};

View File

@ -17,6 +17,7 @@
#define _SHOW_POLYZ_ 1
#include "gfx\font.h"
static FontBank *Font;
int ShowPolyz=0;
#endif
static const int BLOCK_SIZE =16;
@ -274,18 +275,20 @@ void CLayerTile3d::render()
{
sTileMapElem *MapPtr=GetMapPos();
u8 *PrimPtr=GetPrimPtr();
POLY_FT3 *TPrimPtr=(POLY_FT3*)PrimPtr;
u32 *XYList=(u32*)SCRATCH_RAM;
u32 T0,T1,T2;
u32 P0,P1,P2;
u32 T0,T1,T2,T3;
u32 P0,P1,P2,P3;
s32 ClipZ;
sOT *ThisOT;
VECTOR BlkPos;
DVECTOR *DP0,*DP1,*DP2,*DP3;
s16 *DeltaFY=FTableY[ShiftY];
s16 *DeltaBY=BTableY[ShiftY];
#if defined(_SHOW_POLYZ_)
s16 TCount=0,QCount=0;
#endif
// Setup Trans Matrix
BlkPos.vx=RENDER_X_OFS-(ShiftX)+RenderOfs.vx;
BlkPos.vy=RENDER_Y_OFS-(ShiftY)+RenderOfs.vy;
@ -307,8 +310,9 @@ s16 *DeltaBY=BTableY[ShiftY];
int TriCount=Elem->TriCount;
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

Binary file not shown.

View File

@ -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 ************************************************