This commit is contained in:
parent
50b875d84b
commit
e9835c718d
18 changed files with 253 additions and 80 deletions
|
@ -437,6 +437,13 @@ void CCore::TileBankLoad(char *Filename)
|
|||
UpdateView(NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::TileBankDelete()
|
||||
{
|
||||
TileBank.Delete();
|
||||
UpdateView(NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::TileBankReload()
|
||||
{
|
||||
|
@ -488,6 +495,12 @@ void CCore::ActiveBrushRight(CMapEditView *View)
|
|||
UpdateView(View);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
BOOL CCore::IsTileValid(int Set,int Tile)
|
||||
{
|
||||
return(TileBank.IsTileValid(Set,Tile));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Misc ********************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -602,13 +615,13 @@ void CCore::ExportAGB(char *Filename)
|
|||
int LayerCount=Layer.size();
|
||||
char ExportName[256];
|
||||
|
||||
SetFileExt(Filename,ExportName,"C");
|
||||
SetFileExt(Filename,ExportName,"c");
|
||||
|
||||
CExportAGB Exp(ExportName);
|
||||
|
||||
for (int i=0;i<LayerCount;i++)
|
||||
{
|
||||
Layer[i]->Export(Exp);
|
||||
Layer[i]->Export(this,Exp);
|
||||
}
|
||||
Exp.ExportAll(this);
|
||||
}
|
||||
|
|
|
@ -52,12 +52,16 @@ public:
|
|||
CTileBank &GetTileBank() {return(TileBank);}
|
||||
CTile &GetTile(int Bank,int TileNo) {return(TileBank.GetTile(Bank,TileNo));}
|
||||
void TileBankLoad(char *Filename);
|
||||
void TileBankDelete();
|
||||
void TileBankReload();
|
||||
void TileBankSet();
|
||||
void MirrorX(CMapEditView *View);
|
||||
void MirrorY(CMapEditView *View);
|
||||
void ActiveBrushLeft(CMapEditView *View);
|
||||
void ActiveBrushRight(CMapEditView *View);
|
||||
BOOL IsTileValid(int Set,int Tile);
|
||||
|
||||
|
||||
// Param Bar
|
||||
void UpdateParamBar();
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void CExport::ExportAll(CCore *Core)
|
|||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CExport::ExportLayerTile(char *LayerName,CMap &Map)
|
||||
void CExport::ExportLayerTile(CCore *Core,char *LayerName,CMap &Map)
|
||||
{
|
||||
int MapWidth=Map.GetWidth();
|
||||
int MapHeight=Map.GetHeight();
|
||||
|
@ -55,7 +55,7 @@ sMapElem BlankElem={0,0,0};
|
|||
if (X<MapWidth && Y<MapHeight)
|
||||
{
|
||||
sMapElem &ThisElem=Map.Get(X,Y);
|
||||
int Idx=AddTileToList(ThisElem);
|
||||
int Idx=AddTileToList(Core,ThisElem);
|
||||
ExportLayerTile(ThisElem,Idx);
|
||||
}
|
||||
else
|
||||
|
@ -97,9 +97,22 @@ int ListSize=UsedTileList.size();
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int CExport::AddTileToList(sMapElem &Tile)
|
||||
int CExport::AddTileToList(CCore *Core,sMapElem &Tile)
|
||||
{
|
||||
int Idx=FindTileInList(Tile);
|
||||
int Idx;
|
||||
if (!IsTileValidExport(Core,Tile))
|
||||
{
|
||||
sMapElem Blank;
|
||||
Blank.Set=0;
|
||||
Blank.Tile=0;
|
||||
Blank.Flags=0;
|
||||
Idx=FindTileInList(Blank);
|
||||
}
|
||||
else
|
||||
{
|
||||
Idx=FindTileInList(Tile);
|
||||
}
|
||||
|
||||
|
||||
if (Idx==-1)
|
||||
{ // New tile!!
|
||||
|
|
|
@ -24,14 +24,14 @@ public:
|
|||
CExport(char *Filename);
|
||||
~CExport();
|
||||
|
||||
void ExportLayerTile(char *LayerName,CMap &Map);
|
||||
void ExportLayerTile(CCore *Core,char *LayerName,CMap &Map);
|
||||
void ExportAll(CCore *Core);
|
||||
|
||||
void PrintTileList();
|
||||
|
||||
protected:
|
||||
int FindTileInList(sMapElem &Tile);
|
||||
int AddTileToList(sMapElem &Tile);
|
||||
int AddTileToList(CCore *Core,sMapElem &Tile);
|
||||
|
||||
void ExportTiles(CCore *Core);
|
||||
void ExportPalette(CCore *Core);
|
||||
|
@ -41,6 +41,7 @@ virtual void ExportLayerTile(sMapElem &Elem,int NewIdx)=0;
|
|||
virtual void ExportLayerTileEnd(char *LayerName)=0;
|
||||
virtual int GetMinLayerTileWidth()=0;
|
||||
virtual int GetMinLayerTileHeight()=0;
|
||||
virtual BOOL IsTileValidExport(CCore *Core,sMapElem &Tile)=0;
|
||||
|
||||
virtual void ExportTileStart(int TileCount)=0;
|
||||
virtual void ParseTile(CTile &ThisTile)=0;
|
||||
|
|
|
@ -57,7 +57,7 @@ virtual void Resize(int Width,int Height)=0;
|
|||
virtual void Load(CFile *File,float Version)=0;
|
||||
virtual void Save(CFile *File)=0;
|
||||
|
||||
virtual void Export(CExport &Exp)=0;
|
||||
virtual void Export(CCore *Core,CExport &Exp)=0;
|
||||
|
||||
// Functions
|
||||
virtual BOOL SetMode(int NewMode)=0;
|
||||
|
|
|
@ -178,7 +178,7 @@ int Height=ThisMap.GetHeight();
|
|||
for (int XLoop=0; XLoop<Width; XLoop++)
|
||||
{
|
||||
sMapElem &ThisElem=ThisMap.Get(XLoop,YLoop);
|
||||
if (ThisElem.Tile)
|
||||
if (ThisElem.Tile && Core->IsTileValid(ThisElem.Set,ThisElem.Tile))
|
||||
{ // Render Non Zero Tiles
|
||||
CTile &ThisTile=Core->GetTile(ThisElem.Set,ThisElem.Tile);
|
||||
|
||||
|
@ -488,7 +488,7 @@ BOOL CLayerTile::Paint(CMap &Blk,CPoint &CursorPos)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayerTile::Export(CExport &Exp)
|
||||
void CLayerTile::Export(CCore *Core,CExport &Exp)
|
||||
{
|
||||
Exp.ExportLayerTile(GetName(),Map);
|
||||
Exp.ExportLayerTile(Core,GetName(),Map);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
void Load(CFile *File,float Version);
|
||||
void Save(CFile *File);
|
||||
|
||||
void Export(CExport &Exp);
|
||||
void Export(CCore *Core,CExport &Exp);
|
||||
|
||||
// Functions
|
||||
BOOL SetMode(int NewMode);
|
||||
|
|
|
@ -128,11 +128,14 @@ sMapElem &CMap::Get(int X,int Y)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CMap::Set(int X,int Y,sMapElem &Blk)
|
||||
void CMap::Set(int X,int Y,sMapElem &Blk,BOOL Force)
|
||||
{
|
||||
int Width=GetWidth();
|
||||
int Height=GetHeight();
|
||||
|
||||
if (!Force) // if bank or tile invalid
|
||||
if (Blk.Set==-1 || Blk.Tile==-1) return;
|
||||
|
||||
// Make sure within map
|
||||
if ((X>=0 && X<Width) && (Y>=0 && Y<Height))
|
||||
{
|
||||
|
@ -145,7 +148,7 @@ int Height=GetHeight();
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CMap::Set(int StartX,int StartY,CMap &Blk)
|
||||
void CMap::Set(int StartX,int StartY,CMap &Blk,BOOL Force)
|
||||
{
|
||||
int Width=Blk.GetWidth();
|
||||
int Height=Blk.GetHeight();
|
||||
|
@ -154,13 +157,13 @@ int Height=Blk.GetHeight();
|
|||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
Set(StartX+X,StartY+Y,Blk.Get(X,Y));
|
||||
Set(StartX+X,StartY+Y,Blk.Get(X,Y),Force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CMap::Set(CMap &Src,int StartX,int StartY,int Width,int Height)
|
||||
void CMap::Set(CMap &Src,int StartX,int StartY,int Width,int Height,BOOL Force)
|
||||
{
|
||||
Delete();
|
||||
SetSize(Width,Height);
|
||||
|
@ -169,7 +172,7 @@ void CMap::Set(CMap &Src,int StartX,int StartY,int Width,int Height)
|
|||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
Set(X,Y,Src.Get(StartX+X,StartY+Y));
|
||||
Set(X,Y,Src.Get(StartX+X,StartY+Y),Force);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,3 +256,44 @@ int MinH=min(Height,OldHeight);
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CMap::DeleteSet(int Set)
|
||||
{
|
||||
int Width=GetWidth();
|
||||
int Height=GetHeight();
|
||||
|
||||
for (int Y=0; Y<Height; Y++)
|
||||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
sMapElem &ThisElem=Get(X,Y);
|
||||
if (ThisElem.Set==Set)
|
||||
{
|
||||
ThisElem.Set=0;
|
||||
ThisElem.Tile=0;
|
||||
ThisElem.Flags=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CMap::RemapSet(int Old,int New)
|
||||
{
|
||||
int Width=GetWidth();
|
||||
int Height=GetHeight();
|
||||
|
||||
for (int Y=0; Y<Height; Y++)
|
||||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
sMapElem &ThisElem=Get(X,Y);
|
||||
if (ThisElem.Set==Old)
|
||||
{
|
||||
ThisElem.Set=New;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -40,9 +40,9 @@ public:
|
|||
void MirrorY(int Flag);
|
||||
|
||||
sMapElem &Get(int X,int Y);
|
||||
void Set(int X,int Y,sMapElem &Blk);
|
||||
void Set(int X,int Y,CMap &Blk);
|
||||
void Set(CMap &Src,int StartX,int StartY,int Width,int Height);
|
||||
void Set(int X,int Y,sMapElem &Blk,BOOL Force=FALSE);
|
||||
void Set(int X,int Y,CMap &Blk,BOOL Force=FALSE);
|
||||
void Set(CMap &Src,int StartX,int StartY,int Width,int Height,BOOL Force=FALSE);
|
||||
|
||||
void Resize(int Width,int Height);
|
||||
|
||||
|
@ -51,6 +51,9 @@ public:
|
|||
void Load(CFile *File,float Version);
|
||||
void Save(CFile *File);
|
||||
|
||||
void DeleteSet(int Set);
|
||||
void RemapSet(int Old,int New);
|
||||
|
||||
|
||||
inline void operator=(CMap &Src)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[General Info]
|
||||
Version=1
|
||||
LastClass=CNewMapGUI
|
||||
LastClass=CLayerTileGUI
|
||||
LastTemplate=CDialog
|
||||
NewFileInclude1=#include "stdafx.h"
|
||||
NewFileInclude2=#include "mapedit.h"
|
||||
|
@ -18,21 +18,21 @@ Class6=CMapEditDoc
|
|||
Class7=CMapEditView
|
||||
|
||||
ResourceCount=11
|
||||
Resource1=IDD_LAYER_LIST_DIALOG
|
||||
Resource2=IDD_MAPSIZE
|
||||
Resource3=IDR_MAINFRAME (English (U.S.))
|
||||
Resource1=IDD_ABOUTBOX (English (U.S.))
|
||||
Resource2=IDR_MAINFRAME (English (U.S.))
|
||||
Resource3=IDD_LAYER_LIST_DIALOG
|
||||
Resource4=IDD_DIALOGBAR (English (U.S.))
|
||||
Resource5=IDD_LAYERTILE_GUI
|
||||
Resource5=IDD_MAPSIZE
|
||||
Class8=CMultiBar
|
||||
Resource6=IDD_ABOUTBOX (English (U.S.))
|
||||
Resource6=IDR_TOOLBAR (English (U.S.))
|
||||
Resource7=IDR_MAPEDITYPE (English (U.S.))
|
||||
Class9=CLayerList
|
||||
Class10=CMapSizeDlg
|
||||
Resource8=IDD_NEW_LAYER
|
||||
Resource8=IDD_LAYERTILE_GUI
|
||||
Class11=CGfxToolBar
|
||||
Class12=CLayerTileGUI
|
||||
Resource9=IDR_TOOLBAR (English (U.S.))
|
||||
Resource10=IDD_MULTIBAR (English (U.S.))
|
||||
Resource9=IDD_MULTIBAR (English (U.S.))
|
||||
Resource10=IDD_NEW_LAYER
|
||||
Class13=CNewMapGUI
|
||||
Resource11=IDD_NEWMAP
|
||||
|
||||
|
@ -251,12 +251,13 @@ VirtualFilter=dWC
|
|||
[DLG:IDD_LAYERTILE_GUI]
|
||||
Type=1
|
||||
Class=CLayerTileGUI
|
||||
ControlCount=5
|
||||
ControlCount=6
|
||||
Control1=IDD_LAYERTILE_LIST,combobox,1342242819
|
||||
Control2=IDD_LAYERTILE_BTN_UPDATE,button,1342242816
|
||||
Control3=IDD_LAYERTILE_BTN_LOAD,button,1342242816
|
||||
Control4=IDD_LAYERTILE_BTN_PAINT,button,1342177344
|
||||
Control5=IDD_LAYERTILE_BTN_SELECT,button,1476395072
|
||||
Control6=IDD_LAYERTILE_BTN_DELETE,button,1476460544
|
||||
|
||||
[CLS:CLayerTileGUI]
|
||||
Type=0
|
||||
|
@ -265,7 +266,7 @@ ImplementationFile=LayerTileGUI.cpp
|
|||
BaseClass=CDialog
|
||||
Filter=D
|
||||
VirtualFilter=dWC
|
||||
LastObject=IDD_LAYERTILE_LIST
|
||||
LastObject=IDD_LAYERTILE_BTN_DELETE
|
||||
|
||||
[DLG:IDD_NEW_LAYER]
|
||||
Type=1
|
||||
|
|
|
@ -465,12 +465,14 @@ FONT 8, "MS Sans Serif"
|
|||
BEGIN
|
||||
COMBOBOX IDD_LAYERTILE_LIST,7,7,138,322,CBS_DROPDOWNLIST |
|
||||
WS_TABSTOP
|
||||
PUSHBUTTON "Update",IDD_LAYERTILE_BTN_UPDATE,80,25,65,15
|
||||
PUSHBUTTON "Load",IDD_LAYERTILE_BTN_LOAD,5,25,70,15
|
||||
PUSHBUTTON "Update",IDD_LAYERTILE_BTN_UPDATE,95,25,50,15
|
||||
PUSHBUTTON "Load",IDD_LAYERTILE_BTN_LOAD,5,25,45,15
|
||||
PUSHBUTTON "P",IDD_LAYERTILE_BTN_PAINT,5,45,15,15,BS_ICON | NOT
|
||||
WS_TABSTOP
|
||||
PUSHBUTTON "S",IDD_LAYERTILE_BTN_SELECT,20,45,15,15,BS_ICON |
|
||||
WS_DISABLED | NOT WS_TABSTOP
|
||||
PUSHBUTTON "Delete",IDD_LAYERTILE_BTN_DELETE,50,25,45,15,
|
||||
WS_DISABLED
|
||||
END
|
||||
|
||||
IDD_MAPSIZE DIALOG DISCARDABLE 0, 0, 127, 61
|
||||
|
|
|
@ -233,6 +233,14 @@ char Filename[256];
|
|||
FocusView();
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
void CMapEditDoc::TileBankDelete()
|
||||
{
|
||||
Core.TileBankDelete();
|
||||
UpdateAllViews(NULL);
|
||||
FocusView();
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
void CMapEditDoc::TileBankReload()
|
||||
{
|
||||
|
@ -240,7 +248,6 @@ void CMapEditDoc::TileBankReload()
|
|||
UpdateAllViews(NULL);
|
||||
FocusView();
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
void CMapEditDoc::TileBankSet()
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
void Toggle2d3d(CMapEditView *View);
|
||||
|
||||
void TileBankLoad();
|
||||
void TileBankDelete();
|
||||
void TileBankReload();
|
||||
void TileBankSet();
|
||||
|
||||
|
|
|
@ -100,8 +100,26 @@ void CTileBank::AddTileSet(char *Filename)
|
|||
{
|
||||
int ListSize=TileSet.size();
|
||||
|
||||
TileSet.push_back(CTileSet(Filename,ListSize));
|
||||
LoadFlag=TRUE;
|
||||
if (FindTileSet(Filename) ==-1)
|
||||
{
|
||||
TileSet.push_back(CTileSet(Filename,ListSize));
|
||||
LoadFlag=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int CTileBank::FindTileSet(char *Filename)
|
||||
{
|
||||
int ListSize=TileSet.size();
|
||||
CTileSet FindSet(Filename,ListSize);
|
||||
|
||||
for (int i=0; i<ListSize; i++)
|
||||
{
|
||||
CTileSet &ThisSet=TileSet[i];
|
||||
|
||||
if (IsStrSame(FindSet.GetName(),ThisSet.GetName(),-1)) return(i);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -118,6 +136,12 @@ int ListSize=TileSet.size();
|
|||
LoadFlag=FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CTileBank::Delete()
|
||||
{
|
||||
// List.erase(List.begin()+CurrentSet);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CTileBank::Reload()
|
||||
{
|
||||
|
@ -135,6 +159,7 @@ int ListSize=TileSet.size();
|
|||
/*****************************************************************************/
|
||||
CTile &CTileBank::GetTile(int Bank,int Tile)
|
||||
{
|
||||
ASSERT(Bank>=0 && Tile>=0);
|
||||
return(TileSet[Bank].GetTile(Tile));
|
||||
}
|
||||
|
||||
|
@ -252,7 +277,11 @@ int MaxTile=TileSet[CurrentSet].GetTileCount();
|
|||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
ThisElem.Tile=SelStart+X+(Y*BW);
|
||||
ThisBrush.Set(X,Y,ThisElem);
|
||||
if (!IsTileValid(CurrentSet,ThisElem.Tile))
|
||||
{
|
||||
ThisElem.Tile=-1;
|
||||
}
|
||||
ThisBrush.Set(X,Y,ThisElem,TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,6 +295,22 @@ BOOL CTileBank::SelectCancel()
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
BOOL CTileBank::IsTileValid(int Set,int Tile)
|
||||
{
|
||||
if (Set==-1 || Tile==-1) return(FALSE);
|
||||
|
||||
return(TileSet[Set].IsTileValid(Tile));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
BOOL CTileBank::IsTileValidGB(int Set,int Tile)
|
||||
{
|
||||
if (Set==-1 || Tile==-1) return(FALSE);
|
||||
|
||||
return(TileSet[Set].IsTileValidGB(Tile));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*** TileSet *****************************************************************/
|
||||
|
@ -331,15 +376,11 @@ u8 Buffer[16*16*3];
|
|||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
BOOL Data=Create16x16Tile(ThisBmp,Buffer,X,(Height-1)-Y);
|
||||
// if (Data)
|
||||
{ // Not Blank
|
||||
char Name[256];
|
||||
sprintf(Name,"_2d_%s%i",GetName(),X+(Y*Width));
|
||||
int TexID=TexCache.ProcessTexture(Name,GetPath(),0,&NewTex);
|
||||
Tile.push_back(CTile(Core,this,TexID));
|
||||
}
|
||||
|
||||
char Name[256];
|
||||
Create16x16Tile(ThisBmp,Buffer,X,(Height-1)-Y);
|
||||
sprintf(Name,"_2d_%s_%i_%i",GetName(),SetNumber,X+(Y*Width));
|
||||
int TexID=TexCache.ProcessTexture(Name,GetPath(),0,&NewTex);
|
||||
Tile.push_back(CTile(Core,this,TexID));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,6 +449,15 @@ int ListSize=Tile.size();
|
|||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
CPoint CTileSet::GetTilePos(int ID)
|
||||
{
|
||||
if (ID==0)
|
||||
return(CPoint(-1,-1));
|
||||
else
|
||||
return(IDToPoint(ID-1,TileBrowserWidth));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CTileSet::Render(Vec &CamPos,CMap &LBrush,CMap &RBrush,BOOL Render3d)
|
||||
{
|
||||
|
@ -415,6 +465,7 @@ int ListSize=Tile.size();
|
|||
int TileID=0;
|
||||
sMapElem ThisElem;
|
||||
int SelFlag;
|
||||
BOOL ValidTile=TRUE;
|
||||
|
||||
ThisElem.Flags=0;
|
||||
ThisElem.Set=SetNumber;
|
||||
|
@ -423,19 +474,25 @@ int SelFlag;
|
|||
|
||||
while(TileID!=ListSize)
|
||||
{
|
||||
CPoint Pos;//=IDToPoint(TileID,TileBrowserWidth);
|
||||
CPoint Pos=GetTilePos(TileID);
|
||||
|
||||
if (TileID==0)
|
||||
Pos=CPoint(-1,-1);
|
||||
else
|
||||
Pos=IDToPoint(TileID-1,TileBrowserWidth);
|
||||
// if (TileID==0)
|
||||
// Pos=CPoint(-1,-1);
|
||||
// else
|
||||
// Pos=IDToPoint(TileID-1,TileBrowserWidth);
|
||||
|
||||
|
||||
glLoadIdentity();
|
||||
glTranslatef(CamPos.x+Pos.x*(1+TileBrowserGap),CamPos.y-Pos.y*(1+TileBrowserGap),CamPos.z);
|
||||
|
||||
glColor3f(0.5,0.5,0.5);
|
||||
if (TileID) Tile[TileID].Render(0,Render3d);
|
||||
ValidTile=IsTileValid(TileID);
|
||||
if (TileID && ValidTile)
|
||||
{
|
||||
glColor3f(0.5,0.5,0.5);
|
||||
Tile[TileID].Render(0,Render3d);
|
||||
}
|
||||
|
||||
// Selection
|
||||
ThisElem.Tile=TileID;
|
||||
SelFlag=0;
|
||||
|
||||
|
@ -467,10 +524,30 @@ int SelFlag;
|
|||
break;
|
||||
}
|
||||
|
||||
glEnd();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
// Invalid tile?
|
||||
if (!ValidTile)
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glBegin(GL_LINES);
|
||||
#ifdef UseLighting
|
||||
glNormal3f( 1,1,1);
|
||||
#endif
|
||||
glColor3ub(255,255,255);
|
||||
|
||||
glVertex3f( TileBrowserX0,TileBrowserY0,0);
|
||||
glVertex3f( TileBrowserX1,TileBrowserY1,0);
|
||||
|
||||
glVertex3f( TileBrowserX1,TileBrowserY0,0);
|
||||
glVertex3f( TileBrowserX0,TileBrowserY1,0);
|
||||
|
||||
glEnd();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
TileID++;
|
||||
}
|
||||
|
||||
|
@ -487,14 +564,15 @@ int MaxTile=Tile.size();
|
|||
|
||||
if (SelStart==-1)
|
||||
{
|
||||
if (CursorPos==0)
|
||||
{
|
||||
Start=CPoint(-1,-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Start=IDToPoint(CursorPos-1,TileBrowserWidth);
|
||||
}
|
||||
// if (CursorPos==0)
|
||||
// {
|
||||
// Start=CPoint(-1,-1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Start=IDToPoint(CursorPos-1,TileBrowserWidth);
|
||||
// }
|
||||
Start=GetTilePos(CursorPos);
|
||||
End=Start;
|
||||
}
|
||||
else
|
||||
|
@ -543,12 +621,12 @@ int TileID=0;
|
|||
|
||||
while(TileID!=ListSize)
|
||||
{
|
||||
CPoint Pos;//=IDToPoint(TileID,TileBrowserWidth);
|
||||
CPoint Pos=GetTilePos(TileID);
|
||||
|
||||
if (TileID==0)
|
||||
Pos=CPoint(-1,-1);
|
||||
else
|
||||
Pos=IDToPoint(TileID-1,TileBrowserWidth);
|
||||
// if (TileID==0)
|
||||
// Pos=CPoint(-1,-1);
|
||||
// else
|
||||
// Pos=IDToPoint(TileID-1,TileBrowserWidth);
|
||||
|
||||
glLoadIdentity();
|
||||
glTranslatef(CamPos.x+Pos.x*(1+TileBrowserGap),CamPos.y-Pos.y*(1+TileBrowserGap),CamPos.z);
|
||||
|
@ -604,12 +682,12 @@ int TileID=0;
|
|||
|
||||
while(TileID!=ListSize)
|
||||
{
|
||||
CPoint Pos;//=IDToPoint(TileID,TileBrowserWidth);
|
||||
CPoint Pos=GetTilePos(TileID);
|
||||
|
||||
if (TileID==0)
|
||||
Pos=CPoint(-1,-1);
|
||||
else
|
||||
Pos=IDToPoint(TileID-1,TileBrowserWidth);
|
||||
// if (TileID==0)
|
||||
// Pos=CPoint(-1,-1);
|
||||
// else
|
||||
// Pos=IDToPoint(TileID-1,TileBrowserWidth);
|
||||
|
||||
glLoadIdentity();
|
||||
glTranslatef(CamPos.x+Pos.x*(1+TileBrowserGap),CamPos.y-Pos.y*(1+TileBrowserGap),CamPos.z);
|
||||
|
|
|
@ -26,6 +26,7 @@ class CCore;
|
|||
class CTile;
|
||||
|
||||
/*****************************************************************************/
|
||||
class CTileSet;
|
||||
class CTileBank
|
||||
{
|
||||
public:
|
||||
|
@ -39,8 +40,10 @@ public:
|
|||
MaxBrush
|
||||
};
|
||||
|
||||
int FindTileSet(char *Filename);
|
||||
void AddTileSet(char *Filename);
|
||||
int NeedLoad() {return(LoadFlag);}
|
||||
void Delete();
|
||||
void Reload();
|
||||
void LoadTileSets(CCore *Core);
|
||||
CTile &GetTile(int Bank,int Tile);
|
||||
|
@ -58,6 +61,9 @@ public:
|
|||
|
||||
void UpdateGUI(CCore *Core,BOOL IsTileView);
|
||||
|
||||
BOOL IsTileValid(int Set,int Tile);
|
||||
BOOL IsTileValidGB(int Set,int Tile);
|
||||
|
||||
// Functions
|
||||
BOOL SelectL(BOOL DownFlag) {return(Select(LBrush,DownFlag));}
|
||||
BOOL SelectR(BOOL DownFlag) {return(Select(RBrush,DownFlag));}
|
||||
|
@ -110,8 +116,13 @@ public:
|
|||
void RenderBrush(Vec &CamPos,CMap &LBrush,CMap &RBrush);
|
||||
void RenderGrid(Vec &CamPos);
|
||||
int GetTileBrowserWidth() {return(TileBrowserWidth);}
|
||||
BOOL IsTileValid(int No) {return(Tile[No].IsValid());}
|
||||
BOOL IsTileValidGB(int No) {return(Tile[No].IsValidGB());}
|
||||
|
||||
|
||||
private:
|
||||
BOOL Create16x16Tile(sRGBData &Src,u8 *Dst,int XOfs,int YOfs);
|
||||
CPoint GetTilePos(int ID);
|
||||
|
||||
char Drive[_MAX_DRIVE],Path[_MAX_DIR],Name[_MAX_FNAME],Ext[_MAX_EXT];
|
||||
int SetNumber;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define IDD_LAYERTILE_LIST 1030
|
||||
#define IDD_LAYERTILE_BTN_LOAD 1031
|
||||
#define IDD_LAYERTILE_BTN_SELECT 1032
|
||||
#define IDD_LAYERTILE_BTN_DELETE 1033
|
||||
#define IDD_LAYERTILE_BTN_PAINT 1034
|
||||
#define IDC_MAPSIZE_WIDTH 1037
|
||||
#define IDC_MAPSIZE_WIDTH_TEXT 1038
|
||||
|
|
|
@ -120,10 +120,9 @@ void BuildGLBoxNoNormals(float XMin,float XMax,float YMin,float YMax,float ZMin,
|
|||
/**************************************************************************************/
|
||||
void BuildGLQuad(float XMin,float XMax,float YMin,float YMax,float Z)
|
||||
{
|
||||
// Front Face
|
||||
//#ifdef UseLighting
|
||||
#ifdef UseLighting
|
||||
glNormal3f( 0.0f, 0.0f, 1.0f);
|
||||
//#endif
|
||||
#endif
|
||||
glVertex3f( XMin, YMin, Z);
|
||||
glVertex3f( XMax, YMin, Z);
|
||||
glVertex3f( XMax, YMax, Z);
|
||||
|
|
|
@ -46,11 +46,6 @@ TVECTOR TCrossProduct(TVECTOR const &V0,TVECTOR const &V1,const TVECTOR &V2 );
|
|||
CPoint IDToPoint(int ID,int Width);
|
||||
int PointToID(CPoint &Pnt,int Width);
|
||||
|
||||
//AUX_RGBImageRec *LoadBMP(char *Filename);
|
||||
//void FreeBMP(AUX_RGBImageRec *TextureImage);
|
||||
|
||||
|
||||
//void SaveTGA(char *Filename,int SX,int SY,int SW,int SH);
|
||||
void SaveTGA(char *Filename,int W,int H,u8 *Data);
|
||||
void SaveBmp(char *Filename,int Width,int Height,RGBQUAD *Pal,u8 *Image);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue