This commit is contained in:
parent
bfeef1bce5
commit
f338710074
38 changed files with 358 additions and 1018 deletions
|
@ -7,46 +7,40 @@
|
|||
#include "utils\utils.h"
|
||||
#include "gfx\prim.h"
|
||||
|
||||
#if defined(__USER_sbart__) || defined(__USER_daveo__)
|
||||
#define _SHOW_POLYZ_ 1
|
||||
#endif
|
||||
|
||||
#include "LayerTile.h"
|
||||
#include "LayerTile3d.h"
|
||||
|
||||
#include "gfx\font.h"
|
||||
|
||||
#if defined(__USER_art__) || defined(__USER_sbart__) || defined(__USER_daveo__)
|
||||
#define _SHOW_POLYZ_ 1
|
||||
#endif
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
CLayerTile3d::CLayerTile3d(sLayerHdr *Hdr,sTile *TileBank) : CLayerTile(Hdr,TileBank)
|
||||
{
|
||||
|
||||
LayerInfo=(sLayer3d*)MakePtr(Hdr,sizeof(sLayerHdr));
|
||||
|
||||
TriList=(sTri*) MakePtr(Hdr,LayerInfo->TriList);
|
||||
QuadList=(sQuad*) MakePtr(Hdr,LayerInfo->QuadList);
|
||||
VtxList=(sVtx*) MakePtr(Hdr,LayerInfo->VtxList);
|
||||
|
||||
Map=(sTileMapElem*)MakePtr(Hdr,sizeof(sLayerHdr)+sizeof(sLayer3d));
|
||||
|
||||
Font=0;
|
||||
#if defined(_SHOW_POLYZ_)
|
||||
Font=new ("PrimFont") FontBank;
|
||||
Font->initialise( &standardFont );
|
||||
Font->setOt( 0 );
|
||||
Font->setTrans(1);
|
||||
static FontBank *Font;
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
CLayerTile3d::CLayerTile3d(sLvlHdr *LvlHdr,sLayerHdr *Hdr) : CLayerTile(LvlHdr,Hdr)
|
||||
{
|
||||
TileBank3d=LvlHdr->TileBank3d;
|
||||
TriList=LvlHdr->TriList;
|
||||
QuadList=LvlHdr->QuadList;
|
||||
VtxList=LvlHdr->VtxList;
|
||||
|
||||
#if defined(_SHOW_POLYZ_)
|
||||
Font=new ("PrimFont") FontBank;
|
||||
Font->initialise( &standardFont );
|
||||
Font->setOt( 0 );
|
||||
Font->setTrans(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
CLayerTile3d::~CLayerTile3d()
|
||||
{
|
||||
if (Font)
|
||||
{
|
||||
Font->dump();
|
||||
delete Font;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,6 +56,10 @@ void CLayerTile3d::init(DVECTOR &MapPos,int Shift)
|
|||
/*****************************************************************************/
|
||||
void CLayerTile3d::shutdown()
|
||||
{
|
||||
#if defined(_SHOW_POLYZ_)
|
||||
Font->dump();
|
||||
delete Font;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -106,8 +104,100 @@ int YPos=MapPos.vy>>MapXYShift;
|
|||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
int BLOCK_MULTx=1;
|
||||
#if 1
|
||||
VECTOR asd={0,0,0};
|
||||
|
||||
void CLayerTile3d::render()
|
||||
{
|
||||
|
||||
const int XOfs=-(BLOCK_MULT*15)-(SCREEN_TILE_ADJ_LEFT*BLOCK_MULT);
|
||||
const int YOfs=-(BLOCK_MULT*7)-(SCREEN_TILE_ADJ_UP*BLOCK_MULT);
|
||||
|
||||
sTileMapElem *MapPtr=GetMapPos();
|
||||
u8 *PrimPtr=GetPrimPtr();
|
||||
POLY_FT3 *TPrimPtr=(POLY_FT3*)PrimPtr;
|
||||
VECTOR BlkPos;
|
||||
sVtx *P0,*P1,*P2;
|
||||
u32 T0,T1,T2;
|
||||
s32 ClipZ;
|
||||
sOT *ThisOT;
|
||||
|
||||
// Setup Trans Matrix
|
||||
BlkPos.vx=XOfs-((MapXY.vx+ShiftX));
|
||||
BlkPos.vy=YOfs-((MapXY.vy+ShiftY));
|
||||
BlkPos.vx+=RenderOfs.vx;
|
||||
BlkPos.vy+=RenderOfs.vy;
|
||||
|
||||
BlkPos.vx+=asd.vx;
|
||||
BlkPos.vy+=asd.vy;
|
||||
|
||||
|
||||
for (int Y=0; Y<RenderH; Y++)
|
||||
{
|
||||
sTileMapElem *MapRow=MapPtr;
|
||||
s32 BlkXOld=BlkPos.vx;
|
||||
|
||||
for (int X=0; X<RenderW; X++)
|
||||
{
|
||||
sTile3d *Tile=&TileBank3d[MapRow->Tile];
|
||||
int TriCount=Tile->TriCount;
|
||||
sTri *TList=&TriList[Tile->TriStart];
|
||||
|
||||
while (TriCount--) // Blank tiles rejected here (as no tri-count)
|
||||
{
|
||||
P0=&VtxList[TList->P0]; P1=&VtxList[TList->P1]; P2=&VtxList[TList->P2];
|
||||
CMX_SetTransMtxXY(&BlkPos);
|
||||
gte_ldv3(P0,P1,P2);
|
||||
setPolyFT3(TPrimPtr);
|
||||
setShadeTex(TPrimPtr,1);
|
||||
setlen(TPrimPtr, GPU_PolyFT3Tag);
|
||||
gte_rtpt_b();
|
||||
|
||||
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
|
||||
if (TList->OTOfs>MAX_OT-1) TList->OTOfs=MAX_OT-1;
|
||||
ThisOT=OtPtr+TList->OTOfs;
|
||||
|
||||
TList++;
|
||||
// gte_nclip_b();
|
||||
gte_stsxy3_ft3(TPrimPtr);
|
||||
// gte_stopz(&ClipZ);
|
||||
// if (ClipZ<=0)
|
||||
{
|
||||
addPrim(ThisOT,TPrimPtr);
|
||||
// addPrimNoCheck(OtPtr,TPrimPtr);
|
||||
TPrimPtr++;
|
||||
}
|
||||
}
|
||||
MapRow++;
|
||||
BlkPos.vx+=BLOCK_MULT;
|
||||
}
|
||||
MapPtr+=MapWidth;
|
||||
BlkPos.vx=BlkXOld;
|
||||
BlkPos.vy+=BLOCK_MULT;
|
||||
}
|
||||
|
||||
SetPrimPtr((u8*)TPrimPtr);
|
||||
|
||||
#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
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
void CLayerTile3d::render()
|
||||
{
|
||||
/*
|
||||
const int XOfs=-(BLOCK_MULT*15)-(SCREEN_TILE_ADJ_LEFT*BLOCK_MULT);
|
||||
const int YOfs=-(BLOCK_MULT*7)-(SCREEN_TILE_ADJ_UP*BLOCK_MULT);
|
||||
|
||||
|
@ -182,5 +272,7 @@ char Txt[256];
|
|||
sprintf(Txt,"Poly Count=%i",PolyCount);
|
||||
Font->print( 32, 32, Txt);
|
||||
#endif
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue