This commit is contained in:
parent
7b8e1fe8c4
commit
3aeddaf979
9 changed files with 111 additions and 235 deletions
|
@ -53,10 +53,6 @@ int Count;
|
|||
TextPtr+=strlen(TextPtr)+1;
|
||||
TPH=atol(TextPtr);
|
||||
break;
|
||||
// case 'm':
|
||||
// TpStr= CheckFileString(String);
|
||||
// Level.AddModel(TpStr);
|
||||
// break;
|
||||
case 'i':
|
||||
IncDir= CheckFileString(String);
|
||||
IncDir.Upper();
|
||||
|
@ -104,10 +100,11 @@ void Usage(char *ErrStr)
|
|||
printf(" -o:[FILE] Set output File (AND Dir)\n");
|
||||
printf(" -s:nn Set Scaling value\n");
|
||||
printf(" -t:p,w,h Set TPage No,Width,Height\n");
|
||||
// printf(" -m: Add Model\n");
|
||||
printf(" -d: Enable Debug output\n");
|
||||
printf(" -i: Include Out Dir\n");
|
||||
printf(" -q: Enable Quadding\n");
|
||||
printf(" -l: Enable Local Geom\n");
|
||||
printf(" -p: Level Chunk Pak Info (X,Y) (Default=None(0,0)\n");
|
||||
GObject::Error(ERR_FATAL,ErrStr);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "Layers\MkLevelLayerTrigger.h"
|
||||
#include "Layers\MkLevelLayerHazard.h"
|
||||
|
||||
#define PSX_TILE2D_HEIGHT (12)
|
||||
#define PSX_TILE3D_HEIGHT (16)
|
||||
|
||||
//***************************************************************************
|
||||
struct sLayerNameTable
|
||||
|
@ -51,12 +53,11 @@ sLayerNameTable LayerNameTable[]=
|
|||
//***************************************************************************
|
||||
int TSize,QSize,VSize;
|
||||
int Tile2dSize,Tile3dSize;
|
||||
const char *ModelExcludeGroupName="ModelExcludeList";
|
||||
|
||||
//***************************************************************************
|
||||
const GString ConfigFilename="MkLevel.ini";
|
||||
sExpLayerTile BlankTile={0,0};
|
||||
//sExpLayerTile BlankTile2d={-1,-1};
|
||||
//sExpLayerTile BlankTile3d={0,0};
|
||||
|
||||
Vector3 DefVtxTable[8]=
|
||||
{
|
||||
|
@ -108,10 +109,25 @@ void CMkLevel::Init(const char *Filename,const char *OutFilename,const char *Inc
|
|||
{
|
||||
// Setup filenames and paths
|
||||
GFName Path;
|
||||
char *Ptr;
|
||||
char Buffer[256];
|
||||
|
||||
strcpy(Buffer,Filename);
|
||||
Ptr=Buffer;
|
||||
while (*Ptr)
|
||||
{
|
||||
if (*Ptr=='\\' || *Ptr=='/') *Ptr=' ';
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
while (*Ptr!=' ') Ptr--;
|
||||
*Ptr--=0;
|
||||
while (*Ptr!=' ') Ptr--; Ptr--;
|
||||
while (*Ptr!=' ') Ptr--; Ptr++;
|
||||
LevelName=Ptr;
|
||||
InFilename=Filename;
|
||||
Path=Filename;
|
||||
LevelName=Path.File();
|
||||
// LevelName=Path.File();
|
||||
Path.File("");
|
||||
Path.Ext("");
|
||||
InPath=Path.FullName();
|
||||
|
@ -165,7 +181,6 @@ GFName Path;
|
|||
LocalGeom=_LocalGeom;
|
||||
AddDefVtx(OutVtxList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
@ -183,11 +198,16 @@ int CMkLevel::AddModel(const char *Name,int TriStart,int TriCount)
|
|||
{
|
||||
sMkLevelModel ThisModel;
|
||||
int ModelID;
|
||||
GString ModelName=Name;
|
||||
|
||||
ThisModel.Name=Name;
|
||||
ThisModel.TriStart=TriStart;
|
||||
ThisModel.TriCount=TriCount;
|
||||
|
||||
if (Config.FindKey(ModelExcludeGroupName,Name)!=-1)
|
||||
{
|
||||
ThisModel.TriCount=0;
|
||||
}
|
||||
ModelID=ModelList.Add(ThisModel);
|
||||
return(ModelID);
|
||||
}
|
||||
|
@ -440,7 +460,7 @@ int i,ListSize=UsedTile2dList.size();
|
|||
for (i=1; i<ListSize; i++)
|
||||
{ // Skip blank
|
||||
sUsedTile2d &ThisTile=UsedTile2dList[i];
|
||||
ThisTile.TexID=Create2dTile(ThisTile.Tile,ThisTile.Flags);
|
||||
ThisTile.TexID=Create2dTile(ThisTile.Tile,ThisTile.Flags,PSX_TILE2D_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -513,8 +533,12 @@ CFaceStore &ThisList=ThisElem.FaceStore;
|
|||
|
||||
ThisElem.Elem3d.TriCount=ThisList.GetTriFaceCount();
|
||||
ThisElem.Elem3d.QuadCount=ThisList.GetQuadFaceCount();
|
||||
|
||||
if (!ThisElem.Model)
|
||||
{ // Gen max polys per tile (NOT MODEL)
|
||||
if (MaxElemTri<ThisElem.Elem3d.TriCount) MaxElemTri=ThisElem.Elem3d.TriCount;
|
||||
if (MaxElemQuad<ThisElem.Elem3d.QuadCount) MaxElemQuad=ThisElem.Elem3d.QuadCount;
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
@ -656,6 +680,10 @@ CFaceStore &FaceList=ThisElem.FaceStore;
|
|||
FaceList.SetTPageFlag(F,ThisTri.Flags);
|
||||
FaceList.AddFace(F,true);
|
||||
}
|
||||
if (IsTile)
|
||||
ThisElem.Model=false;
|
||||
else
|
||||
ThisElem.Model=true;
|
||||
return(ElemID);
|
||||
}
|
||||
|
||||
|
@ -664,7 +692,7 @@ int CMkLevel::Create2dElem(int Tile,bool Local)
|
|||
{
|
||||
CFace F;
|
||||
int i;
|
||||
int TexID=Create2dTile(Tile,0);
|
||||
int TexID=Create2dTile(Tile,0,PSX_TILE3D_HEIGHT);
|
||||
int ElemID=OutElem3d.size();
|
||||
OutElem3d.resize(ElemID+1);
|
||||
|
||||
|
@ -696,123 +724,8 @@ CFaceStore &FaceList=ThisElem.FaceStore;
|
|||
return(ElemID);
|
||||
}
|
||||
|
||||
/*
|
||||
int CMkLevel::Create3dTile(int Tile,int Flags)
|
||||
{
|
||||
sExpTile &SrcTile=InTileList[Tile];
|
||||
CFace F;
|
||||
int i,ListSize,p;
|
||||
CList<sExpTri> SortList;
|
||||
CList<float> ZPosList;
|
||||
sTileBank3d ThisTile;
|
||||
int TileID=OutTileBank3d.size();
|
||||
CFaceStore FaceStore;
|
||||
|
||||
|
||||
ThisTile.TriStart=OutFaceList.GetFaceCount();
|
||||
ThisTile.QuadCount=0;
|
||||
ThisTile.QuadStart=0;
|
||||
|
||||
if (SrcTile.TriCount)
|
||||
{
|
||||
ThisTile.TriCount=SrcTile.TriCount;
|
||||
for (i=0; i<SrcTile.TriCount; i++)
|
||||
{
|
||||
int ListPos;
|
||||
sExpTri &ThisTri=InTriList[SrcTile.TriStart+i];
|
||||
float ThisZPos;
|
||||
|
||||
ThisZPos=ThisTri.vtx[0].z;
|
||||
if (ThisZPos<ThisTri.vtx[1].z) ThisZPos=ThisTri.vtx[1].z;
|
||||
if (ThisZPos<ThisTri.vtx[2].z) ThisZPos=ThisTri.vtx[2].z;
|
||||
|
||||
ListSize=SortList.size();
|
||||
for (ListPos=0; ListPos<ListSize; ListPos++)
|
||||
{
|
||||
if (ZPosList[ListPos]>ThisZPos) break;
|
||||
}
|
||||
SortList.insert(ListPos,ThisTri);
|
||||
ZPosList.insert(ListPos,ThisZPos);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int TexID=Create2dTile(Tile,0);
|
||||
|
||||
ThisTile.TriCount=2;
|
||||
|
||||
for (int i=0; i<2; i++)
|
||||
{
|
||||
FlatFace[i].Flags=0;
|
||||
FlatFace[i].TexID=TexID;
|
||||
SortList.push_back(FlatFace[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add sorted list to main list
|
||||
ListSize=SortList.size();
|
||||
for (i=0; i<ListSize; i++)
|
||||
{
|
||||
sExpTri &ThisTri=SortList[i];
|
||||
CFace F;
|
||||
bool SwapPnt=false;
|
||||
|
||||
if (SrcTile.TriCount)
|
||||
{
|
||||
F.TexName=InTexNameList[ThisTri.TexID];
|
||||
F.Mat=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
F.Mat=ThisTri.TexID;
|
||||
}
|
||||
|
||||
for (p=0; p<3; p++)
|
||||
{
|
||||
F.vtx[p]=ThisTri.vtx[p];
|
||||
F.vtx[p].y=F.vtx[p].y;
|
||||
F.uvs[p].u=ThisTri.uv[p][0];
|
||||
F.uvs[p].v=ThisTri.uv[p][1];
|
||||
}
|
||||
|
||||
if (Flags & PC_TILE_FLAG_MIRROR_X)
|
||||
{
|
||||
F.vtx[0].x=-F.vtx[0].x;
|
||||
F.vtx[1].x=-F.vtx[1].x;
|
||||
F.vtx[2].x=-F.vtx[2].x;
|
||||
SwapPnt^=1;
|
||||
}
|
||||
|
||||
if (Flags & PC_TILE_FLAG_MIRROR_Y)
|
||||
{
|
||||
F.vtx[0].y =1.0-F.vtx[0].y;
|
||||
F.vtx[1].y =1.0-F.vtx[1].y;
|
||||
F.vtx[2].y =1.0-F.vtx[2].y;
|
||||
SwapPnt^=1;
|
||||
}
|
||||
|
||||
if (SwapPnt)
|
||||
{
|
||||
Vector3 TmpV=F.vtx[0];
|
||||
F.vtx[0]=F.vtx[1];
|
||||
F.vtx[1]=TmpV;
|
||||
sUV TmpUV=F.uvs[0];
|
||||
F.uvs[0]=F.uvs[1];
|
||||
F.uvs[1]=TmpUV;
|
||||
}
|
||||
|
||||
OutFaceList.SetTPageFlag(F,ThisTri.Flags);
|
||||
OutFaceList.AddFace(F,true);
|
||||
}
|
||||
|
||||
OutTileBank3d.push_back(ThisTile);
|
||||
return(TileID);
|
||||
}
|
||||
|
||||
*/
|
||||
//***************************************************************************
|
||||
int CMkLevel::Create2dTile(int Tile,int Flags)
|
||||
int CMkLevel::Create2dTile(int Tile,int Flags,int Height)
|
||||
{
|
||||
sExpTile &SrcTile=InTileList[Tile];
|
||||
sMkLevelTex InTex;
|
||||
|
@ -820,6 +733,7 @@ int Idx;
|
|||
|
||||
InTex.Tile=Tile;
|
||||
InTex.Flags=Flags;
|
||||
InTex.Height=Height;
|
||||
|
||||
Idx=Tex2dList.Find(InTex);
|
||||
|
||||
|
@ -829,13 +743,13 @@ int Idx;
|
|||
}
|
||||
|
||||
// Must be new, add it
|
||||
InTex.TexID=BuildTileTex(SrcTile,Flags);
|
||||
InTex.TexID=BuildTileTex(SrcTile,Flags,InTex.Height);
|
||||
Tex2dList.push_back(InTex);
|
||||
return(InTex.TexID);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
int CMkLevel::BuildTileTex(sExpTile &SrcTile,int Flags)
|
||||
int CMkLevel::BuildTileTex(sExpTile &SrcTile,int Flags,int Height)
|
||||
{
|
||||
Frame &InFrame=BmpList[SrcTile.Set];
|
||||
Frame ThisFrame;
|
||||
|
@ -869,6 +783,11 @@ int TexID;
|
|||
if (Flags& PC_TILE_FLAG_MIRROR_X) ThisFrame.FlipX();
|
||||
if (Flags & PC_TILE_FLAG_MIRROR_Y) ThisFrame.FlipY();
|
||||
|
||||
if (Height!=16)
|
||||
{
|
||||
ThisFrame.Resize(16,Height);
|
||||
}
|
||||
|
||||
TexID=TexGrab.AddMemFrame(TexName,ThisFrame);
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -1064,8 +983,7 @@ int Pos=ftell(File);
|
|||
sVtx Out;
|
||||
|
||||
Out.vx=+In.vx;
|
||||
// Out.vy=-In.vy;//+(Scale/2); // Offset it so the origin is centre centre
|
||||
Out.vy=+In.vy;//+(Scale/2); // Offset it so the origin is centre centre
|
||||
Out.vy=+In.vy;
|
||||
Out.vz=+In.vz;
|
||||
Min.vx=__min(Min.vx,Out.vx);
|
||||
Min.vy=__min(Min.vy,Out.vy);
|
||||
|
@ -1171,7 +1089,11 @@ int Ofs=ftell(File);
|
|||
Out.ElemID=ThisModel.ElemID;
|
||||
Out.BBox=ElemBBox;
|
||||
|
||||
printf("Writing Model %s (%i) (%i %i) (BBox %i,%i->%i,%i)\n",ThisModel.Name,Out.ElemID,ThisElem.Elem3d.TriCount,ThisElem.Elem3d.QuadCount,Out.BBox.XMin,Out.BBox.YMin,Out.BBox.XMax,Out.BBox.YMax);
|
||||
if (ThisModel.TriCount==0)
|
||||
printf("Writing Model E:%i - %s - Dummy --\n",Out.ElemID,ThisModel.Name);
|
||||
else
|
||||
printf("Writing Model E:%i - %s - T:%i Q:%i BBox:%i,%i->%i,%i\n",Out.ElemID,ThisModel.Name,ThisElem.Elem3d.TriCount,ThisElem.Elem3d.QuadCount,Out.BBox.XMin,Out.BBox.YMin,Out.BBox.XMax,Out.BBox.YMax);
|
||||
|
||||
fwrite(&Out,1,sizeof(sModel),File);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,9 @@ struct sMkLevelTex
|
|||
int Tile;
|
||||
int Flags;
|
||||
int TexID;
|
||||
int Height;
|
||||
|
||||
bool operator ==(sMkLevelTex const &v1) {return(Tile==v1.Tile && Flags==v1.Flags);}
|
||||
bool operator ==(sMkLevelTex const &v1) {return(Tile==v1.Tile && Flags==v1.Flags && Height==v1.Height);}
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
@ -58,6 +59,7 @@ bool operator ==(sUsedTile3d const &v1) {return(Tile==v1.Tile);}
|
|||
struct sOutElem3d
|
||||
{
|
||||
bool LocalGeom;
|
||||
bool Model;
|
||||
sElem3d Elem3d;
|
||||
CFaceStore FaceStore;
|
||||
vector<sVtx> LocalVtxList;
|
||||
|
@ -98,10 +100,10 @@ public:
|
|||
void AddInfItem(const char *Name,int Val);
|
||||
void Write();
|
||||
|
||||
int Create2dTile(int Tile,int Flags);
|
||||
int Create2dTile(int Tile,int Flags,int Height);
|
||||
int Create3dTile(int Tile,int Flags);
|
||||
void MakeTexName(sExpTile &SrcTile,int Flags,GString &OutStr);
|
||||
int BuildTileTex(sExpTile &SrcTile,int Flags);
|
||||
int BuildTileTex(sExpTile &SrcTile,int Flags,int Height);
|
||||
|
||||
char *GetConfigStr(const char *Grp,const char *Key) {return(Config.GetStr(Grp,Key));}
|
||||
int GetConfigInt(const char *Grp,const char *Key) {return(Config.GetInt(Grp,Key));}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "system\vid.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
sOT *OtList[2],*BaseOtPtr,*GUIOtPtr,*OtPtr;
|
||||
sOT *OtList[2],*BaseOtPtr,*OtPtr;
|
||||
u32 DmaStart[2];
|
||||
u8 *PrimBuffer[2],*PrimListStart,*PrimListEnd;
|
||||
u8 *CurrPrim,*EndPrim;
|
||||
|
@ -26,8 +26,7 @@ void PrimInit()
|
|||
|
||||
PrimFlipFlag=0;
|
||||
BaseOtPtr=(sOT*)OtList[PrimFlipFlag];
|
||||
GUIOtPtr=BaseOtPtr;
|
||||
OtPtr=GUIOtPtr+MAX_OT_GUI;
|
||||
OtPtr=BaseOtPtr;
|
||||
CurrPrim=(u8*)PrimBuffer[PrimFlipFlag];
|
||||
EndPrim=CurrPrim+PRIMPOOL_SIZE;
|
||||
|
||||
|
@ -60,8 +59,7 @@ void PrimDisplay()
|
|||
|
||||
PrimFlipFlag^=1;
|
||||
BaseOtPtr=(sOT*)OtList[PrimFlipFlag];
|
||||
GUIOtPtr=BaseOtPtr;
|
||||
OtPtr=GUIOtPtr+MAX_OT_GUI;
|
||||
OtPtr=BaseOtPtr;
|
||||
CurrPrim=(u8*)PrimBuffer[PrimFlipFlag];
|
||||
EndPrim=CurrPrim+(PRIMPOOL_SIZE);
|
||||
ResetOTagR(BaseOtPtr,MAX_OT_ALL);
|
||||
|
@ -71,8 +69,7 @@ void PrimDisplay()
|
|||
void FlushPrimPool()
|
||||
{
|
||||
BaseOtPtr=(sOT*)OtList[PrimFlipFlag];
|
||||
GUIOtPtr=BaseOtPtr;
|
||||
OtPtr=GUIOtPtr+MAX_OT_GUI;
|
||||
OtPtr=BaseOtPtr;
|
||||
CurrPrim=(u8*)PrimBuffer[PrimFlipFlag];
|
||||
EndPrim=CurrPrim+(PRIMPOOL_SIZE);
|
||||
ResetOTagR(BaseOtPtr,MAX_OT_ALL);
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
#include "gfx\primplus.h"
|
||||
#endif
|
||||
|
||||
#define MAX_OT_GUI (0)
|
||||
//#define MAX_OT_GUI (0)
|
||||
#define MAX_OT (16)
|
||||
#define MAX_OT_ALL (MAX_OT+MAX_OT_GUI)
|
||||
#define MAX_PRIMS ((1024*2)+512) // Put back after overrender bug found (BAD DAVE!) ( put back in by evilpaul ;)
|
||||
// bumped down a lil, cos we need memory hope this value works ok. Be ok once quadding is in
|
||||
#define MAX_OT_ALL (MAX_OT)
|
||||
#define MAX_PRIMS ((1024*2)) // Took off 512 as mid layer now pre-stored as TSPRTs
|
||||
|
||||
//#define USE_NTAGS 1
|
||||
|
||||
|
@ -308,7 +307,7 @@ typedef u32 sOT;
|
|||
#define OTLIST_SIZE (MAX_OT_ALL*sizeof(sOT))
|
||||
|
||||
/********************************************************************************************************/
|
||||
extern sOT *BaseOtPtr,*GUIOtPtr,*OtPtr;
|
||||
extern sOT *BaseOtPtr,*OtPtr;
|
||||
extern u8 *CurrPrim,*EndPrim;
|
||||
extern u8 *PrimListStart,*PrimListEnd;
|
||||
//extern int PrimFlipFlag;
|
||||
|
@ -330,12 +329,13 @@ LINE_G2 *DrawGLine(int _x0,int _y0,int _x1,int _y1,int _r1,int _g1,int _b1,int
|
|||
/********************************************************************************************************/
|
||||
/*** Inlines ********************************************************************************************/
|
||||
/********************************************************************************************************/
|
||||
/*
|
||||
inline void AddGUIPrimToList(void *Prim,u32 Depth)
|
||||
{
|
||||
ASSERT(Depth<MAX_OT_GUI);
|
||||
addPrim(GUIOtPtr+Depth,(u32*)Prim);
|
||||
}
|
||||
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------------------------*/
|
||||
inline void AddPrimToList(void *Prim,u32 Depth)
|
||||
{
|
||||
|
|
|
@ -14,25 +14,44 @@ const u32 XInc=16<<0;
|
|||
const u32 YInc=16<<16;
|
||||
|
||||
/*****************************************************************************/
|
||||
//DVECTOR TileMapOfs={0,4}; // To line layers up :oP
|
||||
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);
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
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;
|
||||
|
||||
// printf("%i %i\n",MapWidth,MapHeight);
|
||||
ElemBank2d=LevelHdr->ElemBank2d;
|
||||
Map=(sTileMapElem*)MakePtr(Hdr,sizeof(sLayerHdr));
|
||||
|
||||
PrimBank=(TSPRT*)MemAlloc(MemSize,"Mid Polyz");
|
||||
|
||||
TSPRT *PrimPtr=PrimBank;
|
||||
for (int i=0; i<Count; i++)
|
||||
{
|
||||
setTSprt(PrimPtr);
|
||||
setTSetShadeTex(PrimPtr,1);
|
||||
PrimPtr->w=TILE2D_WIDTH;
|
||||
PrimPtr->h=TILE2D_HEIGHT;
|
||||
PrimPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
CLayerTile::~CLayerTile()
|
||||
{
|
||||
MemFree(PrimBank);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -58,16 +77,10 @@ int XPos=MapPos.vx>>MapXYShift;
|
|||
int YPos=MapPos.vy>>MapXYShift;
|
||||
|
||||
MapXY.vx=XPos>>4;
|
||||
MapXY.vy=YPos/12;
|
||||
MapXY.vy=YPos/TILE2D_HEIGHT;
|
||||
|
||||
/* if (LayerHdr->SubType==1) // BODGE AND A HALF
|
||||
{
|
||||
MapXY.vx+=TileMapOfs.vx; MapXY.vy+=TileMapOfs.vy;
|
||||
}
|
||||
*/
|
||||
ShiftX=XPos & 15;
|
||||
// ShiftY=YPos & 15;
|
||||
ShiftY=YPos%12;
|
||||
ShiftY=YPos%TILE2D_HEIGHT;
|
||||
|
||||
if (MapXY.vx+SCREEN_TILE2D_WIDTH<=MapWidth)
|
||||
RenderW=SCREEN_TILE2D_WIDTH;
|
||||
|
@ -84,19 +97,18 @@ int YPos=MapPos.vy>>MapXYShift;
|
|||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
#if 1 // FT4 version
|
||||
void CLayerTile::render()
|
||||
{
|
||||
|
||||
sTileMapElem *MapPtr=GetMapPos();
|
||||
u8 *PrimPtr=GetPrimPtr();
|
||||
s16 TileX,TileY;
|
||||
sOT *ThisOT=OtPtr+LayerOT;
|
||||
TSPRT *PrimPtr=PrimBank;
|
||||
|
||||
// Setup shift bits of pos
|
||||
TileY=-ShiftY;
|
||||
|
||||
// Render it!!
|
||||
|
||||
for (int Y=0; Y<RenderH; Y++)
|
||||
{
|
||||
sTileMapElem *MapRow=MapPtr;
|
||||
|
@ -109,68 +121,17 @@ sOT *ThisOT=OtPtr+LayerOT;
|
|||
if (ThisTile)
|
||||
{
|
||||
sElem2d *Tile=&ElemBank2d[ThisTile];
|
||||
POLY_FT4 *Ft4=(POLY_FT4*)PrimPtr;
|
||||
setPolyFT4(Ft4);
|
||||
setShadeTex(Ft4,1);
|
||||
setXYWH(Ft4,TileX,TileY,16,12);
|
||||
setUVWH(Ft4,Tile->u0,Tile->v0,15,15);
|
||||
Ft4->tpage=Tile->TPage;
|
||||
Ft4->clut=Tile->Clut;
|
||||
// addPrimNoCheck(ThisOT,Ft4);
|
||||
addPrim(ThisOT,Ft4);
|
||||
PrimPtr+=sizeof(POLY_FT4);
|
||||
PrimPtr->x0=TileX;
|
||||
PrimPtr->y0=TileY;
|
||||
setTSprtTPage(PrimPtr,Tile->TPage);
|
||||
*(u32*)&PrimPtr->u0=*(u32*)&Tile->u0; // copy uv AND clut
|
||||
addPrim(ThisOT,PrimPtr);
|
||||
PrimPtr++;
|
||||
}
|
||||
TileX+=TILE2D_WIDTH;
|
||||
}
|
||||
MapPtr+=MapWidth;
|
||||
TileY+=TILE2D_HEIGHT;
|
||||
}
|
||||
SetPrimPtr(PrimPtr);
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
void CLayerTile::render()
|
||||
{
|
||||
sTileMapElem *MapPtr=GetMapPos();
|
||||
u8 *PrimPtr=GetPrimPtr();
|
||||
s16 TileX,TileY;
|
||||
sOT *ThisOT=OtPtr+LayerOT;
|
||||
|
||||
// Setup shift bits of pos
|
||||
TileY=-ShiftY;
|
||||
|
||||
// Render it!!
|
||||
for (int Y=0; Y<RenderH; Y++)
|
||||
{
|
||||
sTileMapElem *MapRow=MapPtr;
|
||||
TileX=-ShiftX;
|
||||
|
||||
for (int X=0; X<RenderW; X++)
|
||||
{
|
||||
int ThisTile=*MapRow++;
|
||||
if (ThisTile)
|
||||
{
|
||||
/**/ sElem2d *Tile=&ElemBank2d[ThisTile];
|
||||
TSPRT_16 *SprPtr=(TSPRT_16*)PrimPtr;
|
||||
setTSprt16(SprPtr);
|
||||
setTSetShadeTex(SprPtr,1);
|
||||
/**/ SprPtr->x0=TileX;
|
||||
/**/ SprPtr->y0=TileY;
|
||||
/**/ setTSprtTPage(SprPtr,Tile->TPage);
|
||||
*(u32*)&SprPtr->u0=*(u32*)&Tile->u0; // copy uv AND clut
|
||||
addPrimNoCheck(ThisOT,SprPtr);
|
||||
PrimPtr+=sizeof(TSPRT_16);
|
||||
}
|
||||
// MapRow++;
|
||||
TileX+=TILE2D_WIDTH;
|
||||
}
|
||||
MapPtr+=MapWidth;
|
||||
TileY+=TILE2D_HEIGHT;
|
||||
}
|
||||
SetPrimPtr(PrimPtr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -18,22 +18,12 @@ class CLayerTile
|
|||
public:
|
||||
enum LAYER_TILE_TYPE
|
||||
{ // Stored reverse for rendering :o)
|
||||
LAYER_TILE_TYPE_FORE,
|
||||
LAYER_TILE_TYPE_ACTION,
|
||||
LAYER_TILE_TYPE_MID,
|
||||
LAYER_TILE_TYPE_BACK,
|
||||
LAYER_TILE_TYPE_MAX
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TILE2D_WIDTH=16,
|
||||
TILE2D_HEIGHT=12,
|
||||
SCREEN_TILE2D_WIDTH=(32+2),
|
||||
SCREEN_TILE2D_HEIGHT=(22+2),
|
||||
SCREEN_TILE_SIZE=SCREEN_TILE2D_WIDTH*SCREEN_TILE2D_HEIGHT,
|
||||
};
|
||||
|
||||
CLayerTile(sLevelHdr *LevelHdr,sLayerHdr *Hdr);
|
||||
virtual ~CLayerTile();
|
||||
|
||||
|
@ -58,6 +48,7 @@ protected:
|
|||
u16 ShiftX,ShiftY;
|
||||
|
||||
sTileMapElem *Map;
|
||||
TSPRT *PrimBank;
|
||||
};
|
||||
|
||||
|
||||
|
|
Binary file not shown.
|
@ -205,3 +205,9 @@ ConveyorSwitch=21
|
|||
ExitMarker=20
|
||||
Swordfish=23
|
||||
Log=24
|
||||
|
||||
|
||||
################################################
|
||||
[ModelExcludeList]
|
||||
Bubble=1
|
||||
AcridBubble=1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue