SBSPSS/source/level/layertile3d.cpp

533 lines
14 KiB
C++
Raw Normal View History

2000-12-14 17:38:34 +01:00
/***************************/
/*** 3d Tile Layer Class ***/
/***************************/
2000-12-14 17:01:49 +01:00
#include "system\global.h"
2001-06-21 21:19:15 +02:00
#include "system\vid.h"
2000-12-14 17:01:49 +01:00
#include <DStructs.h>
#include "utils\utils.h"
#include "gfx\prim.h"
2001-04-19 21:56:43 +02:00
#include "game\game.h"
2000-12-14 17:01:49 +01:00
#include "LayerTile.h"
2000-12-14 17:38:34 +01:00
#include "LayerTile3d.h"
2000-12-14 17:01:49 +01:00
2001-04-19 21:56:43 +02:00
#if defined(__USER_sbart__) || defined(__USER_daveo__)
#define _SHOW_POLYZ_ 1
#include "gfx\font.h"
2001-04-19 01:04:03 +02:00
static FontBank *Font;
2001-07-20 18:17:26 +02:00
int ShowPolyz=0;
2001-03-10 17:54:47 +01:00
#endif
2001-04-19 01:04:03 +02:00
2001-06-21 21:25:19 +02:00
static const int BLOCK_SIZE =16;
static const int SCREEN_TILE_ADJ_U =2;
2001-06-28 19:48:30 +02:00
static const int SCREEN_TILE_ADJ_D =1;
2001-07-18 18:45:39 +02:00
static const int SCREEN_TILE_ADJ_L =3;
2001-06-21 21:25:19 +02:00
static const int SCREEN_TILE_ADJ_R =3;
2001-06-28 19:48:30 +02:00
2001-06-21 21:25:19 +02:00
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;
2001-06-28 19:48:30 +02:00
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;
2001-04-19 21:56:43 +02:00
2001-07-18 18:45:39 +02:00
static const int DeltaTableSizeX=SCREEN_TILE3D_WIDTH+1;
static const int DeltaTableSizeY=SCREEN_TILE3D_HEIGHT+1;
2001-07-12 22:10:15 +02:00
/*****************************************************************************/
2001-07-18 18:45:39 +02:00
// 0 LUF
// 1 RUF
// 2 LDF
// 3 RDF
// 4 LUB
// 5 RUB
// 6 LDB
// 7 RDB
2001-07-12 22:10:15 +02:00
sFlipTable FlipTable[4]=
{
2001-07-18 18:45:39 +02:00
/*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}
2001-07-12 22:10:15 +02:00
};
2000-12-14 17:01:49 +01:00
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-07-28 18:45:46 +02:00
CLayerTile3d::CLayerTile3d(sLevelHdr *LevelHdr,sLayerHdr *Hdr,u8 *_RGBMap,u8 *_RGBTable) : CLayerTile(LevelHdr,Hdr)
2000-12-14 17:01:49 +01:00
{
2001-06-28 19:48:30 +02:00
ElemBank3d=LevelHdr->ElemBank3d;
2001-04-19 17:12:21 +02:00
TriList=LevelHdr->TriList;
QuadList=LevelHdr->QuadList;
VtxList=LevelHdr->VtxList;
2001-07-12 22:10:15 +02:00
VtxIdxList=LevelHdr->VtxIdxList;
2001-07-28 18:45:46 +02:00
RGBMap=_RGBMap;
RGBTable=_RGBTable;
2001-07-25 23:37:17 +02:00
2001-03-10 17:54:47 +01:00
#if defined(_SHOW_POLYZ_)
2001-04-19 01:04:03 +02:00
Font=new ("PrimFont") FontBank;
Font->initialise( &standardFont );
Font->setOt( 0 );
Font->setTrans(1);
2001-03-09 00:12:02 +01:00
#endif
2001-07-25 23:37:17 +02:00
2000-12-14 17:01:49 +01:00
}
/*****************************************************************************/
2000-12-14 17:38:34 +01:00
CLayerTile3d::~CLayerTile3d()
2000-12-14 17:01:49 +01:00
{
}
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-01-04 22:53:14 +01:00
2001-02-22 15:55:13 +01:00
void CLayerTile3d::init(DVECTOR &MapPos,int Shift)
{
CLayerTile::init(MapPos,Shift);
2001-07-18 18:45:39 +02:00
CalcDelta();
2000-12-14 17:01:49 +01:00
}
/*****************************************************************************/
2000-12-14 17:38:34 +01:00
void CLayerTile3d::shutdown()
2000-12-14 17:01:49 +01:00
{
2001-04-19 01:04:03 +02:00
#if defined(_SHOW_POLYZ_)
Font->dump();
delete Font;
#endif
2001-07-18 18:45:39 +02:00
for (int i=0; i<16; i++)
{
MemFree(FTableX[i]);
MemFree(FTableY[i]);
MemFree(BTableX[i]);
MemFree(BTableY[i]);
}
2001-01-17 23:19:53 +01:00
}
2001-03-09 00:02:47 +01:00
/*****************************************************************************/
2001-07-18 18:45:39 +02:00
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];
}
2001-05-09 23:56:48 +02:00
2001-07-18 18:45:39 +02:00
/*****************************************************************************/
2001-03-09 00:02:47 +01:00
void CLayerTile3d::think(DVECTOR &MapPos)
{
2001-04-19 21:56:43 +02:00
MapXY.vx=MapPos.vx>>4;
MapXY.vy=MapPos.vy>>4;
2001-03-09 00:02:47 +01:00
2001-06-21 21:19:15 +02:00
MapXY.vx-=SCREEN_TILE_ADJ_L;
MapXY.vy-=SCREEN_TILE_ADJ_U;
2001-03-09 00:02:47 +01:00
2001-04-19 21:56:43 +02:00
ShiftX=(MapPos.vx & 15);
ShiftY=(MapPos.vy & 15);
2001-03-09 00:02:47 +01:00
2001-03-12 16:24:37 +01:00
RenderOfs.vx=RenderOfs.vy=0;
2001-07-18 18:45:39 +02:00
DeltaFOfs.vx=DeltaFOfs.vy=0;
DeltaBOfs.vx=DeltaBOfs.vy=0;
2001-03-12 16:24:37 +01:00
if (MapXY.vx<0)
{
2001-06-21 21:19:15 +02:00
RenderOfs.vx=-MapXY.vx*BLOCK_SIZE;
2001-07-18 18:45:39 +02:00
DeltaFOfs.vx=-MapXY.vx*DeltaF;
DeltaBOfs.vx=-MapXY.vx*DeltaB;
2001-03-12 16:24:37 +01:00
MapXY.vx=0;
}
if (MapXY.vy<0)
{
2001-06-21 21:19:15 +02:00
RenderOfs.vy=-MapXY.vy*BLOCK_SIZE;
2001-07-18 18:45:39 +02:00
DeltaFOfs.vy=-MapXY.vy*DeltaF;
DeltaBOfs.vy=-MapXY.vy*DeltaB;
2001-03-12 16:24:37 +01:00
MapXY.vy=0;
}
2001-03-09 00:02:47 +01:00
2001-05-09 23:56:48 +02:00
if (MapXY.vx+SCREEN_TILE3D_WIDTH<=MapWidth)
RenderW=SCREEN_TILE3D_WIDTH;
2001-03-09 00:02:47 +01:00
else
RenderW=MapWidth-MapXY.vx;
2001-05-09 23:56:48 +02:00
if (MapXY.vy+SCREEN_TILE3D_HEIGHT<=MapHeight)
RenderH=SCREEN_TILE3D_HEIGHT;
2001-03-09 00:02:47 +01:00
else
RenderH=MapHeight-MapXY.vy;
}
2001-01-04 22:53:14 +01:00
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-07-12 22:10:15 +02:00
void CLayerTile3d::CacheElemVtx(sElem3d *Elem)
{
int Count=Elem->VtxTriCount;
sVtx *V0,*V1,*V2;
u16 *IdxTable=&VtxIdxList[Elem->VtxIdxStart];
2001-07-18 18:45:39 +02:00
s32 *OutVtx=(s32*)SCRATCH_RAM;
s32 *OutPtr;
OutVtx+=8;
2001-06-28 19:48:30 +02:00
2001-07-12 22:10:15 +02:00
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
}
}
2001-07-28 18:45:46 +02:00
2001-07-12 22:10:15 +02:00
/*****************************************************************************/
void CLayerTile3d::render()
2001-06-28 19:48:30 +02:00
{
2001-07-28 18:45:46 +02:00
int MapOfs=GetMapOfs();
sTileMapElem *MapPtr=Map+MapOfs;
u8 *RGBMapPtr=RGBMap+MapOfs;
2001-07-12 22:10:15 +02:00
u8 *PrimPtr=GetPrimPtr();
u32 *XYList=(u32*)SCRATCH_RAM;
2001-07-20 18:17:26 +02:00
u32 T0,T1,T2,T3;
u32 P0,P1,P2,P3;
2001-07-12 22:10:15 +02:00
s32 ClipZ;
sOT *ThisOT;
VECTOR BlkPos;
2001-07-18 18:45:39 +02:00
DVECTOR *DP0,*DP1,*DP2,*DP3;
s16 *DeltaFY=FTableY[ShiftY];
s16 *DeltaBY=BTableY[ShiftY];
2001-04-19 01:04:03 +02:00
2001-07-20 18:17:26 +02:00
#if defined(_SHOW_POLYZ_)
s16 TCount=0,QCount=0;
#endif
2001-04-19 21:56:43 +02:00
// Setup Trans Matrix
2001-05-11 03:10:06 +02:00
BlkPos.vx=RENDER_X_OFS-(ShiftX)+RenderOfs.vx;
BlkPos.vy=RENDER_Y_OFS-(ShiftY)+RenderOfs.vy;
2001-04-19 01:04:03 +02:00
for (int Y=0; Y<RenderH; Y++)
{
sTileMapElem *MapRow=MapPtr;
2001-07-28 18:45:46 +02:00
u8 *RGBRow=RGBMapPtr;
2001-04-19 01:04:03 +02:00
s32 BlkXOld=BlkPos.vx;
2001-07-18 18:45:39 +02:00
s16 *DeltaFX=FTableX[ShiftX];
s16 *DeltaBX=BTableX[ShiftX];
2001-04-19 01:04:03 +02:00
for (int X=0; X<RenderW; X++)
{
2001-06-28 19:48:30 +02:00
u16 Tile=MapRow->Tile;
u16 TileIdx=Tile>>2;
u16 Flip=Tile&3;
sFlipTable *FTab=&FlipTable[Flip];
sElem3d *Elem=&ElemBank3d[TileIdx];
2001-07-18 18:45:39 +02:00
2001-06-28 19:48:30 +02:00
int TriCount=Elem->TriCount;
sTri *TList=&TriList[Elem->TriStart];
2001-07-20 18:17:26 +02:00
int QuadCount=Elem->QuadCount;
sQuad *QList=&QuadList[Elem->QuadStart];
2001-07-28 18:45:46 +02:00
int RGBOfs=*RGBRow++;
u8 *RGB=&RGBTable[RGBOfs*(16*4)];
2001-07-20 18:17:26 +02:00
if (TriCount || QuadCount) // Blank tiles rejected here, to prevent over processing (as no tri-count)
2001-04-19 01:04:03 +02:00
{
2001-07-18 18:45:39 +02:00
CMX_SetTransMtxXY(&BlkPos);
CMX_SetRotMatrixXY(&FTab->Mtx);
2001-07-24 22:17:50 +02:00
// --- 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
}
}
2001-07-18 18:45:39 +02:00
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;
2001-07-24 22:17:50 +02:00
// --- Render Tri's -------------
2001-07-18 18:45:39 +02:00
while (TriCount--)
2001-04-19 01:04:03 +02:00
{
2001-07-25 23:37:17 +02:00
POLY_GT3 *ThisPrim=(POLY_GT3*)PrimPtr;
2001-07-20 18:17:26 +02:00
2001-07-18 18:45:39 +02:00
P0=XYList[TList->P0];
P1=XYList[TList->P1];
P2=XYList[TList->P2];
gte_ldsxy0(P0);
gte_ldsxy1(P1);
gte_ldsxy2(P2);
2001-07-25 23:37:17 +02:00
setlen(ThisPrim, GPU_PolyGT3Tag);
2001-07-18 18:45:39 +02:00
gte_nclip_b(); // 8 cycles
2001-07-20 18:17:26 +02:00
#if defined(_SHOW_POLYZ_)
2001-07-26 17:02:16 +02:00
if (ShowPolyz) {setRGB0(ThisPrim,127,0,0); setRGB1(ThisPrim,255,0,0); setRGB2(ThisPrim,255,0,0);}
2001-07-20 18:17:26 +02:00
#endif
2001-07-18 18:45:39 +02:00
T0=*(u32*)&TList->uv0; // Get UV0 & TPage
T1=*(u32*)&TList->uv1; // Get UV1 & Clut
2001-07-20 18:17:26 +02:00
T2=*(u32*)&TList->uv2; // Get UV2
*(u32*)&ThisPrim->u0=T0; // Set UV0
*(u32*)&ThisPrim->u1=T1; // Set UV1
*(u32*)&ThisPrim->u2=T2; // Set UV2
2001-07-18 18:45:39 +02:00
gte_stopz(&ClipZ);
ThisOT=OtPtr+TList->OTOfs;
ClipZ^=FTab->ClipCode;
if (ClipZ<0)
{
2001-07-20 18:17:26 +02:00
*(u32*)&ThisPrim->x0=P0; // Set XY0
*(u32*)&ThisPrim->x1=P1; // Set XY1
*(u32*)&ThisPrim->x2=P2; // Set XY2
addPrim(ThisOT,ThisPrim);
2001-07-30 16:17:18 +02:00
#if defined(_SHOW_POLYZ_)
if (!ShowPolyz)
#endif
{ // lighting
2001-07-28 18:45:46 +02:00
T0=*(u32*)&RGB[TList->C0];
T1=*(u32*)&RGB[TList->C1];
T2=*(u32*)&RGB[TList->C2];
2001-07-25 23:37:17 +02:00
*(u32*)&ThisPrim->r0=T0;
*(u32*)&ThisPrim->r1=T1;
*(u32*)&ThisPrim->r2=T2;
2001-07-30 16:17:18 +02:00
}
2001-07-25 23:37:17 +02:00
ThisPrim->code=TList->PolyCode;
PrimPtr+=sizeof(POLY_GT3);
2001-07-20 18:17:26 +02:00
#if defined(_SHOW_POLYZ_)
TCount++;
#endif
}
2001-07-25 23:37:17 +02:00
TList++;
2001-07-20 18:17:26 +02:00
}
2001-07-24 22:17:50 +02:00
// --- Render Quads -----------
2001-07-20 18:17:26 +02:00
while (QuadCount--)
{
2001-07-25 23:37:17 +02:00
POLY_GT4 *ThisPrim=(POLY_GT4*)PrimPtr;
2001-07-20 18:17:26 +02:00
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);
2001-07-25 23:37:17 +02:00
setlen(ThisPrim, GPU_PolyGT4Tag);
2001-07-20 18:17:26 +02:00
gte_nclip_b(); // 8 cycles
#if defined(_SHOW_POLYZ_)
2001-07-26 17:02:16 +02:00
if (ShowPolyz) {setRGB0(ThisPrim,0,127,0);setRGB1(ThisPrim,0,255,0); setRGB2(ThisPrim,0,255,0); setRGB3(ThisPrim,0,255,0);}
2001-07-20 18:17:26 +02:00
#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
2001-07-30 16:17:18 +02:00
#if defined(_SHOW_POLYZ_)
if (!ShowPolyz)
#endif
{ // Lighting
2001-07-28 18:45:46 +02:00
T0=*(u32*)&RGB[QList->C0];
T1=*(u32*)&RGB[QList->C1];
T2=*(u32*)&RGB[QList->C2];
T3=*(u32*)&RGB[QList->C3];
2001-07-25 23:37:17 +02:00
*(u32*)&ThisPrim->r0=T0;
*(u32*)&ThisPrim->r1=T1;
*(u32*)&ThisPrim->r2=T2;
*(u32*)&ThisPrim->r3=T3;
2001-07-30 16:17:18 +02:00
}
2001-07-25 23:37:17 +02:00
ThisPrim->code=QList->PolyCode;
2001-07-20 18:17:26 +02:00
addPrim(ThisOT,ThisPrim);
2001-07-25 23:37:17 +02:00
PrimPtr+=sizeof(POLY_GT4);
2001-07-20 18:17:26 +02:00
#if defined(_SHOW_POLYZ_)
QCount++;
#endif
2001-07-18 18:45:39 +02:00
}
2001-07-25 23:37:17 +02:00
QList++;
2001-04-19 01:04:03 +02:00
}
2001-07-20 18:17:26 +02:00
2001-04-19 01:04:03 +02:00
}
MapRow++;
2001-06-21 21:19:15 +02:00
BlkPos.vx+=BLOCK_SIZE;
2001-07-18 18:45:39 +02:00
DeltaFX++; DeltaBX++;
2001-04-19 01:04:03 +02:00
}
MapPtr+=MapWidth;
2001-07-28 18:45:46 +02:00
RGBMapPtr+=MapWidth;
2001-04-19 01:04:03 +02:00
BlkPos.vx=BlkXOld;
2001-06-21 21:19:15 +02:00
BlkPos.vy+=BLOCK_SIZE;
2001-07-18 18:45:39 +02:00
DeltaFY++; DeltaBY++;
2001-04-19 01:04:03 +02:00
}
2001-07-20 18:17:26 +02:00
SetPrimPtr((u8*)PrimPtr);
2001-04-19 01:04:03 +02:00
#if defined(_SHOW_POLYZ_)
char Txt[256];
sprintf(Txt,"TC %i\nQC %i",TCount,QCount);
Font->print( 128, 32, Txt);
#endif
}