This commit is contained in:
parent
ff9329d718
commit
389110e981
5 changed files with 64 additions and 65 deletions
|
@ -81,7 +81,8 @@ int CLayerCollision::getHeightFromGround(int _x,int _y,int _maxHeight)
|
|||
int maxHeightToCheck;
|
||||
|
||||
mapX=_x>>4;
|
||||
mapY=(_y>>4)*MapWidth;
|
||||
// mapY=(_y>>4)*MapWidth;
|
||||
mapY=GetYPos(_y>>4);
|
||||
xFraction=_x&0x0f;
|
||||
yFraction=16-(_y&0x0f);
|
||||
distanceFromGround=0;
|
||||
|
@ -135,7 +136,8 @@ int CLayerCollision::getHeightFromGroundExcluding(int _x,int _y,int _exclusion
|
|||
int maxHeightToCheck;
|
||||
|
||||
mapX=_x>>4;
|
||||
mapY=(_y>>4)*MapWidth;
|
||||
// mapY=(_y>>4)*MapWidth;
|
||||
mapY=GetYPos(_y>>4);
|
||||
xFraction=_x&0x0f;
|
||||
yFraction=16-(_y&0x0f);
|
||||
distanceFromGround=0;
|
||||
|
@ -201,7 +203,8 @@ int CLayerCollision::getHeightFromGroundCart(int _x,int _y,int _maxHeight)
|
|||
int maxHeightToCheck;
|
||||
|
||||
mapX=_x>>4;
|
||||
mapY=(_y>>4)*MapWidth;
|
||||
// mapY=(_y>>4)*MapWidth;
|
||||
mapY=GetYPos(_y>>4);
|
||||
xFraction=_x&0x0f;
|
||||
yFraction=16-(_y&0x0f);
|
||||
distanceFromGround=0;
|
||||
|
@ -315,7 +318,8 @@ void CLayerCollision::render(DVECTOR &MapPos)
|
|||
mapy=MapPos.vy/16;
|
||||
for(y=-yoff;y<(20*16)-yoff;y+=16)
|
||||
{
|
||||
coll=&Map[mapx+(mapy*MapWidth)];
|
||||
// coll=&Map[mapx+(mapy*MapWidth)];
|
||||
coll=&Map[mapx+(GetYPos(mapy))];
|
||||
for(x=-xoff;x<(33*16)-xoff;x+=16)
|
||||
{
|
||||
colour=&s_typeColours[((*coll)&COLLISION_TYPE_MASK)>>COLLISION_TYPE_FLAG_SHIFT];
|
||||
|
|
|
@ -18,6 +18,8 @@ static const int TILE2D_WIDTH=16;
|
|||
static const int TILE2D_HEIGHT=12;
|
||||
static const int SCREEN_TILE2D_WIDTH=((512/TILE2D_WIDTH)+1);
|
||||
static const int SCREEN_TILE2D_HEIGHT=((256/TILE2D_HEIGHT)+1);
|
||||
static const int PrimCount=SCREEN_TILE2D_WIDTH*SCREEN_TILE2D_HEIGHT;
|
||||
static const int PrimMemSize=PrimCount*sizeof(TSPRT);
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -25,9 +27,6 @@ static const int SCREEN_TILE2D_HEIGHT=((256/TILE2D_HEIGHT)+1);
|
|||
|
||||
CLayerTile::CLayerTile(sLevelHdr *LevelHdr,sLayerHdr *Hdr)
|
||||
{
|
||||
int Count=SCREEN_TILE2D_WIDTH*SCREEN_TILE2D_HEIGHT;
|
||||
int MemSize=Count*sizeof(TSPRT);
|
||||
|
||||
LayerHdr=Hdr;
|
||||
MapWidth=LayerHdr->Width;
|
||||
MapHeight=LayerHdr->Height;
|
||||
|
@ -35,23 +34,31 @@ int MemSize=Count*sizeof(TSPRT);
|
|||
ElemBank2d=LevelHdr->ElemBank2d;
|
||||
Map=(sTileMapElem*)MakePtr(Hdr,sizeof(sLayerHdr));
|
||||
|
||||
PrimBank=(TSPRT*)MemAlloc(MemSize,"Mid Polyz");
|
||||
PrimBankID=0;
|
||||
|
||||
TSPRT *PrimPtr=PrimBank;
|
||||
for (int i=0; i<Count; i++)
|
||||
for (int b=0; b<2; b++)
|
||||
{
|
||||
setTSprt(PrimPtr);
|
||||
setTSetShadeTex(PrimPtr,1);
|
||||
PrimPtr->w=TILE2D_WIDTH;
|
||||
PrimPtr->h=TILE2D_HEIGHT;
|
||||
PrimPtr++;
|
||||
PrimBank[b]=(TSPRT*)MemAlloc(PrimMemSize,"Mid Polyz");
|
||||
TSPRT *PrimPtr=PrimBank[b];
|
||||
for (int i=0; i<PrimCount; i++)
|
||||
{
|
||||
setTSprt(PrimPtr);
|
||||
setTSetShadeTex(PrimPtr,1);
|
||||
PrimPtr->w=TILE2D_WIDTH;
|
||||
PrimPtr->h=TILE2D_HEIGHT;
|
||||
PrimPtr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
CLayerTile::~CLayerTile()
|
||||
{
|
||||
MemFree(PrimBank);
|
||||
for (int b=0; b<2; b++)
|
||||
{
|
||||
MemFree(PrimBank[b]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -113,7 +120,9 @@ void CLayerTile::render()
|
|||
sTileMapElem *MapPtr=Map+GetMapOfs();
|
||||
s16 TileX,TileY;
|
||||
sOT *ThisOT=OtPtr+LayerOT;
|
||||
TSPRT *PrimPtr=PrimBank;
|
||||
TSPRT *PrimPtr=PrimBank[PrimBankID];
|
||||
|
||||
PrimBankID^=1;
|
||||
|
||||
// Setup shift bits of pos
|
||||
TileY=-ShiftY;
|
||||
|
@ -128,7 +137,6 @@ TSPRT *PrimPtr=PrimBank;
|
|||
for (int X=0; X<RenderW; X++)
|
||||
{
|
||||
int ThisTile=MapRow->Tile;
|
||||
MapRow++;
|
||||
if (ThisTile)
|
||||
{
|
||||
sElem2d *Tile=&ElemBank2d[ThisTile];
|
||||
|
@ -139,6 +147,7 @@ TSPRT *PrimPtr=PrimBank;
|
|||
addPrim(ThisOT,PrimPtr);
|
||||
PrimPtr++;
|
||||
}
|
||||
MapRow++;
|
||||
TileX+=TILE2D_WIDTH;
|
||||
}
|
||||
MapPtr+=MapWidth;
|
||||
|
|
|
@ -48,7 +48,8 @@ protected:
|
|||
u16 ShiftX,ShiftY;
|
||||
|
||||
sTileMapElem *Map;
|
||||
TSPRT *PrimBank;
|
||||
TSPRT *PrimBank[2];
|
||||
int PrimBankID;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
|
||||
#if 1
|
||||
#if defined(__USER_sbart__) || defined(__USER_daveo__)
|
||||
#if defined(__USER_sbart__) // || defined(__USER_daveo__)
|
||||
#define _SHOW_POLYZ_ 1
|
||||
#include "gfx\font.h"
|
||||
static FontBank *Font;
|
||||
|
@ -405,10 +405,6 @@ s16 TCount=0,QCount=0;
|
|||
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
|
||||
|
||||
*(u32*)&ThisPrim->x0=T0; // Set XY0
|
||||
*(u32*)&ThisPrim->x1=T1; // Set XY1
|
||||
*(u32*)&ThisPrim->x2=T2; // Set XY2
|
||||
|
@ -424,25 +420,20 @@ s16 TCount=0,QCount=0;
|
|||
*(u32*)&ThisPrim->u1=T1; // Set UV1
|
||||
*(u32*)&ThisPrim->u2=T2; // Set UV2
|
||||
addPrim(ThisOT,ThisPrim);
|
||||
|
||||
{ // lighting
|
||||
T0=*(u32*)&RGB[TList->C0];
|
||||
T1=*(u32*)&RGB[TList->C1];
|
||||
T2=*(u32*)&RGB[TList->C2];
|
||||
*(u32*)&ThisPrim->r0=T0;
|
||||
*(u32*)&ThisPrim->r1=T1;
|
||||
*(u32*)&ThisPrim->r2=T2;
|
||||
}
|
||||
#if defined(_SHOW_POLYZ_)
|
||||
if (!ShowPolyz)
|
||||
if (ShowPolyz) {setRGB0(ThisPrim,127,0,0); setRGB1(ThisPrim,255,0,0); setRGB2(ThisPrim,255,0,0); TCount++;}
|
||||
#endif
|
||||
{ // lighting
|
||||
T0=*(u32*)&RGB[TList->C0];
|
||||
T1=*(u32*)&RGB[TList->C1];
|
||||
T2=*(u32*)&RGB[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++;
|
||||
}
|
||||
|
@ -452,10 +443,10 @@ s16 TCount=0,QCount=0;
|
|||
{
|
||||
POLY_GT4 *ThisPrim=(POLY_GT4*)PrimPtr;
|
||||
|
||||
T0=*(u32*)(XYList+(QList->P0/*4*/));
|
||||
T1=*(u32*)(XYList+(QList->P1/*4*/));
|
||||
T2=*(u32*)(XYList+(QList->P2/*4*/));
|
||||
T3=*(u32*)(XYList+(QList->P3/*4*/));
|
||||
T0=*(u32*)(XYList+QList->P0);
|
||||
T1=*(u32*)(XYList+QList->P1);
|
||||
T2=*(u32*)(XYList+QList->P2);
|
||||
T3=*(u32*)(XYList+QList->P3);
|
||||
gte_ldsxy0(T0);
|
||||
gte_ldsxy1(T1);
|
||||
gte_ldsxy2(T2);
|
||||
|
@ -463,10 +454,6 @@ s16 TCount=0,QCount=0;
|
|||
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
|
||||
|
||||
*(u32*)&ThisPrim->x0=T0; // Set XY0
|
||||
*(u32*)&ThisPrim->x1=T1; // Set XY1
|
||||
*(u32*)&ThisPrim->x2=T2; // Set XY2
|
||||
|
@ -484,26 +471,23 @@ s16 TCount=0,QCount=0;
|
|||
*(u32*)&ThisPrim->u1=T1; // Set UV1
|
||||
*(u32*)&ThisPrim->u2=T2; // Set UV2
|
||||
*(u32*)&ThisPrim->u3=T3; // Set UV2
|
||||
{ // Lighting
|
||||
T0=*(u32*)&RGB[QList->C0];
|
||||
T1=*(u32*)&RGB[QList->C1];
|
||||
T2=*(u32*)&RGB[QList->C2];
|
||||
T3=*(u32*)&RGB[QList->C3];
|
||||
*(u32*)&ThisPrim->r0=T0;
|
||||
*(u32*)&ThisPrim->r1=T1;
|
||||
*(u32*)&ThisPrim->r2=T2;
|
||||
*(u32*)&ThisPrim->r3=T3;
|
||||
}
|
||||
#if defined(_SHOW_POLYZ_)
|
||||
if (!ShowPolyz)
|
||||
if (ShowPolyz) {setRGB0(ThisPrim,0,127,0);setRGB1(ThisPrim,0,255,0); setRGB2(ThisPrim,0,255,0); setRGB3(ThisPrim,0,255,0); QCount++;}
|
||||
#endif
|
||||
{ // Lighting
|
||||
T0=*(u32*)&RGB[QList->C0];
|
||||
T1=*(u32*)&RGB[QList->C1];
|
||||
T2=*(u32*)&RGB[QList->C2];
|
||||
T3=*(u32*)&RGB[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++;
|
||||
}
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
|
||||
struct sFlipTable
|
||||
{
|
||||
s16 Mtx[4];
|
||||
DVECTOR *DeltaTab[8];
|
||||
s32 ClipCode;
|
||||
s16 Mtx[4]; // 8
|
||||
DVECTOR *DeltaTab[8]; // 32
|
||||
s32 ClipCode; // 4
|
||||
s8 Pad[20];
|
||||
};
|
||||
extern sFlipTable FlipTable[];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue