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