569 lines
14 KiB
C++
569 lines
14 KiB
C++
/***************************/
|
|
/*** 3d Tile Layer Class ***/
|
|
/***************************/
|
|
|
|
#include "system\global.h"
|
|
#include "system\vid.h"
|
|
#include <DStructs.h>
|
|
#include "utils\utils.h"
|
|
#include "gfx\prim.h"
|
|
#include "game\game.h"
|
|
|
|
#include "LayerTile.h"
|
|
#include "LayerTile3d.h"
|
|
|
|
|
|
#if defined(__USER_sbart__) || defined(__USER_daveo__)
|
|
#define _SHOW_POLYZ_ 1
|
|
#include "gfx\font.h"
|
|
static FontBank *Font;
|
|
int ShowPolyz=0;
|
|
#endif
|
|
|
|
static const int BLOCK_SIZE =16;
|
|
static const int SCREEN_TILE_ADJ_U =2;
|
|
static const int SCREEN_TILE_ADJ_D =1;
|
|
static const int SCREEN_TILE_ADJ_L =3;
|
|
static const int SCREEN_TILE_ADJ_R =3;
|
|
|
|
static const int SCREEN_TILE3D_WIDTH =(INGAME_SCREENW/BLOCK_SIZE)+SCREEN_TILE_ADJ_L+SCREEN_TILE_ADJ_R;
|
|
static const int SCREEN_TILE3D_HEIGHT =(INGAME_SCREENH/BLOCK_SIZE)+SCREEN_TILE_ADJ_U+SCREEN_TILE_ADJ_D;
|
|
|
|
static const int RENDER_X_OFS =INGAME_SCREENOFS_X-(SCREEN_TILE_ADJ_L*BLOCK_SIZE)+INGAME_RENDER_OFS_X;
|
|
static const int RENDER_Y_OFS =INGAME_SCREENOFS_Y-(SCREEN_TILE_ADJ_U*BLOCK_SIZE)+INGAME_RENDER_OFS_Y;
|
|
|
|
static const int DeltaTableSizeX=SCREEN_TILE3D_WIDTH+1;
|
|
static const int DeltaTableSizeY=SCREEN_TILE3D_HEIGHT+1;
|
|
|
|
|
|
/*****************************************************************************/
|
|
// 0 LUF
|
|
// 1 RUF
|
|
// 2 LDF
|
|
// 3 RDF
|
|
|
|
// 4 LUB
|
|
// 5 RUB
|
|
// 6 LDB
|
|
// 7 RDB
|
|
|
|
sFlipTable FlipTable[4]=
|
|
{
|
|
/*00 <0*/ {{+4096,0,+4096,0}, { ((DVECTOR*)SCRATCH_RAM)+0,
|
|
((DVECTOR*)SCRATCH_RAM)+1,
|
|
((DVECTOR*)SCRATCH_RAM)+2,
|
|
((DVECTOR*)SCRATCH_RAM)+3,
|
|
((DVECTOR*)SCRATCH_RAM)+4,
|
|
((DVECTOR*)SCRATCH_RAM)+5,
|
|
((DVECTOR*)SCRATCH_RAM)+6,
|
|
((DVECTOR*)SCRATCH_RAM)+7,
|
|
}, 0<<31},
|
|
/*01 >0*/ {{-4096,0,+4096,0}, { ((DVECTOR*)SCRATCH_RAM)+1,
|
|
((DVECTOR*)SCRATCH_RAM)+0,
|
|
((DVECTOR*)SCRATCH_RAM)+3,
|
|
((DVECTOR*)SCRATCH_RAM)+2,
|
|
((DVECTOR*)SCRATCH_RAM)+5,
|
|
((DVECTOR*)SCRATCH_RAM)+4,
|
|
((DVECTOR*)SCRATCH_RAM)+7,
|
|
((DVECTOR*)SCRATCH_RAM)+6,
|
|
},1<<31},
|
|
/*10 >0*/ {{+4096,0,-4096,0}, { ((DVECTOR*)SCRATCH_RAM)+2,
|
|
((DVECTOR*)SCRATCH_RAM)+3,
|
|
((DVECTOR*)SCRATCH_RAM)+0,
|
|
((DVECTOR*)SCRATCH_RAM)+1,
|
|
((DVECTOR*)SCRATCH_RAM)+6,
|
|
((DVECTOR*)SCRATCH_RAM)+7,
|
|
((DVECTOR*)SCRATCH_RAM)+4,
|
|
((DVECTOR*)SCRATCH_RAM)+5,
|
|
},1<<31},
|
|
/*11 <0*/ {{-4096,0,-4096,0}, { ((DVECTOR*)SCRATCH_RAM)+3,
|
|
((DVECTOR*)SCRATCH_RAM)+2,
|
|
((DVECTOR*)SCRATCH_RAM)+1,
|
|
((DVECTOR*)SCRATCH_RAM)+0,
|
|
((DVECTOR*)SCRATCH_RAM)+7,
|
|
((DVECTOR*)SCRATCH_RAM)+6,
|
|
((DVECTOR*)SCRATCH_RAM)+5,
|
|
((DVECTOR*)SCRATCH_RAM)+4,
|
|
},0<<31}
|
|
};
|
|
|
|
u8 RGBTable[16*4];
|
|
int RS=128;
|
|
int Ri=-6;
|
|
int GS=128;
|
|
int Gi=-6;
|
|
int BS=128;
|
|
int Bi=-6;
|
|
int AS=128;
|
|
int Ai=-6;
|
|
|
|
/*****************************************************************************/
|
|
/*****************************************************************************/
|
|
/*****************************************************************************/
|
|
CLayerTile3d::CLayerTile3d(sLevelHdr *LevelHdr,sLayerHdr *Hdr) : CLayerTile(LevelHdr,Hdr)
|
|
{
|
|
ElemBank3d=LevelHdr->ElemBank3d;
|
|
TriList=LevelHdr->TriList;
|
|
QuadList=LevelHdr->QuadList;
|
|
VtxList=LevelHdr->VtxList;
|
|
VtxIdxList=LevelHdr->VtxIdxList;
|
|
|
|
|
|
#if defined(_SHOW_POLYZ_)
|
|
Font=new ("PrimFont") FontBank;
|
|
Font->initialise( &standardFont );
|
|
Font->setOt( 0 );
|
|
Font->setTrans(1);
|
|
#endif
|
|
for (int i=0; i<16; i++)
|
|
{
|
|
int R,G,B;
|
|
R=RS-(i*Ri);
|
|
G=GS-(i*Gi);
|
|
B=BS-(i*Bi);
|
|
if (R<0) R=0; else if (R>255) R=255;
|
|
if (G<0) G=0; else if (G>255) G=255;
|
|
if (B<0) B=0; else if (B>255) B=255;
|
|
|
|
RGBTable[(i*4)+0]=R;
|
|
RGBTable[(i*4)+1]=G;
|
|
RGBTable[(i*4)+2]=B;
|
|
RGBTable[(i*4)+3]=0;
|
|
}
|
|
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
CLayerTile3d::~CLayerTile3d()
|
|
{
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
/*****************************************************************************/
|
|
/*****************************************************************************/
|
|
|
|
void CLayerTile3d::init(DVECTOR &MapPos,int Shift)
|
|
{
|
|
CLayerTile::init(MapPos,Shift);
|
|
CalcDelta();
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
void CLayerTile3d::shutdown()
|
|
{
|
|
#if defined(_SHOW_POLYZ_)
|
|
Font->dump();
|
|
delete Font;
|
|
#endif
|
|
for (int i=0; i<16; i++)
|
|
{
|
|
MemFree(FTableX[i]);
|
|
MemFree(FTableY[i]);
|
|
MemFree(BTableX[i]);
|
|
MemFree(BTableY[i]);
|
|
}
|
|
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
void CLayerTile3d::CalcDelta()
|
|
{
|
|
VECTOR BlkPos;
|
|
SVECTOR Pnt={-BLOCK_SIZE/2,-BLOCK_SIZE/2,-BLOCK_SIZE*4};
|
|
s16 *FTab,*BTab;
|
|
CGameScene::setCameraMtx();
|
|
|
|
for (int i=0; i<16; i++)
|
|
{
|
|
FTab=(s16*)MemAlloc(DeltaTableSizeX*sizeof(s16),"FTableXTable");
|
|
BTab=(s16*)MemAlloc(DeltaTableSizeX*sizeof(s16),"BTableXTable");
|
|
FTableX[i]=FTab;
|
|
BTableX[i]=BTab;
|
|
ASSERT(FTab);
|
|
ASSERT(BTab);
|
|
BlkPos.vx=RENDER_X_OFS-i;
|
|
BlkPos.vy=RENDER_Y_OFS;
|
|
for (int x=0; x<DeltaTableSizeX; x++)
|
|
{
|
|
s32 Tmp;
|
|
DVECTOR O;
|
|
CMX_SetTransMtxXY(&BlkPos);
|
|
Pnt.vz=-BLOCK_SIZE*4;
|
|
RotTransPers(&Pnt,(s32*)&O,&Tmp,&Tmp);
|
|
FTab[x]=O.vx;
|
|
Pnt.vz=+BLOCK_SIZE*4;
|
|
RotTransPers(&Pnt,(s32*)&O,&Tmp,&Tmp);
|
|
BTab[x]=O.vx;
|
|
BlkPos.vx+=BLOCK_SIZE;
|
|
}
|
|
|
|
FTab=(s16*)MemAlloc(DeltaTableSizeY*sizeof(s16),"FTableYTable");
|
|
BTab=(s16*)MemAlloc(DeltaTableSizeY*sizeof(s16),"BTableYTable");
|
|
FTableY[i]=FTab;
|
|
BTableY[i]=BTab;
|
|
ASSERT(FTab);
|
|
ASSERT(BTab);
|
|
BlkPos.vx=RENDER_X_OFS;
|
|
BlkPos.vy=RENDER_Y_OFS-i;
|
|
for (int y=0; y<DeltaTableSizeY; y++)
|
|
{
|
|
s32 Tmp;
|
|
DVECTOR O;
|
|
CMX_SetTransMtxXY(&BlkPos);
|
|
Pnt.vz=-BLOCK_SIZE*4;
|
|
RotTransPers(&Pnt,(s32*)&O,&Tmp,&Tmp);
|
|
FTab[y]=O.vy;
|
|
Pnt.vz=+BLOCK_SIZE*4;
|
|
RotTransPers(&Pnt,(s32*)&O,&Tmp,&Tmp);
|
|
BTab[y]=O.vy;
|
|
BlkPos.vy+=BLOCK_SIZE;
|
|
}
|
|
}
|
|
DeltaF=FTableX[0][1]-FTableX[0][0];
|
|
DeltaB=BTableY[0][1]-BTableY[0][0];
|
|
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
void CLayerTile3d::think(DVECTOR &MapPos)
|
|
{
|
|
MapXY.vx=MapPos.vx>>4;
|
|
MapXY.vy=MapPos.vy>>4;
|
|
|
|
MapXY.vx-=SCREEN_TILE_ADJ_L;
|
|
MapXY.vy-=SCREEN_TILE_ADJ_U;
|
|
|
|
ShiftX=(MapPos.vx & 15);
|
|
ShiftY=(MapPos.vy & 15);
|
|
|
|
RenderOfs.vx=RenderOfs.vy=0;
|
|
DeltaFOfs.vx=DeltaFOfs.vy=0;
|
|
DeltaBOfs.vx=DeltaBOfs.vy=0;
|
|
if (MapXY.vx<0)
|
|
{
|
|
RenderOfs.vx=-MapXY.vx*BLOCK_SIZE;
|
|
DeltaFOfs.vx=-MapXY.vx*DeltaF;
|
|
DeltaBOfs.vx=-MapXY.vx*DeltaB;
|
|
MapXY.vx=0;
|
|
}
|
|
if (MapXY.vy<0)
|
|
{
|
|
RenderOfs.vy=-MapXY.vy*BLOCK_SIZE;
|
|
DeltaFOfs.vy=-MapXY.vy*DeltaF;
|
|
DeltaBOfs.vy=-MapXY.vy*DeltaB;
|
|
MapXY.vy=0;
|
|
}
|
|
|
|
if (MapXY.vx+SCREEN_TILE3D_WIDTH<=MapWidth)
|
|
RenderW=SCREEN_TILE3D_WIDTH;
|
|
else
|
|
RenderW=MapWidth-MapXY.vx;
|
|
|
|
if (MapXY.vy+SCREEN_TILE3D_HEIGHT<=MapHeight)
|
|
RenderH=SCREEN_TILE3D_HEIGHT;
|
|
else
|
|
RenderH=MapHeight-MapXY.vy;
|
|
|
|
#if defined(__USER_daveo__)
|
|
if (AS!=-1)
|
|
{
|
|
RS=GS=BS=AS;
|
|
}
|
|
if (Ai!=-1)
|
|
{
|
|
Ri=Gi=Bi=Ai;
|
|
}
|
|
|
|
for (int i=0; i<16; i++)
|
|
{
|
|
int R,G,B;
|
|
R=RS-(i*Ri);
|
|
G=GS-(i*Gi);
|
|
B=BS-(i*Bi);
|
|
if (R<0) R=0; else if (R>255) R=255;
|
|
if (G<0) G=0; else if (G>255) G=255;
|
|
if (B<0) B=0; else if (B>255) B=255;
|
|
|
|
RGBTable[(i*4)+0]=R;
|
|
RGBTable[(i*4)+1]=G;
|
|
RGBTable[(i*4)+2]=B;
|
|
RGBTable[(i*4)+3]=0;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
/*****************************************************************************/
|
|
/*****************************************************************************/
|
|
void CLayerTile3d::CacheElemVtx(sElem3d *Elem)
|
|
{
|
|
int Count=Elem->VtxTriCount;
|
|
sVtx *V0,*V1,*V2;
|
|
u16 *IdxTable=&VtxIdxList[Elem->VtxIdxStart];
|
|
s32 *OutVtx=(s32*)SCRATCH_RAM;
|
|
s32 *OutPtr;
|
|
|
|
OutVtx+=8;
|
|
|
|
V0=&VtxList[*IdxTable++];
|
|
V1=&VtxList[*IdxTable++];
|
|
V2=&VtxList[*IdxTable++];
|
|
gte_ldv3(V0,V1,V2);
|
|
|
|
while (Count--)
|
|
{
|
|
gte_rtpt_b(); // 22 cycles
|
|
// Preload next (when able) - Must check this
|
|
V0=&VtxList[*IdxTable++];
|
|
V1=&VtxList[*IdxTable++];
|
|
V2=&VtxList[*IdxTable++];
|
|
OutPtr=OutVtx;
|
|
OutVtx+=3;
|
|
gte_ldv3(V0,V1,V2);
|
|
gte_stsxy3c(OutPtr); // read XY back
|
|
}
|
|
|
|
}
|
|
/*****************************************************************************/
|
|
void CLayerTile3d::render()
|
|
{
|
|
sTileMapElem *MapPtr=GetMapPos();
|
|
u8 *PrimPtr=GetPrimPtr();
|
|
u32 *XYList=(u32*)SCRATCH_RAM;
|
|
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;
|
|
|
|
for (int Y=0; Y<RenderH; Y++)
|
|
{
|
|
sTileMapElem *MapRow=MapPtr;
|
|
s32 BlkXOld=BlkPos.vx;
|
|
s16 *DeltaFX=FTableX[ShiftX];
|
|
s16 *DeltaBX=BTableX[ShiftX];
|
|
|
|
for (int X=0; X<RenderW; X++)
|
|
{
|
|
u16 Tile=MapRow->Tile;
|
|
u16 TileIdx=Tile>>2;
|
|
u16 Flip=Tile&3;
|
|
sFlipTable *FTab=&FlipTable[Flip];
|
|
sElem3d *Elem=&ElemBank3d[TileIdx];
|
|
|
|
int TriCount=Elem->TriCount;
|
|
sTri *TList=&TriList[Elem->TriStart];
|
|
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);
|
|
|
|
// --- Cache Vtx ----------
|
|
// CacheElemVtx(Elem);
|
|
{
|
|
int Count=Elem->VtxTriCount;
|
|
sVtx *V0,*V1,*V2;
|
|
u16 *IdxTable=&VtxIdxList[Elem->VtxIdxStart];
|
|
s32 *OutVtx=(s32*)SCRATCH_RAM;
|
|
s32 *OutPtr;
|
|
|
|
OutVtx+=8;
|
|
|
|
V0=&VtxList[*IdxTable++];
|
|
V1=&VtxList[*IdxTable++];
|
|
V2=&VtxList[*IdxTable++];
|
|
gte_ldv3(V0,V1,V2);
|
|
|
|
while (Count--)
|
|
{
|
|
gte_rtpt_b(); // 22 cycles
|
|
// Preload next (when able) - Must check this
|
|
V0=&VtxList[*IdxTable++];
|
|
V1=&VtxList[*IdxTable++];
|
|
V2=&VtxList[*IdxTable++];
|
|
OutPtr=OutVtx;
|
|
OutVtx+=3;
|
|
gte_ldv3(V0,V1,V2);
|
|
gte_stsxy3c(OutPtr); // read XY back
|
|
}
|
|
|
|
}
|
|
|
|
|
|
s16 FL=DeltaFX[0]+DeltaFOfs.vx;
|
|
s16 FR=DeltaFX[1]+DeltaFOfs.vx;
|
|
s16 FU=DeltaFY[0]+DeltaFOfs.vy;
|
|
s16 FD=DeltaFY[1]+DeltaFOfs.vy;
|
|
DP0=FTab->DeltaTab[0];
|
|
DP1=FTab->DeltaTab[1];
|
|
DP2=FTab->DeltaTab[2];
|
|
DP3=FTab->DeltaTab[3];
|
|
DP0->vx=FL;
|
|
DP0->vy=FU;
|
|
DP1->vx=FR;
|
|
DP1->vy=FU;
|
|
DP2->vx=FL;
|
|
DP2->vy=FD;
|
|
DP3->vx=FR;
|
|
DP3->vy=FD;
|
|
|
|
s16 BL=DeltaBX[0]+DeltaBOfs.vx;
|
|
s16 BR=DeltaBX[1]+DeltaBOfs.vx;
|
|
s16 BU=DeltaBY[0]+DeltaBOfs.vy;
|
|
s16 BD=DeltaBY[1]+DeltaBOfs.vy;
|
|
DP0=FTab->DeltaTab[4];
|
|
DP1=FTab->DeltaTab[5];
|
|
DP2=FTab->DeltaTab[6];
|
|
DP3=FTab->DeltaTab[7];
|
|
DP0->vx=BL;
|
|
DP0->vy=BU;
|
|
DP1->vx=BR;
|
|
DP1->vy=BU;
|
|
DP2->vx=BL;
|
|
DP2->vy=BD;
|
|
DP3->vx=BR;
|
|
DP3->vy=BD;
|
|
|
|
// --- Render Tri's -------------
|
|
while (TriCount--)
|
|
{
|
|
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);
|
|
|
|
setlen(ThisPrim, GPU_PolyGT3Tag);
|
|
gte_nclip_b(); // 8 cycles
|
|
|
|
#if defined(_SHOW_POLYZ_)
|
|
if (ShowPolyz) {setRGB0(ThisPrim,127,0,0); setRGB1(ThisPrim,255,0,0); setRGB2(ThisPrim,255,0,0);}
|
|
#endif
|
|
|
|
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
|
|
addPrim(ThisOT,ThisPrim);
|
|
// lighting
|
|
T0=*(u32*)&RGBTable[TList->C0];
|
|
T1=*(u32*)&RGBTable[TList->C1];
|
|
T2=*(u32*)&RGBTable[TList->C2];
|
|
*(u32*)&ThisPrim->r0=T0;
|
|
*(u32*)&ThisPrim->r1=T1;
|
|
*(u32*)&ThisPrim->r2=T2;
|
|
ThisPrim->code=TList->PolyCode;
|
|
|
|
PrimPtr+=sizeof(POLY_GT3);
|
|
#if defined(_SHOW_POLYZ_)
|
|
TCount++;
|
|
#endif
|
|
|
|
}
|
|
TList++;
|
|
}
|
|
|
|
// --- Render Quads -----------
|
|
while (QuadCount--)
|
|
{
|
|
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);
|
|
|
|
setlen(ThisPrim, GPU_PolyGT4Tag);
|
|
gte_nclip_b(); // 8 cycles
|
|
|
|
#if defined(_SHOW_POLYZ_)
|
|
if (ShowPolyz) {setRGB0(ThisPrim,0,127,0);setRGB1(ThisPrim,0,255,0); setRGB2(ThisPrim,0,255,0); setRGB3(ThisPrim,0,255,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;
|
|
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
|
|
// Lighting
|
|
T0=*(u32*)&RGBTable[QList->C0];
|
|
T1=*(u32*)&RGBTable[QList->C1];
|
|
T2=*(u32*)&RGBTable[QList->C2];
|
|
T3=*(u32*)&RGBTable[QList->C3];
|
|
*(u32*)&ThisPrim->r0=T0;
|
|
*(u32*)&ThisPrim->r1=T1;
|
|
*(u32*)&ThisPrim->r2=T2;
|
|
*(u32*)&ThisPrim->r3=T3;
|
|
ThisPrim->code=QList->PolyCode;
|
|
|
|
addPrim(ThisOT,ThisPrim);
|
|
PrimPtr+=sizeof(POLY_GT4);
|
|
#if defined(_SHOW_POLYZ_)
|
|
QCount++;
|
|
#endif
|
|
}
|
|
QList++;
|
|
}
|
|
|
|
}
|
|
MapRow++;
|
|
BlkPos.vx+=BLOCK_SIZE;
|
|
DeltaFX++; DeltaBX++;
|
|
}
|
|
MapPtr+=MapWidth;
|
|
BlkPos.vx=BlkXOld;
|
|
BlkPos.vy+=BLOCK_SIZE;
|
|
DeltaFY++; DeltaBY++;
|
|
}
|
|
|
|
SetPrimPtr((u8*)PrimPtr);
|
|
|
|
#if defined(_SHOW_POLYZ_)
|
|
char Txt[256];
|
|
sprintf(Txt,"TC %i\nQC %i",TCount,QCount);
|
|
Font->print( 128, 32, Txt);
|
|
#endif
|
|
|
|
}
|