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; Vector3 CamOfs;
CamOfs.Zero(); CamOfs.Zero();
CamOfs.x=-15; CamOfs.x=-15;
CamOfs.y=+10;
ActiveLayer=FindActionLayer(); ActiveLayer=FindActionLayer();
MapCam.Zero(); 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.x*=XS;
Ofs.y*=YS; Ofs.y*=YS;
/* if (nFlags & MK_CONTROL) if (nFlags & MK_CONTROL)
{ // Move Ofs { // Move Ofs
Vector3 &CamOfs=GetCamOfs(); Vector3 &CamOfs=GetCamOfs();
Ofs.y=-Ofs.y; Ofs.y=-Ofs.y;
@ -351,7 +358,7 @@ Vector3 &ThisCam=GetCam();
UpdateView(View); UpdateView(View);
} }
else else
*/ { {
UpdateView(View,Ofs); UpdateView(View,Ofs);
} }
} }
@ -473,8 +480,28 @@ void CCore::TileBankLoad(char *Filename)
/*****************************************************************************/ /*****************************************************************************/
void CCore::TileBankDelete() void CCore::TileBankDelete()
{ {
TileBank.Delete(); if (Question("Delete Current Tile Bank\n\nAll used tiles in current set will be set to blank\nAre you sure?"))
UpdateView(NULL); {
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"); SetFileExt(Filename,ExportName,"PME");
LayerCount=1;
CExportPSX Exp(ExportName,LayerCount); CExportPSX Exp(ExportName,LayerCount);
/* for (int i=0;i<LayerCount;i++) for (int i=0;i<LayerCount;i++)
{ {
Layer[i]->Export(this,Exp); Layer[i]->Export(this,Exp);
} }
*/
Layer[FindActionLayer()]->Export(this,Exp); // Layer[FindActionLayer()]->Export(this,Exp);
Exp.ExportTiles(this); Exp.ExportTiles(this);
Exp.ExportTexList(this); Exp.ExportTexList(this);

View File

@ -29,6 +29,7 @@ public:
BOOL New(); BOOL New();
void Load(CFile *File); void Load(CFile *File);
void Save(CFile *File); void Save(CFile *File);
bool Question(char *Txt);
void Render(CMapEditView *View,BOOL ForceRender=FALSE); void Render(CMapEditView *View,BOOL ForceRender=FALSE);
void RenderLayers(CMapEditView *View); void RenderLayers(CMapEditView *View);
void RenderTileView(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 "stdafx.h"
#include <Vector> #include <Vector>
#include <GFName.hpp>
#include "mapedit.h" #include "mapedit.h"
#include "Quantize.h" #include "Quantize.h"
@ -32,11 +33,10 @@ virtual void ExportTiles(CCore *Core)=0;
protected: protected:
char Drive[_MAX_DRIVE],Path[_MAX_DIR],Name[_MAX_FNAME],Ext[_MAX_EXT]; GFName Filename;
FILE *File; FILE *File;
int Count; 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 MirrorX(CCore *Core){return(FALSE);};
virtual BOOL MirrorY(CCore *Core){return(FALSE);}; virtual BOOL MirrorY(CCore *Core){return(FALSE);};
virtual void DeleteSet(int Set){};
virtual void RemapSet(int OrigSet,int NewSet){};
protected: protected:
BOOL Render3dFlag; BOOL Render3dFlag;
float ScaleFactor; float ScaleFactor;

View File

@ -511,3 +511,16 @@ void CLayerTile::Export(CCore *Core,CExport &Exp)
{ {
Exp.ExportLayerTile(Core,GetName(),SubType,Map); 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 MirrorX(CCore *Core);
BOOL MirrorY(CCore *Core); BOOL MirrorY(CCore *Core);
void DeleteSet(int Set);
void RemapSet(int OrigSet,int NewSet);
protected: protected:
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f); void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f);
void RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d); void RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d);

View File

@ -31,7 +31,7 @@ int Height;
{ {
sMapElem ThisElem; sMapElem ThisElem;
File->Read(&ThisElem,sizeof(sMapElem)); 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); return(Set==v1.Set && Tile==v1.Tile);
} }
}; };
enum enum
@ -63,6 +62,7 @@ public:
void RemapSet(int Old,int New); void RemapSet(int Old,int New);
inline void operator=(CMap &Src) inline void operator=(CMap &Src)
{ {
int Width=Src.GetWidth(); int Width=Src.GetWidth();

View File

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

View File

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 # 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" !ELSEIF "$(CFG)" == "MapEdit - Win32 Debug"

View File

@ -186,7 +186,7 @@ END
// Dialog // 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 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About MapEdit" CAPTION "About MapEdit"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
@ -262,9 +262,9 @@ BEGIN
IDD_ABOUTBOX, DIALOG IDD_ABOUTBOX, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 138 RIGHTMARGIN, 140
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 39 BOTTOMMARGIN, 23
END END
IDD_MULTIBAR, DIALOG IDD_MULTIBAR, DIALOG
@ -471,8 +471,7 @@ BEGIN
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, 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

View File

@ -116,6 +116,17 @@ CString XYStr;
pCmdUI->SetText(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 ****************************************************/ /*** Windows Message Handlers ****************************************************/

View File

@ -23,6 +23,7 @@ public:
void Render(CMapEditView *View); void Render(CMapEditView *View);
void UpdateAll(CMapEditView *View); void UpdateAll(CMapEditView *View);
void FocusView(); void FocusView();
bool Question(char *Txt);
// Windows Messages Thru Point // Windows Messages Thru Point
void LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag); 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; int ListSize;
GFName RootPath=File->GetFilePath(); GFName RootPath=File->GetFilePath();
GString FilePath=RootPath.Dir(); GString FilePath;
FilePath=RootPath.Drive();
FilePath+=RootPath.Dir();
FilePath.Append('\\'); FilePath.Append('\\');
File->Read(&ListSize,sizeof(int)); File->Read(&ListSize,sizeof(int));
File->Read(&CurrentSet,sizeof(int)); File->Read(&CurrentSet,sizeof(int));
File->Read(&ActiveBrush,sizeof(int)); File->Read(&ActiveBrush,sizeof(int));
Brush[0].Load(File,Version); Brush[0].Load(File,Version);
Brush[1].Load(File,Version); Brush[1].Load(File,Version);
if (Version<=1.00) if (Version<=1.00)
{
for (int i=0;i<ListSize;i++)
{ {
char Filename[256+64]; for (int i=0;i<ListSize;i++)
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); char Filename[256+64];
RelName[Len++]=c;
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) void CTileBank::Save(CFile *File)
{ {
int ListSize=TileSet.size(); int ListSize=TileSet.size();
GString FilePath;
GFName RootPath=File->GetFilePath(); GFName RootPath=File->GetFilePath();
GString FilePath=RootPath.Dir();
FilePath=RootPath.Drive();
FilePath+=RootPath.Dir();
FilePath.Append('\\'); FilePath.Append('\\');
File->Write(&ListSize,sizeof(int)); File->Write(&ListSize,sizeof(int));
@ -116,8 +123,6 @@ GString FilePath=RootPath.Dir();
RootPath.makerelative(FilePath,ThisSet.GetFilename(),Filename); RootPath.makerelative(FilePath,ThisSet.GetFilename(),Filename);
// sprintf(Filename,"%s",ThisSet.GetFilename());
// File->Write(Filename,256+64);
File->Write(Filename,strlen(Filename)+1); File->Write(Filename,strlen(Filename)+1);
} }
@ -167,7 +172,22 @@ int ListSize=TileSet.size();
/*****************************************************************************/ /*****************************************************************************/
void CTileBank::Delete() 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) 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)); return(TileSet[Set].IsTileValid(Tile));
} }
@ -334,7 +355,7 @@ BOOL CTileBank::IsTileValid(int Set,int Tile)
/*****************************************************************************/ /*****************************************************************************/
BOOL CTileBank::IsTileValidGB(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)); 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 CTileSet::Create16x16Tile(sRGBData &Src,u8 *Dst,int XOfs,int YOfs)
{ {
BOOL Data=FALSE; BOOL Data=FALSE;
@ -428,7 +450,7 @@ BOOL Data=FALSE;
} }
return(Data); return(Data);
} }
*/
/*****************************************************************************/ /*****************************************************************************/
void CTileSet::Load3d(CCore *Core) void CTileSet::Load3d(CCore *Core)
{ {
@ -529,17 +551,17 @@ BOOL ValidTile=TRUE;
{ {
case 1: // L case 1: // L
glColor4f(1,0,0,0.5); glColor4f(1,0,0,0.5);
BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0); BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0.01);
break; break;
case 2: // R case 2: // R
glColor4f(0,0,1,0.5); glColor4f(0,0,1,0.5);
BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0); BuildGLQuad(TileBrowserX0,TileBrowserX1,TileBrowserY0,TileBrowserY1,0.01);
break; break;
case 3: // LR case 3: // LR
glColor4f(1,0,0,0.5); 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); glColor4f(0,0,1,0.5);
BuildGLQuad(0.5,TileBrowserX1,TileBrowserY0,TileBrowserY1,0); BuildGLQuad(0.5,TileBrowserX1,TileBrowserY0,TileBrowserY1,0.01);
break; break;
} }

View File

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

View File

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