This commit is contained in:
parent
02694f578b
commit
09637b8863
22 changed files with 704 additions and 669 deletions
38
Utils/MapEdit/CmdMsg.h
Normal file
38
Utils/MapEdit/CmdMsg.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/********************/
|
||||||
|
/*** Cmd Messages ***/
|
||||||
|
/********************/
|
||||||
|
|
||||||
|
#ifndef __COMMAND_MESSAGES__
|
||||||
|
#define __COMMAND_MESSAGES__
|
||||||
|
|
||||||
|
enum CmdMsg
|
||||||
|
{
|
||||||
|
CmdMsg_None=0,
|
||||||
|
// Core
|
||||||
|
CmdMsg_ToggleSubView,
|
||||||
|
CmdMsg_ToggleGrid,
|
||||||
|
CmdMsg_Toggle2d,
|
||||||
|
CmdMsg_ZoomIn,
|
||||||
|
CmdMsg_ZoomOut,
|
||||||
|
CmdMsg_ResetView,
|
||||||
|
CmdMsg_SetLayer,
|
||||||
|
CmdMsg_AddLayer,
|
||||||
|
CmdMsg_DeleteLayer,
|
||||||
|
|
||||||
|
// Generic
|
||||||
|
CmdMsg_SetMode,
|
||||||
|
CmdMsg_Copy,
|
||||||
|
CmdMsg_Paste,
|
||||||
|
CmdMsg_SubViewLoad,
|
||||||
|
CmdMsg_SubViewDelete,
|
||||||
|
CmdMsg_SubViewUpdate,
|
||||||
|
CmdMsg_SubViewSet,
|
||||||
|
// TileLayer/TileBank
|
||||||
|
CmdMsg_MirrorX,
|
||||||
|
CmdMsg_MirrorY,
|
||||||
|
CmdMsg_SetColFlag,
|
||||||
|
CmdMsg_ActiveBrushLeft,
|
||||||
|
CmdMsg_ActiveBrushRight,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
/*****************************************************************************/
|
|
@ -35,7 +35,14 @@ const Vector3 DefaultCamPos(0.0f,0.0f,0.9f);
|
||||||
CCore::CCore()
|
CCore::CCore()
|
||||||
{
|
{
|
||||||
CurrentMousePos=CPoint(0,0);
|
CurrentMousePos=CPoint(0,0);
|
||||||
|
MapCam=DefaultCamPos;
|
||||||
|
TileCam=DefaultCamPos;
|
||||||
|
SpareFlag=false;
|
||||||
|
GridFlag=true;
|
||||||
|
Is3dFlag=true;
|
||||||
CurrentView=NULL;
|
CurrentView=NULL;
|
||||||
|
CursorPos.x=CursorPos.y=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -46,7 +53,7 @@ int ListSize=Layer.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CCore::New()
|
bool CCore::New()
|
||||||
{
|
{
|
||||||
CNewMapGUI Dlg;
|
CNewMapGUI Dlg;
|
||||||
int Width,Height;
|
int Width,Height;
|
||||||
|
@ -61,21 +68,24 @@ int Width,Height;
|
||||||
|
|
||||||
// Create Tile Layers
|
// Create Tile Layers
|
||||||
AddLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION, Width, Height);
|
AddLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION, Width, Height);
|
||||||
AddLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_SCRATCH, Width, Height);
|
// AddLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_SCRATCH, Width, Height);
|
||||||
|
|
||||||
|
for (int i=0; i<Layer.size(); i++)
|
||||||
|
{
|
||||||
|
Layer[i]->InitSubView(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ActiveLayer=FindLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION);
|
ActiveLayer=FindLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION);
|
||||||
MapCam=DefaultCamPos;
|
CurrentLayer=Layer[ActiveLayer];
|
||||||
TileCam=DefaultCamPos;
|
|
||||||
TileViewFlag=FALSE;
|
|
||||||
GridFlag=TRUE;
|
|
||||||
Is3dFlag=TRUE;
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::Load(CFile *File)
|
void CCore::Load(CFile *File)
|
||||||
{
|
{
|
||||||
int Version;
|
int Version,i;
|
||||||
|
BOOL F;
|
||||||
|
|
||||||
File->Read(&Version,sizeof(int));
|
File->Read(&Version,sizeof(int));
|
||||||
if (Version>100000) Version=1; // Check fix for changing version to int from float
|
if (Version>100000) Version=1; // Check fix for changing version to int from float
|
||||||
|
@ -95,16 +105,16 @@ int Version;
|
||||||
File->Read(&TileCam,sizeof(Vector3));
|
File->Read(&TileCam,sizeof(Vector3));
|
||||||
File->Read(&TileCamOfs,sizeof(Vector3));
|
File->Read(&TileCamOfs,sizeof(Vector3));
|
||||||
|
|
||||||
File->Read(&TileViewFlag,sizeof(BOOL));
|
File->Read(&F,sizeof(BOOL)); SpareFlag=F!=0;
|
||||||
File->Read(&GridFlag,sizeof(BOOL));
|
File->Read(&F,sizeof(BOOL)); GridFlag=F!=0;
|
||||||
File->Read(&Is3dFlag,sizeof(BOOL));
|
File->Read(&F,sizeof(BOOL)); Is3dFlag=F!=0;
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
int LayerCount;
|
int LayerCount;
|
||||||
File->Read(&LayerCount,sizeof(int));
|
File->Read(&LayerCount,sizeof(int));
|
||||||
File->Read(&ActiveLayer,sizeof(int));
|
File->Read(&ActiveLayer,sizeof(int));
|
||||||
|
|
||||||
for (int i=0;i<LayerCount;i++)
|
for (i=0;i<LayerCount;i++)
|
||||||
{
|
{
|
||||||
int Type;
|
int Type;
|
||||||
|
|
||||||
|
@ -124,8 +134,14 @@ int LayerCount;
|
||||||
ASSERT(!"poos");
|
ASSERT(!"poos");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TileBank.Load(File,Version);
|
|
||||||
|
|
||||||
|
for (i=0; i<Layer.size(); i++)
|
||||||
|
{
|
||||||
|
Layer[i]->InitSubView(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetTileBank()->Load(File,Version);
|
||||||
|
CurrentLayer=Layer[ActiveLayer];
|
||||||
|
|
||||||
// Check Layers
|
// Check Layers
|
||||||
int MapWidth=ActionLayer->GetWidth();
|
int MapWidth=ActionLayer->GetWidth();
|
||||||
|
@ -140,6 +156,7 @@ int MapHeight=ActionLayer->GetHeight();
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::Save(CFile *File)
|
void CCore::Save(CFile *File)
|
||||||
{
|
{
|
||||||
|
BOOL F;
|
||||||
// Version 1
|
// Version 1
|
||||||
File->Write(&FileVersion,sizeof(int));
|
File->Write(&FileVersion,sizeof(int));
|
||||||
|
|
||||||
|
@ -148,9 +165,9 @@ void CCore::Save(CFile *File)
|
||||||
File->Write(&TileCam,sizeof(Vector3));
|
File->Write(&TileCam,sizeof(Vector3));
|
||||||
File->Write(&TileCamOfs,sizeof(Vector3));
|
File->Write(&TileCamOfs,sizeof(Vector3));
|
||||||
|
|
||||||
File->Write(&TileViewFlag,sizeof(BOOL));
|
F=SpareFlag; File->Write(&F,sizeof(BOOL));
|
||||||
File->Write(&GridFlag,sizeof(BOOL));
|
F=GridFlag; File->Write(&F,sizeof(BOOL));
|
||||||
File->Write(&Is3dFlag,sizeof(BOOL));
|
F=Is3dFlag; File->Write(&F,sizeof(BOOL));
|
||||||
|
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
|
@ -164,12 +181,12 @@ int LayerCount=Layer.size();
|
||||||
File->Write(&Type,sizeof(int));
|
File->Write(&Type,sizeof(int));
|
||||||
Layer[i]->Save(File);
|
Layer[i]->Save(File);
|
||||||
}
|
}
|
||||||
TileBank.Save(File);
|
GetTileBank()->Save(File);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CCore::Question(char *Txt)
|
bool CCore::Question(char *Txt)
|
||||||
{
|
{
|
||||||
CString Str;
|
CString Str;
|
||||||
Str.Format(Txt);
|
Str.Format(Txt);
|
||||||
|
@ -183,25 +200,33 @@ int Ret=AfxMessageBox(Str,MB_YESNO , MB_ICONQUESTION);
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::Render(BOOL ForceRender)
|
void CCore::Render(bool ForceRender)
|
||||||
{
|
{
|
||||||
if (!CurrentView)
|
Vector3 &ThisCam=GetCam();
|
||||||
|
if (!CurrentView)
|
||||||
{
|
{
|
||||||
TRACE0("No View\n");
|
TRACE0("No View\n");
|
||||||
UpdateAll();
|
UpdateAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TileBank.NeedLoad()) TileBank.LoadTileSets(this);
|
if (GetTileBank()->NeedLoad()) GetTileBank()->LoadTileSets(this);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen
|
||||||
if (TileViewFlag)
|
|
||||||
|
if (CurrentLayer!=Layer[ActiveLayer] || CurrentLayer->IsUnique())
|
||||||
{
|
{
|
||||||
RenderTileView();
|
CurrentLayer->Render(this,ThisCam,Is3dFlag);
|
||||||
|
CurrentLayer->RenderGrid(this,ThisCam,true);
|
||||||
|
CurrentLayer->FindCursorPos(this,GetCam(),CurrentMousePos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RenderLayers();
|
RenderLayers();
|
||||||
}
|
}
|
||||||
|
CurrentLayer->RenderCursor(this,ThisCam,Is3dFlag);
|
||||||
|
// Get Cursor Pos
|
||||||
|
LastCursorPos=CursorPos;
|
||||||
|
CurrentLayer->FindCursorPos(this,GetCam(),CurrentMousePos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,13 +240,13 @@ int StartLayer,EndLayer;
|
||||||
StartLayer=0;
|
StartLayer=0;
|
||||||
EndLayer=ListSize;
|
EndLayer=ListSize;
|
||||||
|
|
||||||
while (Layer[StartLayer]->IsUnique()) StartLayer++;
|
// while (Layer[StartLayer]->IsUnique()) StartLayer++;
|
||||||
|
|
||||||
if (Layer[ActiveLayer]->IsUnique())
|
// if (Layer[ActiveLayer]->IsUnique())
|
||||||
{
|
// {
|
||||||
StartLayer=ActiveLayer;
|
// StartLayer=ActiveLayer;
|
||||||
EndLayer=StartLayer+1;
|
// EndLayer=StartLayer+1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (int i=StartLayer; i<EndLayer; i++)
|
for (int i=StartLayer; i<EndLayer; i++)
|
||||||
{
|
{
|
||||||
|
@ -232,83 +257,36 @@ int StartLayer,EndLayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Layer[ActiveLayer]->RenderCursor(this,ThisCam,Is3dFlag);
|
|
||||||
|
|
||||||
// Get Cursor Pos
|
|
||||||
LastCursorPos=CursorPos;
|
|
||||||
Layer[ActiveLayer]->FindCursorPos(this,GetCam(),CurrentMousePos);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::RenderTileView()
|
|
||||||
{
|
|
||||||
Vector3 &ThisCam=GetCam();
|
|
||||||
|
|
||||||
GetTileBank().RenderSet(this,ThisCam,Is3dFlag);
|
|
||||||
GetTileBank().FindCursorPos(this,GetCam(),CurrentMousePos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Control *****************************************************************/
|
/*** Control *****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::SetMode(int NewMode)
|
void CCore::LButtonControl(UINT nFlags, CPoint &point,bool DownFlag)
|
||||||
{
|
{
|
||||||
BOOL RedrawFlag=FALSE;
|
if (CurrentLayer->IsVisible())
|
||||||
RedrawFlag=Layer[ActiveLayer]->SetMode(NewMode);
|
{
|
||||||
|
CurrentLayer->LButtonControl(this,nFlags,CursorPos,DownFlag);
|
||||||
|
}
|
||||||
|
Command(CmdMsg_ActiveBrushLeft,0,0);
|
||||||
|
|
||||||
|
RedrawView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
void CCore::MButtonControl(UINT nFlags, CPoint &point,bool DownFlag)
|
||||||
{
|
|
||||||
BOOL RedrawFlag=FALSE;
|
|
||||||
|
|
||||||
if (TileViewFlag)
|
|
||||||
{
|
|
||||||
if (nFlags & MK_RBUTTON)
|
|
||||||
RedrawFlag=GetTileBank().SelectCancel();
|
|
||||||
else
|
|
||||||
RedrawFlag=GetTileBank().SelectL(DownFlag);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Layer[ActiveLayer]->IsVisible())
|
|
||||||
{
|
|
||||||
RedrawFlag=Layer[ActiveLayer]->LButtonControl(this,nFlags,CursorPos,DownFlag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GetTileBank().SetActiveBrushL();
|
|
||||||
|
|
||||||
if (RedrawFlag) RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
void CCore::RButtonControl(UINT nFlags, CPoint &point,bool DownFlag)
|
||||||
{
|
{
|
||||||
BOOL RedrawFlag=FALSE;
|
if (CurrentLayer->IsVisible())
|
||||||
|
|
||||||
if (TileViewFlag)
|
|
||||||
{
|
{
|
||||||
if (nFlags & MK_LBUTTON)
|
CurrentLayer->RButtonControl(this,nFlags,CursorPos,DownFlag);
|
||||||
RedrawFlag=GetTileBank().SelectCancel();
|
|
||||||
else
|
|
||||||
RedrawFlag=GetTileBank().SelectR(DownFlag);
|
|
||||||
}
|
}
|
||||||
else
|
Command(CmdMsg_ActiveBrushRight,0,0);
|
||||||
{
|
RedrawView();
|
||||||
if (Layer[ActiveLayer]->IsVisible())
|
|
||||||
{
|
|
||||||
RedrawFlag=Layer[ActiveLayer]->RButtonControl(this,nFlags,CursorPos,DownFlag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GetTileBank().SetActiveBrushR();
|
|
||||||
|
|
||||||
if (RedrawFlag) RedrawView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -367,15 +345,9 @@ Vector3 &ThisCam=GetCam();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (TileViewFlag)
|
if (CurrentLayer->IsVisible())
|
||||||
{
|
{
|
||||||
}
|
CurrentLayer->MouseMove(this,nFlags,CursorPos);
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Layer[ActiveLayer]->IsVisible())
|
|
||||||
{
|
|
||||||
Layer[ActiveLayer]->MouseMove(this,nFlags,CursorPos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Mouse still moved, so need to redraw windows, to get CursorPos
|
// Mouse still moved, so need to redraw windows, to get CursorPos
|
||||||
RedrawView();
|
RedrawView();
|
||||||
|
@ -384,6 +356,52 @@ Vector3 &ThisCam=GetCam();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CCore::Command(int CmdMsg,int Param0,int Param1)
|
||||||
|
{
|
||||||
|
bool RedrawFlag=false;
|
||||||
|
switch(CmdMsg)
|
||||||
|
{
|
||||||
|
case CmdMsg_ToggleSubView:
|
||||||
|
ToggleSubView();
|
||||||
|
break;
|
||||||
|
case CmdMsg_ToggleGrid:
|
||||||
|
ToggleGrid();
|
||||||
|
break;
|
||||||
|
case CmdMsg_Toggle2d:
|
||||||
|
Toggle2d3d();
|
||||||
|
break;
|
||||||
|
case CmdMsg_ZoomIn:
|
||||||
|
Zoom(-0.1f);
|
||||||
|
break;
|
||||||
|
case CmdMsg_ZoomOut:
|
||||||
|
Zoom(+0.1f);
|
||||||
|
break;
|
||||||
|
case CmdMsg_ResetView:
|
||||||
|
ResetView();
|
||||||
|
break;
|
||||||
|
case CmdMsg_SetLayer:
|
||||||
|
SetLayer(Param0);
|
||||||
|
break;
|
||||||
|
case CmdMsg_AddLayer:
|
||||||
|
AddLayer(Param0);
|
||||||
|
break;
|
||||||
|
case CmdMsg_DeleteLayer:
|
||||||
|
DeleteLayer(Param0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Pass remaining to Active Layer
|
||||||
|
default:
|
||||||
|
RedrawFlag=CurrentLayer->Command(CmdMsg,this,Param0,Param1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* if (RedrawFlag) */RedrawView();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Layers ******************************************************************/
|
/*** Layers ******************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -394,7 +412,7 @@ CMultiBar *ParamBar=Frm->GetParamBar();
|
||||||
|
|
||||||
GUIRemoveAll();
|
GUIRemoveAll();
|
||||||
GUIAdd(LayerList,IDD_LAYER_LIST_DIALOG);
|
GUIAdd(LayerList,IDD_LAYER_LIST_DIALOG);
|
||||||
Layer[ActiveLayer]->GUIInit(this);
|
CurrentLayer->GUIInit(this);
|
||||||
GUIUpdate();
|
GUIUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,21 +449,21 @@ int LastLayer=ActiveLayer;
|
||||||
// If toggling layer, dont change the layer
|
// If toggling layer, dont change the layer
|
||||||
if ((int)LayerList.ListBox.GetCheck(NewLayer)!=(int)Layer[NewLayer]->IsVisible())
|
if ((int)LayerList.ListBox.GetCheck(NewLayer)!=(int)Layer[NewLayer]->IsVisible())
|
||||||
{
|
{
|
||||||
Layer[NewLayer]->SetVisible(LayerList.ListBox.GetCheck(NewLayer));
|
Layer[NewLayer]->SetVisible(LayerList.ListBox.GetCheck(NewLayer)!=0);
|
||||||
LayerList.ListBox.SetCurSel(ActiveLayer);
|
LayerList.ListBox.SetCurSel(ActiveLayer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool IsCol=Layer[NewLayer]->GetType()==LAYER_TYPE_COLLISION;
|
bool IsCol=Layer[NewLayer]->GetType()==LAYER_TYPE_COLLISION;
|
||||||
TileBank.SetCollision(IsCol);
|
GetTileBank()->SetCollision(IsCol);
|
||||||
ActiveLayer=NewLayer;
|
ActiveLayer=NewLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LastLayer!=ActiveLayer || Force)
|
if (LastLayer!=ActiveLayer || Force)
|
||||||
{
|
{
|
||||||
if (TileViewFlag) TileViewFlag=false;
|
if (LastLayer<=LayerCount) CurrentLayer->GUIKill(this);
|
||||||
if (LastLayer<=LayerCount) Layer[LastLayer]->GUIKill(this);
|
CurrentLayer=Layer[ActiveLayer];
|
||||||
Layer[ActiveLayer]->GUIInit(this);
|
CurrentLayer->GUIInit(this);
|
||||||
GUIUpdate();
|
GUIUpdate();
|
||||||
}
|
}
|
||||||
RedrawView();
|
RedrawView();
|
||||||
|
@ -468,7 +486,8 @@ int Idx=ListSize;
|
||||||
|
|
||||||
Layer.insert(Layer.begin() + Idx,NewLayer);
|
Layer.insert(Layer.begin() + Idx,NewLayer);
|
||||||
|
|
||||||
if (NewLayer->GetType()==LAYER_TYPE_TILE && NewLayer->GetSubType()==LAYER_SUBTYPE_ACTION) ActionLayer=NewLayer;
|
if (NewLayer->GetType()==LAYER_TYPE_TILE && NewLayer->GetSubType()==LAYER_SUBTYPE_ACTION) ActionLayer=(CLayerTile*)NewLayer;
|
||||||
|
NewLayer->InitSubView(this);
|
||||||
return(Idx);
|
return(Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,147 +565,47 @@ void CCore::DeleteLayer(int CurrentLayer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
CLayer *CCore::FindSubView(int Type)
|
||||||
|
{
|
||||||
|
int i,ListSize=Layer.size();
|
||||||
|
|
||||||
|
for (i=0;i<ListSize;i++)
|
||||||
|
{
|
||||||
|
if (Layer[i]->GetSubViewType()==Type)
|
||||||
|
{
|
||||||
|
CLayer *SV=Layer[i]->GetSubView();
|
||||||
|
if (SV) return(SV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Grid ********************************************************************/
|
/*** Grid ********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::UpdateGrid(BOOL Toggle)
|
void CCore::ToggleGrid()
|
||||||
{
|
{
|
||||||
if (Toggle) GridFlag=!GridFlag;
|
GridFlag=!GridFlag;
|
||||||
RedrawView();
|
RedrawView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** TileBank ****************************************************************/
|
/*** SubView *****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::UpdateTileView(BOOL Toggle)
|
void CCore::ToggleSubView()
|
||||||
{
|
{
|
||||||
if (!Layer[ActiveLayer]->HasTileView()) return;
|
CLayer *LastLayer=CurrentLayer;
|
||||||
if (TileViewFlag && !TileBank.CanClose()) return;
|
|
||||||
|
|
||||||
if (Toggle)
|
CurrentLayer=CurrentLayer->GetSubView(); // <-- Funky toggle code of what!!
|
||||||
|
if (!CurrentLayer) CurrentLayer=Layer[ActiveLayer];
|
||||||
|
if (LastLayer!=CurrentLayer)
|
||||||
{
|
{
|
||||||
TileViewFlag=!TileViewFlag;
|
LastLayer->GUIKill(this);
|
||||||
|
CurrentLayer->GUIInit(this);
|
||||||
|
GUIUpdate();
|
||||||
|
RedrawView();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TileViewFlag)
|
|
||||||
{
|
|
||||||
Layer[ActiveLayer]->GUIKill(this);
|
|
||||||
TileBank.GUIInit(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TileBank.GUIKill(this);
|
|
||||||
Layer[ActiveLayer]->GUIInit(this);
|
|
||||||
}
|
|
||||||
GUIUpdate();
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::TileBankLoad(char *Filename)
|
|
||||||
{
|
|
||||||
TileBank.AddTileSet(Filename);
|
|
||||||
TileBank.GUIUpdate(this);
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::TileBankDelete()
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::TileBankReload()
|
|
||||||
{
|
|
||||||
TileBank.Reload();
|
|
||||||
TexCache.Purge();
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::TileBankSet()
|
|
||||||
{
|
|
||||||
TileBank.SetCurrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::MirrorX()
|
|
||||||
{
|
|
||||||
if (TileViewFlag) return;
|
|
||||||
Layer[ActiveLayer]->MirrorX(this);
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::MirrorY()
|
|
||||||
{
|
|
||||||
if (TileViewFlag) return;
|
|
||||||
Layer[ActiveLayer]->MirrorY(this);
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::ActiveBrushLeft()
|
|
||||||
{
|
|
||||||
GetTileBank().SetActiveBrushL();
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::ActiveBrushRight()
|
|
||||||
{
|
|
||||||
GetTileBank().SetActiveBrushR();
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CCore::IsTileValid(int Set,int Tile)
|
|
||||||
{
|
|
||||||
return(TileBank.IsTileValid(Set,Tile));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::SetColFlag(int Flag)
|
|
||||||
{
|
|
||||||
if (TileViewFlag) return;
|
|
||||||
Layer[ActiveLayer]->SetColFlags(this,Flag);
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::CopySelection()
|
|
||||||
{
|
|
||||||
Layer[ActiveLayer]->CopySelection(this);
|
|
||||||
RedrawView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::PasteSelection()
|
|
||||||
{
|
|
||||||
Layer[ActiveLayer]->PasteSelection(this);
|
|
||||||
RedrawView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -694,9 +613,9 @@ void CCore::PasteSelection()
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
Vector3 &CCore::GetCam()
|
Vector3 &CCore::GetCam()
|
||||||
{
|
{
|
||||||
if (TileViewFlag)
|
// if (SubViewFlag)
|
||||||
return(TileCam);
|
// return(TileCam);
|
||||||
else
|
// else
|
||||||
return(MapCam);
|
return(MapCam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -774,15 +693,14 @@ CMainFrame *Frm=(CMainFrame*)AfxGetMainWnd();
|
||||||
CMultiBar *ParamBar=Frm->GetParamBar();
|
CMultiBar *ParamBar=Frm->GetParamBar();
|
||||||
|
|
||||||
UpdateLayerGUI();
|
UpdateLayerGUI();
|
||||||
UpdateGrid();
|
CurrentLayer->GUIUpdate(this);
|
||||||
Layer[ActiveLayer]->GUIUpdate(this);
|
|
||||||
ParamBar->Update();
|
ParamBar->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::GUIChanged()
|
void CCore::GUIChanged()
|
||||||
{
|
{
|
||||||
Layer[ActiveLayer]->GUIChanged(this);
|
CurrentLayer->GUIChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -808,11 +726,8 @@ void CCore::UpdateView(Vector3 *Ofs)
|
||||||
ThisCam.x+=Ofs->x;
|
ThisCam.x+=Ofs->x;
|
||||||
ThisCam.y+=Ofs->y;
|
ThisCam.y+=Ofs->y;
|
||||||
ThisCam.z-=Ofs->z;
|
ThisCam.z-=Ofs->z;
|
||||||
if (!TileViewFlag)
|
if (ThisCam.x<0) ThisCam.x=0;
|
||||||
{
|
if (ThisCam.y<0) ThisCam.y=0;
|
||||||
if (ThisCam.x<0) ThisCam.x=0;
|
|
||||||
if (ThisCam.y<0) ThisCam.y=0;
|
|
||||||
}
|
|
||||||
if (ThisCam.z<0.1) ThisCam.z=0.1f;
|
if (ThisCam.z<0.1) ThisCam.z=0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,13 @@
|
||||||
#include "TexCache.h"
|
#include "TexCache.h"
|
||||||
#include "TileSet.h"
|
#include "TileSet.h"
|
||||||
|
|
||||||
#include "MApEdit.h"
|
#include "MapEdit.h"
|
||||||
#include "LayerList.h"
|
#include "LayerList.h"
|
||||||
#include "LayerTileGUI.h"
|
#include "LayerTileGUI.h"
|
||||||
|
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "LayerTile.h"
|
||||||
|
|
||||||
const s32 FileVersion=3;
|
const s32 FileVersion=3;
|
||||||
|
|
||||||
#define SCREEN_MAP_WIDTH 30
|
#define SCREEN_MAP_WIDTH 30
|
||||||
|
@ -23,6 +26,7 @@ const s32 FileVersion=3;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CMapEditView;
|
class CMapEditView;
|
||||||
|
|
||||||
class CCore
|
class CCore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -30,13 +34,12 @@ public:
|
||||||
~CCore();
|
~CCore();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
BOOL New();
|
bool New();
|
||||||
void Load(CFile *File);
|
void Load(CFile *File);
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
BOOL Question(char *Txt);
|
bool Question(char *Txt);
|
||||||
void Render(BOOL ForceRender=FALSE);
|
void Render(bool ForceRender=FALSE);
|
||||||
void RenderLayers();
|
void RenderLayers();
|
||||||
void RenderTileView();
|
|
||||||
void Export(char *Filename);
|
void Export(char *Filename);
|
||||||
|
|
||||||
// View Stuff
|
// View Stuff
|
||||||
|
@ -44,33 +47,18 @@ public:
|
||||||
CMapEditView *GetView() {return(CurrentView);}
|
CMapEditView *GetView() {return(CurrentView);}
|
||||||
// Control
|
// Control
|
||||||
void SetMode(int NewMode);
|
void SetMode(int NewMode);
|
||||||
void LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
void LButtonControl(UINT nFlags, CPoint &point,bool DownFlag);
|
||||||
void MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
void MButtonControl(UINT nFlags, CPoint &point,bool DownFlag);
|
||||||
void RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
void RButtonControl(UINT nFlags, CPoint &point,bool DownFlag);
|
||||||
void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
|
void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
|
||||||
void MouseMove(UINT nFlags, CPoint &point);
|
void MouseMove(UINT nFlags, CPoint &point);
|
||||||
void Zoom(float Dst);
|
void Zoom(float Dst);
|
||||||
|
void Command(int CmdMsg,int Param0=0,int Param1=0);
|
||||||
|
|
||||||
// TileBank
|
// Subview & TileBank
|
||||||
CTileBank &GetTileBank() {return(TileBank);}
|
CTileBank *GetTileBank() {return(ActionLayer->GetTileBank());}
|
||||||
void UpdateTileView(BOOL Toggle=FALSE);
|
void ToggleSubView();
|
||||||
|
CLayer *FindSubView(int Type);
|
||||||
CTile &GetTile(int Bank,int TileNo) {return(TileBank.GetTile(Bank,TileNo));}
|
|
||||||
void TileBankLoad(char *Filename);
|
|
||||||
void TileBankDelete();
|
|
||||||
void TileBankReload();
|
|
||||||
void TileBankSet();
|
|
||||||
void MirrorX();
|
|
||||||
void MirrorY();
|
|
||||||
void ActiveBrushLeft();
|
|
||||||
void ActiveBrushRight();
|
|
||||||
BOOL IsTileValid(int Set,int Tile);
|
|
||||||
BOOL IsTileView() {return(TileViewFlag);}
|
|
||||||
void TileBankGUIInit() {TileBank.GUIInit(this);}
|
|
||||||
void TileBankGUIKill() {TileBank.GUIKill(this);}
|
|
||||||
void TileBankGUIUpdate() {TileBank.GUIUpdate(this);}
|
|
||||||
|
|
||||||
void SetColFlag(int Flag);
|
|
||||||
|
|
||||||
// GUI
|
// GUI
|
||||||
void UpdateParamBar();
|
void UpdateParamBar();
|
||||||
|
@ -87,10 +75,12 @@ public:
|
||||||
void AddLayer(int Layer);
|
void AddLayer(int Layer);
|
||||||
void DeleteLayer(int Layer);
|
void DeleteLayer(int Layer);
|
||||||
void UpdateLayerGUI();
|
void UpdateLayerGUI();
|
||||||
|
int GetLayerCount() {return(Layer.size());}
|
||||||
|
CLayer *GetLayer(int i) {return(Layer[i]);}
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
void UpdateGrid(BOOL Toggle=FALSE);
|
void ToggleGrid();
|
||||||
BOOL IsGridOn() {return(GridFlag);}
|
bool IsGridOn() {return(GridFlag);}
|
||||||
|
|
||||||
// Tex Cache
|
// Tex Cache
|
||||||
CTexCache &GetTexCache() {return(TexCache);}
|
CTexCache &GetTexCache() {return(TexCache);}
|
||||||
|
@ -111,7 +101,7 @@ public:
|
||||||
|
|
||||||
void Toggle2d3d();
|
void Toggle2d3d();
|
||||||
int FindLayer(int Type,int SubType=-1);
|
int FindLayer(int Type,int SubType=-1);
|
||||||
int SetActionLayer(CLayer *Lyr) {ActionLayer=Lyr;}
|
int SetActionLayer(CLayerTile *Lyr) {ActionLayer=Lyr;}
|
||||||
|
|
||||||
void SetScale();
|
void SetScale();
|
||||||
Vector3 &GetScaleVector() {return(ScaleVector);}
|
Vector3 &GetScaleVector() {return(ScaleVector);}
|
||||||
|
@ -132,17 +122,18 @@ private:
|
||||||
Vector3 ScaleVector;
|
Vector3 ScaleVector;
|
||||||
|
|
||||||
std::vector<CLayer*> Layer;
|
std::vector<CLayer*> Layer;
|
||||||
CLayer *ActionLayer;
|
CLayer *CurrentLayer;
|
||||||
|
CLayerTile *ActionLayer;
|
||||||
int ActiveLayer;
|
int ActiveLayer;
|
||||||
|
|
||||||
CTileBank TileBank;
|
// CTileBank TileBank;
|
||||||
CTexCache TexCache;
|
CTexCache TexCache;
|
||||||
|
|
||||||
CLayerListGUI LayerList;
|
CLayerListGUI LayerList;
|
||||||
|
|
||||||
BOOL TileViewFlag;
|
bool SpareFlag;
|
||||||
BOOL GridFlag;
|
bool GridFlag;
|
||||||
BOOL Is3dFlag;
|
bool Is3dFlag;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -73,83 +73,16 @@ int ThisFilePos=ftell(File);
|
||||||
return(ThisFilePos);
|
return(ThisFilePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*** Tile Map ****************************************************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void CExport::ExportLayerTile(CCore *Core,char *LayerName,int SubType,CMap &Map)
|
|
||||||
{
|
|
||||||
int Width=Map.GetWidth();
|
|
||||||
int Height=Map.GetHeight();
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
sExpTile BlankElem={0,0,0,0};
|
|
||||||
|
|
||||||
TRACE1("LayerTile Ofs %i\n",ThisFilePos);
|
|
||||||
ExportLayerHeader(LAYER_TYPE_TILE,SubType,Width,Height);
|
|
||||||
|
|
||||||
UsedTileList.Add(BlankElem); // Ensure blank tile is present
|
|
||||||
|
|
||||||
for (int Y=0; Y<Height; Y++)
|
|
||||||
{
|
|
||||||
for (int X=0; X<Width; X++)
|
|
||||||
{
|
|
||||||
sMapElem &MapElem=Map.Get(X,Y);
|
|
||||||
CTile &ThisTile=Core->GetTile(MapElem.Set,MapElem.Tile);
|
|
||||||
sExpLayerTile OutElem;
|
|
||||||
sExpTile OutTile;
|
|
||||||
|
|
||||||
OutTile.Set=MapElem.Set;
|
|
||||||
OutTile.Tile=MapElem.Tile;
|
|
||||||
OutTile.TriCount=0;
|
|
||||||
OutTile.XOfs=ThisTile.GetTexXOfs();
|
|
||||||
OutTile.YOfs=ThisTile.GetTexYOfs();
|
|
||||||
|
|
||||||
OutElem.Tile=UsedTileList.Add(OutTile);
|
|
||||||
OutElem.Flags=MapElem.Flags;
|
|
||||||
fwrite(&OutElem,sizeof(sExpLayerTile),1,File);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*** Collision Layer *********************************************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*
|
|
||||||
void CExport::ExportLayerCollision(CCore *Core,char *LayerName,int SubType,CMap &Map)
|
|
||||||
{
|
|
||||||
int Width=Map.GetWidth();
|
|
||||||
int Height=Map.GetHeight();
|
|
||||||
u8 OutElem;
|
|
||||||
|
|
||||||
TRACE1("LayerCollision Ofs %i\n",ThisFilePos);
|
|
||||||
|
|
||||||
ExportLayerHeader(LAYER_TYPE_COLLISION,SubType,Width,Height);
|
|
||||||
|
|
||||||
for (int Y=0; Y<Height; Y++)
|
|
||||||
{
|
|
||||||
for (int X=0; X<Width; X++)
|
|
||||||
{
|
|
||||||
sMapElem &MapElem=Map.Get(X,Y);
|
|
||||||
OutElem=0;
|
|
||||||
if (MapElem.Tile)
|
|
||||||
{
|
|
||||||
OutElem=((MapElem.Tile-1)*4)+1;
|
|
||||||
OutElem+=MapElem.Flags & TILE_FLAG_MIRROR_XY;
|
|
||||||
}
|
|
||||||
fwrite(&OutElem,sizeof(u8),1,File);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Tiles *******************************************************************/
|
/*** Tiles *******************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CExport::ExportTiles(CCore *Core)
|
void CExport::ExportTiles(CCore *Core)
|
||||||
{
|
{
|
||||||
int ListSize,i;
|
int ListSize,i;
|
||||||
|
CTileBank *TileBank=Core->GetTileBank();
|
||||||
|
|
||||||
FileHdr.TileW=Core->GetTile(1,0).GetPCTexW();
|
FileHdr.TileW=TileBank->GetTile(1,0).GetPCTexW();
|
||||||
FileHdr.TileH=Core->GetTile(1,0).GetPCTexH();
|
FileHdr.TileH=TileBank->GetTile(1,0).GetPCTexH();
|
||||||
|
|
||||||
// Write Tiles
|
// Write Tiles
|
||||||
ListSize=UsedTileList.size();
|
ListSize=UsedTileList.size();
|
||||||
|
@ -174,12 +107,12 @@ int ListSize,i;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CExport::ExportTile(CCore *Core,sExpTile &OutTile)
|
void CExport::ExportTile(CCore *Core,sExpTile &OutTile)
|
||||||
{
|
{
|
||||||
CTile &ThisTile=Core->GetTile(OutTile.Set,OutTile.Tile);
|
CTileBank *TileBank=Core->GetTileBank();
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
CTile &ThisTile=TileBank->GetTile(OutTile.Set,OutTile.Tile);
|
||||||
int RGBW=ThisTile.GetPCTexW();
|
int RGBW=ThisTile.GetPCTexW();
|
||||||
int RGBH=ThisTile.GetPCTexH();
|
int RGBH=ThisTile.GetPCTexH();
|
||||||
u8 *RGB=ThisTile.GetPCTexRGB();
|
u8 *RGB=ThisTile.GetPCTexRGB();
|
||||||
GString SetName=TileBank.GetSet(OutTile.Set).GetFilename();
|
GString SetName=TileBank->GetSet(OutTile.Set).GetFilename();
|
||||||
|
|
||||||
if (ThisTile.IsTile3d())
|
if (ThisTile.IsTile3d())
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,17 +16,23 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
sLayerInfoTable CLayer::InfoTable[]=
|
sLayerInfoTable CLayer::InfoTable[]=
|
||||||
{
|
{
|
||||||
//Type SubType Name delete? Scale 3d Resizable Export TileView?
|
//Type SubType Name delete? Scale 3d Resizable Export SubView?
|
||||||
{LAYER_TYPE_TILE, LAYER_SUBTYPE_SCRATCH, "WorkPad", true, 1.0f, true, false, false, true,},
|
{LAYER_TYPE_TILE, LAYER_SUBTYPE_SCRATCH, "WorkPad", true, 1.0f, true, false, false, LAYER_SUBVIEW_TILEBANK,},
|
||||||
{LAYER_TYPE_SHADE, LAYER_SUBTYPE_BACK, "Back Shade", true, 4.0f, false, true, true, false,},
|
{LAYER_TYPE_SHADE, LAYER_SUBTYPE_BACK, "Back Shade", true, 4.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
||||||
{LAYER_TYPE_TILE, LAYER_SUBTYPE_BACK, "Back", true, 4.0f, false, false, true, true,},
|
{LAYER_TYPE_TILE, LAYER_SUBTYPE_BACK, "Back", true, 4.0f, false, false, true, LAYER_SUBVIEW_TILEBANK,},
|
||||||
{LAYER_TYPE_TILE, LAYER_SUBTYPE_MID, "Mid", true, 2.0f, false, true, true, true,},
|
{LAYER_TYPE_TILE, LAYER_SUBTYPE_MID, "Mid", true, 2.0f, false, true, true, LAYER_SUBVIEW_TILEBANK,},
|
||||||
{LAYER_TYPE_TILE, LAYER_SUBTYPE_ACTION, "Action", false, 1.0f, true, true, true, true,},
|
{LAYER_TYPE_TILE, LAYER_SUBTYPE_ACTION, "Action", false, 1.0f, true, true, true, LAYER_SUBVIEW_TILEBANK,},
|
||||||
{LAYER_TYPE_COLLISION, LAYER_SUBTYPE_NONE, "Collision", true, 1.0f, false, true, true, true,},
|
{LAYER_TYPE_COLLISION, LAYER_SUBTYPE_NONE, "Collision", true, 1.0f, false, true, true, LAYER_SUBVIEW_TILEBANK,},
|
||||||
};
|
};
|
||||||
|
|
||||||
int CLayer::InfoTableSize=sizeof(InfoTable)/sizeof(sLayerInfoTable);
|
int CLayer::InfoTableSize=sizeof(InfoTable)/sizeof(sLayerInfoTable);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
CLayer::CLayer()
|
||||||
|
{
|
||||||
|
SubView=0;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -56,4 +62,3 @@ int CLayer::GetLayerIdx(int Type,int SubType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct sLayerInfoTable
|
||||||
bool Render3dFlag;
|
bool Render3dFlag;
|
||||||
bool ResizeFlag;
|
bool ResizeFlag;
|
||||||
bool ExportFlag;
|
bool ExportFlag;
|
||||||
bool HasTileView;
|
int SubView;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class CExport;
|
||||||
class CLayer
|
class CLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLayer(){};
|
CLayer();
|
||||||
virtual ~CLayer(){};
|
virtual ~CLayer(){};
|
||||||
|
|
||||||
static sLayerInfoTable InfoTable[];
|
static sLayerInfoTable InfoTable[];
|
||||||
|
@ -55,22 +55,23 @@ static int GetLayerIdx(int Type,int SubType);
|
||||||
bool CanDelete() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].DeleteFlag);}
|
bool CanDelete() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].DeleteFlag);}
|
||||||
bool CanExport() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].ExportFlag);}
|
bool CanExport() {return(InfoTable[GetLayerIdx(GetType(),GetSubType())].ExportFlag);}
|
||||||
bool IsUnique() {return(!(InfoTable[GetLayerIdx(GetType(),GetSubType())].ExportFlag));}
|
bool IsUnique() {return(!(InfoTable[GetLayerIdx(GetType(),GetSubType())].ExportFlag));}
|
||||||
bool HasTileView() {return((InfoTable[GetLayerIdx(GetType(),GetSubType())].HasTileView));}
|
int GetSubViewType() {return((InfoTable[GetLayerIdx(GetType(),GetSubType())].SubView));}
|
||||||
|
|
||||||
virtual void SetVisible(BOOL f) {VisibleFlag=f;}
|
virtual void InitSubView(CCore *Core){};
|
||||||
virtual BOOL IsVisible() {return(VisibleFlag);}
|
virtual CLayer *GetSubView() {return(SubView);}
|
||||||
|
|
||||||
|
|
||||||
|
virtual void SetVisible(bool f) {VisibleFlag=f;}
|
||||||
|
virtual bool IsVisible() {return(VisibleFlag);}
|
||||||
virtual int GetType()=0;
|
virtual int GetType()=0;
|
||||||
virtual int GetSubType() {return(LAYER_SUBTYPE_NONE);}
|
virtual int GetSubType() {return(LAYER_SUBTYPE_NONE);}
|
||||||
float GetScaleFactor() {return(ScaleFactor);}
|
float GetScaleFactor() {return(ScaleFactor);}
|
||||||
|
|
||||||
|
virtual void Render(CCore *Core,Vector3 &CamPos,bool Is3d)=0;
|
||||||
virtual void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d)=0;
|
virtual void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active)=0;
|
||||||
virtual void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active)=0;
|
|
||||||
virtual void RenderSelection(CCore *Core,Vector3 &ThisCam)=0;
|
virtual void RenderSelection(CCore *Core,Vector3 &ThisCam)=0;
|
||||||
|
virtual void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d)=0;
|
||||||
|
|
||||||
virtual void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos)=0;
|
virtual void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos)=0;
|
||||||
virtual void RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d)=0;
|
|
||||||
|
|
||||||
virtual void GUIInit(CCore *Core)=0;
|
virtual void GUIInit(CCore *Core)=0;
|
||||||
virtual void GUIKill(CCore *Core)=0;
|
virtual void GUIKill(CCore *Core)=0;
|
||||||
|
@ -80,7 +81,7 @@ virtual void GUIChanged(CCore *Core)=0;
|
||||||
virtual int GetWidth()=0;
|
virtual int GetWidth()=0;
|
||||||
virtual int GetHeight()=0;
|
virtual int GetHeight()=0;
|
||||||
virtual void CheckLayerSize(int Width,int Height){};
|
virtual void CheckLayerSize(int Width,int Height){};
|
||||||
virtual BOOL Resize(int Width,int Height)=0;
|
virtual bool Resize(int Width,int Height)=0;
|
||||||
|
|
||||||
virtual void Load(CFile *File,int Version)=0;
|
virtual void Load(CFile *File,int Version)=0;
|
||||||
virtual void Save(CFile *File)=0;
|
virtual void Save(CFile *File)=0;
|
||||||
|
@ -89,31 +90,19 @@ virtual void Export(CCore *Core,CExport &Exp)=0;
|
||||||
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
virtual BOOL SetMode(int NewMode)=0;
|
virtual bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag){return(false);}
|
||||||
virtual BOOL InitMode()=0;
|
virtual bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag){return(false);}
|
||||||
virtual BOOL ExitMode()=0;
|
virtual bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos){return(false);}
|
||||||
virtual BOOL LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)=0;
|
virtual bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0){return(false);};
|
||||||
virtual BOOL RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)=0;
|
|
||||||
virtual BOOL MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos)=0;
|
|
||||||
|
|
||||||
virtual BOOL MirrorX(CCore *Core){return(false);};
|
|
||||||
virtual BOOL MirrorY(CCore *Core){return(false);};
|
|
||||||
virtual BOOL SetColFlags(CCore *Core,int Flag){return(false);};
|
|
||||||
|
|
||||||
virtual BOOL CopySelection(CCore *Core) {return(false);}
|
|
||||||
virtual BOOL PasteSelection(CCore *Core) {return(false);}
|
|
||||||
|
|
||||||
|
|
||||||
virtual void DeleteSet(int Set){};
|
|
||||||
virtual void RemapSet(int OrigSet,int NewSet){};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float ScaleFactor;
|
float ScaleFactor;
|
||||||
bool Render3dFlag;
|
bool Render3dFlag;
|
||||||
bool ResizeFlag;
|
bool ResizeFlag;
|
||||||
|
|
||||||
BOOL VisibleFlag;
|
bool VisibleFlag;
|
||||||
CSelect Selection;
|
CSelect Selection;
|
||||||
|
CLayer *SubView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,19 +77,29 @@ void CLayerCollision::Save(CFile *File)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerCollision::Render(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
void CLayerCollision::Render(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
{
|
{
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
|
|
||||||
CLayerTile::Render(Core,ThisCam,Map,FALSE,0.5f);
|
CLayerTile::Render(Core,ThisCam,Map,FALSE,0.5f);
|
||||||
}
|
}
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerCollision::SetColFlag(CCore *Core,int Flag)
|
|
||||||
{
|
|
||||||
TRACE1("HERE!!! %i",Flag);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
bool CLayerCollision::Command(int CmdMsg,CCore *Core,int Param0,int Param1)
|
||||||
|
{
|
||||||
|
bool Ret=false;
|
||||||
|
switch(CmdMsg)
|
||||||
|
{
|
||||||
|
case CmdMsg_MirrorY:
|
||||||
|
// Ret=MirrorY(Core); No longer mirror Y collision tiles
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Ret=CLayerTile::Command(CmdMsg,Core,Param0,Param1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(Ret);
|
||||||
|
}
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Gui *********************************************************************/
|
/*** Gui *********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -154,14 +164,17 @@ int Height=Map.GetHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
void CLayerCollision::DeleteSet(int Set)
|
void CLayerCollision::DeleteSet(int Set)
|
||||||
{
|
{
|
||||||
Map.DeleteSet(Set);
|
Map.DeleteSet(Set);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
void CLayerCollision::RemapSet(int OrigSet,int NewSet)
|
void CLayerCollision::RemapSet(int OrigSet,int NewSet)
|
||||||
{
|
{
|
||||||
Map.RemapSet(OrigSet,NewSet);
|
Map.RemapSet(OrigSet,NewSet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -21,8 +21,7 @@ public:
|
||||||
|
|
||||||
int GetType() {return(LAYER_TYPE_COLLISION);}
|
int GetType() {return(LAYER_TYPE_COLLISION);}
|
||||||
|
|
||||||
void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
void Render(CCore *Core,Vector3 &CamPos,bool Is3d);
|
||||||
BOOL SetColFlag(CCore *Core,int Flag);
|
|
||||||
|
|
||||||
void GUIInit(CCore *Core);
|
void GUIInit(CCore *Core);
|
||||||
void GUIKill(CCore *Core);
|
void GUIKill(CCore *Core);
|
||||||
|
@ -33,6 +32,7 @@ public:
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
|
|
||||||
void Export(CCore *Core,CExport &Exp);
|
void Export(CCore *Core,CExport &Exp);
|
||||||
|
bool Command(int CmdMsg,CCore *Core,int Param0,int Param1);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
void DeleteSet(int Set);
|
void DeleteSet(int Set);
|
||||||
|
|
|
@ -28,6 +28,12 @@ enum LAYER_SUBTYPE
|
||||||
LAYER_SUBTYPE_SCRATCH,
|
LAYER_SUBTYPE_SCRATCH,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum LAYER_SUBVIEW
|
||||||
|
{
|
||||||
|
LAYER_SUBVIEW_NONE=0,
|
||||||
|
LAYER_SUBVIEW_TILEBANK,
|
||||||
|
};
|
||||||
|
|
||||||
enum TILE_FLAG
|
enum TILE_FLAG
|
||||||
{
|
{
|
||||||
PC_TILE_FLAG_MIRROR_X =1<<0,
|
PC_TILE_FLAG_MIRROR_X =1<<0,
|
||||||
|
|
|
@ -113,7 +113,7 @@ void CLayerShade::Save(CFile *File)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::Render(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
void CLayerShade::Render(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
{
|
{
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
float ZoomW=Core->GetZoomW();
|
float ZoomW=Core->GetZoomW();
|
||||||
|
@ -152,7 +152,7 @@ float YInc=(float)Height/(float)ThisCount;
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerShade::Resize(int _Width,int _Height)
|
bool CLayerShade::Resize(int _Width,int _Height)
|
||||||
{
|
{
|
||||||
Width=TileLayerMinWidth+(_Width-TileLayerMinWidth)/ScaleFactor;
|
Width=TileLayerMinWidth+(_Width-TileLayerMinWidth)/ScaleFactor;
|
||||||
Height=TileLayerMinHeight+(_Height-TileLayerMinHeight)/ScaleFactor;
|
Height=TileLayerMinHeight+(_Height-TileLayerMinHeight)/ScaleFactor;
|
||||||
|
|
|
@ -27,12 +27,12 @@ public:
|
||||||
int GetType() {return(LAYER_TYPE_SHADE);}
|
int GetType() {return(LAYER_TYPE_SHADE);}
|
||||||
int GetSubType() {return(SubType);}
|
int GetSubType() {return(SubType);}
|
||||||
|
|
||||||
void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
void Render(CCore *Core,Vector3 &CamPos,bool Is3d);
|
||||||
void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active){};
|
void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active){};
|
||||||
void RenderSelection(CCore *Core,Vector3 &ThisCam){};
|
void RenderSelection(CCore *Core,Vector3 &ThisCam){};
|
||||||
|
|
||||||
void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos){};
|
void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos){};
|
||||||
void RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d){};
|
void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d){};
|
||||||
|
|
||||||
void GUIInit(CCore *Core);
|
void GUIInit(CCore *Core);
|
||||||
void GUIKill(CCore *Core);
|
void GUIKill(CCore *Core);
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
|
|
||||||
int GetWidth() {return(Width);}
|
int GetWidth() {return(Width);}
|
||||||
int GetHeight() {return(Height);}
|
int GetHeight() {return(Height);}
|
||||||
BOOL Resize(int _Width,int _Height);
|
bool Resize(int _Width,int _Height);
|
||||||
|
|
||||||
void Load(CFile *File,int Version);
|
void Load(CFile *File,int Version);
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
|
@ -49,15 +49,13 @@ public:
|
||||||
void Export(CCore *Core,CExport &Exp);
|
void Export(CCore *Core,CExport &Exp);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
BOOL SetMode(int NewMode) {return(false);}
|
// bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag) {return(false);}
|
||||||
BOOL InitMode() {return(false);}
|
// bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag) {return(false);}
|
||||||
BOOL ExitMode() {return(false);}
|
// bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos) {return(false);}
|
||||||
BOOL LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,BOOL DownFlag) {return(false);}
|
// bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0){};
|
||||||
BOOL RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,BOOL DownFlag) {return(false);}
|
|
||||||
BOOL MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos) {return(false);}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,bool Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
||||||
|
|
||||||
int Width,Height;
|
int Width,Height;
|
||||||
int SubType;
|
int SubType;
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "MapEditView.h"
|
#include "MapEditView.h"
|
||||||
#include "MainFrm.h"
|
#include "MainFrm.h"
|
||||||
|
|
||||||
|
#include "TileSet.h"
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "LayerTile.h"
|
#include "LayerTile.h"
|
||||||
|
@ -28,6 +30,12 @@
|
||||||
CLayerTile::CLayerTile(int _SubType,int Width,int Height)
|
CLayerTile::CLayerTile(int _SubType,int Width,int Height)
|
||||||
{
|
{
|
||||||
SubType=_SubType;
|
SubType=_SubType;
|
||||||
|
TileBank=0;
|
||||||
|
if (SubType==LAYER_SUBTYPE_ACTION)
|
||||||
|
TileBank=new CTileBank;
|
||||||
|
else
|
||||||
|
TileBank=0;
|
||||||
|
SubView=TileBank;
|
||||||
|
|
||||||
SetDefaultParams();
|
SetDefaultParams();
|
||||||
|
|
||||||
|
@ -48,6 +56,7 @@ CLayerTile::CLayerTile(int _SubType,int Width,int Height)
|
||||||
if (Height<TileLayerMinHeight) Height=TileLayerMinHeight;
|
if (Height<TileLayerMinHeight) Height=TileLayerMinHeight;
|
||||||
|
|
||||||
Map.SetSize(Width,Height,TRUE);
|
Map.SetSize(Width,Height,TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -60,6 +69,7 @@ CLayerTile::CLayerTile(CFile *File,int Version)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CLayerTile::~CLayerTile()
|
CLayerTile::~CLayerTile()
|
||||||
{
|
{
|
||||||
|
if (SubType==LAYER_SUBTYPE_ACTION) delete TileBank;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -73,9 +83,13 @@ void CLayerTile::Load(CFile *File,int Version)
|
||||||
File->Read(&SubType,sizeof(int));
|
File->Read(&SubType,sizeof(int));
|
||||||
Map.Load(File,Version);
|
Map.Load(File,Version);
|
||||||
|
|
||||||
|
if (SubType==LAYER_SUBTYPE_ACTION)
|
||||||
|
TileBank=new CTileBank;
|
||||||
|
else
|
||||||
|
TileBank=0;
|
||||||
|
SubView=TileBank;
|
||||||
|
|
||||||
TRACE1("%s\t",GetName());
|
TRACE1("%s\t",GetName());
|
||||||
TRACE1("Scl:%g\t",ScaleFactor);
|
|
||||||
TRACE1("%i\n",VisibleFlag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -92,6 +106,18 @@ void CLayerTile::Save(CFile *File)
|
||||||
Map.Save(File);
|
Map.Save(File);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayerTile::InitSubView(CCore *Core)
|
||||||
|
{
|
||||||
|
// Fix up shared layers
|
||||||
|
if (!SubView)
|
||||||
|
{
|
||||||
|
SubView=Core->FindSubView(LAYER_SUBVIEW_TILEBANK);
|
||||||
|
}
|
||||||
|
TileBank=(CTileBank*)SubView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::CheckLayerSize(int Width,int Height)
|
void CLayerTile::CheckLayerSize(int Width,int Height)
|
||||||
{
|
{
|
||||||
|
@ -101,11 +127,10 @@ void CLayerTile::CheckLayerSize(int Width,int Height)
|
||||||
mexstr.Format("%s Layer Resized to Correct Size\nPlease re-save\n", GetName());
|
mexstr.Format("%s Layer Resized to Correct Size\nPlease re-save\n", GetName());
|
||||||
AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
|
AfxMessageBox(mexstr,MB_OK | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::Resize(int Width,int Height)
|
bool CLayerTile::Resize(int Width,int Height)
|
||||||
{
|
{
|
||||||
if (!ResizeFlag) return(FALSE); // Its a fixed size, so DONT DO IT!
|
if (!ResizeFlag) return(FALSE); // Its a fixed size, so DONT DO IT!
|
||||||
|
|
||||||
|
@ -125,7 +150,7 @@ int ThisHeight=Map.GetHeight();
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::Render(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
void CLayerTile::Render(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
{
|
{
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
|
|
||||||
|
@ -142,12 +167,11 @@ Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
void CLayerTile::RenderCursorPaint(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
{
|
{
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
CPoint &CursPos=Core->GetCursorPos();
|
CPoint &CursPos=Core->GetCursorPos();
|
||||||
CMap &Brush=TileBank.GetActiveBrush();
|
CMap &Brush=TileBank->GetActiveBrush();
|
||||||
Vector3 Ofs;
|
Vector3 Ofs;
|
||||||
|
|
||||||
if (!Brush.IsValid()) return;
|
if (!Brush.IsValid()) return;
|
||||||
|
@ -172,7 +196,7 @@ Vector3 Ofs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::Render(CCore *Core,Vector3 &ThisCam,CMap &ThisMap,BOOL Render3d,float Alpha,Vector3 *Ofs)
|
void CLayerTile::Render(CCore *Core,Vector3 &ThisCam,CMap &ThisMap,bool Render3d,float Alpha,Vector3 *Ofs)
|
||||||
{
|
{
|
||||||
int MapWidth=ThisMap.GetWidth();
|
int MapWidth=ThisMap.GetWidth();
|
||||||
int MapHeight=ThisMap.GetHeight();
|
int MapHeight=ThisMap.GetHeight();
|
||||||
|
@ -181,7 +205,7 @@ float ZoomH=Core->GetZoomH();
|
||||||
float ScrOfsX=(ZoomW/2);
|
float ScrOfsX=(ZoomW/2);
|
||||||
float ScrOfsY=(ZoomH/2);
|
float ScrOfsY=(ZoomH/2);
|
||||||
Vector3 &Scale=Core->GetScaleVector();
|
Vector3 &Scale=Core->GetScaleVector();
|
||||||
|
bool WrapMap=SubType==LAYER_SUBTYPE_BACK;
|
||||||
int StartX=(int)ThisCam.x;
|
int StartX=(int)ThisCam.x;
|
||||||
int StartY=(int)ThisCam.y;
|
int StartY=(int)ThisCam.y;
|
||||||
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
||||||
|
@ -209,14 +233,27 @@ int DrawH=ZoomH+8;
|
||||||
glTranslatef(-Ofs->x,Ofs->y,0); // Set scroll offset
|
glTranslatef(-Ofs->x,Ofs->y,0); // Set scroll offset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (WrapMap)
|
||||||
|
{
|
||||||
|
DrawW=MapWidth;
|
||||||
|
DrawH=MapHeight;
|
||||||
|
}
|
||||||
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
||||||
{
|
{
|
||||||
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
||||||
{
|
{
|
||||||
sMapElem &ThisElem=ThisMap.Get(StartX+XLoop,StartY+YLoop);
|
int XPos=StartX+XLoop;
|
||||||
if (ThisElem.Tile && Core->IsTileValid(ThisElem.Set,ThisElem.Tile))
|
int YPos=StartY+YLoop;
|
||||||
|
if (WrapMap)
|
||||||
|
{
|
||||||
|
XPos%=MapWidth;
|
||||||
|
YPos%=MapHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
sMapElem &ThisElem=ThisMap.Get(XPos,YPos);
|
||||||
|
if (ThisElem.Tile && TileBank->IsTileValid(ThisElem.Set,ThisElem.Tile))
|
||||||
{ // Render Non Zero Tiles
|
{ // Render Non Zero Tiles
|
||||||
CTile &ThisTile=Core->GetTile(ThisElem.Set,ThisElem.Tile);
|
CTile &ThisTile=TileBank->GetTile(ThisElem.Set,ThisElem.Tile);
|
||||||
|
|
||||||
glColor4f(1,1,1,Alpha); // Set default Color
|
glColor4f(1,1,1,Alpha); // Set default Color
|
||||||
ThisTile.Render(ThisElem.Flags,Render3d);
|
ThisTile.Render(ThisElem.Flags,Render3d);
|
||||||
|
@ -263,7 +300,7 @@ float Y1=Rect.bottom-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active)
|
void CLayerTile::RenderGrid(CCore *Core,Vector3 &CamPos,bool Active)
|
||||||
{
|
{
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
int MapWidth=Map.GetWidth();
|
int MapWidth=Map.GetWidth();
|
||||||
|
@ -357,11 +394,26 @@ int DrawH=ZoomH+8;
|
||||||
glTranslatef(-ShiftX,ShiftY,0);
|
glTranslatef(-ShiftX,ShiftY,0);
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
||||||
|
|
||||||
|
bool WrapMap=SubType==LAYER_SUBTYPE_BACK;
|
||||||
|
if (WrapMap)
|
||||||
|
{
|
||||||
|
DrawW=MapWidth;
|
||||||
|
DrawH=MapHeight;
|
||||||
|
}
|
||||||
|
|
||||||
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
||||||
{
|
{
|
||||||
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
||||||
{
|
{
|
||||||
TileID=(XLoop+StartX)+(((YLoop+StartY)*MapWidth));
|
int XPos=StartX+XLoop;
|
||||||
|
int YPos=StartY+YLoop;
|
||||||
|
if (WrapMap)
|
||||||
|
{
|
||||||
|
XPos%=MapWidth;
|
||||||
|
YPos%=MapHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
TileID=(XPos)+(((YPos)*MapWidth));
|
||||||
glLoadName (TileID);
|
glLoadName (TileID);
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
BuildGLQuad(XLoop,XLoop+1,-YLoop,-YLoop+1,0);
|
BuildGLQuad(XLoop,XLoop+1,-YLoop,-YLoop+1,0);
|
||||||
|
@ -393,14 +445,14 @@ GLuint *HitPtr=SelectBuffer;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::GUIInit(CCore *Core)
|
void CLayerTile::GUIInit(CCore *Core)
|
||||||
{
|
{
|
||||||
Core->TileBankGUIInit();
|
TileBank->GUIInit(Core);
|
||||||
Core->GUIAdd(ToolBarGUI,IDD_LAYERTILE_TOOLBAR);
|
Core->GUIAdd(ToolBarGUI,IDD_LAYERTILE_TOOLBAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::GUIKill(CCore *Core)
|
void CLayerTile::GUIKill(CCore *Core)
|
||||||
{
|
{
|
||||||
Core->TileBankGUIKill();
|
TileBank->GUIKill(Core);
|
||||||
Core->GUIRemove(ToolBarGUI,IDD_LAYERTILE_TOOLBAR);
|
Core->GUIRemove(ToolBarGUI,IDD_LAYERTILE_TOOLBAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,8 +471,7 @@ void CLayerTile::GUIUpdate(CCore *Core)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
TileBank->GUIUpdate(Core);
|
||||||
Core->TileBankGUIUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -431,58 +482,15 @@ void CLayerTile::GUIChanged(CCore *Core)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Functions ***************************************************************/
|
/*** Functions ***************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::SetMode(int NewMode)
|
bool CLayerTile::LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
||||||
{
|
{
|
||||||
BOOL Ret=FALSE;
|
bool Ret=false;
|
||||||
|
|
||||||
// Clean up last mode
|
|
||||||
Ret|=ExitMode();
|
|
||||||
Mode=(MouseMode)NewMode;
|
|
||||||
Ret|=InitMode();
|
|
||||||
return(Ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::InitMode()
|
|
||||||
{
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::ExitMode()
|
|
||||||
{
|
|
||||||
switch(Mode)
|
|
||||||
{
|
|
||||||
case MouseModePaint:
|
|
||||||
break;
|
|
||||||
case MouseModeSelect:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
BOOL CLayerTile::LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)
|
|
||||||
{
|
|
||||||
BOOL Ret=FALSE;
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
case MouseModePaint:
|
case MouseModePaint:
|
||||||
if (DownFlag)
|
if (DownFlag)
|
||||||
Ret=Paint(TileBank.GetLBrush(),CursorPos);
|
Ret=Paint(TileBank->GetLBrush(),CursorPos);
|
||||||
break;
|
break;
|
||||||
case MouseModeSelect:
|
case MouseModeSelect:
|
||||||
Ret=Selection.Handle(CursorPos,nFlags);
|
Ret=Selection.Handle(CursorPos,nFlags);
|
||||||
|
@ -498,16 +506,15 @@ CTileBank &TileBank=Core->GetTileBank();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,BOOL DownFlag)
|
bool CLayerTile::RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
||||||
{
|
{
|
||||||
BOOL Ret=FALSE;
|
bool Ret=FALSE;
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
case MouseModePaint:
|
case MouseModePaint:
|
||||||
if (DownFlag)
|
if (DownFlag)
|
||||||
Ret=Paint(TileBank.GetRBrush(),CursorPos);
|
Ret=Paint(TileBank->GetRBrush(),CursorPos);
|
||||||
break;
|
break;
|
||||||
case MouseModeSelect:
|
case MouseModeSelect:
|
||||||
Ret=Selection.Handle(CursorPos,nFlags);
|
Ret=Selection.Handle(CursorPos,nFlags);
|
||||||
|
@ -523,19 +530,18 @@ CTileBank &TileBank=Core->GetTileBank();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos)
|
bool CLayerTile::MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos)
|
||||||
{
|
{
|
||||||
BOOL Ret=FALSE;
|
bool Ret=FALSE;
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
|
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
case MouseModePaint:
|
case MouseModePaint:
|
||||||
if (nFlags & MK_LBUTTON)
|
if (nFlags & MK_LBUTTON)
|
||||||
Ret=Paint(TileBank.GetLBrush(),CursorPos);
|
Ret=Paint(TileBank->GetLBrush(),CursorPos);
|
||||||
else
|
else
|
||||||
if (nFlags & MK_RBUTTON)
|
if (nFlags & MK_RBUTTON)
|
||||||
Ret=Paint(TileBank.GetRBrush(),CursorPos);
|
Ret=Paint(TileBank->GetRBrush(),CursorPos);
|
||||||
break;
|
break;
|
||||||
case MouseModeSelect:
|
case MouseModeSelect:
|
||||||
Ret=Selection.Handle(CursorPos,nFlags);
|
Ret=Selection.Handle(CursorPos,nFlags);
|
||||||
|
@ -547,7 +553,45 @@ CTileBank &TileBank=Core->GetTileBank();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTile::RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
bool CLayerTile::Command(int CmdMsg,CCore *Core,int Param0,int Param1)
|
||||||
|
{
|
||||||
|
bool Ret=false;
|
||||||
|
switch(CmdMsg)
|
||||||
|
{
|
||||||
|
case CmdMsg_SetMode:
|
||||||
|
Mode=(MouseMode)Param0;
|
||||||
|
Core->GUIUpdate();
|
||||||
|
break;
|
||||||
|
case CmdMsg_Copy:
|
||||||
|
CopySelection(Core);
|
||||||
|
break;
|
||||||
|
case CmdMsg_Paste:
|
||||||
|
PasteSelection(Core);
|
||||||
|
break;
|
||||||
|
case CmdMsg_MirrorX:
|
||||||
|
Ret=MirrorX(Core);
|
||||||
|
break;
|
||||||
|
case CmdMsg_MirrorY:
|
||||||
|
Ret=MirrorY(Core);
|
||||||
|
break;
|
||||||
|
case CmdMsg_SetColFlag:
|
||||||
|
Ret=SetColFlags(Core,Param0);
|
||||||
|
break;
|
||||||
|
case CmdMsg_SubViewLoad:
|
||||||
|
case CmdMsg_SubViewDelete:
|
||||||
|
case CmdMsg_SubViewUpdate:
|
||||||
|
case CmdMsg_SubViewSet:
|
||||||
|
case CmdMsg_ActiveBrushLeft:
|
||||||
|
case CmdMsg_ActiveBrushRight:
|
||||||
|
Ret=TileBank->Command(CmdMsg,Core,Param0,Param1);
|
||||||
|
default:
|
||||||
|
TRACE3("LayerTile-Unhandled Command %i (%i,%i)\n",CmdMsg,Param0,Param1);
|
||||||
|
}
|
||||||
|
return(Ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayerTile::RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
{
|
{
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
|
@ -563,16 +607,14 @@ void CLayerTile::RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::MirrorX(CCore *Core)
|
bool CLayerTile::MirrorX(CCore *Core)
|
||||||
{
|
{
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
case MouseModePaint:
|
case MouseModePaint:
|
||||||
{
|
{
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
TileBank->GetLBrush().MirrorX(PC_TILE_FLAG_MIRROR_X);
|
||||||
|
TileBank->GetRBrush().MirrorX(PC_TILE_FLAG_MIRROR_X);
|
||||||
TileBank.GetLBrush().MirrorX(PC_TILE_FLAG_MIRROR_X);
|
|
||||||
TileBank.GetRBrush().MirrorX(PC_TILE_FLAG_MIRROR_X);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MouseModeSelect:
|
case MouseModeSelect:
|
||||||
|
@ -585,21 +627,20 @@ BOOL CLayerTile::MirrorX(CCore *Core)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Core->UpdateView();
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::MirrorY(CCore *Core)
|
bool CLayerTile::MirrorY(CCore *Core)
|
||||||
{
|
{
|
||||||
|
// if (GetType()==LAYER_TYPE_COLLISION) return(false);
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
case MouseModePaint:
|
case MouseModePaint:
|
||||||
{
|
{
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
TileBank->GetLBrush().MirrorY(PC_TILE_FLAG_MIRROR_Y);
|
||||||
|
TileBank->GetRBrush().MirrorY(PC_TILE_FLAG_MIRROR_Y);
|
||||||
TileBank.GetLBrush().MirrorY(PC_TILE_FLAG_MIRROR_Y);
|
|
||||||
TileBank.GetRBrush().MirrorY(PC_TILE_FLAG_MIRROR_Y);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MouseModeSelect:
|
case MouseModeSelect:
|
||||||
|
@ -612,22 +653,19 @@ BOOL CLayerTile::MirrorY(CCore *Core)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Core->UpdateView();
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::SetColFlags(CCore *Core,int Flags)
|
bool CLayerTile::SetColFlags(CCore *Core,int Flags)
|
||||||
{
|
{
|
||||||
switch(Mode)
|
switch(Mode)
|
||||||
{
|
{
|
||||||
case MouseModePaint:
|
case MouseModePaint:
|
||||||
{
|
{
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
TileBank->GetLBrush().SetFlags(Flags<<PC_TILE_FLAG_COLLISION_SHIFT,PC_TILE_FLAG_MIRROR_XY);
|
||||||
|
TileBank->GetRBrush().SetFlags(Flags<<PC_TILE_FLAG_COLLISION_SHIFT,PC_TILE_FLAG_MIRROR_XY);
|
||||||
TileBank.GetLBrush().SetFlags(Flags<<PC_TILE_FLAG_COLLISION_SHIFT,PC_TILE_FLAG_MIRROR_XY);
|
|
||||||
TileBank.GetRBrush().SetFlags(Flags<<PC_TILE_FLAG_COLLISION_SHIFT,PC_TILE_FLAG_MIRROR_XY);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MouseModeSelect:
|
case MouseModeSelect:
|
||||||
|
@ -645,30 +683,28 @@ BOOL CLayerTile::SetColFlags(CCore *Core,int Flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::CopySelection(CCore *Core)
|
bool CLayerTile::CopySelection(CCore *Core)
|
||||||
{
|
{
|
||||||
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
||||||
if (!Selection.IsValid()) return(false); // No Selection
|
if (!Selection.IsValid()) return(false); // No Selection
|
||||||
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
CRect Rect=Selection.GetRect();
|
CRect Rect=Selection.GetRect();
|
||||||
|
|
||||||
TileBank.GetActiveBrush().Set(Map,Rect.left,Rect.top,Rect.Width(),Rect.Height());
|
TileBank->GetActiveBrush().Set(Map,Rect.left,Rect.top,Rect.Width(),Rect.Height());
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CLayerTile::PasteSelection(CCore *Core)
|
bool CLayerTile::PasteSelection(CCore *Core)
|
||||||
{
|
{
|
||||||
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
||||||
if (!Selection.IsValid()) return(false); // No Selection
|
if (!Selection.IsValid()) return(false); // No Selection
|
||||||
|
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
CRect Rect=Selection.GetRect();
|
CRect Rect=Selection.GetRect();
|
||||||
|
|
||||||
Map.Paste(TileBank.GetActiveBrush(),&Rect);
|
Map.Paste(TileBank->GetActiveBrush(),&Rect);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,7 +712,7 @@ CRect Rect=Selection.GetRect();
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
BOOL CLayerTile::Paint(CMap &Blk,CPoint &CursorPos)
|
bool CLayerTile::Paint(CMap &Blk,CPoint &CursorPos)
|
||||||
{
|
{
|
||||||
if (CursorPos.y==-1 || CursorPos.y==-1) return(FALSE); // Off Map?
|
if (CursorPos.y==-1 || CursorPos.y==-1) return(FALSE); // Off Map?
|
||||||
if (!Blk.IsValid()) return(FALSE); // Invalid tile?
|
if (!Blk.IsValid()) return(FALSE); // Invalid tile?
|
||||||
|
@ -691,7 +727,6 @@ void CLayerTile::Export(CCore *Core,CExport &Exp)
|
||||||
{
|
{
|
||||||
int Width=Map.GetWidth();
|
int Width=Map.GetWidth();
|
||||||
int Height=Map.GetHeight();
|
int Height=Map.GetHeight();
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
|
||||||
sExpTile BlankElem={0,0,0,0};
|
sExpTile BlankElem={0,0,0,0};
|
||||||
|
|
||||||
Exp.ExportLayerHeader(LAYER_TYPE_TILE,SubType,Width,Height);
|
Exp.ExportLayerHeader(LAYER_TYPE_TILE,SubType,Width,Height);
|
||||||
|
@ -703,7 +738,7 @@ sExpTile BlankElem={0,0,0,0};
|
||||||
for (int X=0; X<Width; X++)
|
for (int X=0; X<Width; X++)
|
||||||
{
|
{
|
||||||
sMapElem &MapElem=Map.Get(X,Y);
|
sMapElem &MapElem=Map.Get(X,Y);
|
||||||
CTile &ThisTile=Core->GetTile(MapElem.Set,MapElem.Tile);
|
CTile &ThisTile=TileBank->GetTile(MapElem.Set,MapElem.Tile);
|
||||||
sExpLayerTile OutElem;
|
sExpLayerTile OutElem;
|
||||||
sExpTile OutTile;
|
sExpTile OutTile;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CCore;
|
class CCore;
|
||||||
|
class CTileBank;
|
||||||
class CLayerTile : public CLayer
|
class CLayerTile : public CLayer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -28,13 +29,14 @@ public:
|
||||||
|
|
||||||
int GetType() {return(LAYER_TYPE_TILE);}
|
int GetType() {return(LAYER_TYPE_TILE);}
|
||||||
int GetSubType() {return(SubType);}
|
int GetSubType() {return(SubType);}
|
||||||
|
void InitSubView(CCore *Core);
|
||||||
|
|
||||||
virtual void Render(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
virtual void Render(CCore *Core,Vector3 &CamPos,bool Is3d);
|
||||||
virtual void RenderGrid(CCore *Core,Vector3 &CamPos,BOOL Active);
|
virtual void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active);
|
||||||
virtual void RenderSelection(CCore *Core,Vector3 &ThisCam);
|
virtual void RenderSelection(CCore *Core,Vector3 &ThisCam);
|
||||||
|
|
||||||
void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos);
|
void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos);
|
||||||
void RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d);
|
||||||
|
|
||||||
virtual void GUIInit(CCore *Core);
|
virtual void GUIInit(CCore *Core);
|
||||||
virtual void GUIKill(CCore *Core);
|
virtual void GUIKill(CCore *Core);
|
||||||
|
@ -43,7 +45,7 @@ virtual void GUIChanged(CCore *Core);
|
||||||
|
|
||||||
int GetWidth() {return(Map.GetWidth());}
|
int GetWidth() {return(Map.GetWidth());}
|
||||||
int GetHeight() {return(Map.GetHeight());}
|
int GetHeight() {return(Map.GetHeight());}
|
||||||
BOOL Resize(int Width,int Height);
|
bool Resize(int Width,int Height);
|
||||||
|
|
||||||
void Load(CFile *File,int Version);
|
void Load(CFile *File,int Version);
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
|
@ -52,35 +54,35 @@ virtual void GUIChanged(CCore *Core);
|
||||||
void Export(CCore *Core,CExport &Exp);
|
void Export(CCore *Core,CExport &Exp);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
BOOL SetMode(int NewMode);
|
virtual bool LButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag);
|
||||||
BOOL InitMode();
|
virtual bool RButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag);
|
||||||
BOOL ExitMode();
|
virtual bool MouseMove(CCore *Core,UINT nFlags, CPoint &point);
|
||||||
|
virtual bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0);
|
||||||
|
|
||||||
BOOL LButtonControl(CCore *Core,UINT nFlags, CPoint &point,BOOL DownFlag);
|
bool MirrorX(CCore *Core);
|
||||||
BOOL RButtonControl(CCore *Core,UINT nFlags, CPoint &point,BOOL DownFlag);
|
bool MirrorY(CCore *Core);
|
||||||
BOOL MouseMove(CCore *Core,UINT nFlags, CPoint &point);
|
bool SetColFlags(CCore *Core,int Flags);
|
||||||
|
|
||||||
BOOL MirrorX(CCore *Core);
|
bool CopySelection(CCore *Core);
|
||||||
BOOL MirrorY(CCore *Core);
|
bool PasteSelection(CCore *Core);
|
||||||
BOOL SetColFlags(CCore *Core,int Flags);
|
|
||||||
|
|
||||||
BOOL CopySelection(CCore *Core);
|
|
||||||
BOOL PasteSelection(CCore *Core);
|
|
||||||
|
|
||||||
|
// Local
|
||||||
|
CTileBank *GetTileBank() {return(TileBank);}
|
||||||
void DeleteSet(int Set);
|
void DeleteSet(int Set);
|
||||||
void RemapSet(int OrigSet,int NewSet);
|
void RemapSet(int OrigSet,int NewSet);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,BOOL Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,bool Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
||||||
void RenderCursorPaint(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
void RenderCursorPaint(CCore *Core,Vector3 &CamPos,bool Is3d);
|
||||||
|
|
||||||
BOOL Paint(CMap &Blk,CPoint &CursorPos);
|
bool Paint(CMap &Blk,CPoint &CursorPos);
|
||||||
|
|
||||||
CMap Map;
|
CMap Map;
|
||||||
int SubType;
|
int SubType;
|
||||||
MouseMode Mode;
|
MouseMode Mode;
|
||||||
|
|
||||||
|
CTileBank *TileBank;
|
||||||
|
|
||||||
CLayerTileToolbar ToolBarGUI;
|
CLayerTileToolbar ToolBarGUI;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,18 +26,18 @@ Class14=CMultiBar
|
||||||
Class15=CNewMapGUI
|
Class15=CNewMapGUI
|
||||||
|
|
||||||
ResourceCount=13
|
ResourceCount=13
|
||||||
Resource1=IDD_MULTIBAR (English (U.S.))
|
Resource1=IDD_ADDLAYER
|
||||||
Resource2=IDR_MAINFRAME (English (U.S.))
|
Resource2=IDD_MAPSIZE
|
||||||
Resource3=IDR_MAPEDITYPE (English (U.S.))
|
Resource3=IDR_MAPEDITYPE (English (U.S.))
|
||||||
Resource4=IDD_ABOUTBOX (English (U.S.))
|
Resource4=IDD_NEWMAP
|
||||||
Resource5=IDD_LAYER_LIST_DIALOG
|
Resource5=IDD_LAYERTILE_GUI
|
||||||
Resource6=IDD_ADDLAYER
|
Resource6=IDR_TOOLBAR (English (U.S.))
|
||||||
Resource7=IDD_NEWMAP
|
Resource7=IDD_LAYERSHADE_GUI
|
||||||
Resource8=IDD_LAYERTILE_GUI
|
Resource8=IDR_MAINFRAME (English (U.S.))
|
||||||
Resource9=IDD_LAYERTILE_TOOLBAR
|
Resource9=IDD_ABOUTBOX (English (U.S.))
|
||||||
Resource10=IDD_LAYERSHADE_GUI
|
Resource10=IDD_MULTIBAR (English (U.S.))
|
||||||
Resource11=IDR_TOOLBAR (English (U.S.))
|
Resource11=IDD_LAYER_LIST_DIALOG
|
||||||
Resource12=IDD_MAPSIZE
|
Resource12=IDD_LAYERTILE_TOOLBAR
|
||||||
Class16=CLayerCollisionGUI
|
Class16=CLayerCollisionGUI
|
||||||
Resource13=IDD_LAYERCOLLISION_GUI
|
Resource13=IDD_LAYERCOLLISION_GUI
|
||||||
|
|
||||||
|
@ -349,5 +349,5 @@ ImplementationFile=layercollisiongui.cpp
|
||||||
BaseClass=CDialog
|
BaseClass=CDialog
|
||||||
Filter=D
|
Filter=D
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
LastObject=IDC_LAYERCOLLISION_DAMAGE
|
LastObject=CLayerCollisionGUI
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
|
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
|
||||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
# ADD CPP /nologo /G6 /MD /W3 /Gi /GX /O2 /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL"
|
# ADD BASE RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL"
|
||||||
|
@ -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 /out:"..\..\tools\MapEdit\MapEdit.exe" /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 /incremental:yes /machine:I386 /out:"..\..\tools\MapEdit\MapEdit.exe" /libpath:"..\libs\ginlib\release\\" /libpath:"..\libs\glib\release\\" /libpath:"..\libs\maths\release\\"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "MapEdit - Win32 Debug"
|
!ELSEIF "$(CFG)" == "MapEdit - Win32 Debug"
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ LINK32=link.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
|
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /Gi- /GX /ZI /Od /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"
|
# ADD BASE RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"
|
||||||
|
@ -148,6 +148,10 @@ SOURCE=.\ExportHdr.h
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\CmdMsg.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\Core.cpp
|
SOURCE=.\Core.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "resource.h" // main symbols
|
#include "resource.h" // main symbols
|
||||||
|
#include "CmdMsg.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CMapEditApp:
|
// CMapEditApp:
|
||||||
|
|
|
@ -132,7 +132,7 @@ BEGIN
|
||||||
MENUITEM "View Left Brush", ID_ACTIVEBRUSH_LEFT
|
MENUITEM "View Left Brush", ID_ACTIVEBRUSH_LEFT
|
||||||
MENUITEM "View Right Brush", ID_ACTIVEBRUSH_RIGHT
|
MENUITEM "View Right Brush", ID_ACTIVEBRUSH_RIGHT
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "&Toggle TileView", ID_TOGGLE_TILEVIEW
|
MENUITEM "&Toggle SubView", ID_TOGGLE_SUBVIEW
|
||||||
END
|
END
|
||||||
POPUP "Misc"
|
POPUP "Misc"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -176,7 +176,7 @@ BEGIN
|
||||||
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
|
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
|
||||||
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||||
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
|
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
|
||||||
VK_SPACE, ID_TOGGLE_TILEVIEW, VIRTKEY, NOINVERT
|
VK_SPACE, ID_TOGGLE_SUBVIEW, VIRTKEY, NOINVERT
|
||||||
VK_SUBTRACT, ID_ZOOM_OUT, VIRTKEY, NOINVERT
|
VK_SUBTRACT, ID_ZOOM_OUT, VIRTKEY, NOINVERT
|
||||||
VK_TAB, ID_NEXT_PANE, VIRTKEY, CONTROL, NOINVERT
|
VK_TAB, ID_NEXT_PANE, VIRTKEY, CONTROL, NOINVERT
|
||||||
VK_TAB, ID_PREV_PANE, VIRTKEY, SHIFT, CONTROL,
|
VK_TAB, ID_PREV_PANE, VIRTKEY, SHIFT, CONTROL,
|
||||||
|
@ -425,7 +425,7 @@ END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
ID_TOGGLE_TILEVIEW "Toggle TileView"
|
ID_TOGGLE_SUBVIEW "Toggle SubView"
|
||||||
ID_MAP_TOGGLEGRID "Toggle Grid On and Off"
|
ID_MAP_TOGGLEGRID "Toggle Grid On and Off"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ BEGIN_MESSAGE_MAP(CMapEditDoc, CDocument)
|
||||||
ON_COMMAND(ID_EXPORT, OnExport)
|
ON_COMMAND(ID_EXPORT, OnExport)
|
||||||
ON_COMMAND(ID_ZOOM_IN, OnZoomIn)
|
ON_COMMAND(ID_ZOOM_IN, OnZoomIn)
|
||||||
ON_COMMAND(ID_ZOOM_OUT, OnZoomOut)
|
ON_COMMAND(ID_ZOOM_OUT, OnZoomOut)
|
||||||
ON_COMMAND(ID_TOGGLE_TILEVIEW, OnToggleTileview)
|
ON_COMMAND(ID_TOGGLE_SUBVIEW, OnToggleSubView)
|
||||||
ON_COMMAND(ID_TOOLBAR_GRID, OnToggleGrid)
|
ON_COMMAND(ID_TOOLBAR_GRID, OnToggleGrid)
|
||||||
ON_COMMAND(ID_MIRRORX, OnMirrorx)
|
ON_COMMAND(ID_MIRRORX, OnMirrorx)
|
||||||
ON_COMMAND(ID_MIRRORY, OnMirrory)
|
ON_COMMAND(ID_MIRRORY, OnMirrory)
|
||||||
|
@ -35,7 +35,7 @@ BEGIN_MESSAGE_MAP(CMapEditDoc, CDocument)
|
||||||
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
|
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
|
||||||
ON_COMMAND(ID_2D_3D_TOGGLE, On2d3dToggle)
|
ON_COMMAND(ID_2D_3D_TOGGLE, On2d3dToggle)
|
||||||
ON_COMMAND(ID_RESET_VIEW, OnResetView)
|
ON_COMMAND(ID_RESET_VIEW, OnResetView)
|
||||||
ON_COMMAND(ID_TOOLBAR_TILEPALETTE, OnToggleTileview)
|
ON_COMMAND(ID_TOOLBAR_TILEPALETTE, OnToggleSubView)
|
||||||
ON_COMMAND(ID_TOGGLE_GRID, OnToggleGrid)
|
ON_COMMAND(ID_TOGGLE_GRID, OnToggleGrid)
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
@ -111,10 +111,8 @@ void CMapEditDoc::Dump(CDumpContext& dc) const
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void CMapEditDoc::SetView(CMapEditView *View)
|
void CMapEditDoc::SetView(CMapEditView *View)
|
||||||
{
|
{
|
||||||
//CMapEditView *LastView=Core.GetView();
|
|
||||||
Core.SetView(View);
|
Core.SetView(View);
|
||||||
// if (LastView!=View)
|
UpdateView();
|
||||||
UpdateView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
@ -171,55 +169,33 @@ void CMapEditDoc::GUIChanged()
|
||||||
/*** Windows Message Handlers ****************************************************/
|
/*** Windows Message Handlers ****************************************************/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void CMapEditDoc::LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag) {Core.LButtonControl(nFlags,point,DownFlag);}
|
void CMapEditDoc::LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag) {Core.LButtonControl(nFlags,point,DownFlag!=0);}
|
||||||
void CMapEditDoc::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag) {Core.MButtonControl(nFlags,point,DownFlag);}
|
void CMapEditDoc::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag) {Core.MButtonControl(nFlags,point,DownFlag!=0);}
|
||||||
void CMapEditDoc::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag) {Core.RButtonControl(nFlags,point,DownFlag);}
|
void CMapEditDoc::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag) {Core.RButtonControl(nFlags,point,DownFlag!=0);}
|
||||||
void CMapEditDoc::MouseWheel(UINT nFlags, short zDelta, CPoint &point) {Core.MouseWheel(nFlags,zDelta,point);}
|
void CMapEditDoc::MouseWheel(UINT nFlags, short zDelta, CPoint &point) {Core.MouseWheel(nFlags,zDelta,point);}
|
||||||
void CMapEditDoc::MouseMove(UINT nFlags, CPoint &point) {Core.MouseMove(nFlags,point);}
|
void CMapEditDoc::MouseMove(UINT nFlags, CPoint &point) {Core.MouseMove(nFlags,point);}
|
||||||
|
|
||||||
void CMapEditDoc::OnToggleTileview() {Core.UpdateTileView(true); FocusView();}
|
void CMapEditDoc::OnToggleSubView() {Command(CmdMsg_ToggleSubView);}
|
||||||
void CMapEditDoc::OnToggleGrid() {Core.UpdateGrid(TRUE); FocusView();}
|
void CMapEditDoc::OnToggleGrid() {Command(CmdMsg_ToggleGrid);}
|
||||||
void CMapEditDoc::OnMirrorx() {Core.MirrorX(); FocusView();}
|
void CMapEditDoc::On2d3dToggle() {Command(CmdMsg_Toggle2d);}
|
||||||
void CMapEditDoc::OnMirrory() {Core.MirrorY();FocusView();}
|
|
||||||
void CMapEditDoc::OnEditCopy() {Core.CopySelection(); FocusView();}
|
|
||||||
void CMapEditDoc::OnEditPaste() {Core.PasteSelection(); FocusView(); }
|
|
||||||
void CMapEditDoc::OnActivebrushLeft() {Core.ActiveBrushLeft();}
|
|
||||||
void CMapEditDoc::OnActivebrushRight() {Core.ActiveBrushRight();}
|
|
||||||
void CMapEditDoc::On2d3dToggle() {Core.Toggle2d3d();}
|
|
||||||
void CMapEditDoc::OnZoomIn() {Core.Zoom(-0.1f); UpdateView();}
|
|
||||||
void CMapEditDoc::OnZoomOut() {Core.Zoom(+0.1f); UpdateView();}
|
|
||||||
void CMapEditDoc::OnResetView() {Core.ResetView();}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
void CMapEditDoc::OnZoomIn() {Command(CmdMsg_ZoomIn);}
|
||||||
/*********************************************************************************/
|
void CMapEditDoc::OnZoomOut() {Command(CmdMsg_ZoomOut);}
|
||||||
/*********************************************************************************/
|
void CMapEditDoc::OnResetView() {Command(CmdMsg_ResetView);}
|
||||||
void CMapEditDoc::SetMode(int NewMode)
|
|
||||||
|
void CMapEditDoc::OnMirrorx() {Command(CmdMsg_MirrorX);}
|
||||||
|
void CMapEditDoc::OnMirrory() {Command(CmdMsg_MirrorY);}
|
||||||
|
void CMapEditDoc::OnEditCopy() {Command(CmdMsg_Copy);}
|
||||||
|
void CMapEditDoc::OnEditPaste() {Command(CmdMsg_Paste);}
|
||||||
|
void CMapEditDoc::OnActivebrushLeft() {Command(CmdMsg_ActiveBrushLeft);}
|
||||||
|
void CMapEditDoc::OnActivebrushRight() {Command(CmdMsg_ActiveBrushRight);}
|
||||||
|
|
||||||
|
void CMapEditDoc::Command(int CmdMsg,int Param0,int Param1)
|
||||||
{
|
{
|
||||||
Core.SetMode(NewMode);
|
Core.Command(CmdMsg,Param0,Param1);
|
||||||
Core.GUIUpdate();
|
FocusView();
|
||||||
FocusView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
void CMapEditDoc::SetLayer(int Layer)
|
|
||||||
{
|
|
||||||
Core.SetLayer(Layer);
|
|
||||||
FocusView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
void CMapEditDoc::AddLayer(int Layer)
|
|
||||||
{
|
|
||||||
Core.AddLayer(Layer);
|
|
||||||
FocusView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
void CMapEditDoc::DeleteLayer(int Layer)
|
|
||||||
{
|
|
||||||
Core.DeleteLayer(Layer);
|
|
||||||
FocusView();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
@ -240,6 +216,7 @@ char Filename[256];
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
/*** Tilebank Functions **********************************************************/
|
/*** Tilebank Functions **********************************************************/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
/*
|
||||||
void CMapEditDoc::TileBankLoad()
|
void CMapEditDoc::TileBankLoad()
|
||||||
{
|
{
|
||||||
char BASED_CODE GinFilter[]= "All Tile Files (*.Gin; *.Bmp)|*.gin;*.Bmp|3d Tile Files (*.Gin)|*.Gin|2d Tile Files (*.Bmp)|*.Bmp|All Files (*.*)|*.*||";
|
char BASED_CODE GinFilter[]= "All Tile Files (*.Gin; *.Bmp)|*.gin;*.Bmp|3d Tile Files (*.Gin)|*.Gin|2d Tile Files (*.Bmp)|*.Bmp|All Files (*.*)|*.*||";
|
||||||
|
@ -253,30 +230,34 @@ char Filename[256];
|
||||||
UpdateView();
|
UpdateView();
|
||||||
FocusView();
|
FocusView();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
/*
|
||||||
void CMapEditDoc::TileBankDelete()
|
void CMapEditDoc::TileBankDelete()
|
||||||
{
|
{
|
||||||
Core.TileBankDelete();
|
Core.TileBankDelete();
|
||||||
UpdateView();
|
UpdateView();
|
||||||
FocusView();
|
FocusView();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
/*
|
||||||
void CMapEditDoc::TileBankReload()
|
void CMapEditDoc::TileBankReload()
|
||||||
{
|
{
|
||||||
Core.TileBankReload();
|
Core.TileBankReload();
|
||||||
UpdateView();
|
UpdateView();
|
||||||
FocusView();
|
FocusView();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
/*
|
||||||
void CMapEditDoc::TileBankSet()
|
void CMapEditDoc::TileBankSet()
|
||||||
{
|
{
|
||||||
Core.TileBankSet();
|
Core.TileBankSet();
|
||||||
UpdateView();
|
UpdateView();
|
||||||
FocusView();
|
FocusView();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void CMapEditDoc::OnMapSetSize()
|
void CMapEditDoc::OnMapSetSize()
|
||||||
{
|
{
|
||||||
|
@ -298,9 +279,3 @@ void CMapEditDoc::FocusView()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void CMapEditDoc::SetColFlag(int Flag)
|
|
||||||
{
|
|
||||||
Core.SetColFlag(Flag);
|
|
||||||
FocusView();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -36,17 +36,8 @@ public:
|
||||||
void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
|
void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
|
||||||
void MouseMove(UINT nFlags, CPoint &point);
|
void MouseMove(UINT nFlags, CPoint &point);
|
||||||
|
|
||||||
void TileBankLoad();
|
void Command(int CmdMsg,int Param0=0,int Param1=0);
|
||||||
void TileBankDelete();
|
|
||||||
void TileBankReload();
|
|
||||||
void TileBankSet();
|
|
||||||
|
|
||||||
void SetMode(int NewMode);
|
|
||||||
void SetLayer(int Layer);
|
|
||||||
void AddLayer(int Layer);
|
|
||||||
void DeleteLayer(int Layer);
|
|
||||||
|
|
||||||
void SetColFlag(int Flag);
|
|
||||||
// Operations
|
// Operations
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -78,7 +69,7 @@ protected:
|
||||||
afx_msg void OnExport();
|
afx_msg void OnExport();
|
||||||
afx_msg void OnZoomIn();
|
afx_msg void OnZoomIn();
|
||||||
afx_msg void OnZoomOut();
|
afx_msg void OnZoomOut();
|
||||||
afx_msg void OnToggleTileview();
|
afx_msg void OnToggleSubView();
|
||||||
afx_msg void OnToggleGrid();
|
afx_msg void OnToggleGrid();
|
||||||
afx_msg void OnMirrorx();
|
afx_msg void OnMirrorx();
|
||||||
afx_msg void OnMirrory();
|
afx_msg void OnMirrory();
|
||||||
|
|
|
@ -63,6 +63,7 @@ char ExeFilename[2048];
|
||||||
SelEnd=-1;
|
SelEnd=-1;
|
||||||
TileSet.push_back(CTileSet(Filename,0));
|
TileSet.push_back(CTileSet(Filename,0));
|
||||||
LoadFlag=TRUE;
|
LoadFlag=TRUE;
|
||||||
|
VisibleFlag=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -190,7 +191,7 @@ int ListSize=TileSet.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CTileBank::Delete()
|
void CTileBank::DeleteCurrent()
|
||||||
{
|
{
|
||||||
int ListSize=TileSet.size();
|
int ListSize=TileSet.size();
|
||||||
// Remap Brushes
|
// Remap Brushes
|
||||||
|
@ -205,13 +206,12 @@ int ListSize=TileSet.size();
|
||||||
Brush[i].RemapSet(Set,Set);
|
Brush[i].RemapSet(Set,Set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TileSet.erase(TileSet.begin()+CurrentSet);
|
|
||||||
TileSet.erase(CurrentSet);
|
TileSet.erase(CurrentSet);
|
||||||
CurrentSet=0;
|
CurrentSet=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CTileBank::Reload()
|
void CTileBank::ReloadAll()
|
||||||
{
|
{
|
||||||
int ListSize=TileSet.size();
|
int ListSize=TileSet.size();
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ CTile &CTileBank::GetTile(int Bank,int Tile)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CTileBank::RenderSet(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
void CTileBank::Render(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
{
|
{
|
||||||
if (!TileSet.size()) return; // No tiles, return
|
if (!TileSet.size()) return; // No tiles, return
|
||||||
|
|
||||||
|
@ -246,8 +246,17 @@ void CTileBank::RenderSet(CCore *Core,Vector3 &CamPos,BOOL Is3d)
|
||||||
TileSet[CurrentSet].Render(Core,CamPos,GetLBrush(),GetRBrush(),FALSE);
|
TileSet[CurrentSet].Render(Core,CamPos,GetLBrush(),GetRBrush(),FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CTileBank::RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
|
{
|
||||||
TileSet[CurrentSet].RenderCursor(CamPos,CursorPos,SelStart,SelEnd);
|
TileSet[CurrentSet].RenderCursor(CamPos,CursorPos,SelStart,SelEnd);
|
||||||
if (Core->IsGridOn()) TileSet[CurrentSet].RenderGrid(CamPos);
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CTileBank::RenderGrid(CCore *Core,Vector3 &CamPos,bool Active)
|
||||||
|
{
|
||||||
|
TileSet[CurrentSet].RenderGrid(Core,CamPos,Active);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -259,6 +268,68 @@ void CTileBank::FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos)
|
||||||
SelEnd=CursorPos;
|
SelEnd=CursorPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
bool CTileBank::LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
||||||
|
{
|
||||||
|
if (nFlags & MK_RBUTTON)
|
||||||
|
{
|
||||||
|
SelectCancel();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
Select(LBrush,DownFlag);
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
bool CTileBank::RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
||||||
|
{
|
||||||
|
if (nFlags & MK_LBUTTON)
|
||||||
|
{
|
||||||
|
SelectCancel();
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Select(RBrush,DownFlag);
|
||||||
|
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
bool CTileBank::MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos)
|
||||||
|
{
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
bool CTileBank::Command(int CmdMsg,CCore *Core,int Param0,int Param1)
|
||||||
|
{
|
||||||
|
switch(CmdMsg)
|
||||||
|
{
|
||||||
|
case CmdMsg_SubViewLoad:
|
||||||
|
LoadSet(Core);
|
||||||
|
break;
|
||||||
|
case CmdMsg_SubViewDelete:
|
||||||
|
DeleteSet(Core);
|
||||||
|
break;
|
||||||
|
case CmdMsg_SubViewUpdate:
|
||||||
|
ReloadAll();
|
||||||
|
Core->GetTexCache().Purge();
|
||||||
|
break;
|
||||||
|
case CmdMsg_SubViewSet:
|
||||||
|
CurrentSet=TileBankGUI.m_List.GetCurSel()+1;
|
||||||
|
break;
|
||||||
|
case CmdMsg_ActiveBrushLeft:
|
||||||
|
ActiveBrush=LBrush;
|
||||||
|
break;
|
||||||
|
case CmdMsg_ActiveBrushRight:
|
||||||
|
ActiveBrush=RBrush;
|
||||||
|
default:
|
||||||
|
TRACE3("TileBank-Unhandled Command %i (%i,%i)\n",CmdMsg,Param0,Param1);
|
||||||
|
}
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Gui *********************************************************************/
|
/*** Gui *********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -277,7 +348,7 @@ void CTileBank::GUIKill(CCore *Core)
|
||||||
void CTileBank::GUIUpdate(CCore *Core)
|
void CTileBank::GUIUpdate(CCore *Core)
|
||||||
{
|
{
|
||||||
int ListSize=TileSet.size();
|
int ListSize=TileSet.size();
|
||||||
BOOL IsTileView=Core->IsTileView();
|
bool IsSubView=true;//Core->IsSubView();
|
||||||
|
|
||||||
if (TileBankGUI.m_List)
|
if (TileBankGUI.m_List)
|
||||||
{
|
{
|
||||||
|
@ -292,16 +363,21 @@ BOOL IsTileView=Core->IsTileView();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IsTileView=FALSE;
|
IsSubView=FALSE;
|
||||||
}
|
}
|
||||||
TileBankGUI.m_List.EnableWindow(IsTileView);
|
TileBankGUI.m_List.EnableWindow(IsSubView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CTileBank::GUIChanged(CCore *Core)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Functions ***************************************************************/
|
/*** Functions ***************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CTileBank::Select(int BrushID,BOOL DownFlag)
|
bool CTileBank::Select(int BrushID,bool DownFlag)
|
||||||
{
|
{
|
||||||
if (DownFlag && SelStart==-1)
|
if (DownFlag && SelStart==-1)
|
||||||
{
|
{
|
||||||
|
@ -366,7 +442,7 @@ int MaxTile=TileSet[CurrentSet].GetTileCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CTileBank::SelectCancel()
|
bool CTileBank::SelectCancel()
|
||||||
{
|
{
|
||||||
SelStart=-1;
|
SelStart=-1;
|
||||||
TRACE0("Select Cancelled\n");
|
TRACE0("Select Cancelled\n");
|
||||||
|
@ -374,7 +450,7 @@ BOOL CTileBank::SelectCancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CTileBank::IsTileValid(int Set,int Tile)
|
bool CTileBank::IsTileValid(int Set,int Tile)
|
||||||
{
|
{
|
||||||
if (Set<0 || Tile<0) return(FALSE);
|
if (Set<0 || Tile<0) return(FALSE);
|
||||||
if (Tile==0) return(TRUE);
|
if (Tile==0) return(TRUE);
|
||||||
|
@ -383,6 +459,55 @@ BOOL CTileBank::IsTileValid(int Set,int Tile)
|
||||||
return(TileSet[Set].IsTileValid(Tile));
|
return(TileSet[Set].IsTileValid(Tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CTileBank::LoadSet(CCore *Core)
|
||||||
|
{
|
||||||
|
char BASED_CODE GinFilter[]= "All Tile Files (*.Gin; *.Bmp)|*.gin;*.Bmp|3d Tile Files (*.Gin)|*.Gin|2d Tile Files (*.Bmp)|*.Bmp|All Files (*.*)|*.*||";
|
||||||
|
CFileDialog Dlg(TRUE,"Gin",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,GinFilter);
|
||||||
|
|
||||||
|
if (Dlg.DoModal()!=IDOK) return;
|
||||||
|
|
||||||
|
char Filename[256];
|
||||||
|
sprintf(Filename,"%s",Dlg.GetPathName());
|
||||||
|
AddTileSet(Filename);
|
||||||
|
GUIUpdate(Core);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CTileBank::DeleteSet(CCore *Core)
|
||||||
|
{
|
||||||
|
if (Core->Question("Delete Current Tile Bank\n\nAll used tiles in current set will be set to blank\nAre you sure?"))
|
||||||
|
{
|
||||||
|
int SetCount=GetSetCount();
|
||||||
|
int i,ListSize=Core->GetLayerCount();
|
||||||
|
|
||||||
|
for (i=0;i<ListSize;i++)
|
||||||
|
{
|
||||||
|
CLayerTile *ThisLayer=(CLayerTile*)Core->GetLayer(i);
|
||||||
|
if (ThisLayer->GetType()==LAYER_TYPE_TILE)
|
||||||
|
{
|
||||||
|
ThisLayer->DeleteSet(CurrentSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DeleteCurrent();
|
||||||
|
|
||||||
|
for (int Set=CurrentSet+1; Set<SetCount; Set++)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (i=0;i<ListSize;i++)
|
||||||
|
{
|
||||||
|
CLayerTile *ThisLayer=(CLayerTile*)Core->GetLayer(i);
|
||||||
|
if (ThisLayer->GetType()==LAYER_TYPE_TILE)
|
||||||
|
{
|
||||||
|
ThisLayer->RemapSet(Set,Set-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CurrentSet--;
|
||||||
|
GUIUpdate(Core);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** TileSet *****************************************************************/
|
/*** TileSet *****************************************************************/
|
||||||
|
@ -498,21 +623,21 @@ CPoint CTileSet::GetTilePos(int ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CTileSet::IsTileValid(int No)
|
bool CTileSet::IsTileValid(int No)
|
||||||
{
|
{
|
||||||
// ASSERT(No<Tile.size());
|
// ASSERT(No<Tile.size());
|
||||||
if (No>Tile.size()) return(FALSE);
|
if (No>Tile.size()) return(FALSE);
|
||||||
{return(Tile[No].IsValid());}
|
return(Tile[No].IsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CTileSet::Render(CCore *Core,Vector3 &CamPos,CMap &LBrush,CMap &RBrush,BOOL Render3d)
|
void CTileSet::Render(CCore *Core,Vector3 &CamPos,CMap &LBrush,CMap &RBrush,bool Render3d)
|
||||||
{
|
{
|
||||||
int ListSize=Tile.size();
|
int ListSize=Tile.size();
|
||||||
int TileID=0;
|
int TileID=0;
|
||||||
sMapElem ThisElem;
|
sMapElem ThisElem;
|
||||||
int SelFlag;
|
int SelFlag;
|
||||||
BOOL ValidTile=TRUE;
|
bool ValidTile=TRUE;
|
||||||
//float Scale=1.0f/(float)TileBrowserWidth/CamPos.z;
|
//float Scale=1.0f/(float)TileBrowserWidth/CamPos.z;
|
||||||
float Scale=CamPos.z/(float)TileBrowserWidth/2.0;
|
float Scale=CamPos.z/(float)TileBrowserWidth/2.0;
|
||||||
|
|
||||||
|
@ -665,7 +790,7 @@ float Scale=CamPos.z/(float)TileBrowserWidth/2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CTileSet::RenderGrid(Vector3 &CamPos)
|
void CTileSet::RenderGrid(CCore *Core,Vector3 &CamPos,bool Active)
|
||||||
{
|
{
|
||||||
int ListSize=Tile.size();
|
int ListSize=Tile.size();
|
||||||
int TileID=1; // Dont bother with blank, its sorted
|
int TileID=1; // Dont bother with blank, its sorted
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <Vector>
|
#include <Vector>
|
||||||
#include <gfname.hpp>
|
#include <gfname.hpp>
|
||||||
|
|
||||||
|
#include "Layer.h"
|
||||||
#include "TexCache.h"
|
#include "TexCache.h"
|
||||||
#include "Tile.h"
|
#include "Tile.h"
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ class CTile;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CTileSet;
|
class CTileSet;
|
||||||
class CTileBank
|
class CTileBank : public CLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CTileBank();
|
CTileBank();
|
||||||
|
@ -42,16 +43,43 @@ public:
|
||||||
RBrush,
|
RBrush,
|
||||||
MaxBrush
|
MaxBrush
|
||||||
};
|
};
|
||||||
|
// Overloads
|
||||||
|
int GetType() {return(0);}
|
||||||
|
|
||||||
|
void Render(CCore *Core,Vector3 &CamPos,bool Is3d);
|
||||||
|
void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active);
|
||||||
|
void RenderSelection(CCore *Core,Vector3 &ThisCam){};
|
||||||
|
void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d);
|
||||||
|
void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos);
|
||||||
|
|
||||||
|
void GUIInit(CCore *Core);
|
||||||
|
void GUIKill(CCore *Core);
|
||||||
|
void GUIUpdate(CCore *Core);
|
||||||
|
void GUIChanged(CCore *Core);
|
||||||
|
|
||||||
|
int GetWidth(){return(0);}
|
||||||
|
int GetHeight(){return(0);}
|
||||||
|
void CheckLayerSize(int Width,int Height){};
|
||||||
|
bool Resize(int Width,int Height){return(false);}
|
||||||
|
|
||||||
|
void Load(CFile *File,int Version);
|
||||||
|
void Save(CFile *File);
|
||||||
|
|
||||||
|
void Export(CCore *Core,CExport &Exp){};
|
||||||
|
|
||||||
|
bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
|
||||||
|
bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
|
||||||
|
bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos);
|
||||||
|
bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0);
|
||||||
|
|
||||||
|
// Local
|
||||||
void AddTileSet(const char *Filename);
|
void AddTileSet(const char *Filename);
|
||||||
int NeedLoad() {return(LoadFlag);}
|
int NeedLoad() {return(LoadFlag);}
|
||||||
void Delete();
|
void DeleteCurrent();
|
||||||
void Reload();
|
void ReloadAll();
|
||||||
void LoadTileSets(CCore *Core);
|
void LoadTileSets(CCore *Core);
|
||||||
CTile &GetTile(int Bank,int Tile);
|
CTile &GetTile(int Bank,int Tile);
|
||||||
|
|
||||||
void SetCurrent() {CurrentSet=TileBankGUI.m_List.GetCurSel()+1;}
|
|
||||||
int GetCurrent() {return(CurrentSet);}
|
|
||||||
int GetSetCount() {return(TileSet.size());}
|
int GetSetCount() {return(TileSet.size());}
|
||||||
|
|
||||||
CMap &GetLBrush() {return(Brush[LBrush]);}
|
CMap &GetLBrush() {return(Brush[LBrush]);}
|
||||||
|
@ -59,44 +87,30 @@ public:
|
||||||
CMap &GetBrush(int i) {return(Brush[i]);}
|
CMap &GetBrush(int i) {return(Brush[i]);}
|
||||||
CMap &GetActiveBrush() {return(GetBrush(ActiveBrush));}
|
CMap &GetActiveBrush() {return(GetBrush(ActiveBrush));}
|
||||||
|
|
||||||
void RenderSet(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
bool IsTileValid(int Set,int Tile);
|
||||||
void FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos);
|
|
||||||
void RenderCursor(CCore *Core,Vector3 &CamPos,BOOL Is3d);
|
|
||||||
|
|
||||||
void GUIInit(CCore *Core);
|
|
||||||
void GUIKill(CCore *Core);
|
|
||||||
void GUIUpdate(CCore *Core);
|
|
||||||
|
|
||||||
BOOL IsTileValid(int Set,int Tile);
|
|
||||||
bool CanClose() {return(SelStart==-1);}
|
bool CanClose() {return(SelStart==-1);}
|
||||||
|
|
||||||
void SetCollision(bool f);
|
void SetCollision(bool f);
|
||||||
CTileSet &GetSet(int Set) {return(TileSet[Set]);}
|
CTileSet &GetSet(int Set) {return(TileSet[Set]);}
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
BOOL SelectL(BOOL DownFlag) {return(Select(LBrush,DownFlag));}
|
bool SelectCancel();
|
||||||
BOOL SelectR(BOOL DownFlag) {return(Select(RBrush,DownFlag));}
|
void LoadSet(CCore *Core);
|
||||||
BOOL SelectCancel();
|
void DeleteSet(CCore *Core);
|
||||||
|
|
||||||
void SetActiveBrushL() {ActiveBrush=LBrush;}
|
|
||||||
void SetActiveBrushR() {ActiveBrush=RBrush;}
|
|
||||||
|
|
||||||
void Load(CFile *File,int Version);
|
|
||||||
void Save(CFile *File);
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
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;
|
|
||||||
CList<CTileSet> TileSet;
|
CList<CTileSet> TileSet;
|
||||||
int CurrentSet,LastSet;
|
int CurrentSet,LastSet;
|
||||||
CMap Brush[2];
|
CMap Brush[2];
|
||||||
int ActiveBrush;
|
int ActiveBrush;
|
||||||
int SelStart,SelEnd;
|
int SelStart,SelEnd;
|
||||||
|
|
||||||
BOOL LoadFlag;
|
bool LoadFlag;
|
||||||
int LastCursorPos,CursorPos;
|
int LastCursorPos,CursorPos;
|
||||||
|
|
||||||
CLayerTileGUI TileBankGUI;
|
CLayerTileGUI TileBankGUI;
|
||||||
|
@ -123,26 +137,26 @@ const char *GetName() {return(Name);}
|
||||||
CTile &GetTile(int No) {return(Tile[No]);}
|
CTile &GetTile(int No) {return(Tile[No]);}
|
||||||
void Purge();
|
void Purge();
|
||||||
int FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos);
|
int FindCursorPos(CCore *Core,Vector3 &CamPos,CPoint &MousePos);
|
||||||
void Render(CCore *Core,Vector3 &CamPos,CMap &LBrush,CMap &RBrush,BOOL Render3d);
|
void Render(CCore *Core,Vector3 &CamPos,CMap &LBrush,CMap &RBrush,bool Render3d);
|
||||||
void RenderCursor(Vector3 &CamPos,int Pos,int Width, int Height);
|
void RenderCursor(Vector3 &CamPos,int Pos,int Width, int Height);
|
||||||
void RenderBrush(Vector3 &CamPos,CMap &LBrush,CMap &RBrush);
|
void RenderBrush(Vector3 &CamPos,CMap &LBrush,CMap &RBrush);
|
||||||
void RenderGrid(Vector3 &CamPos);
|
void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active);
|
||||||
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);}
|
bool operator==(CTileSet const &v1) {return (Name==v1.Name);}
|
||||||
|
|
||||||
// if (IsStrSame((char*)Name,(char*)v1.Name) return(i);
|
// 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);
|
||||||
CPoint GetTilePos(int ID);
|
CPoint GetTilePos(int ID);
|
||||||
|
|
||||||
GString Filename,Name;
|
GString Filename,Name;
|
||||||
|
|
||||||
int SetNumber;
|
int SetNumber;
|
||||||
CList<CTile> Tile;
|
CList<CTile> Tile;
|
||||||
BOOL Loaded;
|
bool Loaded;
|
||||||
int TileBrowserWidth;
|
int TileBrowserWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
#define ID_TOOLBAR_COMBO 32777
|
#define ID_TOOLBAR_COMBO 32777
|
||||||
#define ID_TOOLBAR_PARAMBAR 32783
|
#define ID_TOOLBAR_PARAMBAR 32783
|
||||||
#define ID_TOOLBAR_GRID 32784
|
#define ID_TOOLBAR_GRID 32784
|
||||||
#define ID_TOGGLE_TILEVIEW 32785
|
#define ID_TOGGLE_SUBVIEW 32785
|
||||||
#define ID_MAP_TOGGLEGRID 32786
|
#define ID_MAP_TOGGLEGRID 32786
|
||||||
#define ID_TOGGLE_GRID 32787
|
#define ID_TOGGLE_GRID 32787
|
||||||
#define ID_MIRRORX 32788
|
#define ID_MIRRORX 32788
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue