This commit is contained in:
Daveo 2001-05-02 18:40:41 +00:00
parent a6710337c0
commit cb772db46a
30 changed files with 197 additions and 108 deletions

View file

@ -1,3 +1,2 @@
Idle
Bite Bite
Bounce
Wobble

View file

@ -0,0 +1 @@
idle

View file

@ -0,0 +1 @@
idle

View file

@ -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(); //int ListSize = FaceList.size();
// FaceList.resize(ListSize+1); // 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 < 0.f) F.uvs[i].v=0.f;
if (F.uvs[i].v > 1.f) F.uvs[i].v=1.f; if (F.uvs[i].v > 1.f) F.uvs[i].v=1.f;
} }
F.TPageFlag=0;
F.TexName=Tex; F.TexName=Tex;
F.Mat = -1; F.Mat = -1;
SetTPageFlag(F,MatFlag);
return(AddFace(F,ProcessTexFlag)); return(AddFace(F,ProcessTexFlag));
} }
@ -153,6 +168,7 @@ int ListSize=Faces.GetFaceCount();
} }
//*************************************************************************** //***************************************************************************
/*
CFace &CFaceStore::AddFace(sTriFace &Face,int ID) CFace &CFaceStore::AddFace(sTriFace &Face,int ID)
{ {
int ListSize = FaceList.size(); int ListSize = FaceList.size();
@ -177,7 +193,7 @@ CFace &F = FaceList[ListSize];
F.ID=ID; F.ID=ID;
return(F); return(F);
} }
*/
//*************************************************************************** //***************************************************************************
//*** Texture Stuff ********************************************************* //*** Texture Stuff *********************************************************
//*************************************************************************** //***************************************************************************
@ -367,8 +383,15 @@ int V=ThisTex.v+H;
Out.uv1[0]=(uv1[0]-XOfs); Out.uv1[1]=(uv1[1]-YOfs); 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.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.Clut=ThisTex.Clut;
Out.PolyCode=GPU_PolyFT3Code;
if (In.TPageFlag)
{
Out.PolyCode|=GPUCode_SemiTrans;
}
} }

View file

@ -35,8 +35,10 @@ public:
int vis[4]; int vis[4];
Vector3 Normal; Vector3 Normal;
bool Avail; bool Avail;
int ID; // int ID;
GString TexName; GString TexName;
int TPageFlag;
}; };
/* /*
@ -71,6 +73,7 @@ public:
struct sTriFace struct sTriFace
{ {
int Mat; int Mat;
int Flags;
Vector3 vtx[3]; Vector3 vtx[3];
int pts[3]; int pts[3];
sUV uvs[3]; sUV uvs[3];
@ -86,7 +89,8 @@ public:
CFaceStore(int Max) {MaxStrip=Max;TexGrab=&FaceStoreTexGrab;} CFaceStore(int Max) {MaxStrip=Max;TexGrab=&FaceStoreTexGrab;}
~CFaceStore(){}; ~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); CFace &AddFace(CFace &F,bool TexFlag=true);
void AddFaces(vector<CFace>&Faces,bool TexFlag=true); void AddFaces(vector<CFace>&Faces,bool TexFlag=true);
void AddFaces(CFaceStore &Faces,bool TexFlag=true); void AddFaces(CFaceStore &Faces,bool TexFlag=true);

View file

@ -99,7 +99,7 @@ GFName Path=Filename;
Create2dTexture(TexCache,Path.File(),Node); Create2dTexture(TexCache,Path.File(),Node);
Build2dDrawList(TexCache,DrawList[ElemType2d]); Build2dDrawList(TexCache,DrawList[ElemType2d]);
BlankFlag=false; 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<GString> const &SceneTexList=ThisScene.GetTexList();
std::vector<int> const &SceneUsedMatList=ThisScene.GetUsedMaterialIdx(); std::vector<int> const &SceneUsedMatList=ThisScene.GetUsedMaterialIdx();
std::vector<Material> const &SceneMatList=ThisScene.GetMaterials();
int TexCount=SceneTexList.size(); int TexCount=SceneTexList.size();
int TriCount=NodeTriList.size(); int TriCount=NodeTriList.size();
@ -257,7 +258,7 @@ int ListSize=TriList.size();
sUVTri const &ThisUV=NodeUVList[T]; sUVTri const &ThisUV=NodeUVList[T];
sTriFace &Tri=TriList[ListSize+T]; sTriFace &Tri=TriList[ListSize+T];
int ThisMat=NodeTriMat[T]; int ThisMat=NodeTriMat[T];
int TexID; int TexID,TexFlags;
// Sort Textures - Only add the ones that are used :o) // Sort Textures - Only add the ones that are used :o)
@ -269,10 +270,12 @@ int ListSize=TriList.size();
AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION); AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
TexID=0; TexID=0;
} }
else // else
{ {
TexFlags=SceneMatList[TexID].Flags;
GString ThisName; GString ThisName;
GString TexName=SceneTexList[TexID]; GString TexName=SceneTexList[TexID];
ThisName=SetPath+TexName; ThisName=SetPath+TexName;
TRACE2("%i !%s!\n",TexID,ThisName); TRACE2("%i !%s!\n",TexID,ThisName);
TexID=TexCache.ProcessTexture(ThisName); TexID=TexCache.ProcessTexture(ThisName);
@ -293,6 +296,7 @@ Matrix4x4 TransMtx;
Tri.uvs[p].u=ThisUV.p[p].u; Tri.uvs[p].u=ThisUV.p[p].u;
Tri.uvs[p].v=ThisUV.p[p].v; Tri.uvs[p].v=ThisUV.p[p].v;
Tri.Mat=TexID; Tri.Mat=TexID;
Tri.Flags=TexFlags;
} }
} }
for (int Child=0; Child<ChildCount; Child++) Build3dElem(TexCache,ThisScene,ThisNode.PruneChildList[Child]); 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++) for (int i=0; i<ElemTypeMax; i++)
glDeleteLists(DrawList[i],1); glDeleteLists(DrawList[i],1);
CleanUp(); CleanUp();
TriList.clear(); // TriList.clear();
} }
/*****************************************************************************/ /*****************************************************************************/

View file

@ -17,14 +17,20 @@
#include "MapEdit.h" #include "MapEdit.h"
#include "GUIElemList.h" #include "GUIElemList.h"
/*****************************************************************************/
struct sTriFace struct sTriFace
{ {
int Mat; int Mat;
int Flags;
Vector3 vtx[3]; Vector3 vtx[3];
int pts[3]; int pts[3];
sUV uvs[3]; sUV uvs[3];
}; };
enum TRI_FLAGS
{
TRI_FLAGS_TRANS_ADD=1<<0,
};
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/

View file

@ -74,6 +74,7 @@ struct sExpTri
int TexID; int TexID;
Vector3 vtx[3]; Vector3 vtx[3];
float uv[3][2]; float uv[3][2];
int Flags;
}; };
/*****************************************************************************/ /*****************************************************************************/

View file

@ -37,26 +37,26 @@ Class25=CMapEditDoc
Class26=CMapEditView Class26=CMapEditView
ResourceCount=21 ResourceCount=21
Resource1=IDR_MAINFRAME (English (U.S.)) Resource1=IDD_LAYER_COLLISION
Resource2=IDR_MAPEDITYPE (English (U.S.)) Resource2=IDR_MAPEDITYPE (English (U.S.))
Resource3=IDD_ABOUTBOX (English (U.S.)) Resource3=IDD_ELEMLIST
Resource4=IDD_ELEMLIST Resource4=IDD_MULTIBAR (English (U.S.))
Resource5=IDD_LAYER_LIST Resource5=IDD_LAYER_THING
Resource6=IDD_TOOLBAR Resource6=IDR_TOOLBAR (English (U.S.))
Resource7=IDD_NEWMAP Resource7=IDD_LAYER_PLATFORM
Resource8=IDD_ADDLAYER Resource8=IDD_LAYER_TRIGGER
Resource9=IDD_LAYER_TRIGGER Resource9=IDD_TILEBANK
Resource10=IDD_LAYER_THING_POS Resource10=IDD_NEWMAP
Resource11=IDD_LAYER_SHADE Resource11=IDR_MAINFRAME (English (U.S.))
Resource12=IDD_LAYER_COLLISION Resource12=IDD_ABOUTBOX (English (U.S.))
Resource13=IDD_MULTIBAR (English (U.S.)) Resource13=IDD_LAYER_ACTOR
Resource14=IDD_LAYER_ACTOR Resource14=IDD_LAYER_LIST
Resource15=IDD_LAYER_THING Resource15=IDD_RESIZE
Resource16=IDD_RESIZE Resource16=IDD_LAYER_THING_POS
Resource17=IDD_LAYER_PLATFORM Resource17=IDD_ADDLAYER
Resource18=IDD_TILEBANK Resource18=IDD_LAYER_FX
Resource19=IDD_LAYER_FX Resource19=IDD_TOOLBAR
Resource20=IDR_TOOLBAR (English (U.S.)) Resource20=IDD_LAYER_SHADE
Resource21=IDD_LAYER_HAZARD Resource21=IDD_LAYER_HAZARD
[CLS:CChildFrame] [CLS:CChildFrame]

View file

@ -54,6 +54,8 @@ int i,ListSize=ThingList.size();
OutThing.Pos.Y=ThisThing.XY[0].y; OutThing.Pos.Y=ThisThing.XY[0].y;
OutThing.Width=ThisThing.Data.Trigger.TriggerWidth; OutThing.Width=ThisThing.Data.Trigger.TriggerWidth;
OutThing.Height=ThisThing.Data.Trigger.TriggerHeight; 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); fwrite(&OutThing,sizeof(sThingTrigger),1,File);
} }

View file

@ -156,6 +156,7 @@ vector<int> const &NodeMatList = ThisNode.GetTriMaterial();
vector<sUVTri> const &NodeUVList = ThisNode.GetUVTris(); vector<sUVTri> const &NodeUVList = ThisNode.GetUVTris();
vector<GString> const &SceneTexList= Scene.GetTexList(); vector<GString> const &SceneTexList= Scene.GetTexList();
vector<int> const &SceneUsedMatList=Scene.GetUsedMaterialIdx(); vector<int> const &SceneUsedMatList=Scene.GetUsedMaterialIdx();
vector<Material> const &SceneMaterials=Scene.GetMaterials();
int TriCount=NodeTriList.size(); 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()); 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]; 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(); int ChildCount=ThisNode.GetPruneChildCount();
@ -197,6 +200,7 @@ int Idx;
CFace F; CFace F;
ExpTri2Face(ThisTri,F); ExpTri2Face(ThisTri,F);
ModelFaceList.SetTPageFlag(F,ThisTri.Flags);
ModelFaceList.AddFace(F,false); ModelFaceList.AddFace(F,false);
} }
@ -299,8 +303,9 @@ u8 *TilePtr=(u8*) &ByteHdr[FileHdr->TileOfs];
sExpTile &InTile=InTileList[i]; sExpTile &InTile=InTileList[i];
InTile=*ThisTilePtr; InTile=*ThisTilePtr;
InTile.RGB=(u8*)malloc(RGBSize); // InTile.RGB=(u8*)malloc(RGBSize);
memcpy(InTile.RGB,TilePtr+sizeof(sExpTile),RGBSize); // memcpy(InTile.RGB,TilePtr+sizeof(sExpTile),RGBSize);
InTile.RGB=0;
TilePtr+=RGBSize+sizeof(sExpTile); 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].u=ThisTri.uv[p][0];
F.uvs[p].v=ThisTri.uv[p][1]; F.uvs[p].v=ThisTri.uv[p][1];
} }
} }
//*************************************************************************** //***************************************************************************
@ -648,8 +654,7 @@ int TileID=OutTile3dList.size();
F.uvs[0]=F.uvs[1]; F.uvs[0]=F.uvs[1];
F.uvs[1]=TmpUV; F.uvs[1]=TmpUV;
} }
OutFaceList.SetTPageFlag(F,ThisTri.Flags);
OutFaceList.AddFace(F,true); OutFaceList.AddFace(F,true);
} }
@ -663,66 +668,64 @@ int TileID=OutTile3dList.size();
int CMkLevel::Create2dTex(int Tile,int Flags) int CMkLevel::Create2dTex(int Tile,int Flags)
{ {
sExpTile &SrcTile=InTileList[Tile]; sExpTile &SrcTile=InTileList[Tile];
int Idx; //sMkLevelTex InTex;
sMkLevelTex InTex;
InTex.Set=SrcTile.Set; // InTex.RGB=SrcTile.RGB;
InTex.Flags=Flags;
InTex.XOfs=SrcTile.XOfs;
InTex.YOfs=SrcTile.YOfs;
InTex.RGB=SrcTile.RGB;
Idx=Tex2dList.Find(InTex);
if (Idx!=-1) return(Idx);
// Try and find RGB data match // Try and find RGB data match
Idx=FindRGBMatch(InTex); // not working
if (Idx!=-1) return(Idx); // Idx=FindRGBMatch(InTex);
// if (Idx!=-1) return(Idx);
// Must be new, add it // Must be new, add it
BuildTileTex(InTex); // InTex.Set=SrcTile.Set;
Tex2dList.push_back(InTex); // InTex.Flags=Flags;
return(InTex.TexID); // 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; Frame ThisFrame;
Rect ThisRect; Rect ThisRect;
GString Name=GFName(InSetNameList[InTex.Set]).File(); GString Name=GFName(InSetNameList[SrcTile.Set]).File();
GString TexName; GString TexName;
int BmpW=InFrame.GetWidth(); int BmpW=InFrame.GetWidth();
int BmpH=InFrame.GetHeight(); int BmpH=InFrame.GetHeight();
int TexID;
TexGrab.ShrinkToFit(false); TexGrab.ShrinkToFit(false);
TexGrab.AllowRotate(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); printf("AARGH!!! %s(%i) wants X=%i,tile is only %i Wide\n",Name,SrcTile.Set,SrcTile.XOfs*16,BmpW);
InTex.XOfs=0; 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); printf("AARGH!!! %s(%i) wants Y=%i,tile is only %i High\n",Name,SrcTile.Set,SrcTile.YOfs*16,BmpH);
InTex.YOfs=0; SrcTile.YOfs=0;
} }
MakeTexName(InTex,TexName); MakeTexName(SrcTile,Flags,TexName);
ThisRect.X=InTex.XOfs*16; ThisRect.X=SrcTile.XOfs*16;
ThisRect.Y=InTex.YOfs*16; ThisRect.Y=SrcTile.YOfs*16;
ThisRect.W=16; ThisRect.W=16;
ThisRect.H=16; ThisRect.H=16;
ThisFrame.Grab(InFrame,ThisRect); ThisFrame.Grab(InFrame,ThisRect);
if (InTex.Flags& PC_TILE_FLAG_MIRROR_X) ThisFrame.FlipX(); if (Flags& PC_TILE_FLAG_MIRROR_X) ThisFrame.FlipX();
if (InTex.Flags & PC_TILE_FLAG_MIRROR_Y) ThisFrame.FlipY(); if (Flags & PC_TILE_FLAG_MIRROR_Y) ThisFrame.FlipY();
InTex.TexID=TexGrab.AddMemFrame(TexName,ThisFrame); TexID=TexGrab.AddMemFrame(TexName,ThisFrame);
#ifdef _DEBUG #ifdef _DEBUG
if (0) if (0)
@ -735,26 +738,28 @@ int BmpH=InFrame.GetHeight();
} }
} }
#endif #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]; 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; OutStr=NewName;
} }
//*************************************************************************** //***************************************************************************
/*
int CMkLevel::FindRGBMatch(sMkLevelTex &ThisTex) int CMkLevel::FindRGBMatch(sMkLevelTex &ThisTex)
{ {
int i,ListSize=Tex2dList.size(); int i,ListSize=Tex2dList.size();
int Size=TileW*TileH; int Size=TileW*TileH;
u8 *RGBPtr=ThisTex.RGB; u8 *RGBPtr=ThisTex.RGB;
if (!RGBPtr) printf("HA HA\n");
// Create Checksum for this tile // Create Checksum for this tile
ThisTex.RChk=0; ThisTex.RChk=0;
ThisTex.GChk=0; ThisTex.GChk=0;
@ -765,6 +770,7 @@ u8 *RGBPtr=ThisTex.RGB;
ThisTex.GChk+=*RGBPtr++; ThisTex.GChk+=*RGBPtr++;
ThisTex.BChk+=*RGBPtr++; ThisTex.BChk+=*RGBPtr++;
} }
// Check all others for match // Check all others for match
for (i=0; i<ListSize; i++) for (i=0; i<ListSize; i++)
{ {
@ -774,14 +780,31 @@ u8 *RGBPtr=ThisTex.RGB;
// Checksum first // Checksum first
if (ThisTex.RChk==ChkTex.RChk && ThisTex.GChk==ChkTex.GChk && ThisTex.BChk==ChkTex.BChk) 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); 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) bool CMkLevel::IsRGBSame(const sMkLevelTex &Tex0,const sMkLevelTex &Tex1)
{ {
int W=TileW; int W=TileW;
@ -818,6 +841,7 @@ u8 *RGB1=Tex1.RGB;
return(true); return(true);
} }
*/
//*************************************************************************** //***************************************************************************
//*** Write ***************************************************************** //*** Write *****************************************************************
//*************************************************************************** //***************************************************************************
@ -879,36 +903,49 @@ int i,ListSize;
//*************************************************************************** //***************************************************************************
int ZMin=9999,ZMax=0;
int CMkLevel::WriteTriList() int CMkLevel::WriteTriList()
{ {
vector<sTri> &TriList=OutFaceList.GetOutTriList(); vector<sTri> &TriList=OutFaceList.GetOutTriList();
vector<sVtx> const &VtxList=OutFaceList.GetVtxList(); vector<sVtx> const &VtxList=OutFaceList.GetVtxList();
int ThisPos=ftell(File); int ThisPos=ftell(File);
int i,ListSize=TriList.size(); int i,ListSize=TriList.size();
int ZOfs=+4*Scale;
for (i=0;i<ListSize;i++) for (i=0;i<ListSize;i++)
{ {
sTri &T=TriList[i]; sTri &T=TriList[i];
int Z[3];
int OtOfs=0; int OtOfs=0;
int Z[3];
// Calc OtOfs // Calc OtOfs
Z[0]=abs(VtxList[T.P0].vz); Z[0]=VtxList[T.P0].vz+ZOfs;
Z[1]=abs(VtxList[T.P1].vz); Z[1]=VtxList[T.P1].vz+ZOfs;
Z[2]=abs(VtxList[T.P2].vz); Z[2]=VtxList[T.P2].vz+ZOfs;
for (int p=0; p<3; p++) 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 (MinOT>OtOfs) MinOT=OtOfs;
if (MaxOT<OtOfs) MaxOT=OtOfs; if (MaxOT<OtOfs) MaxOT=OtOfs;
if (OtOfs>15) OtOfs=15; if (OtOfs>15) OtOfs=15;
if (OtOfs<0) OtOfs=0;
// if (OtOfs>15) OtOfs=15;
T.OTOfs=OtOfs;
// Write It // Write It
fwrite(&T,1,sizeof(sTri),File); fwrite(&T,1,sizeof(sTri),File);
} }
printf("Tri %i\n",ListSize); printf("Tri %i\n",ListSize);
printf("ZMin %i ZMax %i\n",ZMin,ZMax);
return(ThisPos); return(ThisPos);

View file

@ -123,6 +123,14 @@ SOURCE=.\Layers\MkLevelLayerFX.h
# End Source File # End Source File
# Begin 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 SOURCE=.\Layers\MkLevelLayerItem.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View file

@ -17,13 +17,14 @@
using namespace std; using namespace std;
//*************************************************************************** //***************************************************************************
/*
struct sMkLevelTex struct sMkLevelTex
{ {
int Set; int Set;
int XOfs,YOfs; int XOfs,YOfs;
u8 *RGB; // u8 *RGB;
int Flags; int Flags;
int RChk,GChk,BChk; // int RChk,GChk,BChk;
int TexID; int TexID;
bool operator ==(sMkLevelTex const &v1) bool operator ==(sMkLevelTex const &v1)
@ -35,7 +36,7 @@ bool operator ==(sMkLevelTex const &v1)
return(true); return(true);
} }
}; };
*/
//*************************************************************************** //***************************************************************************
struct sMkLevelModel struct sMkLevelModel
{ {
@ -72,10 +73,10 @@ public:
int Create2dTex(int Tile,int Flags); int Create2dTex(int Tile,int Flags);
int Create3dTile(sExpLayerTile &ThisTile); int Create3dTile(sExpLayerTile &ThisTile);
int FindRGBMatch(sMkLevelTex &ThisTex); // int FindRGBMatch(sMkLevelTex &ThisTex);
bool IsRGBSame(const sMkLevelTex &Tile0,const sMkLevelTex &Tile1); // bool IsRGBSame(const sMkLevelTex &Tile0,const sMkLevelTex &Tile1);
void MakeTexName(sMkLevelTex &InTex,GString &OutStr); void MakeTexName(sExpTile &SrcTile,int Flags,GString &OutStr);
int BuildTileTex(sMkLevelTex &InTex); int BuildTileTex(sExpTile &SrcTile,int Flags);
char *GetConfigStr(const char *Grp,const char *Key) {return(Config.GetStr(Grp,Key));} char *GetConfigStr(const char *Grp,const char *Key) {return(Config.GetStr(Grp,Key));}
CIni &GetConfig() {return(Config);} CIni &GetConfig() {return(Config);}
@ -137,7 +138,7 @@ protected:
CList<sExpLayerTile> Tile2dList; CList<sExpLayerTile> Tile2dList;
CList<sExpLayerTile> Tile3dList; CList<sExpLayerTile> Tile3dList;
CList<sMkLevelTex> Tex2dList; // CList<sMkLevelTex> Tex2dList;
CTexGrab TexGrab; CTexGrab TexGrab;
CList<Frame> BmpList; CList<Frame> BmpList;

View file

@ -138,8 +138,6 @@ levels/CHAPTER06_LEVEL05.Tex
levels/FMA_SHADYSHOALS.Lvl levels/FMA_SHADYSHOALS.Lvl
levels/FMA_SHADYSHOALS.Tex levels/FMA_SHADYSHOALS.Tex
LEVELS/FMA_SHADYEXTERIOR.Lvl
LEVELS/FMA_SHADYEXTERIOR.Tex
actors/SPONGEBOB.SBK actors/SPONGEBOB.SBK
actors/SPONGEBOB_CORALBLOWER.SBK actors/SPONGEBOB_CORALBLOWER.SBK
@ -149,6 +147,8 @@ actors/SPONGEBOB_NET.SBK
actors/BARNACLEBOY.SBK actors/BARNACLEBOY.SBK
actors/KRUSTY.SBK actors/KRUSTY.SBK
actors/SQUIDWARD.SBK actors/SQUIDWARD.SBK
actors/GARY.SBK
actors/SANDY.SBK
actors/ANENOME.SBK actors/ANENOME.SBK
actors/BABYOCTOPUS.SBK actors/BABYOCTOPUS.SBK
@ -169,5 +169,3 @@ actors/SKELETALFISH.SBK
actors/SPIDERCRAB.SBK actors/SPIDERCRAB.SBK
actors/SPIKEYANENOME.SBK actors/SPIKEYANENOME.SBK
actors/STOMPER.SBK actors/STOMPER.SBK

View file

@ -53,7 +53,7 @@ LEVELS_CHAPTER03 := LEVEL01 LEVEL02 LEVEL03 LEVEL04
LEVELS_CHAPTER04 := LEVEL01 LEVEL02 LEVEL03 LEVEL04 LEVELS_CHAPTER04 := LEVEL01 LEVEL02 LEVEL03 LEVEL04
LEVELS_CHAPTER05 := LEVEL01 LEVEL02 LEVEL03 LEVEL04 LEVELS_CHAPTER05 := LEVEL01 LEVEL02 LEVEL03 LEVEL04
LEVELS_CHAPTER06 := LEVEL01 LEVEL02 LEVEL03 LEVEL04 LEVEL05 LEVELS_CHAPTER06 := LEVEL01 LEVEL02 LEVEL03 LEVEL04 LEVEL05
LEVELS_FMA := SHADYSHOALS SHADYEXTERIOR LEVELS_FMA := SHADYSHOALS
LEVELS_MAKEFILES := $(foreach CHAPTER,$(LEVELS_CHAPTERS),$(foreach LEVEL,$(LEVELS_$(CHAPTER)),$(LEVELS_MAKEFILE_DIR)/$(CHAPTER)_$(LEVEL).mak)) LEVELS_MAKEFILES := $(foreach CHAPTER,$(LEVELS_CHAPTERS),$(foreach LEVEL,$(LEVELS_$(CHAPTER)),$(LEVELS_MAKEFILE_DIR)/$(CHAPTER)_$(LEVEL).mak))
@ -108,8 +108,8 @@ ACTOR_MAKEFILE_DIR := $(TEMP_BUILD_DIR)/actor
ACTOR_DIRS_TO_MAKE := $(ACTOR_MAKEFILE_DIR) $(ACTOR_OUT_DIR) ACTOR_DIRS_TO_MAKE := $(ACTOR_MAKEFILE_DIR) $(ACTOR_OUT_DIR)
ACTOR_SPONGEBOB := SpongeBob SpongeBob_CoralBlower SpongeBob_JellyLauncher SpongeBob_Net ACTOR_SPONGEBOB := SpongeBob SpongeBob_CoralBlower SpongeBob_JellyLauncher SpongeBob_Net
ACTOR_NPC := BarnacleBoy Krusty Squidward ACTOR_NPC := BarnacleBoy Krusty Squidward Gary Sandy
# BarnacleBoy Gary Krusty MermaidMan Patrick Plankton Sandy Squidward # MermaidMan Patrick Plankton
ACTOR_ENEMY := Anenome BabyOctopus Ballblob Caterpillar clam Dustdevil Eyeball \ ACTOR_ENEMY := Anenome BabyOctopus Ballblob Caterpillar clam Dustdevil Eyeball \
Flamingskull FlyingDutchman Ghost HermitCrab IronDogFish Lrgjellyfish \ Flamingskull FlyingDutchman Ghost HermitCrab IronDogFish Lrgjellyfish \

View file

@ -49,10 +49,10 @@ void CNpcBallBlobEnemy::processMovement( int _frames )
if ( !m_animPlaying && m_frame != 0 ) if ( !m_animPlaying && m_frame != 0 )
{ {
m_animNo = ANIM_BALLBLOB_WOBBLE; m_animNo = ANIM_BALLBLOB_IDLE;
m_frame = 0; m_frame = 0;
} }
else if ( m_animNo == ANIM_BALLBLOB_BOUNCE ) else if ( m_animNo == ANIM_BALLBLOB_IDLE )
{ {
moveX = 0; moveX = 0;
moveY = 0; moveY = 0;
@ -85,14 +85,14 @@ void CNpcBallBlobEnemy::processMovement( int _frames )
{ {
m_velocity.vy = -m_velocity.vy; m_velocity.vy = -m_velocity.vy;
m_animPlaying = true; m_animPlaying = true;
m_animNo = ANIM_BALLBLOB_BOUNCE; m_animNo = ANIM_BALLBLOB_IDLE;
m_frame = 0; m_frame = 0;
} }
else else
{ {
m_velocity.vy = -( 5 << 8 ); m_velocity.vy = -( 5 << 8 );
m_animPlaying = true; m_animPlaying = true;
m_animNo = ANIM_BALLBLOB_BOUNCE; m_animNo = ANIM_BALLBLOB_IDLE;
m_frame = 0; m_frame = 0;
} }
@ -105,10 +105,10 @@ void CNpcBallBlobEnemy::processMovement( int _frames )
if ( m_npcPath.thinkFlat( Pos, &pathComplete, &waypointXDist, &waypointYDist, &waypointHeading ) ) if ( m_npcPath.thinkFlat( Pos, &pathComplete, &waypointXDist, &waypointYDist, &waypointHeading ) )
{ {
if ( m_animNo != ANIM_BALLBLOB_BOUNCE ) if ( m_animNo != ANIM_BALLBLOB_IDLE)
{ {
m_animPlaying = true; m_animPlaying = true;
m_animNo = ANIM_BALLBLOB_WOBBLE; m_animNo = ANIM_BALLBLOB_IDLE;
m_frame = 0; m_frame = 0;
} }
} }

View file

@ -904,7 +904,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
{ // NPC_BALL_BLOB { // NPC_BALL_BLOB
ACTORS_BALLBLOB_SBK, ACTORS_BALLBLOB_SBK,
ANIM_BALLBLOB_WOBBLE, ANIM_BALLBLOB_IDLE,
NPC_SENSOR_NONE, NPC_SENSOR_NONE,
NPC_MOVEMENT_STATIC, NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE, NPC_CLOSE_NONE,
@ -915,7 +915,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
DETECT_ALL_COLLISION, DETECT_ALL_COLLISION,
DAMAGE__BURN_ENEMY, DAMAGE__BURN_ENEMY,
16, 16,
ANIM_BALLBLOB_WOBBLE, ANIM_BALLBLOB_IDLE,
NPC_SHOT_GENERIC, NPC_SHOT_GENERIC,
0, 0,
0, 0,

View file

@ -743,9 +743,9 @@ int ShiftY=(Pos.vy & 15);
{ {
P0=&ModelVtxList[TList->P0]; P1=&ModelVtxList[TList->P1]; P2=&ModelVtxList[TList->P2]; P0=&ModelVtxList[TList->P0]; P1=&ModelVtxList[TList->P1]; P2=&ModelVtxList[TList->P2];
gte_ldv3(P0,P1,P2); gte_ldv3(P0,P1,P2);
setPolyFT3(TPrimPtr);
setShadeTex(TPrimPtr,1);
setlen(TPrimPtr, GPU_PolyFT3Tag); setlen(TPrimPtr, GPU_PolyFT3Tag);
TPrimPtr->code=TList->PolyCode;
setRGB0(TPrimPtr,128,128,128);
gte_rtpt_b(); gte_rtpt_b();
T0=*(u32*)&TList->uv0; // Get UV0 & TPage T0=*(u32*)&TList->uv0; // Get UV0 & TPage

View file

@ -135,9 +135,9 @@ VECTOR BlkPos;
P0=&VtxList[TList->P0]; P1=&VtxList[TList->P1]; P2=&VtxList[TList->P2]; P0=&VtxList[TList->P0]; P1=&VtxList[TList->P1]; P2=&VtxList[TList->P2];
CMX_SetTransMtxXY(&BlkPos); CMX_SetTransMtxXY(&BlkPos);
gte_ldv3(P0,P1,P2); gte_ldv3(P0,P1,P2);
setPolyFT3(TPrimPtr);
setShadeTex(TPrimPtr,1);
setlen(TPrimPtr, GPU_PolyFT3Tag); setlen(TPrimPtr, GPU_PolyFT3Tag);
TPrimPtr->code=TList->PolyCode;
setRGB0(TPrimPtr,128,128,128);
gte_rtpt_b(); gte_rtpt_b();
T0=*(u32*)&TList->uv0; // Get UV0 & TPage T0=*(u32*)&TList->uv0; // Get UV0 & TPage

Binary file not shown.

View file

@ -87,7 +87,9 @@ struct sTri
u16 TPage; // 2 u16 TPage; // 2
u8 uv2[2]; // 2 u8 uv2[2]; // 2
u16 P2; // 2 u16 P2; // 2
u32 OTOfs; // 4 u16 OTOfs; // 2
u8 PolyCode; // 1
u8 Pad; // 1
}; // 20 }; // 20
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -103,7 +105,9 @@ struct sQuad
u16 TPage; // 2 u16 TPage; // 2
u8 uv2[2]; // 2 u8 uv2[2]; // 2
u8 uv3[2]; // 2 u8 uv3[2]; // 2
u32 OTOfs; // 4 u16 OTOfs; // 2
u8 PolyCode; // 1
u8 Pad; // 1
}; // 24 }; // 24