This commit is contained in:
Daveo 2001-02-10 20:21:20 +00:00
parent 2702a1bfc4
commit e95a2bec41
8 changed files with 70 additions and 67 deletions

View File

@ -39,7 +39,9 @@ public:
void RenderTileView(CMapEditView *View); void RenderTileView(CMapEditView *View);
void Export(char *Filename); void Export(char *Filename);
// View Stuff
void SetView(CMapEditView *View) {CurrentView=View;}
CMapEditView *GetView() {return(CurrentView);}
// Control // Control
void SetMode(int NewMode); void SetMode(int NewMode);
void LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag); void LButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag);
@ -119,6 +121,7 @@ public:
GString GetCurrentPath(); GString GetCurrentPath();
private: private:
CMapEditView *CurrentView;
CPoint CurrentMousePos,LastMousePos; CPoint CurrentMousePos,LastMousePos;
CPoint CursorPos,LastCursorPos; CPoint CursorPos,LastCursorPos;
Vector3 MapCam,TileCam; Vector3 MapCam,TileCam;

View File

@ -2,7 +2,7 @@
[General Info] [General Info]
Version=1 Version=1
LastClass=CMapEditView LastClass=CMapEditDoc
LastTemplate=CDialog LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h" NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mapedit.h" NewFileInclude2=#include "mapedit.h"
@ -20,26 +20,26 @@ Class7=CMapEditView
ResourceCount=14 ResourceCount=14
Resource1=IDD_NEW_LAYER Resource1=IDD_NEW_LAYER
Resource2=IDR_MAPEDITYPE (English (U.S.)) Resource2=IDR_MAPEDITYPE (English (U.S.))
Resource3=IDD_ADDLAYER Resource3=IDD_MAPSIZE
Resource4=IDD_DIALOGBAR (English (U.S.)) Resource4=IDD_DIALOGBAR (English (U.S.))
Resource5=IDR_MAINFRAME (English (U.S.)) Resource5=IDD_LAYERTILE_TOOLBAR
Class8=CMultiBar Class8=CMultiBar
Resource6=IDD_LAYER_LIST_DIALOG Resource6=IDD_ABOUTBOX (English (U.S.))
Resource7=IDD_MULTIBAR (English (U.S.)) Resource7=IDR_MAINFRAME (English (U.S.))
Class9=CLayerList Class9=CLayerList
Class10=CMapSizeDlg Class10=CMapSizeDlg
Resource8=IDD_NEWMAP Resource8=IDD_LAYER_LIST_DIALOG
Class11=CGfxToolBar Class11=CGfxToolBar
Class12=CLayerTileGUI Class12=CLayerTileGUI
Resource9=IDD_LAYERTILE_TOOLBAR Resource9=IDD_ADDLAYER
Resource10=IDR_TOOLBAR (English (U.S.)) Resource10=IDD_LAYERTILE_GUI
Class13=CNewMapGUI Class13=CNewMapGUI
Class14=CProgressDlg Class14=CProgressDlg
Resource11=IDD_LAYERTILE_GUI Resource11=IDD_NEWMAP
Class15=CAddLayerDlg Class15=CAddLayerDlg
Resource12=IDD_MAPSIZE Resource12=IDD_MULTIBAR (English (U.S.))
Class16=CLayerTileToolbar Class16=CLayerTileToolbar
Resource13=IDD_ABOUTBOX (English (U.S.)) Resource13=IDR_TOOLBAR (English (U.S.))
Class17=CLayerShadeGUI Class17=CLayerShadeGUI
Resource14=IDD_LAYERSHADE_GUI Resource14=IDD_LAYERSHADE_GUI
@ -93,7 +93,7 @@ Type=0
BaseClass=CGLEnabledView BaseClass=CGLEnabledView
HeaderFile=MapEditView.h HeaderFile=MapEditView.h
ImplementationFile=MapEditView.cpp ImplementationFile=MapEditView.cpp
LastObject=ID_TOGGLE_GRID LastObject=CMapEditView
Filter=C Filter=C
VirtualFilter=VWC VirtualFilter=VWC

View File

@ -88,6 +88,18 @@ void CMapEditDoc::Dump(CDumpContext& dc) const
/*********************************************************************************/ /*********************************************************************************/
/*********************************************************************************/ /*********************************************************************************/
/*********************************************************************************/ /*********************************************************************************/
/*********************************************************************************/
void CMapEditDoc::SetView(CMapEditView *View)
{
Core.SetView(View);
}
/*********************************************************************************/
CMapEditView *CMapEditDoc::GetView()
{
return(Core.GetView());
}
/*********************************************************************************/ /*********************************************************************************/
void CMapEditDoc::UpdateView(CMapEditView *View) void CMapEditDoc::UpdateView(CMapEditView *View)
{ {
@ -98,18 +110,15 @@ CView *V=(CView*)View;
/*********************************************************************************/ /*********************************************************************************/
void CMapEditDoc::Render(CMapEditView *View) void CMapEditDoc::Render(CMapEditView *View)
{ {
// if (View)
if (View)
Core.Render(View); Core.Render(View);
} }
/*********************************************************************************/ /*********************************************************************************/
void CMapEditDoc::UpdateAll(CMapEditView *View) void CMapEditDoc::UpdateAll(CMapEditView *View)
{ {
// if (View)
if (View)
Core.UpdateAll(); Core.UpdateAll();
} }
/*********************************************************************************/ /*********************************************************************************/

View File

@ -19,6 +19,8 @@ protected: // create from serialization only
// Attributes // Attributes
public: public:
void SetView(CMapEditView *View);
CMapEditView *GetView();
void UpdateView(CMapEditView *View); void UpdateView(CMapEditView *View);
void Render(CMapEditView *View); void Render(CMapEditView *View);
void UpdateAll(CMapEditView *View); void UpdateAll(CMapEditView *View);

View File

@ -168,6 +168,7 @@ void CMapEditView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* p
{ {
CMapEditDoc *CurDoc=GetDocument(); CMapEditDoc *CurDoc=GetDocument();
theApp.SetCurrent(CurDoc); theApp.SetCurrent(CurDoc);
CurDoc->SetView(this);
CurDoc->UpdateAll(this); CurDoc->UpdateAll(this);
} }
} }

View File

@ -42,7 +42,7 @@ GFName FName=Filename;
int Idx=GetTexIdx(NewTex); // Is already loaded? int Idx=GetTexIdx(NewTex); // Is already loaded?
if (Idx!=-1) return(Idx); if (Idx!=-1) return(Idx);
// TRACE1("Loading Texture %s\n",NewTex.Filename); TRACE1("Loading Texture %s\n",NewTex.Filename);
if (!LoadBMP(NewTex.Filename,ThisRGB)) if (!LoadBMP(NewTex.Filename,ThisRGB))
{ {
@ -133,6 +133,7 @@ u8 *Src,*Dst;
Buffer=(u8*)malloc(GLWidth*GLHeight*4); Buffer=(u8*)malloc(GLWidth*GLHeight*4);
Src=TexData->RGB; Src=TexData->RGB;
Dst=&Buffer[0]; Dst=&Buffer[0];
for (int Y=0; Y<TexHeight; Y++) for (int Y=0; Y<TexHeight; Y++)
{ {
for (int X=0; X<TexWidth; X++) for (int X=0; X<TexWidth; X++)

View File

@ -161,27 +161,10 @@ GString SavePath;
void CTileBank::AddTileSet(const char *Filename) void CTileBank::AddTileSet(const char *Filename)
{ {
int ListSize=TileSet.size(); int ListSize=TileSet.size();
CTileSet NewSet(Filename,ListSize);
if (FindTileSet(Filename) ==-1) TileSet.Add(NewSet);
{ if (TileSet.size()!=ListSize) LoadFlag=TRUE;
TileSet.push_back(CTileSet(Filename,ListSize));
LoadFlag=TRUE;
}
}
/*****************************************************************************/
int CTileBank::FindTileSet(const char *Filename)
{
int ListSize=TileSet.size();
CTileSet FindSet(Filename,ListSize);
for (int i=0; i<ListSize; i++)
{
CTileSet &ThisSet=TileSet[i];
if (IsStrSame((char*)FindSet.GetName(),(char*)ThisSet.GetName(),-1)) return(i);
}
return(-1);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -214,7 +197,8 @@ int ListSize=TileSet.size();
Brush[i].RemapSet(Set,Set); Brush[i].RemapSet(Set,Set);
} }
} }
TileSet.erase(TileSet.begin()+CurrentSet); // TileSet.erase(TileSet.begin()+CurrentSet);
TileSet.erase(CurrentSet);
CurrentSet=0; CurrentSet=0;
} }

View File

@ -43,7 +43,6 @@ public:
MaxBrush MaxBrush
}; };
int FindTileSet(const char *Filename);
void AddTileSet(const char *Filename); void AddTileSet(const char *Filename);
int NeedLoad() {return(LoadFlag);} int NeedLoad() {return(LoadFlag);}
void Delete(); void Delete();
@ -88,7 +87,8 @@ protected:
BOOL Select(int BrushID,BOOL DownFlag); BOOL Select(int BrushID,BOOL DownFlag);
void SetBrush(CMap &ThisBrush); void SetBrush(CMap &ThisBrush);
std::vector<CTileSet> TileSet; // std::vector<CTileSet> TileSet;
CList<CTileSet> TileSet;
int CurrentSet,LastSet; int CurrentSet,LastSet;
CMap Brush[2]; CMap Brush[2];
int ActiveBrush; int ActiveBrush;
@ -115,8 +115,8 @@ public:
void Load2d(CCore *Core); void Load2d(CCore *Core);
void Load3d(CCore *Core); void Load3d(CCore *Core);
const char *GetFilename() {return(Filename);} const char *GetFilename() {return(Filename);}
const char *GetName() {return(Name);} const char *GetName() {return(Name);}
CTile &GetTile(int No) {return(Tile[No]);} CTile &GetTile(int No) {return(Tile[No]);}
void Purge(); void Purge();
@ -128,6 +128,9 @@ public:
int GetTileBrowserWidth() {return(TileBrowserWidth);} int GetTileBrowserWidth() {return(TileBrowserWidth);}
BOOL IsTileValid(int No); BOOL IsTileValid(int No);
bool operator==(CTileSet const &v1) {return (Name==v1.Name);}
// if (IsStrSame((char*)Name,(char*)v1.Name) return(i);
private: private:
BOOL Create16x16Tile(sRGBData &Src,u8 *Dst,int XOfs,int YOfs); BOOL Create16x16Tile(sRGBData &Src,u8 *Dst,int XOfs,int YOfs);