Initial ScEd CVS revision; corresponds to ScEd 0.0.7.2.
This was SVN commit r315.
This commit is contained in:
parent
210d77c9b3
commit
4928af6239
121
source/sced/AlterElevationCommand.cpp
Executable file
121
source/sced/AlterElevationCommand.cpp
Executable file
@ -0,0 +1,121 @@
|
|||||||
|
#include "AlterElevationCommand.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
#include "MiniMap.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
|
inline int clamp(int x,int min,int max)
|
||||||
|
{
|
||||||
|
if (x<min) return min;
|
||||||
|
else if (x>max) return max;
|
||||||
|
else return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CAlterElevationCommand::CAlterElevationCommand(int brushSize,int selectionCentre[2])
|
||||||
|
{
|
||||||
|
m_BrushSize=brushSize;
|
||||||
|
m_SelectionCentre[0]=selectionCentre[0];
|
||||||
|
m_SelectionCentre[1]=selectionCentre[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CAlterElevationCommand::~CAlterElevationCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAlterElevationCommand::Execute()
|
||||||
|
{
|
||||||
|
int r=m_BrushSize;
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
|
||||||
|
// get range of vertices affected by brush
|
||||||
|
int x0=clamp(m_SelectionCentre[0]-r,0,mapSize-1);
|
||||||
|
int x1=clamp(m_SelectionCentre[0]+r+1,0,mapSize-1);
|
||||||
|
int z0=clamp(m_SelectionCentre[1]-r,0,mapSize-1);
|
||||||
|
int z1=clamp(m_SelectionCentre[1]+r+1,0,mapSize-1);
|
||||||
|
|
||||||
|
// resize input/output arrays
|
||||||
|
m_DataIn.resize(x1-x0+1,z1-z0+1);
|
||||||
|
m_DataOut.resize(x1-x0+1,z1-z0+1);
|
||||||
|
|
||||||
|
// fill input data
|
||||||
|
int i,j;
|
||||||
|
for (j=z0;j<=z1;j++) {
|
||||||
|
for (i=x0;i<=x1;i++) {
|
||||||
|
u16 input=g_Terrain.GetHeightMap()[j*mapSize+i];
|
||||||
|
m_DataIn(i-x0,j-z0)=input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// call on base classes to fill the output data
|
||||||
|
CalcDataOut(x0,x1,z0,z1);
|
||||||
|
|
||||||
|
// now actually apply data to terrain
|
||||||
|
ApplyDataToSelection(m_DataOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CAlterElevationCommand::ApplyDataToSelection(const CArray2D<u16>& data)
|
||||||
|
{
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
|
||||||
|
int r=m_BrushSize;
|
||||||
|
int x0=clamp(m_SelectionCentre[0]-r,0,mapSize-1);
|
||||||
|
int x1=clamp(m_SelectionCentre[0]+r+1,0,mapSize-1);
|
||||||
|
int z0=clamp(m_SelectionCentre[1]-r,0,mapSize-1);
|
||||||
|
int z1=clamp(m_SelectionCentre[1]+r+1,0,mapSize-1);
|
||||||
|
|
||||||
|
|
||||||
|
// copy given data to heightmap
|
||||||
|
int i,j;
|
||||||
|
for (j=z0;j<=z1;j++) {
|
||||||
|
for (i=x0;i<=x1;i++) {
|
||||||
|
int idx=j*mapSize+i;
|
||||||
|
u16 height=data(i-x0,j-z0);
|
||||||
|
// update heightmap
|
||||||
|
g_Terrain.GetHeightMap()[idx]=height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// flag vertex data as dirty for affected patches, and rebuild bounds of these patches
|
||||||
|
u32 patchesPerSide=g_Terrain.GetPatchesPerSide();
|
||||||
|
int px0=clamp(-1+(x0/16),0,patchesPerSide);
|
||||||
|
int px1=clamp(1+(x1/16),0,patchesPerSide);
|
||||||
|
int pz0=clamp(-1+(z0/16),0,patchesPerSide);
|
||||||
|
int pz1=clamp(1+(z1/16),0,patchesPerSide);
|
||||||
|
for (j=pz0;j<pz1;j++) {
|
||||||
|
for (int i=px0;i<px1;i++) {
|
||||||
|
CPatch* patch=g_Terrain.GetPatch(i,j);
|
||||||
|
patch->CalcBounds();
|
||||||
|
patch->SetDirty(RENDERDATA_UPDATE_VERTICES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rebuild this bit of the minimap
|
||||||
|
int w=1+2*m_BrushSize;
|
||||||
|
int x=m_SelectionCentre[1]-m_BrushSize;
|
||||||
|
if (x<0) {
|
||||||
|
w+=x;
|
||||||
|
x=0;
|
||||||
|
}
|
||||||
|
int h=1+2*m_BrushSize;
|
||||||
|
int y=m_SelectionCentre[0]-m_BrushSize;
|
||||||
|
if (y<0) {
|
||||||
|
h+=y;
|
||||||
|
y=0;
|
||||||
|
}
|
||||||
|
g_MiniMap.Rebuild(x,y,w,h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CAlterElevationCommand::Undo()
|
||||||
|
{
|
||||||
|
ApplyDataToSelection(m_DataIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAlterElevationCommand::Redo()
|
||||||
|
{
|
||||||
|
ApplyDataToSelection(m_DataOut);
|
||||||
|
}
|
45
source/sced/AlterElevationCommand.h
Executable file
45
source/sced/AlterElevationCommand.h
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef _ALTERELEVATIONCOMMAND_H
|
||||||
|
#define _ALTERELEVATIONCOMMAND_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "Command.h"
|
||||||
|
#include "Array2D.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CAlterElevationCommand : public CCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor, destructor
|
||||||
|
CAlterElevationCommand(int brushSize,int selectionCentre[2]);
|
||||||
|
~CAlterElevationCommand();
|
||||||
|
|
||||||
|
// execute this command
|
||||||
|
void Execute();
|
||||||
|
|
||||||
|
// can undo command?
|
||||||
|
bool IsUndoable() const { return true; }
|
||||||
|
// undo
|
||||||
|
void Undo();
|
||||||
|
// redo
|
||||||
|
void Redo();
|
||||||
|
|
||||||
|
// abstract function implemented by subclasses to fill in outgoing data member
|
||||||
|
virtual void CalcDataOut(int x0,int x1,int z0,int z1) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void ApplyDataToSelection(const CArray2D<u16>& data);
|
||||||
|
|
||||||
|
// size of brush
|
||||||
|
int m_BrushSize;
|
||||||
|
// centre of brush
|
||||||
|
int m_SelectionCentre[2];
|
||||||
|
// origin of data set
|
||||||
|
int m_SelectionOrigin[2];
|
||||||
|
// input data (original terrain heights)
|
||||||
|
CArray2D<u16> m_DataIn;
|
||||||
|
// output data (final terrain heights)
|
||||||
|
CArray2D<u16> m_DataOut;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
66
source/sced/AlterLightEnvCommand.cpp
Executable file
66
source/sced/AlterLightEnvCommand.cpp
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#include "AlterLightEnvCommand.h"
|
||||||
|
#include "UnitManager.h"
|
||||||
|
#include "ObjectManager.h"
|
||||||
|
#include "Model.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
extern CLightEnv g_LightEnv;
|
||||||
|
|
||||||
|
|
||||||
|
CAlterLightEnvCommand::CAlterLightEnvCommand(const CLightEnv& env) : m_LightEnv(env)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CAlterLightEnvCommand::~CAlterLightEnvCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAlterLightEnvCommand::Execute()
|
||||||
|
{
|
||||||
|
// save current lighting environment
|
||||||
|
m_SavedLightEnv=g_LightEnv;
|
||||||
|
// apply this commands lighting environment onto the global lighting environment
|
||||||
|
ApplyData(m_LightEnv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CAlterLightEnvCommand::ApplyData(const CLightEnv& env)
|
||||||
|
{
|
||||||
|
// copy given lighting environment to global environment
|
||||||
|
g_LightEnv=env;
|
||||||
|
|
||||||
|
// dirty the vertices on all patches
|
||||||
|
u32 patchesPerSide=g_Terrain.GetPatchesPerSide();
|
||||||
|
u32 i,j;
|
||||||
|
for (j=0;j<patchesPerSide;j++) {
|
||||||
|
for (i=0;i<patchesPerSide;i++) {
|
||||||
|
CPatch* patch=g_Terrain.GetPatch(i,j);
|
||||||
|
patch->SetDirty(RENDERDATA_UPDATE_VERTICES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dirty all models
|
||||||
|
const std::vector<CUnit*>& units=g_UnitMan.GetUnits();
|
||||||
|
for (i=0;i<units.size();++i) {
|
||||||
|
CUnit* unit=units[i];
|
||||||
|
unit->GetModel()->SetDirty(RENDERDATA_UPDATE_VERTICES);
|
||||||
|
}
|
||||||
|
|
||||||
|
CObjectEntry* selobject=g_ObjMan.GetSelectedObject();
|
||||||
|
if (selobject && selobject->m_Model) {
|
||||||
|
selobject->m_Model->SetDirty(RENDERDATA_UPDATE_VERTICES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CAlterLightEnvCommand::Undo()
|
||||||
|
{
|
||||||
|
ApplyData(m_SavedLightEnv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAlterLightEnvCommand::Redo()
|
||||||
|
{
|
||||||
|
ApplyData(m_LightEnv);
|
||||||
|
}
|
40
source/sced/AlterLightEnvCommand.h
Executable file
40
source/sced/AlterLightEnvCommand.h
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#ifndef _ALTERLIGHTENVCOMMAND_H
|
||||||
|
#define _ALTERLIGHTENVCOMMAND_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "Command.h"
|
||||||
|
|
||||||
|
#include "LightEnv.h"
|
||||||
|
|
||||||
|
class CAlterLightEnvCommand : public CCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor, destructor
|
||||||
|
CAlterLightEnvCommand(const CLightEnv& env);
|
||||||
|
~CAlterLightEnvCommand();
|
||||||
|
|
||||||
|
// return the texture name of this command
|
||||||
|
const char* GetName() const { return "Alter Lighting Parameters"; }
|
||||||
|
|
||||||
|
// execute this command
|
||||||
|
void Execute();
|
||||||
|
|
||||||
|
// can undo command?
|
||||||
|
bool IsUndoable() const { return true; }
|
||||||
|
// undo
|
||||||
|
void Undo();
|
||||||
|
// redo
|
||||||
|
void Redo();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// apply given lighting parameters to global environment
|
||||||
|
void ApplyData(const CLightEnv& env);
|
||||||
|
|
||||||
|
// lighting parameters to apply to the environment
|
||||||
|
CLightEnv m_LightEnv;
|
||||||
|
// old lighting parameters - saved for undo/redo
|
||||||
|
CLightEnv m_SavedLightEnv;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
202
source/sced/Array2D.h
Executable file
202
source/sced/Array2D.h
Executable file
@ -0,0 +1,202 @@
|
|||||||
|
#ifndef _ARRAY2D_H
|
||||||
|
#define _ARRAY2D_H
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class CArray2D
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CArray2D();
|
||||||
|
CArray2D(int usize,int vsize);
|
||||||
|
CArray2D(int usize,int vsize,const T* data);
|
||||||
|
CArray2D(const CArray2D& rhs);
|
||||||
|
virtual ~CArray2D();
|
||||||
|
|
||||||
|
CArray2D& operator=(const CArray2D& rhs);
|
||||||
|
|
||||||
|
operator T*();
|
||||||
|
operator const T*() const;
|
||||||
|
|
||||||
|
int usize() const;
|
||||||
|
int vsize() const;
|
||||||
|
void size(int& usize,int& vsize) const;
|
||||||
|
|
||||||
|
void resize(int usize,int vsize);
|
||||||
|
|
||||||
|
void fill(const T* elements);
|
||||||
|
|
||||||
|
T& operator()(int a,int b);
|
||||||
|
const T& operator()(int a,int b) const;
|
||||||
|
|
||||||
|
T& at(int a,int b);
|
||||||
|
const T& at(int a,int b) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// allocate and deallocate are overrideable by subclasses, allowing alternative
|
||||||
|
// (more efficient) allocation in certain circumstances
|
||||||
|
// * if allocation/deallocation is not done using new[]/delete[], it is necessary
|
||||||
|
// to override both functions
|
||||||
|
virtual void allocate();
|
||||||
|
virtual void deallocate();
|
||||||
|
|
||||||
|
int _usize; // no of columns;
|
||||||
|
int _vsize; // no of rows
|
||||||
|
T* _elements;
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>::CArray2D() : _usize(0), _vsize(0), _elements(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>::CArray2D(int usize,int vsize)
|
||||||
|
: _usize(usize), _vsize(vsize), _elements(0)
|
||||||
|
{
|
||||||
|
allocate();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>::CArray2D(int usize,int vsize,const T* elements)
|
||||||
|
: _usize(usize), _vsize(vsize), _elements(0)
|
||||||
|
{
|
||||||
|
assert(elements!=0);
|
||||||
|
|
||||||
|
allocate();
|
||||||
|
fill(elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>::CArray2D(const CArray2D<T>& rhs)
|
||||||
|
: _usize(rhs._usize), _vsize(rhs._vsize), _elements(0)
|
||||||
|
{
|
||||||
|
allocate();
|
||||||
|
fill(rhs._elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>::~CArray2D()
|
||||||
|
{
|
||||||
|
deallocate();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>& CArray2D<T>::operator=(const CArray2D<T>& rhs)
|
||||||
|
{
|
||||||
|
if (this==&rhs)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
deallocate();
|
||||||
|
|
||||||
|
_usize=rhs._usize;
|
||||||
|
_vsize=rhs._vsize;
|
||||||
|
|
||||||
|
allocate();
|
||||||
|
fill(rhs._elements);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CArray2D<T>::allocate()
|
||||||
|
{
|
||||||
|
assert(_elements==0);
|
||||||
|
_elements=new T[_usize*_vsize];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CArray2D<T>::deallocate()
|
||||||
|
{
|
||||||
|
delete[] _elements;
|
||||||
|
_elements=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
int CArray2D<T>::usize() const
|
||||||
|
{
|
||||||
|
return _usize;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
int CArray2D<T>::vsize() const
|
||||||
|
{
|
||||||
|
return _vsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CArray2D<T>::size(int& usize,int& vsize) const
|
||||||
|
{
|
||||||
|
usize=_usize;
|
||||||
|
vsize=_vsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CArray2D<T>::resize(int usize,int vsize)
|
||||||
|
{
|
||||||
|
deallocate();
|
||||||
|
|
||||||
|
_usize=usize;
|
||||||
|
_vsize=vsize;
|
||||||
|
allocate();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void CArray2D<T>::fill(const T* elements)
|
||||||
|
{
|
||||||
|
memcpy(_elements,elements,sizeof(T)*_usize*_vsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// operator()(int r,int c)
|
||||||
|
// return the element at (r,c) (ie c'th element in r'th row)
|
||||||
|
template <class T>
|
||||||
|
T& CArray2D<T>::operator()(int u,int v)
|
||||||
|
{
|
||||||
|
assert(u>=0 && u<_usize);
|
||||||
|
assert(v>=0 && v<_vsize);
|
||||||
|
return _elements[(u*_vsize)+v];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
const T& CArray2D<T>::operator()(int u,int v) const
|
||||||
|
{
|
||||||
|
assert(u>=0 && u<_usize);
|
||||||
|
assert(v>=0 && v<_vsize);
|
||||||
|
return _elements[(u*_vsize)+v];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
T& CArray2D<T>::at(int u,int v)
|
||||||
|
{
|
||||||
|
assert(u>=0 && u<_usize);
|
||||||
|
assert(v>=0 && v<_vsize);
|
||||||
|
return _elements[(u*_vsize)+v];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
const T& CArray2D<T>::at(int u,int v) const
|
||||||
|
{
|
||||||
|
assert(u>=0 && u<_usize);
|
||||||
|
assert(v>=0 && v<_vsize);
|
||||||
|
return _elements[(u*_vsize)+v];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>::operator T*()
|
||||||
|
{
|
||||||
|
return _elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
CArray2D<T>::operator const T*() const
|
||||||
|
{
|
||||||
|
return _elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#endif
|
92
source/sced/BrushShapeEditorDlgBar.cpp
Executable file
92
source/sced/BrushShapeEditorDlgBar.cpp
Executable file
@ -0,0 +1,92 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
#include "EditorData.h"
|
||||||
|
#include "BrushShapeEditorTool.h"
|
||||||
|
#include "BrushShapeEditorDlgBar.h"
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CBrushShapeEditorDlgBar, CDialogBar)
|
||||||
|
//{{AFX_MSG_MAP(CBrushShapeEditorDlgBar)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_BACK, OnButtonBack)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_ADD, OnButtonAdd)
|
||||||
|
ON_CBN_SELCHANGE(IDC_COMBO_TERRAINTYPES, OnSelChangeBrush)
|
||||||
|
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_BRUSHSIZE, OnReleasedCaptureSliderBrushSize)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
CBrushShapeEditorDlgBar::CBrushShapeEditorDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CBrushShapeEditorDlgBar::~CBrushShapeEditorDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CBrushShapeEditorDlgBar::Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!CDialogBar::Create(pParentWnd, lpszTemplateName, nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OnInitDialog()) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CBrushShapeEditorDlgBar::Create(CWnd * pParentWnd, UINT nIDTemplate,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorDlgBar::OnButtonAdd()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CBrushShapeEditorDlgBar::OnInitDialog()
|
||||||
|
{
|
||||||
|
// get the current window size and position
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
|
||||||
|
// now change the size, position, and Z order of the window.
|
||||||
|
::SetWindowPos(m_hWnd,HWND_TOPMOST,10,rect.top,rect.Width(),rect.Height(),SWP_HIDEWINDOW);
|
||||||
|
|
||||||
|
// set up brush size slider
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
sliderctrl->SetRange(0,CBrushShapeEditorTool::MAX_BRUSH_SIZE);
|
||||||
|
sliderctrl->SetPos(CBrushShapeEditorTool::GetTool()->GetBrushSize());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorDlgBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
|
||||||
|
{
|
||||||
|
bDisableIfNoHndler = FALSE;
|
||||||
|
CDialogBar::OnUpdateCmdUI(pTarget,bDisableIfNoHndler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorDlgBar::OnReleasedCaptureSliderBrushSize(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
CBrushShapeEditorTool::GetTool()->SetBrushSize(sliderctrl->GetPos());
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CBrushShapeEditorDlgBar::OnSelChangeBrush()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorDlgBar::OnButtonBack()
|
||||||
|
{
|
||||||
|
CMainFrame* mainfrm=(CMainFrame*) AfxGetMainWnd();
|
||||||
|
mainfrm->DeselectTools();
|
||||||
|
}
|
31
source/sced/BrushShapeEditorDlgBar.h
Executable file
31
source/sced/BrushShapeEditorDlgBar.h
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef _BRUSHSHAPEEDITORDLGBAR_H
|
||||||
|
#define _BRUSHSHAPEEDITORDLGBAR_H
|
||||||
|
|
||||||
|
class CBrushShapeEditorDlgBar : public CDialogBar
|
||||||
|
{
|
||||||
|
// DECLARE_DYNAMIC(CInitDialogBar)
|
||||||
|
public:
|
||||||
|
CBrushShapeEditorDlgBar();
|
||||||
|
~CBrushShapeEditorDlgBar();
|
||||||
|
|
||||||
|
BOOL Create(CWnd * pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID);
|
||||||
|
BOOL Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID);
|
||||||
|
void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
BOOL OnInitDialog();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CBrushShapeEditorDlgBar)
|
||||||
|
afx_msg void OnButtonAdd();
|
||||||
|
afx_msg void OnButtonBack();
|
||||||
|
afx_msg void OnReleasedCaptureSliderBrushSize(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnSelChangeBrush();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
86
source/sced/BrushShapeEditorTool.cpp
Executable file
86
source/sced/BrushShapeEditorTool.cpp
Executable file
@ -0,0 +1,86 @@
|
|||||||
|
#include "BrushShapeEditorTool.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "ogl.h"
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
CBrushShapeEditorTool CBrushShapeEditorTool::m_BrushShapeEditorTool;
|
||||||
|
|
||||||
|
|
||||||
|
CBrushShapeEditorTool::CBrushShapeEditorTool() : m_BrushSize(5), m_BrushData(0)
|
||||||
|
{
|
||||||
|
m_BrushData=new bool[m_BrushSize*m_BrushSize];
|
||||||
|
memset(m_BrushData,0,sizeof(bool)*m_BrushSize*m_BrushSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorTool::OnDraw()
|
||||||
|
{
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
glDepthMask(0);
|
||||||
|
|
||||||
|
// draw grid
|
||||||
|
|
||||||
|
// draw state of each bit in the brush
|
||||||
|
int r=m_BrushSize;
|
||||||
|
// iterate through selected patches
|
||||||
|
for (int j=0;j<r;j++) {
|
||||||
|
for (int i=0;i<r;i++) {
|
||||||
|
if (m_BrushData[j*m_BrushSize+i]) {
|
||||||
|
// draw filled quad here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
glDepthMask(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorTool::OnLButtonDown(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
// check for bit under cursor
|
||||||
|
if (0) {
|
||||||
|
// switch if on
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorTool::OnRButtonDown(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
// check for bit under cursor
|
||||||
|
if (0) {
|
||||||
|
// switch it off
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorTool::OnMouseMove(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
if (flags & TOOL_MOUSEFLAG_LBUTTONDOWN) {
|
||||||
|
OnLButtonDown(flags,px,py);
|
||||||
|
} else if (flags & TOOL_MOUSEFLAG_RBUTTONDOWN) {
|
||||||
|
OnRButtonDown(flags,px,py);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushShapeEditorTool::SetBrushSize(int size)
|
||||||
|
{
|
||||||
|
// allocate new data
|
||||||
|
bool* newdata=new bool[size*size];
|
||||||
|
memset(newdata,0,sizeof(bool)*size*size);
|
||||||
|
|
||||||
|
// copy data from old to new
|
||||||
|
bool* src=m_BrushData;
|
||||||
|
bool* dst=newdata;
|
||||||
|
u32 copysize=size>m_BrushSize ? m_BrushSize : size;
|
||||||
|
for (u32 j=0;j<copysize;j++) {
|
||||||
|
memcpy(dst,src,copysize*sizeof(bool));
|
||||||
|
dst+=copysize;
|
||||||
|
src+=m_BrushSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up and assign new data as current
|
||||||
|
delete[] m_BrushData;
|
||||||
|
m_BrushData=newdata;
|
||||||
|
}
|
44
source/sced/BrushShapeEditorTool.h
Executable file
44
source/sced/BrushShapeEditorTool.h
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef _BRUSHSHAPEEDITORTOOL_H
|
||||||
|
#define _BRUSHSHAPEEDITORTOOL_H
|
||||||
|
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "Tool.h"
|
||||||
|
|
||||||
|
class CPatch;
|
||||||
|
class CMiniPatch;
|
||||||
|
|
||||||
|
class CBrushShapeEditorTool : public CTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { MAX_BRUSH_SIZE=8 };
|
||||||
|
|
||||||
|
public:
|
||||||
|
CBrushShapeEditorTool();
|
||||||
|
|
||||||
|
// draw the visual representation of this tool
|
||||||
|
void OnDraw();
|
||||||
|
// callback for left button down event
|
||||||
|
void OnLButtonDown(unsigned int flags,int px,int py);
|
||||||
|
// callback for right button down event
|
||||||
|
void OnRButtonDown(unsigned int flags,int px,int py);
|
||||||
|
// callback for mouse move event
|
||||||
|
void OnMouseMove(unsigned int flags,int px,int py);
|
||||||
|
|
||||||
|
// set current brush size
|
||||||
|
void SetBrushSize(int size);
|
||||||
|
// get current brush size
|
||||||
|
int GetBrushSize() { return m_BrushSize; }
|
||||||
|
|
||||||
|
// get the default brush shape editor instance
|
||||||
|
static CBrushShapeEditorTool* GetTool() { return &m_BrushShapeEditorTool; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// current tool brush size
|
||||||
|
int m_BrushSize;
|
||||||
|
// on/off state of each bit in the brush
|
||||||
|
bool* m_BrushData;
|
||||||
|
// default tool instance
|
||||||
|
static CBrushShapeEditorTool m_BrushShapeEditorTool;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
150
source/sced/BrushTool.cpp
Executable file
150
source/sced/BrushTool.cpp
Executable file
@ -0,0 +1,150 @@
|
|||||||
|
#include "BrushTool.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
#include "HFTracer.h"
|
||||||
|
#include "NaviCam.h"
|
||||||
|
#include "TextureManager.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
#include "Renderer.h"
|
||||||
|
#include "ogl.h"
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
extern CCamera g_Camera;
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
|
CBrushTool::CBrushTool() : m_BrushSize(1), m_LButtonDown(false), m_RButtonDown(false)
|
||||||
|
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void RenderTileOutline(int gx,int gz)
|
||||||
|
{
|
||||||
|
CMiniPatch* mpatch=g_Terrain.GetTile(gx,gz);
|
||||||
|
if (!mpatch) return;
|
||||||
|
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
|
||||||
|
CVector3D V[4];
|
||||||
|
g_Terrain.CalcPosition(gx,gz,V[0]);
|
||||||
|
g_Terrain.CalcPosition(gx+1,gz,V[1]);
|
||||||
|
g_Terrain.CalcPosition(gx+1,gz+1,V[2]);
|
||||||
|
g_Terrain.CalcPosition(gx,gz+1,V[3]);
|
||||||
|
|
||||||
|
glLineWidth(2);
|
||||||
|
glColor4f(0.05f,0.95f,0.1f,0.75f);
|
||||||
|
|
||||||
|
glBegin (GL_LINE_LOOP);
|
||||||
|
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
glVertex3fv(&V[i].X);
|
||||||
|
|
||||||
|
glEnd ();
|
||||||
|
|
||||||
|
glColor4f (0.1f,0.9f,0.15f,0.35f);
|
||||||
|
|
||||||
|
glBegin (GL_QUADS);
|
||||||
|
|
||||||
|
for(i = 0; i < 4; i++)
|
||||||
|
glVertex3fv(&V[i].X);
|
||||||
|
|
||||||
|
glEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushTool::OnDraw()
|
||||||
|
{
|
||||||
|
glActiveTexture (GL_TEXTURE0);
|
||||||
|
glDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
glDepthMask(0);
|
||||||
|
|
||||||
|
int r=m_BrushSize;
|
||||||
|
// iterate through selected patches
|
||||||
|
for (int j=m_SelectionCentre[1]-r;j<=m_SelectionCentre[1]+r;j++) {
|
||||||
|
for (int i=m_SelectionCentre[0]-r;i<=m_SelectionCentre[0]+r;i++) {
|
||||||
|
RenderTileOutline(i,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
glDepthMask(1);
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushTool::OnLButtonDown(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
m_LButtonDown=true;
|
||||||
|
OnTriggerLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushTool::OnLButtonUp(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
m_LButtonDown=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushTool::OnRButtonDown(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
m_RButtonDown=true;
|
||||||
|
OnTriggerRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushTool::OnRButtonUp(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
m_RButtonDown=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// BuildCameraRay: calculate origin and ray direction of a ray through
|
||||||
|
// the pixel (px,py) on the screen
|
||||||
|
void CBrushTool::BuildCameraRay(int px,int py,CVector3D& origin,CVector3D& dir)
|
||||||
|
{
|
||||||
|
// get points on far plane of frustum in camera space
|
||||||
|
CCamera& camera=g_NaviCam.GetCamera();
|
||||||
|
CVector3D cPts[4];
|
||||||
|
camera.GetCameraPlanePoints(camera.GetFarPlane(),cPts);
|
||||||
|
|
||||||
|
// transform to world space
|
||||||
|
CVector3D wPts[4];
|
||||||
|
for (int i=0;i<4;i++) {
|
||||||
|
wPts[i]=camera.m_Orientation.Transform(cPts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get world space position of mouse point
|
||||||
|
float dx=float(px)/float(g_Renderer.GetWidth());
|
||||||
|
float dz=1-float(py)/float(g_Renderer.GetHeight());
|
||||||
|
CVector3D vdx=wPts[1]-wPts[0];
|
||||||
|
CVector3D vdz=wPts[3]-wPts[0];
|
||||||
|
CVector3D pt=wPts[0]+(vdx*dx)+(vdz*dz);
|
||||||
|
|
||||||
|
// copy origin
|
||||||
|
origin=camera.m_Orientation.GetTranslation();
|
||||||
|
// build direction
|
||||||
|
dir=pt-origin;
|
||||||
|
dir.Normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBrushTool::OnMouseMove(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
// build camera ray
|
||||||
|
CVector3D rayorigin,raydir;
|
||||||
|
BuildCameraRay(px,py,rayorigin,raydir);
|
||||||
|
|
||||||
|
// intersect with terrain
|
||||||
|
CVector3D ipt;
|
||||||
|
CHFTracer hftracer(g_Terrain.GetHeightMap(),g_Terrain.GetVerticesPerSide(),float(CELL_SIZE),HEIGHT_SCALE);
|
||||||
|
if (hftracer.RayIntersect(rayorigin,raydir,m_SelectionCentre[0],m_SelectionCentre[1],m_SelectionPoint)) {
|
||||||
|
// drag trigger supported?
|
||||||
|
if (SupportDragTrigger()) {
|
||||||
|
// yes - handle mouse button down state
|
||||||
|
if (m_LButtonDown) {
|
||||||
|
OnTriggerLeft();
|
||||||
|
} else if (m_RButtonDown) {
|
||||||
|
OnTriggerRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
64
source/sced/BrushTool.h
Executable file
64
source/sced/BrushTool.h
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#ifndef _BRUSHTOOL_H
|
||||||
|
#define _BRUSHTOOL_H
|
||||||
|
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "Tool.h"
|
||||||
|
#include "Vector3D.h"
|
||||||
|
|
||||||
|
class CPatch;
|
||||||
|
class CMiniPatch;
|
||||||
|
|
||||||
|
class CBrushTool : public CTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CBrushTool();
|
||||||
|
|
||||||
|
// draw the visual representation of this tool
|
||||||
|
virtual void OnDraw();
|
||||||
|
// callback for left button down event
|
||||||
|
virtual void OnLButtonDown(unsigned int flags,int px,int py);
|
||||||
|
// callback for left button up event
|
||||||
|
virtual void OnLButtonUp(unsigned int flags,int px,int py);
|
||||||
|
// callback for right button down event
|
||||||
|
virtual void OnRButtonDown(unsigned int flags,int px,int py);
|
||||||
|
// callback for right button up event
|
||||||
|
virtual void OnRButtonUp(unsigned int flags,int px,int py);
|
||||||
|
// callback for mouse move event
|
||||||
|
virtual void OnMouseMove(unsigned int flags,int px,int py);
|
||||||
|
|
||||||
|
// action to take when tool is triggered via left mouse, or left mouse + drag
|
||||||
|
virtual void OnTriggerLeft() {};
|
||||||
|
// action to take when tool is triggered via right mouse, or right mouse + drag
|
||||||
|
virtual void OnTriggerRight() {};
|
||||||
|
|
||||||
|
// set current brush size
|
||||||
|
void SetBrushSize(int size) { m_BrushSize=size; }
|
||||||
|
// get current brush size
|
||||||
|
int GetBrushSize() { return m_BrushSize; }
|
||||||
|
|
||||||
|
// virtual function: allow multiple triggers by click and drag? - else requires individual clicks
|
||||||
|
// to invoke trigger .. default to off
|
||||||
|
virtual bool SupportDragTrigger() { return false; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// build camera ray through screen point (px,py)
|
||||||
|
void BuildCameraRay(int px,int py,CVector3D& origin,CVector3D& dir);
|
||||||
|
// return true if given tile is on border of selection, false otherwise
|
||||||
|
bool IsBorderSelection(int gx,int gz);
|
||||||
|
// return true if given tile is a neighbour of the a border of selection, false otherwise
|
||||||
|
bool IsNeighbourSelection(int gx,int gz);
|
||||||
|
// build a selection of the given radius around the given minipatch
|
||||||
|
void BuildSelection(int radius,CPatch* patch,CMiniPatch* minipatch);
|
||||||
|
// left mouse button currently down?
|
||||||
|
bool m_LButtonDown;
|
||||||
|
// right mouse button currently down?
|
||||||
|
bool m_RButtonDown;
|
||||||
|
// current tool brush size
|
||||||
|
int m_BrushSize;
|
||||||
|
// centre of current selection
|
||||||
|
int m_SelectionCentre[2];
|
||||||
|
// world space "projection" of mouse point - somewhere in the m_SelectionCentre tile
|
||||||
|
CVector3D m_SelectionPoint;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
56
source/sced/ColorButton.cpp
Executable file
56
source/sced/ColorButton.cpp
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
// ColorButton.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "ColorButton.h"
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColorButton
|
||||||
|
|
||||||
|
CColorButton::CColorButton() : m_Color(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CColorButton::~CColorButton()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CColorButton, CButton)
|
||||||
|
//{{AFX_MSG_MAP(CColorButton)
|
||||||
|
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColorButton message handlers
|
||||||
|
|
||||||
|
void CColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||||
|
{
|
||||||
|
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||||
|
CRect rect = lpDrawItemStruct->rcItem;
|
||||||
|
|
||||||
|
// draw button edges
|
||||||
|
pDC->DrawFrameControl(rect, DFC_BUTTON,DFCS_BUTTONPUSH | DFCS_FLAT );
|
||||||
|
|
||||||
|
// deflate the drawing rect by the size of the button's edges
|
||||||
|
rect.DeflateRect( CSize(GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)));
|
||||||
|
|
||||||
|
// fill the interior color
|
||||||
|
pDC->FillSolidRect(rect,m_Color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CColorButton::OnClicked()
|
||||||
|
{
|
||||||
|
CColorDialog dlg;
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
// store color in button
|
||||||
|
m_Color=dlg.m_cc.rgbResult;
|
||||||
|
// force redraw
|
||||||
|
Invalidate();
|
||||||
|
UpdateWindow();
|
||||||
|
}
|
||||||
|
}
|
77
source/sced/ColorButton.h
Executable file
77
source/sced/ColorButton.h
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
#if !defined(AFX_COLORBUTTON_H__DBA27321_CEB1_4D75_9225_AFF2B02FCD82__INCLUDED_)
|
||||||
|
#define AFX_COLORBUTTON_H__DBA27321_CEB1_4D75_9225_AFF2B02FCD82__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// ColorButton.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
|
inline void ColorRefToRGBColor(COLORREF c,RGBColor& result)
|
||||||
|
{
|
||||||
|
result.X=(c & 0xff)/255.0f;
|
||||||
|
result.Y=((c>>8) & 0xff)/255.0f;
|
||||||
|
result.Z=((c>>16) & 0xff)/255.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void RGBColorToColorRef(const RGBColor& c,COLORREF& result)
|
||||||
|
{
|
||||||
|
int r=int(c.X*255);
|
||||||
|
if (r<0) r=0;
|
||||||
|
if (r>255) r=255;
|
||||||
|
|
||||||
|
int g=int(c.Y*255);
|
||||||
|
if (g<0) g=0;
|
||||||
|
if (g>255) g=255;
|
||||||
|
|
||||||
|
int b=int(c.Z*255);
|
||||||
|
if (b<0) b=0;
|
||||||
|
if (b>255) b=255;
|
||||||
|
|
||||||
|
result=r | (g<<8) | (b<<16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CColorButton window
|
||||||
|
|
||||||
|
class CColorButton : public CButton
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CColorButton();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
COLORREF m_Color;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CColorButton)
|
||||||
|
public:
|
||||||
|
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CColorButton();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CColorButton)
|
||||||
|
afx_msg void OnClicked();
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_COLORBUTTON_H__DBA27321_CEB1_4D75_9225_AFF2B02FCD82__INCLUDED_)
|
24
source/sced/Command.h
Executable file
24
source/sced/Command.h
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef _COMMAND_H
|
||||||
|
#define _COMMAND_H
|
||||||
|
|
||||||
|
class CCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// virtual destructor
|
||||||
|
virtual ~CCommand() {}
|
||||||
|
|
||||||
|
// return the texture name of this command
|
||||||
|
virtual const char* GetName() const { return 0; }
|
||||||
|
|
||||||
|
// execute this command
|
||||||
|
virtual void Execute() = 0;
|
||||||
|
|
||||||
|
// can undo command?
|
||||||
|
virtual bool IsUndoable() const = 0;
|
||||||
|
// undo
|
||||||
|
virtual void Undo() {}
|
||||||
|
// redo
|
||||||
|
virtual void Redo() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
127
source/sced/CommandManager.cpp
Executable file
127
source/sced/CommandManager.cpp
Executable file
@ -0,0 +1,127 @@
|
|||||||
|
#include "Command.h"
|
||||||
|
#include "CommandManager.h"
|
||||||
|
|
||||||
|
CCommandManager g_CmdMan;
|
||||||
|
|
||||||
|
CCommandManager::CCommandManager() : m_CommandHistoryLength(128), m_HistoryPos(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCommandManager::~CCommandManager()
|
||||||
|
{
|
||||||
|
ClearHistory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Append: add given command to the end of the history list, without
|
||||||
|
// executing it
|
||||||
|
void CCommandManager::Append(CCommand* cmd)
|
||||||
|
{
|
||||||
|
if (cmd->IsUndoable()) {
|
||||||
|
// remove all existing commands from current position to end
|
||||||
|
CommandList::iterator iter=GetIterator(m_HistoryPos+1);
|
||||||
|
for (CommandList::iterator i=iter;i!=m_CommandHistory.end();++i) {
|
||||||
|
delete *i;
|
||||||
|
}
|
||||||
|
m_CommandHistory.erase(iter,m_CommandHistory.end());
|
||||||
|
|
||||||
|
// add new command to end
|
||||||
|
m_CommandHistory.push_back(cmd);
|
||||||
|
|
||||||
|
// check for history that's too big
|
||||||
|
if (m_CommandHistory.size()>m_CommandHistoryLength) {
|
||||||
|
CCommand* cmd=m_CommandHistory.front();
|
||||||
|
m_CommandHistory.pop_front();
|
||||||
|
delete cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update history position to point at last command executed
|
||||||
|
m_HistoryPos=m_CommandHistory.size()-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Execute: execute the given command, then add it to the end of the history list
|
||||||
|
void CCommandManager::Execute(CCommand* cmd)
|
||||||
|
{
|
||||||
|
cmd->Execute();
|
||||||
|
Append(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCommandManager::CommandList::iterator CCommandManager::GetIterator(int pos)
|
||||||
|
{
|
||||||
|
if (pos<0 || uint(pos)>=m_CommandHistory.size()) return m_CommandHistory.end();
|
||||||
|
|
||||||
|
typedef CommandList::iterator Iter;
|
||||||
|
int count=0;
|
||||||
|
for (Iter iter=m_CommandHistory.begin();iter!=m_CommandHistory.end();++iter) {
|
||||||
|
if (count==pos) {
|
||||||
|
return iter;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// hmm .. shouldn't get here
|
||||||
|
return m_CommandHistory.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCommand* CCommandManager::GetUndoCommand()
|
||||||
|
{
|
||||||
|
CommandList::iterator iter=GetIterator(m_HistoryPos);
|
||||||
|
if (iter!=m_CommandHistory.end()) {
|
||||||
|
return *iter;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCommandManager::Undo()
|
||||||
|
{
|
||||||
|
CCommand* cmd=GetUndoCommand();
|
||||||
|
if (cmd) {
|
||||||
|
cmd->Undo();
|
||||||
|
m_HistoryPos--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CCommandManager::GetUndoName()
|
||||||
|
{
|
||||||
|
CCommand* cmd=GetUndoCommand();
|
||||||
|
return cmd ? cmd->GetName() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCommand* CCommandManager::GetRedoCommand()
|
||||||
|
{
|
||||||
|
CommandList::iterator iter=GetIterator(m_HistoryPos+1);
|
||||||
|
if (iter!=m_CommandHistory.end()) {
|
||||||
|
return *iter;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCommandManager::Redo()
|
||||||
|
{
|
||||||
|
CCommand* cmd=GetRedoCommand();
|
||||||
|
if (cmd) {
|
||||||
|
cmd->Redo();
|
||||||
|
m_HistoryPos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CCommandManager::GetRedoName()
|
||||||
|
{
|
||||||
|
CCommand* cmd=GetRedoCommand();
|
||||||
|
return cmd ? cmd->GetName() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CCommandManager::ClearHistory()
|
||||||
|
{
|
||||||
|
// empty out command history
|
||||||
|
while (m_CommandHistory.size()>0) {
|
||||||
|
CCommand* cmd=m_CommandHistory.front();
|
||||||
|
m_CommandHistory.pop_front();
|
||||||
|
delete cmd;
|
||||||
|
}
|
||||||
|
}
|
39
source/sced/CommandManager.h
Executable file
39
source/sced/CommandManager.h
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef _COMMANDMANAGER_H
|
||||||
|
#define _COMMANDMANAGER_H
|
||||||
|
|
||||||
|
class CCommand;
|
||||||
|
#include <list>
|
||||||
|
#include "res/res.h"
|
||||||
|
|
||||||
|
class CCommandManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommandManager();
|
||||||
|
~CCommandManager();
|
||||||
|
|
||||||
|
void Append(CCommand* cmd);
|
||||||
|
void Execute(CCommand* cmd);
|
||||||
|
|
||||||
|
void Undo();
|
||||||
|
const char* GetUndoName();
|
||||||
|
|
||||||
|
void Redo();
|
||||||
|
const char* GetRedoName();
|
||||||
|
|
||||||
|
void ClearHistory();
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef std::list<CCommand*> CommandList;
|
||||||
|
|
||||||
|
CommandList::iterator GetIterator(int pos);
|
||||||
|
CCommand* GetUndoCommand();
|
||||||
|
CCommand* GetRedoCommand();
|
||||||
|
|
||||||
|
i32 m_HistoryPos;
|
||||||
|
u32 m_CommandHistoryLength;
|
||||||
|
CommandList m_CommandHistory;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CCommandManager g_CmdMan;
|
||||||
|
|
||||||
|
#endif
|
96
source/sced/DirectionButton.cpp
Executable file
96
source/sced/DirectionButton.cpp
Executable file
@ -0,0 +1,96 @@
|
|||||||
|
// DirectionButton.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "DirectionButton.h"
|
||||||
|
|
||||||
|
#include "MathUtil.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDirectionButton
|
||||||
|
|
||||||
|
CDirectionButton::CDirectionButton() : m_Direction(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CDirectionButton::~CDirectionButton()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CDirectionButton, CButton)
|
||||||
|
//{{AFX_MSG_MAP(CDirectionButton)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDirectionButton message handlers
|
||||||
|
|
||||||
|
void CDirectionButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||||
|
{
|
||||||
|
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||||
|
CRect rect = lpDrawItemStruct->rcItem;
|
||||||
|
|
||||||
|
// draw button edges
|
||||||
|
pDC->DrawFrameControl(rect, DFC_BUTTON,DFCS_BUTTONPUSH | DFCS_FLAT );
|
||||||
|
|
||||||
|
// deflate the drawing rect by the size of the button's edges
|
||||||
|
rect.DeflateRect( CSize(GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)));
|
||||||
|
// fill the interior color
|
||||||
|
pDC->FillSolidRect(rect,RGB(0,0,0));
|
||||||
|
|
||||||
|
// shrink rect before drawing anything else
|
||||||
|
rect.DeflateRect(15,15);
|
||||||
|
|
||||||
|
// create a hollow brush
|
||||||
|
CBrush brush;
|
||||||
|
brush.CreateStockObject(HOLLOW_BRUSH);
|
||||||
|
CBrush* oldbrush=pDC->SelectObject(&brush);
|
||||||
|
|
||||||
|
// draw circle
|
||||||
|
pDC->SetROP2(R2_WHITE);
|
||||||
|
pDC->Ellipse(&rect);
|
||||||
|
|
||||||
|
// draw direction arrow
|
||||||
|
pDC->SetROP2(R2_COPYPEN);
|
||||||
|
CPen pen;
|
||||||
|
pen.CreatePen(PS_SOLID,1,RGB(255,0,0));
|
||||||
|
CPen* oldpen=pDC->SelectObject(&pen);
|
||||||
|
|
||||||
|
float cx=float(rect.bottom+rect.top)/2.0f;
|
||||||
|
float cy=float(rect.bottom+rect.top)/2.0f;
|
||||||
|
|
||||||
|
float dy=float(rect.bottom-rect.top)/2.0f;
|
||||||
|
float dx=float(rect.right-rect.left)/2.0f;
|
||||||
|
float r=(float) sqrt(dx*dx+dy*dy);
|
||||||
|
|
||||||
|
float dirx=sin(DEGTORAD(m_Direction));
|
||||||
|
float diry=cos(DEGTORAD(m_Direction));
|
||||||
|
|
||||||
|
CPoint m_One(int(cx+dirx*r),int(cy+diry*r));
|
||||||
|
CPoint m_Two(int(cx+dirx*(r-14)),int(cy+diry*(r-14)));
|
||||||
|
|
||||||
|
double slopy , cosy , siny;
|
||||||
|
double Par = 6.5; //length of Arrow (>)
|
||||||
|
slopy = atan2( float( m_One.y - m_Two.y ),float( m_One.x - m_Two.x ) );
|
||||||
|
cosy = cos( slopy );
|
||||||
|
siny = sin( slopy ); //need math.h for these functions
|
||||||
|
|
||||||
|
//draw a line between the 2 endpoint
|
||||||
|
pDC->MoveTo( m_One );
|
||||||
|
pDC->LineTo( m_Two );
|
||||||
|
|
||||||
|
pDC->MoveTo( m_Two );
|
||||||
|
pDC->LineTo( m_Two.x + int( Par * cosy - ( Par / 2.0 * siny ) ),
|
||||||
|
m_Two.y + int( Par * siny + ( Par / 2.0 * cosy ) ) );
|
||||||
|
pDC->LineTo( m_Two.x + int( Par * cosy + Par / 2.0 * siny ),
|
||||||
|
m_Two.y - int( Par / 2.0 * cosy - Par * siny ) );
|
||||||
|
pDC->LineTo( m_Two );
|
||||||
|
|
||||||
|
|
||||||
|
pDC->SelectObject(oldpen);
|
||||||
|
pDC->SelectObject(oldbrush);
|
||||||
|
}
|
51
source/sced/DirectionButton.h
Executable file
51
source/sced/DirectionButton.h
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#if !defined(AFX_DIRECTIONBUTTON_H__C66DCA94_4F09_41D8_8CAA_C2AF5EDA38D8__INCLUDED_)
|
||||||
|
#define AFX_DIRECTIONBUTTON_H__C66DCA94_4F09_41D8_8CAA_C2AF5EDA38D8__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// DirectionButton.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CDirectionButton window
|
||||||
|
|
||||||
|
class CDirectionButton : public CButton
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CDirectionButton();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
float m_Direction;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CDirectionButton)
|
||||||
|
public:
|
||||||
|
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CDirectionButton();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CDirectionButton)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_DIRECTIONBUTTON_H__C66DCA94_4F09_41D8_8CAA_C2AF5EDA38D8__INCLUDED_)
|
658
source/sced/EditorData.cpp
Executable file
658
source/sced/EditorData.cpp
Executable file
@ -0,0 +1,658 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include "EditorData.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
#include "ToolManager.h"
|
||||||
|
#include "ObjectManager.h"
|
||||||
|
#include "UnitManager.h"
|
||||||
|
#include "TextureManager.h"
|
||||||
|
#include "Model.h"
|
||||||
|
#include "SkeletonAnimManager.h"
|
||||||
|
|
||||||
|
#include "ogl.h"
|
||||||
|
#include "res/tex.h"
|
||||||
|
#include "time.h"
|
||||||
|
|
||||||
|
#include "BaseEntityCollection.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "EntityHandles.h"
|
||||||
|
#include "EntityManager.h"
|
||||||
|
|
||||||
|
const int NUM_ALPHA_MAPS = 14;
|
||||||
|
Handle AlphaMaps[NUM_ALPHA_MAPS];
|
||||||
|
|
||||||
|
CTerrain g_Terrain;
|
||||||
|
CLightEnv g_LightEnv;
|
||||||
|
CMiniMap g_MiniMap;
|
||||||
|
CEditorData g_EditorData;
|
||||||
|
|
||||||
|
CEditorData::CEditorData()
|
||||||
|
{
|
||||||
|
m_ModelMatrix.SetIdentity();
|
||||||
|
m_ScenarioName="Scenario01";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::SetMode(EditMode mode)
|
||||||
|
{
|
||||||
|
if (m_Mode==TEST_MODE && mode!=TEST_MODE) StopTestMode();
|
||||||
|
m_Mode=mode;
|
||||||
|
if (m_Mode==TEST_MODE) StartTestMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEditorData::InitScene()
|
||||||
|
{
|
||||||
|
// setup default lighting environment
|
||||||
|
g_LightEnv.m_SunColor=RGBColor(1,1,1);
|
||||||
|
g_LightEnv.m_Rotation=DEGTORAD(270);
|
||||||
|
g_LightEnv.m_Elevation=DEGTORAD(45);
|
||||||
|
g_LightEnv.m_TerrainAmbientColor=RGBColor(0,0,0);
|
||||||
|
g_LightEnv.m_UnitsAmbientColor=RGBColor(0.4f,0.4f,0.4f);
|
||||||
|
g_Renderer.SetLightEnv(&g_LightEnv);
|
||||||
|
|
||||||
|
// load the default
|
||||||
|
if (!LoadTerrain("terrain.raw")) return false;
|
||||||
|
|
||||||
|
// get default texture to apply to terrain
|
||||||
|
CTextureEntry* texture=0;
|
||||||
|
for (uint i=0;i<g_TexMan.m_TerrainTextures.size();i++) {
|
||||||
|
if (g_TexMan.m_TerrainTextures[i].m_Textures.size()) {
|
||||||
|
texture=g_TexMan.m_TerrainTextures[i].m_Textures[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// cover entire terrain with default texture
|
||||||
|
u32 patchesPerSide=g_Terrain.GetPatchesPerSide();
|
||||||
|
for (uint pj=0; pj<patchesPerSide; pj++) {
|
||||||
|
for (uint pi=0; pi<patchesPerSide; pi++) {
|
||||||
|
|
||||||
|
CPatch* patch=g_Terrain.GetPatch(pi,pj);
|
||||||
|
|
||||||
|
for (int j=0;j<16;j++) {
|
||||||
|
for (int i=0;i<16;i++) {
|
||||||
|
patch->m_MiniPatches[j][i].Tex1=texture ? texture->m_Handle : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup camera
|
||||||
|
InitCamera();
|
||||||
|
|
||||||
|
// build the terrain plane
|
||||||
|
float h=128*HEIGHT_SCALE;
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
CVector3D pt0(0,h,0),pt1(float(CELL_SIZE*mapSize),h,0),pt2(0,h,float(CELL_SIZE*mapSize));
|
||||||
|
m_TerrainPlane.Set(pt0,pt1,pt2);
|
||||||
|
m_TerrainPlane.Normalize();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct TGAHeader {
|
||||||
|
// header stuff
|
||||||
|
unsigned char iif_size;
|
||||||
|
unsigned char cmap_type;
|
||||||
|
unsigned char image_type;
|
||||||
|
unsigned char pad[5];
|
||||||
|
|
||||||
|
// origin : unused
|
||||||
|
unsigned short d_x_origin;
|
||||||
|
unsigned short d_y_origin;
|
||||||
|
|
||||||
|
// dimensions
|
||||||
|
unsigned short width;
|
||||||
|
unsigned short height;
|
||||||
|
|
||||||
|
// bits per pixel : 16, 24 or 32
|
||||||
|
unsigned char bpp;
|
||||||
|
|
||||||
|
// image descriptor : Bits 3-0: size of alpha channel
|
||||||
|
// Bit 4: must be 0 (reserved)
|
||||||
|
// Bit 5: should be 0 (origin)
|
||||||
|
// Bits 6-7: should be 0 (interleaving)
|
||||||
|
unsigned char image_descriptor;
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool saveTGA(const char* filename,int width,int height,unsigned char* data)
|
||||||
|
{
|
||||||
|
FILE* fp=fopen(filename,"wb");
|
||||||
|
if (!fp) return false;
|
||||||
|
|
||||||
|
// fill file header
|
||||||
|
TGAHeader header;
|
||||||
|
header.iif_size=0;
|
||||||
|
header.cmap_type=0;
|
||||||
|
header.image_type=2;
|
||||||
|
memset(header.pad,0,sizeof(header.pad));
|
||||||
|
header.d_x_origin=0;
|
||||||
|
header.d_y_origin=0;
|
||||||
|
header.width=width;
|
||||||
|
header.height=height;
|
||||||
|
header.bpp=24;
|
||||||
|
header.image_descriptor=0;
|
||||||
|
|
||||||
|
if (fwrite(&header,sizeof(TGAHeader),1,fp)!=1) {
|
||||||
|
fclose(fp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write data
|
||||||
|
if (fwrite(data,width*height*3,1,fp)!=1) {
|
||||||
|
fclose(fp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return success ..
|
||||||
|
fclose(fp);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::LoadAlphaMaps()
|
||||||
|
{
|
||||||
|
const char* fns[CRenderer::NumAlphaMaps] = {
|
||||||
|
"art/textures/terrain/alphamaps/special/blendcircle.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendlshape.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendedge.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendedgecorner.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendedgetwocorners.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendfourcorners.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendtwooppositecorners.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendlshapecorner.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendtwocorners.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendcorner.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendtwoedges.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendthreecorners.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendushape.png",
|
||||||
|
"art/textures/terrain/alphamaps/special/blendbad.png"
|
||||||
|
};
|
||||||
|
|
||||||
|
g_Renderer.LoadAlphaMaps(fns);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::InitResources()
|
||||||
|
{
|
||||||
|
g_TexMan.LoadTerrainTextures();
|
||||||
|
LoadAlphaMaps();
|
||||||
|
g_ObjMan.LoadObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// InitSingletons: create and initialise required singletons
|
||||||
|
void CEditorData::InitSingletons()
|
||||||
|
{
|
||||||
|
// create terrain related stuff
|
||||||
|
new CTextureManager;
|
||||||
|
|
||||||
|
// create actor related stuff
|
||||||
|
new CSkeletonAnimManager;
|
||||||
|
new CObjectManager;
|
||||||
|
new CUnitManager;
|
||||||
|
|
||||||
|
// create entity related stuff
|
||||||
|
new CBaseEntityCollection;
|
||||||
|
new CEntityManager;
|
||||||
|
g_EntityTemplateCollection.loadTemplates();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Init: perform one time initialisation of the editor
|
||||||
|
bool CEditorData::Init()
|
||||||
|
{
|
||||||
|
// create and initialise singletons
|
||||||
|
InitSingletons();
|
||||||
|
|
||||||
|
// load default textures
|
||||||
|
InitResources();
|
||||||
|
|
||||||
|
// create the scene - terrain, camera, light environment etc
|
||||||
|
if (!InitScene()) return false;
|
||||||
|
|
||||||
|
// set up an empty minimap
|
||||||
|
g_MiniMap.Initialise();
|
||||||
|
|
||||||
|
// set up the info box
|
||||||
|
m_InfoBox.Initialise();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Terminate: close down the editor (destroy singletons in reverse order to construction)
|
||||||
|
void CEditorData::Terminate()
|
||||||
|
{
|
||||||
|
// destroy entity related stuff
|
||||||
|
delete CEntityManager::GetSingletonPtr();
|
||||||
|
delete CBaseEntityCollection::GetSingletonPtr();
|
||||||
|
|
||||||
|
// destroy actor related stuff
|
||||||
|
delete CUnitManager::GetSingletonPtr();
|
||||||
|
delete CObjectManager::GetSingletonPtr();
|
||||||
|
delete CSkeletonAnimManager::GetSingletonPtr();
|
||||||
|
|
||||||
|
// destroy terrain related stuff
|
||||||
|
delete CTextureManager::GetSingletonPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::InitCamera()
|
||||||
|
{
|
||||||
|
g_NaviCam.GetCamera().SetProjection(1.0f,10000.0f,DEGTORAD(90));
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.SetIdentity();
|
||||||
|
#ifdef TOPDOWNVIEW
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.RotateX(DEGTORAD(90));
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.Translate(CELL_SIZE*250*0.5, 80, CELL_SIZE*250*0.5);
|
||||||
|
#else
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.RotateX(DEGTORAD(40));
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.RotateY(DEGTORAD(-45));
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.Translate(600, 200, 125);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
OnCameraChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::OnCameraChanged()
|
||||||
|
{
|
||||||
|
int width=g_Renderer.GetWidth();
|
||||||
|
int height=g_Renderer.GetHeight();
|
||||||
|
|
||||||
|
// resize viewport
|
||||||
|
SViewPort viewport;
|
||||||
|
viewport.m_X=0;
|
||||||
|
viewport.m_Y=0;
|
||||||
|
viewport.m_Width=width;
|
||||||
|
viewport.m_Height=height;
|
||||||
|
g_NaviCam.GetCamera().SetViewPort(&viewport);
|
||||||
|
|
||||||
|
// rebuild object camera
|
||||||
|
m_ObjectCamera.SetViewPort(&viewport);
|
||||||
|
m_ObjectCamera.SetProjection(1.0f,10000.0f,DEGTORAD(90));
|
||||||
|
|
||||||
|
|
||||||
|
// recalculate projection matrix
|
||||||
|
g_NaviCam.GetCamera().SetProjection(1.0f,10000.0f,DEGTORAD(20));
|
||||||
|
|
||||||
|
// update viewing frustum
|
||||||
|
g_NaviCam.GetCamera().UpdateFrustum();
|
||||||
|
|
||||||
|
// calculate intersection of camera stabbing lines with terrain plane
|
||||||
|
|
||||||
|
// get points of back plane of frustum in camera space
|
||||||
|
float aspect=height>0 ? float(width)/float(height) : 1.0f;
|
||||||
|
float zfar=g_NaviCam.GetCamera().GetFarPlane();
|
||||||
|
CVector3D cPts[4];
|
||||||
|
float x=zfar*float(tan(g_NaviCam.GetCamera().GetFOV()*aspect*0.5));
|
||||||
|
float y=zfar*float(tan(g_NaviCam.GetCamera().GetFOV()*0.5));
|
||||||
|
cPts[0].X=-x;
|
||||||
|
cPts[0].Y=-y;
|
||||||
|
cPts[0].Z=zfar;
|
||||||
|
cPts[1].X=x;
|
||||||
|
cPts[1].Y=-y;
|
||||||
|
cPts[1].Z=zfar;
|
||||||
|
cPts[2].X=x;
|
||||||
|
cPts[2].Y=y;
|
||||||
|
cPts[2].Z=zfar;
|
||||||
|
cPts[3].X=-x;
|
||||||
|
cPts[3].Y=y;
|
||||||
|
cPts[3].Z=zfar;
|
||||||
|
|
||||||
|
// transform to world space
|
||||||
|
CVector3D wPts[4];
|
||||||
|
for (int i=0;i<4;i++) {
|
||||||
|
wPts[i]=g_NaviCam.GetCamera().m_Orientation.Transform(cPts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// now intersect a ray from the camera through each point
|
||||||
|
CVector3D rayOrigin=g_NaviCam.GetCamera().m_Orientation.GetTranslation();
|
||||||
|
CVector3D rayDir=g_NaviCam.GetCamera().m_Orientation.GetIn();
|
||||||
|
|
||||||
|
CVector3D hitPt[4];
|
||||||
|
for (i=0;i<4;i++) {
|
||||||
|
CVector3D rayDir=wPts[i]-rayOrigin;
|
||||||
|
rayDir.Normalize();
|
||||||
|
|
||||||
|
// get intersection point
|
||||||
|
m_TerrainPlane.FindRayIntersection(rayOrigin,rayDir,&hitPt[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0;i<4;i++) {
|
||||||
|
// convert to minimap space
|
||||||
|
float px=hitPt[i].X;
|
||||||
|
float pz=hitPt[i].Z;
|
||||||
|
g_MiniMap.m_ViewRect[i][0]=(197*px/float(CELL_SIZE*g_Terrain.GetVerticesPerSide()));
|
||||||
|
g_MiniMap.m_ViewRect[i][1]=197*pz/float(CELL_SIZE*g_Terrain.GetVerticesPerSide());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::RenderTerrain()
|
||||||
|
{
|
||||||
|
CFrustum frustum=g_NaviCam.GetCamera().GetFustum();
|
||||||
|
u32 patchesPerSide=g_Terrain.GetPatchesPerSide();
|
||||||
|
for (uint j=0; j<patchesPerSide; j++) {
|
||||||
|
for (uint i=0; i<patchesPerSide; i++) {
|
||||||
|
CPatch* patch=g_Terrain.GetPatch(i,j);
|
||||||
|
if (frustum.IsBoxVisible (CVector3D(0,0,0),patch->GetBounds())) {
|
||||||
|
g_Renderer.Submit(patch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::OnScreenShot(const char* filename)
|
||||||
|
{
|
||||||
|
g_Renderer.SetClearColor(0);
|
||||||
|
g_Renderer.BeginFrame();
|
||||||
|
g_Renderer.SetCamera(g_NaviCam.GetCamera());
|
||||||
|
|
||||||
|
RenderWorld();
|
||||||
|
|
||||||
|
g_Renderer.EndFrame();
|
||||||
|
|
||||||
|
int width=g_Renderer.GetWidth();
|
||||||
|
int height=g_Renderer.GetHeight();
|
||||||
|
unsigned char* data=new unsigned char[width*height*3];
|
||||||
|
|
||||||
|
glReadBuffer(GL_BACK);
|
||||||
|
glReadPixels(0,0,width,height,GL_BGR_EXT,GL_UNSIGNED_BYTE,data);
|
||||||
|
|
||||||
|
saveTGA(filename,width,height,data);
|
||||||
|
|
||||||
|
delete[] data;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SubmitModelRecursive: recurse down given model, submitting it and all it's descendents to the
|
||||||
|
// renderer
|
||||||
|
void SubmitModelRecursive(CModel* model)
|
||||||
|
{
|
||||||
|
g_Renderer.Submit(model);
|
||||||
|
|
||||||
|
const std::vector<CModel::Prop>& props=model->GetProps();
|
||||||
|
for (uint i=0;i<props.size();i++) {
|
||||||
|
SubmitModelRecursive(props[i].m_Model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// RenderNoCull: render absolutely everything to a blank frame to force renderer
|
||||||
|
// to load required assets
|
||||||
|
void CEditorData::RenderNoCull()
|
||||||
|
{
|
||||||
|
g_Renderer.BeginFrame();
|
||||||
|
g_Renderer.SetCamera(g_NaviCam.GetCamera());
|
||||||
|
|
||||||
|
uint i,j;
|
||||||
|
const std::vector<CUnit*>& units=g_UnitMan.GetUnits();
|
||||||
|
for (i=0;i<units.size();++i) {
|
||||||
|
SubmitModelRecursive(units[i]->GetModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 patchesPerSide=g_Terrain.GetPatchesPerSide();
|
||||||
|
for (j=0; j<patchesPerSide; j++) {
|
||||||
|
for (i=0; i<patchesPerSide; i++) {
|
||||||
|
CPatch* patch=g_Terrain.GetPatch(i,j);
|
||||||
|
g_Renderer.Submit(patch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Renderer.FlushFrame();
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||||
|
g_Renderer.EndFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::RenderModels()
|
||||||
|
{
|
||||||
|
CFrustum frustum=g_NaviCam.GetCamera().GetFustum();
|
||||||
|
|
||||||
|
const std::vector<CUnit*>& units=g_UnitMan.GetUnits();
|
||||||
|
uint i;
|
||||||
|
for (i=0;i<units.size();++i) {
|
||||||
|
if (frustum.IsBoxVisible (CVector3D(0,0,0),units[i]->GetModel()->GetBounds())) {
|
||||||
|
SubmitModelRecursive(units[i]->GetModel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::RenderWorld()
|
||||||
|
{
|
||||||
|
// render terrain
|
||||||
|
RenderTerrain();
|
||||||
|
|
||||||
|
// render all the units
|
||||||
|
RenderModels();
|
||||||
|
|
||||||
|
// flush prior to rendering overlays etc
|
||||||
|
g_Renderer.FlushFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::RenderObEdGrid()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const int numSteps=32;
|
||||||
|
const CVector3D start(-numSteps*CELL_SIZE/2,0,-numSteps*CELL_SIZE/2);
|
||||||
|
const CVector3D end(numSteps*CELL_SIZE/2,0,numSteps*CELL_SIZE/2);
|
||||||
|
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
glDepthMask(0);
|
||||||
|
glColor4f(0.5f,0.5f,0.5f,0.35f);
|
||||||
|
glLineWidth(1.0f);
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
for (i=0;i<=numSteps;i++) {
|
||||||
|
if (i%8==0) continue;
|
||||||
|
CVector3D v0(start.X+(i*(end.X-start.X))/float(numSteps),start.Y,start.Z);
|
||||||
|
glVertex3fv(&v0.X);
|
||||||
|
|
||||||
|
CVector3D v1(v0.X,end.Y,end.Z);
|
||||||
|
glVertex3fv(&v1.X);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0;i<=numSteps;i++) {
|
||||||
|
if (i%8==0) continue;
|
||||||
|
CVector3D v0(start.X,start.Y,start.Z+(i*(end.Z-start.Z))/float(numSteps));
|
||||||
|
glVertex3fv(&v0.X);
|
||||||
|
|
||||||
|
CVector3D v1(end.X,end.Y,v0.Z);
|
||||||
|
glVertex3fv(&v1.X);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
|
glColor3f(0,0,0.5);
|
||||||
|
glLineWidth(2.0f);
|
||||||
|
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
for (i=0;i<=numSteps;i+=8) {
|
||||||
|
CVector3D v0(start.X+(i*(end.X-start.X))/float(numSteps),start.Y,start.Z);
|
||||||
|
glVertex3fv(&v0.X);
|
||||||
|
|
||||||
|
CVector3D v1(v0.X,end.Y,end.Z);
|
||||||
|
glVertex3fv(&v1.X);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0;i<=numSteps;i+=8) {
|
||||||
|
CVector3D v0(start.X,start.Y,start.Z+(i*(end.Z-start.Z))/float(numSteps));
|
||||||
|
glVertex3fv(&v0.X);
|
||||||
|
|
||||||
|
CVector3D v1(end.X,end.Y,v0.Z);
|
||||||
|
glVertex3fv(&v1.X);
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
glDepthMask(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::OnDraw()
|
||||||
|
{
|
||||||
|
if (m_Mode==SCENARIO_EDIT || m_Mode==TEST_MODE) {
|
||||||
|
g_Renderer.SetClearColor(0);
|
||||||
|
g_Renderer.BeginFrame();
|
||||||
|
|
||||||
|
// setup camera
|
||||||
|
g_Renderer.SetCamera(g_NaviCam.GetCamera());
|
||||||
|
|
||||||
|
// render base terrain plus models
|
||||||
|
RenderWorld();
|
||||||
|
|
||||||
|
if (m_Mode!=TEST_MODE) {
|
||||||
|
// render the active tool
|
||||||
|
g_ToolMan.OnDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
// flush prior to rendering overlays ..
|
||||||
|
g_Renderer.FlushFrame();
|
||||||
|
|
||||||
|
// .. and here's the overlays
|
||||||
|
g_MiniMap.Render();
|
||||||
|
m_InfoBox.Render();
|
||||||
|
} else {
|
||||||
|
g_Renderer.SetClearColor(0x00453015);
|
||||||
|
g_Renderer.BeginFrame();
|
||||||
|
|
||||||
|
CObjectEntry* selobject=g_ObjMan.GetSelectedObject();
|
||||||
|
if (selobject && selobject->m_Model) {
|
||||||
|
// setup camera such that object is in the centre of the viewport
|
||||||
|
m_ModelMatrix.SetIdentity();
|
||||||
|
selobject->m_Model->SetTransform(m_ModelMatrix);
|
||||||
|
|
||||||
|
const CBound& bound=selobject->m_Model->GetBounds();
|
||||||
|
CVector3D pt((bound[0].X+bound[1].X)*0.5f,(bound[0].Y+bound[1].Y)*0.5f,bound[0].Z);
|
||||||
|
|
||||||
|
float hfov=tan(DEGTORAD(45));
|
||||||
|
float vfov=hfov/g_Renderer.GetAspect();
|
||||||
|
float zx=(bound[1].X-bound[0].X)*0.5f/hfov;
|
||||||
|
float zy=(bound[1].Y-bound[0].Y)*0.5f/vfov;
|
||||||
|
float z=zx>zy ? zx : zy;
|
||||||
|
z=(z+1)*2;
|
||||||
|
|
||||||
|
m_ObjectCamera.m_Orientation.SetIdentity();
|
||||||
|
m_ObjectCamera.m_Orientation.Translate(pt.X,pt.Y,-z);
|
||||||
|
|
||||||
|
g_Renderer.SetCamera(m_ObjectCamera);
|
||||||
|
|
||||||
|
RenderObEdGrid();
|
||||||
|
|
||||||
|
g_Renderer.Submit(selobject->m_Model);
|
||||||
|
}
|
||||||
|
|
||||||
|
// flush prior to rendering overlays ..
|
||||||
|
g_Renderer.FlushFrame();
|
||||||
|
|
||||||
|
// .. and here's the overlays
|
||||||
|
m_InfoBox.Render();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Renderer.EndFrame();
|
||||||
|
|
||||||
|
// notify info box frame is complete; gives it chance to accumulate stats, check
|
||||||
|
// fps, etc
|
||||||
|
m_InfoBox.OnFrameComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CEditorData::LoadTerrain(const char* filename)
|
||||||
|
{
|
||||||
|
Handle h = tex_load(filename);
|
||||||
|
if(h<=0) {
|
||||||
|
char buf[1024];
|
||||||
|
sprintf(buf,"Failed to load \"%s\"",filename);
|
||||||
|
ErrorBox(buf);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
int width=0;
|
||||||
|
int height=0;
|
||||||
|
int bpp=0;
|
||||||
|
void *ptr=0;
|
||||||
|
|
||||||
|
int i=tex_info(h, &width, &height, NULL, &bpp, &ptr);
|
||||||
|
if (i)
|
||||||
|
{
|
||||||
|
printf("tex_info error: %d\n",i);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rescale the texture to fit to the nearest of the 4 possible map sizes
|
||||||
|
u32 mapsize=9; // assume smallest map
|
||||||
|
if (width>11*16+1) mapsize=11;
|
||||||
|
if (width>13*16+1) mapsize=13;
|
||||||
|
if (width>17*16+1) mapsize=17;
|
||||||
|
|
||||||
|
u32 targetsize=mapsize*16+1;
|
||||||
|
unsigned char* data=new unsigned char[targetsize*targetsize*bpp/8];
|
||||||
|
u32 fmt=(bpp==8) ? GL_RED : ((bpp==24) ? GL_RGB : GL_RGBA);
|
||||||
|
gluScaleImage(fmt,width,height,GL_UNSIGNED_BYTE,ptr,
|
||||||
|
targetsize,targetsize,GL_UNSIGNED_BYTE,data);
|
||||||
|
|
||||||
|
// build 16 bit heightmap from red channel of texture
|
||||||
|
u16* heightmap=new u16[targetsize*targetsize];
|
||||||
|
int stride=bpp/8;
|
||||||
|
u16* hmptr=heightmap;
|
||||||
|
|
||||||
|
// get src of copy
|
||||||
|
const u8* dataptr = (bpp==8) ? data : ((bpp==24) ? data+2 : data+3);
|
||||||
|
|
||||||
|
// build heightmap
|
||||||
|
for (uint j=0;j<targetsize;++j) {
|
||||||
|
for (uint i=0;i<targetsize;++i) {
|
||||||
|
*hmptr=(*dataptr) << 8;
|
||||||
|
hmptr++;
|
||||||
|
dataptr+=stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rebuild terrain
|
||||||
|
g_Terrain.Resize(mapsize);
|
||||||
|
g_Terrain.SetHeightMap(heightmap);
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
delete[] data;
|
||||||
|
delete[] heightmap;
|
||||||
|
|
||||||
|
// re-initialise minimap - terrain size may have changed
|
||||||
|
g_MiniMap.Initialise();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateWorld: update time dependent data in the world to account for changes over
|
||||||
|
// the given time (in s)
|
||||||
|
void CEditorData::UpdateWorld(float time)
|
||||||
|
{
|
||||||
|
if (m_Mode==SCENARIO_EDIT || m_Mode==TEST_MODE) {
|
||||||
|
const std::vector<CUnit*>& units=g_UnitMan.GetUnits();
|
||||||
|
for (uint i=0;i<units.size();++i) {
|
||||||
|
units[i]->GetModel()->Update(time);
|
||||||
|
}
|
||||||
|
if (m_Mode==TEST_MODE) {
|
||||||
|
g_EntityManager.updateAll( time );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CObjectEntry* selobject=g_ObjMan.GetSelectedObject();
|
||||||
|
if (selobject && selobject->m_Model) {
|
||||||
|
selobject->m_Model->Update(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::StartTestMode()
|
||||||
|
{
|
||||||
|
// initialise entities
|
||||||
|
g_EntityManager.dispatchAll( &CMessage( CMessage::EMSG_INIT ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditorData::StopTestMode()
|
||||||
|
{
|
||||||
|
// make all units idle again
|
||||||
|
const std::vector<CUnit*>& units=g_UnitMan.GetUnits();
|
||||||
|
for (uint i=0;i<units.size();++i) {
|
||||||
|
if (units[i]->GetObject()->m_IdleAnim) {
|
||||||
|
units[i]->GetModel()->SetAnimation(units[i]->GetObject()->m_IdleAnim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
82
source/sced/EditorData.h
Executable file
82
source/sced/EditorData.h
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
#ifndef _EDITORDATA_H
|
||||||
|
#define _EDITORDATA_H
|
||||||
|
|
||||||
|
#include "MiniMap.h"
|
||||||
|
#include "InfoBox.h"
|
||||||
|
#include "PaintTextureTool.h"
|
||||||
|
#include "NaviCam.h"
|
||||||
|
#include "CStr.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
#include "Renderer.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "LightEnv.h"
|
||||||
|
|
||||||
|
class CEditorData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum EditMode { SCENARIO_EDIT, UNIT_EDIT, BRUSH_EDIT, TEST_MODE };
|
||||||
|
|
||||||
|
public:
|
||||||
|
CEditorData();
|
||||||
|
|
||||||
|
void SetMode(EditMode mode);
|
||||||
|
EditMode GetMode() const { return m_Mode; }
|
||||||
|
|
||||||
|
// initialise editor at given width, height and bpp
|
||||||
|
bool Init();
|
||||||
|
void Terminate();
|
||||||
|
|
||||||
|
void OnCameraChanged();
|
||||||
|
void OnDraw();
|
||||||
|
void OnScreenShot(const char* filename);
|
||||||
|
|
||||||
|
CInfoBox& GetInfoBox() { return m_InfoBox; }
|
||||||
|
|
||||||
|
// terrain plane
|
||||||
|
CPlane m_TerrainPlane;
|
||||||
|
|
||||||
|
// set the scenario name
|
||||||
|
void SetScenarioName(const char* name) { m_ScenarioName=name; }
|
||||||
|
// get the scenario name
|
||||||
|
const char* GetScenarioName() const { return (const char*) m_ScenarioName; }
|
||||||
|
|
||||||
|
bool LoadTerrain(const char* filename);
|
||||||
|
|
||||||
|
// update time dependent data in the world to account for changes over
|
||||||
|
// the given time (in ms)
|
||||||
|
void UpdateWorld(float time);
|
||||||
|
|
||||||
|
void RenderNoCull();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool InitScene();
|
||||||
|
void LoadAlphaMaps();
|
||||||
|
void InitResources();
|
||||||
|
void InitCamera();
|
||||||
|
void RenderTerrain();
|
||||||
|
void RenderModels();
|
||||||
|
void RenderWorld();
|
||||||
|
void RenderObEdGrid();
|
||||||
|
|
||||||
|
void InitSingletons();
|
||||||
|
|
||||||
|
void StartTestMode();
|
||||||
|
void StopTestMode();
|
||||||
|
|
||||||
|
// current editing mode
|
||||||
|
EditMode m_Mode;
|
||||||
|
// camera to use in object viewing mode
|
||||||
|
CCamera m_ObjectCamera;
|
||||||
|
// transform of model in object viewing mode
|
||||||
|
CMatrix3D m_ModelMatrix;
|
||||||
|
// information panel
|
||||||
|
CInfoBox m_InfoBox;
|
||||||
|
// the (short) name of this scenario used in title bar and as default save name
|
||||||
|
CStr m_ScenarioName;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CEditorData g_EditorData;
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
extern CLightEnv g_LightEnv;
|
||||||
|
|
||||||
|
#endif
|
187
source/sced/ElevToolsDlgBar.cpp
Executable file
187
source/sced/ElevToolsDlgBar.cpp
Executable file
@ -0,0 +1,187 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "ToolManager.h"
|
||||||
|
#include "ElevToolsDlgBar.h"
|
||||||
|
#include "RaiseElevationTool.h"
|
||||||
|
#include "SmoothElevationTool.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CElevToolsDlgBar, CDialogBar)
|
||||||
|
//{{AFX_MSG_MAP(CElevToolsDlgBar)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
ON_BN_CLICKED(IDC_RADIO_RAISE, OnRadioRaise)
|
||||||
|
ON_BN_CLICKED(IDC_RADIO_SMOOTH, OnRadioSmooth)
|
||||||
|
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_BRUSHEFFECT, OnReleasedCaptureSliderBrushEffect)
|
||||||
|
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_BRUSHSIZE, OnReleasedCaptureSliderBrushSize)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
CElevToolsDlgBar::CElevToolsDlgBar() : m_Mode(RAISELOWER_MODE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CElevToolsDlgBar::~CElevToolsDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CElevToolsDlgBar::Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!CDialogBar::Create(pParentWnd, lpszTemplateName, nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OnInitDialog()) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CElevToolsDlgBar::Create(CWnd * pParentWnd, UINT nIDTemplate,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::SetRaiseControls()
|
||||||
|
{
|
||||||
|
// set up brush size slider
|
||||||
|
CSliderCtrl* sizectrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
sizectrl->SetRange(0,CRaiseElevationTool::MAX_BRUSH_SIZE,TRUE);
|
||||||
|
sizectrl->SetPos(CRaiseElevationTool::GetTool()->GetBrushSize());
|
||||||
|
|
||||||
|
// set up brush effect slider
|
||||||
|
CSliderCtrl* effectctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHEFFECT);
|
||||||
|
effectctrl->SetRange(1,CRaiseElevationTool::MAX_SPEED/16,TRUE);
|
||||||
|
effectctrl->SetPos(CRaiseElevationTool::GetTool()->GetSpeed()/16);
|
||||||
|
|
||||||
|
// setup radio buttons
|
||||||
|
CheckDlgButton(IDC_RADIO_RAISE,TRUE);
|
||||||
|
CheckDlgButton(IDC_RADIO_SMOOTH,FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::SetSmoothControls()
|
||||||
|
{
|
||||||
|
// set up brush size slider
|
||||||
|
CSliderCtrl* sizectrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
sizectrl->SetRange(0,CSmoothElevationTool::MAX_BRUSH_SIZE,TRUE);
|
||||||
|
sizectrl->SetPos(CSmoothElevationTool::GetTool()->GetBrushSize());
|
||||||
|
|
||||||
|
// set up brush effect slider
|
||||||
|
CSliderCtrl* effectctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHEFFECT);
|
||||||
|
effectctrl->SetRange(1,int(CSmoothElevationTool::MAX_SMOOTH_POWER),TRUE);
|
||||||
|
effectctrl->SetPos(int(CSmoothElevationTool::GetTool()->GetSmoothPower()));
|
||||||
|
|
||||||
|
// setup radio buttons
|
||||||
|
CheckDlgButton(IDC_RADIO_RAISE,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_SMOOTH,TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CElevToolsDlgBar::OnInitDialog()
|
||||||
|
{
|
||||||
|
// get the current window size and position
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
|
||||||
|
// now change the size, position, and Z order of the window.
|
||||||
|
::SetWindowPos(m_hWnd,HWND_TOPMOST,10,rect.top,rect.Width(),rect.Height(),SWP_HIDEWINDOW);
|
||||||
|
|
||||||
|
// initially show raise controls
|
||||||
|
SetRaiseControls();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
|
||||||
|
{
|
||||||
|
bDisableIfNoHndler = FALSE;
|
||||||
|
CDialogBar::OnUpdateCmdUI(pTarget,bDisableIfNoHndler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::OnReleasedCaptureSliderBrushSize(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
if (IsDlgButtonChecked(IDC_RADIO_RAISE)) {
|
||||||
|
CRaiseElevationTool::GetTool()->SetBrushSize(sliderctrl->GetPos());
|
||||||
|
} else {
|
||||||
|
CSmoothElevationTool::GetTool()->SetBrushSize(sliderctrl->GetPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::OnReleasedCaptureSliderBrushEffect(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHEFFECT);
|
||||||
|
if (IsDlgButtonChecked(IDC_RADIO_RAISE)) {
|
||||||
|
CRaiseElevationTool::GetTool()->SetSpeed(sliderctrl->GetPos()*16);
|
||||||
|
} else {
|
||||||
|
CSmoothElevationTool::GetTool()->SetSmoothPower(float(sliderctrl->GetPos()));
|
||||||
|
}
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::OnShow()
|
||||||
|
{
|
||||||
|
switch (m_Mode) {
|
||||||
|
case RAISELOWER_MODE:
|
||||||
|
SetRaiseControls();
|
||||||
|
g_ToolMan.SetActiveTool(CRaiseElevationTool::GetTool());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SMOOTH_MODE:
|
||||||
|
SetSmoothControls();
|
||||||
|
g_ToolMan.SetActiveTool(CSmoothElevationTool::GetTool());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::OnRadioRaise()
|
||||||
|
{
|
||||||
|
// set UI elements for raise/lower
|
||||||
|
SetRaiseControls();
|
||||||
|
|
||||||
|
// set current tool
|
||||||
|
g_ToolMan.SetActiveTool(CRaiseElevationTool::GetTool());
|
||||||
|
|
||||||
|
// redraw sliders
|
||||||
|
CWnd* sizeslider=GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
sizeslider->Invalidate();
|
||||||
|
sizeslider->UpdateWindow();
|
||||||
|
|
||||||
|
CWnd* effectslider=GetDlgItem(IDC_SLIDER_BRUSHEFFECT);
|
||||||
|
effectslider->Invalidate();
|
||||||
|
effectslider->UpdateWindow();
|
||||||
|
|
||||||
|
// store mode
|
||||||
|
m_Mode=RAISELOWER_MODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CElevToolsDlgBar::OnRadioSmooth()
|
||||||
|
{
|
||||||
|
// set UI elements for smooth
|
||||||
|
SetSmoothControls();
|
||||||
|
|
||||||
|
// set current tool
|
||||||
|
g_ToolMan.SetActiveTool(CSmoothElevationTool::GetTool());
|
||||||
|
|
||||||
|
// redraw sliders
|
||||||
|
CWnd* sizeslider=GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
sizeslider->Invalidate();
|
||||||
|
sizeslider->UpdateWindow();
|
||||||
|
|
||||||
|
CWnd* effectslider=GetDlgItem(IDC_SLIDER_BRUSHEFFECT);
|
||||||
|
effectslider->Invalidate();
|
||||||
|
effectslider->UpdateWindow();
|
||||||
|
|
||||||
|
// store mode
|
||||||
|
m_Mode=SMOOTH_MODE;
|
||||||
|
}
|
||||||
|
|
38
source/sced/ElevToolsDlgBar.h
Executable file
38
source/sced/ElevToolsDlgBar.h
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef _ELEVTOOLSDLGBAR_H
|
||||||
|
#define _ELEVTOOLSDLGBAR_H
|
||||||
|
|
||||||
|
class CElevToolsDlgBar : public CDialogBar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Mode { RAISELOWER_MODE, SMOOTH_MODE };
|
||||||
|
|
||||||
|
CElevToolsDlgBar();
|
||||||
|
~CElevToolsDlgBar();
|
||||||
|
|
||||||
|
BOOL Create(CWnd * pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID);
|
||||||
|
BOOL Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID);
|
||||||
|
void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
|
||||||
|
|
||||||
|
void OnShow();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL OnInitDialog();
|
||||||
|
|
||||||
|
void SetRaiseControls();
|
||||||
|
void SetSmoothControls();
|
||||||
|
|
||||||
|
// current operating mode
|
||||||
|
Mode m_Mode;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CElevToolsDlgBar)
|
||||||
|
afx_msg void OnRadioRaise();
|
||||||
|
afx_msg void OnRadioSmooth();
|
||||||
|
afx_msg void OnReleasedCaptureSliderBrushSize(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnReleasedCaptureSliderBrushEffect(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
98
source/sced/ElevationButton.cpp
Executable file
98
source/sced/ElevationButton.cpp
Executable file
@ -0,0 +1,98 @@
|
|||||||
|
// ElevationButton.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "ElevationButton.h"
|
||||||
|
|
||||||
|
#include "MathUtil.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CElevationButton
|
||||||
|
|
||||||
|
CElevationButton::CElevationButton() : m_Elevation(45)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CElevationButton::~CElevationButton()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CElevationButton, CButton)
|
||||||
|
//{{AFX_MSG_MAP(CElevationButton)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CElevationButton message handlers
|
||||||
|
|
||||||
|
void CElevationButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||||
|
{
|
||||||
|
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||||
|
CRect rect = lpDrawItemStruct->rcItem;
|
||||||
|
|
||||||
|
// draw button edges
|
||||||
|
pDC->DrawFrameControl(rect, DFC_BUTTON,DFCS_BUTTONPUSH | DFCS_FLAT );
|
||||||
|
|
||||||
|
// deflate the drawing rect by the size of the button's edges
|
||||||
|
rect.DeflateRect( CSize(GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)));
|
||||||
|
|
||||||
|
// fill the interior color
|
||||||
|
pDC->FillSolidRect(rect,RGB(0,0,0));
|
||||||
|
|
||||||
|
// shrink rect before drawing anything else
|
||||||
|
rect.DeflateRect(15,5);
|
||||||
|
|
||||||
|
// create a hollow brush
|
||||||
|
CBrush brush;
|
||||||
|
brush.CreateStockObject(HOLLOW_BRUSH);
|
||||||
|
CBrush* oldbrush=pDC->SelectObject(&brush);
|
||||||
|
|
||||||
|
// draw horizon
|
||||||
|
pDC->SetROP2(R2_WHITE);
|
||||||
|
pDC->MoveTo(rect.left,rect.bottom);
|
||||||
|
pDC->LineTo(rect.right,rect.bottom);
|
||||||
|
|
||||||
|
// draw direction arrow
|
||||||
|
pDC->SetROP2(R2_COPYPEN);
|
||||||
|
CPen pen;
|
||||||
|
pen.CreatePen(PS_SOLID,1,RGB(255,0,0));
|
||||||
|
CPen* oldpen=pDC->SelectObject(&pen);
|
||||||
|
|
||||||
|
float dy=float(rect.bottom-rect.top)/2.0f;
|
||||||
|
float dx=float(rect.right-rect.left)/2.0f;
|
||||||
|
float r=(float) sqrt(2*dx*dx);
|
||||||
|
|
||||||
|
float cx=float(rect.left+rect.right)/2.0f;
|
||||||
|
float cy=float(rect.bottom);
|
||||||
|
|
||||||
|
float dirx=cos(DEGTORAD(m_Elevation));
|
||||||
|
float diry=-sin(DEGTORAD(m_Elevation));
|
||||||
|
|
||||||
|
CPoint m_One(int(cx+dirx*r),int(cy+diry*r));
|
||||||
|
CPoint m_Two(int(cx+dirx*(r-14)),int(cy+diry*(r-14)));
|
||||||
|
|
||||||
|
double slopy , cosy , siny;
|
||||||
|
double Par = 6.5; //length of Arrow (>)
|
||||||
|
slopy = atan2( float( m_One.y - m_Two.y ),float( m_One.x - m_Two.x ) );
|
||||||
|
cosy = cos( slopy );
|
||||||
|
siny = sin( slopy ); //need math.h for these functions
|
||||||
|
|
||||||
|
//draw a line between the 2 endpoint
|
||||||
|
pDC->MoveTo( m_One );
|
||||||
|
pDC->LineTo( m_Two );
|
||||||
|
|
||||||
|
pDC->MoveTo( m_Two );
|
||||||
|
pDC->LineTo( m_Two.x + int( Par * cosy - ( Par / 2.0 * siny ) ),
|
||||||
|
m_Two.y + int( Par * siny + ( Par / 2.0 * cosy ) ) );
|
||||||
|
pDC->LineTo( m_Two.x + int( Par * cosy + Par / 2.0 * siny ),
|
||||||
|
m_Two.y - int( Par / 2.0 * cosy - Par * siny ) );
|
||||||
|
pDC->LineTo( m_Two );
|
||||||
|
|
||||||
|
|
||||||
|
pDC->SelectObject(oldpen);
|
||||||
|
pDC->SelectObject(oldbrush);
|
||||||
|
}
|
51
source/sced/ElevationButton.h
Executable file
51
source/sced/ElevationButton.h
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#if !defined(AFX_ELEVATIONBUTTON_H__7CD052F1_193A_46B3_9EC6_81A52F9A2399__INCLUDED_)
|
||||||
|
#define AFX_ELEVATIONBUTTON_H__7CD052F1_193A_46B3_9EC6_81A52F9A2399__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// ElevationButton.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CElevationButton window
|
||||||
|
|
||||||
|
class CElevationButton : public CButton
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CElevationButton();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
float m_Elevation;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CElevationButton)
|
||||||
|
public:
|
||||||
|
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CElevationButton();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CElevationButton)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_ELEVATIONBUTTON_H__7CD052F1_193A_46B3_9EC6_81A52F9A2399__INCLUDED_)
|
31
source/sced/ImageListCtrl.cpp
Executable file
31
source/sced/ImageListCtrl.cpp
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// ImageListCtrl.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "ImageListCtrl.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CImageListCtrl
|
||||||
|
|
||||||
|
CImageListCtrl::CImageListCtrl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CImageListCtrl::~CImageListCtrl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CImageListCtrl, CListCtrl)
|
||||||
|
//{{AFX_MSG_MAP(CImageListCtrl)
|
||||||
|
ON_WM_DRAWITEM()
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CImageListCtrl message handlers
|
||||||
|
|
||||||
|
void CImageListCtrl::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||||
|
{
|
||||||
|
}
|
48
source/sced/ImageListCtrl.h
Executable file
48
source/sced/ImageListCtrl.h
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#if !defined(AFX_IMAGELISTCTRL_H__EAFCDB8A_5A00_4F1E_966A_3036315B92E0__INCLUDED_)
|
||||||
|
#define AFX_IMAGELISTCTRL_H__EAFCDB8A_5A00_4F1E_966A_3036315B92E0__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// ImageListCtrl.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CImageListCtrl window
|
||||||
|
|
||||||
|
class CImageListCtrl : public CListCtrl
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CImageListCtrl();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CImageListCtrl)
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CImageListCtrl();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CImageListCtrl)
|
||||||
|
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_IMAGELISTCTRL_H__EAFCDB8A_5A00_4F1E_966A_3036315B92E0__INCLUDED_)
|
241
source/sced/InfoBox.cpp
Executable file
241
source/sced/InfoBox.cpp
Executable file
@ -0,0 +1,241 @@
|
|||||||
|
#include "InfoBox.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "ogl.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include "NPFont.h"
|
||||||
|
#include "NPFontManager.h"
|
||||||
|
#include "OverlayText.h"
|
||||||
|
#include "Renderer.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const char* DefaultFontName="mods/official/fonts/verdana18.fnt";
|
||||||
|
|
||||||
|
CInfoBox::CInfoBox() : m_Font(0), m_Visible(false)
|
||||||
|
{
|
||||||
|
m_LastFPSTime=get_time();
|
||||||
|
m_Stats.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInfoBox::Initialise()
|
||||||
|
{
|
||||||
|
m_Font=NPFontManager::instance().add(DefaultFontName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInfoBox::Render()
|
||||||
|
{
|
||||||
|
if (!m_Visible) return;
|
||||||
|
|
||||||
|
const u32 panelColor=0x80f9527d;
|
||||||
|
const u32 borderColor=0xfffa0043;
|
||||||
|
|
||||||
|
// setup renderstate
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDepthMask(0);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
// load identity modelview
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
// setup ortho view
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
int w=g_Renderer.GetWidth();
|
||||||
|
int h=g_Renderer.GetHeight();
|
||||||
|
glOrtho(0,w,0,h,-1,1);
|
||||||
|
|
||||||
|
glColor4ubv((const GLubyte*) &panelColor);
|
||||||
|
|
||||||
|
// render infobox as quad
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glVertex2i(3,h-180);
|
||||||
|
glVertex2i(150,h-180);
|
||||||
|
glVertex2i(150,h-2);
|
||||||
|
glVertex2i(3,h-2);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// render border
|
||||||
|
glColor4ubv((const GLubyte*) &borderColor);
|
||||||
|
|
||||||
|
glLineWidth(2);
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex2i(1,h-182);
|
||||||
|
glVertex2i(152,h-182);
|
||||||
|
glVertex2i(152,h-1);
|
||||||
|
glVertex2i(1,h-1);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// render any info now, assuming we've got a font
|
||||||
|
if (m_Font) {
|
||||||
|
RenderInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// restore matrices
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
// restore renderstate
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glDepthMask(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void render(COverlayText* overlaytext)
|
||||||
|
{
|
||||||
|
// get font on overlay
|
||||||
|
NPFont* font=overlaytext->GetFont();
|
||||||
|
if (!font) return;
|
||||||
|
|
||||||
|
const CStr& str=overlaytext->GetString();
|
||||||
|
int len=str.Length();
|
||||||
|
if (len==0) return;
|
||||||
|
|
||||||
|
// bind to font texture
|
||||||
|
g_Renderer.SetTexture(0,&font->texture());
|
||||||
|
|
||||||
|
// setup texenv
|
||||||
|
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
||||||
|
|
||||||
|
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
|
||||||
|
glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PRIMARY_COLOR);
|
||||||
|
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
|
||||||
|
|
||||||
|
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
|
||||||
|
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
|
||||||
|
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
|
||||||
|
|
||||||
|
// get overlay's position
|
||||||
|
float x,y;
|
||||||
|
overlaytext->GetPosition(x,y);
|
||||||
|
|
||||||
|
// setup color
|
||||||
|
const CColor& color=overlaytext->GetColor();
|
||||||
|
glColor4fv((float*) &color);
|
||||||
|
|
||||||
|
float x0=x;
|
||||||
|
float ftw=float(font->textureWidth());
|
||||||
|
float fth=float(font->textureHeight());
|
||||||
|
float fdy=float(font->height())/fth;
|
||||||
|
|
||||||
|
// submit quad verts for each character
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
|
for (int i=0;i<len;i++) {
|
||||||
|
// get pointer to char widths
|
||||||
|
const NPFont::CharData& cdata=font->chardata(str[i]);
|
||||||
|
const int* cw=&cdata._widthA;
|
||||||
|
|
||||||
|
if (cw[0]>0) x0+=cw[0];
|
||||||
|
|
||||||
|
// find the tile for this character
|
||||||
|
unsigned char c0=unsigned char(str[i]-32);
|
||||||
|
int ix=c0%font->numCols();
|
||||||
|
int iy=c0/font->numCols();
|
||||||
|
|
||||||
|
// calc UV coords of character in texture
|
||||||
|
float u0=float(ix*font->maxcharwidth()+cw[0]-1)/ftw;
|
||||||
|
float v0=float(iy*(font->height()+1))/fth;
|
||||||
|
float u1=u0+float(cw[1]+1)/ftw;
|
||||||
|
float v1=v0+fdy;
|
||||||
|
|
||||||
|
glTexCoord2f(u0,v0);
|
||||||
|
glVertex2f(x0,y);
|
||||||
|
|
||||||
|
glTexCoord2f(u1,v0);
|
||||||
|
glVertex2f(x0+float(cw[1]+1),y);
|
||||||
|
|
||||||
|
glTexCoord2f(u1,v1);
|
||||||
|
glVertex2f(x0+float(cw[1]+1),y+font->height());
|
||||||
|
|
||||||
|
glTexCoord2f(u0,v1);
|
||||||
|
glVertex2f(x0,y+font->height());
|
||||||
|
|
||||||
|
// translate such that next character is rendered in correct position
|
||||||
|
x0+=float(cw[1]+1);
|
||||||
|
if (cw[2]>0) x0+=cw[2];
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// unbind texture ..
|
||||||
|
g_Renderer.SetTexture(0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CInfoBox::RenderInfo()
|
||||||
|
{
|
||||||
|
int w=g_Renderer.GetWidth();
|
||||||
|
int h=g_Renderer.GetHeight();
|
||||||
|
|
||||||
|
char buf[32];
|
||||||
|
|
||||||
|
if (m_LastStats.m_Counter) {
|
||||||
|
u32 dy=m_Font->height()+2;
|
||||||
|
float y=float(h-dy);
|
||||||
|
|
||||||
|
sprintf(buf,"FPS: %d",int(m_LastStats.m_Counter/m_LastTickTime));
|
||||||
|
COverlayText fpstext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&fpstext);
|
||||||
|
y-=dy;
|
||||||
|
|
||||||
|
sprintf(buf,"FT: %.2f",1000*m_LastTickTime/float(m_LastStats.m_Counter));
|
||||||
|
COverlayText fttext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&fttext);
|
||||||
|
y-=dy;
|
||||||
|
|
||||||
|
u32 totalTris=m_LastStats.m_TerrainTris+m_LastStats.m_ModelTris+m_LastStats.m_TransparentTris;
|
||||||
|
sprintf(buf,"TPF: %d",int(totalTris/m_LastStats.m_Counter));
|
||||||
|
COverlayText tpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&tpftext);
|
||||||
|
y-=dy;
|
||||||
|
|
||||||
|
sprintf(buf,"TeTPF: %d",int(m_LastStats.m_TerrainTris/m_LastStats.m_Counter));
|
||||||
|
COverlayText tetpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&tetpftext);
|
||||||
|
y-=dy;
|
||||||
|
|
||||||
|
sprintf(buf,"MTPF: %d",int(m_LastStats.m_ModelTris/m_LastStats.m_Counter));
|
||||||
|
COverlayText mtpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&mtpftext);
|
||||||
|
y-=dy;
|
||||||
|
|
||||||
|
sprintf(buf,"TrTPF: %d",int(m_LastStats.m_TransparentTris/m_LastStats.m_Counter));
|
||||||
|
COverlayText trtpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&trtpftext);
|
||||||
|
y-=dy;
|
||||||
|
|
||||||
|
sprintf(buf,"DCPF: %d",int(m_LastStats.m_DrawCalls/m_LastStats.m_Counter));
|
||||||
|
COverlayText dcpftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&dcpftext);
|
||||||
|
y-=dy;
|
||||||
|
|
||||||
|
sprintf(buf,"SPPF: %d",int(m_LastStats.m_BlendSplats/m_LastStats.m_Counter));
|
||||||
|
COverlayText sppftext(5,y,0,DefaultFontName,buf,CColor(1,1,1,1));
|
||||||
|
render(&sppftext);
|
||||||
|
y-=dy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInfoBox::OnFrameComplete()
|
||||||
|
{
|
||||||
|
// accumulate stats
|
||||||
|
m_Stats+=g_Renderer.GetStats();
|
||||||
|
|
||||||
|
// fps check
|
||||||
|
double cur_time=get_time();
|
||||||
|
if (cur_time-m_LastFPSTime>1) {
|
||||||
|
// save tick time
|
||||||
|
m_LastTickTime=cur_time-m_LastFPSTime;
|
||||||
|
// save stats
|
||||||
|
m_LastStats=m_Stats;
|
||||||
|
// save time
|
||||||
|
m_LastFPSTime=cur_time;
|
||||||
|
// reset stats
|
||||||
|
m_Stats.Reset();
|
||||||
|
}
|
||||||
|
}
|
45
source/sced/InfoBox.h
Executable file
45
source/sced/InfoBox.h
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef _INFOBOX_H
|
||||||
|
#define _INFOBOX_H
|
||||||
|
|
||||||
|
class NPFont;
|
||||||
|
|
||||||
|
#include "Renderer.h"
|
||||||
|
|
||||||
|
class CInfoBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CInfoBox();
|
||||||
|
|
||||||
|
// setup the infobox
|
||||||
|
void Initialise();
|
||||||
|
// render out the info box
|
||||||
|
void Render();
|
||||||
|
// frame has been rendered out, update stats
|
||||||
|
void OnFrameComplete();
|
||||||
|
|
||||||
|
// set visibility
|
||||||
|
void SetVisible(bool flag) { m_Visible=flag; }
|
||||||
|
// get visibility
|
||||||
|
bool GetVisible() const { return m_Visible; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// text output: render any relevant current information
|
||||||
|
void RenderInfo();
|
||||||
|
|
||||||
|
// currently visible?
|
||||||
|
bool m_Visible;
|
||||||
|
// font to use rendering out text to the info box
|
||||||
|
NPFont* m_Font;
|
||||||
|
// current frame rate
|
||||||
|
double m_FPS;
|
||||||
|
// last known frame time
|
||||||
|
double m_LastFPSTime;
|
||||||
|
// accumulated stats
|
||||||
|
CRenderer::Stats m_Stats;
|
||||||
|
// time of the last 1 second "tick"
|
||||||
|
double m_LastTickTime;
|
||||||
|
// stats from last 1 second "tick"
|
||||||
|
CRenderer::Stats m_LastStats;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
170
source/sced/LightSettingsDlg.cpp
Executable file
170
source/sced/LightSettingsDlg.cpp
Executable file
@ -0,0 +1,170 @@
|
|||||||
|
// LightSettingsDlg.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "LightSettingsDlg.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "Terrain.h"
|
||||||
|
#include "LightEnv.h"
|
||||||
|
|
||||||
|
#include "CommandManager.h"
|
||||||
|
#include "AlterLightEnvCommand.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CLightSettingsDlg dialog
|
||||||
|
|
||||||
|
|
||||||
|
CLightSettingsDlg::CLightSettingsDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CLightSettingsDlg::IDD, pParent), m_PreviousPreview(false)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CLightSettingsDlg)
|
||||||
|
m_Direction = 270;
|
||||||
|
m_Elevation = 45;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CLightSettingsDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CLightSettingsDlg)
|
||||||
|
DDX_Control(pDX, IDC_BUTTON_UNITSAMBIENTCOLOR, m_UnitsAmbientColor);
|
||||||
|
DDX_Control(pDX, IDC_BUTTON_DIRECTION, m_DirectionButton);
|
||||||
|
DDX_Control(pDX, IDC_BUTTON_ELEVATION, m_ElevationButton);
|
||||||
|
DDX_Control(pDX, IDC_BUTTON_TERRAINAMBIENTCOLOR, m_TerrainAmbientColor);
|
||||||
|
DDX_Control(pDX, IDC_BUTTON_SUNCOLOR, m_SunColor);
|
||||||
|
DDX_Text(pDX, IDC_EDIT_DIRECTION, m_Direction);
|
||||||
|
DDX_Text(pDX, IDC_EDIT_ELEVATION, m_Elevation);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CLightSettingsDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CLightSettingsDlg)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_APPLY, OnButtonApply)
|
||||||
|
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_DIRECTION, OnDeltaposSpinDirection)
|
||||||
|
ON_EN_CHANGE(IDC_EDIT_DIRECTION, OnChangeEditDirection)
|
||||||
|
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_ELEVATION, OnDeltaposSpinElevation)
|
||||||
|
ON_EN_CHANGE(IDC_EDIT_ELEVATION, OnChangeEditElevation)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CLightSettingsDlg message handlers
|
||||||
|
|
||||||
|
|
||||||
|
void CLightSettingsDlg::OnButtonApply()
|
||||||
|
{
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
// have we previously applied a lightenv?
|
||||||
|
if (m_PreviousPreview) {
|
||||||
|
// yes - undo it
|
||||||
|
g_CmdMan.Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// build a lighting environment from the parameters
|
||||||
|
CLightEnv env;
|
||||||
|
env.m_Elevation=DEGTORAD(m_ElevationButton.m_Elevation);
|
||||||
|
env.m_Rotation=DEGTORAD(m_DirectionButton.m_Direction);
|
||||||
|
ColorRefToRGBColor(m_SunColor.m_Color,env.m_SunColor);
|
||||||
|
ColorRefToRGBColor(m_TerrainAmbientColor.m_Color,env.m_TerrainAmbientColor);
|
||||||
|
ColorRefToRGBColor(m_TerrainAmbientColor.m_Color,env.m_UnitsAmbientColor);
|
||||||
|
|
||||||
|
// create and execute an AlterLightEnv command
|
||||||
|
CAlterLightEnvCommand* cmd=new CAlterLightEnvCommand(env);
|
||||||
|
g_CmdMan.Execute(cmd);
|
||||||
|
|
||||||
|
AfxGetMainWnd()->Invalidate();
|
||||||
|
AfxGetMainWnd()->UpdateWindow();
|
||||||
|
|
||||||
|
m_PreviousPreview=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CLightSettingsDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
CSpinButtonCtrl* dirspin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_DIRECTION);
|
||||||
|
assert(dirspin);
|
||||||
|
dirspin->SetRange32(0,359);
|
||||||
|
dirspin->SetPos(m_Direction);
|
||||||
|
m_DirectionButton.m_Direction=float(m_Direction);
|
||||||
|
|
||||||
|
CSpinButtonCtrl* espin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_ELEVATION);
|
||||||
|
assert(espin);
|
||||||
|
espin->SetRange32(0,90);
|
||||||
|
espin->SetPos(m_Elevation);
|
||||||
|
m_ElevationButton.m_Elevation=float(m_Elevation);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLightSettingsDlg::OnDeltaposSpinDirection(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||||
|
|
||||||
|
// update direction button
|
||||||
|
if (!UpdateData(TRUE)) return;
|
||||||
|
CSpinButtonCtrl* dirspin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_DIRECTION);
|
||||||
|
m_Direction=dirspin->GetPos()+pNMUpDown->iDelta;
|
||||||
|
m_DirectionButton.m_Direction=float(m_Direction);
|
||||||
|
m_DirectionButton.Invalidate();
|
||||||
|
m_DirectionButton.UpdateWindow();
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLightSettingsDlg::OnChangeEditDirection()
|
||||||
|
{
|
||||||
|
if (IsWindow(m_DirectionButton.m_hWnd)) {
|
||||||
|
if (!UpdateData(TRUE)) return;
|
||||||
|
m_DirectionButton.m_Direction=float(m_Direction);
|
||||||
|
m_DirectionButton.Invalidate();
|
||||||
|
m_DirectionButton.UpdateWindow();
|
||||||
|
|
||||||
|
CSpinButtonCtrl* dirspin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_DIRECTION);
|
||||||
|
if (dirspin) dirspin->SetPos(m_Direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLightSettingsDlg::OnDeltaposSpinElevation(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||||
|
|
||||||
|
// update elevation button
|
||||||
|
if (!UpdateData(TRUE)) return;
|
||||||
|
CSpinButtonCtrl* espin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_ELEVATION);
|
||||||
|
m_Elevation=espin->GetPos()+pNMUpDown->iDelta;
|
||||||
|
m_ElevationButton.m_Elevation=float(m_Elevation);
|
||||||
|
m_ElevationButton.Invalidate();
|
||||||
|
m_ElevationButton.UpdateWindow();
|
||||||
|
|
||||||
|
UpdateData(FALSE);
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLightSettingsDlg::OnChangeEditElevation()
|
||||||
|
{
|
||||||
|
if (IsWindow(m_ElevationButton.m_hWnd)) {
|
||||||
|
if (!UpdateData(TRUE)) return;
|
||||||
|
|
||||||
|
m_ElevationButton.m_Elevation=float(m_Elevation);
|
||||||
|
m_ElevationButton.Invalidate();
|
||||||
|
m_ElevationButton.UpdateWindow();
|
||||||
|
|
||||||
|
CSpinButtonCtrl* espin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_ELEVATION);
|
||||||
|
if (espin) espin->SetPos(m_Elevation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
64
source/sced/LightSettingsDlg.h
Executable file
64
source/sced/LightSettingsDlg.h
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#if !defined(AFX_LIGHTSETTINGSDLG_H__B2A613AF_961F_4365_90A3_82DF9F713401__INCLUDED_)
|
||||||
|
#define AFX_LIGHTSETTINGSDLG_H__B2A613AF_961F_4365_90A3_82DF9F713401__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// LightSettingsDlg.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ColorButton.h"
|
||||||
|
#include "DirectionButton.h"
|
||||||
|
#include "ElevationButton.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CLightSettingsDlg dialog
|
||||||
|
|
||||||
|
class CLightSettingsDlg : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CLightSettingsDlg(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
bool m_PreviousPreview;
|
||||||
|
// Dialog Data
|
||||||
|
|
||||||
|
//{{AFX_DATA(CLightSettingsDlg)
|
||||||
|
enum { IDD = IDD_DIALOG_LIGHTSETTINGS };
|
||||||
|
CColorButton m_UnitsAmbientColor;
|
||||||
|
CDirectionButton m_DirectionButton;
|
||||||
|
CElevationButton m_ElevationButton;
|
||||||
|
CColorButton m_TerrainAmbientColor;
|
||||||
|
CColorButton m_SunColor;
|
||||||
|
int m_Direction;
|
||||||
|
int m_Elevation;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CLightSettingsDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CLightSettingsDlg)
|
||||||
|
afx_msg void OnButtonApply();
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnDeltaposSpinDirection(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnChangeEditDirection();
|
||||||
|
afx_msg void OnButtonTerrainambientcolor();
|
||||||
|
afx_msg void OnDeltaposSpinElevation(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnChangeEditElevation();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_LIGHTSETTINGSDLG_H__B2A613AF_961F_4365_90A3_82DF9F713401__INCLUDED_)
|
107
source/sced/MainFrameDlgBar.cpp
Executable file
107
source/sced/MainFrameDlgBar.cpp
Executable file
@ -0,0 +1,107 @@
|
|||||||
|
// MainFrameDlgBar.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
#include "MainFrameDlgBar.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMainFrameDlgBar, CDialogBar)
|
||||||
|
//{{AFX_MSG_MAP(CMainFrameDlgBar)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_SELECT, OnButtonSelect)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_TEXTURETOOLS, OnButtonTextureTools)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_ELEVATIONTOOLS, OnButtonElevationTools)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_MODELTOOLS, OnButtonModelTools)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrameDlgBar dialog
|
||||||
|
|
||||||
|
|
||||||
|
CMainFrameDlgBar::CMainFrameDlgBar()
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CMainFrameDlgBar)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMainFrameDlgBar::Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!CDialogBar::Create(pParentWnd, lpszTemplateName, nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OnInitDialog()) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMainFrameDlgBar::Create(CWnd * pParentWnd, UINT nIDTemplate,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrameDlgBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
|
||||||
|
{
|
||||||
|
bDisableIfNoHndler = FALSE;
|
||||||
|
CDialogBar::OnUpdateCmdUI(pTarget,bDisableIfNoHndler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrameDlgBar message handlers
|
||||||
|
|
||||||
|
void CMainFrameDlgBar::OnButtonSelect()
|
||||||
|
{
|
||||||
|
CMainFrame* parent=(CMainFrame*) GetParent();
|
||||||
|
parent->DeselectTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrameDlgBar::OnButtonTextureTools()
|
||||||
|
{
|
||||||
|
CMainFrame* parent=(CMainFrame*) GetParent();
|
||||||
|
parent->OnTextureTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrameDlgBar::OnButtonElevationTools()
|
||||||
|
{
|
||||||
|
CMainFrame* parent=(CMainFrame*) GetParent();
|
||||||
|
parent->OnElevationTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrameDlgBar::OnButtonModelTools()
|
||||||
|
{
|
||||||
|
CMainFrame* parent=(CMainFrame*) GetParent();
|
||||||
|
parent->OnUnitTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMainFrameDlgBar::OnInitDialog()
|
||||||
|
{
|
||||||
|
CButton* btnSelect=(CButton*) GetDlgItem(IDC_BUTTON_SELECT);
|
||||||
|
btnSelect->SetBitmap(::LoadBitmap(::GetModuleHandle(0),MAKEINTRESOURCE(IDB_BITMAP_SELECT)));
|
||||||
|
|
||||||
|
CButton* btnTexTools=(CButton*) GetDlgItem(IDC_BUTTON_TEXTURETOOLS);
|
||||||
|
btnTexTools->SetBitmap(::LoadBitmap(::GetModuleHandle(0),MAKEINTRESOURCE(IDB_BITMAP_TEXTURETOOLS)));
|
||||||
|
|
||||||
|
CButton* btnElevTools=(CButton*) GetDlgItem(IDC_BUTTON_ELEVATIONTOOLS);
|
||||||
|
btnElevTools->SetBitmap(::LoadBitmap(::GetModuleHandle(0),MAKEINTRESOURCE(IDB_BITMAP_ELEVATIONTOOLS)));
|
||||||
|
|
||||||
|
CButton* btnMdlTools=(CButton*) GetDlgItem(IDC_BUTTON_MODELTOOLS);
|
||||||
|
btnMdlTools->SetBitmap(::LoadBitmap(::GetModuleHandle(0),MAKEINTRESOURCE(IDB_BITMAP_MODELTOOLS)));
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
53
source/sced/MainFrameDlgBar.h
Executable file
53
source/sced/MainFrameDlgBar.h
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#if !defined(AFX_MAINFRAMEDLGBAR_H__B1EBAF6A_9AB1_4797_B859_3D47D8B011E0__INCLUDED_)
|
||||||
|
#define AFX_MAINFRAMEDLGBAR_H__B1EBAF6A_9AB1_4797_B859_3D47D8B011E0__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// MainFrameDlgBar.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrameDlgBar dialog
|
||||||
|
|
||||||
|
class CMainFrameDlgBar : public CDialogBar
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CMainFrameDlgBar(); // standard constructor
|
||||||
|
|
||||||
|
BOOL Create(CWnd * pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID);
|
||||||
|
BOOL Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID);
|
||||||
|
void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CMainFrameDlgBar)
|
||||||
|
enum { IDD = IDR_MAINFRAME };
|
||||||
|
// NOTE: the ClassWizard will add data members here
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMainFrameDlgBar)
|
||||||
|
protected:
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
BOOL OnInitDialog();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CMainFrameDlgBar)
|
||||||
|
afx_msg void OnButtonSelect();
|
||||||
|
afx_msg void OnButtonTextureTools();
|
||||||
|
afx_msg void OnButtonElevationTools();
|
||||||
|
afx_msg void OnButtonModelTools();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MAINFRAMEDLGBAR_H__B1EBAF6A_9AB1_4797_B859_3D47D8B011E0__INCLUDED_)
|
719
source/sced/MainFrm.cpp
Executable file
719
source/sced/MainFrm.cpp
Executable file
@ -0,0 +1,719 @@
|
|||||||
|
// MainFrm.cpp : implementation of the CMainFrame class
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
#include "ogl.h"
|
||||||
|
#include "res/tex.h"
|
||||||
|
#include "res/mem.h"
|
||||||
|
#include "res/vfs.h"
|
||||||
|
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "ScEdView.h"
|
||||||
|
#include "MiniMap.h"
|
||||||
|
#include "MapReader.h"
|
||||||
|
#include "MapWriter.h"
|
||||||
|
|
||||||
|
#include "UserConfig.h"
|
||||||
|
|
||||||
|
#include "Unit.h"
|
||||||
|
#include "UnitManager.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
#include "OptionsPropSheet.h"
|
||||||
|
#include "LightSettingsDlg.h"
|
||||||
|
#include "MapSizeDlg.h"
|
||||||
|
#include "EditorData.h"
|
||||||
|
#include "ToolManager.h"
|
||||||
|
#include "CommandManager.h"
|
||||||
|
|
||||||
|
#include "AlterLightEnvCommand.h"
|
||||||
|
|
||||||
|
#include "LightEnv.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
|
||||||
|
#include "PaintTextureTool.h"
|
||||||
|
#include "PaintObjectTool.h"
|
||||||
|
#include "RaiseElevationTool.h"
|
||||||
|
#include "BrushShapeEditorTool.h"
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
extern CLightEnv g_LightEnv;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
|
||||||
|
//{{AFX_MSG_MAP(CMainFrame)
|
||||||
|
ON_WM_CREATE()
|
||||||
|
ON_COMMAND(ID_TERRAIN_LOAD, OnTerrainLoad)
|
||||||
|
ON_COMMAND(ID_LIGHTING_SETTINGS, OnLightingSettings)
|
||||||
|
ON_COMMAND(ID_VIEW_SCREENSHOT, OnViewScreenshot)
|
||||||
|
ON_COMMAND(IDR_TEXTURE_TOOLS, OnTextureTools)
|
||||||
|
ON_COMMAND(ID_TOOLS_OPTIONS, OnToolsOptions)
|
||||||
|
ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo)
|
||||||
|
ON_COMMAND(ID_EDIT_REDO, OnEditRedo)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_EDIT_REDO, OnUpdateEditRedo)
|
||||||
|
ON_COMMAND(IDR_ELEVATION_TOOLS, OnElevationTools)
|
||||||
|
ON_COMMAND(IDR_RESIZE_MAP, OnResizeMap)
|
||||||
|
ON_COMMAND(ID_VIEW_TERRAIN_GRID, OnViewTerrainGrid)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_VIEW_TERRAIN_GRID, OnUpdateViewTerrainGrid)
|
||||||
|
ON_COMMAND(ID_VIEW_TERRAIN_SOLID, OnViewTerrainSolid)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_VIEW_TERRAIN_SOLID, OnUpdateViewTerrainSolid)
|
||||||
|
ON_COMMAND(ID_VIEW_TERRAIN_WIREFRAME, OnViewTerrainWireframe)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_VIEW_TERRAIN_WIREFRAME, OnUpdateViewTerrainWireframe)
|
||||||
|
ON_COMMAND(ID_VIEW_MODEL_GRID, OnViewModelGrid)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_VIEW_MODEL_GRID, OnUpdateViewModelGrid)
|
||||||
|
ON_COMMAND(ID_VIEW_MODEL_SOLID, OnViewModelSolid)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_VIEW_MODEL_SOLID, OnUpdateViewModelSolid)
|
||||||
|
ON_COMMAND(ID_VIEW_MODEL_WIREFRAME, OnViewModelWireframe)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_VIEW_MODEL_WIREFRAME, OnUpdateViewModelWireframe)
|
||||||
|
ON_COMMAND(ID_FILE_SAVEMAP, OnFileSaveMap)
|
||||||
|
ON_COMMAND(ID_FILE_LOADMAP, OnFileLoadMap)
|
||||||
|
ON_COMMAND(ID_VIEW_RENDERSTATS, OnViewRenderStats)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_VIEW_RENDERSTATS, OnUpdateViewRenderStats)
|
||||||
|
ON_MESSAGE(WM_MOUSEWHEEL,OnMouseWheel)
|
||||||
|
ON_COMMAND(IDR_UNIT_TOOLS, OnUnitTools)
|
||||||
|
ON_COMMAND(ID_TEST_GO, OnTestGo)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_TEST_GO, OnUpdateTestGo)
|
||||||
|
ON_COMMAND(ID_TEST_STOP, OnTestStop)
|
||||||
|
ON_UPDATE_COMMAND_UI(ID_TEST_STOP, OnUpdateTestStop)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
static UINT indicators[] =
|
||||||
|
{
|
||||||
|
ID_SEPARATOR, // status line indicator
|
||||||
|
ID_INDICATOR_CAPS,
|
||||||
|
ID_INDICATOR_NUM,
|
||||||
|
ID_INDICATOR_SCRL,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame construction/destruction
|
||||||
|
|
||||||
|
CMainFrame::CMainFrame()
|
||||||
|
{
|
||||||
|
// TODO: add member initialization code here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMainFrame::~CMainFrame()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::PostNcDestroy()
|
||||||
|
{
|
||||||
|
CFrameWnd::PostNcDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||||
|
{
|
||||||
|
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
|
||||||
|
if (!m_wndDlgBar.Create(this, IDR_MAINFRAME,
|
||||||
|
CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create dialogbar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
m_wndDlgBar.SetWindowText("Toolbar");
|
||||||
|
|
||||||
|
// create status bar
|
||||||
|
if (!m_wndStatusBar.Create(this) ||
|
||||||
|
!m_wndStatusBar.SetIndicators(indicators,
|
||||||
|
sizeof(indicators)/sizeof(UINT)))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create status bar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create texture tools bar
|
||||||
|
if (!m_wndTexToolsBar.Create(this, IDD_DIALOGBAR_TEXTURETOOLS,
|
||||||
|
CBRS_ALIGN_LEFT | CBRS_GRIPPER, AFX_IDW_DIALOGBAR))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create dialogbar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
m_wndTexToolsBar.SetWindowText("TexTools");
|
||||||
|
|
||||||
|
// create elevation tools bar
|
||||||
|
if (!m_wndElevToolsBar.Create(this, IDD_DIALOGBAR_ELEVATIONTOOLS,
|
||||||
|
CBRS_ALIGN_LEFT | CBRS_GRIPPER, AFX_IDW_DIALOGBAR))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create dialogbar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
m_wndElevToolsBar.SetWindowText("ElevTools");
|
||||||
|
|
||||||
|
// create unit tools bar
|
||||||
|
if (!m_wndUnitToolsBar.Create(this, IDD_DIALOGBAR_UNITTOOLS,
|
||||||
|
CBRS_ALIGN_LEFT | CBRS_GRIPPER, AFX_IDW_DIALOGBAR))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create dialogbar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
m_wndUnitToolsBar.SetWindowText("UnitTools");
|
||||||
|
|
||||||
|
// create unit properties bar
|
||||||
|
if (!m_wndUnitPropsBar.Create(this, IDD_DIALOGBAR_UNITPROPERTIES,
|
||||||
|
CBRS_ALIGN_LEFT | CBRS_GRIPPER, AFX_IDW_DIALOGBAR))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create dialogbar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
m_wndUnitPropsBar.SetWindowText("UnitProperties");
|
||||||
|
|
||||||
|
// create brush shape editor bar
|
||||||
|
if (!m_wndBrushShapeEditorBar.Create(this, IDD_DIALOGBAR_BRUSHSHAPEEDITOR,
|
||||||
|
CBRS_ALIGN_LEFT | CBRS_GRIPPER, AFX_IDW_DIALOGBAR))
|
||||||
|
{
|
||||||
|
TRACE0("Failed to create dialogbar\n");
|
||||||
|
return -1; // fail to create
|
||||||
|
}
|
||||||
|
m_wndTexToolsBar.SetWindowText("BrushEditor");
|
||||||
|
|
||||||
|
// enable docking on main frame
|
||||||
|
EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT | CBRS_ALIGN_BOTTOM);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// initially dock everything
|
||||||
|
m_wndTexToolsBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
|
||||||
|
DockControlBar(&m_wndTexToolsBar);
|
||||||
|
m_wndElevToolsBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
|
||||||
|
DockControlBar(&m_wndElevToolsBar);
|
||||||
|
m_wndUnitToolsBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
|
||||||
|
DockControlBar(&m_wndUnitToolsBar);
|
||||||
|
m_wndUnitPropsBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
|
||||||
|
DockControlBar(&m_wndUnitPropsBar);
|
||||||
|
*/
|
||||||
|
// and start up with all tools deselected
|
||||||
|
DeselectTools();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||||
|
{
|
||||||
|
if( !CFrameWnd::PreCreateWindow(cs) )
|
||||||
|
return FALSE;
|
||||||
|
// TODO: Modify the Window class or styles here by modifying
|
||||||
|
// the CREATESTRUCT cs
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame diagnostics
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CMainFrame::AssertValid() const
|
||||||
|
{
|
||||||
|
CFrameWnd::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CFrameWnd::Dump(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMainFrame message handlers
|
||||||
|
|
||||||
|
|
||||||
|
float rnd1()
|
||||||
|
{
|
||||||
|
return float(rand())/float(RAND_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMainFrame::OnTerrainLoad()
|
||||||
|
{
|
||||||
|
const char* filter="Targa Files|*.tga|RAW files|*.raw||";
|
||||||
|
CFileDialog dlg(TRUE,"tga",0,OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,filter,0);
|
||||||
|
dlg.m_ofn.lpstrInitialDir=g_UserCfg.GetOptionString(CFG_TERRAINLOADDIR);
|
||||||
|
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
const char* filename=dlg.m_ofn.lpstrFile;
|
||||||
|
|
||||||
|
CStr dir(filename);
|
||||||
|
dir=dir.Left(dlg.m_ofn.nFileOffset-1);
|
||||||
|
g_UserCfg.SetOptionString(CFG_TERRAINLOADDIR,(const char*) dir);
|
||||||
|
|
||||||
|
g_EditorData.LoadTerrain(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CMainFrame::OnLightingSettings()
|
||||||
|
{
|
||||||
|
CLightSettingsDlg dlg;
|
||||||
|
RGBColorToColorRef(g_LightEnv.m_SunColor,dlg.m_SunColor.m_Color);
|
||||||
|
RGBColorToColorRef(g_LightEnv.m_TerrainAmbientColor,dlg.m_TerrainAmbientColor.m_Color);
|
||||||
|
RGBColorToColorRef(g_LightEnv.m_UnitsAmbientColor,dlg.m_UnitsAmbientColor.m_Color);
|
||||||
|
dlg.m_Elevation=int(RADTODEG(g_LightEnv.m_Elevation)+0.5f);
|
||||||
|
dlg.m_Direction=int(RADTODEG(g_LightEnv.m_Rotation)+0.5f);
|
||||||
|
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
// have we previously applied a lightenv?
|
||||||
|
if (dlg.m_PreviousPreview) {
|
||||||
|
// yes - undo it
|
||||||
|
g_CmdMan.Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// build a lighting environment from the parameters
|
||||||
|
CLightEnv env;
|
||||||
|
env.m_Elevation=DEGTORAD(dlg.m_ElevationButton.m_Elevation);
|
||||||
|
env.m_Rotation=DEGTORAD(dlg.m_DirectionButton.m_Direction);
|
||||||
|
ColorRefToRGBColor(dlg.m_SunColor.m_Color,env.m_SunColor);
|
||||||
|
ColorRefToRGBColor(dlg.m_TerrainAmbientColor.m_Color,env.m_TerrainAmbientColor);
|
||||||
|
ColorRefToRGBColor(dlg.m_TerrainAmbientColor.m_Color,env.m_UnitsAmbientColor);
|
||||||
|
|
||||||
|
// create and execute an AlterLightEnv command
|
||||||
|
CAlterLightEnvCommand* cmd=new CAlterLightEnvCommand(env);
|
||||||
|
g_CmdMan.Execute(cmd);
|
||||||
|
} else {
|
||||||
|
if (dlg.m_PreviousPreview) {
|
||||||
|
// undo the change
|
||||||
|
g_CmdMan.Undo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AfxGetMainWnd()->Invalidate();
|
||||||
|
AfxGetMainWnd()->UpdateWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewScreenshot()
|
||||||
|
{
|
||||||
|
CScEdView* view=(CScEdView*) GetActiveView();
|
||||||
|
view->OnScreenShot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CMainFrame::OnTextureTools()
|
||||||
|
{
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
|
||||||
|
// swizzle around control bar visibility
|
||||||
|
DisableCtrlBars();
|
||||||
|
ShowControlBar(&m_wndTexToolsBar,TRUE,FALSE);
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_TEXTURETOOLS))->SetState(TRUE);
|
||||||
|
|
||||||
|
// set active tool
|
||||||
|
g_ToolMan.SetActiveTool(CPaintTextureTool::GetTool());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnElevationTools()
|
||||||
|
{
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
|
||||||
|
// swizzle around control bar visibility
|
||||||
|
DisableCtrlBars();
|
||||||
|
ShowControlBar(&m_wndElevToolsBar,TRUE,FALSE);
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_ELEVATIONTOOLS))->SetState(TRUE);
|
||||||
|
|
||||||
|
// notify window being shown so controls for correct mode (raise/smooth) are drawn,
|
||||||
|
// and correct tool is setup
|
||||||
|
m_wndElevToolsBar.OnShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUnitTools()
|
||||||
|
{
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
|
||||||
|
// swizzle around control bar visibility
|
||||||
|
DisableCtrlBars();
|
||||||
|
ShowControlBar(&m_wndUnitToolsBar,TRUE,FALSE);
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_MODELTOOLS))->SetState(TRUE);
|
||||||
|
|
||||||
|
// set modeactive tool
|
||||||
|
if (m_wndUnitToolsBar.m_Mode==CUnitToolsDlgBar::SELECT_MODE) {
|
||||||
|
m_wndUnitToolsBar.SetSelectMode();
|
||||||
|
} else {
|
||||||
|
m_wndUnitToolsBar.SetAddUnitMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure we're in the right editing mode
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::DisableCtrlBars()
|
||||||
|
{
|
||||||
|
ShowControlBar(&m_wndTexToolsBar,FALSE,FALSE);
|
||||||
|
ShowControlBar(&m_wndElevToolsBar,FALSE,FALSE);
|
||||||
|
ShowControlBar(&m_wndUnitToolsBar,FALSE,FALSE);
|
||||||
|
ShowControlBar(&m_wndUnitPropsBar,FALSE,FALSE);
|
||||||
|
ShowControlBar(&m_wndBrushShapeEditorBar,FALSE,FALSE);
|
||||||
|
|
||||||
|
// switch off corresponding short cut buttons
|
||||||
|
DisableToolbarButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::DisableToolbarButtons()
|
||||||
|
{
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_SELECT))->SetState(FALSE);
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_TEXTURETOOLS))->SetState(FALSE);
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_ELEVATIONTOOLS))->SetState(FALSE);
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_MODELTOOLS))->SetState(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::DeselectTools()
|
||||||
|
{
|
||||||
|
// switch off all control bars
|
||||||
|
DisableCtrlBars();
|
||||||
|
((CButton*) m_wndDlgBar.GetDlgItem(IDC_BUTTON_SELECT))->SetState(TRUE);
|
||||||
|
|
||||||
|
// deselect active tool
|
||||||
|
g_ToolMan.SetActiveTool(0);
|
||||||
|
|
||||||
|
// ensure we're in the right editing mode
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnObjectProperties(CObjectEntry* obj)
|
||||||
|
{
|
||||||
|
// swizzle around control bar visibility
|
||||||
|
DisableCtrlBars();
|
||||||
|
ShowControlBar(&m_wndUnitPropsBar,TRUE,FALSE);
|
||||||
|
|
||||||
|
m_wndUnitPropsBar.SetObject(obj);
|
||||||
|
|
||||||
|
// set active tool
|
||||||
|
g_ToolMan.SetActiveTool(0);
|
||||||
|
|
||||||
|
// ensure we're in the right editing mode
|
||||||
|
g_EditorData.SetMode(CEditorData::UNIT_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnToolsOptions()
|
||||||
|
{
|
||||||
|
COptionsPropSheet dlg("Options",this,0);
|
||||||
|
dlg.m_NavigatePage.m_ScrollSpeed=g_UserCfg.GetOptionInt(CFG_SCROLLSPEED);
|
||||||
|
|
||||||
|
dlg.m_ShadowsPage.m_EnableShadows=g_Renderer.GetOptionBool(CRenderer::OPT_SHADOWS) ? TRUE : FALSE;
|
||||||
|
|
||||||
|
COLORREF c;
|
||||||
|
RGBColorToColorRef(g_Renderer.GetOptionColor(CRenderer::OPT_SHADOWCOLOR),c);
|
||||||
|
dlg.m_ShadowsPage.m_ShadowColor.m_Color=c;
|
||||||
|
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
g_UserCfg.SetOptionInt(CFG_SCROLLSPEED,dlg.m_NavigatePage.m_ScrollSpeed);
|
||||||
|
g_Renderer.SetOptionBool(CRenderer::OPT_SHADOWS,dlg.m_ShadowsPage.m_EnableShadows ? true : false);
|
||||||
|
|
||||||
|
RGBColor c;
|
||||||
|
ColorRefToRGBColor(dlg.m_ShadowsPage.m_ShadowColor.m_Color,c);
|
||||||
|
g_Renderer.SetOptionColor(CRenderer::OPT_SHADOWCOLOR,c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnEditUndo()
|
||||||
|
{
|
||||||
|
g_CmdMan.Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateEditUndo(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
const char* cmdName=g_CmdMan.GetUndoName();
|
||||||
|
if (!cmdName) {
|
||||||
|
const char* undoText="&Undo";
|
||||||
|
pCmdUI->SetText(undoText);
|
||||||
|
pCmdUI->Enable(FALSE);
|
||||||
|
} else {
|
||||||
|
const char* undoText="&Undo Ctrl+Z";
|
||||||
|
char buf[64];
|
||||||
|
strcpy(buf,undoText);
|
||||||
|
int len=strlen(cmdName);
|
||||||
|
if (len>32) len=32;
|
||||||
|
buf[6]='\"';
|
||||||
|
strncpy(buf+7,cmdName,len);
|
||||||
|
buf[6+len+1]='\"';
|
||||||
|
pCmdUI->SetText(buf);
|
||||||
|
pCmdUI->Enable(TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnEditRedo()
|
||||||
|
{
|
||||||
|
g_CmdMan.Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateEditRedo(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
const char* cmdName=g_CmdMan.GetRedoName();
|
||||||
|
if (!cmdName) {
|
||||||
|
const char* redoText="&Redo";
|
||||||
|
pCmdUI->SetText(redoText);
|
||||||
|
pCmdUI->Enable(FALSE);
|
||||||
|
} else {
|
||||||
|
const char* redoText="&Redo Ctrl+Y";
|
||||||
|
char buf[64];
|
||||||
|
strcpy(buf,redoText);
|
||||||
|
int len=strlen(cmdName);
|
||||||
|
if (len>32) len=32;
|
||||||
|
buf[6]='\"';
|
||||||
|
strncpy(buf+7,cmdName,len);
|
||||||
|
buf[6+len+1]='\"';
|
||||||
|
pCmdUI->SetText(buf);
|
||||||
|
pCmdUI->Enable(TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CMainFrame::OnResizeMap()
|
||||||
|
{
|
||||||
|
CMapSizeDlg dlg;
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
// resize terrain to selected size
|
||||||
|
g_Terrain.Resize(dlg.m_MapSize);
|
||||||
|
|
||||||
|
// reinitialise minimap to cope with terrain of different size
|
||||||
|
g_MiniMap.Initialise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewModelGrid()
|
||||||
|
{
|
||||||
|
g_Renderer.SetModelRenderMode(EDGED_FACES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateViewModelGrid(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
pCmdUI->SetCheck(g_Renderer.GetModelRenderMode()==EDGED_FACES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewModelSolid()
|
||||||
|
{
|
||||||
|
g_Renderer.SetModelRenderMode(SOLID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateViewModelSolid(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
pCmdUI->SetCheck(g_Renderer.GetModelRenderMode()==SOLID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewModelWireframe()
|
||||||
|
{
|
||||||
|
g_Renderer.SetModelRenderMode(WIREFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateViewModelWireframe(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
pCmdUI->SetCheck(g_Renderer.GetModelRenderMode()==WIREFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewTerrainGrid()
|
||||||
|
{
|
||||||
|
g_Renderer.SetTerrainRenderMode(EDGED_FACES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateViewTerrainGrid(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
pCmdUI->SetCheck(g_Renderer.GetTerrainRenderMode()==EDGED_FACES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewTerrainSolid()
|
||||||
|
{
|
||||||
|
g_Renderer.SetTerrainRenderMode(SOLID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateViewTerrainSolid(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
pCmdUI->SetCheck(g_Renderer.GetTerrainRenderMode()==SOLID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewTerrainWireframe()
|
||||||
|
{
|
||||||
|
g_Renderer.SetTerrainRenderMode(WIREFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateViewTerrainWireframe(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
pCmdUI->SetCheck(g_Renderer.GetTerrainRenderMode()==WIREFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnFileSaveMap()
|
||||||
|
{
|
||||||
|
const char* filter="PMP Files|*.pmp||";
|
||||||
|
CFileDialog savedlg(FALSE,"pmp","Untitled.pmp",OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR,filter,0);
|
||||||
|
savedlg.m_ofn.lpstrInitialDir=g_UserCfg.GetOptionString(CFG_MAPSAVEDIR);
|
||||||
|
if (savedlg.DoModal()==IDOK) {
|
||||||
|
const char* savename=savedlg.m_ofn.lpstrFile;
|
||||||
|
|
||||||
|
CStr dir(savename);
|
||||||
|
dir=dir.Left(savedlg.m_ofn.nFileOffset-1);
|
||||||
|
g_UserCfg.SetOptionString(CFG_MAPSAVEDIR,(const char*) dir);
|
||||||
|
|
||||||
|
CMapWriter writer;
|
||||||
|
try {
|
||||||
|
writer.SaveMap(savename);
|
||||||
|
|
||||||
|
CStr filetitle=savedlg.m_ofn.lpstrFileTitle;
|
||||||
|
int index=filetitle.ReverseFind(CStr("."));
|
||||||
|
CStr doctitle=(index==-1) ? filetitle : filetitle.GetSubstring(0,index);
|
||||||
|
g_EditorData.SetScenarioName((const char*) doctitle);
|
||||||
|
SetTitle();
|
||||||
|
} catch (CFilePacker::CFileOpenError) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Failed to open \"%s\" for writing",savename);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
} catch (CFilePacker::CFileWriteError) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Error trying to write to \"%s\"",savename);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
} catch (...) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Error saving file \"%s\"",savename);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnFileLoadMap()
|
||||||
|
{
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
|
||||||
|
const char* filter="PMP Files|*.pmp||";
|
||||||
|
CFileDialog loaddlg(TRUE,"pmp",0,OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,filter,0);
|
||||||
|
loaddlg.m_ofn.lpstrInitialDir=g_UserCfg.GetOptionString(CFG_MAPLOADDIR);
|
||||||
|
|
||||||
|
if (loaddlg.DoModal()==IDOK) {
|
||||||
|
const char* loadname=loaddlg.m_ofn.lpstrFile;
|
||||||
|
|
||||||
|
CStr dir(loadname);
|
||||||
|
dir=dir.Left(loaddlg.m_ofn.nFileOffset-1);
|
||||||
|
g_UserCfg.SetOptionString(CFG_MAPLOADDIR,(const char*) dir);
|
||||||
|
|
||||||
|
CMapReader reader;
|
||||||
|
try {
|
||||||
|
reader.LoadMap(loadname);
|
||||||
|
|
||||||
|
CStr filetitle=loaddlg.m_ofn.lpstrFileTitle;
|
||||||
|
int index=filetitle.ReverseFind(CStr("."));
|
||||||
|
CStr doctitle=(index==-1) ? filetitle : filetitle.GetSubstring(0,index);
|
||||||
|
g_EditorData.SetScenarioName((const char*) doctitle);
|
||||||
|
SetTitle();
|
||||||
|
|
||||||
|
// reinitialise minimap
|
||||||
|
g_MiniMap.Initialise();
|
||||||
|
// render everything force asset load
|
||||||
|
g_EditorData.RenderNoCull();
|
||||||
|
|
||||||
|
// start everything idling
|
||||||
|
const std::vector<CUnit*>& units=g_UnitMan.GetUnits();
|
||||||
|
for (uint i=0;i<units.size();++i) {
|
||||||
|
if (units[i]->GetObject()->m_IdleAnim) {
|
||||||
|
units[i]->GetModel()->SetAnimation(units[i]->GetObject()->m_IdleAnim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CFileUnpacker::CFileOpenError) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Failed to open \"%s\" for reading",loadname);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
} catch (CFileUnpacker::CFileReadError) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Error trying to read from \"%s\"",loadname);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
} catch (CFileUnpacker::CFileEOFError) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Premature end of file error reading from \"%s\"",loadname);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
} catch (CFileUnpacker::CFileVersionError) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Error reading from \"%s\" - version mismatch",loadname);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
} catch (CFileUnpacker::CFileTypeError) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Error reading \"%s\" - doesn't seem to a PMP file",loadname);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
} catch (...) {
|
||||||
|
char buf[256];
|
||||||
|
sprintf(buf,"Error loading file \"%s\"",loadname);
|
||||||
|
MessageBox(buf,"Error",MB_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::SetTitle()
|
||||||
|
{
|
||||||
|
// set document title
|
||||||
|
if (GetActiveView()) {
|
||||||
|
GetActiveView()->GetDocument()->SetTitle(g_EditorData.GetScenarioName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnViewRenderStats()
|
||||||
|
{
|
||||||
|
CInfoBox& infobox=g_EditorData.GetInfoBox();
|
||||||
|
infobox.SetVisible(!infobox.GetVisible());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateViewRenderStats(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
pCmdUI->SetCheck(g_EditorData.GetInfoBox().GetVisible()==true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnToolsBrushShapeEditor()
|
||||||
|
{
|
||||||
|
DeselectTools();
|
||||||
|
ShowControlBar(&m_wndBrushShapeEditorBar,TRUE,FALSE);
|
||||||
|
|
||||||
|
// set active tool
|
||||||
|
g_ToolMan.SetActiveTool(CBrushShapeEditorTool::GetTool());
|
||||||
|
|
||||||
|
// ensure we're in the right editing mode
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CMainFrame::OnMouseWheel(WPARAM wParam,LPARAM lParam)
|
||||||
|
{
|
||||||
|
// Windows sucks: why the main frame is getting mouse wheel messages
|
||||||
|
// when mouse move messages are still going to the view is beyond
|
||||||
|
// my comprehension. Just duplicate the work CScEdView does.
|
||||||
|
int xPos = LOWORD(lParam);
|
||||||
|
int yPos = HIWORD(lParam);
|
||||||
|
SHORT fwKeys = LOWORD(wParam);
|
||||||
|
SHORT zDelta = HIWORD(wParam);
|
||||||
|
|
||||||
|
g_NaviCam.OnMouseWheelScroll(0,xPos,yPos,float(zDelta)/120.0f);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnTestGo()
|
||||||
|
{
|
||||||
|
g_EditorData.SetMode(CEditorData::TEST_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateTestGo(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
if (g_EditorData.GetMode()==CEditorData::TEST_MODE || g_EditorData.GetMode()!=CEditorData::SCENARIO_EDIT)
|
||||||
|
pCmdUI->Enable(FALSE);
|
||||||
|
else
|
||||||
|
pCmdUI->Enable(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnTestStop()
|
||||||
|
{
|
||||||
|
g_EditorData.SetMode(CEditorData::SCENARIO_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMainFrame::OnUpdateTestStop(CCmdUI* pCmdUI)
|
||||||
|
{
|
||||||
|
if (g_EditorData.GetMode()==CEditorData::TEST_MODE)
|
||||||
|
pCmdUI->Enable(TRUE);
|
||||||
|
else
|
||||||
|
pCmdUI->Enable(FALSE);
|
||||||
|
}
|
117
source/sced/MainFrm.h
Executable file
117
source/sced/MainFrm.h
Executable file
@ -0,0 +1,117 @@
|
|||||||
|
// MainFrm.h : interface of the CMainFrame class
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_MAINFRM_H__5804C3C3_DA2E_4546_9BE5_886FB4BEF254__INCLUDED_)
|
||||||
|
#define AFX_MAINFRM_H__5804C3C3_DA2E_4546_9BE5_886FB4BEF254__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#include "MainFrameDlgBar.h"
|
||||||
|
#include "TexToolsDlgBar.h"
|
||||||
|
#include "ElevToolsDlgBar.h"
|
||||||
|
#include "UnitToolsDlgBar.h"
|
||||||
|
#include "UnitPropertiesDlgBar.h"
|
||||||
|
#include "BrushShapeEditorDlgBar.h"
|
||||||
|
|
||||||
|
class CObjectEntry;
|
||||||
|
|
||||||
|
class CMainFrame : public CFrameWnd
|
||||||
|
{
|
||||||
|
|
||||||
|
protected: // create from serialization only
|
||||||
|
CMainFrame();
|
||||||
|
DECLARE_DYNCREATE(CMainFrame)
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
void OnUnitTools();
|
||||||
|
void OnObjectProperties(CObjectEntry* obj);
|
||||||
|
|
||||||
|
void DeselectTools();
|
||||||
|
|
||||||
|
void SetTitle();
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMainFrame)
|
||||||
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||||
|
virtual void PostNcDestroy();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CMainFrame();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
protected: // control bar embedded members
|
||||||
|
CStatusBar m_wndStatusBar;
|
||||||
|
CMainFrameDlgBar m_wndDlgBar;
|
||||||
|
CTexToolsDlgBar m_wndTexToolsBar;
|
||||||
|
CElevToolsDlgBar m_wndElevToolsBar;
|
||||||
|
CUnitToolsDlgBar m_wndUnitToolsBar;
|
||||||
|
CUnitPropertiesDlgBar m_wndUnitPropsBar;
|
||||||
|
CBrushShapeEditorDlgBar m_wndBrushShapeEditorBar;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
friend class CMainFrameDlgBar;
|
||||||
|
friend class CScEdView;
|
||||||
|
|
||||||
|
void DisableCtrlBars();
|
||||||
|
void DisableToolbarButtons();
|
||||||
|
|
||||||
|
//{{AFX_MSG(CMainFrame)
|
||||||
|
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||||
|
afx_msg void OnTerrainLoad();
|
||||||
|
afx_msg void OnLightingSettings();
|
||||||
|
afx_msg void OnViewScreenshot();
|
||||||
|
afx_msg void OnTextureTools();
|
||||||
|
afx_msg void OnToolsOptions();
|
||||||
|
afx_msg void OnToolsBrushShapeEditor();
|
||||||
|
afx_msg void OnEditUndo();
|
||||||
|
afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnEditRedo();
|
||||||
|
afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnElevationTools();
|
||||||
|
afx_msg void OnResizeMap();
|
||||||
|
afx_msg void OnViewTerrainGrid();
|
||||||
|
afx_msg void OnUpdateViewTerrainGrid(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnViewTerrainSolid();
|
||||||
|
afx_msg void OnUpdateViewTerrainSolid(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnViewTerrainWireframe();
|
||||||
|
afx_msg void OnUpdateViewTerrainWireframe(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnViewModelGrid();
|
||||||
|
afx_msg void OnUpdateViewModelGrid(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnViewModelSolid();
|
||||||
|
afx_msg void OnUpdateViewModelSolid(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnViewModelWireframe();
|
||||||
|
afx_msg void OnUpdateViewModelWireframe(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnFileSaveMap();
|
||||||
|
afx_msg void OnFileLoadMap();
|
||||||
|
afx_msg void OnViewRenderStats();
|
||||||
|
afx_msg void OnUpdateViewRenderStats(CCmdUI* pCmdUI);
|
||||||
|
afx_msg LRESULT OnMouseWheel(WPARAM wParam,LPARAM lParam);
|
||||||
|
afx_msg void OnTestGo();
|
||||||
|
afx_msg void OnUpdateTestGo(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnTestStop();
|
||||||
|
afx_msg void OnUpdateTestStop(CCmdUI* pCmdUI);
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MAINFRM_H__5804C3C3_DA2E_4546_9BE5_886FB4BEF254__INCLUDED_)
|
86
source/sced/MapSizeDlg.cpp
Executable file
86
source/sced/MapSizeDlg.cpp
Executable file
@ -0,0 +1,86 @@
|
|||||||
|
// MapSizeDlg.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "MapSizeDlg.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMapSizeDlg dialog
|
||||||
|
|
||||||
|
|
||||||
|
CMapSizeDlg::CMapSizeDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CMapSizeDlg::IDD, pParent), m_MapSize(11)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CMapSizeDlg)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMapSizeDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CMapSizeDlg)
|
||||||
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CMapSizeDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CMapSizeDlg)
|
||||||
|
ON_BN_CLICKED(IDC_RADIO_HUGE, OnRadioHuge)
|
||||||
|
ON_BN_CLICKED(IDC_RADIO_LARGE, OnRadioLarge)
|
||||||
|
ON_BN_CLICKED(IDC_RADIO_MEDIUM, OnRadioMedium)
|
||||||
|
ON_BN_CLICKED(IDC_RADIO_SMALL, OnRadioSmall)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMapSizeDlg message handlers
|
||||||
|
|
||||||
|
BOOL CMapSizeDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
OnRadioMedium();
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMapSizeDlg::OnRadioHuge()
|
||||||
|
{
|
||||||
|
CheckDlgButton(IDC_RADIO_SMALL,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_MEDIUM,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_LARGE,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_HUGE,TRUE);
|
||||||
|
m_MapSize=17;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMapSizeDlg::OnRadioLarge()
|
||||||
|
{
|
||||||
|
CheckDlgButton(IDC_RADIO_SMALL,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_MEDIUM,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_LARGE,TRUE);
|
||||||
|
CheckDlgButton(IDC_RADIO_HUGE,FALSE);
|
||||||
|
m_MapSize=13;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMapSizeDlg::OnRadioMedium()
|
||||||
|
{
|
||||||
|
CheckDlgButton(IDC_RADIO_SMALL,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_MEDIUM,TRUE);
|
||||||
|
CheckDlgButton(IDC_RADIO_LARGE,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_HUGE,FALSE);
|
||||||
|
m_MapSize=11;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMapSizeDlg::OnRadioSmall()
|
||||||
|
{
|
||||||
|
CheckDlgButton(IDC_RADIO_SMALL,TRUE);
|
||||||
|
CheckDlgButton(IDC_RADIO_MEDIUM,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_LARGE,FALSE);
|
||||||
|
CheckDlgButton(IDC_RADIO_HUGE,FALSE);
|
||||||
|
m_MapSize=9;
|
||||||
|
}
|
52
source/sced/MapSizeDlg.h
Executable file
52
source/sced/MapSizeDlg.h
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#if !defined(AFX_MAPSIZEDLG_H__F43F9B80_73CB_4DEB_8630_F0690664D510__INCLUDED_)
|
||||||
|
#define AFX_MAPSIZEDLG_H__F43F9B80_73CB_4DEB_8630_F0690664D510__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// MapSizeDlg.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CMapSizeDlg dialog
|
||||||
|
|
||||||
|
class CMapSizeDlg : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CMapSizeDlg(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
int m_MapSize;
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CMapSizeDlg)
|
||||||
|
enum { IDD = IDD_DIALOG_MAPSIZE };
|
||||||
|
// NOTE: the ClassWizard will add data members here
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CMapSizeDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CMapSizeDlg)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnRadioHuge();
|
||||||
|
afx_msg void OnRadioLarge();
|
||||||
|
afx_msg void OnRadioMedium();
|
||||||
|
afx_msg void OnRadioSmall();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_MAPSIZEDLG_H__F43F9B80_73CB_4DEB_8630_F0690664D510__INCLUDED_)
|
259
source/sced/MiniMap.cpp
Executable file
259
source/sced/MiniMap.cpp
Executable file
@ -0,0 +1,259 @@
|
|||||||
|
#include "MiniMap.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
#include "TextureManager.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
#include "Renderer.h"
|
||||||
|
#include "ogl.h"
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
|
static unsigned int ScaleColor(unsigned int color,float x)
|
||||||
|
{
|
||||||
|
unsigned int r=unsigned int(float(color & 0xff)*x);
|
||||||
|
unsigned int g=unsigned int(float((color>>8) & 0xff)*x);
|
||||||
|
unsigned int b=unsigned int(float((color>>16) & 0xff)*x);
|
||||||
|
return (0xff000000 | r | g<<8 | b<<16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int RoundUpToPowerOf2(int x)
|
||||||
|
{
|
||||||
|
if ((x & (x-1))==0) return x;
|
||||||
|
int d=x;
|
||||||
|
while (d & (d-1)) {
|
||||||
|
d&=(d-1);
|
||||||
|
}
|
||||||
|
return d<<1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CMiniMap::CMiniMap() : m_Handle(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMiniMap::Initialise()
|
||||||
|
{
|
||||||
|
// get rid of existing texture, if we've got one
|
||||||
|
if (m_Handle) {
|
||||||
|
glDeleteTextures(1,&m_Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocate a handle, bind to it
|
||||||
|
glGenTextures(1,&m_Handle);
|
||||||
|
g_Renderer.BindTexture(0,m_Handle);
|
||||||
|
|
||||||
|
// allocate an image big enough to fit the entire map into
|
||||||
|
m_Size=RoundUpToPowerOf2(g_Terrain.GetVerticesPerSide());
|
||||||
|
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,m_Size,m_Size,0,GL_BGRA_EXT,GL_UNSIGNED_BYTE,0);
|
||||||
|
|
||||||
|
// set texture parameters
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
|
||||||
|
|
||||||
|
// force a rebuild to get correct initial view
|
||||||
|
Rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMiniMap::Render()
|
||||||
|
{
|
||||||
|
// setup renderstate
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDepthMask(0);
|
||||||
|
|
||||||
|
// load identity modelview
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
// setup ortho view
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
int w=g_Renderer.GetWidth();
|
||||||
|
int h=g_Renderer.GetHeight();
|
||||||
|
glOrtho(0,w,0,h,-1,1);
|
||||||
|
|
||||||
|
// bind to the minimap
|
||||||
|
g_Renderer.BindTexture(0,m_Handle);
|
||||||
|
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
|
||||||
|
|
||||||
|
float tclimit=float(g_Terrain.GetVerticesPerSide()-1)/float(m_Size);
|
||||||
|
|
||||||
|
// render minimap as quad
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
|
glTexCoord2f(0,tclimit);
|
||||||
|
glVertex2i(w-200,200);
|
||||||
|
|
||||||
|
glTexCoord2f(0,0);
|
||||||
|
glVertex2i(w-200,2);
|
||||||
|
|
||||||
|
glTexCoord2f(tclimit,0);
|
||||||
|
glVertex2i(w-3,2);
|
||||||
|
|
||||||
|
glTexCoord2f(tclimit,tclimit);
|
||||||
|
glVertex2i(w-3,200);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// switch off textures
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
// render border
|
||||||
|
glLineWidth(2);
|
||||||
|
glColor3f(0.4f,0.35f,0.8f);
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex2i(w-202,202);
|
||||||
|
glVertex2i(w-1,202);
|
||||||
|
glVertex2i(w-1,1);
|
||||||
|
glVertex2i(w-202,1);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
// render view rect
|
||||||
|
glScissor(w-200,2,w,198);
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
glLineWidth(2);
|
||||||
|
glColor3f(1.0f,0.3f,0.3f);
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex2f(w-200+m_ViewRect[0][0],m_ViewRect[0][1]);
|
||||||
|
glVertex2f(w-200+m_ViewRect[1][0],m_ViewRect[1][1]);
|
||||||
|
glVertex2f(w-200+m_ViewRect[2][0],m_ViewRect[2][1]);
|
||||||
|
glVertex2f(w-200+m_ViewRect[3][0],m_ViewRect[3][1]);
|
||||||
|
glEnd();
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
|
||||||
|
// restore matrices
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
// restore renderstate
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glDepthMask(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMiniMap::Update(int x,int y,unsigned int color)
|
||||||
|
{
|
||||||
|
// bind to the minimap
|
||||||
|
g_Renderer.BindTexture(0,m_Handle);
|
||||||
|
|
||||||
|
// get height at this pixel
|
||||||
|
int hmap=(int) g_Terrain.GetHeightMap()[y*g_Terrain.GetVerticesPerSide() + x]>>8;
|
||||||
|
// shift from 0-255 to 170-255
|
||||||
|
int val=(hmap/3)+170;
|
||||||
|
|
||||||
|
// get modulated color
|
||||||
|
unsigned int mcolor=ScaleColor(color,float(val)/255.0f);
|
||||||
|
|
||||||
|
// subimage to update pixel (ugh)
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D,0,x,y,1,1,GL_BGRA_EXT,GL_UNSIGNED_BYTE,&mcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMiniMap::Update(int x,int y,int w,int h,unsigned int color)
|
||||||
|
{
|
||||||
|
// bind to the minimap
|
||||||
|
g_Renderer.BindTexture(0,m_Handle);
|
||||||
|
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
unsigned int* data=new unsigned int[w*h];
|
||||||
|
unsigned int* dataptr=data;
|
||||||
|
|
||||||
|
for (int j=0;j<h;j++) {
|
||||||
|
for (int i=0;i<w;i++) {
|
||||||
|
// get height at this pixel
|
||||||
|
int hmap=int(g_Terrain.GetHeightMap()[(y+j)*mapSize + x+i])>>8;
|
||||||
|
// shift from 0-255 to 170-255
|
||||||
|
int val=(hmap/3)+170;
|
||||||
|
// load scaled color into data pointer
|
||||||
|
*dataptr++=ScaleColor(color,float(val)/255.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// subimage to update pixels
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D,0,x,y,w,h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,data);
|
||||||
|
delete[] data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMiniMap::Rebuild()
|
||||||
|
{
|
||||||
|
// bind to the minimap
|
||||||
|
g_Renderer.BindTexture(0,m_Handle);
|
||||||
|
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
unsigned int* data=new unsigned int[(mapSize-1)*(mapSize-1)];
|
||||||
|
unsigned int* dataptr=data;
|
||||||
|
|
||||||
|
for (uint pj=0; pj<g_Terrain.GetPatchesPerSide(); pj++)
|
||||||
|
{
|
||||||
|
for (int tj=0; tj<16; tj++)
|
||||||
|
{
|
||||||
|
for (uint pi=0; pi<g_Terrain.GetPatchesPerSide(); pi++)
|
||||||
|
{
|
||||||
|
for (int ti=0; ti<16; ti++)
|
||||||
|
{
|
||||||
|
int i=pi*16+ti;
|
||||||
|
int j=pj*16+tj;
|
||||||
|
|
||||||
|
// get base color from textures on tile
|
||||||
|
unsigned int color;
|
||||||
|
CMiniPatch* mp=g_Terrain.GetTile(i,j);
|
||||||
|
if (mp) {
|
||||||
|
CTextureEntry* tex=mp->Tex1 ? g_TexMan.FindTexture(mp->Tex1) : 0;
|
||||||
|
color=tex ? tex->m_BaseColor : 0xffffffff;
|
||||||
|
} else {
|
||||||
|
color=0xffffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get height at this pixel
|
||||||
|
int hmap=int(g_Terrain.GetHeightMap()[j*mapSize + i])>>8;
|
||||||
|
// shift from 0-255 to 170-255
|
||||||
|
int val=(hmap/3)+170;
|
||||||
|
// load scaled color into data pointer
|
||||||
|
*dataptr++=ScaleColor(color,float(val)/255.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// subimage to update pixels
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,(mapSize-1),(mapSize-1),GL_BGRA_EXT,GL_UNSIGNED_BYTE,data);
|
||||||
|
delete[] data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMiniMap::Rebuild(int x,int y,int w,int h)
|
||||||
|
{
|
||||||
|
// bind to the minimap
|
||||||
|
g_Renderer.BindTexture(0,m_Handle);
|
||||||
|
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
unsigned int* data=new unsigned int[w*h];
|
||||||
|
unsigned int* dataptr=data;
|
||||||
|
|
||||||
|
for (int j=0;j<h;j++) {
|
||||||
|
for (int i=0;i<w;i++) {
|
||||||
|
// get height at this pixel
|
||||||
|
int hmap=int(g_Terrain.GetHeightMap()[(y+j)*mapSize + x+i])>>8;
|
||||||
|
// shift from 0-255 to 170-255
|
||||||
|
int val=(hmap/3)+170;
|
||||||
|
|
||||||
|
CMiniPatch* mp=g_Terrain.GetTile(x+i,y+j);
|
||||||
|
|
||||||
|
unsigned int color;
|
||||||
|
if (mp) {
|
||||||
|
// get texture on this time
|
||||||
|
CTextureEntry* tex=mp->Tex1 ? g_TexMan.FindTexture(mp->Tex1) : 0;
|
||||||
|
color=tex ? tex->m_BaseColor : 0xffffffff;
|
||||||
|
} else {
|
||||||
|
color=0xffffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// load scaled color into data pointer
|
||||||
|
*dataptr++=ScaleColor(color,float(val)/255.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// subimage to update pixels
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D,0,x,y,w,h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,data);
|
||||||
|
delete[] data;
|
||||||
|
}
|
28
source/sced/MiniMap.h
Executable file
28
source/sced/MiniMap.h
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef _MINIMAP_H
|
||||||
|
#define _MINIMAP_H
|
||||||
|
|
||||||
|
class CMiniMap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMiniMap();
|
||||||
|
|
||||||
|
void Initialise();
|
||||||
|
void Render();
|
||||||
|
void Update(int x,int y,unsigned int color);
|
||||||
|
void Update(int x,int y,int w,int h,unsigned int color);
|
||||||
|
void Rebuild();
|
||||||
|
void Rebuild(int x,int y,int w,int h);
|
||||||
|
|
||||||
|
// current viewing frustum, in minimap coordinate space
|
||||||
|
float m_ViewRect[4][2];
|
||||||
|
|
||||||
|
private:
|
||||||
|
// texture handle
|
||||||
|
unsigned int m_Handle;
|
||||||
|
// size of the map texture
|
||||||
|
unsigned int m_Size;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CMiniMap g_MiniMap;
|
||||||
|
|
||||||
|
#endif
|
68
source/sced/NaviCam.cpp
Executable file
68
source/sced/NaviCam.cpp
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "NaviCam.h"
|
||||||
|
#include "EditorData.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
CNaviCam g_NaviCam;
|
||||||
|
|
||||||
|
static void DbgText(char* str, ...)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, str);
|
||||||
|
vsprintf(buf, str, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
OutputDebugString(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CNaviCam constructor
|
||||||
|
CNaviCam::CNaviCam() : m_CameraZoom(10)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// OnMouseWheelScroll: handler for wheel scroll event - dir is positive for
|
||||||
|
// upward scroll (away from user), or negative for downward scroll (towards
|
||||||
|
// user)
|
||||||
|
void CNaviCam::OnMouseWheelScroll(u32 flags,int px,int py,float dir)
|
||||||
|
{
|
||||||
|
CVector3D forward=m_Camera.m_Orientation.GetIn();
|
||||||
|
float factor=dir*dir;
|
||||||
|
if (dir<0) factor=-factor;
|
||||||
|
|
||||||
|
// check we're not going to zoom into the terrain, or too far out into space
|
||||||
|
float h=m_Camera.m_Orientation.GetTranslation().Y+forward.Y*factor*m_CameraZoom;
|
||||||
|
float minh=65536*HEIGHT_SCALE*1.05f;
|
||||||
|
|
||||||
|
if (h<minh || h>1500) {
|
||||||
|
// yup, we will; don't move anywhere (do clamped move instead, at some point)
|
||||||
|
} else {
|
||||||
|
// do a full move
|
||||||
|
m_CameraZoom-=(factor)*0.1f;
|
||||||
|
if (m_CameraZoom<0.01f) m_CameraZoom=0.01f;
|
||||||
|
m_Camera.m_Orientation.Translate(forward*(factor*m_CameraZoom));
|
||||||
|
}
|
||||||
|
g_EditorData.OnCameraChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// OnMButtonDown: handler for middle button down event
|
||||||
|
void CNaviCam::OnMButtonDown(u32 flags,int px,int py)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// OnMButtonUp: handler for middle button up event
|
||||||
|
void CNaviCam::OnMButtonUp(u32 flags,int px,int py)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// OnMouseMove: handler for mouse move (only called when middle button down)
|
||||||
|
void CNaviCam::OnMouseMove(u32 flags,int px,int py)
|
||||||
|
{
|
||||||
|
}
|
46
source/sced/NaviCam.h
Executable file
46
source/sced/NaviCam.h
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// navicam.h
|
||||||
|
//
|
||||||
|
// - header containing NaviCam class, used to produce MAX style navigation controls
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _NAVICAM_H
|
||||||
|
#define _NAVICAM_H
|
||||||
|
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CNaviCam: MAX style navigation controller
|
||||||
|
class CNaviCam
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
CNaviCam();
|
||||||
|
|
||||||
|
// handler for wheel scroll event - dir is positive for
|
||||||
|
// upward scroll (away from user), or negative for downward scroll (towards
|
||||||
|
// user)
|
||||||
|
void OnMouseWheelScroll(u32 flags,int px,int py,float dir);
|
||||||
|
// handler for middle button down event
|
||||||
|
void OnMButtonDown(u32 flags,int px,int py);
|
||||||
|
// handler for middle button up event
|
||||||
|
void OnMButtonUp(u32 flags,int px,int py);
|
||||||
|
// handler for mouse move (only called when middle button down)
|
||||||
|
void OnMouseMove(u32 flags,int px,int py);
|
||||||
|
|
||||||
|
// return the regular camera object
|
||||||
|
CCamera& GetCamera() { return m_Camera; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// the regular camera object that defines FOV, orientation, etc
|
||||||
|
CCamera m_Camera;
|
||||||
|
// current zoom of camera
|
||||||
|
float m_CameraZoom;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CNaviCam g_NaviCam;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
46
source/sced/NavigatePropPage.cpp
Executable file
46
source/sced/NavigatePropPage.cpp
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
// NavigatePropPage.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "NavigatePropPage.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CNavigatePropPage property page
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CNavigatePropPage, CPropertyPage)
|
||||||
|
|
||||||
|
CNavigatePropPage::CNavigatePropPage() : CPropertyPage(CNavigatePropPage::IDD)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CNavigatePropPage)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
CNavigatePropPage::~CNavigatePropPage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNavigatePropPage::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CPropertyPage::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CNavigatePropPage)
|
||||||
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CNavigatePropPage, CPropertyPage)
|
||||||
|
//{{AFX_MSG_MAP(CNavigatePropPage)
|
||||||
|
// NOTE: the ClassWizard will add message map macros here
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CNavigatePropPage message handlers
|
51
source/sced/NavigatePropPage.h
Executable file
51
source/sced/NavigatePropPage.h
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#if !defined(AFX_NAVIGATEPROPPAGE_H__BD8DC549_74F0_425E_9970_77BAE8F735E5__INCLUDED_)
|
||||||
|
#define AFX_NAVIGATEPROPPAGE_H__BD8DC549_74F0_425E_9970_77BAE8F735E5__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// NavigatePropPage.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CNavigatePropPage dialog
|
||||||
|
|
||||||
|
class CNavigatePropPage : public CPropertyPage
|
||||||
|
{
|
||||||
|
DECLARE_DYNCREATE(CNavigatePropPage)
|
||||||
|
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CNavigatePropPage();
|
||||||
|
~CNavigatePropPage();
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CNavigatePropPage)
|
||||||
|
enum { IDD = IDD_PROPPAGE_NAVIGATION };
|
||||||
|
int m_ScrollSpeed;
|
||||||
|
// NOTE - ClassWizard will add data members here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generate virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CNavigatePropPage)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CNavigatePropPage)
|
||||||
|
// NOTE: the ClassWizard will add member functions here
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_NAVIGATEPROPPAGE_H__BD8DC549_74F0_425E_9970_77BAE8F735E5__INCLUDED_)
|
50
source/sced/OptionsDlg.cpp
Executable file
50
source/sced/OptionsDlg.cpp
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
// OptionsDlg.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "OptionsDlg.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COptionsDlg dialog
|
||||||
|
|
||||||
|
|
||||||
|
COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(COptionsDlg::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(COptionsDlg)
|
||||||
|
m_ScrollSpeed = 0;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void COptionsDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(COptionsDlg)
|
||||||
|
DDX_Slider(pDX, IDC_SLIDER_RTSSCROLLSPEED, m_ScrollSpeed);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(COptionsDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(COptionsDlg)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COptionsDlg message handlers
|
||||||
|
|
||||||
|
BOOL COptionsDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
// set up scroll speed slider
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_RTSSCROLLSPEED);
|
||||||
|
sliderctrl->SetRange(0,10,TRUE);
|
||||||
|
sliderctrl->SetPos(m_ScrollSpeed);
|
||||||
|
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
46
source/sced/OptionsDlg.h
Executable file
46
source/sced/OptionsDlg.h
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#if !defined(AFX_OPTIONSDLG_H__D9A7A4A5_A6D1_4793_98E8_5558D40B905A__INCLUDED_)
|
||||||
|
#define AFX_OPTIONSDLG_H__D9A7A4A5_A6D1_4793_98E8_5558D40B905A__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// OptionsDlg.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COptionsDlg dialog
|
||||||
|
|
||||||
|
class COptionsDlg : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
COptionsDlg(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(COptionsDlg)
|
||||||
|
enum { IDD = IDD_DIALOG_OPTIONS };
|
||||||
|
int m_ScrollSpeed;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(COptionsDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(COptionsDlg)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_OPTIONSDLG_H__D9A7A4A5_A6D1_4793_98E8_5558D40B905A__INCLUDED_)
|
67
source/sced/OptionsPropSheet.cpp
Executable file
67
source/sced/OptionsPropSheet.cpp
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
// OptionsPropSheet.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "OptionsPropSheet.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COptionsPropSheet
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC(COptionsPropSheet, CPropertySheet)
|
||||||
|
|
||||||
|
COptionsPropSheet::COptionsPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
|
||||||
|
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
|
||||||
|
{
|
||||||
|
AddPage(&m_NavigatePage);
|
||||||
|
AddPage(&m_ShadowsPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
COptionsPropSheet::COptionsPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
|
||||||
|
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
|
||||||
|
{
|
||||||
|
AddPage(&m_NavigatePage);
|
||||||
|
AddPage(&m_ShadowsPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
COptionsPropSheet::~COptionsPropSheet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(COptionsPropSheet, CPropertySheet)
|
||||||
|
//{{AFX_MSG_MAP(COptionsPropSheet)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COptionsPropSheet message handlers
|
||||||
|
|
||||||
|
BOOL COptionsPropSheet::OnInitDialog()
|
||||||
|
{
|
||||||
|
BOOL bResult = CPropertySheet::OnInitDialog();
|
||||||
|
|
||||||
|
// NAVIGATION CONTROLS:
|
||||||
|
// setup scroll speed slider
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) m_NavigatePage.GetDlgItem(IDC_SLIDER_RTSSCROLLSPEED);
|
||||||
|
sliderctrl->SetRange(0,10,TRUE);
|
||||||
|
sliderctrl->SetPos(m_NavigatePage.m_ScrollSpeed);
|
||||||
|
|
||||||
|
// SHADOW CONTROLS:
|
||||||
|
// setup checkbox
|
||||||
|
// CSliderCtrl* sliderctrl=(CSliderCtrl*) m_NavigatePage.GetDlgItem(IDC_SLIDER_RTSSCROLLSPEED);
|
||||||
|
// sliderctrl->SetRange(0,10,TRUE);
|
||||||
|
// sliderctrl->SetPos(m_NavigatePage.m_ScrollSpeed);
|
||||||
|
|
||||||
|
// setup shadow colour
|
||||||
|
|
||||||
|
// setup quality slider
|
||||||
|
return bResult;
|
||||||
|
}
|
57
source/sced/OptionsPropSheet.h
Executable file
57
source/sced/OptionsPropSheet.h
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#if !defined(AFX_OPTIONSPROPSHEET_H__11CE8789_3E13_4D06_966E_6A6DA9C36E13__INCLUDED_)
|
||||||
|
#define AFX_OPTIONSPROPSHEET_H__11CE8789_3E13_4D06_966E_6A6DA9C36E13__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// OptionsPropSheet.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "NavigatePropPage.h"
|
||||||
|
#include "ShadowsPropPage.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COptionsPropSheet
|
||||||
|
|
||||||
|
class COptionsPropSheet : public CPropertySheet
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC(COptionsPropSheet)
|
||||||
|
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
COptionsPropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
|
||||||
|
COptionsPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
CNavigatePropPage m_NavigatePage;
|
||||||
|
CShadowsPropPage m_ShadowsPage;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(COptionsPropSheet)
|
||||||
|
public:
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~COptionsPropSheet();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(COptionsPropSheet)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_OPTIONSPROPSHEET_H__11CE8789_3E13_4D06_966E_6A6DA9C36E13__INCLUDED_)
|
56
source/sced/PaintObjectCommand.cpp
Executable file
56
source/sced/PaintObjectCommand.cpp
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
#include "PaintObjectCommand.h"
|
||||||
|
#include "UnitManager.h"
|
||||||
|
#include "ObjectEntry.h"
|
||||||
|
#include "Model.h"
|
||||||
|
|
||||||
|
#include "BaseEntity.h"
|
||||||
|
#include "BaseEntityCollection.h"
|
||||||
|
#include "EntityManager.h"
|
||||||
|
|
||||||
|
CPaintObjectCommand::CPaintObjectCommand(CObjectEntry* object,const CMatrix3D& transform)
|
||||||
|
: m_Object(object), m_Transform(transform), m_Unit(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CPaintObjectCommand::~CPaintObjectCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CPaintObjectCommand::Execute()
|
||||||
|
{
|
||||||
|
// create new unit
|
||||||
|
m_Unit=new CUnit(m_Object,m_Object->m_Model->Clone());
|
||||||
|
m_Unit->GetModel()->SetTransform(m_Transform);
|
||||||
|
|
||||||
|
// add this unit to list of units stored in unit manager
|
||||||
|
g_UnitMan.AddUnit(m_Unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Finalize: notification that command has finished (ie object stopped rotating) - convert
|
||||||
|
// unit to entity if there's a template for it
|
||||||
|
void CPaintObjectCommand::Finalize()
|
||||||
|
{
|
||||||
|
CBaseEntity* templateObject = g_EntityTemplateCollection.getTemplateByActor(m_Object);
|
||||||
|
if( templateObject )
|
||||||
|
{
|
||||||
|
CVector3D orient = m_Unit->GetModel()->GetTransform().GetIn();
|
||||||
|
CVector3D position = m_Unit->GetModel()->GetTransform().GetTranslation();
|
||||||
|
g_UnitMan.RemoveUnit(m_Unit);
|
||||||
|
g_EntityManager.create( templateObject, position, atan2( orient.X, orient.Z ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CPaintObjectCommand::Undo()
|
||||||
|
{
|
||||||
|
// remove model from unit managers list
|
||||||
|
g_UnitMan.RemoveUnit(m_Unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintObjectCommand::Redo()
|
||||||
|
{
|
||||||
|
// add the unit back to the unit manager
|
||||||
|
g_UnitMan.AddUnit(m_Unit);
|
||||||
|
}
|
46
source/sced/PaintObjectCommand.h
Executable file
46
source/sced/PaintObjectCommand.h
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef _PAINTOBJECTCOMMAND_H
|
||||||
|
#define _PAINTOBJECTCOMMAND_H
|
||||||
|
|
||||||
|
#include "Command.h"
|
||||||
|
#include "Matrix3D.h"
|
||||||
|
|
||||||
|
class CUnit;
|
||||||
|
class CObjectEntry;
|
||||||
|
|
||||||
|
class CPaintObjectCommand : public CCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor, destructor
|
||||||
|
CPaintObjectCommand(CObjectEntry* object,const CMatrix3D& transform);
|
||||||
|
~CPaintObjectCommand();
|
||||||
|
|
||||||
|
// return the texture name of this command
|
||||||
|
const char* GetName() const { return "Add Unit"; }
|
||||||
|
|
||||||
|
// execute this command
|
||||||
|
void Execute();
|
||||||
|
|
||||||
|
// can undo command?
|
||||||
|
bool IsUndoable() const { return false; }
|
||||||
|
// undo
|
||||||
|
void Undo();
|
||||||
|
// redo
|
||||||
|
void Redo();
|
||||||
|
|
||||||
|
// notification that command has finished (ie object stopped rotating) - convert
|
||||||
|
// unit to entity if there's a template for it
|
||||||
|
void Finalize();
|
||||||
|
|
||||||
|
// return unit added to world
|
||||||
|
CUnit* GetUnit() { return m_Unit; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// unit to add to world
|
||||||
|
CUnit* m_Unit;
|
||||||
|
// object to paint
|
||||||
|
CObjectEntry* m_Object;
|
||||||
|
// model transformation
|
||||||
|
CMatrix3D m_Transform;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
85
source/sced/PaintObjectTool.cpp
Executable file
85
source/sced/PaintObjectTool.cpp
Executable file
@ -0,0 +1,85 @@
|
|||||||
|
#include "timer.h"
|
||||||
|
#include "CommandManager.h"
|
||||||
|
#include "ObjectEntry.h"
|
||||||
|
#include "Unit.h"
|
||||||
|
#include "PaintObjectTool.h"
|
||||||
|
#include "MiniPatch.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
#include "Renderer.h"
|
||||||
|
#include "ObjectManager.h"
|
||||||
|
#include "PaintObjectCommand.h"
|
||||||
|
|
||||||
|
// rotate object at 180 degrees each second when applying to terrain
|
||||||
|
#define ROTATION_SPEED PI
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
CPaintObjectTool CPaintObjectTool::m_PaintObjectTool;
|
||||||
|
|
||||||
|
CPaintObjectTool::CPaintObjectTool() : m_PaintCmd(0), m_Rotation(0)
|
||||||
|
{
|
||||||
|
m_BrushSize=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintObjectTool::BuildTransform()
|
||||||
|
{
|
||||||
|
m_ObjectTransform.SetIdentity();
|
||||||
|
m_ObjectTransform.RotateY(m_Rotation);
|
||||||
|
m_ObjectTransform.Translate(m_Position);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintObjectTool::PaintSelection()
|
||||||
|
{
|
||||||
|
if (m_PaintCmd) {
|
||||||
|
// already applied object to terrain, now we're just rotating it
|
||||||
|
double curtime=get_time();
|
||||||
|
m_Rotation+=ROTATION_SPEED*float(curtime-m_LastTriggerTime);
|
||||||
|
BuildTransform();
|
||||||
|
m_PaintCmd->GetUnit()->GetModel()->SetTransform(m_ObjectTransform);
|
||||||
|
m_LastTriggerTime=curtime;
|
||||||
|
} else {
|
||||||
|
m_Rotation=0;
|
||||||
|
m_Position=m_SelectionPoint;
|
||||||
|
m_LastTriggerTime=get_time();
|
||||||
|
|
||||||
|
CObjectEntry* obj=g_ObjMan.GetSelectedObject();
|
||||||
|
if (obj && obj->m_Model) {
|
||||||
|
// get up to date transform
|
||||||
|
BuildTransform();
|
||||||
|
|
||||||
|
// now paint the object
|
||||||
|
m_PaintCmd=new CPaintObjectCommand(obj,m_ObjectTransform);
|
||||||
|
m_PaintCmd->Execute();
|
||||||
|
g_CmdMan.Append(m_PaintCmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintObjectTool::OnLButtonUp(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
CBrushTool::OnLButtonUp(flags,px,py);
|
||||||
|
// terminate current command, if we've got one
|
||||||
|
if (m_PaintCmd) {
|
||||||
|
m_PaintCmd->Finalize();
|
||||||
|
m_PaintCmd=0;
|
||||||
|
m_Rotation=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintObjectTool::OnDraw()
|
||||||
|
{
|
||||||
|
// don't draw object if we're currently rotating it on the terrain
|
||||||
|
if (m_PaintCmd) return;
|
||||||
|
|
||||||
|
// don't draw unless we have a valid object to apply
|
||||||
|
CObjectEntry* obj=g_ObjMan.GetSelectedObject();
|
||||||
|
if (!obj || !obj->m_Model) return;
|
||||||
|
|
||||||
|
// try to get object transform, in world space
|
||||||
|
m_Position=m_SelectionPoint;
|
||||||
|
BuildTransform();
|
||||||
|
|
||||||
|
// render the current object at the same position as the selected tile
|
||||||
|
m_Model=obj->m_Model;
|
||||||
|
m_Model->SetTransform(m_ObjectTransform);
|
||||||
|
g_Renderer.Submit(m_Model);
|
||||||
|
}
|
57
source/sced/PaintObjectTool.h
Executable file
57
source/sced/PaintObjectTool.h
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#ifndef _PAINTOBJECTTOOL_H
|
||||||
|
#define _PAINTOBJECTTOOL_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
|
||||||
|
#include "BrushTool.h"
|
||||||
|
#include "Vector3D.h"
|
||||||
|
#include "Matrix3D.h"
|
||||||
|
#include "Model.h"
|
||||||
|
|
||||||
|
class CObjectEntry;
|
||||||
|
class CPaintObjectCommand;
|
||||||
|
|
||||||
|
class CPaintObjectTool : public CBrushTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CPaintObjectTool();
|
||||||
|
|
||||||
|
// draw this tool
|
||||||
|
void OnDraw();
|
||||||
|
|
||||||
|
// callback for left button up event
|
||||||
|
void OnLButtonUp(unsigned int flags,int px,int py);
|
||||||
|
|
||||||
|
// tool triggered via left mouse button; paint current selection
|
||||||
|
void OnTriggerLeft() { PaintSelection(); }
|
||||||
|
|
||||||
|
// allow multiple triggers by click and hold - subsequent triggers rotate
|
||||||
|
// the last applied object, rather than adding new objects
|
||||||
|
bool SupportDragTrigger() { return true; }
|
||||||
|
|
||||||
|
// get the default paint model instance
|
||||||
|
static CPaintObjectTool* GetTool() { return &m_PaintObjectTool; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// apply current object to current selection
|
||||||
|
void PaintSelection();
|
||||||
|
// build the m_ObjectTransform member from current tile selection
|
||||||
|
void BuildTransform();
|
||||||
|
// currently active command, or null if no object currently being applied
|
||||||
|
CPaintObjectCommand* m_PaintCmd;
|
||||||
|
// Y-rotation of object currently being applied
|
||||||
|
float m_Rotation;
|
||||||
|
// position of object when first dropped
|
||||||
|
CVector3D m_Position;
|
||||||
|
// time of last trigger
|
||||||
|
double m_LastTriggerTime;
|
||||||
|
// current transform of selected object
|
||||||
|
CMatrix3D m_ObjectTransform;
|
||||||
|
// model of current object
|
||||||
|
CModel* m_Model;
|
||||||
|
// default tool instance
|
||||||
|
static CPaintObjectTool m_PaintObjectTool;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
97
source/sced/PaintTextureCommand.cpp
Executable file
97
source/sced/PaintTextureCommand.cpp
Executable file
@ -0,0 +1,97 @@
|
|||||||
|
#include "PaintTextureCommand.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
#include "MiniMap.h"
|
||||||
|
#include "textureEntry.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
|
inline int clamp(int x,int min,int max)
|
||||||
|
{
|
||||||
|
if (x<min) return min;
|
||||||
|
else if (x>max) return max;
|
||||||
|
else return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPaintTextureCommand::CPaintTextureCommand(CTextureEntry* tex,int brushSize,int selectionCentre[2])
|
||||||
|
{
|
||||||
|
m_Texture=tex;
|
||||||
|
m_BrushSize=brushSize;
|
||||||
|
m_SelectionCentre[0]=selectionCentre[0];
|
||||||
|
m_SelectionCentre[1]=selectionCentre[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CPaintTextureCommand::~CPaintTextureCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CPaintTextureCommand::Execute()
|
||||||
|
{
|
||||||
|
int r=m_BrushSize;
|
||||||
|
u32 patchesPerSide=g_Terrain.GetPatchesPerSide();
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
|
||||||
|
// get range of tiles affected by brush
|
||||||
|
int x0=clamp(m_SelectionCentre[0]-r,0,mapSize-1);
|
||||||
|
int x1=clamp(m_SelectionCentre[0]+r+1,0,mapSize-1);
|
||||||
|
int z0=clamp(m_SelectionCentre[1]-r,0,mapSize-1);
|
||||||
|
int z1=clamp(m_SelectionCentre[1]+r+1,0,mapSize-1);
|
||||||
|
|
||||||
|
// iterate through tiles affected by brush
|
||||||
|
for (int j=m_SelectionCentre[1]-r;j<=m_SelectionCentre[1]+r;j++) {
|
||||||
|
for (int i=m_SelectionCentre[0]-r;i<=m_SelectionCentre[0]+r;i++) {
|
||||||
|
|
||||||
|
// try and get minipatch, if there is one
|
||||||
|
CMiniPatch* nmp=g_Terrain.GetTile(i,j);
|
||||||
|
|
||||||
|
if (nmp) {
|
||||||
|
nmp->Tex1=m_Texture ? m_Texture->m_Handle : 0;
|
||||||
|
nmp->Tex1Priority=m_Texture ? ((int) m_Texture->m_Type) : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// invalidate affected patches
|
||||||
|
int px0=clamp(-1+(x0/16),0,patchesPerSide);
|
||||||
|
int px1=clamp(1+(x1/16),0,patchesPerSide);
|
||||||
|
int pz0=clamp(-1+(z0/16),0,patchesPerSide);
|
||||||
|
int pz1=clamp(1+(z1/16),0,patchesPerSide);
|
||||||
|
for (j=pz0;j<pz1;j++) {
|
||||||
|
for (int i=px0;i<px1;i++) {
|
||||||
|
CPatch* patch=g_Terrain.GetPatch(i,j);
|
||||||
|
patch->SetDirty(RENDERDATA_UPDATE_INDICES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// rebuild this bit of the minimap
|
||||||
|
int w=1+2*m_BrushSize;
|
||||||
|
int x=m_SelectionCentre[1]-m_BrushSize;
|
||||||
|
if (x<0) {
|
||||||
|
w+=x;
|
||||||
|
x=0;
|
||||||
|
}
|
||||||
|
int h=1+2*m_BrushSize;
|
||||||
|
int y=m_SelectionCentre[0]-m_BrushSize;
|
||||||
|
if (y<0) {
|
||||||
|
h+=y;
|
||||||
|
y=0;
|
||||||
|
}
|
||||||
|
g_MiniMap.Rebuild(x,y,w,h);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintTextureCommand::Undo()
|
||||||
|
{
|
||||||
|
ApplyDataToSelection(m_DataIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintTextureCommand::Redo()
|
||||||
|
{
|
||||||
|
ApplyDataToSelection(m_DataOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintTextureCommand::ApplyDataToSelection(const CArray2D<TextureSet>& data)
|
||||||
|
{
|
||||||
|
}
|
68
source/sced/PaintTextureCommand.h
Executable file
68
source/sced/PaintTextureCommand.h
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
#ifndef _PAINTTEXTURECOMMAND_H
|
||||||
|
#define _PAINTTEXTURECOMMAND_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "Command.h"
|
||||||
|
#include "Array2D.h"
|
||||||
|
|
||||||
|
struct TextureSet
|
||||||
|
{
|
||||||
|
Handle m_Texture;
|
||||||
|
int m_Priority;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CTextureEntry;
|
||||||
|
|
||||||
|
class CPaintTextureCommand : public CCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor, destructor
|
||||||
|
CPaintTextureCommand(CTextureEntry* tex,int brushSize,int selectionCentre[2]);
|
||||||
|
~CPaintTextureCommand();
|
||||||
|
|
||||||
|
// return the texture name of this command
|
||||||
|
const char* GetName() const { return "Apply Texture"; }
|
||||||
|
|
||||||
|
// execute this command
|
||||||
|
void Execute();
|
||||||
|
|
||||||
|
// can undo command?
|
||||||
|
bool IsUndoable() const { return true; }
|
||||||
|
// undo
|
||||||
|
void Undo();
|
||||||
|
// redo
|
||||||
|
void Redo();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool IsValidDataIndex(const CArray2D<TextureSet>& array,int x,int y) {
|
||||||
|
if (x<0 || y<0) return 0;
|
||||||
|
int ix=x-m_SelectionOrigin[0];
|
||||||
|
int iy=y-m_SelectionOrigin[1];
|
||||||
|
return ix>=0 && ix<array.usize() && iy>=0 && iy<array.vsize();
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureSet* DataIn(int x,int y) {
|
||||||
|
return IsValidDataIndex(m_DataIn,x,y) ? &m_DataIn(x-m_SelectionOrigin[0],y-m_SelectionOrigin[1]) : 0;
|
||||||
|
}
|
||||||
|
TextureSet* DataOut(int x,int y) {
|
||||||
|
return IsValidDataIndex(m_DataOut,x,y) ? &m_DataOut(x-m_SelectionOrigin[0],y-m_SelectionOrigin[1]) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApplyDataToSelection(const CArray2D<TextureSet>& data);
|
||||||
|
|
||||||
|
// texture being painted
|
||||||
|
CTextureEntry* m_Texture;
|
||||||
|
// size of brush
|
||||||
|
int m_BrushSize;
|
||||||
|
// centre of brush
|
||||||
|
int m_SelectionCentre[2];
|
||||||
|
// origin of data set
|
||||||
|
int m_SelectionOrigin[2];
|
||||||
|
// input data (textures applied to the selection)
|
||||||
|
CArray2D<TextureSet> m_DataIn;
|
||||||
|
// output data (new textures applied to the selection after painting)
|
||||||
|
CArray2D<TextureSet> m_DataOut;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
21
source/sced/PaintTextureTool.cpp
Executable file
21
source/sced/PaintTextureTool.cpp
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#include "CommandManager.h"
|
||||||
|
#include "TextureEntry.h"
|
||||||
|
#include "PaintTextureTool.h"
|
||||||
|
#include "PaintTextureCommand.h"
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
CPaintTextureTool CPaintTextureTool::m_PaintTextureTool;
|
||||||
|
|
||||||
|
CPaintTextureTool::CPaintTextureTool()
|
||||||
|
{
|
||||||
|
m_SelectedTexture=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPaintTextureTool::PaintSelection()
|
||||||
|
{
|
||||||
|
// apply current texture to current selection
|
||||||
|
CPaintTextureCommand* paintCmd=new CPaintTextureCommand(m_SelectedTexture,m_BrushSize,m_SelectionCentre);
|
||||||
|
g_CmdMan.Execute(paintCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
43
source/sced/PaintTextureTool.h
Executable file
43
source/sced/PaintTextureTool.h
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#ifndef _PAINTTEXTURETOOL_H
|
||||||
|
#define _PAINTTEXTURETOOL_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "BrushTool.h"
|
||||||
|
|
||||||
|
class CTextureEntry;
|
||||||
|
|
||||||
|
class CPaintTextureTool : public CBrushTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { MAX_BRUSH_SIZE=8 };
|
||||||
|
|
||||||
|
public:
|
||||||
|
CPaintTextureTool();
|
||||||
|
|
||||||
|
// tool triggered via left mouse button; paint current selection
|
||||||
|
void OnTriggerLeft() { PaintSelection(); }
|
||||||
|
|
||||||
|
// set current painting texture
|
||||||
|
void SetSelectedTexture(CTextureEntry* tex) { m_SelectedTexture=tex; }
|
||||||
|
// get current painting texture
|
||||||
|
CTextureEntry* GetSelectedTexture() { return m_SelectedTexture; }
|
||||||
|
|
||||||
|
// allow multiple triggers by click and drag
|
||||||
|
bool SupportDragTrigger() { return true; }
|
||||||
|
|
||||||
|
// get the default paint texture instance
|
||||||
|
static CPaintTextureTool* GetTool() { return &m_PaintTextureTool; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// apply current texture to current selection
|
||||||
|
void PaintSelection();
|
||||||
|
|
||||||
|
// currently selected texture for painting
|
||||||
|
CTextureEntry* m_SelectedTexture;
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
static CPaintTextureTool m_PaintTextureTool;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
36
source/sced/RaiseElevationCommand.cpp
Executable file
36
source/sced/RaiseElevationCommand.cpp
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#include "RaiseElevationCommand.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
|
inline int clamp(int x,int min,int max)
|
||||||
|
{
|
||||||
|
if (x<min) return min;
|
||||||
|
else if (x>max) return max;
|
||||||
|
else return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CRaiseElevationCommand::CRaiseElevationCommand(int deltaheight,int brushSize,int selectionCentre[2])
|
||||||
|
: CAlterElevationCommand(brushSize,selectionCentre), m_DeltaHeight(deltaheight)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CRaiseElevationCommand::~CRaiseElevationCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRaiseElevationCommand::CalcDataOut(int x0,int x1,int z0,int z1)
|
||||||
|
{
|
||||||
|
// fill output data
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
int i,j;
|
||||||
|
for (j=z0;j<=z1;j++) {
|
||||||
|
for (i=x0;i<=x1;i++) {
|
||||||
|
u32 input=g_Terrain.GetHeightMap()[j*mapSize+i];
|
||||||
|
u16 output=clamp(input+m_DeltaHeight,0,65535);
|
||||||
|
m_DataOut(i-x0,j-z0)=output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
source/sced/RaiseElevationCommand.h
Executable file
24
source/sced/RaiseElevationCommand.h
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef _RAISEELEVATIONCOMMAND_H
|
||||||
|
#define _RAISEELEVATIONCOMMAND_H
|
||||||
|
|
||||||
|
#include "AlterElevationCommand.h"
|
||||||
|
|
||||||
|
class CRaiseElevationCommand : public CAlterElevationCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor, destructor
|
||||||
|
CRaiseElevationCommand(int deltaheight,int brushSize,int selectionCentre[2]);
|
||||||
|
~CRaiseElevationCommand();
|
||||||
|
|
||||||
|
// return the texture name of this command
|
||||||
|
const char* GetName() const { return m_DeltaHeight<0 ? "Lower Elevation" : "Raise Elevation"; }
|
||||||
|
|
||||||
|
// calculate output data
|
||||||
|
void CalcDataOut(int x0,int x1,int z0,int z1);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// change in elevation, signed
|
||||||
|
int m_DeltaHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
79
source/sced/RaiseElevationTool.cpp
Executable file
79
source/sced/RaiseElevationTool.cpp
Executable file
@ -0,0 +1,79 @@
|
|||||||
|
#include "CommandManager.h"
|
||||||
|
#include "RaiseElevationTool.h"
|
||||||
|
#include "RaiseElevationCommand.h"
|
||||||
|
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
CRaiseElevationTool CRaiseElevationTool::m_RaiseElevationTool;
|
||||||
|
|
||||||
|
|
||||||
|
CRaiseElevationTool::CRaiseElevationTool() : m_Speed(MAX_SPEED)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for left button down event
|
||||||
|
void CRaiseElevationTool::OnLButtonDown(u32 flags,int px,int py)
|
||||||
|
{
|
||||||
|
// store trigger time
|
||||||
|
m_LastTriggerTime=get_time();
|
||||||
|
// give base class a shout to do some work
|
||||||
|
CBrushTool::OnLButtonDown(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for left button up event
|
||||||
|
void CRaiseElevationTool::OnLButtonUp(u32 flags,int px,int py)
|
||||||
|
{
|
||||||
|
// force a trigger
|
||||||
|
OnTriggerLeft();
|
||||||
|
// give base class a shout to do some work
|
||||||
|
CBrushTool::OnLButtonUp(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for right button down event
|
||||||
|
void CRaiseElevationTool::OnRButtonDown(u32 flags,int px,int py)
|
||||||
|
{
|
||||||
|
// store trigger time
|
||||||
|
m_LastTriggerTime=get_time();
|
||||||
|
// give base class a shout to do some work
|
||||||
|
CBrushTool::OnRButtonDown(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for right button up event
|
||||||
|
void CRaiseElevationTool::OnRButtonUp(u32 flags,int px,int py)
|
||||||
|
{
|
||||||
|
// force a trigger
|
||||||
|
OnTriggerRight();
|
||||||
|
// give base class a shout to do some work
|
||||||
|
CBrushTool::OnRButtonUp(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRaiseElevationTool::AlterSelectionHeight(int32 amount)
|
||||||
|
{
|
||||||
|
CRaiseElevationCommand* alterCmd=new CRaiseElevationCommand(amount,m_BrushSize,m_SelectionCentre);
|
||||||
|
g_CmdMan.Execute(alterCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 CRaiseElevationTool::CalcDistSinceLastTrigger()
|
||||||
|
{
|
||||||
|
double curtime=get_time();
|
||||||
|
double elapsed=curtime-m_LastTriggerTime;
|
||||||
|
int32 dist=int32(elapsed*m_Speed);
|
||||||
|
|
||||||
|
m_LastTriggerTime+=dist/m_Speed;
|
||||||
|
|
||||||
|
return dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tool triggered by left mouse button; raise selected terrain
|
||||||
|
void CRaiseElevationTool::OnTriggerLeft()
|
||||||
|
{
|
||||||
|
AlterSelectionHeight(CalcDistSinceLastTrigger());
|
||||||
|
}
|
||||||
|
|
||||||
|
// tool triggered by right mouse button; lower selected terrain
|
||||||
|
void CRaiseElevationTool::OnTriggerRight()
|
||||||
|
{
|
||||||
|
AlterSelectionHeight(-CalcDistSinceLastTrigger());
|
||||||
|
}
|
||||||
|
|
60
source/sced/RaiseElevationTool.h
Executable file
60
source/sced/RaiseElevationTool.h
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
#ifndef _RAISEELEVATIONTOOL_H
|
||||||
|
#define _RAISEELEVATIONTOOL_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "BrushTool.h"
|
||||||
|
|
||||||
|
class CRaiseElevationTool : public CBrushTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { MAX_BRUSH_SIZE=8 };
|
||||||
|
enum { MAX_SPEED=255 };
|
||||||
|
|
||||||
|
public:
|
||||||
|
CRaiseElevationTool();
|
||||||
|
|
||||||
|
// tool triggered by left mouse button; raise selected terrain
|
||||||
|
void OnTriggerLeft();
|
||||||
|
// tool triggered by right mouse button; lower selected terrain
|
||||||
|
void OnTriggerRight();
|
||||||
|
|
||||||
|
// callback for left button down event
|
||||||
|
void OnLButtonDown(u32 flags,int px,int py);
|
||||||
|
// callback for left button up event
|
||||||
|
void OnLButtonUp(u32 flags,int px,int py);
|
||||||
|
// callback for right button down event
|
||||||
|
void OnRButtonDown(u32 flags,int px,int py);
|
||||||
|
// callback for right button up event
|
||||||
|
void OnRButtonUp(u32 flags,int px,int py);
|
||||||
|
|
||||||
|
// set change in elevation on tool being triggered
|
||||||
|
void SetSpeed(int delta) { m_Speed=delta; }
|
||||||
|
// get change in elevation on tool being triggered
|
||||||
|
int GetSpeed() const { return m_Speed; }
|
||||||
|
|
||||||
|
// allow multiple triggers by click and drag
|
||||||
|
bool SupportDragTrigger() { return true; }
|
||||||
|
|
||||||
|
// get tool instance
|
||||||
|
static CRaiseElevationTool* GetTool() { return &m_RaiseElevationTool; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// raise/lower the currently selected terrain tiles by given amount
|
||||||
|
void AlterSelectionHeight(int32 amount);
|
||||||
|
|
||||||
|
// calculate distance terrain has moved since last trigger; adjust last trigger
|
||||||
|
// time appropriately to avoid rounding errors
|
||||||
|
int32 CalcDistSinceLastTrigger();
|
||||||
|
|
||||||
|
// number of units to raise/lower selected terrain tiles per second
|
||||||
|
int m_Speed;
|
||||||
|
|
||||||
|
// time of last trigger
|
||||||
|
double m_LastTriggerTime;
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
static CRaiseElevationTool m_RaiseElevationTool;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
725
source/sced/ScEd.clw
Executable file
725
source/sced/ScEd.clw
Executable file
@ -0,0 +1,725 @@
|
|||||||
|
; CLW file contains information for the MFC ClassWizard
|
||||||
|
|
||||||
|
[General Info]
|
||||||
|
Version=1
|
||||||
|
LastClass=CScEdView
|
||||||
|
LastTemplate=CDialog
|
||||||
|
NewFileInclude1=#include "stdafx.h"
|
||||||
|
NewFileInclude2=#include "ScEd.h"
|
||||||
|
LastPage=0
|
||||||
|
|
||||||
|
ClassCount=27
|
||||||
|
Class1=CScEdApp
|
||||||
|
Class2=CScEdDoc
|
||||||
|
Class3=CScEdView
|
||||||
|
Class4=CMainFrame
|
||||||
|
|
||||||
|
ResourceCount=27
|
||||||
|
Resource1=IDD_DIALOGBAR_UNITTOOLS
|
||||||
|
Class5=CAboutDlg
|
||||||
|
Resource2=IDD_ABOUTBOX
|
||||||
|
Class6=CLightSettingsDlg
|
||||||
|
Class7=CColorButton
|
||||||
|
Class8=CElevationButton
|
||||||
|
Class9=CDirectionButton
|
||||||
|
Class10=CWebLinkButton
|
||||||
|
Resource3=IDD_DIALOG_LIGHTSETTINGS
|
||||||
|
Class11=CTextureToolBar
|
||||||
|
Class12=CImageListCtrl
|
||||||
|
Class13=TexToolBar
|
||||||
|
Resource4=IDR_MAINFRAME
|
||||||
|
Class14=CModelToolBar
|
||||||
|
Resource5=IDD_DIALOGBAR_TEXTURETOOLS
|
||||||
|
Class15=COptionsDlg
|
||||||
|
Resource6=IDD_DIALOG_SIMPLEEDIT
|
||||||
|
Class16=CElevToolsDlgBar
|
||||||
|
Resource7=IDD_DIALOGBAR_UNITPROPERTIES
|
||||||
|
Class17=CUnitPropertiesDlg
|
||||||
|
Resource8=IDD_DIALOG_MAPSIZE
|
||||||
|
Class18=CSimpleEdit
|
||||||
|
Resource9=IDD_DIALOG_OPTIONS
|
||||||
|
Class19=CMapSizeDlg
|
||||||
|
Class20=CMainFrameDlgBar
|
||||||
|
Resource10=IDD_DIALOGBAR_ELEVATIONTOOLS
|
||||||
|
Resource11=IDD_DIALOGBAR_BRUSHSHAPEEDITOR
|
||||||
|
Resource12=IDD_PROPPAGE_NAVIGATION (English (U.S.))
|
||||||
|
Resource13=IDD_ABOUTBOX (English (U.S.))
|
||||||
|
Resource14=IDD_DIALOG_SIMPLEEDIT (English (U.S.))
|
||||||
|
Resource15=IDD_DIALOG_MAPSIZE (English (U.S.))
|
||||||
|
Resource16=IDD_DIALOG_LIGHTSETTINGS (English (U.S.))
|
||||||
|
Resource17=IDD_DIALOGBAR_ELEVATIONTOOLS (English (U.S.))
|
||||||
|
Resource18=IDD_PROPPAGE_SHADOWS (English (U.S.))
|
||||||
|
Resource19=IDD_DIALOGBAR_UNITPROPERTIES (English (U.S.))
|
||||||
|
Resource20=IDD_DIALOGBAR_BRUSHSHAPEEDITOR (English (U.S.))
|
||||||
|
Resource21=IDD_DIALOGBAR_TEXTURETOOLS (English (U.S.))
|
||||||
|
Resource22=IDD_UNITPROPERTIES_TEXTURES (English (U.S.))
|
||||||
|
Resource23=IDD_PROPPAGE_MEDIUM (English (U.S.))
|
||||||
|
Resource24=IDD_DIALOGBAR_UNITTOOLS (English (U.S.))
|
||||||
|
Class21=COptionsPropSheet
|
||||||
|
Class22=CNavigationPropPage
|
||||||
|
Class23=CShadowsPropPage
|
||||||
|
Class24=CNavigatePropPage
|
||||||
|
Resource25=IDD_DIALOG_OPTIONS (English (U.S.))
|
||||||
|
Resource26=IDD_UNITPROPERTIES_ANIMATIONS (English (U.S.))
|
||||||
|
Class25=CUnitPropertiesTabCtrl
|
||||||
|
Class26=CUnitPropertiesTexturesTab
|
||||||
|
Class27=CUnitPropertiesAnimationsTab
|
||||||
|
Resource27=IDR_MAINFRAME (English (U.S.))
|
||||||
|
|
||||||
|
[CLS:CScEdApp]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ScEd.h
|
||||||
|
ImplementationFile=ScEd.cpp
|
||||||
|
Filter=N
|
||||||
|
LastObject=CScEdApp
|
||||||
|
BaseClass=CWinApp
|
||||||
|
VirtualFilter=AC
|
||||||
|
|
||||||
|
[CLS:CScEdDoc]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ScEdDoc.h
|
||||||
|
ImplementationFile=ScEdDoc.cpp
|
||||||
|
Filter=N
|
||||||
|
|
||||||
|
[CLS:CScEdView]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ScEdView.h
|
||||||
|
ImplementationFile=ScEdView.cpp
|
||||||
|
Filter=C
|
||||||
|
BaseClass=CView
|
||||||
|
VirtualFilter=VWC
|
||||||
|
LastObject=CScEdView
|
||||||
|
|
||||||
|
|
||||||
|
[CLS:CMainFrame]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=MainFrm.h
|
||||||
|
ImplementationFile=MainFrm.cpp
|
||||||
|
Filter=T
|
||||||
|
BaseClass=CFrameWnd
|
||||||
|
VirtualFilter=fWC
|
||||||
|
LastObject=CMainFrame
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[CLS:CAboutDlg]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ScEd.cpp
|
||||||
|
ImplementationFile=ScEd.cpp
|
||||||
|
Filter=D
|
||||||
|
LastObject=IDC_BUTTON_LAUNCHWFG
|
||||||
|
BaseClass=CDialog
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[DLG:IDD_ABOUTBOX]
|
||||||
|
Type=1
|
||||||
|
Class=CAboutDlg
|
||||||
|
ControlCount=5
|
||||||
|
Control1=IDC_STATIC,static,1342177294
|
||||||
|
Control2=IDC_STATIC_VERSION,static,1342308480
|
||||||
|
Control3=IDC_STATIC,static,1342308352
|
||||||
|
Control4=IDOK,button,1342373889
|
||||||
|
Control5=IDC_BUTTON_LAUNCHWFG,button,1342275595
|
||||||
|
|
||||||
|
[MNU:IDR_MAINFRAME]
|
||||||
|
Type=1
|
||||||
|
Class=CMainFrame
|
||||||
|
Command1=ID_FILE_LOADMAP
|
||||||
|
Command2=ID_FILE_SAVEMAP
|
||||||
|
Command3=ID_APP_EXIT
|
||||||
|
Command4=ID_EDIT_UNDO
|
||||||
|
Command5=ID_EDIT_REDO
|
||||||
|
Command6=ID_VIEW_TERRAIN_SOLID
|
||||||
|
Command7=ID_VIEW_TERRAIN_GRID
|
||||||
|
Command8=ID_VIEW_TERRAIN_WIREFRAME
|
||||||
|
Command9=ID_VIEW_MODEL_SOLID
|
||||||
|
Command10=ID_VIEW_MODEL_GRID
|
||||||
|
Command11=ID_VIEW_MODEL_WIREFRAME
|
||||||
|
Command12=ID_VIEW_RENDERSTATS
|
||||||
|
Command13=ID_VIEW_SCREENSHOT
|
||||||
|
Command14=IDR_TEXTURE_TOOLS
|
||||||
|
Command15=IDR_ELEVATION_TOOLS
|
||||||
|
Command16=IDR_UNIT_TOOLS
|
||||||
|
Command17=ID_LIGHTING_SETTINGS
|
||||||
|
Command18=ID_TERRAIN_LOAD
|
||||||
|
Command19=IDR_RESIZE_MAP
|
||||||
|
Command20=IDR_TOOLS_CONVERTSMD
|
||||||
|
Command21=ID_TOOLS_OPTIONS
|
||||||
|
Command22=ID_APP_ABOUT
|
||||||
|
CommandCount=22
|
||||||
|
|
||||||
|
[ACL:IDR_MAINFRAME]
|
||||||
|
Type=1
|
||||||
|
Class=CMainFrame
|
||||||
|
Command1=ID_EDIT_COPY
|
||||||
|
Command2=ID_FILE_NEW
|
||||||
|
Command3=ID_FILE_OPEN
|
||||||
|
Command4=ID_FILE_SAVE
|
||||||
|
Command5=ID_EDIT_PASTE
|
||||||
|
Command6=ID_EDIT_UNDO
|
||||||
|
Command7=ID_EDIT_CUT
|
||||||
|
Command8=ID_VIEW_RENDERSTATS
|
||||||
|
Command9=ID_NEXT_PANE
|
||||||
|
Command10=ID_PREV_PANE
|
||||||
|
Command11=ID_VIEW_SCREENSHOT
|
||||||
|
Command12=ID_EDIT_COPY
|
||||||
|
Command13=ID_EDIT_PASTE
|
||||||
|
Command14=ID_EDIT_CUT
|
||||||
|
Command15=ID_EDIT_REDO
|
||||||
|
Command16=ID_EDIT_UNDO
|
||||||
|
CommandCount=16
|
||||||
|
|
||||||
|
[TB:IDR_MAINFRAME]
|
||||||
|
Type=1
|
||||||
|
Class=?
|
||||||
|
Command1=ID_FILE_NEW
|
||||||
|
Command2=ID_FILE_OPEN
|
||||||
|
Command3=ID_FILE_SAVE
|
||||||
|
Command4=ID_EDIT_CUT
|
||||||
|
Command5=ID_EDIT_COPY
|
||||||
|
Command6=ID_EDIT_PASTE
|
||||||
|
Command7=ID_FILE_PRINT
|
||||||
|
Command8=ID_APP_ABOUT
|
||||||
|
CommandCount=8
|
||||||
|
|
||||||
|
[DLG:IDR_MAINFRAME]
|
||||||
|
Type=1
|
||||||
|
Class=CMainFrameDlgBar
|
||||||
|
ControlCount=4
|
||||||
|
Control1=IDC_BUTTON_SELECT,button,1342242944
|
||||||
|
Control2=IDC_BUTTON_ELEVATIONTOOLS,button,1342242944
|
||||||
|
Control3=IDC_BUTTON_TEXTURETOOLS,button,1342242944
|
||||||
|
Control4=IDC_BUTTON_MODELTOOLS,button,1342177408
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_LIGHTSETTINGS]
|
||||||
|
Type=1
|
||||||
|
Class=CLightSettingsDlg
|
||||||
|
ControlCount=19
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDC_BUTTON_APPLY,button,1342242816
|
||||||
|
Control3=IDCANCEL,button,1342242816
|
||||||
|
Control4=IDC_STATIC,static,1342308352
|
||||||
|
Control5=IDC_STATIC,static,1342308352
|
||||||
|
Control6=IDC_STATIC,static,1342308352
|
||||||
|
Control7=IDC_BUTTON_SUNCOLOR,button,1342210059
|
||||||
|
Control8=IDC_BUTTON_TERRAINAMBIENTCOLOR,button,1342210059
|
||||||
|
Control9=IDC_STATIC,button,1342177287
|
||||||
|
Control10=IDC_STATIC,button,1342177287
|
||||||
|
Control11=IDC_STATIC,static,1342308352
|
||||||
|
Control12=IDC_BUTTON_DIRECTION,button,1342210059
|
||||||
|
Control13=IDC_BUTTON_ELEVATION,button,1342210059
|
||||||
|
Control14=IDC_EDIT_DIRECTION,edit,1350574208
|
||||||
|
Control15=IDC_SPIN_DIRECTION,msctls_updown32,1342177463
|
||||||
|
Control16=IDC_STATIC,static,1342308352
|
||||||
|
Control17=IDC_BUTTON_UNITSAMBIENTCOLOR,button,1342210059
|
||||||
|
Control18=IDC_EDIT_ELEVATION,edit,1350574208
|
||||||
|
Control19=IDC_SPIN_ELEVATION,msctls_updown32,1342177462
|
||||||
|
|
||||||
|
[CLS:CLightSettingsDlg]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=LightSettingsDlg.h
|
||||||
|
ImplementationFile=LightSettingsDlg.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=CLightSettingsDlg
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[CLS:CColorButton]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ColorButton.h
|
||||||
|
ImplementationFile=ColorButton.cpp
|
||||||
|
BaseClass=CButton
|
||||||
|
Filter=W
|
||||||
|
LastObject=CColorButton
|
||||||
|
VirtualFilter=BWC
|
||||||
|
|
||||||
|
[CLS:CElevationButton]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ElevationButton.h
|
||||||
|
ImplementationFile=ElevationButton.cpp
|
||||||
|
BaseClass=CButton
|
||||||
|
Filter=W
|
||||||
|
VirtualFilter=BWC
|
||||||
|
LastObject=CElevationButton
|
||||||
|
|
||||||
|
[CLS:CDirectionButton]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=DirectionButton.h
|
||||||
|
ImplementationFile=DirectionButton.cpp
|
||||||
|
BaseClass=CButton
|
||||||
|
Filter=W
|
||||||
|
LastObject=CDirectionButton
|
||||||
|
VirtualFilter=BWC
|
||||||
|
|
||||||
|
[CLS:CWebLinkButton]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=WebLinkButton.h
|
||||||
|
ImplementationFile=WebLinkButton.cpp
|
||||||
|
BaseClass=CButton
|
||||||
|
Filter=W
|
||||||
|
VirtualFilter=BWC
|
||||||
|
LastObject=CWebLinkButton
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_TEXTURETOOLS]
|
||||||
|
Type=1
|
||||||
|
Class=CTextureToolBar
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDC_SLIDER_BRUSHSIZE,msctls_trackbar32,1342242821
|
||||||
|
Control2=IDC_STATIC,static,1342308352
|
||||||
|
Control3=IDC_LIST_TEXTUREBROWSER,SysListView32,1342291980
|
||||||
|
Control4=IDC_STATIC_CURRENTTEXTURE,static,1350566414
|
||||||
|
Control5=IDC_COMBO_TERRAINTYPES,combobox,1344339970
|
||||||
|
Control6=IDC_STATIC,button,1342177287
|
||||||
|
|
||||||
|
[CLS:CTextureToolBar]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=TextureToolBar.h
|
||||||
|
ImplementationFile=TextureToolBar.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=CTextureToolBar
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[CLS:CImageListCtrl]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ImageListCtrl.h
|
||||||
|
ImplementationFile=ImageListCtrl.cpp
|
||||||
|
BaseClass=CListCtrl
|
||||||
|
Filter=W
|
||||||
|
LastObject=CImageListCtrl
|
||||||
|
VirtualFilter=FWC
|
||||||
|
|
||||||
|
[CLS:TexToolBar]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=TexToolBar.h
|
||||||
|
ImplementationFile=TexToolBar.cpp
|
||||||
|
BaseClass=CToolBarCtrl
|
||||||
|
Filter=W
|
||||||
|
LastObject=TexToolBar
|
||||||
|
VirtualFilter=YWC
|
||||||
|
|
||||||
|
[CLS:CModelToolBar]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ModelToolBar.h
|
||||||
|
ImplementationFile=ModelToolBar.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=CModelToolBar
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_OPTIONS]
|
||||||
|
Type=1
|
||||||
|
Class=COptionsDlg
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDCANCEL,button,1342242816
|
||||||
|
Control3=IDC_STATIC,button,1342177287
|
||||||
|
Control4=IDC_SLIDER_RTSSCROLLSPEED,msctls_trackbar32,1342242821
|
||||||
|
Control5=IDC_STATIC,static,1342308352
|
||||||
|
Control6=IDC_STATIC,static,1342308352
|
||||||
|
|
||||||
|
[CLS:COptionsDlg]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=OptionsDlg.h
|
||||||
|
ImplementationFile=OptionsDlg.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=COptionsDlg
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_ELEVATIONTOOLS]
|
||||||
|
Type=1
|
||||||
|
Class=CElevToolsDlgBar
|
||||||
|
ControlCount=7
|
||||||
|
Control1=IDC_SLIDER_BRUSHSIZE,msctls_trackbar32,1342242821
|
||||||
|
Control2=IDC_STATIC,static,1342308352
|
||||||
|
Control3=IDC_SLIDER_BRUSHEFFECT,msctls_trackbar32,1342242821
|
||||||
|
Control4=IDC_STATIC,static,1342308352
|
||||||
|
Control5=IDC_STATIC,button,1342177287
|
||||||
|
Control6=IDC_RADIO_RAISE,button,1342177289
|
||||||
|
Control7=IDC_RADIO_SMOOTH,button,1342177289
|
||||||
|
|
||||||
|
[CLS:CElevToolsDlgBar]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ElevToolsDlgBar.h
|
||||||
|
ImplementationFile=ElevToolsDlgBar.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=CElevToolsDlgBar
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_UNITTOOLS]
|
||||||
|
Type=1
|
||||||
|
Class=CModelToolBar
|
||||||
|
ControlCount=4
|
||||||
|
Control1=IDC_LIST_OBJECTBROWSER,SysListView32,1342291981
|
||||||
|
Control2=IDC_BUTTON_ADD,button,1342242816
|
||||||
|
Control3=IDC_BUTTON_EDIT,button,1342242816
|
||||||
|
Control4=IDC_COMBO_OBJECTTYPES,combobox,1344339970
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_UNITPROPERTIES]
|
||||||
|
Type=1
|
||||||
|
Class=CUnitPropertiesDlg
|
||||||
|
ControlCount=13
|
||||||
|
Control1=IDC_STATIC,static,1342308352
|
||||||
|
Control2=IDC_STATIC,static,1342308352
|
||||||
|
Control3=IDC_STATIC,static,1342308352
|
||||||
|
Control4=IDC_EDIT_NAME,edit,1350631552
|
||||||
|
Control5=IDC_EDIT_MODEL,edit,1350631552
|
||||||
|
Control6=IDC_EDIT_TEXTURE,edit,1350631552
|
||||||
|
Control7=IDC_BUTTON_MODELBROWSE,button,1342242816
|
||||||
|
Control8=IDC_BUTTON_TEXTUREBROWSE,button,1342242816
|
||||||
|
Control9=IDC_BUTTON_REFRESH,button,1342242816
|
||||||
|
Control10=IDC_BUTTON_BACK,button,1342242816
|
||||||
|
Control11=IDC_STATIC,static,1342308352
|
||||||
|
Control12=IDC_EDIT_ANIMATION,edit,1350631552
|
||||||
|
Control13=IDC_BUTTON_ANIMATIONBROWSE,button,1342242816
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_SIMPLEEDIT]
|
||||||
|
Type=1
|
||||||
|
Class=CSimpleEdit
|
||||||
|
ControlCount=3
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDCANCEL,button,1342242816
|
||||||
|
Control3=IDC_EDIT1,edit,1350631552
|
||||||
|
|
||||||
|
[CLS:CSimpleEdit]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=SimpleEdit.h
|
||||||
|
ImplementationFile=SimpleEdit.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=CSimpleEdit
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_MAPSIZE]
|
||||||
|
Type=1
|
||||||
|
Class=CMapSizeDlg
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDCANCEL,button,1342242816
|
||||||
|
Control3=IDC_RADIO_SMALL,button,1342177289
|
||||||
|
Control4=IDC_RADIO_MEDIUM,button,1342177289
|
||||||
|
Control5=IDC_RADIO_LARGE,button,1342177289
|
||||||
|
Control6=IDC_RADIO_HUGE,button,1342177289
|
||||||
|
|
||||||
|
[CLS:CMapSizeDlg]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=MapSizeDlg.h
|
||||||
|
ImplementationFile=MapSizeDlg.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
VirtualFilter=dWC
|
||||||
|
LastObject=CMapSizeDlg
|
||||||
|
|
||||||
|
[CLS:CMainFrameDlgBar]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=MainFrameDlgBar.h
|
||||||
|
ImplementationFile=MainFrameDlgBar.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
VirtualFilter=dWC
|
||||||
|
LastObject=IDC_BUTTON_ELEVATIONTOOLS
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_BRUSHSHAPEEDITOR]
|
||||||
|
Type=1
|
||||||
|
Class=CShadowsPropPage
|
||||||
|
ControlCount=4
|
||||||
|
Control1=IDC_SLIDER_BRUSHSIZE,msctls_trackbar32,1342242821
|
||||||
|
Control2=IDC_COMBO_TERRAINTYPES,combobox,1344339970
|
||||||
|
Control3=IDC_STATIC,static,1342308352
|
||||||
|
Control4=IDC_BUTTON_BACK,button,1342242816
|
||||||
|
|
||||||
|
[TB:IDR_MAINFRAME (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=?
|
||||||
|
Command1=ID_FILE_NEW
|
||||||
|
Command2=ID_FILE_OPEN
|
||||||
|
Command3=ID_FILE_SAVE
|
||||||
|
Command4=ID_EDIT_CUT
|
||||||
|
Command5=ID_EDIT_COPY
|
||||||
|
Command6=ID_EDIT_PASTE
|
||||||
|
Command7=ID_FILE_PRINT
|
||||||
|
Command8=ID_APP_ABOUT
|
||||||
|
CommandCount=8
|
||||||
|
|
||||||
|
[MNU:IDR_MAINFRAME (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CMainFrame
|
||||||
|
Command1=ID_FILE_LOADMAP
|
||||||
|
Command2=ID_FILE_SAVEMAP
|
||||||
|
Command3=ID_APP_EXIT
|
||||||
|
Command4=ID_TEST_GO
|
||||||
|
Command5=ID_TEST_STOP
|
||||||
|
Command6=ID_EDIT_UNDO
|
||||||
|
Command7=ID_EDIT_REDO
|
||||||
|
Command8=ID_VIEW_TERRAIN_SOLID
|
||||||
|
Command9=ID_VIEW_TERRAIN_GRID
|
||||||
|
Command10=ID_VIEW_TERRAIN_WIREFRAME
|
||||||
|
Command11=ID_VIEW_MODEL_SOLID
|
||||||
|
Command12=ID_VIEW_MODEL_GRID
|
||||||
|
Command13=ID_VIEW_MODEL_WIREFRAME
|
||||||
|
Command14=ID_VIEW_RENDERSTATS
|
||||||
|
Command15=ID_VIEW_SCREENSHOT
|
||||||
|
Command16=IDR_TEXTURE_TOOLS
|
||||||
|
Command17=IDR_ELEVATION_TOOLS
|
||||||
|
Command18=IDR_UNIT_TOOLS
|
||||||
|
Command19=ID_LIGHTING_SETTINGS
|
||||||
|
Command20=ID_TERRAIN_LOAD
|
||||||
|
Command21=IDR_RESIZE_MAP
|
||||||
|
Command22=ID_TOOLS_OPTIONS
|
||||||
|
Command23=ID_APP_ABOUT
|
||||||
|
CommandCount=23
|
||||||
|
|
||||||
|
[ACL:IDR_MAINFRAME (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=?
|
||||||
|
Command1=ID_EDIT_COPY
|
||||||
|
Command2=ID_FILE_NEW
|
||||||
|
Command3=ID_FILE_OPEN
|
||||||
|
Command4=ID_FILE_SAVE
|
||||||
|
Command5=ID_EDIT_PASTE
|
||||||
|
Command6=ID_EDIT_UNDO
|
||||||
|
Command7=ID_EDIT_CUT
|
||||||
|
Command8=ID_VIEW_RENDERSTATS
|
||||||
|
Command9=ID_NEXT_PANE
|
||||||
|
Command10=ID_PREV_PANE
|
||||||
|
Command11=ID_VIEW_SCREENSHOT
|
||||||
|
Command12=ID_EDIT_COPY
|
||||||
|
Command13=ID_EDIT_PASTE
|
||||||
|
Command14=ID_EDIT_CUT
|
||||||
|
Command15=ID_EDIT_REDO
|
||||||
|
Command16=ID_EDIT_UNDO
|
||||||
|
CommandCount=16
|
||||||
|
|
||||||
|
[DLG:IDD_ABOUTBOX (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CAboutDlg
|
||||||
|
ControlCount=5
|
||||||
|
Control1=IDC_STATIC,static,1342177294
|
||||||
|
Control2=IDC_STATIC_VERSION,static,1342308480
|
||||||
|
Control3=IDC_STATIC,static,1342308352
|
||||||
|
Control4=IDOK,button,1342373889
|
||||||
|
Control5=IDC_BUTTON_LAUNCHWFG,button,1342275595
|
||||||
|
|
||||||
|
[DLG:IDR_MAINFRAME (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CMainFrameDlgBar
|
||||||
|
ControlCount=4
|
||||||
|
Control1=IDC_BUTTON_SELECT,button,1342242944
|
||||||
|
Control2=IDC_BUTTON_ELEVATIONTOOLS,button,1342242944
|
||||||
|
Control3=IDC_BUTTON_TEXTURETOOLS,button,1342242944
|
||||||
|
Control4=IDC_BUTTON_MODELTOOLS,button,1342177408
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_LIGHTSETTINGS (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CLightSettingsDlg
|
||||||
|
ControlCount=19
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDC_BUTTON_APPLY,button,1342242816
|
||||||
|
Control3=IDCANCEL,button,1342242816
|
||||||
|
Control4=IDC_STATIC,static,1342308352
|
||||||
|
Control5=IDC_STATIC,static,1342308352
|
||||||
|
Control6=IDC_STATIC,static,1342308352
|
||||||
|
Control7=IDC_BUTTON_SUNCOLOR,button,1342210059
|
||||||
|
Control8=IDC_BUTTON_TERRAINAMBIENTCOLOR,button,1342210059
|
||||||
|
Control9=IDC_STATIC,button,1342177287
|
||||||
|
Control10=IDC_STATIC,button,1342177287
|
||||||
|
Control11=IDC_STATIC,static,1342308352
|
||||||
|
Control12=IDC_BUTTON_DIRECTION,button,1342210059
|
||||||
|
Control13=IDC_BUTTON_ELEVATION,button,1342210059
|
||||||
|
Control14=IDC_EDIT_DIRECTION,edit,1350574208
|
||||||
|
Control15=IDC_SPIN_DIRECTION,msctls_updown32,1342177463
|
||||||
|
Control16=IDC_STATIC,static,1342308352
|
||||||
|
Control17=IDC_BUTTON_UNITSAMBIENTCOLOR,button,1342210059
|
||||||
|
Control18=IDC_EDIT_ELEVATION,edit,1350574208
|
||||||
|
Control19=IDC_SPIN_ELEVATION,msctls_updown32,1342177462
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_TEXTURETOOLS (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CTextureToolBar
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDC_SLIDER_BRUSHSIZE,msctls_trackbar32,1342242821
|
||||||
|
Control2=IDC_STATIC,static,1342308352
|
||||||
|
Control3=IDC_LIST_TEXTUREBROWSER,SysListView32,1342291980
|
||||||
|
Control4=IDC_STATIC_CURRENTTEXTURE,static,1350566414
|
||||||
|
Control5=IDC_COMBO_TERRAINTYPES,combobox,1344339970
|
||||||
|
Control6=IDC_STATIC,button,1342177287
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_UNITTOOLS (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CModelToolBar
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDC_LIST_OBJECTBROWSER,SysListView32,1342291981
|
||||||
|
Control2=IDC_BUTTON_ADD,button,1342242816
|
||||||
|
Control3=IDC_BUTTON_EDIT,button,1342242816
|
||||||
|
Control4=IDC_COMBO_OBJECTTYPES,combobox,1344339970
|
||||||
|
Control5=IDC_BUTTON_SELECT,button,1342242944
|
||||||
|
Control6=IDC_BUTTON_ADDUNIT,button,1342242944
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_OPTIONS (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=COptionsDlg
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDCANCEL,button,1342242816
|
||||||
|
Control3=IDC_STATIC,button,1342177287
|
||||||
|
Control4=IDC_SLIDER_RTSSCROLLSPEED,msctls_trackbar32,1342242821
|
||||||
|
Control5=IDC_STATIC,static,1342308352
|
||||||
|
Control6=IDC_STATIC,static,1342308352
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_ELEVATIONTOOLS (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CElevToolsDlgBar
|
||||||
|
ControlCount=7
|
||||||
|
Control1=IDC_SLIDER_BRUSHSIZE,msctls_trackbar32,1342242821
|
||||||
|
Control2=IDC_STATIC,static,1342308352
|
||||||
|
Control3=IDC_SLIDER_BRUSHEFFECT,msctls_trackbar32,1342242821
|
||||||
|
Control4=IDC_STATIC,static,1342308352
|
||||||
|
Control5=IDC_STATIC,button,1342177287
|
||||||
|
Control6=IDC_RADIO_RAISE,button,1342177289
|
||||||
|
Control7=IDC_RADIO_SMOOTH,button,1342177289
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_UNITPROPERTIES (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CUnitPropertiesDlg
|
||||||
|
ControlCount=13
|
||||||
|
Control1=IDC_STATIC,static,1342308352
|
||||||
|
Control2=IDC_STATIC,static,1342308352
|
||||||
|
Control3=IDC_EDIT_NAME,edit,1350631552
|
||||||
|
Control4=IDC_EDIT_MODEL,edit,1350631552
|
||||||
|
Control5=IDC_BUTTON_MODELBROWSE,button,1342242816
|
||||||
|
Control6=IDC_BUTTON_REFRESH,button,1342242816
|
||||||
|
Control7=IDC_BUTTON_BACK,button,1342242816
|
||||||
|
Control8=IDC_STATIC,static,1342308352
|
||||||
|
Control9=IDC_EDIT_ANIMATION,edit,1350631552
|
||||||
|
Control10=IDC_BUTTON_ANIMATIONBROWSE,button,1342242816
|
||||||
|
Control11=IDC_STATIC,static,1342308352
|
||||||
|
Control12=IDC_EDIT_TEXTURE,edit,1350631552
|
||||||
|
Control13=IDC_BUTTON_TEXTUREBROWSE,button,1342242816
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_SIMPLEEDIT (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CSimpleEdit
|
||||||
|
ControlCount=3
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDCANCEL,button,1342242816
|
||||||
|
Control3=IDC_EDIT1,edit,1350631552
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOG_MAPSIZE (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CMapSizeDlg
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDOK,button,1342242817
|
||||||
|
Control2=IDCANCEL,button,1342242816
|
||||||
|
Control3=IDC_RADIO_SMALL,button,1342177289
|
||||||
|
Control4=IDC_RADIO_MEDIUM,button,1342177289
|
||||||
|
Control5=IDC_RADIO_LARGE,button,1342177289
|
||||||
|
Control6=IDC_RADIO_HUGE,button,1342177289
|
||||||
|
|
||||||
|
[DLG:IDD_DIALOGBAR_BRUSHSHAPEEDITOR (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CShadowsPropPage
|
||||||
|
ControlCount=4
|
||||||
|
Control1=IDC_SLIDER_BRUSHSIZE,msctls_trackbar32,1342242821
|
||||||
|
Control2=IDC_COMBO_TERRAINTYPES,combobox,1344339970
|
||||||
|
Control3=IDC_STATIC,static,1342308352
|
||||||
|
Control4=IDC_BUTTON_BACK,button,1342242816
|
||||||
|
|
||||||
|
[DLG:IDD_PROPPAGE_MEDIUM (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=?
|
||||||
|
ControlCount=1
|
||||||
|
Control1=IDC_STATIC,static,1342308352
|
||||||
|
|
||||||
|
[DLG:IDD_PROPPAGE_NAVIGATION (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CNavigatePropPage
|
||||||
|
ControlCount=2
|
||||||
|
Control1=IDC_STATIC,button,1342177287
|
||||||
|
Control2=IDC_SLIDER_RTSSCROLLSPEED,msctls_trackbar32,1342242821
|
||||||
|
|
||||||
|
[DLG:IDD_PROPPAGE_SHADOWS (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=?
|
||||||
|
ControlCount=6
|
||||||
|
Control1=IDC_CHECK_SHADOWS,button,1342242819
|
||||||
|
Control2=IDC_STATIC,button,1342177287
|
||||||
|
Control3=IDC_STATIC,static,1342308352
|
||||||
|
Control4=IDC_BUTTON_SHADOWCOLOR,button,1342210059
|
||||||
|
Control5=IDC_SLIDER_SHADOWQUALITY,msctls_trackbar32,1342242821
|
||||||
|
Control6=IDC_STATIC,static,1342308352
|
||||||
|
|
||||||
|
[CLS:COptionsPropSheet]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=OptionsPropSheet.h
|
||||||
|
ImplementationFile=OptionsPropSheet.cpp
|
||||||
|
BaseClass=CPropertySheet
|
||||||
|
Filter=W
|
||||||
|
LastObject=COptionsPropSheet
|
||||||
|
VirtualFilter=hWC
|
||||||
|
|
||||||
|
[CLS:CNavigationPropPage]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=NavigationPropPage.h
|
||||||
|
ImplementationFile=NavigationPropPage.cpp
|
||||||
|
BaseClass=CPropertySheet
|
||||||
|
Filter=W
|
||||||
|
LastObject=CNavigationPropPage
|
||||||
|
|
||||||
|
[CLS:CShadowsPropPage]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=ShadowsPropPage.h
|
||||||
|
ImplementationFile=ShadowsPropPage.cpp
|
||||||
|
BaseClass=CPropertyPage
|
||||||
|
Filter=D
|
||||||
|
LastObject=CShadowsPropPage
|
||||||
|
VirtualFilter=idWC
|
||||||
|
|
||||||
|
[CLS:CNavigatePropPage]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=NavigatePropPage.h
|
||||||
|
ImplementationFile=NavigatePropPage.cpp
|
||||||
|
BaseClass=CPropertyPage
|
||||||
|
Filter=D
|
||||||
|
LastObject=CNavigatePropPage
|
||||||
|
|
||||||
|
[DLG:IDD_UNITPROPERTIES_TEXTURES (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CUnitPropertiesTexturesTab
|
||||||
|
ControlCount=3
|
||||||
|
Control1=IDC_STATIC,static,1342308352
|
||||||
|
Control2=IDC_EDIT_TEXTURE,edit,1350631552
|
||||||
|
Control3=IDC_BUTTON_TEXTUREBROWSE,button,1342242816
|
||||||
|
|
||||||
|
[DLG:IDD_UNITPROPERTIES_ANIMATIONS (English (U.S.))]
|
||||||
|
Type=1
|
||||||
|
Class=CUnitPropertiesAnimationsTab
|
||||||
|
ControlCount=3
|
||||||
|
Control1=IDC_STATIC,static,1342308352
|
||||||
|
Control2=IDC_EDIT_ANIMATION,edit,1350631552
|
||||||
|
Control3=IDC_BUTTON_ANIMATIONBROWSE,button,1342242816
|
||||||
|
|
||||||
|
[CLS:CUnitPropertiesTabCtrl]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=UnitPropertiesTabCtrl.h
|
||||||
|
ImplementationFile=UnitPropertiesTabCtrl.cpp
|
||||||
|
BaseClass=CTabCtrl
|
||||||
|
Filter=W
|
||||||
|
LastObject=CUnitPropertiesTabCtrl
|
||||||
|
VirtualFilter=UWC
|
||||||
|
|
||||||
|
[CLS:CUnitPropertiesTexturesTab]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=UnitPropertiesTexturesTab.h
|
||||||
|
ImplementationFile=UnitPropertiesTexturesTab.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
|
||||||
|
[CLS:CUnitPropertiesAnimationsTab]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=UnitPropertiesAnimationsTab.h
|
||||||
|
ImplementationFile=UnitPropertiesAnimationsTab.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
|
217
source/sced/ScEd.cpp
Executable file
217
source/sced/ScEd.cpp
Executable file
@ -0,0 +1,217 @@
|
|||||||
|
// ScEd.cpp : Defines the class behaviors for the application.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
|
||||||
|
#include "MainFrm.h"
|
||||||
|
#include "ScEdDoc.h"
|
||||||
|
#include "ScEdView.h"
|
||||||
|
#include "WebLinkButton.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
|
||||||
|
#include "lib.h"
|
||||||
|
#ifdef _M_IX86
|
||||||
|
#include "sysdep/ia32.h"
|
||||||
|
#endif
|
||||||
|
#include "detect.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CScEdApp, CWinApp)
|
||||||
|
//{{AFX_MSG_MAP(CScEdApp)
|
||||||
|
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
// Standard file based document commands
|
||||||
|
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
|
||||||
|
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdApp construction
|
||||||
|
|
||||||
|
CScEdApp::CScEdApp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// The one and only CScEdApp object
|
||||||
|
|
||||||
|
CScEdApp theApp;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdApp initialization
|
||||||
|
|
||||||
|
BOOL CScEdApp::InitInstance()
|
||||||
|
{
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
// Standard initialization
|
||||||
|
// If you are not using these features and wish to reduce the size
|
||||||
|
// of your final executable, you should remove from the following
|
||||||
|
// the specific initialization routines you do not need.
|
||||||
|
|
||||||
|
#ifdef _AFXDLL
|
||||||
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||||
|
#else
|
||||||
|
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Change the registry key under which our settings are stored.
|
||||||
|
// TODO: You should modify this string to be something appropriate
|
||||||
|
// such as the name of your company or organization.
|
||||||
|
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||||
|
|
||||||
|
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
|
||||||
|
|
||||||
|
// Register the application's document templates. Document templates
|
||||||
|
// serve as the connection between documents, frame windows and views.
|
||||||
|
|
||||||
|
CSingleDocTemplate* pDocTemplate;
|
||||||
|
pDocTemplate = new CSingleDocTemplate(
|
||||||
|
IDR_MAINFRAME,
|
||||||
|
RUNTIME_CLASS(CScEdDoc),
|
||||||
|
RUNTIME_CLASS(CMainFrame), // main SDI frame window
|
||||||
|
RUNTIME_CLASS(CScEdView));
|
||||||
|
AddDocTemplate(pDocTemplate);
|
||||||
|
|
||||||
|
// Parse command line for standard shell commands, DDE, file open
|
||||||
|
CCommandLineInfo cmdInfo;
|
||||||
|
ParseCommandLine(cmdInfo);
|
||||||
|
|
||||||
|
// Dispatch commands specified on the command line
|
||||||
|
if (!ProcessShellCommand(cmdInfo))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
((CMainFrame*)m_pMainWnd)->SetTitle();
|
||||||
|
|
||||||
|
// The one and only window has been initialized, so show and update it.
|
||||||
|
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
|
||||||
|
m_pMainWnd->UpdateWindow();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CAboutDlg dialog used for App About
|
||||||
|
|
||||||
|
class CAboutDlg : public CDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAboutDlg();
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CAboutDlg)
|
||||||
|
enum { IDD = IDD_ABOUTBOX };
|
||||||
|
CWebLinkButton m_WFGLinkButton;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CAboutDlg)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CAboutDlg)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CAboutDlg)
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CAboutDlg)
|
||||||
|
DDX_Control(pDX, IDC_BUTTON_LAUNCHWFG, m_WFGLinkButton);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CAboutDlg)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
// App command to run the dialog
|
||||||
|
void CScEdApp::OnAppAbout()
|
||||||
|
{
|
||||||
|
CAboutDlg aboutDlg;
|
||||||
|
aboutDlg.DoModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdApp message handlers
|
||||||
|
|
||||||
|
BOOL CAboutDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
char buf[64];
|
||||||
|
GetVersionString(buf);
|
||||||
|
|
||||||
|
CWnd* wnd=GetDlgItem(IDC_STATIC_VERSION);
|
||||||
|
wnd->SetWindowText(buf);
|
||||||
|
|
||||||
|
m_WFGLinkButton.m_Address="www.wildfiregames.com";
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
int CScEdApp::Run()
|
||||||
|
{
|
||||||
|
// acquire and dispatch messages until a WM_QUIT message is received
|
||||||
|
while (1) {
|
||||||
|
// process windows messages
|
||||||
|
while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE)) {
|
||||||
|
// pump message, but quit on WM_QUIT
|
||||||
|
if (!PumpMessage())
|
||||||
|
return ExitInstance();
|
||||||
|
}
|
||||||
|
// do idle time processing
|
||||||
|
CMainFrame* mainfrm=(CMainFrame*) AfxGetMainWnd();
|
||||||
|
if (mainfrm) {
|
||||||
|
CScEdView* view=(CScEdView*) mainfrm->GetActiveView();
|
||||||
|
if (view) {
|
||||||
|
view->IdleTimeProcess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// shouldn't get here
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
|
LPTSTR lpCmdLine, int nCmdShow);
|
||||||
|
|
||||||
|
extern void pre_main_init();
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
pre_main_init();
|
||||||
|
lib_init();
|
||||||
|
|
||||||
|
// set 24 bit (float) FPU precision for faster divides / sqrts
|
||||||
|
#ifdef _M_IX86
|
||||||
|
_control87(_PC_24, _MCW_PC);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
detect();
|
||||||
|
|
||||||
|
AfxInitialize();
|
||||||
|
return AfxWinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0);
|
||||||
|
}
|
||||||
|
#endif
|
989
source/sced/ScEd.dep
Executable file
989
source/sced/ScEd.dep
Executable file
@ -0,0 +1,989 @@
|
|||||||
|
# Microsoft Developer Studio Generated Dependency File, included by ScEd.mak
|
||||||
|
|
||||||
|
.\ColorButton.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\ColorButton.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\DirectionButton.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
".\DirectionButton.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ElevationButton.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
".\ElevationButton.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ElevToolsDlgBar.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\ElevToolsDlgBar.h"\
|
||||||
|
".\RaiseElevationTool.h"\
|
||||||
|
".\SmoothElevationTool.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
".\ToolManager.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ImageListCtrl.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\ImageListCtrl.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\LightSettingsDlg.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\LightEnv.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\ColorButton.h"\
|
||||||
|
".\DirectionButton.h"\
|
||||||
|
".\ElevationButton.h"\
|
||||||
|
".\LightSettingsDlg.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\MainFrm.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\mem.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\lib\tex.h"\
|
||||||
|
"..\lib\vfs.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\LightEnv.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\ModelDef.h"\
|
||||||
|
"..\Terrain\ModelFile.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\PatchRData.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Renderer.h"\
|
||||||
|
"..\Terrain\SHCoeffs.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\ColorButton.h"\
|
||||||
|
".\CommandManager.h"\
|
||||||
|
".\DirectionButton.h"\
|
||||||
|
".\EditorData.h"\
|
||||||
|
".\ElevationButton.h"\
|
||||||
|
".\ElevToolsDlgBar.h"\
|
||||||
|
".\InfoBox.h"\
|
||||||
|
".\LightSettingsDlg.h"\
|
||||||
|
".\MainFrm.h"\
|
||||||
|
".\MapSizeDlg.h"\
|
||||||
|
".\MiniMap.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\OptionsDlg.h"\
|
||||||
|
".\PaintObjectTool.h"\
|
||||||
|
".\PaintTextureTool.h"\
|
||||||
|
".\RaiseElevationTool.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\ScEdView.h"\
|
||||||
|
".\SMDConverter.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\TexToolsDlgBar.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
".\ToolManager.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
".\UnitPropertiesDlgBar.h"\
|
||||||
|
".\UnitToolsDlgBar.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\MapSizeDlg.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\MapSizeDlg.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\OptionsDlg.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\OptionsDlg.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ScEd.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
".\ElevToolsDlgBar.h"\
|
||||||
|
".\MainFrm.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\ScEdDoc.h"\
|
||||||
|
".\ScEdView.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\TexToolsDlgBar.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
".\UnitPropertiesDlgBar.h"\
|
||||||
|
".\UnitToolsDlgBar.h"\
|
||||||
|
".\WebLinkButton.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ScEd.rc : \
|
||||||
|
".\res\0ad_logo.bmp"\
|
||||||
|
".\res\ico00001.ico"\
|
||||||
|
".\res\ico00002.ico"\
|
||||||
|
".\res\icon1.ico"\
|
||||||
|
".\res\ScEd.ico"\
|
||||||
|
".\res\ScEd.rc2"\
|
||||||
|
".\res\ScEdDoc.ico"\
|
||||||
|
".\res\Toolbar.bmp"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ScEdDoc.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\ScEdDoc.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ScEdView.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\lib\vfs.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\LightEnv.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\PatchRData.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Renderer.h"\
|
||||||
|
"..\Terrain\SHCoeffs.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\EditorData.h"\
|
||||||
|
".\InfoBox.h"\
|
||||||
|
".\MiniMap.h"\
|
||||||
|
".\PaintTextureTool.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\ScEdDoc.h"\
|
||||||
|
".\ScEdView.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
".\ToolManager.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\SimpleEdit.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\SimpleEdit.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\TexToolsDlgBar.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\lib\tex.h"\
|
||||||
|
"..\lib\vfs.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\PaintTextureTool.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\TexToolsDlgBar.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\TextureManager.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\UIGlobals.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
".\ElevToolsDlgBar.h"\
|
||||||
|
".\MainFrm.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ScEdView.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\TexToolsDlgBar.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
".\UnitPropertiesDlgBar.h"\
|
||||||
|
".\UnitToolsDlgBar.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\UnitPropertiesDlgBar.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\LightEnv.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\PatchRData.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Renderer.h"\
|
||||||
|
"..\Terrain\SHCoeffs.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\EditorData.h"\
|
||||||
|
".\ElevToolsDlgBar.h"\
|
||||||
|
".\InfoBox.h"\
|
||||||
|
".\MainFrm.h"\
|
||||||
|
".\MiniMap.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ObjectManager.h"\
|
||||||
|
".\PaintTextureTool.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\TexToolsDlgBar.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
".\UnitPropertiesDlgBar.h"\
|
||||||
|
".\UnitToolsDlgBar.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\UnitToolsDlgBar.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
".\ElevToolsDlgBar.h"\
|
||||||
|
".\MainFrm.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ObjectManager.h"\
|
||||||
|
".\SimpleEdit.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\TexToolsDlgBar.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\UnitPropertiesDlgBar.h"\
|
||||||
|
".\UnitToolsDlgBar.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\WebLinkButton.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\ScEd.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
".\WebLinkButton.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\AlterElevationCommand.cpp : \
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\LightEnv.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\SHCoeffs.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\AlterElevationCommand.h"\
|
||||||
|
".\Array2D.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\MiniMap.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\PaintObjectCommand.cpp : \
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\PaintObjectCommand.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
".\Unit.h"\
|
||||||
|
".\UnitManager.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\PaintTextureCommand.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\Array2D.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\MiniMap.h"\
|
||||||
|
".\PaintTextureCommand.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\RaiseElevationCommand.cpp : \
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\AlterElevationCommand.h"\
|
||||||
|
".\Array2D.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\RaiseElevationCommand.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\SmoothElevationCommand.cpp : \
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\AlterElevationCommand.h"\
|
||||||
|
".\Array2D.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\SmoothElevationCommand.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\BrushTool.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\HFTracer.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\TextureManager.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\PaintObjectTool.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\PatchRData.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Renderer.h"\
|
||||||
|
"..\Terrain\SHCoeffs.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\CommandManager.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ObjectManager.h"\
|
||||||
|
".\PaintObjectCommand.h"\
|
||||||
|
".\PaintObjectTool.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\PaintTextureTool.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\Array2D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\CommandManager.h"\
|
||||||
|
".\PaintTextureCommand.h"\
|
||||||
|
".\PaintTextureTool.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\RaiseElevationTool.cpp : \
|
||||||
|
"..\lib\res.h"\
|
||||||
|
".\AlterElevationCommand.h"\
|
||||||
|
".\Array2D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\CommandManager.h"\
|
||||||
|
".\RaiseElevationCommand.h"\
|
||||||
|
".\RaiseElevationTool.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\SmoothElevationTool.cpp : \
|
||||||
|
"..\lib\res.h"\
|
||||||
|
".\AlterElevationCommand.h"\
|
||||||
|
".\Array2D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\Command.h"\
|
||||||
|
".\CommandManager.h"\
|
||||||
|
".\SmoothElevationCommand.h"\
|
||||||
|
".\SmoothElevationTool.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\CommandManager.cpp : \
|
||||||
|
".\Command.h"\
|
||||||
|
".\CommandManager.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\EditorData.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\lib\tex.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\LightEnv.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\PatchRData.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Renderer.h"\
|
||||||
|
"..\Terrain\SHCoeffs.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\BrushTool.h"\
|
||||||
|
".\EditorData.h"\
|
||||||
|
".\InfoBox.h"\
|
||||||
|
".\MiniMap.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ObjectManager.h"\
|
||||||
|
".\PaintTextureTool.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\TextureManager.h"\
|
||||||
|
".\Tool.h"\
|
||||||
|
".\ToolManager.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
".\Unit.h"\
|
||||||
|
".\UnitManager.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\InfoBox.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\NPFont.h"\
|
||||||
|
"..\ps\NPFontManager.h"\
|
||||||
|
"..\ps\Overlay.h"\
|
||||||
|
"..\ps\OverlayText.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Color.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\PatchRData.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Renderer.h"\
|
||||||
|
"..\Terrain\SHCoeffs.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Texture.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\InfoBox.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\MiniMap.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\MiniMap.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\TextureManager.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ObjectEntry.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\ps\XercesErrorHandler.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\Model.h"\
|
||||||
|
"..\Terrain\ModelDef.h"\
|
||||||
|
"..\Terrain\ModelFile.h"\
|
||||||
|
"..\Terrain\Texture.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ObjectManager.h"\
|
||||||
|
".\UIGlobals.h"\
|
||||||
|
".\Unit.h"\
|
||||||
|
".\UnitManager.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOM.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMAttr.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMBuilder.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMCDATASection.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMCharacterData.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMComment.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMConfiguration.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMDocument.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMDocumentFragment.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMDocumentRange.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMDocumentTraversal.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMDocumentType.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMElement.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMEntity.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMEntityReference.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMEntityResolver.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMError.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMErrorHandler.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMImplementation.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMImplementationLS.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMImplementationRegistry.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMImplementationSource.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMInputSource.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMLocator.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMNamedNodeMap.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMNode.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMNodeFilter.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMNodeIterator.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMNodeList.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMNotation.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMProcessingInstruction.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMRange.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMRangeException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMText.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMTreeWalker.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMTypeInfo.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMUserDataHandler.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMWriter.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\dom\DOMWriterFilter.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\LocalFileInputSource.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\MemoryManager.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLAttDef.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLAttDefList.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLAttr.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLBuffer.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLBufferMgr.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLContentModel.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLDocumentHandler.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLElementDecl.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLEntityDecl.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLEntityHandler.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLErrorReporter.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLFormatter.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\framework\XMLNotationDecl.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\parsers\AbstractDOMParser.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\parsers\XercesDOMParser.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\sax\ErrorHandler.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\sax\InputSource.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\ArrayIndexOutOfBoundsException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\AutoSense.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\BaseRefVectorOf.c"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\BaseRefVectorOf.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\BorlandCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\CodeWarriorDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\CSetDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\DECCXXDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\GCCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\HPCCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\IBMVAOS2Defs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\IBMVAW32Defs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\MIPSproDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\MVSCPPDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\OS400SetDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\PTXCCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\QCCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\SCOCCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\SunCCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\SunKaiDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\TandemCCDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Compilers\VCPPDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\EmptyStackException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\HashBase.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\HashXMLCh.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\IllegalArgumentException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\NoSuchElementException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\NullPointerException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\PanicHandler.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\AIX\AIXDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\BeOS\BeOSDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\HPUX\HPUXDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\Linux\LinuxDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\MacOS\MacOSDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\OS2\OS2Defs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\OS390\OS390Defs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\PTX\PTXDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\Solaris\SolarisDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\Tandem\TandemDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\Platforms\Win32\Win32Defs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\PlatformUtils.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\QName.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\RefHashTableOf.c"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\RefHashTableOf.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\RefVectorOf.c"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\RefVectorOf.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\RuntimeException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\SecurityManager.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\ValueStackOf.c"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\ValueStackOf.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\ValueVectorOf.c"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\ValueVectorOf.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XercesDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XercesVersion.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XMemory.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XMLEnumerator.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XMLException.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XMLExceptMsgs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XMLString.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XMLUni.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\util\XMLUniDefs.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\validators\DTD\DocTypeHandler.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\validators\DTD\DTDAttDef.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\validators\DTD\DTDElementDecl.hpp"\
|
||||||
|
{$(INCLUDE)}"xercesc\validators\DTD\DTDEntityDecl.hpp"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ObjectManager.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
".\ObjectEntry.h"\
|
||||||
|
".\ObjectManager.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\SMDConverter.cpp : \
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\ModelDef.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\SMDConverter.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\TextureManager.cpp : \
|
||||||
|
"..\lib\glext_funcs.h"\
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\ogl.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\lib\tex.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\TextureEntry.h"\
|
||||||
|
".\TextureManager.h"\
|
||||||
|
{$(INCLUDE)}"GL\glext.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\ToolManager.cpp : \
|
||||||
|
".\Tool.h"\
|
||||||
|
".\ToolManager.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\UnitManager.cpp : \
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\Unit.h"\
|
||||||
|
".\UnitManager.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\HFTracer.cpp : \
|
||||||
|
"..\lib\res.h"\
|
||||||
|
"..\Terrain\Bound.h"\
|
||||||
|
"..\Terrain\Camera.h"\
|
||||||
|
"..\Terrain\Frustum.h"\
|
||||||
|
"..\Terrain\MathUtil.h"\
|
||||||
|
"..\Terrain\Matrix3D.h"\
|
||||||
|
"..\Terrain\MiniPatch.h"\
|
||||||
|
"..\Terrain\Patch.h"\
|
||||||
|
"..\Terrain\Plane.h"\
|
||||||
|
"..\Terrain\RenderableObject.h"\
|
||||||
|
"..\Terrain\Terrain.h"\
|
||||||
|
"..\Terrain\TerrGlobals.h"\
|
||||||
|
"..\Terrain\Triangle.h"\
|
||||||
|
"..\Terrain\Vector3D.h"\
|
||||||
|
"..\Terrain\Vector4D.h"\
|
||||||
|
".\HFTracer.h"\
|
||||||
|
|
||||||
|
|
||||||
|
.\StdAfx.cpp : \
|
||||||
|
"..\lib\misc.h"\
|
||||||
|
"..\lib\posix.h"\
|
||||||
|
"..\lib\posix\aio.h"\
|
||||||
|
"..\ps\CStr.h"\
|
||||||
|
"..\ps\Prometheus.h"\
|
||||||
|
".\StdAfx.h"\
|
||||||
|
{$(INCLUDE)}"unistd.h"\
|
||||||
|
|
1404
source/sced/ScEd.dsp
Executable file
1404
source/sced/ScEd.dsp
Executable file
File diff suppressed because it is too large
Load Diff
50
source/sced/ScEd.h
Executable file
50
source/sced/ScEd.h
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
// ScEd.h : main header file for the SCED application
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_SCED_H__7CE13472_02D4_450E_8F31_B08FBE733ED6__INCLUDED_)
|
||||||
|
#define AFX_SCED_H__7CE13472_02D4_450E_8F31_B08FBE733ED6__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error include 'stdafx.h' before including this file for PCH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // main symbols
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdApp:
|
||||||
|
// See ScEd.cpp for the implementation of this class
|
||||||
|
//
|
||||||
|
|
||||||
|
class CScEdApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CScEdApp();
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CScEdApp)
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
virtual int Run();
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
//{{AFX_MSG(CScEdApp)
|
||||||
|
afx_msg void OnAppAbout();
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_SCED_H__7CE13472_02D4_450E_8F31_B08FBE733ED6__INCLUDED_)
|
621
source/sced/ScEd.mak
Executable file
621
source/sced/ScEd.mak
Executable file
@ -0,0 +1,621 @@
|
|||||||
|
# Microsoft Developer Studio Generated NMAKE File, Based on ScEd.dsp
|
||||||
|
!IF "$(CFG)" == ""
|
||||||
|
CFG=ScEd - Win32 Debug
|
||||||
|
!MESSAGE No configuration specified. Defaulting to ScEd - Win32 Debug.
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(CFG)" != "ScEd - Win32 Release" && "$(CFG)" != "ScEd - Win32 Debug"
|
||||||
|
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "ScEd.mak" CFG="ScEd - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "ScEd - Win32 Release" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE "ScEd - Win32 Debug" (based on "Win32 (x86) Application")
|
||||||
|
!MESSAGE
|
||||||
|
!ERROR An invalid configuration is specified.
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(OS)" == "Windows_NT"
|
||||||
|
NULL=
|
||||||
|
!ELSE
|
||||||
|
NULL=nul
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "ScEd - Win32 Release"
|
||||||
|
|
||||||
|
OUTDIR=.\Release
|
||||||
|
INTDIR=.\Release
|
||||||
|
# Begin Custom Macros
|
||||||
|
OutDir=.\Release
|
||||||
|
# End Custom Macros
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "0"
|
||||||
|
|
||||||
|
ALL : "..\..\binaries\ScEd.exe" "$(OUTDIR)\ScEd.pch"
|
||||||
|
|
||||||
|
!ELSE
|
||||||
|
|
||||||
|
ALL : "pslib - Win32 Release" "..\..\binaries\ScEd.exe" "$(OUTDIR)\ScEd.pch"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "1"
|
||||||
|
CLEAN :"pslib - Win32 ReleaseCLEAN"
|
||||||
|
!ELSE
|
||||||
|
CLEAN :
|
||||||
|
!ENDIF
|
||||||
|
-@erase "$(INTDIR)\AlterElevationCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\BrushTool.obj"
|
||||||
|
-@erase "$(INTDIR)\ColorButton.obj"
|
||||||
|
-@erase "$(INTDIR)\CommandManager.obj"
|
||||||
|
-@erase "$(INTDIR)\DirectionButton.obj"
|
||||||
|
-@erase "$(INTDIR)\EditorData.obj"
|
||||||
|
-@erase "$(INTDIR)\ElevationButton.obj"
|
||||||
|
-@erase "$(INTDIR)\ElevToolsDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\HFTracer.obj"
|
||||||
|
-@erase "$(INTDIR)\ImageListCtrl.obj"
|
||||||
|
-@erase "$(INTDIR)\InfoBox.obj"
|
||||||
|
-@erase "$(INTDIR)\LightSettingsDlg.obj"
|
||||||
|
-@erase "$(INTDIR)\MainFrm.obj"
|
||||||
|
-@erase "$(INTDIR)\MapSizeDlg.obj"
|
||||||
|
-@erase "$(INTDIR)\MiniMap.obj"
|
||||||
|
-@erase "$(INTDIR)\ObjectEntry.obj"
|
||||||
|
-@erase "$(INTDIR)\ObjectManager.obj"
|
||||||
|
-@erase "$(INTDIR)\OptionsDlg.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintObjectCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintObjectTool.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintTextureCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintTextureTool.obj"
|
||||||
|
-@erase "$(INTDIR)\RaiseElevationCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\RaiseElevationTool.obj"
|
||||||
|
-@erase "$(INTDIR)\ScEd.obj"
|
||||||
|
-@erase "$(INTDIR)\ScEd.pch"
|
||||||
|
-@erase "$(INTDIR)\ScEd.res"
|
||||||
|
-@erase "$(INTDIR)\ScEdDoc.obj"
|
||||||
|
-@erase "$(INTDIR)\ScEdView.obj"
|
||||||
|
-@erase "$(INTDIR)\SimpleEdit.obj"
|
||||||
|
-@erase "$(INTDIR)\SMDConverter.obj"
|
||||||
|
-@erase "$(INTDIR)\SmoothElevationCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\SmoothElevationTool.obj"
|
||||||
|
-@erase "$(INTDIR)\StdAfx.obj"
|
||||||
|
-@erase "$(INTDIR)\TexToolsDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\TextureManager.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolManager.obj"
|
||||||
|
-@erase "$(INTDIR)\UIGlobals.obj"
|
||||||
|
-@erase "$(INTDIR)\UnitManager.obj"
|
||||||
|
-@erase "$(INTDIR)\UnitPropertiesDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\UnitToolsDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\vc60.idb"
|
||||||
|
-@erase "$(INTDIR)\vc60.pdb"
|
||||||
|
-@erase "$(INTDIR)\WebLinkButton.obj"
|
||||||
|
-@erase "$(OUTDIR)\ScEd.pdb"
|
||||||
|
-@erase "..\..\binaries\ScEd.exe"
|
||||||
|
|
||||||
|
"$(OUTDIR)" :
|
||||||
|
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||||
|
|
||||||
|
CPP=cl.exe
|
||||||
|
CPP_PROJ=/nologo /G5 /MT /W3 /GX /Zi /O2 /Ob0 /I "..\\" /I "..\lib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||||
|
|
||||||
|
.c{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.c{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
MTL=midl.exe
|
||||||
|
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
RSC=rc.exe
|
||||||
|
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ScEd.res" /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ScEd.bsc"
|
||||||
|
BSC32_SBRS= \
|
||||||
|
|
||||||
|
LINK32=link.exe
|
||||||
|
LINK32_FLAGS=nafxcw.lib pslib.lib opengl32.lib glu32.lib ws2_32.lib version.lib xerces-c_2.lib /nologo /entry:"entry" /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\ScEd.pdb" /debug /machine:I386 /out:"D:\0ad\binaries\ScEd.exe" /libpath:"..\libs" /fixed:no
|
||||||
|
LINK32_OBJS= \
|
||||||
|
"$(INTDIR)\ColorButton.obj" \
|
||||||
|
"$(INTDIR)\DirectionButton.obj" \
|
||||||
|
"$(INTDIR)\ElevationButton.obj" \
|
||||||
|
"$(INTDIR)\ElevToolsDlgBar.obj" \
|
||||||
|
"$(INTDIR)\ImageListCtrl.obj" \
|
||||||
|
"$(INTDIR)\LightSettingsDlg.obj" \
|
||||||
|
"$(INTDIR)\MainFrm.obj" \
|
||||||
|
"$(INTDIR)\MapSizeDlg.obj" \
|
||||||
|
"$(INTDIR)\OptionsDlg.obj" \
|
||||||
|
"$(INTDIR)\ScEd.obj" \
|
||||||
|
"$(INTDIR)\ScEdDoc.obj" \
|
||||||
|
"$(INTDIR)\ScEdView.obj" \
|
||||||
|
"$(INTDIR)\SimpleEdit.obj" \
|
||||||
|
"$(INTDIR)\TexToolsDlgBar.obj" \
|
||||||
|
"$(INTDIR)\UIGlobals.obj" \
|
||||||
|
"$(INTDIR)\UnitPropertiesDlgBar.obj" \
|
||||||
|
"$(INTDIR)\UnitToolsDlgBar.obj" \
|
||||||
|
"$(INTDIR)\WebLinkButton.obj" \
|
||||||
|
"$(INTDIR)\AlterElevationCommand.obj" \
|
||||||
|
"$(INTDIR)\PaintObjectCommand.obj" \
|
||||||
|
"$(INTDIR)\PaintTextureCommand.obj" \
|
||||||
|
"$(INTDIR)\RaiseElevationCommand.obj" \
|
||||||
|
"$(INTDIR)\SmoothElevationCommand.obj" \
|
||||||
|
"$(INTDIR)\BrushTool.obj" \
|
||||||
|
"$(INTDIR)\PaintObjectTool.obj" \
|
||||||
|
"$(INTDIR)\PaintTextureTool.obj" \
|
||||||
|
"$(INTDIR)\RaiseElevationTool.obj" \
|
||||||
|
"$(INTDIR)\SmoothElevationTool.obj" \
|
||||||
|
"$(INTDIR)\CommandManager.obj" \
|
||||||
|
"$(INTDIR)\EditorData.obj" \
|
||||||
|
"$(INTDIR)\InfoBox.obj" \
|
||||||
|
"$(INTDIR)\MiniMap.obj" \
|
||||||
|
"$(INTDIR)\ObjectEntry.obj" \
|
||||||
|
"$(INTDIR)\ObjectManager.obj" \
|
||||||
|
"$(INTDIR)\SMDConverter.obj" \
|
||||||
|
"$(INTDIR)\TextureManager.obj" \
|
||||||
|
"$(INTDIR)\ToolManager.obj" \
|
||||||
|
"$(INTDIR)\UnitManager.obj" \
|
||||||
|
"$(INTDIR)\HFTracer.obj" \
|
||||||
|
"$(INTDIR)\StdAfx.obj" \
|
||||||
|
"$(INTDIR)\ScEd.res"
|
||||||
|
|
||||||
|
"..\..\binaries\ScEd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||||
|
$(LINK32) @<<
|
||||||
|
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "ScEd - Win32 Debug"
|
||||||
|
|
||||||
|
OUTDIR=.\Debug
|
||||||
|
INTDIR=.\Debug
|
||||||
|
# Begin Custom Macros
|
||||||
|
OutDir=.\Debug
|
||||||
|
# End Custom Macros
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "0"
|
||||||
|
|
||||||
|
ALL : "..\..\binaries\ScEd_d.exe" "$(OUTDIR)\ScEd.pch"
|
||||||
|
|
||||||
|
!ELSE
|
||||||
|
|
||||||
|
ALL : "pslib - Win32 Debug" "..\..\binaries\ScEd_d.exe" "$(OUTDIR)\ScEd.pch"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
!IF "$(RECURSE)" == "1"
|
||||||
|
CLEAN :"pslib - Win32 DebugCLEAN"
|
||||||
|
!ELSE
|
||||||
|
CLEAN :
|
||||||
|
!ENDIF
|
||||||
|
-@erase "$(INTDIR)\AlterElevationCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\BrushTool.obj"
|
||||||
|
-@erase "$(INTDIR)\ColorButton.obj"
|
||||||
|
-@erase "$(INTDIR)\CommandManager.obj"
|
||||||
|
-@erase "$(INTDIR)\DirectionButton.obj"
|
||||||
|
-@erase "$(INTDIR)\EditorData.obj"
|
||||||
|
-@erase "$(INTDIR)\ElevationButton.obj"
|
||||||
|
-@erase "$(INTDIR)\ElevToolsDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\HFTracer.obj"
|
||||||
|
-@erase "$(INTDIR)\ImageListCtrl.obj"
|
||||||
|
-@erase "$(INTDIR)\InfoBox.obj"
|
||||||
|
-@erase "$(INTDIR)\LightSettingsDlg.obj"
|
||||||
|
-@erase "$(INTDIR)\MainFrm.obj"
|
||||||
|
-@erase "$(INTDIR)\MapSizeDlg.obj"
|
||||||
|
-@erase "$(INTDIR)\MiniMap.obj"
|
||||||
|
-@erase "$(INTDIR)\ObjectEntry.obj"
|
||||||
|
-@erase "$(INTDIR)\ObjectManager.obj"
|
||||||
|
-@erase "$(INTDIR)\OptionsDlg.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintObjectCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintObjectTool.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintTextureCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\PaintTextureTool.obj"
|
||||||
|
-@erase "$(INTDIR)\RaiseElevationCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\RaiseElevationTool.obj"
|
||||||
|
-@erase "$(INTDIR)\ScEd.obj"
|
||||||
|
-@erase "$(INTDIR)\ScEd.pch"
|
||||||
|
-@erase "$(INTDIR)\ScEd.res"
|
||||||
|
-@erase "$(INTDIR)\ScEdDoc.obj"
|
||||||
|
-@erase "$(INTDIR)\ScEdView.obj"
|
||||||
|
-@erase "$(INTDIR)\SimpleEdit.obj"
|
||||||
|
-@erase "$(INTDIR)\SMDConverter.obj"
|
||||||
|
-@erase "$(INTDIR)\SmoothElevationCommand.obj"
|
||||||
|
-@erase "$(INTDIR)\SmoothElevationTool.obj"
|
||||||
|
-@erase "$(INTDIR)\StdAfx.obj"
|
||||||
|
-@erase "$(INTDIR)\TexToolsDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\TextureManager.obj"
|
||||||
|
-@erase "$(INTDIR)\ToolManager.obj"
|
||||||
|
-@erase "$(INTDIR)\UIGlobals.obj"
|
||||||
|
-@erase "$(INTDIR)\UnitManager.obj"
|
||||||
|
-@erase "$(INTDIR)\UnitPropertiesDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\UnitToolsDlgBar.obj"
|
||||||
|
-@erase "$(INTDIR)\vc60.idb"
|
||||||
|
-@erase "$(INTDIR)\vc60.pdb"
|
||||||
|
-@erase "$(INTDIR)\WebLinkButton.obj"
|
||||||
|
-@erase "$(OUTDIR)\ScEd_d.pdb"
|
||||||
|
-@erase "..\..\binaries\ScEd_d.exe"
|
||||||
|
-@erase "..\..\binaries\ScEd_d.ilk"
|
||||||
|
|
||||||
|
"$(OUTDIR)" :
|
||||||
|
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||||
|
|
||||||
|
CPP=cl.exe
|
||||||
|
CPP_PROJ=/nologo /G6 /MTd /W3 /Gm /Gi /GX /ZI /Od /I "..\\" /I "..\lib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
|
||||||
|
|
||||||
|
.c{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(INTDIR)}.obj::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.c{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cpp{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
.cxx{$(INTDIR)}.sbr::
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_PROJ) $<
|
||||||
|
<<
|
||||||
|
|
||||||
|
MTL=midl.exe
|
||||||
|
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
RSC=rc.exe
|
||||||
|
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ScEd.res" /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ScEd.bsc"
|
||||||
|
BSC32_SBRS= \
|
||||||
|
|
||||||
|
LINK32=link.exe
|
||||||
|
LINK32_FLAGS=nafxcwd.lib pslib_d.lib opengl32.lib glu32.lib ws2_32.lib version.lib xerces-c_2D.lib /nologo /entry:"entry" /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\ScEd_d.pdb" /debug /machine:I386 /out:"D:\0ad\binaries\ScEd_d.exe" /pdbtype:sept /libpath:"..\libs"
|
||||||
|
LINK32_OBJS= \
|
||||||
|
"$(INTDIR)\ColorButton.obj" \
|
||||||
|
"$(INTDIR)\DirectionButton.obj" \
|
||||||
|
"$(INTDIR)\ElevationButton.obj" \
|
||||||
|
"$(INTDIR)\ElevToolsDlgBar.obj" \
|
||||||
|
"$(INTDIR)\ImageListCtrl.obj" \
|
||||||
|
"$(INTDIR)\LightSettingsDlg.obj" \
|
||||||
|
"$(INTDIR)\MainFrm.obj" \
|
||||||
|
"$(INTDIR)\MapSizeDlg.obj" \
|
||||||
|
"$(INTDIR)\OptionsDlg.obj" \
|
||||||
|
"$(INTDIR)\ScEd.obj" \
|
||||||
|
"$(INTDIR)\ScEdDoc.obj" \
|
||||||
|
"$(INTDIR)\ScEdView.obj" \
|
||||||
|
"$(INTDIR)\SimpleEdit.obj" \
|
||||||
|
"$(INTDIR)\TexToolsDlgBar.obj" \
|
||||||
|
"$(INTDIR)\UIGlobals.obj" \
|
||||||
|
"$(INTDIR)\UnitPropertiesDlgBar.obj" \
|
||||||
|
"$(INTDIR)\UnitToolsDlgBar.obj" \
|
||||||
|
"$(INTDIR)\WebLinkButton.obj" \
|
||||||
|
"$(INTDIR)\AlterElevationCommand.obj" \
|
||||||
|
"$(INTDIR)\PaintObjectCommand.obj" \
|
||||||
|
"$(INTDIR)\PaintTextureCommand.obj" \
|
||||||
|
"$(INTDIR)\RaiseElevationCommand.obj" \
|
||||||
|
"$(INTDIR)\SmoothElevationCommand.obj" \
|
||||||
|
"$(INTDIR)\BrushTool.obj" \
|
||||||
|
"$(INTDIR)\PaintObjectTool.obj" \
|
||||||
|
"$(INTDIR)\PaintTextureTool.obj" \
|
||||||
|
"$(INTDIR)\RaiseElevationTool.obj" \
|
||||||
|
"$(INTDIR)\SmoothElevationTool.obj" \
|
||||||
|
"$(INTDIR)\CommandManager.obj" \
|
||||||
|
"$(INTDIR)\EditorData.obj" \
|
||||||
|
"$(INTDIR)\InfoBox.obj" \
|
||||||
|
"$(INTDIR)\MiniMap.obj" \
|
||||||
|
"$(INTDIR)\ObjectEntry.obj" \
|
||||||
|
"$(INTDIR)\ObjectManager.obj" \
|
||||||
|
"$(INTDIR)\SMDConverter.obj" \
|
||||||
|
"$(INTDIR)\TextureManager.obj" \
|
||||||
|
"$(INTDIR)\ToolManager.obj" \
|
||||||
|
"$(INTDIR)\UnitManager.obj" \
|
||||||
|
"$(INTDIR)\HFTracer.obj" \
|
||||||
|
"$(INTDIR)\StdAfx.obj" \
|
||||||
|
"$(INTDIR)\ScEd.res"
|
||||||
|
|
||||||
|
"..\..\binaries\ScEd_d.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||||
|
$(LINK32) @<<
|
||||||
|
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||||
|
!IF EXISTS("ScEd.dep")
|
||||||
|
!INCLUDE "ScEd.dep"
|
||||||
|
!ELSE
|
||||||
|
!MESSAGE Warning: cannot find "ScEd.dep"
|
||||||
|
!ENDIF
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "ScEd - Win32 Release" || "$(CFG)" == "ScEd - Win32 Debug"
|
||||||
|
SOURCE=.\ColorButton.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ColorButton.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\DirectionButton.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\DirectionButton.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ElevationButton.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ElevationButton.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ElevToolsDlgBar.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ElevToolsDlgBar.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ImageListCtrl.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ImageListCtrl.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\LightSettingsDlg.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\LightSettingsDlg.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MainFrm.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\MainFrm.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MapSizeDlg.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\MapSizeDlg.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\OptionsDlg.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ScEd.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ScEd.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ScEd.rc
|
||||||
|
|
||||||
|
"$(INTDIR)\ScEd.res" : $(SOURCE) "$(INTDIR)"
|
||||||
|
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ScEdDoc.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ScEdDoc.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ScEdView.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ScEdView.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\SimpleEdit.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\SimpleEdit.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\TexToolsDlgBar.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\TexToolsDlgBar.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\UIGlobals.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\UIGlobals.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\UnitPropertiesDlgBar.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\UnitPropertiesDlgBar.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\UnitToolsDlgBar.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\UnitToolsDlgBar.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\WebLinkButton.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\WebLinkButton.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\AlterElevationCommand.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\AlterElevationCommand.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\PaintObjectCommand.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\PaintObjectCommand.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\PaintTextureCommand.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\PaintTextureCommand.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\RaiseElevationCommand.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\RaiseElevationCommand.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\SmoothElevationCommand.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\SmoothElevationCommand.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\BrushTool.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\BrushTool.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\PaintObjectTool.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\PaintObjectTool.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\PaintTextureTool.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\PaintTextureTool.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\RaiseElevationTool.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\RaiseElevationTool.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\SmoothElevationTool.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\SmoothElevationTool.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\CommandManager.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\CommandManager.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\EditorData.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\EditorData.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\InfoBox.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\InfoBox.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\MiniMap.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\MiniMap.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ObjectEntry.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ObjectEntry.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ObjectManager.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ObjectManager.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\SMDConverter.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\SMDConverter.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\TextureManager.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\TextureManager.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\ToolManager.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\ToolManager.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\UnitManager.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\UnitManager.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE=.\HFTracer.cpp
|
||||||
|
|
||||||
|
"$(INTDIR)\HFTracer.obj" : $(SOURCE) "$(INTDIR)"
|
||||||
|
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "ScEd - Win32 Release"
|
||||||
|
|
||||||
|
"pslib - Win32 Release" :
|
||||||
|
cd "\0ad\fw\pslib"
|
||||||
|
NMAKE /f pslib.mak
|
||||||
|
cd "..\ScEd"
|
||||||
|
|
||||||
|
"pslib - Win32 ReleaseCLEAN" :
|
||||||
|
cd "\0ad\fw\pslib"
|
||||||
|
cd "..\ScEd"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "ScEd - Win32 Debug"
|
||||||
|
|
||||||
|
"pslib - Win32 Debug" :
|
||||||
|
cd "\0ad\fw\pslib"
|
||||||
|
NMAKE /f pslib.mak
|
||||||
|
cd "..\ScEd"
|
||||||
|
|
||||||
|
"pslib - Win32 DebugCLEAN" :
|
||||||
|
cd "\0ad\fw\pslib"
|
||||||
|
cd "..\ScEd"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
SOURCE=.\StdAfx.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "ScEd - Win32 Release"
|
||||||
|
|
||||||
|
CPP_SWITCHES=/nologo /G5 /MT /W3 /GX /Zi /O2 /Ob0 /I "..\\" /I "..\lib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\ScEd.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||||
|
|
||||||
|
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\ScEd.pch" : $(SOURCE) "$(INTDIR)"
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_SWITCHES) $(SOURCE)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "ScEd - Win32 Debug"
|
||||||
|
|
||||||
|
CPP_SWITCHES=/nologo /G6 /MTd /W3 /Gm /Gi /GX /ZI /Od /I "..\\" /I "..\lib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\ScEd.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
|
||||||
|
|
||||||
|
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\ScEd.pch" : $(SOURCE) "$(INTDIR)"
|
||||||
|
$(CPP) @<<
|
||||||
|
$(CPP_SWITCHES) $(SOURCE)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
749
source/sced/ScEd.rc
Executable file
749
source/sced/ScEd.rc
Executable file
@ -0,0 +1,749 @@
|
|||||||
|
//Microsoft Developer Studio generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (U.S.) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||||
|
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||||
|
"#ifdef _WIN32\r\n"
|
||||||
|
"LANGUAGE 9, 1\r\n"
|
||||||
|
"#pragma code_page(1252)\r\n"
|
||||||
|
"#endif //_WIN32\r\n"
|
||||||
|
"#include ""res\\ScEd.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||||
|
"#include ""afxres.rc"" // Standard components\r\n"
|
||||||
|
"#endif\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Icon
|
||||||
|
//
|
||||||
|
|
||||||
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
|
// remains consistent on all systems.
|
||||||
|
IDR_MAINFRAME ICON DISCARDABLE "res\\ScEd.ico"
|
||||||
|
IDR_SCEDTYPE ICON DISCARDABLE "res\\ScEdDoc.ico"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Bitmap
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
|
||||||
|
IDB_LOGO BITMAP DISCARDABLE "res\\0ad_logo.bmp"
|
||||||
|
IDB_BITMAP_SELECT BITMAP DISCARDABLE "res\\select.bmp"
|
||||||
|
IDB_BITMAP_TEXTURETOOLS BITMAP DISCARDABLE "res\\terraintools.bmp"
|
||||||
|
IDB_BITMAP_ELEVATIONTOOLS BITMAP DISCARDABLE "res\\elevationtools.bmp"
|
||||||
|
IDB_BITMAP_MODELTOOLS BITMAP DISCARDABLE "res\\modeltools.bmp"
|
||||||
|
IDB_BITMAP_SELECTUNIT BITMAP DISCARDABLE "res\\selectunit.bmp"
|
||||||
|
IDB_BITMAP_ADDUNIT BITMAP DISCARDABLE "res\\addunit.bmp"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Toolbar
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
|
||||||
|
BEGIN
|
||||||
|
BUTTON ID_FILE_NEW
|
||||||
|
BUTTON ID_FILE_OPEN
|
||||||
|
BUTTON ID_FILE_SAVE
|
||||||
|
SEPARATOR
|
||||||
|
BUTTON ID_EDIT_CUT
|
||||||
|
BUTTON ID_EDIT_COPY
|
||||||
|
BUTTON ID_EDIT_PASTE
|
||||||
|
SEPARATOR
|
||||||
|
BUTTON ID_FILE_PRINT
|
||||||
|
SEPARATOR
|
||||||
|
BUTTON ID_APP_ABOUT
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Menu
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
POPUP "&File"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Load Map", ID_FILE_LOADMAP
|
||||||
|
MENUITEM "&Save Map", ID_FILE_SAVEMAP
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "E&xit", ID_APP_EXIT
|
||||||
|
END
|
||||||
|
POPUP "&Test"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Go", ID_TEST_GO
|
||||||
|
MENUITEM "&Stop", ID_TEST_STOP
|
||||||
|
END
|
||||||
|
POPUP "&Edit"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Undo Ctrl+Z", ID_EDIT_UNDO
|
||||||
|
MENUITEM "&Redo Ctrl+Y", ID_EDIT_REDO
|
||||||
|
END
|
||||||
|
POPUP "&View"
|
||||||
|
BEGIN
|
||||||
|
POPUP "&Terrain Style"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Normal", ID_VIEW_TERRAIN_SOLID
|
||||||
|
, CHECKED
|
||||||
|
MENUITEM "&Grid", ID_VIEW_TERRAIN_GRID
|
||||||
|
, CHECKED
|
||||||
|
MENUITEM "&Wireframe", ID_VIEW_TERRAIN_WIREFRAME
|
||||||
|
, CHECKED
|
||||||
|
END
|
||||||
|
POPUP "&Model Style"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Normal", ID_VIEW_MODEL_SOLID
|
||||||
|
, CHECKED
|
||||||
|
MENUITEM "&Edged Faces", ID_VIEW_MODEL_GRID
|
||||||
|
, CHECKED
|
||||||
|
MENUITEM "&Wireframe", ID_VIEW_MODEL_WIREFRAME
|
||||||
|
, CHECKED
|
||||||
|
END
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "&Render Stats F1", ID_VIEW_RENDERSTATS
|
||||||
|
MENUITEM "&Screenshot F9", ID_VIEW_SCREENSHOT
|
||||||
|
END
|
||||||
|
POPUP "&Map"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Texture Tools", IDR_TEXTURE_TOOLS
|
||||||
|
MENUITEM "&Elevation Tools", IDR_ELEVATION_TOOLS
|
||||||
|
MENUITEM "&Unit Tools", IDR_UNIT_TOOLS
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "&Lighting Settings", ID_LIGHTING_SETTINGS
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "L&oad Terrain", ID_TERRAIN_LOAD
|
||||||
|
MENUITEM "&Resize Terrain", IDR_RESIZE_MAP
|
||||||
|
END
|
||||||
|
POPUP "&Tools"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&Options", ID_TOOLS_OPTIONS
|
||||||
|
END
|
||||||
|
POPUP "&Help"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "&About ScEd...", ID_APP_ABOUT
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Accelerator
|
||||||
|
//
|
||||||
|
|
||||||
|
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
|
||||||
|
BEGIN
|
||||||
|
"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
|
||||||
|
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
|
||||||
|
VK_F1, ID_VIEW_RENDERSTATS, VIRTKEY, NOINVERT
|
||||||
|
VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
|
||||||
|
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
|
||||||
|
VK_F9, ID_VIEW_SCREENSHOT, VIRTKEY, NOINVERT
|
||||||
|
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
|
||||||
|
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"Y", ID_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Dialog
|
||||||
|
//
|
||||||
|
|
||||||
|
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 268, 153
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "About ScEd"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
CONTROL 135,IDC_STATIC,"Static",SS_BITMAP,31,21,205,62
|
||||||
|
LTEXT "Version: 0.0.0.0",IDC_STATIC_VERSION,7,138,56,8,
|
||||||
|
SS_NOPREFIX
|
||||||
|
LTEXT "Wildfire Games, 2003",IDC_STATIC,98,97,71,8
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,211,132,50,14,WS_GROUP
|
||||||
|
CONTROL "www.wildfiregames.com",IDC_BUTTON_LAUNCHWFG,"Button",
|
||||||
|
BS_OWNERDRAW | BS_FLAT | WS_TABSTOP,84,110,98,17
|
||||||
|
END
|
||||||
|
|
||||||
|
IDR_MAINFRAME DIALOG DISCARDABLE 0, 0, 224, 18
|
||||||
|
STYLE WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
PUSHBUTTON "",IDC_BUTTON_SELECT,3,0,18,18,BS_BITMAP
|
||||||
|
PUSHBUTTON "",IDC_BUTTON_ELEVATIONTOOLS,43,0,18,18,BS_BITMAP
|
||||||
|
PUSHBUTTON "",IDC_BUTTON_TEXTURETOOLS,23,0,18,18,BS_BITMAP
|
||||||
|
PUSHBUTTON "",IDC_BUTTON_MODELTOOLS,63,0,18,18,BS_BITMAP | NOT
|
||||||
|
WS_TABSTOP
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_LIGHTSETTINGS DIALOG DISCARDABLE 0, 0, 186, 263
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Lighting Settings"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,7,243,50,14
|
||||||
|
PUSHBUTTON "Preview",IDC_BUTTON_APPLY,68,243,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,129,243,50,14
|
||||||
|
LTEXT "Color",IDC_STATIC,55,133,57,8
|
||||||
|
LTEXT "Direction",IDC_STATIC,83,25,42,8
|
||||||
|
LTEXT "Terrain",IDC_STATIC,55,185,71,8
|
||||||
|
CONTROL "",IDC_BUTTON_SUNCOLOR,"Button",BS_OWNERDRAW | BS_FLAT,
|
||||||
|
18,129,27,14
|
||||||
|
CONTROL "",IDC_BUTTON_TERRAINAMBIENTCOLOR,"Button",BS_OWNERDRAW |
|
||||||
|
BS_FLAT,18,183,27,14
|
||||||
|
GROUPBOX "Ambient Light",IDC_STATIC,7,169,172,62
|
||||||
|
GROUPBOX "Directional Light",IDC_STATIC,7,7,172,147
|
||||||
|
LTEXT "Elevation",IDC_STATIC,84,81,40,8
|
||||||
|
CONTROL "",IDC_BUTTON_DIRECTION,"Button",BS_OWNERDRAW | BS_FLAT,
|
||||||
|
18,19,56,48
|
||||||
|
CONTROL "",IDC_BUTTON_ELEVATION,"Button",BS_OWNERDRAW | BS_FLAT,
|
||||||
|
18,73,56,32
|
||||||
|
EDITTEXT IDC_EDIT_DIRECTION,83,41,31,14,ES_AUTOHSCROLL |
|
||||||
|
ES_NUMBER | NOT WS_TABSTOP
|
||||||
|
CONTROL "Spin1",IDC_SPIN_DIRECTION,"msctls_updown32",UDS_WRAP |
|
||||||
|
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
|
||||||
|
UDS_ARROWKEYS | UDS_NOTHOUSANDS,115,41,11,14
|
||||||
|
LTEXT "Units and Buildings",IDC_STATIC,55,209,71,8
|
||||||
|
CONTROL "",IDC_BUTTON_UNITSAMBIENTCOLOR,"Button",BS_OWNERDRAW |
|
||||||
|
BS_FLAT,18,207,27,14
|
||||||
|
EDITTEXT IDC_EDIT_ELEVATION,83,95,31,14,ES_AUTOHSCROLL |
|
||||||
|
ES_NUMBER | NOT WS_TABSTOP
|
||||||
|
CONTROL "Spin1",IDC_SPIN_ELEVATION,"msctls_updown32",
|
||||||
|
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
|
||||||
|
UDS_ARROWKEYS | UDS_NOTHOUSANDS,115,95,11,14
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_TEXTURETOOLS DIALOG DISCARDABLE 0, 0, 75, 374
|
||||||
|
STYLE DS_3DLOOK | WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
CONTROL "Slider1",IDC_SLIDER_BRUSHSIZE,"msctls_trackbar32",
|
||||||
|
TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,9,23,57,14
|
||||||
|
LTEXT "Brush Size",IDC_STATIC,13,14,39,8
|
||||||
|
CONTROL "List1",IDC_LIST_TEXTUREBROWSER,"SysListView32",
|
||||||
|
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
|
||||||
|
LVS_NOSORTHEADER | WS_TABSTOP,7,94,61,273
|
||||||
|
CONTROL "",IDC_STATIC_CURRENTTEXTURE,"Static",SS_BITMAP |
|
||||||
|
SS_CENTERIMAGE | WS_BORDER,24,45,24,24
|
||||||
|
COMBOBOX IDC_COMBO_TERRAINTYPES,7,79,61,58,CBS_DROPDOWN |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
GROUPBOX "",IDC_STATIC,7,7,61,69
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_UNITTOOLS DIALOG DISCARDABLE 0, 0, 95, 330
|
||||||
|
STYLE DS_3DLOOK | WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
CONTROL "List1",IDC_LIST_OBJECTBROWSER,"SysListView32",
|
||||||
|
LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS |
|
||||||
|
LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_TABSTOP,7,74,
|
||||||
|
81,246
|
||||||
|
PUSHBUTTON "New",IDC_BUTTON_ADD,7,44,81,14
|
||||||
|
PUSHBUTTON "Edit",IDC_BUTTON_EDIT,7,58,81,14
|
||||||
|
COMBOBOX IDC_COMBO_OBJECTTYPES,7,28,81,58,CBS_DROPDOWN |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
PUSHBUTTON "",IDC_BUTTON_SELECT,7,7,18,18,BS_BITMAP
|
||||||
|
PUSHBUTTON "",IDC_BUTTON_ADDUNIT,27,7,18,18,BS_BITMAP
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_OPTIONS DIALOG DISCARDABLE 0, 0, 186, 138
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Options"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,35,117,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,101,117,50,14
|
||||||
|
GROUPBOX "Scroll Speed",IDC_STATIC,7,13,172,53
|
||||||
|
CONTROL "Slider1",IDC_SLIDER_RTSSCROLLSPEED,"msctls_trackbar32",
|
||||||
|
TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,14,36,158,15
|
||||||
|
LTEXT "10",IDC_STATIC,159,25,9,8
|
||||||
|
LTEXT "0",IDC_STATIC,20,26,8,8
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_ELEVATIONTOOLS DIALOG DISCARDABLE 0, 0, 75, 330
|
||||||
|
STYLE DS_3DLOOK | WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
CONTROL "Slider1",IDC_SLIDER_BRUSHSIZE,"msctls_trackbar32",
|
||||||
|
TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,7,18,61,15
|
||||||
|
LTEXT "Brush Size",IDC_STATIC,7,7,61,8
|
||||||
|
CONTROL "Slider1",IDC_SLIDER_BRUSHEFFECT,"msctls_trackbar32",
|
||||||
|
TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,7,112,61,15
|
||||||
|
LTEXT "Brush Effect",IDC_STATIC,7,101,61,8
|
||||||
|
GROUPBOX "Use",IDC_STATIC,7,44,61,48
|
||||||
|
CONTROL "Raise/Lower",IDC_RADIO_RAISE,"Button",
|
||||||
|
BS_AUTORADIOBUTTON,10,56,54,10
|
||||||
|
CONTROL "Smooth",IDC_RADIO_SMOOTH,"Button",BS_AUTORADIOBUTTON,10,
|
||||||
|
73,54,10
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_UNITPROPERTIES DIALOG DISCARDABLE 0, 0, 137, 327
|
||||||
|
STYLE DS_3DLOOK | WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
LTEXT "Unit",IDC_STATIC,23,25,18,8
|
||||||
|
LTEXT "Model",IDC_STATIC,21,37,20,8
|
||||||
|
EDITTEXT IDC_EDIT_NAME,43,23,71,12,ES_AUTOHSCROLL
|
||||||
|
EDITTEXT IDC_EDIT_MODEL,43,35,71,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_BUTTON_MODELBROWSE,118,37,12,10
|
||||||
|
PUSHBUTTON "Refresh",IDC_BUTTON_REFRESH,80,7,50,14
|
||||||
|
PUSHBUTTON "<<",IDC_BUTTON_BACK,4,7,16,14
|
||||||
|
LTEXT "Animation",IDC_STATIC,9,63,32,8
|
||||||
|
EDITTEXT IDC_EDIT_ANIMATION,43,62,71,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_BUTTON_ANIMATIONBROWSE,118,63,12,10
|
||||||
|
LTEXT "Texture",IDC_STATIC,15,52,25,8
|
||||||
|
EDITTEXT IDC_EDIT_TEXTURE,43,49,71,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_BUTTON_TEXTUREBROWSE,118,50,12,10
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_SIMPLEEDIT DIALOG DISCARDABLE 0, 0, 186, 47
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Dialog"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,35,26,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,101,26,50,14
|
||||||
|
EDITTEXT IDC_EDIT1,7,8,172,14,ES_AUTOHSCROLL
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_MAPSIZE DIALOG DISCARDABLE 0, 0, 138, 106
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Select Map Size"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,13,85,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,75,85,50,14
|
||||||
|
CONTROL "Small",IDC_RADIO_SMALL,"Button",BS_AUTORADIOBUTTON,41,
|
||||||
|
13,56,10
|
||||||
|
CONTROL "Medium",IDC_RADIO_MEDIUM,"Button",BS_AUTORADIOBUTTON,41,
|
||||||
|
28,56,10
|
||||||
|
CONTROL "Large",IDC_RADIO_LARGE,"Button",BS_AUTORADIOBUTTON,41,
|
||||||
|
43,56,10
|
||||||
|
CONTROL "Huge",IDC_RADIO_HUGE,"Button",BS_AUTORADIOBUTTON,41,58,
|
||||||
|
56,10
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_BRUSHSHAPEEDITOR DIALOG DISCARDABLE 0, 0, 91, 277
|
||||||
|
STYLE WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
CONTROL "Slider1",IDC_SLIDER_BRUSHSIZE,"msctls_trackbar32",
|
||||||
|
TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,19,33,57,14
|
||||||
|
COMBOBOX IDC_COMBO_TERRAINTYPES,4,57,82,58,CBS_DROPDOWN |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "Brush Size",IDC_STATIC,27,22,39,8
|
||||||
|
PUSHBUTTON "<<",IDC_BUTTON_BACK,4,7,15,12
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_PROPPAGE_NAVIGATION DIALOG DISCARDABLE 0, 0, 195, 127
|
||||||
|
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
|
CAPTION "Navigation"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Scroll Speed",IDC_STATIC,7,13,181,53
|
||||||
|
CONTROL "Slider1",IDC_SLIDER_RTSSCROLLSPEED,"msctls_trackbar32",
|
||||||
|
TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,14,36,165,15
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_PROPPAGE_SHADOWS DIALOG DISCARDABLE 0, 0, 195, 127
|
||||||
|
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
|
CAPTION "Shadows"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
CONTROL "Enable Shadows",IDC_CHECK_SHADOWS,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,14,17,69,10
|
||||||
|
GROUPBOX "",IDC_STATIC,15,41,168,71
|
||||||
|
LTEXT "Color",IDC_STATIC,23,55,27,8
|
||||||
|
CONTROL "",IDC_BUTTON_SHADOWCOLOR,"Button",BS_OWNERDRAW |
|
||||||
|
BS_FLAT,57,52,27,14
|
||||||
|
CONTROL "Slider1",IDC_SLIDER_SHADOWQUALITY,"msctls_trackbar32",
|
||||||
|
TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,51,78,125,15
|
||||||
|
LTEXT "Quality",IDC_STATIC,21,83,27,8
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_UNITPROPERTIES_TEXTURES DIALOG DISCARDABLE 0, 0, 113, 127
|
||||||
|
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
|
CAPTION "Textures"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
LTEXT "Texture",IDC_STATIC,7,9,25,8
|
||||||
|
EDITTEXT IDC_EDIT_TEXTURE,35,7,57,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_BUTTON_TEXTUREBROWSE,94,7,12,10
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_UNITPROPERTIES_ANIMATIONS DIALOG DISCARDABLE 0, 0, 120, 127
|
||||||
|
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||||
|
CAPTION "Animations"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
LTEXT "Animation",IDC_STATIC,7,7,32,8
|
||||||
|
EDITTEXT IDC_EDIT_ANIMATION,39,7,57,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_BUTTON_ANIMATIONBROWSE,101,7,12,10
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _MAC
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 0,0,7,2
|
||||||
|
PRODUCTVERSION 0,0,7,2
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x4L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Comments", "\0"
|
||||||
|
VALUE "CompanyName", "Wildfire Games\0"
|
||||||
|
VALUE "FileDescription", "0AD Scenario Editor\0"
|
||||||
|
VALUE "FileVersion", "0, 0, 7, 2\0"
|
||||||
|
VALUE "InternalName", "ScEd\0"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2003-2004\0"
|
||||||
|
VALUE "LegalTrademarks", "\0"
|
||||||
|
VALUE "OriginalFilename", "ScEd.EXE\0"
|
||||||
|
VALUE "PrivateBuild", "\0"
|
||||||
|
VALUE "ProductName", "ScEd\0"
|
||||||
|
VALUE "ProductVersion", "0, 0, 7, 2\0"
|
||||||
|
VALUE "SpecialBuild", "\0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // !_MAC
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// DESIGNINFO
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
GUIDELINES DESIGNINFO DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDD_ABOUTBOX, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 261
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 146
|
||||||
|
END
|
||||||
|
|
||||||
|
IDR_MAINFRAME, DIALOG
|
||||||
|
BEGIN
|
||||||
|
RIGHTMARGIN, 216
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_LIGHTSETTINGS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 179
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 256
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_TEXTURETOOLS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 68
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 367
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_UNITTOOLS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 88
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 320
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_OPTIONS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 179
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 131
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_ELEVATIONTOOLS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 68
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 204
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_UNITPROPERTIES, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 4
|
||||||
|
RIGHTMARGIN, 130
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 320
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_SIMPLEEDIT, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 179
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 40
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOG_MAPSIZE, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 126
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 99
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_DIALOGBAR_BRUSHSHAPEEDITOR, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 4
|
||||||
|
RIGHTMARGIN, 86
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 270
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_PROPPAGE_NAVIGATION, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 188
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 120
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_PROPPAGE_SHADOWS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 188
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 120
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_UNITPROPERTIES_TEXTURES, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 106
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 120
|
||||||
|
END
|
||||||
|
|
||||||
|
IDD_UNITPROPERTIES_ANIMATIONS, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 113
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 120
|
||||||
|
END
|
||||||
|
END
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// String Table
|
||||||
|
//
|
||||||
|
|
||||||
|
STRINGTABLE PRELOAD DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDR_MAINFRAME "ScEd\n\nScEd\n\n\nScEd.Document\nScEd Document"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE PRELOAD DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
AFX_IDS_APP_TITLE "ScEd"
|
||||||
|
AFX_IDS_IDLEMESSAGE "Ready"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_INDICATOR_EXT "EXT"
|
||||||
|
ID_INDICATOR_CAPS "CAP"
|
||||||
|
ID_INDICATOR_NUM "NUM"
|
||||||
|
ID_INDICATOR_SCRL "SCRL"
|
||||||
|
ID_INDICATOR_OVR "OVR"
|
||||||
|
ID_INDICATOR_REC "REC"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_FILE_NEW "Create a new document\nNew"
|
||||||
|
ID_FILE_OPEN "Open an existing document\nOpen"
|
||||||
|
ID_FILE_CLOSE "Close the active document\nClose"
|
||||||
|
ID_FILE_SAVE "Save the active document\nSave"
|
||||||
|
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
||||||
|
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_FILE_MRU_FILE1 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE2 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE3 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE4 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE5 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE6 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE7 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE8 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE9 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE10 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE11 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE12 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE13 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE14 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE15 "Open this document"
|
||||||
|
ID_FILE_MRU_FILE16 "Open this document"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
||||||
|
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_EDIT_CLEAR "Erase the selection\nErase"
|
||||||
|
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
||||||
|
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
|
||||||
|
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
|
||||||
|
ID_EDIT_FIND "Find the specified text\nFind"
|
||||||
|
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
|
||||||
|
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
|
||||||
|
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
|
||||||
|
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
|
||||||
|
ID_EDIT_UNDO "Undo the last action\nUndo"
|
||||||
|
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
||||||
|
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
AFX_IDS_SCSIZE "Change the window size"
|
||||||
|
AFX_IDS_SCMOVE "Change the window position"
|
||||||
|
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
|
||||||
|
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
|
||||||
|
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
|
||||||
|
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
|
||||||
|
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
AFX_IDS_SCRESTORE "Restore the window to normal size"
|
||||||
|
AFX_IDS_SCTASKLIST "Activate Task List"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
#define _AFX_NO_SPLITTER_RESOURCES
|
||||||
|
#define _AFX_NO_OLE_RESOURCES
|
||||||
|
#define _AFX_NO_TRACKER_RESOURCES
|
||||||
|
#define _AFX_NO_PROPERTY_RESOURCES
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE 9, 1
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
#include "res\ScEd.rc2" // non-Microsoft Visual C++ edited resources
|
||||||
|
#include "afxres.rc" // Standard components
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
78
source/sced/ScEdDoc.cpp
Executable file
78
source/sced/ScEdDoc.cpp
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
// ScEdDoc.cpp : implementation of the CScEdDoc class
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
|
||||||
|
#include "ScEdDoc.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdDoc
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CScEdDoc, CDocument)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CScEdDoc, CDocument)
|
||||||
|
//{{AFX_MSG_MAP(CScEdDoc)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code!
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdDoc construction/destruction
|
||||||
|
|
||||||
|
CScEdDoc::CScEdDoc()
|
||||||
|
{
|
||||||
|
// TODO: add one-time construction code here
|
||||||
|
m_bAutoDelete = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CScEdDoc::~CScEdDoc()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CScEdDoc::OnNewDocument()
|
||||||
|
{
|
||||||
|
if (!CDocument::OnNewDocument())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// TODO: add reinitialization code here
|
||||||
|
// (SDI documents will reuse this document)
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdDoc serialization
|
||||||
|
|
||||||
|
void CScEdDoc::Serialize(CArchive& ar)
|
||||||
|
{
|
||||||
|
if (ar.IsStoring())
|
||||||
|
{
|
||||||
|
// TODO: add storing code here
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: add loading code here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdDoc diagnostics
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CScEdDoc::AssertValid() const
|
||||||
|
{
|
||||||
|
CDocument::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdDoc::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CDocument::Dump(dc);
|
||||||
|
}
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdDoc commands
|
57
source/sced/ScEdDoc.h
Executable file
57
source/sced/ScEdDoc.h
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
// ScEdDoc.h : interface of the CScEdDoc class
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_SCEDDOC_H__6242BDFF_C79F_4830_8E45_7433106317DB__INCLUDED_)
|
||||||
|
#define AFX_SCEDDOC_H__6242BDFF_C79F_4830_8E45_7433106317DB__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
|
||||||
|
class CScEdDoc : public CDocument
|
||||||
|
{
|
||||||
|
protected: // create from serialization only
|
||||||
|
CScEdDoc();
|
||||||
|
DECLARE_DYNCREATE(CScEdDoc)
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CScEdDoc)
|
||||||
|
public:
|
||||||
|
virtual BOOL OnNewDocument();
|
||||||
|
virtual void Serialize(CArchive& ar);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CScEdDoc();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CScEdDoc)
|
||||||
|
// NOTE - the ClassWizard will add and remove member functions here.
|
||||||
|
// DO NOT EDIT what you see in these blocks of generated code !
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_SCEDDOC_H__6242BDFF_C79F_4830_8E45_7433106317DB__INCLUDED_)
|
580
source/sced/ScEdView.cpp
Executable file
580
source/sced/ScEdView.cpp
Executable file
@ -0,0 +1,580 @@
|
|||||||
|
// ScEdView.cpp : implementation of the CScEdView class
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
|
||||||
|
#include "ScEdDoc.h"
|
||||||
|
#include "ScEdView.h"
|
||||||
|
#include "ToolManager.h"
|
||||||
|
#include "EditorData.h"
|
||||||
|
#include "UserConfig.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
|
||||||
|
#include "timer.h"
|
||||||
|
#include "ogl.h"
|
||||||
|
#include "res/vfs.h"
|
||||||
|
|
||||||
|
int g_ClickMode=0;
|
||||||
|
|
||||||
|
static unsigned int GetModifierKeyFlags()
|
||||||
|
{
|
||||||
|
unsigned int flags=0;
|
||||||
|
if (::GetAsyncKeyState(VK_MENU) & 0x8000) flags|=TOOL_MOUSEFLAG_ALTDOWN;
|
||||||
|
if (::GetAsyncKeyState(VK_SHIFT) & 0x8000) flags|=TOOL_MOUSEFLAG_SHIFTDOWN;
|
||||||
|
if (::GetAsyncKeyState(VK_CONTROL) & 0x8000) flags|=TOOL_MOUSEFLAG_CTRLDOWN;
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdView
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CScEdView, CView)
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CScEdView, CView)
|
||||||
|
//{{AFX_MSG_MAP(CScEdView)
|
||||||
|
ON_WM_ERASEBKGND()
|
||||||
|
ON_WM_CREATE()
|
||||||
|
ON_WM_DESTROY()
|
||||||
|
ON_WM_SIZE()
|
||||||
|
ON_WM_MOUSEMOVE()
|
||||||
|
ON_WM_LBUTTONDOWN()
|
||||||
|
ON_WM_LBUTTONUP()
|
||||||
|
ON_WM_RBUTTONDOWN()
|
||||||
|
ON_WM_RBUTTONUP()
|
||||||
|
ON_WM_MBUTTONDOWN()
|
||||||
|
ON_WM_MBUTTONUP()
|
||||||
|
ON_MESSAGE(WM_MOUSEWHEEL,OnMouseWheel)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdView construction/destruction
|
||||||
|
|
||||||
|
CScEdView::CScEdView() : m_hGLRC(0), m_LastTickTime(-1.0f), m_LastFrameDuration(-1.0f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CScEdView::~CScEdView()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CScEdView::PreCreateWindow(CREATESTRUCT& cs)
|
||||||
|
{
|
||||||
|
cs.lpszClass = ::AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC,
|
||||||
|
::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
|
||||||
|
cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||||
|
return CView::PreCreateWindow(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdView drawing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void CScEdView::OnDraw(CDC* pDC)
|
||||||
|
{
|
||||||
|
HWND hWnd = GetSafeHwnd();
|
||||||
|
HDC hDC = ::GetDC(hWnd);
|
||||||
|
wglMakeCurrent(hDC,m_hGLRC);
|
||||||
|
|
||||||
|
g_EditorData.OnDraw();
|
||||||
|
|
||||||
|
SwapBuffers(hDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdView diagnostics
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
void CScEdView::AssertValid() const
|
||||||
|
{
|
||||||
|
CView::AssertValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::Dump(CDumpContext& dc) const
|
||||||
|
{
|
||||||
|
CView::Dump(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
CScEdDoc* CScEdView::GetDocument() // non-debug version is inline
|
||||||
|
{
|
||||||
|
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CScEdDoc)));
|
||||||
|
return (CScEdDoc*)m_pDocument;
|
||||||
|
}
|
||||||
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CScEdView message handlers
|
||||||
|
|
||||||
|
BOOL CScEdView::OnEraseBkgnd(CDC* pDC)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CScEdView::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||||
|
{
|
||||||
|
// base initialisation first
|
||||||
|
if (CView::OnCreate(lpCreateStruct) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// get device context for this window
|
||||||
|
HDC dc=::GetDC(m_hWnd);
|
||||||
|
|
||||||
|
// try and setup a default pixel format
|
||||||
|
if (!SetupPixelFormat(dc)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create context, make it current
|
||||||
|
m_hGLRC=wglCreateContext(dc);
|
||||||
|
wglMakeCurrent(dc,m_hGLRC);
|
||||||
|
|
||||||
|
// initialise gl stuff (extensions, etc)
|
||||||
|
oglInit();
|
||||||
|
|
||||||
|
// check for minimum requirements
|
||||||
|
if(!oglExtAvail("GL_ARB_multitexture") || !oglExtAvail("GL_ARB_texture_env_combine")) {
|
||||||
|
const char* err="No graphics card support for multitexturing found; please visit the 0AD Forums for more information.";
|
||||||
|
::MessageBox(0,err,"Error",MB_OK);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// initialise VFS paths
|
||||||
|
char path[256];
|
||||||
|
::GetModuleFileName(0,path,256);
|
||||||
|
file_rel_chdir(path, "../data");
|
||||||
|
vfs_mount("", "mods/official", 0);
|
||||||
|
|
||||||
|
// create renderer related stuff
|
||||||
|
new CRenderer;
|
||||||
|
|
||||||
|
// start up the renderer
|
||||||
|
g_Renderer.Open(0,0,::GetDeviceCaps(dc,BITSPIXEL));
|
||||||
|
|
||||||
|
// initialise document data
|
||||||
|
if (!g_EditorData.Init()) return -1;
|
||||||
|
|
||||||
|
// store current mouse pos
|
||||||
|
::GetCursorPos(&m_LastMousePos);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::OnDestroy()
|
||||||
|
{
|
||||||
|
// close down editor resources
|
||||||
|
g_EditorData.Terminate();
|
||||||
|
|
||||||
|
// destroy renderer related stuff
|
||||||
|
delete CRenderer::GetSingletonPtr();
|
||||||
|
|
||||||
|
// release rendering context
|
||||||
|
if (m_hGLRC) {
|
||||||
|
wglMakeCurrent(0,0);
|
||||||
|
wglDeleteContext(m_hGLRC);
|
||||||
|
m_hGLRC=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// base destruction
|
||||||
|
CView::OnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::OnSize(UINT nType, int cx, int cy)
|
||||||
|
{
|
||||||
|
// give base class a shout ..
|
||||||
|
CView::OnSize(nType, cx, cy);
|
||||||
|
|
||||||
|
m_Width=cx;
|
||||||
|
m_Height=cy;
|
||||||
|
g_Renderer.Resize(m_Width,m_Height);
|
||||||
|
|
||||||
|
g_EditorData.OnCameraChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CScEdView::SetupPixelFormat(HDC dc)
|
||||||
|
{
|
||||||
|
int bpp=::GetDeviceCaps(dc,BITSPIXEL);
|
||||||
|
PIXELFORMATDESCRIPTOR pfd = {
|
||||||
|
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
|
||||||
|
1, // version number
|
||||||
|
PFD_DRAW_TO_WINDOW | // support window
|
||||||
|
PFD_SUPPORT_OPENGL | // support OpenGL
|
||||||
|
PFD_DOUBLEBUFFER, // double buffered
|
||||||
|
PFD_TYPE_RGBA, // RGBA type
|
||||||
|
bpp==16 ? 16 : 24, // 16/24 bit color depth
|
||||||
|
0, 0, 0, 0, 0, 0, // color bits ignored
|
||||||
|
bpp==16 ? 0 : 8, // 16/24 bit color depth
|
||||||
|
0, // shift bit ignored
|
||||||
|
0, // no accumulation buffer
|
||||||
|
0, 0, 0, 0, // accum bits ignored
|
||||||
|
24, // 24-bit z-buffer
|
||||||
|
8, // 8-bit stencil buffer
|
||||||
|
0, // no auxiliary buffer
|
||||||
|
PFD_MAIN_PLANE, // main layer
|
||||||
|
0, // reserved
|
||||||
|
0, 0, 0 // layer masks ignored
|
||||||
|
};
|
||||||
|
|
||||||
|
int format=::ChoosePixelFormat(dc,&pfd);
|
||||||
|
if (format==0) {
|
||||||
|
// ack - can't choose format; bail out
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(::SetPixelFormat(dc,format,&pfd) == false) {
|
||||||
|
// ugh - still can't get anything; bail out
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check we've got an accelerated format available
|
||||||
|
if (::DescribePixelFormat(dc,format,sizeof(pfd),&pfd)) {
|
||||||
|
if (pfd.dwFlags & PFD_GENERIC_FORMAT) {
|
||||||
|
const char* err="No hardware accelerated graphics support found; please visit the 0AD Forums for more information.";
|
||||||
|
::MessageBox(0,err,"Error",MB_OK);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static CPoint lastClientMousePos;
|
||||||
|
|
||||||
|
void CScEdView::OnMouseLeave(const CPoint& point)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::OnMouseEnter(const CPoint& point)
|
||||||
|
{
|
||||||
|
unsigned int flags=GetModifierKeyFlags();
|
||||||
|
|
||||||
|
// trigger left button up and right button up events as required
|
||||||
|
if (!(::GetAsyncKeyState(VK_LBUTTON) & 0x8000)) {
|
||||||
|
g_ToolMan.OnLButtonUp(flags,point.x,point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(::GetAsyncKeyState(VK_RBUTTON) & 0x8000)) {
|
||||||
|
g_ToolMan.OnRButtonUp(flags,point.x,point.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::OnMouseMove(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
SetFocus();
|
||||||
|
|
||||||
|
if (nFlags & MK_MBUTTON) {
|
||||||
|
// middle mouse down .. forward move to the navicam and
|
||||||
|
// we're done
|
||||||
|
u32 flags=GetModifierKeyFlags();
|
||||||
|
g_NaviCam.OnMouseMove(flags,point.x,point.y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool mouseInView=false;
|
||||||
|
|
||||||
|
// get view rect
|
||||||
|
CRect rect;
|
||||||
|
GetClientRect(rect);
|
||||||
|
|
||||||
|
// inside?
|
||||||
|
if(rect.PtInRect(point)) {
|
||||||
|
// yes - previously inside?
|
||||||
|
if (!mouseInView) {
|
||||||
|
// nope - enable mouse capture
|
||||||
|
SetCapture();
|
||||||
|
// run any necessary mouse leave code
|
||||||
|
OnMouseEnter(point);
|
||||||
|
}
|
||||||
|
mouseInView=true;
|
||||||
|
// store mouse position
|
||||||
|
lastClientMousePos=point;
|
||||||
|
|
||||||
|
// now actually handle everything required for the actual move event
|
||||||
|
|
||||||
|
// assume we want to update tile selection on mouse move
|
||||||
|
bool updateSelection=true;
|
||||||
|
|
||||||
|
// check for left mouse down on minimap following click on minimap
|
||||||
|
if (nFlags & MK_LBUTTON) {
|
||||||
|
if (g_ClickMode==0) {
|
||||||
|
if (point.x>m_Width-200 && point.y>m_Height-200) {
|
||||||
|
AdjustCameraViaMinimapClick(point);
|
||||||
|
|
||||||
|
// minimap moved, so don't update selection
|
||||||
|
updateSelection=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateSelection) {
|
||||||
|
unsigned int flags=GetModifierKeyFlags();
|
||||||
|
g_ToolMan.OnMouseMove(flags,point.x,point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// store this position as last
|
||||||
|
m_LastMousePos=point;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// previously inside view?
|
||||||
|
if (mouseInView) {
|
||||||
|
// yes - run any necessary mouse leave code
|
||||||
|
OnMouseLeave(point);
|
||||||
|
// release capture
|
||||||
|
ReleaseCapture();
|
||||||
|
}
|
||||||
|
// note mouse no longer in view
|
||||||
|
mouseInView=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CScEdView::OnScreenShot()
|
||||||
|
{
|
||||||
|
static int counter=1;
|
||||||
|
|
||||||
|
// generate filename, create directory if required
|
||||||
|
char buf[512];
|
||||||
|
sprintf(buf,"../screenshots");
|
||||||
|
mkdir(buf,0);
|
||||||
|
sprintf(buf,"%s/%08d.tga",buf,counter++);
|
||||||
|
|
||||||
|
// make context current
|
||||||
|
HWND hWnd = GetSafeHwnd();
|
||||||
|
HDC hDC = ::GetDC(hWnd);
|
||||||
|
wglMakeCurrent(hDC,m_hGLRC);
|
||||||
|
|
||||||
|
// call on editor to make screenshot
|
||||||
|
g_EditorData.OnScreenShot(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CScEdView::OnRButtonUp(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
g_ClickMode=1;
|
||||||
|
|
||||||
|
unsigned int flags=GetModifierKeyFlags();
|
||||||
|
g_ToolMan.OnRButtonUp(flags,point.x,point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::OnRButtonDown(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
if (point.x>m_Width-200 && point.y>m_Height-200) {
|
||||||
|
} else {
|
||||||
|
g_ClickMode=1;
|
||||||
|
unsigned int flags=GetModifierKeyFlags();
|
||||||
|
g_ToolMan.OnRButtonDown(flags,point.x,point.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CScEdView::OnLButtonUp(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
g_ClickMode=1;
|
||||||
|
|
||||||
|
unsigned int flags=GetModifierKeyFlags();
|
||||||
|
g_ToolMan.OnLButtonUp(flags,point.x,point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::OnLButtonDown(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
if (point.x>m_Width-200 && point.y>m_Height-200) {
|
||||||
|
g_ClickMode=0;
|
||||||
|
AdjustCameraViaMinimapClick(point);
|
||||||
|
} else {
|
||||||
|
g_ClickMode=1;
|
||||||
|
unsigned int flags=GetModifierKeyFlags();
|
||||||
|
g_ToolMan.OnLButtonDown(flags,point.x,point.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::AdjustCameraViaMinimapClick(CPoint point)
|
||||||
|
{
|
||||||
|
// convert from screen space point back to world space point representating intersection of
|
||||||
|
// ray with terrain plane
|
||||||
|
CVector3D pos;
|
||||||
|
pos.X=float(CELL_SIZE*g_Terrain.GetVerticesPerSide())*float(point.x+200-m_Width)/200.0f;
|
||||||
|
pos.Y=-g_EditorData.m_TerrainPlane.m_Dist;
|
||||||
|
pos.Z=float(CELL_SIZE*g_Terrain.GetVerticesPerSide())*float(m_Height-point.y)/197.0f;
|
||||||
|
|
||||||
|
// calculate desired camera point from this
|
||||||
|
CVector3D startpos=g_NaviCam.GetCamera().m_Orientation.GetTranslation();
|
||||||
|
CVector3D rayDir=g_NaviCam.GetCamera().m_Orientation.GetIn();
|
||||||
|
|
||||||
|
float distToPlane=g_EditorData.m_TerrainPlane.DistanceToPlane(startpos);
|
||||||
|
float dot=rayDir.Dot(g_EditorData.m_TerrainPlane.m_Norm);
|
||||||
|
CVector3D endpos=pos+(rayDir*(distToPlane/dot));
|
||||||
|
|
||||||
|
// translate camera from old point to new
|
||||||
|
CVector3D trans=endpos-startpos;
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.Translate(trans);
|
||||||
|
|
||||||
|
g_EditorData.OnCameraChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CScEdView::AppHasFocus()
|
||||||
|
{
|
||||||
|
CWnd* wnd=AfxGetMainWnd();
|
||||||
|
if (!wnd) return false;
|
||||||
|
|
||||||
|
CWnd* focuswnd=GetFocus();
|
||||||
|
|
||||||
|
while (focuswnd) {
|
||||||
|
if (focuswnd==wnd) return true;
|
||||||
|
focuswnd=focuswnd->GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::IdleTimeProcess()
|
||||||
|
{
|
||||||
|
if (m_LastTickTime==-1) {
|
||||||
|
m_LastTickTime=get_time();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fake a mouse move from current position if either mouse button is down
|
||||||
|
unsigned int flags=0;
|
||||||
|
if ((::GetAsyncKeyState(VK_LBUTTON) & 0x8000) || (::GetAsyncKeyState(VK_RBUTTON) & 0x8000)) {
|
||||||
|
unsigned int flags=GetModifierKeyFlags();
|
||||||
|
g_ToolMan.OnMouseMove(flags,m_LastMousePos.x,m_LastMousePos.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
double curtime=get_time();
|
||||||
|
double diff=curtime-m_LastTickTime;
|
||||||
|
|
||||||
|
if (m_LastFrameDuration>0) {
|
||||||
|
|
||||||
|
g_EditorData.UpdateWorld(float(m_LastFrameDuration));
|
||||||
|
|
||||||
|
// check app has focus
|
||||||
|
if (AppHasFocus()) {
|
||||||
|
POINT pt;
|
||||||
|
if (GetCursorPos(&pt)) {
|
||||||
|
// want to scroll?
|
||||||
|
int scrollspeed=g_UserCfg.GetOptionInt(CFG_SCROLLSPEED);
|
||||||
|
if (scrollspeed>0) {
|
||||||
|
RECT rect;
|
||||||
|
AfxGetMainWnd()->GetWindowRect(&rect);
|
||||||
|
|
||||||
|
// scale translation by distance from terrain
|
||||||
|
float h=g_NaviCam.GetCamera().m_Orientation.GetTranslation().Y;
|
||||||
|
float speed=h*0.1f;
|
||||||
|
|
||||||
|
// scale translation to account for fact that we might not be running at the same rate as the timer
|
||||||
|
speed*=float(diff);
|
||||||
|
|
||||||
|
// scale by user requested speed
|
||||||
|
speed*=scrollspeed;
|
||||||
|
|
||||||
|
bool changed=false;
|
||||||
|
if (pt.x<rect.left+16) {
|
||||||
|
CVector3D left=g_NaviCam.GetCamera().m_Orientation.GetLeft();
|
||||||
|
// strip vertical movement, to prevent moving into/away from terrain plane
|
||||||
|
left.Y=0;
|
||||||
|
left.Normalize();
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.Translate(left*speed);
|
||||||
|
changed=true;
|
||||||
|
} else if (pt.x>rect.right-16) {
|
||||||
|
CVector3D left=g_NaviCam.GetCamera().m_Orientation.GetLeft();
|
||||||
|
// strip vertical movement, to prevent moving into/away from terrain plane
|
||||||
|
left.Y=0;
|
||||||
|
left.Normalize();
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.Translate(left*(-speed));
|
||||||
|
changed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pt.y>rect.bottom-16) {
|
||||||
|
CVector3D up=g_NaviCam.GetCamera().m_Orientation.GetUp();
|
||||||
|
// strip vertical movement, to prevent moving into/away from terrain plane
|
||||||
|
up.Y=0;
|
||||||
|
up.Normalize();
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.Translate(up*(-speed));
|
||||||
|
changed=true;
|
||||||
|
} else if (pt.y<rect.top+16) {
|
||||||
|
CVector3D up=g_NaviCam.GetCamera().m_Orientation.GetUp();
|
||||||
|
// strip vertical movement, to prevent moving into/away from terrain plane
|
||||||
|
up.Y=0;
|
||||||
|
up.Normalize();
|
||||||
|
g_NaviCam.GetCamera().m_Orientation.Translate(up*speed);
|
||||||
|
changed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
g_EditorData.OnCameraChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// store frame time
|
||||||
|
m_LastFrameDuration=diff;
|
||||||
|
|
||||||
|
// store current time
|
||||||
|
m_LastTickTime=curtime;
|
||||||
|
|
||||||
|
// finally, redraw view
|
||||||
|
HWND hWnd = GetSafeHwnd();
|
||||||
|
HDC hDC = ::GetDC(hWnd);
|
||||||
|
wglMakeCurrent(hDC,m_hGLRC);
|
||||||
|
g_EditorData.OnDraw();
|
||||||
|
SwapBuffers(hDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CScEdView::OnMouseWheel(WPARAM wParam,LPARAM lParam)
|
||||||
|
{
|
||||||
|
int xPos = LOWORD(lParam);
|
||||||
|
int yPos = HIWORD(lParam);
|
||||||
|
SHORT fwKeys = LOWORD(wParam);
|
||||||
|
SHORT zDelta = HIWORD(wParam);
|
||||||
|
|
||||||
|
g_NaviCam.OnMouseWheelScroll(0,xPos,yPos,float(zDelta)/120.0f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CScEdView::OnMButtonDown(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
g_NaviCam.OnMButtonDown(0,point.x,point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScEdView::OnMButtonUp(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
g_NaviCam.OnMButtonUp(0,point.x,point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CScEdView::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
|
||||||
|
if (pMsg->message==WM_KEYDOWN) {
|
||||||
|
int key=(int) pMsg->wParam;
|
||||||
|
CMainFrame* mainfrm=(CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||||||
|
switch (key) {
|
||||||
|
case VK_F1:
|
||||||
|
mainfrm->OnViewRenderStats();
|
||||||
|
break;
|
||||||
|
case VK_F9:
|
||||||
|
mainfrm->OnViewScreenshot();
|
||||||
|
break;
|
||||||
|
case 'Z':
|
||||||
|
if (GetAsyncKeyState(VK_CONTROL))
|
||||||
|
mainfrm->OnEditUndo();
|
||||||
|
break;
|
||||||
|
case 'Y':
|
||||||
|
if (GetAsyncKeyState(VK_CONTROL))
|
||||||
|
mainfrm->OnEditRedo();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return CView::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
|
}
|
101
source/sced/ScEdView.h
Executable file
101
source/sced/ScEdView.h
Executable file
@ -0,0 +1,101 @@
|
|||||||
|
// ScEdView.h : interface of the CScEdView class
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if !defined(AFX_SCEDVIEW_H__8E15B3D6_0CEA_4B52_95AC_64B15600ADE8__INCLUDED_)
|
||||||
|
#define AFX_SCEDVIEW_H__8E15B3D6_0CEA_4B52_95AC_64B15600ADE8__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
|
||||||
|
// forward declarations
|
||||||
|
class CScEdDoc;
|
||||||
|
|
||||||
|
|
||||||
|
class CScEdView : public CView
|
||||||
|
{
|
||||||
|
protected: // create from serialization only
|
||||||
|
CScEdView();
|
||||||
|
DECLARE_DYNCREATE(CScEdView)
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
CScEdDoc* GetDocument();
|
||||||
|
void OnScreenShot();
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CScEdView)
|
||||||
|
public:
|
||||||
|
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|
||||||
|
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CScEdView();
|
||||||
|
#ifdef _DEBUG
|
||||||
|
virtual void AssertValid() const;
|
||||||
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void IdleTimeProcess();
|
||||||
|
|
||||||
|
// current size of view
|
||||||
|
int m_Width,m_Height;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void AdjustCameraViaMinimapClick(CPoint point);
|
||||||
|
bool AppHasFocus();
|
||||||
|
|
||||||
|
// GL rendering context
|
||||||
|
HGLRC m_hGLRC;
|
||||||
|
// last known position of mouse
|
||||||
|
CPoint m_LastMousePos;
|
||||||
|
// setup pixel format on given DC
|
||||||
|
bool SetupPixelFormat(HDC dc);
|
||||||
|
// last tick time
|
||||||
|
double m_LastTickTime;
|
||||||
|
// duration of last frame
|
||||||
|
double m_LastFrameDuration;
|
||||||
|
|
||||||
|
void OnMouseLeave(const CPoint& point);
|
||||||
|
void OnMouseEnter(const CPoint& point);
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CScEdView)
|
||||||
|
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||||
|
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||||
|
afx_msg void OnDestroy();
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
|
||||||
|
afx_msg LRESULT OnMouseWheel(WPARAM wParam,LPARAM lParam);
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef _DEBUG // debug version in ScEdView.cpp
|
||||||
|
inline CScEdDoc* CScEdView::GetDocument()
|
||||||
|
{ return (CScEdDoc*)m_pDocument; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_SCEDVIEW_H__8E15B3D6_0CEA_4B52_95AC_64B15600ADE8__INCLUDED_)
|
112
source/sced/SelectObjectTool.cpp
Executable file
112
source/sced/SelectObjectTool.cpp
Executable file
@ -0,0 +1,112 @@
|
|||||||
|
#include "CommandManager.h"
|
||||||
|
#include "Unit.h"
|
||||||
|
#include "Model.h"
|
||||||
|
#include "ObjectEntry.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
#include "Renderer.h"
|
||||||
|
#include "UnitManager.h"
|
||||||
|
#include "SelectObjectTool.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
CSelectObjectTool CSelectObjectTool::m_SelectObjectTool;
|
||||||
|
|
||||||
|
CSelectObjectTool::CSelectObjectTool()
|
||||||
|
{
|
||||||
|
m_BrushSize=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSelectObjectTool::OnDraw()
|
||||||
|
{
|
||||||
|
glColor3f(1,0,0);
|
||||||
|
|
||||||
|
for (uint i=0;i<m_SelectedUnits.size();i++) {
|
||||||
|
RenderUnitBounds(m_SelectedUnits[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SelectObject: try and select the object under the cursor
|
||||||
|
// TODO, RC - add support for CTRL, SHIFT + ALT modifiers
|
||||||
|
// TODO, RC - move selected objects to another tool? visual of selection
|
||||||
|
// currently disappears when tool changes
|
||||||
|
void CSelectObjectTool::SelectObject(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
// modifiers:
|
||||||
|
// CTRL - add to selection
|
||||||
|
// ALT - remove from selection
|
||||||
|
|
||||||
|
// build camera ray
|
||||||
|
CVector3D rayorigin,raydir;
|
||||||
|
BuildCameraRay(px,py,rayorigin,raydir);
|
||||||
|
|
||||||
|
// try and pick object with it
|
||||||
|
CUnit* hit=g_UnitMan.PickUnit(rayorigin,raydir);
|
||||||
|
if (hit) {
|
||||||
|
if (flags & TOOL_MOUSEFLAG_CTRLDOWN) {
|
||||||
|
// add unit to selection if not already there
|
||||||
|
if (std::find(m_SelectedUnits.begin(),m_SelectedUnits.end(),hit)==m_SelectedUnits.end()) {
|
||||||
|
m_SelectedUnits.push_back(hit);
|
||||||
|
}
|
||||||
|
} else if (flags & TOOL_MOUSEFLAG_ALTDOWN) {
|
||||||
|
// add unit to selection if not already there
|
||||||
|
typedef std::vector<CUnit*>::iterator Iter;
|
||||||
|
Iter iter=std::find(m_SelectedUnits.begin(),m_SelectedUnits.end(),hit);
|
||||||
|
if (iter!=m_SelectedUnits.end()) {
|
||||||
|
m_SelectedUnits.erase(iter);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// just set hit as sole selection
|
||||||
|
m_SelectedUnits.clear();
|
||||||
|
m_SelectedUnits.push_back(hit);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// clear selection unless some modifier begin applied
|
||||||
|
if (!(flags & TOOL_MOUSEFLAG_CTRLDOWN) && !(flags & TOOL_MOUSEFLAG_ALTDOWN)) {
|
||||||
|
m_SelectedUnits.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// RenderUnitBounds: render a bounding box round given unit
|
||||||
|
void CSelectObjectTool::RenderUnitBounds(CUnit* unit)
|
||||||
|
{
|
||||||
|
glPushMatrix();
|
||||||
|
const CMatrix3D& transform=unit->GetModel()->GetTransform();
|
||||||
|
glMultMatrixf(&transform._11);
|
||||||
|
|
||||||
|
const CBound& bounds=unit->GetModel()->GetObjectBounds();
|
||||||
|
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex3f(bounds[0].X,bounds[0].Y,bounds[0].Z);
|
||||||
|
glVertex3f(bounds[0].X,bounds[0].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[0].X,bounds[1].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[0].X,bounds[1].Y,bounds[0].Z);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex3f(bounds[1].X,bounds[0].Y,bounds[0].Z);
|
||||||
|
glVertex3f(bounds[1].X,bounds[0].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[1].X,bounds[1].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[1].X,bounds[1].Y,bounds[0].Z);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex3f(bounds[0].X,bounds[0].Y,bounds[0].Z);
|
||||||
|
glVertex3f(bounds[0].X,bounds[0].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[1].X,bounds[0].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[1].X,bounds[0].Y,bounds[0].Z);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex3f(bounds[0].X,bounds[1].Y,bounds[0].Z);
|
||||||
|
glVertex3f(bounds[0].X,bounds[1].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[1].X,bounds[1].Y,bounds[1].Z);
|
||||||
|
glVertex3f(bounds[1].X,bounds[1].Y,bounds[0].Z);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
|
41
source/sced/SelectObjectTool.h
Executable file
41
source/sced/SelectObjectTool.h
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#ifndef _SELECTOBJECTTOOL_H
|
||||||
|
#define _SELECTOBJECTTOOL_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
|
||||||
|
#include "BrushTool.h"
|
||||||
|
#include "Vector3D.h"
|
||||||
|
#include "Matrix3D.h"
|
||||||
|
#include "Model.h"
|
||||||
|
|
||||||
|
class CUnit;
|
||||||
|
|
||||||
|
class CSelectObjectTool : public CBrushTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSelectObjectTool();
|
||||||
|
|
||||||
|
void OnDraw();
|
||||||
|
|
||||||
|
// tool triggered via left mouse button; paint current selection
|
||||||
|
void OnLButtonDown(unsigned int flags,int px,int py) { SelectObject(flags,px,py); }
|
||||||
|
|
||||||
|
// get the default select object instance
|
||||||
|
static CSelectObjectTool* GetTool() { return &m_SelectObjectTool; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// try and select the object under the cursor
|
||||||
|
void SelectObject(unsigned int flags,int px,int py);
|
||||||
|
|
||||||
|
// render bounding box round given unit
|
||||||
|
void RenderUnitBounds(CUnit* unit);
|
||||||
|
|
||||||
|
// list of currently selected units
|
||||||
|
std::vector<CUnit*> m_SelectedUnits;
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
static CSelectObjectTool m_SelectObjectTool;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
47
source/sced/ShadowsPropPage.cpp
Executable file
47
source/sced/ShadowsPropPage.cpp
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
// ShadowsPropPage.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "ShadowsPropPage.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CShadowsPropPage property page
|
||||||
|
|
||||||
|
IMPLEMENT_DYNCREATE(CShadowsPropPage, CPropertyPage)
|
||||||
|
|
||||||
|
CShadowsPropPage::CShadowsPropPage() : CPropertyPage(CShadowsPropPage::IDD)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CShadowsPropPage)
|
||||||
|
m_EnableShadows = FALSE;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
CShadowsPropPage::~CShadowsPropPage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CShadowsPropPage::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CPropertyPage::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CShadowsPropPage)
|
||||||
|
DDX_Control(pDX, IDC_BUTTON_SHADOWCOLOR, m_ShadowColor);
|
||||||
|
DDX_Check(pDX, IDC_CHECK_SHADOWS, m_EnableShadows);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CShadowsPropPage, CPropertyPage)
|
||||||
|
//{{AFX_MSG_MAP(CShadowsPropPage)
|
||||||
|
// NOTE: the ClassWizard will add message map macros here
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CShadowsPropPage message handlers
|
52
source/sced/ShadowsPropPage.h
Executable file
52
source/sced/ShadowsPropPage.h
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#if !defined(AFX_SHADOWSPROPPAGE_H__49CB83C3_EFFA_4D6B_8EAC_A728D4F85963__INCLUDED_)
|
||||||
|
#define AFX_SHADOWSPROPPAGE_H__49CB83C3_EFFA_4D6B_8EAC_A728D4F85963__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// ShadowsPropPage.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ColorButton.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CShadowsPropPage dialog
|
||||||
|
|
||||||
|
class CShadowsPropPage : public CPropertyPage
|
||||||
|
{
|
||||||
|
DECLARE_DYNCREATE(CShadowsPropPage)
|
||||||
|
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CShadowsPropPage();
|
||||||
|
~CShadowsPropPage();
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CShadowsPropPage)
|
||||||
|
enum { IDD = IDD_PROPPAGE_SHADOWS };
|
||||||
|
CColorButton m_ShadowColor;
|
||||||
|
BOOL m_EnableShadows;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generate virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CShadowsPropPage)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CShadowsPropPage)
|
||||||
|
// NOTE: the ClassWizard will add member functions here
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_SHADOWSPROPPAGE_H__49CB83C3_EFFA_4D6B_8EAC_A728D4F85963__INCLUDED_)
|
52
source/sced/SimpleEdit.cpp
Executable file
52
source/sced/SimpleEdit.cpp
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
// SimpleEdit.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "SimpleEdit.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSimpleEdit dialog
|
||||||
|
|
||||||
|
|
||||||
|
CSimpleEdit::CSimpleEdit(const char* title,CWnd* pParent /*=NULL*/)
|
||||||
|
: m_Title(title), CDialog(CSimpleEdit::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CSimpleEdit)
|
||||||
|
m_Text = _T("");
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CSimpleEdit::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CSimpleEdit)
|
||||||
|
DDX_Text(pDX, IDC_EDIT1, m_Text);
|
||||||
|
DDV_MaxChars(pDX, m_Text, 64);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CSimpleEdit, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CSimpleEdit)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSimpleEdit message handlers
|
||||||
|
|
||||||
|
BOOL CSimpleEdit::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
SetWindowText((const char*) m_Title);
|
||||||
|
|
||||||
|
CWnd* edit=GetDlgItem(IDC_EDIT1);
|
||||||
|
if (edit) {
|
||||||
|
edit->SetFocus();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
47
source/sced/SimpleEdit.h
Executable file
47
source/sced/SimpleEdit.h
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#if !defined(AFX_SIMPLEEDIT_H__190C3373_D31B_4037_9851_2C3255DFEA53__INCLUDED_)
|
||||||
|
#define AFX_SIMPLEEDIT_H__190C3373_D31B_4037_9851_2C3255DFEA53__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// SimpleEdit.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSimpleEdit dialog
|
||||||
|
|
||||||
|
class CSimpleEdit : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CSimpleEdit(const char* title,CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CSimpleEdit)
|
||||||
|
enum { IDD = IDD_DIALOG_SIMPLEEDIT };
|
||||||
|
CString m_Text;
|
||||||
|
CString m_Title;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CSimpleEdit)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CSimpleEdit)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_SIMPLEEDIT_H__190C3373_D31B_4037_9851_2C3255DFEA53__INCLUDED_)
|
67
source/sced/SmoothElevationCommand.cpp
Executable file
67
source/sced/SmoothElevationCommand.cpp
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
#include "SmoothElevationCommand.h"
|
||||||
|
#include "Terrain.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
extern CTerrain g_Terrain;
|
||||||
|
|
||||||
|
inline int clamp(int x,int min,int max)
|
||||||
|
{
|
||||||
|
if (x<min) return min;
|
||||||
|
else if (x>max) return max;
|
||||||
|
else return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSmoothElevationCommand::CSmoothElevationCommand(float smoothpower,int brushSize,int selectionCentre[2])
|
||||||
|
: CAlterElevationCommand(brushSize,selectionCentre), m_SmoothPower(smoothpower)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSmoothElevationCommand::~CSmoothElevationCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSmoothElevationCommand::CalcDataOut(int x0,int x1,int z0,int z1)
|
||||||
|
{
|
||||||
|
u32 mapSize=g_Terrain.GetVerticesPerSide();
|
||||||
|
|
||||||
|
// get valid filter vertex indices
|
||||||
|
int fxmin=clamp(x0-2,0,mapSize-1);
|
||||||
|
int fxmax=clamp(x1+2,0,mapSize-1);
|
||||||
|
int fzmin=clamp(z0-2,0,mapSize-1);
|
||||||
|
int fzmax=clamp(z1+2,0,mapSize-1);
|
||||||
|
|
||||||
|
int i,j;
|
||||||
|
for (j=z0;j<=z1;j++) {
|
||||||
|
for (i=x0;i<=x1;i++) {
|
||||||
|
// calculate output height at this pixel by filtering across neighbouring vertices
|
||||||
|
float accum=0;
|
||||||
|
float totalWeight=0;
|
||||||
|
|
||||||
|
// iterate through each vertex in selection
|
||||||
|
int r=2;
|
||||||
|
for (int k=-r;k<=r;k++) {
|
||||||
|
for (int m=-r;m<=r;m++) {
|
||||||
|
if (i+m>=fxmin && i+m<=fxmax && j+k>=fzmin && j+k<=fzmax) {
|
||||||
|
float dist=sqrt(float((k*k)+(m*m)));
|
||||||
|
float weight=1-(dist/(r+1));
|
||||||
|
accum+=weight*g_Terrain.GetHeightMap()[(j+k)*mapSize+(i+m)];
|
||||||
|
totalWeight+=weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 || totalWeight>0) {
|
||||||
|
float t=0.5f;//m_SmoothPower/32.0f;
|
||||||
|
float inputHeight=g_Terrain.GetHeightMap()[j*mapSize+i];
|
||||||
|
accum/=totalWeight;
|
||||||
|
m_DataOut(i-x0,j-z0)=clamp(int((inputHeight*(1-t))+accum*t),0,65535);
|
||||||
|
} else {
|
||||||
|
m_DataOut(i-x0,j-z0)=g_Terrain.GetHeightMap()[j*mapSize+i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
24
source/sced/SmoothElevationCommand.h
Executable file
24
source/sced/SmoothElevationCommand.h
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef _SMOOTHELEVATIONCOMMAND_H
|
||||||
|
#define _SMOOTHELEVATIONCOMMAND_H
|
||||||
|
|
||||||
|
#include "AlterElevationCommand.h"
|
||||||
|
|
||||||
|
class CSmoothElevationCommand : public CAlterElevationCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor, destructor
|
||||||
|
CSmoothElevationCommand(float smoothpower,int brushSize,int selectionCentre[2]);
|
||||||
|
~CSmoothElevationCommand();
|
||||||
|
|
||||||
|
// return the texture name of this command
|
||||||
|
const char* GetName() const { return "Smooth Elevation"; }
|
||||||
|
|
||||||
|
// calculate output data
|
||||||
|
void CalcDataOut(int x0,int x1,int z0,int z1);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// smoothing power - higher powers have greater smoothing effect
|
||||||
|
float m_SmoothPower;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
49
source/sced/SmoothElevationTool.cpp
Executable file
49
source/sced/SmoothElevationTool.cpp
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#include "timer.h"
|
||||||
|
#include "CommandManager.h"
|
||||||
|
#include "SmoothElevationTool.h"
|
||||||
|
#include "SmoothElevationCommand.h"
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
CSmoothElevationTool CSmoothElevationTool::m_SmoothElevationTool;
|
||||||
|
|
||||||
|
// maximum smoothing power
|
||||||
|
const float CSmoothElevationTool::MAX_SMOOTH_POWER=32.0f;
|
||||||
|
|
||||||
|
CSmoothElevationTool::CSmoothElevationTool() : m_SmoothPower(16.0f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CSmoothElevationTool::SmoothSelection()
|
||||||
|
{
|
||||||
|
double curtime=1000*get_time();
|
||||||
|
double elapsed=(curtime-m_LastTriggerTime);
|
||||||
|
|
||||||
|
while (elapsed>=m_SmoothPower) {
|
||||||
|
CSmoothElevationCommand* smoothCmd=new CSmoothElevationCommand(MAX_SMOOTH_POWER,m_BrushSize,m_SelectionCentre);
|
||||||
|
g_CmdMan.Execute(smoothCmd);
|
||||||
|
elapsed-=m_SmoothPower;
|
||||||
|
}
|
||||||
|
m_LastTriggerTime=curtime-elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// callback for left button down event
|
||||||
|
void CSmoothElevationTool::OnLButtonDown(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
// store trigger time
|
||||||
|
m_LastTriggerTime=1000*get_time();
|
||||||
|
// give base class a shout to do some work
|
||||||
|
CBrushTool::OnLButtonDown(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for left button up event
|
||||||
|
void CSmoothElevationTool::OnLButtonUp(unsigned int flags,int px,int py)
|
||||||
|
{
|
||||||
|
// force a trigger
|
||||||
|
OnTriggerLeft();
|
||||||
|
// give base class a shout to do some work
|
||||||
|
CBrushTool::OnLButtonUp(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
50
source/sced/SmoothElevationTool.h
Executable file
50
source/sced/SmoothElevationTool.h
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#ifndef _SMOOTHELEVATIONTOOL_H
|
||||||
|
#define _SMOOTHELEVATIONTOOL_H
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
#include "res/res.h"
|
||||||
|
#include "BrushTool.h"
|
||||||
|
|
||||||
|
class CSmoothElevationTool : public CBrushTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { MAX_BRUSH_SIZE=8 };
|
||||||
|
static const float MAX_SMOOTH_POWER;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CSmoothElevationTool();
|
||||||
|
|
||||||
|
// tool triggered by left mouse button; smooth selected terrain
|
||||||
|
void OnTriggerLeft() { SmoothSelection(); }
|
||||||
|
|
||||||
|
// callback for left button down event
|
||||||
|
void OnLButtonDown(unsigned int flags,int px,int py);
|
||||||
|
// callback for left button up event
|
||||||
|
void OnLButtonUp(unsigned int flags,int px,int py);
|
||||||
|
|
||||||
|
// set smoothing power
|
||||||
|
void SetSmoothPower(float power) { m_SmoothPower=power; }
|
||||||
|
// get smoothing power
|
||||||
|
float GetSmoothPower() const { return m_SmoothPower; }
|
||||||
|
|
||||||
|
// allow multiple triggers by click and drag
|
||||||
|
bool SupportDragTrigger() { return true; }
|
||||||
|
|
||||||
|
// get tool instance
|
||||||
|
static CSmoothElevationTool* GetTool() { return &m_SmoothElevationTool; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// smooth the currently selected terrain tiles
|
||||||
|
void SmoothSelection();
|
||||||
|
|
||||||
|
// time of last trigger
|
||||||
|
double m_LastTriggerTime;
|
||||||
|
|
||||||
|
// amount to smooth selected terrain tiles
|
||||||
|
float m_SmoothPower;
|
||||||
|
|
||||||
|
// default tool instance
|
||||||
|
static CSmoothElevationTool m_SmoothElevationTool;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
8
source/sced/StdAfx.cpp
Executable file
8
source/sced/StdAfx.cpp
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
// stdafx.cpp : source file that includes just the standard includes
|
||||||
|
// ScEd.pch will be the pre-compiled header
|
||||||
|
// stdafx.obj will contain the pre-compiled type information
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
38
source/sced/StdAfx.h
Executable file
38
source/sced/StdAfx.h
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
// stdafx.h : include file for standard system include files,
|
||||||
|
// or project specific include files that are used frequently, but
|
||||||
|
// are changed infrequently
|
||||||
|
//
|
||||||
|
|
||||||
|
#if !defined(AFX_STDAFX_H__806A78B8_0008_491A_9FB6_5FF892838693__INCLUDED_)
|
||||||
|
#define AFX_STDAFX_H__806A78B8_0008_491A_9FB6_5FF892838693__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
|
||||||
|
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
|
||||||
|
#define _SIZE_T_DEFINED
|
||||||
|
#include "posix.h"
|
||||||
|
#include "CStr.h"
|
||||||
|
|
||||||
|
#undef _WINDOWS_
|
||||||
|
#undef UNUSED
|
||||||
|
#undef _T
|
||||||
|
#undef _istspace
|
||||||
|
#undef _totlower
|
||||||
|
|
||||||
|
#include <afxwin.h> // MFC core and standard components
|
||||||
|
#include <afxext.h> // MFC extensions
|
||||||
|
#include <afxdisp.h> // MFC Automation classes
|
||||||
|
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_STDAFX_H__806A78B8_0008_491A_9FB6_5FF892838693__INCLUDED_)
|
291
source/sced/TexToolsDlgBar.cpp
Executable file
291
source/sced/TexToolsDlgBar.cpp
Executable file
@ -0,0 +1,291 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "TexToolsDlgBar.h"
|
||||||
|
#include "TextureManager.h"
|
||||||
|
#include "PaintTextureTool.h"
|
||||||
|
#include "Renderer.h"
|
||||||
|
|
||||||
|
#include "ogl.h"
|
||||||
|
#include "res/tex.h"
|
||||||
|
#include "res/vfs.h"
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CTexToolsDlgBar, CDialogBar)
|
||||||
|
//{{AFX_MSG_MAP(CTexToolsDlgBar)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
ON_NOTIFY(NM_CLICK, IDC_LIST_TEXTUREBROWSER, OnClickListTextureBrowser)
|
||||||
|
ON_CBN_SELCHANGE(IDC_COMBO_TERRAINTYPES, OnSelChangeTerrainTypes)
|
||||||
|
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_BRUSHSIZE, OnReleasedCaptureSliderBrushSize)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
CTexToolsDlgBar::CTexToolsDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CTexToolsDlgBar::~CTexToolsDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CTexToolsDlgBar::Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!CDialogBar::Create(pParentWnd, lpszTemplateName, nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OnInitDialog()) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CTexToolsDlgBar::Create(CWnd * pParentWnd, UINT nIDTemplate,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTexToolsDlgBar::Select(CTextureEntry* entry)
|
||||||
|
{
|
||||||
|
CStatic* curbmp=(CStatic*) GetDlgItem(IDC_STATIC_CURRENTTEXTURE);
|
||||||
|
CBitmap* bmp=(CBitmap*) (entry ? entry->m_Bitmap : 0);
|
||||||
|
curbmp->SetBitmap((HBITMAP) (*bmp));
|
||||||
|
CPaintTextureTool::GetTool()->SetSelectedTexture(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 32 bit colour data struct
|
||||||
|
struct Color8888 {
|
||||||
|
unsigned char r;
|
||||||
|
unsigned char g;
|
||||||
|
unsigned char b;
|
||||||
|
unsigned char a;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 24 bit colour data struct
|
||||||
|
struct Color888 {
|
||||||
|
unsigned char r;
|
||||||
|
unsigned char g;
|
||||||
|
unsigned char b;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 16-bit colour data struct
|
||||||
|
struct Color565 {
|
||||||
|
unsigned r : 5;
|
||||||
|
unsigned g : 6;
|
||||||
|
unsigned b : 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void ConvertColor(const Color8888* src,Color565* dst)
|
||||||
|
{
|
||||||
|
dst->r=(src->r>>3);
|
||||||
|
dst->g=(src->g>>2);
|
||||||
|
dst->b=(src->b>>3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ConvertColor(const Color8888* src,Color888* dst)
|
||||||
|
{
|
||||||
|
dst->r=src->r;
|
||||||
|
dst->g=src->g;
|
||||||
|
dst->b=src->b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CTexToolsDlgBar::GetCurrentTerrainType()
|
||||||
|
{
|
||||||
|
CComboBox* terraintypes=(CComboBox*) GetDlgItem(IDC_COMBO_TERRAINTYPES);
|
||||||
|
return terraintypes->GetCurSel();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CTexToolsDlgBar::BuildImageListIcon(CTextureEntry* texentry)
|
||||||
|
{
|
||||||
|
// bind to texture
|
||||||
|
g_Renderer.BindTexture(0,tex_id(texentry->m_Handle));
|
||||||
|
|
||||||
|
// get image data in BGRA format
|
||||||
|
int w,h;
|
||||||
|
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_WIDTH,&w);
|
||||||
|
glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_HEIGHT,&h);
|
||||||
|
|
||||||
|
unsigned char* texdata=new unsigned char[w*h*4];
|
||||||
|
glGetTexImage(GL_TEXTURE_2D,0,GL_BGRA_EXT,GL_UNSIGNED_BYTE,texdata);
|
||||||
|
|
||||||
|
// generate scaled bitmap of correct size
|
||||||
|
int bmpsize=32*32*4;
|
||||||
|
unsigned int bmpdata[32*32];
|
||||||
|
gluScaleImage(GL_BGRA_EXT,w,h,GL_UNSIGNED_BYTE,texdata,32,32,GL_UNSIGNED_BYTE,bmpdata);
|
||||||
|
|
||||||
|
// create the actual CBitmap object
|
||||||
|
BOOL success=TRUE;
|
||||||
|
CDC* dc=GetDC();
|
||||||
|
CBitmap* bmp=new CBitmap;
|
||||||
|
texentry->m_Bitmap=bmp;
|
||||||
|
|
||||||
|
if (bmp->CreateCompatibleBitmap(dc,32,32)) {
|
||||||
|
|
||||||
|
// query bpp of bitmap
|
||||||
|
BITMAP bm;
|
||||||
|
if (bmp->GetBitmap(&bm)) {
|
||||||
|
int bpp=bm.bmBitsPixel;
|
||||||
|
if (bpp==16) {
|
||||||
|
// build 16 bit image
|
||||||
|
unsigned short* tmp=new unsigned short[32*32];
|
||||||
|
for (int i=0;i<32*32;i++) {
|
||||||
|
ConvertColor((Color8888*) &bmpdata[i],(Color565*) &tmp[i]);
|
||||||
|
}
|
||||||
|
bmp->SetBitmapBits(32*32*2,tmp);
|
||||||
|
delete[] tmp;
|
||||||
|
} else if (bpp==24) {
|
||||||
|
// ditch alpha from image
|
||||||
|
unsigned short* tmp=new unsigned short[32*32];
|
||||||
|
for (int i=0;i<32*32;i++) {
|
||||||
|
ConvertColor((Color8888*) &bmpdata[i],(Color888*) &tmp[i]);
|
||||||
|
}
|
||||||
|
bmp->SetBitmapBits(32*32*3,tmp);
|
||||||
|
delete[] tmp;
|
||||||
|
} else if (bpp==32) {
|
||||||
|
// upload original image
|
||||||
|
bmp->SetBitmapBits(bmpsize,bmpdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
// now add to image list
|
||||||
|
m_ImageList.Add(bmp,RGB(255,255,255));
|
||||||
|
|
||||||
|
// success; note this
|
||||||
|
success=TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
delete[] texdata;
|
||||||
|
ReleaseDC(dc);
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CTexToolsDlgBar::AddImageListIcon(CTextureEntry* texentry)
|
||||||
|
{
|
||||||
|
// get a bitmap for imagelist yet?
|
||||||
|
if (!texentry->m_Bitmap) {
|
||||||
|
// nope; create one now
|
||||||
|
BuildImageListIcon(texentry);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add bitmap to imagelist
|
||||||
|
m_ImageList.Add((CBitmap*) texentry->m_Bitmap,RGB(255,255,255));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CTexToolsDlgBar::OnInitDialog()
|
||||||
|
{
|
||||||
|
// get the current window size and position
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
|
||||||
|
// now change the size, position, and Z order of the window.
|
||||||
|
::SetWindowPos(m_hWnd,HWND_TOPMOST,10,rect.top,rect.Width(),rect.Height(),SWP_HIDEWINDOW);
|
||||||
|
|
||||||
|
m_ImageList.Create(32,32,ILC_COLORDDB,0,16);
|
||||||
|
m_ImageList.SetBkColor(RGB(255,255,255));
|
||||||
|
|
||||||
|
// build combo box for terrain types
|
||||||
|
CComboBox* terraintypes=(CComboBox*) GetDlgItem(IDC_COMBO_TERRAINTYPES);
|
||||||
|
|
||||||
|
const std::vector<CTextureManager::STextureType>& ttypes=g_TexMan.m_TerrainTextures;
|
||||||
|
for (uint i=0;i<ttypes.size();i++) {
|
||||||
|
terraintypes->AddString((const char*) ttypes[i].m_Name);
|
||||||
|
}
|
||||||
|
if (ttypes.size()>0) {
|
||||||
|
// select first type
|
||||||
|
terraintypes->SetCurSel(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_TEXTUREBROWSER);
|
||||||
|
// set lists images
|
||||||
|
listctrl->SetImageList(&m_ImageList,LVSIL_NORMAL);
|
||||||
|
|
||||||
|
// build icons for existing textures
|
||||||
|
if (ttypes.size()) {
|
||||||
|
const std::vector<CTextureEntry*>& textures=ttypes[0].m_Textures;
|
||||||
|
for (uint i=0;i<textures.size();i++) {
|
||||||
|
// add image icon for this
|
||||||
|
AddImageListIcon(textures[i]);
|
||||||
|
|
||||||
|
// add to list ctrl
|
||||||
|
int index=listctrl->GetItemCount();
|
||||||
|
listctrl->InsertItem(index,(const char*) textures[i]->m_Name,index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// select first entry if we've got any entries
|
||||||
|
if (textures.size()>0) {
|
||||||
|
Select(textures[0]);
|
||||||
|
} else {
|
||||||
|
Select(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OnSelChangeTerrainTypes();
|
||||||
|
|
||||||
|
// set up brush size slider
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
sliderctrl->SetRange(0,CPaintTextureTool::MAX_BRUSH_SIZE);
|
||||||
|
sliderctrl->SetPos(CPaintTextureTool::GetTool()->GetBrushSize());
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTexToolsDlgBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
|
||||||
|
{
|
||||||
|
bDisableIfNoHndler = FALSE;
|
||||||
|
CDialogBar::OnUpdateCmdUI(pTarget,bDisableIfNoHndler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTexToolsDlgBar::OnClickListTextureBrowser(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_TEXTUREBROWSER);
|
||||||
|
|
||||||
|
POSITION pos=listctrl->GetFirstSelectedItemPosition();
|
||||||
|
if (!pos) return;
|
||||||
|
|
||||||
|
int index=listctrl->GetNextSelectedItem(pos);
|
||||||
|
Select(g_TexMan.m_TerrainTextures[GetCurrentTerrainType()].m_Textures[index]);
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTexToolsDlgBar::OnReleasedCaptureSliderBrushSize(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
CSliderCtrl* sliderctrl=(CSliderCtrl*) GetDlgItem(IDC_SLIDER_BRUSHSIZE);
|
||||||
|
CPaintTextureTool::GetTool()->SetBrushSize(sliderctrl->GetPos());
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CTexToolsDlgBar::OnSelChangeTerrainTypes()
|
||||||
|
{
|
||||||
|
// clear out the old image list
|
||||||
|
int i;
|
||||||
|
int count=m_ImageList.GetImageCount();
|
||||||
|
for (i=count-1;i>=0;--i) {
|
||||||
|
m_ImageList.Remove(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear out the listctrl
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_TEXTUREBROWSER);
|
||||||
|
listctrl->DeleteAllItems();
|
||||||
|
|
||||||
|
// add icons to image list from new selected terrain types
|
||||||
|
if (GetCurrentTerrainType()!=CB_ERR)
|
||||||
|
{
|
||||||
|
std::vector<CTextureEntry*>& textures=g_TexMan.m_TerrainTextures[GetCurrentTerrainType()].m_Textures;
|
||||||
|
for (uint j=0;j<textures.size();j++) {
|
||||||
|
// add image icon for this
|
||||||
|
AddImageListIcon(textures[j]);
|
||||||
|
|
||||||
|
// add to list ctrl
|
||||||
|
listctrl->InsertItem(j,(const char*) textures[j]->m_Name,j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
source/sced/TexToolsDlgBar.h
Executable file
38
source/sced/TexToolsDlgBar.h
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef _TEXTOOLSDLGBAR_H
|
||||||
|
#define _TEXTOOLSDLGBAR_H
|
||||||
|
|
||||||
|
#include "TextureEntry.h"
|
||||||
|
|
||||||
|
class CTexToolsDlgBar : public CDialogBar
|
||||||
|
{
|
||||||
|
// DECLARE_DYNAMIC(CInitDialogBar)
|
||||||
|
public:
|
||||||
|
CTexToolsDlgBar();
|
||||||
|
~CTexToolsDlgBar();
|
||||||
|
|
||||||
|
BOOL Create(CWnd * pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID);
|
||||||
|
BOOL Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID);
|
||||||
|
void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CImageList m_ImageList;
|
||||||
|
|
||||||
|
int GetCurrentTerrainType();
|
||||||
|
|
||||||
|
void Select(CTextureEntry* entry);
|
||||||
|
BOOL BuildImageListIcon(CTextureEntry* texentry);
|
||||||
|
BOOL AddImageListIcon(CTextureEntry* entry);
|
||||||
|
BOOL OnInitDialog();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CTexToolsDlgBar)
|
||||||
|
afx_msg void OnClickListTextureBrowser(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnReleasedCaptureSliderBrushSize(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void OnSelChangeTerrainTypes();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
30
source/sced/Tool.h
Executable file
30
source/sced/Tool.h
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef _TOOL_H
|
||||||
|
#define _TOOL_H
|
||||||
|
|
||||||
|
// flags for mouse events
|
||||||
|
#define TOOL_MOUSEFLAG_ALTDOWN 0x04
|
||||||
|
#define TOOL_MOUSEFLAG_CTRLDOWN 0x08
|
||||||
|
#define TOOL_MOUSEFLAG_SHIFTDOWN 0x10
|
||||||
|
|
||||||
|
class CTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// virtual destructor
|
||||||
|
virtual ~CTool() {}
|
||||||
|
|
||||||
|
// draw the visual representation of this tool
|
||||||
|
virtual void OnDraw() {}
|
||||||
|
// callback for left button down event
|
||||||
|
virtual void OnLButtonDown(unsigned int flags,int px,int py) {}
|
||||||
|
// callback for left button up event
|
||||||
|
virtual void OnLButtonUp(unsigned int flags,int px,int py) {}
|
||||||
|
// callback for right button down event
|
||||||
|
virtual void OnRButtonDown(unsigned int flags,int px,int py) {}
|
||||||
|
// callback for right button up event
|
||||||
|
virtual void OnRButtonUp(unsigned int flags,int px,int py) {}
|
||||||
|
// callback for mouse move event
|
||||||
|
virtual void OnMouseMove(unsigned int flags,int px,int py) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
3
source/sced/ToolManager.cpp
Executable file
3
source/sced/ToolManager.cpp
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#include "ToolManager.h"
|
||||||
|
|
||||||
|
CToolManager g_ToolMan;
|
52
source/sced/ToolManager.h
Executable file
52
source/sced/ToolManager.h
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#ifndef _TOOLMANAGER_H
|
||||||
|
#define _TOOLMANAGER_H
|
||||||
|
|
||||||
|
#include "Tool.h"
|
||||||
|
|
||||||
|
class CToolManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CToolManager() : m_ActiveTool(0) {}
|
||||||
|
|
||||||
|
// draw the visual representation of active tool, if any
|
||||||
|
void OnDraw() {
|
||||||
|
if (m_ActiveTool) m_ActiveTool->OnDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for left button down event
|
||||||
|
void OnLButtonDown(unsigned int flags,int px,int py) {
|
||||||
|
if (m_ActiveTool) m_ActiveTool->OnLButtonDown(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for left button up event
|
||||||
|
void OnLButtonUp(unsigned int flags,int px,int py) {
|
||||||
|
if (m_ActiveTool) m_ActiveTool->OnLButtonUp(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for right button down event
|
||||||
|
void OnRButtonDown(unsigned int flags,int px,int py) {
|
||||||
|
if (m_ActiveTool) m_ActiveTool->OnRButtonDown(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for right button up event
|
||||||
|
void OnRButtonUp(unsigned int flags,int px,int py) {
|
||||||
|
if (m_ActiveTool) m_ActiveTool->OnRButtonUp(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// callback for mouse move event
|
||||||
|
void OnMouseMove(unsigned int flags,int px,int py) {
|
||||||
|
if (m_ActiveTool) m_ActiveTool->OnMouseMove(flags,px,py);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set currently active tool, or pass 0 to deactive all tools
|
||||||
|
void SetActiveTool(CTool* tool) { m_ActiveTool=tool; }
|
||||||
|
// get currently active tool, if any
|
||||||
|
CTool* GetActiveTool() const { return m_ActiveTool; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
CTool* m_ActiveTool;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CToolManager g_ToolMan;
|
||||||
|
|
||||||
|
#endif
|
37
source/sced/UIGlobals.cpp
Executable file
37
source/sced/UIGlobals.cpp
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
|
||||||
|
void GetVersionString(char* buf)
|
||||||
|
{
|
||||||
|
// null version in case API calls fail for some reason
|
||||||
|
int version[4];
|
||||||
|
version[0]=version[1]=version[2]=version[3]=0;
|
||||||
|
|
||||||
|
// get filename of process currently running
|
||||||
|
char filename[256];
|
||||||
|
::GetModuleFileName(0,filename,256);
|
||||||
|
|
||||||
|
DWORD unused;
|
||||||
|
DWORD len=::GetFileVersionInfoSize(filename,&unused);
|
||||||
|
if (len>0) {
|
||||||
|
char* versioninfo=new char[len];
|
||||||
|
GetFileVersionInfo(filename,0,len,versioninfo);
|
||||||
|
|
||||||
|
VS_FIXEDFILEINFO* fileinfo;
|
||||||
|
UINT size;
|
||||||
|
if (VerQueryValue(versioninfo,"\\",(LPVOID*) &fileinfo,&size)) {
|
||||||
|
version[0]=HIWORD(fileinfo->dwFileVersionMS);
|
||||||
|
version[1]=LOWORD(fileinfo->dwFileVersionMS);
|
||||||
|
version[2]=HIWORD(fileinfo->dwFileVersionLS);
|
||||||
|
version[3]=LOWORD(fileinfo->dwFileVersionLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] versioninfo;
|
||||||
|
}
|
||||||
|
sprintf(buf,"Version: %d.%d.%d.%d",version[0],version[1],version[2],version[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ErrorBox(const char* errstr)
|
||||||
|
{
|
||||||
|
::MessageBox(0,errstr,"Error",MB_OK);
|
||||||
|
}
|
18
source/sced/UIGlobals.h
Executable file
18
source/sced/UIGlobals.h
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef _UIGLOBALS_H
|
||||||
|
#define _UIGLOBALS_H
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// UIGlobals.h: miscellaneous functions for interface the editor to "UI"
|
||||||
|
// elements
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// GetVersionString: fill version string into given buffer
|
||||||
|
extern void GetVersionString(char* buf);
|
||||||
|
// ErrorBox: show an error message box with given string
|
||||||
|
extern void ErrorBox(const char* errstr);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
43
source/sced/UnitPropertiesAnimationsTab.cpp
Executable file
43
source/sced/UnitPropertiesAnimationsTab.cpp
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
// UnitPropertiesAnimationsTab.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "UnitPropertiesAnimationsTab.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesAnimationsTab dialog
|
||||||
|
|
||||||
|
|
||||||
|
CUnitPropertiesAnimationsTab::CUnitPropertiesAnimationsTab(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CUnitPropertiesAnimationsTab::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CUnitPropertiesAnimationsTab)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CUnitPropertiesAnimationsTab::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CUnitPropertiesAnimationsTab)
|
||||||
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CUnitPropertiesAnimationsTab, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CUnitPropertiesAnimationsTab)
|
||||||
|
// NOTE: the ClassWizard will add message map macros here
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesAnimationsTab message handlers
|
46
source/sced/UnitPropertiesAnimationsTab.h
Executable file
46
source/sced/UnitPropertiesAnimationsTab.h
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#if !defined(AFX_UNITPROPERTIESANIMATIONSTAB_H__EFA556CF_E800_419B_8438_4CCB00217B1A__INCLUDED_)
|
||||||
|
#define AFX_UNITPROPERTIESANIMATIONSTAB_H__EFA556CF_E800_419B_8438_4CCB00217B1A__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// UnitPropertiesAnimationsTab.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesAnimationsTab dialog
|
||||||
|
|
||||||
|
class CUnitPropertiesAnimationsTab : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CUnitPropertiesAnimationsTab(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CUnitPropertiesAnimationsTab)
|
||||||
|
enum { IDD = IDD_UNITPROPERTIES_ANIMATIONS };
|
||||||
|
// NOTE: the ClassWizard will add data members here
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CUnitPropertiesAnimationsTab)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CUnitPropertiesAnimationsTab)
|
||||||
|
// NOTE: the ClassWizard will add member functions here
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_UNITPROPERTIESANIMATIONSTAB_H__EFA556CF_E800_419B_8438_4CCB00217B1A__INCLUDED_)
|
271
source/sced/UnitPropertiesDlgBar.cpp
Executable file
271
source/sced/UnitPropertiesDlgBar.cpp
Executable file
@ -0,0 +1,271 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "UserConfig.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
#include "Model.h"
|
||||||
|
#include "Unit.h"
|
||||||
|
#include "UnitManager.h"
|
||||||
|
#include "ObjectManager.h"
|
||||||
|
#include "UnitPropertiesDlgBar.h"
|
||||||
|
|
||||||
|
#include "EditorData.h"
|
||||||
|
#include "UIGlobals.h"
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CUnitPropertiesDlgBar, CDialogBar)
|
||||||
|
//{{AFX_MSG_MAP(CUnitPropertiesDlgBar)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_BACK, OnButtonBack)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_REFRESH, OnButtonRefresh)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_MODELBROWSE, OnButtonModelBrowse)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_TEXTUREBROWSE, OnButtonTextureBrowse)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_ANIMATIONBROWSE, OnButtonAnimationBrowse)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// MakeRelativeFileName: adjust the given filename to return the filename
|
||||||
|
// relative to the mods/official directory - also swizzle backslashes
|
||||||
|
// to forward slashes
|
||||||
|
// TODO, RC: need to make this work with other root directories
|
||||||
|
static CStr MakeRelativeFileName(const char* fname)
|
||||||
|
{
|
||||||
|
CStr result;
|
||||||
|
const char* ptr=strstr(fname,"mods\\official\\");
|
||||||
|
if (!ptr) {
|
||||||
|
result=fname;
|
||||||
|
} else {
|
||||||
|
result=ptr+strlen("mods\\official\\");
|
||||||
|
}
|
||||||
|
int len=result.Length();
|
||||||
|
for (int i=0;i<len;i++) {
|
||||||
|
if (result[i]=='\\') result[i]='/';
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
CUnitPropertiesDlgBar::CUnitPropertiesDlgBar() : m_Object(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CUnitPropertiesDlgBar::~CUnitPropertiesDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CUnitPropertiesDlgBar::Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!CDialogBar::Create(pParentWnd, lpszTemplateName, nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OnInitDialog()) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CUnitPropertiesDlgBar::Create(CWnd * pParentWnd, UINT nIDTemplate,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CUnitPropertiesDlgBar::OnInitDialog()
|
||||||
|
{
|
||||||
|
// get the current window size and position
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
|
||||||
|
// now change the size, position, and Z order of the window.
|
||||||
|
::SetWindowPos(m_hWnd,HWND_TOPMOST,10,rect.top,rect.Width(),rect.Height(),SWP_HIDEWINDOW);
|
||||||
|
|
||||||
|
/*
|
||||||
|
CTabCtrl *tabCtrl=(CTabCtrl*) GetDlgItem(IDC_TAB_PAGES);
|
||||||
|
tabCtrl->InsertItem(0, "Tab 1", 0); // add some test pages to the tab
|
||||||
|
tabCtrl->InsertItem(1, "Tab 2", 1);
|
||||||
|
tabCtrl->InsertItem(2, "Tab 3", 2);
|
||||||
|
tabCtrl->InsertItem(3, "Tab 4", 3);
|
||||||
|
*/
|
||||||
|
// initialise data from editor data
|
||||||
|
UpdatePropertiesDlg();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
|
||||||
|
{
|
||||||
|
bDisableIfNoHndler = FALSE;
|
||||||
|
CDialogBar::OnUpdateCmdUI(pTarget,bDisableIfNoHndler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::OnButtonBack()
|
||||||
|
{
|
||||||
|
// save current object (if we've got one) before going back
|
||||||
|
if (m_Object) {
|
||||||
|
|
||||||
|
CStr filename("data/mods/official/art/actors/");
|
||||||
|
filename+=g_ObjMan.m_ObjectTypes[m_Object->m_Type].m_Name;
|
||||||
|
filename+="/";
|
||||||
|
filename+=m_Object->m_Name;
|
||||||
|
filename+=".xml";
|
||||||
|
m_Object->Save((const char*) filename);
|
||||||
|
|
||||||
|
// and rebuild the model
|
||||||
|
UpdateEditorData();
|
||||||
|
}
|
||||||
|
|
||||||
|
CMainFrame* mainfrm=(CMainFrame*) AfxGetMainWnd();
|
||||||
|
mainfrm->OnUnitTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::OnButtonRefresh()
|
||||||
|
{
|
||||||
|
UpdateEditorData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::OnButtonTextureBrowse()
|
||||||
|
{
|
||||||
|
const char* filter="DDS Files|*.dds|PNG Files|*.png||";
|
||||||
|
CFileDialog dlg(TRUE,g_UserCfg.GetOptionString(CFG_TEXTUREEXT),0,OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,filter,0);
|
||||||
|
dlg.m_ofn.lpstrInitialDir=g_UserCfg.GetOptionString(CFG_MODELTEXLOADDIR);
|
||||||
|
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
CStr filename=MakeRelativeFileName(dlg.m_ofn.lpstrFile);
|
||||||
|
|
||||||
|
CStr dir(dlg.m_ofn.lpstrFile);
|
||||||
|
dir=dir.Left(dlg.m_ofn.nFileOffset-1);
|
||||||
|
g_UserCfg.SetOptionString(CFG_MODELTEXLOADDIR,(const char*) dir);
|
||||||
|
|
||||||
|
CWnd* texture=GetDlgItem(IDC_EDIT_TEXTURE);
|
||||||
|
texture->SetWindowText(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::OnButtonAnimationBrowse()
|
||||||
|
{
|
||||||
|
const char* filter="PSA Files|*.psa||";
|
||||||
|
CFileDialog dlg(TRUE,"psa",0,OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,filter,0);
|
||||||
|
dlg.m_ofn.lpstrInitialDir=g_UserCfg.GetOptionString(CFG_MODELANIMATIONDIR);
|
||||||
|
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
CStr filename=MakeRelativeFileName(dlg.m_ofn.lpstrFile);
|
||||||
|
|
||||||
|
CStr dir(dlg.m_ofn.lpstrFile);
|
||||||
|
dir=dir.Left(dlg.m_ofn.nFileOffset-1);
|
||||||
|
g_UserCfg.SetOptionString(CFG_MODELANIMATIONDIR,(const char*) dir);
|
||||||
|
|
||||||
|
CWnd* animation=GetDlgItem(IDC_EDIT_ANIMATION);
|
||||||
|
animation->SetWindowText(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::OnButtonModelBrowse()
|
||||||
|
{
|
||||||
|
const char* filter="PMD Files|*.pmd|0ADM Files|*.0adm||";
|
||||||
|
CFileDialog dlg(TRUE,"pmd",0,OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,filter,0);
|
||||||
|
dlg.m_ofn.lpstrInitialDir=g_UserCfg.GetOptionString(CFG_MODELLOADDIR);
|
||||||
|
|
||||||
|
if (dlg.DoModal()==IDOK) {
|
||||||
|
CStr filename=MakeRelativeFileName(dlg.m_ofn.lpstrFile);
|
||||||
|
|
||||||
|
CStr dir(dlg.m_ofn.lpstrFile);
|
||||||
|
dir=dir.Left(dlg.m_ofn.nFileOffset-1);
|
||||||
|
g_UserCfg.SetOptionString(CFG_MODELLOADDIR,(const char*) dir);
|
||||||
|
|
||||||
|
CWnd* texture=GetDlgItem(IDC_EDIT_MODEL);
|
||||||
|
texture->SetWindowText(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::UpdateEditorData()
|
||||||
|
{
|
||||||
|
if (!m_Object) {
|
||||||
|
g_ObjMan.SetSelectedObject(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString str;
|
||||||
|
|
||||||
|
CWnd* name=GetDlgItem(IDC_EDIT_NAME);
|
||||||
|
name->GetWindowText(str);
|
||||||
|
m_Object->m_Name=str;
|
||||||
|
|
||||||
|
CWnd* model=GetDlgItem(IDC_EDIT_MODEL);
|
||||||
|
model->GetWindowText(str);
|
||||||
|
m_Object->m_ModelName=str;
|
||||||
|
|
||||||
|
CWnd* texture=GetDlgItem(IDC_EDIT_TEXTURE);
|
||||||
|
texture->GetWindowText(str);
|
||||||
|
m_Object->m_TextureName=str;
|
||||||
|
|
||||||
|
CWnd* animation=GetDlgItem(IDC_EDIT_ANIMATION);
|
||||||
|
animation->GetWindowText(str);
|
||||||
|
if (m_Object->m_Animations.size()==0) {
|
||||||
|
m_Object->m_Animations.resize(1);
|
||||||
|
m_Object->m_Animations[0].m_AnimName="Idle";
|
||||||
|
}
|
||||||
|
m_Object->m_Animations[0].m_FileName=str;
|
||||||
|
|
||||||
|
std::vector<CUnit*> animupdatelist;
|
||||||
|
const std::vector<CUnit*>& units=g_UnitMan.GetUnits();
|
||||||
|
for (uint i=0;i<units.size();++i) {
|
||||||
|
if (units[i]->GetModel()->GetModelDef()==m_Object->m_Model->GetModelDef()) {
|
||||||
|
animupdatelist.push_back(units[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_Object->BuildModel()) {
|
||||||
|
g_ObjMan.SetSelectedObject(m_Object);
|
||||||
|
CSkeletonAnim* anim=m_Object->m_Model->GetAnimation();
|
||||||
|
if (anim) {
|
||||||
|
for (uint i=0;i<animupdatelist.size();++i) {
|
||||||
|
animupdatelist[i]->GetModel()->SetAnimation(anim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g_ObjMan.SetSelectedObject(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::UpdatePropertiesDlg()
|
||||||
|
{
|
||||||
|
if (!m_Object) return;
|
||||||
|
|
||||||
|
CWnd* name=GetDlgItem(IDC_EDIT_NAME);
|
||||||
|
if (name) {
|
||||||
|
name->SetWindowText(m_Object->m_Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
CWnd* model=GetDlgItem(IDC_EDIT_MODEL);
|
||||||
|
if (model) {
|
||||||
|
model->SetWindowText(m_Object->m_ModelName);
|
||||||
|
}
|
||||||
|
|
||||||
|
CWnd* texture=GetDlgItem(IDC_EDIT_TEXTURE);
|
||||||
|
if (texture) {
|
||||||
|
texture->SetWindowText(m_Object->m_TextureName);
|
||||||
|
}
|
||||||
|
|
||||||
|
CWnd* animation=GetDlgItem(IDC_EDIT_ANIMATION);
|
||||||
|
if (animation) {
|
||||||
|
if (m_Object->m_Animations.size()>0) {
|
||||||
|
animation->SetWindowText(m_Object->m_Animations[0].m_FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CUnitPropertiesDlgBar::SetObject(CObjectEntry* obj)
|
||||||
|
{
|
||||||
|
m_Object=obj;
|
||||||
|
if (m_Object) {
|
||||||
|
if (m_Object->BuildModel()) {
|
||||||
|
g_ObjMan.SetSelectedObject(m_Object);
|
||||||
|
} else {
|
||||||
|
g_ObjMan.SetSelectedObject(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UpdatePropertiesDlg();
|
||||||
|
}
|
40
source/sced/UnitPropertiesDlgBar.h
Executable file
40
source/sced/UnitPropertiesDlgBar.h
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#ifndef _UNITPROPERTIESDLGBAR_H
|
||||||
|
#define _UNITPROPERTIESDLGBAR_H
|
||||||
|
|
||||||
|
#include "ObjectEntry.h"
|
||||||
|
|
||||||
|
class CUnitPropertiesDlgBar : public CDialogBar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CUnitPropertiesDlgBar();
|
||||||
|
~CUnitPropertiesDlgBar();
|
||||||
|
|
||||||
|
BOOL Create(CWnd * pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID);
|
||||||
|
BOOL Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID);
|
||||||
|
void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
|
||||||
|
|
||||||
|
void SetObject(CObjectEntry* obj);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL OnInitDialog();
|
||||||
|
|
||||||
|
void UpdateEditorData();
|
||||||
|
void UpdatePropertiesDlg();
|
||||||
|
|
||||||
|
// object being edited
|
||||||
|
CObjectEntry* m_Object;
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CUnitPropertiesDlgBar)
|
||||||
|
afx_msg void OnButtonBack();
|
||||||
|
afx_msg void OnButtonRefresh();
|
||||||
|
afx_msg void OnButtonTextureBrowse();
|
||||||
|
afx_msg void OnButtonModelBrowse();
|
||||||
|
afx_msg void OnButtonAnimationBrowse();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
82
source/sced/UnitPropertiesTabCtrl.cpp
Executable file
82
source/sced/UnitPropertiesTabCtrl.cpp
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
// UnitPropertiesTabCtrl.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "UnitPropertiesTabCtrl.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesTabCtrl
|
||||||
|
|
||||||
|
CUnitPropertiesTabCtrl::CUnitPropertiesTabCtrl()
|
||||||
|
{
|
||||||
|
m_TexturesTab=new CUnitPropertiesTexturesTab;
|
||||||
|
m_AnimationsTab=new CUnitPropertiesAnimationsTab;
|
||||||
|
m_tabPages[0]=m_TexturesTab;
|
||||||
|
m_tabPages[1]=m_AnimationsTab;
|
||||||
|
m_nNumberOfPages=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
CUnitPropertiesTabCtrl::~CUnitPropertiesTabCtrl()
|
||||||
|
{
|
||||||
|
delete m_TexturesTab;
|
||||||
|
delete m_AnimationsTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CUnitPropertiesTabCtrl, CTabCtrl)
|
||||||
|
//{{AFX_MSG_MAP(CUnitPropertiesTabCtrl)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesTabCtrl message handlers
|
||||||
|
|
||||||
|
void CUnitPropertiesTabCtrl::Init()
|
||||||
|
{
|
||||||
|
m_tabCurrent=0;
|
||||||
|
|
||||||
|
PSTR pszTabItems[] = {
|
||||||
|
"Textures",
|
||||||
|
"Animations",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
TC_ITEM tcItem;
|
||||||
|
for(INT i = 0; pszTabItems[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
tcItem.mask = TCIF_TEXT;
|
||||||
|
tcItem.pszText = pszTabItems[i];
|
||||||
|
tcItem.cchTextMax = strlen(pszTabItems[i]);
|
||||||
|
InsertItem(i,&tcItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_TexturesTab->Create(IDD_UNITPROPERTIES_TEXTURES,this);
|
||||||
|
m_AnimationsTab->Create(IDD_UNITPROPERTIES_ANIMATIONS,this);
|
||||||
|
|
||||||
|
m_TexturesTab->ShowWindow(SW_SHOW);
|
||||||
|
m_AnimationsTab->ShowWindow(SW_HIDE);
|
||||||
|
|
||||||
|
|
||||||
|
CRect tabRect, itemRect;
|
||||||
|
int nX, nY, nXc, nYc;
|
||||||
|
|
||||||
|
GetClientRect(&tabRect);
|
||||||
|
GetItemRect(0, &itemRect);
|
||||||
|
|
||||||
|
nX=itemRect.left;
|
||||||
|
nY=itemRect.bottom+1;
|
||||||
|
nXc=tabRect.right-itemRect.left-1;
|
||||||
|
nYc=tabRect.bottom-nY-1;
|
||||||
|
|
||||||
|
m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
|
||||||
|
for(int nCount=1; nCount < m_nNumberOfPages; nCount++){
|
||||||
|
m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
|
||||||
|
}
|
||||||
|
}
|
58
source/sced/UnitPropertiesTabCtrl.h
Executable file
58
source/sced/UnitPropertiesTabCtrl.h
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
#if !defined(AFX_UNITPROPERTIESTABCTRL_H__65018BF5_3893_4430_AA1D_743F79904748__INCLUDED_)
|
||||||
|
#define AFX_UNITPROPERTIESTABCTRL_H__65018BF5_3893_4430_AA1D_743F79904748__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// UnitPropertiesTabCtrl.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "UnitPropertiesTexturesTab.h"
|
||||||
|
#include "UnitPropertiesAnimationsTab.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesTabCtrl window
|
||||||
|
|
||||||
|
class CUnitPropertiesTabCtrl : public CTabCtrl
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CUnitPropertiesTabCtrl();
|
||||||
|
|
||||||
|
CDialog *m_tabPages[2];
|
||||||
|
int m_tabCurrent;
|
||||||
|
int m_nNumberOfPages;
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
public:
|
||||||
|
CUnitPropertiesTexturesTab* m_TexturesTab;
|
||||||
|
CUnitPropertiesAnimationsTab* m_AnimationsTab;
|
||||||
|
|
||||||
|
// Operations
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CUnitPropertiesTabCtrl)
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
public:
|
||||||
|
virtual ~CUnitPropertiesTabCtrl();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
protected:
|
||||||
|
//{{AFX_MSG(CUnitPropertiesTabCtrl)
|
||||||
|
//}}AFX_MSG
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_UNITPROPERTIESTABCTRL_H__65018BF5_3893_4430_AA1D_743F79904748__INCLUDED_)
|
43
source/sced/UnitPropertiesTexturesTab.cpp
Executable file
43
source/sced/UnitPropertiesTexturesTab.cpp
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
// UnitPropertiesTexturesTab.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ScEd.h"
|
||||||
|
#include "UnitPropertiesTexturesTab.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesTexturesTab dialog
|
||||||
|
|
||||||
|
|
||||||
|
CUnitPropertiesTexturesTab::CUnitPropertiesTexturesTab(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CUnitPropertiesTexturesTab::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CUnitPropertiesTexturesTab)
|
||||||
|
// NOTE: the ClassWizard will add member initialization here
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CUnitPropertiesTexturesTab::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CUnitPropertiesTexturesTab)
|
||||||
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CUnitPropertiesTexturesTab, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CUnitPropertiesTexturesTab)
|
||||||
|
// NOTE: the ClassWizard will add message map macros here
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesTexturesTab message handlers
|
46
source/sced/UnitPropertiesTexturesTab.h
Executable file
46
source/sced/UnitPropertiesTexturesTab.h
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#if !defined(AFX_UNITPROPERTIESTEXTURESTAB_H__5F56FF68_6305_4E2E_BC75_6CF208ED2DBB__INCLUDED_)
|
||||||
|
#define AFX_UNITPROPERTIESTEXTURESTAB_H__5F56FF68_6305_4E2E_BC75_6CF208ED2DBB__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER > 1000
|
||||||
|
// UnitPropertiesTexturesTab.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CUnitPropertiesTexturesTab dialog
|
||||||
|
|
||||||
|
class CUnitPropertiesTexturesTab : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CUnitPropertiesTexturesTab(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CUnitPropertiesTexturesTab)
|
||||||
|
enum { IDD = IDD_UNITPROPERTIES_TEXTURES };
|
||||||
|
// NOTE: the ClassWizard will add data members here
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CUnitPropertiesTexturesTab)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CUnitPropertiesTexturesTab)
|
||||||
|
// NOTE: the ClassWizard will add member functions here
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_UNITPROPERTIESTEXTURESTAB_H__5F56FF68_6305_4E2E_BC75_6CF208ED2DBB__INCLUDED_)
|
226
source/sced/UnitToolsDlgBar.cpp
Executable file
226
source/sced/UnitToolsDlgBar.cpp
Executable file
@ -0,0 +1,226 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
#include "SimpleEdit.h"
|
||||||
|
#include "ObjectManager.h"
|
||||||
|
#include "UnitToolsDlgBar.h"
|
||||||
|
#include "PaintObjectTool.h"
|
||||||
|
#include "SelectObjectTool.h"
|
||||||
|
#include "ToolManager.h"
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CUnitToolsDlgBar, CDialogBar)
|
||||||
|
//{{AFX_MSG_MAP(CUnitToolsDlgBar)
|
||||||
|
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_SELECT, OnButtonSelect)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_ADDUNIT, OnButtonAddUnit)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_ADD, OnButtonAdd)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_EDIT, OnButtonEdit)
|
||||||
|
ON_NOTIFY(NM_CLICK, IDC_LIST_OBJECTBROWSER, OnClickListObjectBrowser)
|
||||||
|
ON_CBN_SELCHANGE(IDC_COMBO_OBJECTTYPES, OnSelChangeObjectTypes)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
CUnitToolsDlgBar::CUnitToolsDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CUnitToolsDlgBar::~CUnitToolsDlgBar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CUnitToolsDlgBar::Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!CDialogBar::Create(pParentWnd, lpszTemplateName, nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!OnInitDialog()) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CUnitToolsDlgBar::Create(CWnd * pParentWnd, UINT nIDTemplate,UINT nStyle, UINT nID)
|
||||||
|
{
|
||||||
|
if (!Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CUnitToolsDlgBar::OnInitDialog()
|
||||||
|
{
|
||||||
|
// get the current window size and position
|
||||||
|
CRect rect;
|
||||||
|
GetWindowRect(rect);
|
||||||
|
|
||||||
|
// now change the size, position, and Z order of the window.
|
||||||
|
::SetWindowPos(m_hWnd,HWND_TOPMOST,10,rect.top,rect.Width(),rect.Height(),SWP_HIDEWINDOW);
|
||||||
|
|
||||||
|
// setup the list ctrl
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_OBJECTBROWSER);
|
||||||
|
listctrl->GetClientRect(&rect);
|
||||||
|
listctrl->InsertColumn(0,_T("Item Name"),LVCFMT_LEFT,rect.Width());
|
||||||
|
|
||||||
|
|
||||||
|
// build combo box for object types
|
||||||
|
CComboBox* objecttypes=(CComboBox*) GetDlgItem(IDC_COMBO_OBJECTTYPES);
|
||||||
|
|
||||||
|
const std::vector<CObjectManager::SObjectType>& types=g_ObjMan.m_ObjectTypes;
|
||||||
|
for (uint i=0;i<types.size();i++) {
|
||||||
|
objecttypes->AddString((const char*) types[i].m_Name);
|
||||||
|
}
|
||||||
|
if (types.size()>0) {
|
||||||
|
// select first type
|
||||||
|
objecttypes->SetCurSel(0);
|
||||||
|
|
||||||
|
// set initial list contents
|
||||||
|
if (types.size()) {
|
||||||
|
const std::vector<CObjectEntry*>& objects=types[0].m_Objects;
|
||||||
|
for (uint i=0;i<objects.size();++i) {
|
||||||
|
listctrl->InsertItem(i,(const char*) objects[i]->m_Name,i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CButton* addunit=(CButton*) GetDlgItem(IDC_BUTTON_ADDUNIT);
|
||||||
|
addunit->SetBitmap(::LoadBitmap(::GetModuleHandle(0),MAKEINTRESOURCE(IDB_BITMAP_ADDUNIT)));
|
||||||
|
|
||||||
|
CButton* selectunit=(CButton*) GetDlgItem(IDC_BUTTON_SELECT);
|
||||||
|
selectunit->SetBitmap(::LoadBitmap(::GetModuleHandle(0),MAKEINTRESOURCE(IDB_BITMAP_SELECTUNIT)));
|
||||||
|
|
||||||
|
OnButtonSelect();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
|
||||||
|
{
|
||||||
|
bDisableIfNoHndler = FALSE;
|
||||||
|
CDialogBar::OnUpdateCmdUI(pTarget,bDisableIfNoHndler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::OnButtonAdd()
|
||||||
|
{
|
||||||
|
bool foundname=false;
|
||||||
|
CSimpleEdit dlg("Enter Object Name");
|
||||||
|
while (!foundname && dlg.DoModal()==IDOK) {
|
||||||
|
// get object name
|
||||||
|
CString& name=dlg.m_Text;
|
||||||
|
if (name.GetLength()==0) {
|
||||||
|
MessageBox("Bad name","Error");
|
||||||
|
} else if (g_ObjMan.FindObject(name)!=0) {
|
||||||
|
MessageBox("Object with that name already exists","Error");
|
||||||
|
} else {
|
||||||
|
// add to list ctrl
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_OBJECTBROWSER);
|
||||||
|
int index=listctrl->GetItemCount();
|
||||||
|
listctrl->InsertItem(index,(const char*) name,index);
|
||||||
|
|
||||||
|
// deselect current selection in list ctrl, if any
|
||||||
|
POSITION pos=listctrl->GetFirstSelectedItemPosition();
|
||||||
|
if (pos) {
|
||||||
|
int oldindex=listctrl->GetNextSelectedItem(pos);
|
||||||
|
listctrl->SetItemState(oldindex, 0, LVIS_SELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// select new entry
|
||||||
|
listctrl->SetItemState(index, LVIS_SELECTED, LVIS_SELECTED);
|
||||||
|
|
||||||
|
// now enter edit mode
|
||||||
|
CObjectEntry* obj=new CObjectEntry(GetCurrentObjectType());
|
||||||
|
obj->m_Name=name;
|
||||||
|
g_ObjMan.AddObject(obj,GetCurrentObjectType());
|
||||||
|
|
||||||
|
CMainFrame* mainfrm=(CMainFrame*) AfxGetMainWnd();
|
||||||
|
mainfrm->OnObjectProperties(obj);
|
||||||
|
foundname=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::OnButtonEdit()
|
||||||
|
{
|
||||||
|
// get current selection, if any
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_OBJECTBROWSER);
|
||||||
|
POSITION pos=listctrl->GetFirstSelectedItemPosition();
|
||||||
|
if (!pos) {
|
||||||
|
// nothing selected, nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get object at position
|
||||||
|
const std::vector<CObjectEntry*>& objects=g_ObjMan.m_ObjectTypes[GetCurrentObjectType()].m_Objects;
|
||||||
|
CObjectEntry* obj=objects[(int) pos-1];
|
||||||
|
CMainFrame* mainfrm=(CMainFrame*) AfxGetMainWnd();
|
||||||
|
mainfrm->OnObjectProperties(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::OnClickListObjectBrowser(NMHDR* pNMHDR, LRESULT* pResult)
|
||||||
|
{
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_OBJECTBROWSER);
|
||||||
|
|
||||||
|
// deselect current selection in list ctrl, if any
|
||||||
|
POSITION pos=listctrl->GetFirstSelectedItemPosition();
|
||||||
|
if (pos) {
|
||||||
|
g_ObjMan.SetSelectedObject(g_ObjMan.m_ObjectTypes[GetCurrentObjectType()].m_Objects[(int) pos-1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// shift to add mode
|
||||||
|
SetAddUnitMode();
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CUnitToolsDlgBar::GetCurrentObjectType()
|
||||||
|
{
|
||||||
|
CComboBox* objecttypes=(CComboBox*) GetDlgItem(IDC_COMBO_OBJECTTYPES);
|
||||||
|
return objecttypes->GetCurSel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::OnSelChangeObjectTypes()
|
||||||
|
{
|
||||||
|
// clear out the listctrl
|
||||||
|
CListCtrl* listctrl=(CListCtrl*) GetDlgItem(IDC_LIST_OBJECTBROWSER);
|
||||||
|
listctrl->DeleteAllItems();
|
||||||
|
|
||||||
|
// add new items back to listbox
|
||||||
|
std::vector<CObjectEntry*>& objects=g_ObjMan.m_ObjectTypes[GetCurrentObjectType()].m_Objects;
|
||||||
|
for (uint i=0;i<objects.size();i++) {
|
||||||
|
// add to list ctrl
|
||||||
|
listctrl->InsertItem(i,(const char*) objects[i]->m_Name,i);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_ObjMan.SetSelectedObject(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::OnButtonSelect()
|
||||||
|
{
|
||||||
|
SetSelectMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::SetSelectMode()
|
||||||
|
{
|
||||||
|
((CButton*) GetDlgItem(IDC_BUTTON_SELECT))->SetState(TRUE);
|
||||||
|
((CButton*) GetDlgItem(IDC_BUTTON_ADDUNIT))->SetState(FALSE);
|
||||||
|
m_Mode=SELECT_MODE;
|
||||||
|
g_ToolMan.SetActiveTool(CSelectObjectTool::GetTool());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::OnButtonAddUnit()
|
||||||
|
{
|
||||||
|
SetAddUnitMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUnitToolsDlgBar::SetAddUnitMode()
|
||||||
|
{
|
||||||
|
((CButton*) GetDlgItem(IDC_BUTTON_SELECT))->SetState(FALSE);
|
||||||
|
((CButton*) GetDlgItem(IDC_BUTTON_ADDUNIT))->SetState(TRUE);
|
||||||
|
m_Mode=ADDUNIT_MODE;
|
||||||
|
g_ToolMan.SetActiveTool(CPaintObjectTool::GetTool());
|
||||||
|
}
|
36
source/sced/UnitToolsDlgBar.h
Executable file
36
source/sced/UnitToolsDlgBar.h
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef _UNITTOOLSDLGBAR_H
|
||||||
|
#define _UNITTOOLSDLGBAR_H
|
||||||
|
|
||||||
|
class CUnitToolsDlgBar : public CDialogBar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CUnitToolsDlgBar();
|
||||||
|
~CUnitToolsDlgBar();
|
||||||
|
|
||||||
|
BOOL Create(CWnd * pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID);
|
||||||
|
BOOL Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName, UINT nStyle, UINT nID);
|
||||||
|
void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
|
||||||
|
|
||||||
|
enum { SELECT_MODE, ADDUNIT_MODE } m_Mode;
|
||||||
|
|
||||||
|
void SetSelectMode();
|
||||||
|
void SetAddUnitMode();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL OnInitDialog();
|
||||||
|
int GetCurrentObjectType();
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CUnitToolsDlgBar)
|
||||||
|
afx_msg void OnButtonAdd();
|
||||||
|
afx_msg void OnButtonEdit();
|
||||||
|
afx_msg void OnButtonAddUnit();
|
||||||
|
afx_msg void OnButtonSelect();
|
||||||
|
afx_msg void OnClickListObjectBrowser(NMHDR* pNMHDR, LRESULT* pResult);
|
||||||
|
afx_msg void CUnitToolsDlgBar::OnSelChangeObjectTypes();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
126
source/sced/UserConfig.cpp
Executable file
126
source/sced/UserConfig.cpp
Executable file
@ -0,0 +1,126 @@
|
|||||||
|
#include "UserConfig.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
CUserConfig g_UserCfg;
|
||||||
|
|
||||||
|
CUserConfig::CUserConfig()
|
||||||
|
{
|
||||||
|
m_ScrollSpeed=5;
|
||||||
|
m_MapLoadDir="mods\\official\\maps\\scenarios";
|
||||||
|
m_MapSaveDir="mods\\official\\maps\\scenarios";
|
||||||
|
m_TerrainLoadDir="mods\\official\\art\\textures\\terrain";
|
||||||
|
m_TerrainSaveDir="mods\\official\\art\\textures\\terrain";
|
||||||
|
m_PMDSaveDir=".";
|
||||||
|
m_ModelLoadDir="mods\\official\\art\\meshes";
|
||||||
|
m_ModelTexLoadDir="mods\\official\\art\\textures\\skins";
|
||||||
|
m_ModelAnimationDir="mods\\official\\art\\animation";
|
||||||
|
m_TextureExt="dds";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUserConfig::SetOptionString(ECfgOption opt,const char* str)
|
||||||
|
{
|
||||||
|
switch (opt) {
|
||||||
|
case CFG_MAPLOADDIR:
|
||||||
|
m_MapLoadDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_MAPSAVEDIR:
|
||||||
|
m_MapSaveDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_TERRAINLOADDIR:
|
||||||
|
m_TerrainLoadDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_TERRAINSAVEDIR:
|
||||||
|
m_TerrainSaveDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_PMDSAVEDIR:
|
||||||
|
m_PMDSaveDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_MODELLOADDIR:
|
||||||
|
m_ModelLoadDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_MODELTEXLOADDIR:
|
||||||
|
m_ModelTexLoadDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_MODELANIMATIONDIR:
|
||||||
|
m_ModelAnimationDir=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CFG_TEXTUREEXT:
|
||||||
|
m_TextureExt=str;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert(0 && "unhandled case statement");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CUserConfig::GetOptionString(ECfgOption opt)
|
||||||
|
{
|
||||||
|
switch (opt) {
|
||||||
|
case CFG_MAPLOADDIR:
|
||||||
|
return (const char*) m_MapLoadDir;
|
||||||
|
|
||||||
|
case CFG_MAPSAVEDIR:
|
||||||
|
return (const char*) m_MapSaveDir;
|
||||||
|
|
||||||
|
case CFG_TERRAINLOADDIR:
|
||||||
|
return (const char*) m_TerrainLoadDir;
|
||||||
|
|
||||||
|
case CFG_TERRAINSAVEDIR:
|
||||||
|
return (const char*) m_TerrainSaveDir;
|
||||||
|
|
||||||
|
case CFG_PMDSAVEDIR:
|
||||||
|
return (const char*) m_PMDSaveDir;
|
||||||
|
|
||||||
|
case CFG_MODELLOADDIR:
|
||||||
|
return (const char*) m_ModelLoadDir;
|
||||||
|
|
||||||
|
case CFG_MODELTEXLOADDIR:
|
||||||
|
return (const char*) m_ModelTexLoadDir;
|
||||||
|
|
||||||
|
case CFG_MODELANIMATIONDIR:
|
||||||
|
return (const char*) m_ModelAnimationDir;
|
||||||
|
|
||||||
|
case CFG_TEXTUREEXT:
|
||||||
|
return (const char*) m_TextureExt;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert(0 && "unhandled case statement");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CUserConfig::SetOptionInt(ECfgOption opt,int value)
|
||||||
|
{
|
||||||
|
switch (opt) {
|
||||||
|
case CFG_SCROLLSPEED:
|
||||||
|
m_ScrollSpeed=value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert(0 && "unhandled case statement");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CUserConfig::GetOptionInt(ECfgOption opt)
|
||||||
|
{
|
||||||
|
switch (opt) {
|
||||||
|
case CFG_SCROLLSPEED:
|
||||||
|
return m_ScrollSpeed;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert(0 && "unhandled case statement");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
55
source/sced/UserConfig.h
Executable file
55
source/sced/UserConfig.h
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#ifndef _USERCONFIG_H
|
||||||
|
#define _USERCONFIG_H
|
||||||
|
|
||||||
|
#include "ps\CStr.h"
|
||||||
|
|
||||||
|
enum ECfgOption {
|
||||||
|
CFG_MAPLOADDIR,
|
||||||
|
CFG_MAPSAVEDIR,
|
||||||
|
CFG_TERRAINLOADDIR,
|
||||||
|
CFG_TERRAINSAVEDIR,
|
||||||
|
CFG_PMDSAVEDIR,
|
||||||
|
CFG_MODELLOADDIR,
|
||||||
|
CFG_MODELTEXLOADDIR,
|
||||||
|
CFG_MODELANIMATIONDIR,
|
||||||
|
CFG_TEXTUREEXT,
|
||||||
|
CFG_SCROLLSPEED
|
||||||
|
};
|
||||||
|
|
||||||
|
class CUserConfig
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CUserConfig();
|
||||||
|
|
||||||
|
void SetOptionString(ECfgOption opt,const char* str);
|
||||||
|
const char* GetOptionString(ECfgOption opt);
|
||||||
|
|
||||||
|
void SetOptionInt(ECfgOption opt,int value);
|
||||||
|
int GetOptionInt(ECfgOption opt);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// map load directory
|
||||||
|
CStr m_MapLoadDir;
|
||||||
|
// map save directory
|
||||||
|
CStr m_MapSaveDir;
|
||||||
|
// terrain load directory
|
||||||
|
CStr m_TerrainLoadDir;
|
||||||
|
// terrain save directory
|
||||||
|
CStr m_TerrainSaveDir;
|
||||||
|
// PMD save directory
|
||||||
|
CStr m_PMDSaveDir;
|
||||||
|
// model load directory
|
||||||
|
CStr m_ModelLoadDir;
|
||||||
|
// model texture load directory
|
||||||
|
CStr m_ModelTexLoadDir;
|
||||||
|
// model animation load directory
|
||||||
|
CStr m_ModelAnimationDir;
|
||||||
|
// texture file extension
|
||||||
|
CStr m_TextureExt;
|
||||||
|
// map scroll speed
|
||||||
|
int m_ScrollSpeed;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CUserConfig g_UserCfg;
|
||||||
|
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user