This commit is contained in:
Daveo 2001-04-20 22:20:58 +00:00
parent 5c54345a81
commit 68fa6f4e6c
5 changed files with 121 additions and 0 deletions

View File

@ -415,3 +415,93 @@ u8 H=Frame->H;
}
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
sModel *CModelGfx::ModelTable;
sTri *CModelGfx::ModelTriList;
sQuad *CModelGfx::ModelQuadList;
sVtx *CModelGfx::ModelVtxList;
/*****************************************************************************/
void CModelGfx::SetData(sModel *Table,sTri *TList,sQuad *QList,sVtx *VList)
{
ModelTable=Table;
ModelTriList=TList;
ModelQuadList=QList;
ModelVtxList=VList;
}
/*****************************************************************************/
void CModelGfx::SetModel(int Type)
{
Model=&CModelGfx::ModelTable[Type];
}
/*****************************************************************************/
int DX=1;
int DY=1;
int PXOfs=-16;
int PYOfs=-6;
void CModelGfx::Render(DVECTOR &Pos)
{
#define BLOCK_MULT 16
u8 *PrimPtr=GetPrimPtr();
POLY_FT3 *TPrimPtr=(POLY_FT3*)PrimPtr;
sVtx *P0,*P1,*P2;
u32 T0,T1,T2;
s32 ClipZ;
sOT *ThisOT;
DVECTOR MapXY;
VECTOR RenderPos;
int TriCount=Model->TriCount;
sTri *TList=&ModelTriList[Model->TriStart];
MapXY.vx=Pos.vx>>4;
MapXY.vy=Pos.vy>>4;
int ShiftX=(Pos.vx & 15);
int ShiftY=(Pos.vy & 15);
RenderPos.vx=(PXOfs*16)+((MapXY.vx*16)+ShiftX);
RenderPos.vy=(PYOfs*16)+((MapXY.vy*16)+ShiftY);
CMX_SetTransMtxXY(&RenderPos);
while (TriCount--)
{
P0=&ModelVtxList[TList->P0]; P1=&ModelVtxList[TList->P1]; P2=&ModelVtxList[TList->P2];
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);
// if (TriCount==1)
// {
// printf("%i,%i\n",TPrimPtr->x0,TPrimPtr->y0);
//
// }
gte_stopz(&ClipZ);
if (ClipZ<=0)
{
addPrim(ThisOT,TPrimPtr);
TPrimPtr++;
}
}
SetPrimPtr((u8*)TPrimPtr);
}

View File

@ -126,6 +126,26 @@ static u8 UnpackBuffer[CActorPool::MAX_ACTOR_SIZE];
};
/*****************************************************************************/
class CModelGfx
{
public:
CModelGfx(){};
virtual ~CModelGfx(){};
static void SetData(sModel *Table,sTri *TList,sQuad *QList,sVtx *VList);
void SetModel(int Type);
void Render(DVECTOR &Pos);
protected:
static sModel *ModelTable;
static sTri *ModelTriList;
static sQuad *ModelQuadList;
static sVtx *ModelVtxList;
sModel *Model;
};
/*****************************************************************************/
#endif

View File

@ -131,6 +131,7 @@ sLvlTab *lvlTab=&LvlTable[LevelNo];
LevelHdr->TriList=(sTri*) MakePtr(LevelHdr,(int)LevelHdr->TriList);
LevelHdr->QuadList=(sQuad*) MakePtr(LevelHdr,(int)LevelHdr->QuadList);
LevelHdr->VtxList=(sVtx*) MakePtr(LevelHdr,(int)LevelHdr->VtxList);
LevelHdr->PlatformGfx=(sModel*) MakePtr(LevelHdr,(int)LevelHdr->PlatformGfx);
printf("ActorList %i\n",(int)LevelHdr->ActorList);
printf("ItemList %i\n",(int)LevelHdr->ItemList);
@ -138,6 +139,7 @@ sLvlTab *lvlTab=&LvlTable[LevelNo];
printf("TriggerList %i\n",(int)LevelHdr->TriggerList);
printf("FXList %i\n",(int)LevelHdr->FXList);
CModelGfx::SetData(LevelHdr->PlatformGfx,LevelHdr->TriList,LevelHdr->QuadList,LevelHdr->VtxList);
m_levelTPage=TPLoadTex(lvlTab->TexFilename);
s_playerSpawnPos.vx=LevelHdr->PlayerStartX*16;

Binary file not shown.

View File

@ -181,6 +181,12 @@ struct sLayerShadeHdr
sLayerShadeGfx BackGfx[2];
};
//---------------------------------------------------------------------------
struct sModel
{
u16 TriCount;
u16 TriStart;
};
//---------------------------------------------------------------------------
// Header
struct sLevelHdr
@ -203,6 +209,7 @@ struct sLevelHdr
sTri *TriList;
sQuad *QuadList;
sVtx *VtxList;
sModel *PlatformGfx;
};
//***************************************************************************
@ -276,6 +283,8 @@ struct sThingPlatform
u16 Type;
u16 Speed;
u16 TurnRate;
u16 Gfx;
u16 Pad;
u8 Flags;
u8 PointCount;
// Point List...