This commit is contained in:
parent
f2c2ce0fd2
commit
9087f4cc16
12 changed files with 94 additions and 87 deletions
|
@ -55,7 +55,6 @@ GString Filename;
|
|||
GetExecPath(Filename);
|
||||
Filename+=IconzFileName;
|
||||
IconBank->AddSet(Filename);
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -110,7 +109,6 @@ Vector3 DuffVector;
|
|||
CString mexstr;
|
||||
mexstr.Format("Old File Format\n\nPlease re-save\n");
|
||||
AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -231,26 +229,31 @@ void CCore::RenderLayers(bool OneShot)
|
|||
Vector3 &ThisCam=GetCam();
|
||||
int ListSize=Layer.size();
|
||||
int StartLayer,EndLayer;
|
||||
CLayer *ThisLayer;
|
||||
|
||||
if (OneShot)
|
||||
{
|
||||
StartLayer=ActiveLayer;
|
||||
EndLayer=StartLayer+1;
|
||||
ThisLayer=CurrentLayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartLayer=0;
|
||||
EndLayer=ListSize;
|
||||
while (Layer[StartLayer]->IsUnique()) StartLayer++;
|
||||
ThisLayer=Layer[StartLayer];
|
||||
}
|
||||
|
||||
for (int i=StartLayer; i<EndLayer; i++)
|
||||
{
|
||||
if (Layer[i]->IsVisible())
|
||||
if (ThisLayer->IsVisible())
|
||||
{
|
||||
Layer[i]->Render(this,ThisCam,Is3dFlag);
|
||||
if (GridFlag) Layer[i]->RenderGrid(this,ThisCam,i==ActiveLayer);
|
||||
ThisLayer->Render(this,ThisCam,Is3dFlag);
|
||||
if (GridFlag) ThisLayer->RenderGrid(this,ThisCam,i==ActiveLayer);
|
||||
}
|
||||
if (i!=EndLayer) ThisLayer=Layer[i+1];
|
||||
|
||||
}
|
||||
CurrentLayer->RenderCursor(this,ThisCam,Is3dFlag);
|
||||
// Get Cursor Pos
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
|
||||
const Vector3 DefOfs(+0.5f,0,+4.0f);
|
||||
int CElem::BlankID=-1;
|
||||
int CElem::InvalidID=-1;
|
||||
bool CElem::DefTexFlag=false;
|
||||
|
||||
/*****************************************************************************/
|
||||
// All Elems MUST run from 0,0 ->
|
||||
|
@ -67,7 +70,7 @@ CElem::CElem(int Width,int Height)
|
|||
Type=ElemType2d;
|
||||
TexXOfs=0;
|
||||
TexYOfs=0;
|
||||
CreateBlankTileGfx();
|
||||
for (int i=0; i<ElemTypeMax; i++) DrawList[i]=BlankID;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -92,8 +95,11 @@ GFName Path=Filename;
|
|||
Ofs.Zero();
|
||||
Create2dTexture(TexCache,Path.File(),Node);
|
||||
Build2dDrawList(TexCache,DrawList[ElemType2d]);
|
||||
if (!ValidFlag) CreateInvalidTileGfx();
|
||||
|
||||
if (!ValidFlag)
|
||||
{
|
||||
Purge(); // Clear whatever is already there
|
||||
for (int i=0; i<ElemTypeMax; i++) DrawList[i]=InvalidID;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -122,7 +128,11 @@ GFName Path=Filename;
|
|||
Build3dDrawList(TexCache,DrawList[ElemType3d]);
|
||||
Create2dTexture(TexCache,Path.File(),TexID);
|
||||
Build2dDrawList(TexCache,DrawList[ElemType2d]);
|
||||
if (!ValidFlag) CreateInvalidTileGfx();
|
||||
if (!ValidFlag)
|
||||
{
|
||||
Purge(); // Clear whatever is already there
|
||||
for (int i=0; i<ElemTypeMax; i++) DrawList[i]=InvalidID;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -409,26 +419,6 @@ int ColFlags=Flags >> PC_TILE_FLAG_COLLISION_SHIFT;
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CElem::RenderInvalid()
|
||||
{
|
||||
float X0=0;
|
||||
float X1=UnitWidth;
|
||||
float Y0=0;
|
||||
float Y1=UnitHeight;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBegin(GL_LINES);
|
||||
glColor4f(1,1,1,1);
|
||||
|
||||
glVertex3f( X0,Y0,0);
|
||||
glVertex3f( X1,Y1,0);
|
||||
|
||||
glVertex3f( X1,Y0,0);
|
||||
glVertex3f( X0,Y1,0);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CElem::Purge()
|
||||
{
|
||||
|
@ -439,18 +429,18 @@ void CElem::Purge()
|
|||
|
||||
/*****************************************************************************/
|
||||
// Only created for the tile browser, should NEVER appear in main view
|
||||
void CElem::CreateBlankTileGfx()
|
||||
void CElem::CreateDefaultTileGfx()
|
||||
{
|
||||
float X0=0;
|
||||
float X1=UnitWidth;
|
||||
float X1=1.0f;
|
||||
float Y0=0;
|
||||
float Y1=UnitHeight;
|
||||
|
||||
Purge();
|
||||
for (int i=0; i<ElemTypeMax; i++)
|
||||
float Y1=1.0f;
|
||||
DefTexFlag=true;
|
||||
// Blank
|
||||
if (BlankID==-1)
|
||||
{
|
||||
DrawList[i]=glGenLists(1);
|
||||
glNewList(DrawList[i],GL_COMPILE);
|
||||
BlankID=glGenLists(1);
|
||||
glNewList(BlankID,GL_COMPILE);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBegin(GL_LINES);
|
||||
glColor4f(1,1,1,1);
|
||||
|
@ -469,21 +459,11 @@ float Y1=UnitHeight;
|
|||
glEnd();
|
||||
glEndList();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CElem::CreateInvalidTileGfx()
|
||||
// Invalid
|
||||
if (InvalidID==-1)
|
||||
{
|
||||
float X0=0;
|
||||
float X1=UnitWidth;
|
||||
float Y0=0;
|
||||
float Y1=UnitHeight;
|
||||
|
||||
Purge();
|
||||
for (int i=0; i<ElemTypeMax; i++)
|
||||
{
|
||||
DrawList[i]=glGenLists(1);
|
||||
glNewList(DrawList[i],GL_COMPILE);
|
||||
InvalidID=glGenLists(1);
|
||||
glNewList(InvalidID,GL_COMPILE);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBegin(GL_LINES);
|
||||
glColor4f(1,1,1,1);
|
||||
|
@ -498,6 +478,7 @@ float Y1=UnitHeight;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void CElem::RenderElem4Texture(sRGBData &RGBData)
|
||||
{
|
||||
|
@ -632,7 +613,7 @@ void CElemSet::Load(CCore *Core)
|
|||
GFName FName=Filename;
|
||||
GString Ext=FName.Ext();
|
||||
Ext.Upper();
|
||||
|
||||
if (!CElem::DefTexFlag) CElem::CreateDefaultTileGfx();
|
||||
if (Ext=="GIN")
|
||||
Load3d(Core);
|
||||
else
|
||||
|
@ -708,7 +689,7 @@ CPoint CElemSet::GetElemPos(int ID)
|
|||
bool CElemSet::IsValid(int No)
|
||||
{
|
||||
int ListSize=ElemList.size();
|
||||
if (No>ListSize) return(false);
|
||||
if (No>=ListSize) return(false);
|
||||
return(ElemList[No].IsValid());
|
||||
}
|
||||
|
||||
|
@ -880,8 +861,8 @@ bool CElemBank::IsValid(int Set,int Elem)
|
|||
{
|
||||
if (Set<0 || Elem<0) return(false);
|
||||
if (Elem==0) return(true);
|
||||
// if (Set>=SetList.size()) return(false);
|
||||
if (Set>SetList.size()) return(false);
|
||||
if (Set>=SetList.size()) return(false);
|
||||
// if (Set>SetList.size()) return(false);
|
||||
ASSERT(Set<SetList.size());
|
||||
return(SetList[Set].IsValid(Elem));
|
||||
}
|
||||
|
@ -908,7 +889,7 @@ void CElemBank::RenderElem(int Set,int Elem,int Flags,bool Is3d)
|
|||
}
|
||||
else
|
||||
{
|
||||
SetList[0].RenderInvalid();
|
||||
RenderInvalid();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ public:
|
|||
|
||||
void Purge();
|
||||
void Render(int Flags,bool Render3d);
|
||||
void RenderInvalid();
|
||||
|
||||
int GetElemWidth() {return(ElemWidth);}
|
||||
int GetElemHeight() {return(ElemHeight);}
|
||||
|
@ -63,8 +62,10 @@ public:
|
|||
int GetTexXOfs() {return(TexXOfs);}
|
||||
int GetTexYOfs() {return(TexYOfs);}
|
||||
|
||||
void CreateBlankTileGfx();
|
||||
void CreateInvalidTileGfx();
|
||||
static void CreateDefaultTileGfx();
|
||||
static int BlankID;
|
||||
static int InvalidID;
|
||||
static bool DefTexFlag;
|
||||
|
||||
std::vector<sTriFace> &GetTriList() {return(TriList);}
|
||||
|
||||
|
@ -93,7 +94,6 @@ protected:
|
|||
float UnitWidth,UnitHeight;
|
||||
int ElemID;
|
||||
u8 *ElemRGB;
|
||||
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -119,7 +119,6 @@ const char *GetName() {return(Name);}
|
|||
int GetBrowserWidth() {return(ElemBrowserWidth);}
|
||||
|
||||
void RenderElem(int Elem,int Flags,bool Render3d) {ElemList[Elem].Render(Flags,Render3d);}
|
||||
void RenderInvalid() {ElemList[0].RenderInvalid();}
|
||||
CElem &GetElem(int No) {return(ElemList[No]);}
|
||||
void Purge();
|
||||
bool IsValid(int No);
|
||||
|
@ -163,7 +162,7 @@ virtual void Save(CFile *File);
|
|||
CElem &GetElem(int Set,int Elem) {return(SetList[Set].GetElem(Elem));}
|
||||
bool IsValid(int Set,int Elem);
|
||||
void RenderElem(int Set,int Elem,int Flags,bool Is3d);
|
||||
|
||||
void RenderInvalid() {glCallList(CElem::InvalidID);}
|
||||
int GetSetCount() {return(SetList.size());}
|
||||
|
||||
const char *GetSetName(int Set) {return(SetList[Set].GetName());}
|
||||
|
|
|
@ -77,7 +77,7 @@ void CElemStore::RenderElem(int Set,int Elem,int Flags,bool Is3d)
|
|||
}
|
||||
else
|
||||
{
|
||||
SetList[0].RenderInvalid();
|
||||
RenderInvalid();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ CLayer *New;
|
|||
|
||||
File->Read(&ThisDef,sizeof(sLayerDef));
|
||||
New=NewLayer(ThisDef);//Type,SubType,0,0);
|
||||
New->Load(File,Version);
|
||||
}
|
||||
return(New);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ static int GetLayerIdx(int Type,int SubType);
|
|||
static CLayer *NewLayer(sLayerDef &Def);
|
||||
static CLayer *LoadLayer(CFile *File,int Version);
|
||||
|
||||
char *GetName() {TRACE1("%i\n",TableIdx);return(InfoTable[TableIdx].Name);}
|
||||
char *GetName() {return(InfoTable[TableIdx].Name);}
|
||||
bool CanDelete() {return(InfoTable[TableIdx].DeleteFlag);}
|
||||
float GetScaleFactor() {return(InfoTable[TableIdx].ScaleFactor);}
|
||||
bool GetRender3dFlag() {return(InfoTable[TableIdx].Render3dFlag);}
|
||||
|
|
|
@ -80,6 +80,7 @@ void CLayerCollision::Load(CFile *File,int Version)
|
|||
void CLayerCollision::Save(CFile *File)
|
||||
{
|
||||
// Always Save current version
|
||||
File->Write(&Mode,sizeof(MouseMode));
|
||||
Map.Save(File);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ void CLayerShade::Load(CFile *File,int Version)
|
|||
}
|
||||
InitLayer(LayerDef);
|
||||
File->Read(&Count,sizeof(int));
|
||||
if (Count<2) Count=2;
|
||||
for (int i=0; i<LAYER_SHADE_RGB_MAX; i++)
|
||||
{
|
||||
File->Read(&Pos[i],sizeof(int));
|
||||
|
|
|
@ -116,7 +116,6 @@ CElemBank *IconBank=Core->GetIconBank();
|
|||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
||||
|
||||
int ListSize=ThisThing.XY.size();
|
||||
TRACE1("%i\n",ListSize);
|
||||
for (int i=0;i<ListSize; i++)
|
||||
{
|
||||
// Render Thing
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
/*****************************************************************************/
|
||||
CLayerTile::CLayerTile(sLayerDef &Def)
|
||||
{
|
||||
TileBank=0;
|
||||
InitLayer(Def);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
CLayerTile::~CLayerTile()
|
||||
{
|
||||
|
@ -47,10 +49,11 @@ void CLayerTile::InitLayer(sLayerDef &Def)
|
|||
CLayer::InitLayer(Def);
|
||||
Mode=MouseModePaint;
|
||||
|
||||
if (LayerDef.SubType==LAYER_SUBTYPE_ACTION)
|
||||
if (LayerDef.SubType==LAYER_SUBTYPE_ACTION && !TileBank)
|
||||
{
|
||||
TileBank=new CTileBank;
|
||||
else
|
||||
TileBank=0;
|
||||
}
|
||||
|
||||
SubView=TileBank;
|
||||
|
||||
if (!GetResizeFlag())
|
||||
|
@ -67,6 +70,7 @@ void CLayerTile::Load(CFile *File,int Version)
|
|||
{
|
||||
if (Version<=5)
|
||||
{
|
||||
TileBank=0;
|
||||
LayerDef.Type=LAYER_TYPE_TILE;
|
||||
BOOL DB;
|
||||
float DF;
|
||||
|
@ -83,13 +87,6 @@ void CLayerTile::Load(CFile *File,int Version)
|
|||
}
|
||||
InitLayer(LayerDef);
|
||||
Map.Load(File,Version);
|
||||
|
||||
// if (LayerDef.SubType==LAYER_SUBTYPE_ACTION)
|
||||
// TileBank=new CTileBank;
|
||||
// else
|
||||
// TileBank=0;
|
||||
// SubView=TileBank;
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -109,6 +109,14 @@ SOURCE=.\Layer.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerActor.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerActor.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerCollision.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -121,6 +129,22 @@ SOURCE=.\LayerDef.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerItem.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerItem.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerPlatform.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerPlatform.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LayerShade.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -127,7 +127,9 @@ float Scale=CamPos.z/(float)BrowserWidth/2.0;
|
|||
glTranslatef(-CamPos.x+XPos,CamPos.y-YPos,0);
|
||||
|
||||
glColor3f(1,1,1);
|
||||
ThisSet.RenderElem(TileID,0,Is3d);
|
||||
|
||||
RenderElem(CurrentSet,TileID,0,Is3d);
|
||||
|
||||
// Selection
|
||||
ThisElem.Tile=TileID;
|
||||
SelFlag=0;
|
||||
|
@ -158,6 +160,7 @@ float Scale=CamPos.z/(float)BrowserWidth/2.0;
|
|||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
TileID++;
|
||||
}
|
||||
glPopMatrix();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue