This commit is contained in:
Daveo 2000-12-11 21:29:59 +00:00
parent 091c8f2ada
commit e2c1ddcb20
17 changed files with 156 additions and 72 deletions

View File

@ -81,6 +81,7 @@ int Width,Height;
Vector3 CamOfs;
CamOfs.Zero();
CamOfs.x=-15;
CamOfs.y=+10;
ActiveLayer=FindActionLayer();
MapCam.Zero();
@ -183,6 +184,12 @@ int LayerCount=Layer.size();
}
/*****************************************************************************/
bool CCore::Question(char *Txt)
{
return(theApp.GetCurrent()->Question(Txt));
}
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
@ -343,7 +350,7 @@ Vector3 &ThisCam=GetCam();
Ofs.x*=XS;
Ofs.y*=YS;
/* if (nFlags & MK_CONTROL)
if (nFlags & MK_CONTROL)
{ // Move Ofs
Vector3 &CamOfs=GetCamOfs();
Ofs.y=-Ofs.y;
@ -351,7 +358,7 @@ Vector3 &ThisCam=GetCam();
UpdateView(View);
}
else
*/ {
{
UpdateView(View,Ofs);
}
}
@ -473,8 +480,28 @@ void CCore::TileBankLoad(char *Filename)
/*****************************************************************************/
void CCore::TileBankDelete()
{
TileBank.Delete();
UpdateView(NULL);
if (Question("Delete Current Tile Bank\n\nAll used tiles in current set will be set to blank\nAre you sure?"))
{
int SetCount=TileBank.GetSetCount();
int Current=TileBank.GetCurrent();
int i,ListSize=Layer.size();
for (i=0;i<ListSize;i++)
{
Layer[i]->DeleteSet(Current);
}
TileBank.Delete();
for (int Set=Current+1; Set<SetCount; Set++)
{
for (i=0;i<ListSize;i++)
{
Layer[i]->RemapSet(Set,Set-1);
}
}
UpdateView(NULL);
}
}
/*****************************************************************************/
@ -676,15 +703,14 @@ char ExportName[256];
SetFileExt(Filename,ExportName,"PME");
LayerCount=1;
CExportPSX Exp(ExportName,LayerCount);
/* for (int i=0;i<LayerCount;i++)
for (int i=0;i<LayerCount;i++)
{
Layer[i]->Export(this,Exp);
}
*/
Layer[FindActionLayer()]->Export(this,Exp);
// Layer[FindActionLayer()]->Export(this,Exp);
Exp.ExportTiles(this);
Exp.ExportTexList(this);

View File

@ -29,6 +29,7 @@ public:
BOOL New();
void Load(CFile *File);
void Save(CFile *File);
bool Question(char *Txt);
void Render(CMapEditView *View,BOOL ForceRender=FALSE);
void RenderLayers(CMapEditView *View);
void RenderTileView(CMapEditView *View);

View File

@ -15,9 +15,9 @@
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
CExport::CExport(char *Filename)
CExport::CExport(char *_Filename)
{
_splitpath(Filename,Drive,Path,Name,Ext);
Filename=_Filename;
}
/*****************************************************************************/

View File

@ -7,6 +7,7 @@
#include "stdafx.h"
#include <Vector>
#include <GFName.hpp>
#include "mapedit.h"
#include "Quantize.h"
@ -32,11 +33,10 @@ virtual void ExportTiles(CCore *Core)=0;
protected:
char Drive[_MAX_DRIVE],Path[_MAX_DIR],Name[_MAX_FNAME],Ext[_MAX_EXT];
GFName Filename;
FILE *File;
int Count;
CList<sMapElem> UsedTileList;
};

View File

@ -71,6 +71,10 @@ virtual BOOL MouseMove(CCore *Core,CMapEditView *View,UINT nFlags, CPoint &Cur
virtual BOOL MirrorX(CCore *Core){return(FALSE);};
virtual BOOL MirrorY(CCore *Core){return(FALSE);};
virtual void DeleteSet(int Set){};
virtual void RemapSet(int OrigSet,int NewSet){};
protected:
BOOL Render3dFlag;
float ScaleFactor;

View File

@ -511,3 +511,16 @@ void CLayerTile::Export(CCore *Core,CExport &Exp)
{
Exp.ExportLayerTile(Core,GetName(),SubType,Map);
}
/*****************************************************************************/
void CLayerTile::DeleteSet(int Set)
{
Map.DeleteSet(Set);
}
/*****************************************************************************/
void CLayerTile::RemapSet(int OrigSet,int NewSet)
{
Map.RemapSet(OrigSet,NewSet);
}

View File

@ -66,6 +66,10 @@ public:
BOOL MirrorX(CCore *Core);
BOOL MirrorY(CCore *Core);
void DeleteSet(int Set);
void RemapSet(int OrigSet,int NewSet);
protected:
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f);
void RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d);

View File

@ -31,7 +31,7 @@ int Height;
{
sMapElem ThisElem;
File->Read(&ThisElem,sizeof(sMapElem));
Set(X,Y,ThisElem);
Set(X,Y,ThisElem,TRUE);
}
}
@ -296,5 +296,4 @@ int Height=GetHeight();
}
}
}
}

View File

@ -17,7 +17,6 @@ BOOL operator==(sMapElem const &v1) // Doesnt Check flags
{
return(Set==v1.Set && Tile==v1.Tile);
}
};
enum
@ -63,6 +62,7 @@ public:
void RemapSet(int Old,int New);
inline void operator=(CMap &Src)
{
int Width=Src.GetWidth();

View File

@ -2,7 +2,7 @@
[General Info]
Version=1
LastClass=CLayerList
LastClass=CAboutDlg
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mapedit.h"
@ -19,23 +19,23 @@ Class7=CMapEditView
ResourceCount=11
Resource1=IDD_NEW_LAYER
Resource2=IDD_LAYER_LIST_DIALOG
Resource3=IDR_MAINFRAME (English (U.S.))
Resource2=IDR_MAINFRAME (English (U.S.))
Resource3=IDD_MAPSIZE
Resource4=IDD_DIALOGBAR (English (U.S.))
Resource5=IDD_MULTIBAR (English (U.S.))
Resource5=IDR_TOOLBAR (English (U.S.))
Class8=CMultiBar
Resource6=IDD_LAYERTILE_GUI
Resource6=IDD_LAYER_LIST_DIALOG
Resource7=IDR_MAPEDITYPE (English (U.S.))
Class9=CLayerList
Class10=CMapSizeDlg
Resource8=IDD_ABOUTBOX (English (U.S.))
Class11=CGfxToolBar
Class12=CLayerTileGUI
Resource9=IDD_NEWMAP
Resource10=IDD_MAPSIZE
Resource9=IDD_LAYERTILE_GUI
Resource10=IDD_MULTIBAR (English (U.S.))
Class13=CNewMapGUI
Class14=CProgressDlg
Resource11=IDR_TOOLBAR (English (U.S.))
Resource11=IDD_NEWMAP
[CLS:CChildFrame]
Type=0
@ -68,7 +68,9 @@ Type=0
BaseClass=CDialog
HeaderFile=MapEdit.cpp
ImplementationFile=MapEdit.cpp
LastObject=CAboutDlg
LastObject=IDC_VERSION_LIST
Filter=D
VirtualFilter=dWC
[CLS:CMapEditDoc]
Type=0
@ -258,7 +260,7 @@ 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
Control6=IDD_LAYERTILE_BTN_DELETE,button,1342242816
[CLS:CLayerTileGUI]
Type=0

View File

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 opengl32.lib glu32.lib glib.lib ginlib.lib glaux.lib maths.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\libs\ginlib\release\\" /libpath:"..\libs\glib\release\\" /libpath:"..\libs\maths\release\\"
# ADD LINK32 opengl32.lib glu32.lib glib.lib ginlib.lib glaux.lib maths.lib /nologo /subsystem:windows /machine:I386 /out:"..\..\tools\MapEdit.exe" /libpath:"..\libs\ginlib\release\\" /libpath:"..\libs\glib\release\\" /libpath:"..\libs\maths\release\\"
!ELSEIF "$(CFG)" == "MapEdit - Win32 Debug"

View File

@ -186,7 +186,7 @@ END
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 145, 46
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 147, 30
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About MapEdit"
FONT 8, "MS Sans Serif"
@ -262,9 +262,9 @@ BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 138
RIGHTMARGIN, 140
TOPMARGIN, 7
BOTTOMMARGIN, 39
BOTTOMMARGIN, 23
END
IDD_MULTIBAR, DIALOG
@ -471,8 +471,7 @@ BEGIN
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
PUSHBUTTON "Delete",IDD_LAYERTILE_BTN_DELETE,50,25,45,15
END
IDD_MAPSIZE DIALOG DISCARDABLE 0, 0, 127, 61

View File

@ -116,6 +116,17 @@ CString XYStr;
pCmdUI->SetText(XYStr);
}
/*********************************************************************************/
bool CMapEditDoc::Question(char *Txt)
{
CString Str;
Str.Format(Txt);
int Ret=AfxMessageBox(Str,MB_YESNO , MB_ICONQUESTION);
if (Ret==IDYES) return(true);
return(false);
}
/*********************************************************************************/
/*********************************************************************************/
/*** Windows Message Handlers ****************************************************/

View File

@ -23,6 +23,7 @@ public:
void Render(CMapEditView *View);
void UpdateAll(CMapEditView *View);
void FocusView();
bool Question(char *Txt);
// Windows Messages Thru Point
void LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);

View File

@ -58,49 +58,56 @@ void CTileBank::Load(CFile *File,float Version)
{
int ListSize;
GFName RootPath=File->GetFilePath();
GString FilePath=RootPath.Dir();
GString FilePath;
FilePath=RootPath.Drive();
FilePath+=RootPath.Dir();
FilePath.Append('\\');
File->Read(&ListSize,sizeof(int));
File->Read(&CurrentSet,sizeof(int));
File->Read(&ActiveBrush,sizeof(int));
Brush[0].Load(File,Version);
Brush[1].Load(File,Version);
File->Read(&ListSize,sizeof(int));
File->Read(&CurrentSet,sizeof(int));
File->Read(&ActiveBrush,sizeof(int));
Brush[0].Load(File,Version);
Brush[1].Load(File,Version);
if (Version<=1.00)
{
for (int i=0;i<ListSize;i++)
if (Version<=1.00)
{
char Filename[256+64];
File->Read(Filename,256+64);
AddTileSet(Filename);
TRACE1("%s\n",Filename);
}
}
else
{ // New Style rel storage
for (int i=0;i<ListSize;i++)
{
char c=1,RelName[256+64],FullName[256+64];
int Len=0;
while (c)
for (int i=0;i<ListSize;i++)
{
File->Read(&c,1);
RelName[Len++]=c;
char Filename[256+64];
File->Read(Filename,256+64);
AddTileSet(Filename);
TRACE1("%s\n",Filename);
}
}
else
{ // New Style rel storage
for (int i=0;i<ListSize;i++)
{
char c=1,RelName[256+64],FullName[256+64];
int Len=0;
while (c)
{
File->Read(&c,1);
RelName[Len++]=c;
}
RootPath.makeabsolute(FilePath,RelName,FullName);
AddTileSet(FullName);
}
RootPath.makeabsolute(FilePath,RelName,FullName);
AddTileSet(FullName);
}
}
}
/*****************************************************************************/
void CTileBank::Save(CFile *File)
{
int ListSize=TileSet.size();
GString FilePath;
GFName RootPath=File->GetFilePath();
GString FilePath=RootPath.Dir();
FilePath=RootPath.Drive();
FilePath+=RootPath.Dir();
FilePath.Append('\\');
File->Write(&ListSize,sizeof(int));
@ -116,8 +123,6 @@ GString FilePath=RootPath.Dir();
RootPath.makerelative(FilePath,ThisSet.GetFilename(),Filename);
// sprintf(Filename,"%s",ThisSet.GetFilename());
// File->Write(Filename,256+64);
File->Write(Filename,strlen(Filename)+1);
}
@ -167,7 +172,22 @@ int ListSize=TileSet.size();
/*****************************************************************************/
void CTileBank::Delete()
{
// List.erase(List.begin()+CurrentSet);
int ListSize=TileSet.size();
// Remap Brushes
for (int i=0; i<MaxBrush; i++)
{
Brush[i].DeleteSet(CurrentSet);
}
for (int Set=CurrentSet; Set<ListSize; Set++)
{
for (int i=0; i<MaxBrush; i++)
{
Brush[i].RemapSet(Set,Set-1);
}
}
TileSet.erase(TileSet.begin()+CurrentSet);
CurrentSet=0;
}
/*****************************************************************************/
@ -326,7 +346,8 @@ BOOL CTileBank::SelectCancel()
/*****************************************************************************/
BOOL CTileBank::IsTileValid(int Set,int Tile)
{
if (Set==-1 || Tile==-1) return(FALSE);
if (Set<0 || Tile<0) return(FALSE);
ASSERT(Set<TileSet.size());
return(TileSet[Set].IsTileValid(Tile));
}
@ -334,7 +355,7 @@ BOOL CTileBank::IsTileValid(int Set,int Tile)
/*****************************************************************************/
BOOL CTileBank::IsTileValidGB(int Set,int Tile)
{
if (Set==-1 || Tile==-1) return(FALSE);
if (Set<0 || Tile<0) return(FALSE);
return(TileSet[Set].IsTileValidGB(Tile));
}
@ -406,6 +427,7 @@ int Height=ThisTex.TexHeight/16;
}
/*****************************************************************************/
/*
BOOL CTileSet::Create16x16Tile(sRGBData &Src,u8 *Dst,int XOfs,int YOfs)
{
BOOL Data=FALSE;
@ -428,7 +450,7 @@ BOOL Data=FALSE;
}
return(Data);
}
*/
/*****************************************************************************/
void CTileSet::Load3d(CCore *Core)
{
@ -529,17 +551,17 @@ BOOL ValidTile=TRUE;
{
case 1: // L
glColor4f(1,0,0,0.5);
BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0);
BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0.01);
break;
case 2: // R
glColor4f(0,0,1,0.5);
BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0);
BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0.01);
break;
case 3: // LR
glColor4f(1,0,0,0.5);
BuildGLQuad(TileBrowserX0,0.5,TileBrowserY0,TileBrowserY1,0);
BuildGLQuad(TileBrowserX0,0.5,TileBrowserY0,TileBrowserY1,0.01);
glColor4f(0,0,1,0.5);
BuildGLQuad(0.5,TileBrowserX1,TileBrowserY0,TileBrowserY1,0);
BuildGLQuad(0.5,TileBrowserX1,TileBrowserY0,TileBrowserY1,0.01);
break;
}

View File

@ -51,6 +51,8 @@ public:
CTile &GetTile(int Bank,int Tile);
void SetCurrent(int Set) {CurrentSet=Set;}
int GetCurrent() {return(CurrentSet);}
int GetSetCount() {return(TileSet.size());}
CMap &GetLBrush() {return(Brush[LBrush]);}
CMap &GetRBrush() {return(Brush[RBrush]);}

View File

@ -41,7 +41,7 @@
#define IDC_NEWMAP_FORE_CHECK 1051
#define IDC_NEW_LAYER_WIDTH_NAME2 1052
#define IDC_NEW_LAYER_WIDTH_EDIT2 1053
#define IDC_RICHEDIT1 1054
#define IDC_VERSION_LIST 1055
#define ID_TOOLBAR_LAYERBAR 32773
#define ID_TOOLBAR_TILEPALETTE 32774
#define ID_TOOLBAR_COMBO 32777
@ -67,7 +67,7 @@
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 172
#define _APS_NEXT_COMMAND_VALUE 32797
#define _APS_NEXT_CONTROL_VALUE 1055
#define _APS_NEXT_CONTROL_VALUE 1056
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif