SBSPSS/Utils/MapEdit/LayerCollision.cpp

128 lines
3.5 KiB
C++
Raw Normal View History

2001-01-22 18:01:20 +01:00
/******************/
/*** Layer Tile ***/
/******************/
#include "stdafx.h"
#include <Vector3.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include "GLEnabledView.h"
#include "MapEdit.h"
#include "MapEditDoc.h"
#include "MapEditView.h"
#include "MainFrm.h"
#include "Core.h"
#include "Layer.h"
#include "LayerTile.h"
2001-01-23 22:53:48 +01:00
#include "LayerCollision.h"
2001-01-22 18:01:20 +01:00
#include "Utils.h"
#include "Select.h"
#include "Export.h"
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
// New Layer
2001-01-23 22:53:48 +01:00
CLayerCollision::CLayerCollision(int _SubType,int Width,int Height)
2001-01-22 18:01:20 +01:00
{
2001-01-23 22:53:48 +01:00
SubType=LAYER_SUBTYPE_NONE;
2001-01-22 18:01:20 +01:00
SetDefaultParams();
Mode=MouseModePaint;
Map.SetSize(Width,Height,TRUE);
}
/*****************************************************************************/
// Load Layer
2001-01-23 22:53:48 +01:00
CLayerCollision::CLayerCollision(CFile *File,int Version)
2001-01-22 18:01:20 +01:00
{
Load(File,Version);
}
/*****************************************************************************/
2001-01-23 22:53:48 +01:00
CLayerCollision::~CLayerCollision()
2001-01-22 18:01:20 +01:00
{
}
/*****************************************************************************/
2001-01-23 22:53:48 +01:00
void CLayerCollision::Load(CFile *File,int Version)
2001-01-22 18:01:20 +01:00
{
2001-01-23 22:53:48 +01:00
// Version 2
File->Read(&Render3dFlag,sizeof(BOOL));
File->Read(&ScaleFactor,sizeof(float));
File->Read(&ResizeFlag,sizeof(BOOL));
File->Read(&VisibleFlag,sizeof(BOOL));
File->Read(&Mode,sizeof(MouseMode));
File->Read(&SubType,sizeof(int));
Map.Load(File,Version);
2001-01-22 18:01:20 +01:00
TRACE1("%s\t",GetName());
TRACE1("Scl:%g\t",ScaleFactor);
TRACE1("%i\n",VisibleFlag);
}
/*****************************************************************************/
2001-01-23 22:53:48 +01:00
void CLayerCollision::Save(CFile *File)
2001-01-22 18:01:20 +01:00
{
// Always Save current version
File->Write(&Render3dFlag,sizeof(BOOL));
File->Write(&ScaleFactor,sizeof(float));
File->Write(&ResizeFlag,sizeof(BOOL));
File->Write(&VisibleFlag,sizeof(BOOL));
File->Write(&Mode,sizeof(MouseMode));
File->Write(&SubType,sizeof(SubType));
Map.Save(File);
}
/*****************************************************************************/
/*** Gui *********************************************************************/
/*****************************************************************************/
2001-02-09 22:17:01 +01:00
void CLayerCollision::GUIInit(CCore *Core)
2001-01-22 18:01:20 +01:00
{
2001-02-09 22:17:01 +01:00
Core->GUIAdd(ToolBarGUI,IDD_LAYERTILE_TOOLBAR);
}
2001-01-22 18:01:20 +01:00
2001-02-09 22:17:01 +01:00
/*****************************************************************************/
void CLayerCollision::GUIKill(CCore *Core)
{
Core->GUIRemove(ToolBarGUI,IDD_LAYERTILE_TOOLBAR);
}
/*****************************************************************************/
void CLayerCollision::GUIUpdate(CCore *Core)
{
CLayerTile::GUIUpdate(Core);
2001-01-22 18:01:20 +01:00
}
/*****************************************************************************/
2001-02-09 22:17:01 +01:00
void CLayerCollision::GUIChanged(CCore *Core)
2001-01-22 18:01:20 +01:00
{
2001-02-09 22:17:01 +01:00
CLayerTile::GUIChanged(Core);
2001-01-22 18:01:20 +01:00
}
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-01-23 22:53:48 +01:00
void CLayerCollision::Export(CCore *Core,CExport &Exp)
2001-01-22 18:01:20 +01:00
{
2001-01-24 23:35:11 +01:00
Exp.ExportLayerCollision(Core,GetName(),SubType,Map);
2001-01-22 18:01:20 +01:00
}
/*****************************************************************************/
2001-01-23 22:53:48 +01:00
void CLayerCollision::DeleteSet(int Set)
2001-01-22 18:01:20 +01:00
{
Map.DeleteSet(Set);
}
/*****************************************************************************/
2001-01-23 22:53:48 +01:00
void CLayerCollision::RemapSet(int OrigSet,int NewSet)
2001-01-22 18:01:20 +01:00
{
Map.RemapSet(OrigSet,NewSet);
}