This commit is contained in:
parent
a6710337c0
commit
cb772db46a
30 changed files with 197 additions and 108 deletions
|
@ -82,7 +82,21 @@ inline bool uvaprox( sUV &uv0, sUV &uv1 )
|
|||
}
|
||||
|
||||
//***************************************************************************
|
||||
CFace &CFaceStore::AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int ID,bool ProcessTexFlag )
|
||||
void CFaceStore::SetTPageFlag(CFace &F,int MatFlag)
|
||||
{
|
||||
int Trans=0;
|
||||
|
||||
switch (MatFlag>>3)
|
||||
{
|
||||
// case 0: Trans=2; break; /* Subtractive */
|
||||
case 1: Trans=1; break; /* Additive */
|
||||
}
|
||||
// Trans=1;
|
||||
F.TPageFlag=Trans<<5;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CFace &CFaceStore::AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int MatFlag,bool ProcessTexFlag )
|
||||
{
|
||||
//int ListSize = FaceList.size();
|
||||
// FaceList.resize(ListSize+1);
|
||||
|
@ -101,9 +115,10 @@ CFace F;
|
|||
if (F.uvs[i].v < 0.f) F.uvs[i].v=0.f;
|
||||
if (F.uvs[i].v > 1.f) F.uvs[i].v=1.f;
|
||||
}
|
||||
|
||||
F.TPageFlag=0;
|
||||
F.TexName=Tex;
|
||||
F.Mat = -1;
|
||||
SetTPageFlag(F,MatFlag);
|
||||
return(AddFace(F,ProcessTexFlag));
|
||||
}
|
||||
|
||||
|
@ -153,6 +168,7 @@ int ListSize=Faces.GetFaceCount();
|
|||
}
|
||||
|
||||
//***************************************************************************
|
||||
/*
|
||||
CFace &CFaceStore::AddFace(sTriFace &Face,int ID)
|
||||
{
|
||||
int ListSize = FaceList.size();
|
||||
|
@ -177,7 +193,7 @@ CFace &F = FaceList[ListSize];
|
|||
F.ID=ID;
|
||||
return(F);
|
||||
}
|
||||
|
||||
*/
|
||||
//***************************************************************************
|
||||
//*** Texture Stuff *********************************************************
|
||||
//***************************************************************************
|
||||
|
@ -367,8 +383,15 @@ int V=ThisTex.v+H;
|
|||
Out.uv1[0]=(uv1[0]-XOfs); Out.uv1[1]=(uv1[1]-YOfs);
|
||||
Out.uv2[0]=(uv2[0]-XOfs); Out.uv2[1]=(uv2[1]-YOfs);
|
||||
|
||||
Out.TPage=ThisTex.Tpage;
|
||||
Out.TPage=ThisTex.Tpage | In.TPageFlag;
|
||||
Out.Clut=ThisTex.Clut;
|
||||
Out.PolyCode=GPU_PolyFT3Code;
|
||||
|
||||
if (In.TPageFlag)
|
||||
{
|
||||
Out.PolyCode|=GPUCode_SemiTrans;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ public:
|
|||
int vis[4];
|
||||
Vector3 Normal;
|
||||
bool Avail;
|
||||
int ID;
|
||||
// int ID;
|
||||
GString TexName;
|
||||
int TPageFlag;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -71,6 +73,7 @@ public:
|
|||
struct sTriFace
|
||||
{
|
||||
int Mat;
|
||||
int Flags;
|
||||
Vector3 vtx[3];
|
||||
int pts[3];
|
||||
sUV uvs[3];
|
||||
|
@ -86,7 +89,8 @@ public:
|
|||
CFaceStore(int Max) {MaxStrip=Max;TexGrab=&FaceStoreTexGrab;}
|
||||
~CFaceStore(){};
|
||||
|
||||
CFace &AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int ID=0,bool ProcessTexFlag=false);
|
||||
void SetTPageFlag(CFace &F,int MatFlag);
|
||||
CFace &AddFace(vector<Vector3> const &P, const sGinTri &T, const sUVTri &uv,GString const &Tex,int MatFlag=0,bool ProcessTexFlag=false);
|
||||
CFace &AddFace(CFace &F,bool TexFlag=true);
|
||||
void AddFaces(vector<CFace>&Faces,bool TexFlag=true);
|
||||
void AddFaces(CFaceStore &Faces,bool TexFlag=true);
|
||||
|
|
|
@ -99,7 +99,7 @@ GFName Path=Filename;
|
|||
Create2dTexture(TexCache,Path.File(),Node);
|
||||
Build2dDrawList(TexCache,DrawList[ElemType2d]);
|
||||
BlankFlag=false;
|
||||
if (!ValidFlag) SetInvalid();
|
||||
// if (!ValidFlag) SetInvalid();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -245,6 +245,7 @@ std::vector<int> const &NodeTriMat=ThisNode.GetTriMaterial();
|
|||
|
||||
std::vector<GString> const &SceneTexList=ThisScene.GetTexList();
|
||||
std::vector<int> const &SceneUsedMatList=ThisScene.GetUsedMaterialIdx();
|
||||
std::vector<Material> const &SceneMatList=ThisScene.GetMaterials();
|
||||
int TexCount=SceneTexList.size();
|
||||
|
||||
int TriCount=NodeTriList.size();
|
||||
|
@ -257,7 +258,7 @@ int ListSize=TriList.size();
|
|||
sUVTri const &ThisUV=NodeUVList[T];
|
||||
sTriFace &Tri=TriList[ListSize+T];
|
||||
int ThisMat=NodeTriMat[T];
|
||||
int TexID;
|
||||
int TexID,TexFlags;
|
||||
|
||||
|
||||
// Sort Textures - Only add the ones that are used :o)
|
||||
|
@ -269,10 +270,12 @@ int ListSize=TriList.size();
|
|||
AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
|
||||
TexID=0;
|
||||
}
|
||||
else
|
||||
// else
|
||||
{
|
||||
TexFlags=SceneMatList[TexID].Flags;
|
||||
GString ThisName;
|
||||
GString TexName=SceneTexList[TexID];
|
||||
|
||||
ThisName=SetPath+TexName;
|
||||
TRACE2("%i !%s!\n",TexID,ThisName);
|
||||
TexID=TexCache.ProcessTexture(ThisName);
|
||||
|
@ -293,6 +296,7 @@ Matrix4x4 TransMtx;
|
|||
Tri.uvs[p].u=ThisUV.p[p].u;
|
||||
Tri.uvs[p].v=ThisUV.p[p].v;
|
||||
Tri.Mat=TexID;
|
||||
Tri.Flags=TexFlags;
|
||||
}
|
||||
}
|
||||
for (int Child=0; Child<ChildCount; Child++) Build3dElem(TexCache,ThisScene,ThisNode.PruneChildList[Child]);
|
||||
|
@ -470,7 +474,7 @@ void CElem::Purge()
|
|||
for (int i=0; i<ElemTypeMax; i++)
|
||||
glDeleteLists(DrawList[i],1);
|
||||
CleanUp();
|
||||
TriList.clear();
|
||||
// TriList.clear();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -17,14 +17,20 @@
|
|||
#include "MapEdit.h"
|
||||
#include "GUIElemList.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct sTriFace
|
||||
{
|
||||
int Mat;
|
||||
int Flags;
|
||||
Vector3 vtx[3];
|
||||
int pts[3];
|
||||
sUV uvs[3];
|
||||
};
|
||||
|
||||
enum TRI_FLAGS
|
||||
{
|
||||
TRI_FLAGS_TRANS_ADD=1<<0,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -74,6 +74,7 @@ struct sExpTri
|
|||
int TexID;
|
||||
Vector3 vtx[3];
|
||||
float uv[3][2];
|
||||
int Flags;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -37,26 +37,26 @@ Class25=CMapEditDoc
|
|||
Class26=CMapEditView
|
||||
|
||||
ResourceCount=21
|
||||
Resource1=IDR_MAINFRAME (English (U.S.))
|
||||
Resource1=IDD_LAYER_COLLISION
|
||||
Resource2=IDR_MAPEDITYPE (English (U.S.))
|
||||
Resource3=IDD_ABOUTBOX (English (U.S.))
|
||||
Resource4=IDD_ELEMLIST
|
||||
Resource5=IDD_LAYER_LIST
|
||||
Resource6=IDD_TOOLBAR
|
||||
Resource7=IDD_NEWMAP
|
||||
Resource8=IDD_ADDLAYER
|
||||
Resource9=IDD_LAYER_TRIGGER
|
||||
Resource10=IDD_LAYER_THING_POS
|
||||
Resource11=IDD_LAYER_SHADE
|
||||
Resource12=IDD_LAYER_COLLISION
|
||||
Resource13=IDD_MULTIBAR (English (U.S.))
|
||||
Resource14=IDD_LAYER_ACTOR
|
||||
Resource15=IDD_LAYER_THING
|
||||
Resource16=IDD_RESIZE
|
||||
Resource17=IDD_LAYER_PLATFORM
|
||||
Resource18=IDD_TILEBANK
|
||||
Resource19=IDD_LAYER_FX
|
||||
Resource20=IDR_TOOLBAR (English (U.S.))
|
||||
Resource3=IDD_ELEMLIST
|
||||
Resource4=IDD_MULTIBAR (English (U.S.))
|
||||
Resource5=IDD_LAYER_THING
|
||||
Resource6=IDR_TOOLBAR (English (U.S.))
|
||||
Resource7=IDD_LAYER_PLATFORM
|
||||
Resource8=IDD_LAYER_TRIGGER
|
||||
Resource9=IDD_TILEBANK
|
||||
Resource10=IDD_NEWMAP
|
||||
Resource11=IDR_MAINFRAME (English (U.S.))
|
||||
Resource12=IDD_ABOUTBOX (English (U.S.))
|
||||
Resource13=IDD_LAYER_ACTOR
|
||||
Resource14=IDD_LAYER_LIST
|
||||
Resource15=IDD_RESIZE
|
||||
Resource16=IDD_LAYER_THING_POS
|
||||
Resource17=IDD_ADDLAYER
|
||||
Resource18=IDD_LAYER_FX
|
||||
Resource19=IDD_TOOLBAR
|
||||
Resource20=IDD_LAYER_SHADE
|
||||
Resource21=IDD_LAYER_HAZARD
|
||||
|
||||
[CLS:CChildFrame]
|
||||
|
|
|
@ -54,6 +54,8 @@ int i,ListSize=ThingList.size();
|
|||
OutThing.Pos.Y=ThisThing.XY[0].y;
|
||||
OutThing.Width=ThisThing.Data.Trigger.TriggerWidth;
|
||||
OutThing.Height=ThisThing.Data.Trigger.TriggerHeight;
|
||||
OutThing.TargetPos.X=ThisThing.Data.Trigger.TriggerTargetX;
|
||||
OutThing.TargetPos.Y=ThisThing.Data.Trigger.TriggerTargetY;
|
||||
fwrite(&OutThing,sizeof(sThingTrigger),1,File);
|
||||
}
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ vector<int> const &NodeMatList = ThisNode.GetTriMaterial();
|
|||
vector<sUVTri> const &NodeUVList = ThisNode.GetUVTris();
|
||||
vector<GString> const &SceneTexList= Scene.GetTexList();
|
||||
vector<int> const &SceneUsedMatList=Scene.GetUsedMaterialIdx();
|
||||
vector<Material> const &SceneMaterials=Scene.GetMaterials();
|
||||
|
||||
int TriCount=NodeTriList.size();
|
||||
|
||||
|
@ -165,7 +166,9 @@ int TriCount=NodeTriList.size();
|
|||
if (Mat>SceneTexList.size()) GObject::Error(ERR_FATAL,"Crap Material ID, wanted %i, only have %i\n",Mat,SceneTexList.size());
|
||||
GString TexName=RootPath+SceneTexList[Mat];
|
||||
|
||||
ModelFaceList.AddFace( NodeVtxList, NodeTriList[T], NodeUVList[T], TexName,0,false);
|
||||
|
||||
CFace &F=ModelFaceList.AddFace( NodeVtxList, NodeTriList[T], NodeUVList[T], TexName,SceneMaterials[Mat].Flags,false);
|
||||
// ModelFaceList.SetTPageFlag(F,SceneMaterials[Mat].Flags);
|
||||
}
|
||||
|
||||
int ChildCount=ThisNode.GetPruneChildCount();
|
||||
|
@ -197,6 +200,7 @@ int Idx;
|
|||
CFace F;
|
||||
|
||||
ExpTri2Face(ThisTri,F);
|
||||
ModelFaceList.SetTPageFlag(F,ThisTri.Flags);
|
||||
ModelFaceList.AddFace(F,false);
|
||||
}
|
||||
|
||||
|
@ -299,8 +303,9 @@ u8 *TilePtr=(u8*) &ByteHdr[FileHdr->TileOfs];
|
|||
sExpTile &InTile=InTileList[i];
|
||||
|
||||
InTile=*ThisTilePtr;
|
||||
InTile.RGB=(u8*)malloc(RGBSize);
|
||||
memcpy(InTile.RGB,TilePtr+sizeof(sExpTile),RGBSize);
|
||||
// InTile.RGB=(u8*)malloc(RGBSize);
|
||||
// memcpy(InTile.RGB,TilePtr+sizeof(sExpTile),RGBSize);
|
||||
InTile.RGB=0;
|
||||
TilePtr+=RGBSize+sizeof(sExpTile);
|
||||
}
|
||||
|
||||
|
@ -532,6 +537,7 @@ void CMkLevel::ExpTri2Face(sExpTri &ThisTri,CFace &F,bool ImportTex)
|
|||
F.uvs[p].u=ThisTri.uv[p][0];
|
||||
F.uvs[p].v=ThisTri.uv[p][1];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//***************************************************************************
|
||||
|
@ -648,8 +654,7 @@ int TileID=OutTile3dList.size();
|
|||
F.uvs[0]=F.uvs[1];
|
||||
F.uvs[1]=TmpUV;
|
||||
}
|
||||
|
||||
|
||||
OutFaceList.SetTPageFlag(F,ThisTri.Flags);
|
||||
OutFaceList.AddFace(F,true);
|
||||
}
|
||||
|
||||
|
@ -663,66 +668,64 @@ int TileID=OutTile3dList.size();
|
|||
int CMkLevel::Create2dTex(int Tile,int Flags)
|
||||
{
|
||||
sExpTile &SrcTile=InTileList[Tile];
|
||||
int Idx;
|
||||
sMkLevelTex InTex;
|
||||
//sMkLevelTex InTex;
|
||||
|
||||
InTex.Set=SrcTile.Set;
|
||||
InTex.Flags=Flags;
|
||||
InTex.XOfs=SrcTile.XOfs;
|
||||
InTex.YOfs=SrcTile.YOfs;
|
||||
InTex.RGB=SrcTile.RGB;
|
||||
|
||||
Idx=Tex2dList.Find(InTex);
|
||||
if (Idx!=-1) return(Idx);
|
||||
// InTex.RGB=SrcTile.RGB;
|
||||
|
||||
// Try and find RGB data match
|
||||
Idx=FindRGBMatch(InTex);
|
||||
if (Idx!=-1) return(Idx);
|
||||
// not working
|
||||
// Idx=FindRGBMatch(InTex);
|
||||
// if (Idx!=-1) return(Idx);
|
||||
|
||||
// Must be new, add it
|
||||
BuildTileTex(InTex);
|
||||
Tex2dList.push_back(InTex);
|
||||
return(InTex.TexID);
|
||||
// InTex.Set=SrcTile.Set;
|
||||
// InTex.Flags=Flags;
|
||||
// InTex.XOfs=SrcTile.XOfs;
|
||||
// InTex.YOfs=SrcTile.YOfs;
|
||||
|
||||
int TexID=BuildTileTex(SrcTile,Flags);
|
||||
// Tex2dList.push_back(InTex);
|
||||
return(TexID);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
int CMkLevel::BuildTileTex(sMkLevelTex &InTex)
|
||||
int CMkLevel::BuildTileTex(sExpTile &SrcTile,int Flags)
|
||||
{
|
||||
Frame &InFrame=BmpList[InTex.Set];
|
||||
Frame &InFrame=BmpList[SrcTile.Set];
|
||||
Frame ThisFrame;
|
||||
Rect ThisRect;
|
||||
GString Name=GFName(InSetNameList[InTex.Set]).File();
|
||||
GString Name=GFName(InSetNameList[SrcTile.Set]).File();
|
||||
GString TexName;
|
||||
int BmpW=InFrame.GetWidth();
|
||||
int BmpH=InFrame.GetHeight();
|
||||
|
||||
int TexID;
|
||||
TexGrab.ShrinkToFit(false);
|
||||
TexGrab.AllowRotate(false);
|
||||
|
||||
if (InTex.XOfs*16>BmpW)
|
||||
if (SrcTile.XOfs*16>BmpW)
|
||||
{
|
||||
printf("AARGH!!! %s(%i) wants X=%i,tile is only %i Wide\n",Name,InTex.Set,InTex.XOfs*16,BmpW);
|
||||
InTex.XOfs=0;
|
||||
printf("AARGH!!! %s(%i) wants X=%i,tile is only %i Wide\n",Name,SrcTile.Set,SrcTile.XOfs*16,BmpW);
|
||||
SrcTile.XOfs=0;
|
||||
}
|
||||
if (InTex.YOfs*16>BmpH)
|
||||
if (SrcTile.YOfs*16>BmpH)
|
||||
{
|
||||
printf("AARGH!!! %s(%i) wants Y=%i,tile is only %i High\n",Name,InTex.Set,InTex.YOfs*16,BmpH);
|
||||
InTex.YOfs=0;
|
||||
printf("AARGH!!! %s(%i) wants Y=%i,tile is only %i High\n",Name,SrcTile.Set,SrcTile.YOfs*16,BmpH);
|
||||
SrcTile.YOfs=0;
|
||||
}
|
||||
|
||||
MakeTexName(InTex,TexName);
|
||||
MakeTexName(SrcTile,Flags,TexName);
|
||||
|
||||
ThisRect.X=InTex.XOfs*16;
|
||||
ThisRect.Y=InTex.YOfs*16;
|
||||
ThisRect.X=SrcTile.XOfs*16;
|
||||
ThisRect.Y=SrcTile.YOfs*16;
|
||||
ThisRect.W=16;
|
||||
ThisRect.H=16;
|
||||
|
||||
ThisFrame.Grab(InFrame,ThisRect);
|
||||
|
||||
if (InTex.Flags& PC_TILE_FLAG_MIRROR_X) ThisFrame.FlipX();
|
||||
if (InTex.Flags & PC_TILE_FLAG_MIRROR_Y) ThisFrame.FlipY();
|
||||
if (Flags& PC_TILE_FLAG_MIRROR_X) ThisFrame.FlipX();
|
||||
if (Flags & PC_TILE_FLAG_MIRROR_Y) ThisFrame.FlipY();
|
||||
|
||||
InTex.TexID=TexGrab.AddMemFrame(TexName,ThisFrame);
|
||||
TexID=TexGrab.AddMemFrame(TexName,ThisFrame);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (0)
|
||||
|
@ -735,26 +738,28 @@ int BmpH=InFrame.GetHeight();
|
|||
}
|
||||
}
|
||||
#endif
|
||||
return(InTex.TexID);
|
||||
return(TexID);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CMkLevel::MakeTexName(sMkLevelTex &InTex,GString &OutStr)
|
||||
void CMkLevel::MakeTexName(sExpTile &SrcTile,int Flags,GString &OutStr)
|
||||
{
|
||||
char NewName[256];
|
||||
GString Name=GFName(InSetNameList[InTex.Set]).File();
|
||||
GString Name=GFName(InSetNameList[SrcTile.Set]).File();
|
||||
|
||||
sprintf(NewName,"%s_%02d_%02d_%01d_",Name,InTex.XOfs,InTex.YOfs,InTex.Flags&PC_TILE_FLAG_MIRROR_XY);
|
||||
sprintf(NewName,"%s_%02d_%02d_%01d_",Name,SrcTile.XOfs,SrcTile.YOfs,Flags&PC_TILE_FLAG_MIRROR_XY);
|
||||
OutStr=NewName;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/*
|
||||
int CMkLevel::FindRGBMatch(sMkLevelTex &ThisTex)
|
||||
{
|
||||
int i,ListSize=Tex2dList.size();
|
||||
int Size=TileW*TileH;
|
||||
u8 *RGBPtr=ThisTex.RGB;
|
||||
|
||||
if (!RGBPtr) printf("HA HA\n");
|
||||
// Create Checksum for this tile
|
||||
ThisTex.RChk=0;
|
||||
ThisTex.GChk=0;
|
||||
|
@ -765,6 +770,7 @@ u8 *RGBPtr=ThisTex.RGB;
|
|||
ThisTex.GChk+=*RGBPtr++;
|
||||
ThisTex.BChk+=*RGBPtr++;
|
||||
}
|
||||
|
||||
// Check all others for match
|
||||
for (i=0; i<ListSize; i++)
|
||||
{
|
||||
|
@ -774,14 +780,31 @@ u8 *RGBPtr=ThisTex.RGB;
|
|||
// Checksum first
|
||||
if (ThisTex.RChk==ChkTex.RChk && ThisTex.GChk==ChkTex.GChk && ThisTex.BChk==ChkTex.BChk)
|
||||
{
|
||||
if (IsRGBSame(ThisTex,ChkTex)) return(i);
|
||||
if (ThisTex.Flags==ChkTex.Flags)
|
||||
{
|
||||
if (IsRGBSame(ThisTex,ChkTex)) return(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
*/
|
||||
//***************************************************************************
|
||||
/*
|
||||
bool CMkLevel::IsRGBSame(const sMkLevelTex &Tex0,const sMkLevelTex &Tex1)
|
||||
{
|
||||
int Size=TileW*TileH*3;
|
||||
int H=TileH;
|
||||
u8 *RGB0=Tex0.RGB;
|
||||
u8 *RGB1=Tex1.RGB;
|
||||
|
||||
int Res=memcmp(RGB0,RGB1,Size);
|
||||
|
||||
return(Res==0);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
bool CMkLevel::IsRGBSame(const sMkLevelTex &Tex0,const sMkLevelTex &Tex1)
|
||||
{
|
||||
int W=TileW;
|
||||
|
@ -818,6 +841,7 @@ u8 *RGB1=Tex1.RGB;
|
|||
return(true);
|
||||
}
|
||||
|
||||
*/
|
||||
//***************************************************************************
|
||||
//*** Write *****************************************************************
|
||||
//***************************************************************************
|
||||
|
@ -879,36 +903,49 @@ int i,ListSize;
|
|||
|
||||
|
||||
//***************************************************************************
|
||||
int ZMin=9999,ZMax=0;
|
||||
int CMkLevel::WriteTriList()
|
||||
{
|
||||
vector<sTri> &TriList=OutFaceList.GetOutTriList();
|
||||
vector<sVtx> const &VtxList=OutFaceList.GetVtxList();
|
||||
int ThisPos=ftell(File);
|
||||
int i,ListSize=TriList.size();
|
||||
int ZOfs=+4*Scale;
|
||||
|
||||
for (i=0;i<ListSize;i++)
|
||||
{
|
||||
sTri &T=TriList[i];
|
||||
int Z[3];
|
||||
int OtOfs=0;
|
||||
int Z[3];
|
||||
|
||||
// Calc OtOfs
|
||||
Z[0]=abs(VtxList[T.P0].vz);
|
||||
Z[1]=abs(VtxList[T.P1].vz);
|
||||
Z[2]=abs(VtxList[T.P2].vz);
|
||||
Z[0]=VtxList[T.P0].vz+ZOfs;
|
||||
Z[1]=VtxList[T.P1].vz+ZOfs;
|
||||
Z[2]=VtxList[T.P2].vz+ZOfs;
|
||||
|
||||
for (int p=0; p<3; p++)
|
||||
{
|
||||
if (OtOfs<Z[p]) OtOfs=Z[p];
|
||||
if (ZMin>Z[p]) ZMin=Z[p];
|
||||
if (ZMax<Z[p]) ZMax=Z[p];
|
||||
OtOfs+=Z[p]*Z[p];
|
||||
}
|
||||
OtOfs/=4;
|
||||
OtOfs=(int)sqrt(OtOfs/3);
|
||||
|
||||
OtOfs/=8;
|
||||
// printf("%i\n",OtOfs);
|
||||
if (MinOT>OtOfs) MinOT=OtOfs;
|
||||
if (MaxOT<OtOfs) MaxOT=OtOfs;
|
||||
if (OtOfs>15) OtOfs=15;
|
||||
if (OtOfs<0) OtOfs=0;
|
||||
|
||||
// if (OtOfs>15) OtOfs=15;
|
||||
T.OTOfs=OtOfs;
|
||||
|
||||
// Write It
|
||||
fwrite(&T,1,sizeof(sTri),File);
|
||||
}
|
||||
printf("Tri %i\n",ListSize);
|
||||
printf("ZMin %i ZMax %i\n",ZMin,ZMax);
|
||||
|
||||
return(ThisPos);
|
||||
|
||||
|
|
|
@ -123,6 +123,14 @@ SOURCE=.\Layers\MkLevelLayerFX.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Layers\MkLevelLayerHazard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Layers\MkLevelLayerHazard.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Layers\MkLevelLayerItem.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
using namespace std;
|
||||
|
||||
//***************************************************************************
|
||||
/*
|
||||
struct sMkLevelTex
|
||||
{
|
||||
int Set;
|
||||
int XOfs,YOfs;
|
||||
u8 *RGB;
|
||||
// u8 *RGB;
|
||||
int Flags;
|
||||
int RChk,GChk,BChk;
|
||||
// int RChk,GChk,BChk;
|
||||
int TexID;
|
||||
|
||||
bool operator ==(sMkLevelTex const &v1)
|
||||
|
@ -35,7 +36,7 @@ bool operator ==(sMkLevelTex const &v1)
|
|||
return(true);
|
||||
}
|
||||
};
|
||||
|
||||
*/
|
||||
//***************************************************************************
|
||||
struct sMkLevelModel
|
||||
{
|
||||
|
@ -72,10 +73,10 @@ public:
|
|||
|
||||
int Create2dTex(int Tile,int Flags);
|
||||
int Create3dTile(sExpLayerTile &ThisTile);
|
||||
int FindRGBMatch(sMkLevelTex &ThisTex);
|
||||
bool IsRGBSame(const sMkLevelTex &Tile0,const sMkLevelTex &Tile1);
|
||||
void MakeTexName(sMkLevelTex &InTex,GString &OutStr);
|
||||
int BuildTileTex(sMkLevelTex &InTex);
|
||||
// int FindRGBMatch(sMkLevelTex &ThisTex);
|
||||
// bool IsRGBSame(const sMkLevelTex &Tile0,const sMkLevelTex &Tile1);
|
||||
void MakeTexName(sExpTile &SrcTile,int Flags,GString &OutStr);
|
||||
int BuildTileTex(sExpTile &SrcTile,int Flags);
|
||||
|
||||
char *GetConfigStr(const char *Grp,const char *Key) {return(Config.GetStr(Grp,Key));}
|
||||
CIni &GetConfig() {return(Config);}
|
||||
|
@ -137,7 +138,7 @@ protected:
|
|||
|
||||
CList<sExpLayerTile> Tile2dList;
|
||||
CList<sExpLayerTile> Tile3dList;
|
||||
CList<sMkLevelTex> Tex2dList;
|
||||
// CList<sMkLevelTex> Tex2dList;
|
||||
CTexGrab TexGrab;
|
||||
CList<Frame> BmpList;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue