This commit is contained in:
Daveo 2001-03-29 17:59:01 +00:00
parent e6097f7417
commit 826713a65c
23 changed files with 1118 additions and 325 deletions

View File

@ -27,12 +27,22 @@ enum CmdMsg
CmdMsg_SubViewDelete, // 14 CmdMsg_SubViewDelete, // 14
CmdMsg_SubViewUpdate, // 15 CmdMsg_SubViewUpdate, // 15
CmdMsg_SubViewSet, // 16 CmdMsg_SubViewSet, // 16
// TileLayer/TileBank // TileLayer/TileBank
CmdMsg_MirrorX, // 17 CmdMsg_MirrorX, // 17
CmdMsg_MirrorY, // 18 CmdMsg_MirrorY, // 18
CmdMsg_SetColFlag, // 19 CmdMsg_SetColFlag, // 19
CmdMsg_ActiveBrushLeft, // 20 CmdMsg_ActiveBrushLeft, // 20
CmdMsg_ActiveBrushRight, // 21 CmdMsg_ActiveBrushRight, // 21
// Thing
CmdMsg_ThingListDelete, // 23
CmdMsg_ThingListSelect, // 24
CmdMsg_ThingLevelSelect, // 25
CmdMsg_ThingPosSelect, // 26
CmdMsg_ThingPosUp, // 27
CmdMsg_ThingPosDown, // 28
CmdMsg_ThingPosDelete, // 29
}; };
#endif #endif
/*****************************************************************************/ /*****************************************************************************/

View File

@ -33,7 +33,7 @@
#include <IniClass.h> #include <IniClass.h>
GString IconzFileName="Iconz.bmp"; //GString IconzFileName="Iconz.bmp";
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
@ -53,7 +53,7 @@ GString Filename;
IconBank=new CElemBank(16,16,false,false); IconBank=new CElemBank(16,16,false,false);
GetExecPath(Filename); GetExecPath(Filename);
Filename+=IconzFileName; Filename+=theApp.GetConfigStr("FileLocation","Iconz");
IconBank->AddSet(Filename); IconBank->AddSet(Filename);
} }
@ -71,8 +71,8 @@ bool CCore::New()
{ {
CGUINewMap Dlg; CGUINewMap Dlg;
int Width,Height; int Width,Height;
Dlg.m_Width=TileLayerMinWidth; Dlg.m_Width=TileLayerMinWidth+2;
Dlg.m_Height=TileLayerMinHeight; Dlg.m_Height=TileLayerMinHeight+2;
#ifndef _DEBUG #ifndef _DEBUG
if (Dlg.DoModal()!=IDOK) return FALSE; if (Dlg.DoModal()!=IDOK) return FALSE;
@ -82,7 +82,7 @@ int Width,Height;
// Create Tile Layers // Create Tile Layers
AddLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION, Width, Height); AddLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION, Width, Height);
// AddLayer(LAYER_TYPE_ACTOR,LAYER_SUBTYPE_NONE, Width, Height); AddLayer(LAYER_TYPE_ACTOR,LAYER_SUBTYPE_NONE, Width, Height);
for (int i=0; i<Layer.size(); i++) for (int i=0; i<Layer.size(); i++)
{ {
@ -262,6 +262,20 @@ CLayer *ThisLayer;
} }
/*****************************************************************************/
void CCore::RenderNumber(int No)
{
int T=No/10;
int U=No%10;
glPushMatrix();
IconBank->RenderElem(0,T,0,false);
glTranslatef(0.5f,0,0);
IconBank->RenderElem(0,U,0,false);
glPopMatrix();
}
/*****************************************************************************/ /*****************************************************************************/
/*** Control *****************************************************************/ /*** Control *****************************************************************/
/*****************************************************************************/ /*****************************************************************************/
@ -667,6 +681,7 @@ Vector3 &ThisCam=GetCam();
/*****************************************************************************/ /*****************************************************************************/
void CCore::GetExecPath(GString &Path) void CCore::GetExecPath(GString &Path)
{ {
#ifndef _DEBUG
// Get application path // Get application path
char ExeFilename[2048]; char ExeFilename[2048];
GFName Exe; GFName Exe;
@ -675,6 +690,7 @@ GFName Exe;
Exe.File(0); Exe.File(0);
Exe.Ext(0); Exe.Ext(0);
Path=Exe.FullName(); Path=Exe.FullName();
#endif
} }

View File

@ -43,6 +43,7 @@ public:
bool Question(char *Txt); bool Question(char *Txt);
void Render(bool ForceRender=FALSE); void Render(bool ForceRender=FALSE);
void RenderLayers(bool OneShot=false); void RenderLayers(bool OneShot=false);
void RenderNumber(int No);
void Export(char *Filename); void Export(char *Filename);
// View Stuff // View Stuff
@ -116,6 +117,7 @@ public:
void ResetView(); void ResetView();
CElemBank *GetIconBank() {return(IconBank);} CElemBank *GetIconBank() {return(IconBank);}
void GetExecPath(GString &Path); void GetExecPath(GString &Path);
private: private:
CMapEditView *CurrentView; CMapEditView *CurrentView;
CPoint CurrentMousePos,LastMousePos; CPoint CurrentMousePos,LastMousePos;

View File

@ -108,5 +108,17 @@ BOOL operator==(sExpMapElem const &v1)
}; };
*/ */
/*****************************************************************************/ /*****************************************************************************/
/*** Things ******************************************************************/
/*****************************************************************************/
struct sExpLayerActor
{
int Speed;
int TurnRate;
int Health;
int AttackStrength;
bool CollisionFlag;
bool PlayerFlag;
int Spare[8];
};
#endif #endif

View File

@ -5,6 +5,9 @@
#include "mapedit.h" #include "mapedit.h"
#include "GUILayerActor.h" #include "GUILayerActor.h"
#include "MapEditDoc.h"
#include "MainFrm.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
@ -18,9 +21,10 @@ static char THIS_FILE[] = __FILE__;
CGUILayerActor::CGUILayerActor(CWnd* pParent /*=NULL*/) CGUILayerActor::CGUILayerActor(CWnd* pParent /*=NULL*/)
: CDialog(CGUILayerActor::IDD, pParent) : CDialog(CGUILayerActor::IDD, pParent)
{ {
DisableCallback(true);
//{{AFX_DATA_INIT(CGUILayerActor) //{{AFX_DATA_INIT(CGUILayerActor)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
DisableCallback(false);
} }
@ -28,16 +32,70 @@ void CGUILayerActor::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGUILayerActor) //{{AFX_DATA_MAP(CGUILayerActor)
// NOTE: the ClassWizard will add DDX and DDV calls here DDX_Control(pDX, IDC_ACTOR_COLLISION, m_Collision);
DDX_Control(pDX, IDC_ACTOR_PLAYER, m_Player);
DDX_Control(pDX, IDC_ACTOR_TURNRATE, m_TurnRate);
DDX_Control(pDX, IDC_ACTOR_SPEED, m_Speed);
DDX_Control(pDX, IDC_ACTOR_ATTACK, m_Attack);
DDX_Control(pDX, IDC_ACTOR_HEALTH, m_Health);
DDX_Control(pDX, IDC_LEVEL_ACTOR_LIST, m_LevelList);
DDX_Control(pDX, IDC_ACTOR_POS_LIST, m_PosList);
DDX_Control(pDX, IDC_ACTOR_LIST, m_List);
//}}AFX_DATA_MAP //}}AFX_DATA_MAP
} }
BEGIN_MESSAGE_MAP(CGUILayerActor, CDialog) BEGIN_MESSAGE_MAP(CGUILayerActor, CDialog)
//{{AFX_MSG_MAP(CGUILayerActor) //{{AFX_MSG_MAP(CGUILayerActor)
// NOTE: the ClassWizard will add message map macros here ON_BN_CLICKED(IDC_ACTOR_DELETE, OnActorDelete)
ON_BN_CLICKED(IDC_ACTOR_POS_UP, OnActorPosUp)
ON_BN_CLICKED(IDC_ACTOR_POS_DOWN, OnActorPosDown)
ON_BN_CLICKED(IDC_ACTOR_POS_DELETE, OnActorPosDelete)
ON_EN_CHANGE(IDC_ACTOR_HEALTH, OnChangeParam)
ON_CBN_SELCHANGE(IDC_ACTOR_LIST, OnSelchangeActorList)
ON_CBN_SELCHANGE(IDC_LEVEL_ACTOR_LIST, OnSelchangeLevelActorList)
ON_LBN_SELCHANGE(IDC_ACTOR_POS_LIST, OnSelchangeActorPosList)
ON_EN_CHANGE(IDC_ACTOR_ATTACK, OnChangeParam)
ON_BN_CLICKED(IDC_ACTOR_COLLISION, OnChangeParam)
ON_EN_CHANGE(IDC_ACTOR_SPEED, OnChangeParam)
ON_EN_CHANGE(IDC_ACTOR_TURNRATE, OnChangeParam)
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
END_MESSAGE_MAP() END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
void CGUILayerActor::SetVal(CEdit &Dlg,int Val)
{
CString Str;
if (!Dlg) return;
DisableCallback(true);
Str.Format("%i",Val);
Dlg.SetWindowText(Str);
DisableCallback(false);
}
/////////////////////////////////////////////////////////////////////////////
int CGUILayerActor::GetVal(CEdit &Dlg)
{
CString Str;
int Val=0;
if (!Dlg) return(0);
Dlg.GetWindowText(Str);
if (Str.GetLength())
Val=atoi(Str);
return(Val);
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CGUILayerActor message handlers // CGUILayerActor message handlers
void CGUILayerActor::OnSelchangeActorList() {theApp.GetCurrent()->Command(CmdMsg_ThingListSelect,m_List.GetCurSel());}
void CGUILayerActor::OnActorDelete() {theApp.GetCurrent()->Command(CmdMsg_ThingListDelete,m_List.GetCurSel());}
void CGUILayerActor::OnSelchangeLevelActorList() {theApp.GetCurrent()->Command(CmdMsg_ThingLevelSelect,m_LevelList.GetCurSel());}
void CGUILayerActor::OnSelchangeActorPosList() {theApp.GetCurrent()->Command(CmdMsg_ThingPosSelect,m_PosList.GetCurSel());}
void CGUILayerActor::OnActorPosUp() {theApp.GetCurrent()->Command(CmdMsg_ThingPosUp,m_PosList.GetCurSel());}
void CGUILayerActor::OnActorPosDown() {theApp.GetCurrent()->Command(CmdMsg_ThingPosDown,m_PosList.GetCurSel());}
void CGUILayerActor::OnActorPosDelete() {theApp.GetCurrent()->Command(CmdMsg_ThingPosDelete,m_PosList.GetCurSel());}
void CGUILayerActor::OnChangeParam() {if (!CallbackFlag) theApp.GetCurrent()->GUIChanged();}

View File

@ -19,7 +19,15 @@ public:
// Dialog Data // Dialog Data
//{{AFX_DATA(CGUILayerActor) //{{AFX_DATA(CGUILayerActor)
enum { IDD = IDD_LAYER_ACTOR }; enum { IDD = IDD_LAYER_ACTOR };
// NOTE: the ClassWizard will add data members here CButton m_Collision;
CButton m_Player;
CEdit m_TurnRate;
CEdit m_Speed;
CEdit m_Attack;
CEdit m_Health;
CComboBox m_LevelList;
CListBox m_PosList;
CComboBox m_List;
//}}AFX_DATA //}}AFX_DATA
@ -31,11 +39,24 @@ public:
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
// Implementation // Implementation
public:
void DisableCallback(bool f) {CallbackFlag=f;}
void SetVal(CEdit &Dlg,int Number);
int GetVal(CEdit &Dlg);
protected: protected:
bool CallbackFlag;
// Generated message map functions // Generated message map functions
//{{AFX_MSG(CGUILayerActor) //{{AFX_MSG(CGUILayerActor)
// NOTE: the ClassWizard will add member functions here afx_msg void OnActorDelete();
afx_msg void OnActorPosUp();
afx_msg void OnActorPosDown();
afx_msg void OnActorPosDelete();
afx_msg void OnChangeParam();
afx_msg void OnSelchangeActorList();
afx_msg void OnSelchangeLevelActorList();
afx_msg void OnSelchangeActorPosList();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };

View File

@ -30,9 +30,9 @@ void CGUINewMap::DoDataExchange(CDataExchange* pDX)
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGUINewMap) //{{AFX_DATA_MAP(CGUINewMap)
DDX_Text(pDX, IDC_MAPSIZE_HEIGHT, m_Height); DDX_Text(pDX, IDC_MAPSIZE_HEIGHT, m_Height);
DDV_MinMaxUInt(pDX, m_Height, 34, 1024); DDV_MinMaxUInt(pDX, m_Height, 24, 1024);
DDX_Text(pDX, IDC_MAPSIZE_WIDTH, m_Width); DDX_Text(pDX, IDC_MAPSIZE_WIDTH, m_Width);
DDV_MinMaxUInt(pDX, m_Width, 24, 1024); DDV_MinMaxUInt(pDX, m_Width, 34, 1024);
//}}AFX_DATA_MAP //}}AFX_DATA_MAP
} }

View File

@ -22,29 +22,16 @@
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
CLayerActor::CLayerActor(sLayerDef &Def) :CLayerThing(Def) CLayerActor::CLayerActor(sLayerDef &Def)
{ {
// CLayerThing::CLayerThing(_SubType,_Width,_Height); InitLayer(Def);
LoadThingScript("c:\\temp\\character.txt");
} }
/*****************************************************************************/ /*****************************************************************************/
//CLayerActor::CLayerActor(CFile *File,int Version) void CLayerActor::InitLayer(sLayerDef &Def)
//{
// CLayerThing::CLayerThing(File,Version);
//
//}
/*****************************************************************************/
void CLayerActor::Load(CFile *File,int Version)
{ {
// CLayerThing::Load(File,Version); CLayerThing::InitLayer(Def);
} LoadThingScript(theApp.GetConfigStr("LayerScript","ActorScript"));
/*****************************************************************************/
void CLayerActor::Save(CFile *File)
{
CLayerThing::Save(File);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -52,50 +39,148 @@ void CLayerActor::InitSubView(CCore *Core)
{ {
} }
/*****************************************************************************/
void CLayerActor::LoadThingScript(const char *Filename)
{
CLayerThing::LoadThingScript(Filename);
// CLayerThing::ThingScript.LoadAndImport(Filename);
int Count=ThingScript.GetGroupCount();
for (int i=0; i<Count; i++)
{
char *Name=ThingScript.GetGroupName(i);
char *Gfx=ThingScript.GetData(Name,"gfx");
TRACE2("%s\t\t%s\n",Name,Gfx);
if (Gfx) ThingBank->AddSet(Gfx);
}
}
/*****************************************************************************/ /*****************************************************************************/
/*** Gui *********************************************************************/ /*** Gui *********************************************************************/
/*****************************************************************************/ /*****************************************************************************/
void CLayerActor::GUIInit(CCore *Core) void CLayerActor::GUIInit(CCore *Core)
{ {
// Core->GUIAdd(GUIToolBar,IDD_TOOLBAR); GUI.DisableCallback(true);
Core->GUIAdd(GUI,IDD_LAYER_ACTOR);
GUI.DisableCallback(false);
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerActor::GUIKill(CCore *Core) void CLayerActor::GUIKill(CCore *Core)
{ {
// Core->GUIRemove(GUIToolBar,IDD_TOOLBAR); Core->GUIRemove(GUI,IDD_LAYER_ACTOR);
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerActor::GUIUpdate(CCore *Core) void CLayerActor::GUIUpdate(CCore *Core)
{ {
int i,ListSize;
CComboBox &List=GUI.m_List;
// Setup Def Actor List
ListSize=DefList.size();
List.ResetContent();
for (i=0; i<ListSize; i++)
{
List.AddString(DefList[i].Name);
}
List.SetCurSel(CurrentDefThing);
GUIThingUpdate();
}
/*****************************************************************************/
void CLayerActor::GUIThingDefClear()
{
CComboBox &List=GUI.m_List;
CurrentDefThing=-1;
List.SetCurSel(CurrentDefThing);
}
/*****************************************************************************/
void CLayerActor::GUIThingUpdate()
{
int i,ListSize;
CComboBox &List=GUI.m_LevelList;
// Setup ThingList
ListSize=ThingList.size();
TRACE1("%i\n",ListSize);
List.ResetContent();
for (i=0; i<ListSize; i++)
{
List.AddString(ThingList[i].Name);
}
List.SetCurSel(CurrentThing);
GUIThingPointUpdate();
// Params
GUI.DisableCallback(true);
if (CurrentThing!=-1)
{
sLayerThing &ThisThing=ThingList[CurrentThing];
GUI.SetVal(GUI.m_Speed,ThisThing.Data.Speed);
GUI.SetVal(GUI.m_TurnRate,ThisThing.Data.TurnRate);
GUI.SetVal(GUI.m_Health,ThisThing.Data.Health);
GUI.SetVal(GUI.m_Attack,ThisThing.Data.AttackStrength);
GUI.m_Collision.SetCheck(ThisThing.Data.CollisionFlag);
GUI.m_Player.SetCheck(ThisThing.Data.PlayerFlag);
}
else
{
GUI.m_Speed.SetWindowText("");
GUI.m_TurnRate.SetWindowText("");
GUI.m_Health.SetWindowText("");
GUI.m_Attack.SetWindowText("");
GUI.m_Collision.SetCheck(false);
GUI.m_Player.SetCheck(false);
}
GUI.DisableCallback(false);
}
/*****************************************************************************/
void CLayerActor::GUIThingPointUpdate()
{
int i,ListSize;
sLayerThing &ThisThing=ThingList[CurrentThing];
CListBox &List=GUI.m_PosList;
List.ResetContent();
if (CurrentThing==-1)
{
}
else
{
// Setup ThingPointList
ListSize=ThisThing.XY.size();
for (i=0; i<ListSize; i++)
{
CString Str;
Str.Format("%i: %i, %i",i,ThisThing.XY[i].x,ThisThing.XY[i].y);
List.AddString(Str);
}
List.SetCurSel(CurrentThingPoint);
}
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerActor::GUIChanged(CCore *Core) void CLayerActor::GUIChanged(CCore *Core)
{ {
if (CurrentThing!=-1)
{
sLayerThing &ThisThing=ThingList[CurrentThing];
ThisThing.Data.Speed=GUI.GetVal(GUI.m_Speed);
ThisThing.Data.TurnRate=GUI.GetVal(GUI.m_TurnRate);
ThisThing.Data.Health=GUI.GetVal(GUI.m_Health);
ThisThing.Data.AttackStrength=GUI.GetVal(GUI.m_Attack);
ThisThing.Data.CollisionFlag=GUI.m_Collision.GetCheck()!=0;
ThisThing.Data.PlayerFlag=GUI.m_Player.GetCheck()!=0;
}
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Functions ***************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ void CLayerActor::ExportThing(CExport &Exp,sLayerThing &ThisThing)
void CLayerActor::Export(CCore *Core,CExport &Exp)
{ {
int i,ListSize=ThisThing.XY.size();
sExpLayerActor OutThing;
// Point List
Exp.Write(&ListSize,sizeof(int));
for (i=0 ;i<ListSize; i++)
{
Exp.Write(&ThisThing.XY[i],sizeof(CPoint));
}
// Thing
OutThing.Health=ThisThing.Data.Health;
OutThing.AttackStrength=ThisThing.Data.AttackStrength;
OutThing.Speed=ThisThing.Data.Speed;
OutThing.TurnRate=ThisThing.Data.TurnRate;
OutThing.CollisionFlag=ThisThing.Data.CollisionFlag;
OutThing.PlayerFlag=ThisThing.Data.PlayerFlag;
Exp.Write(&OutThing,sizeof(sExpLayerActor));
} }

View File

@ -8,32 +8,34 @@
#include "LayerThing.h" #include "LayerThing.h"
#include "Layer.h" #include "Layer.h"
#include "MapEdit.h" #include "MapEdit.h"
#include "GUIToolbar.h" #include "GUILayerActor.h"
#include "Elem.h" #include "Elem.h"
/*****************************************************************************/ /*****************************************************************************/
class CLayerActor : public CLayerThing class CLayerActor : public CLayerThing
{ {
public: public:
// CLayerActor(int Type,int SubType,int Width,int Height);
CLayerActor(sLayerDef &Def); CLayerActor(sLayerDef &Def);
CLayerActor(CFile *File,int Version) {Load(File,Version);} CLayerActor(CFile *File,int Version) {Load(File,Version);}
void InitLayer(sLayerDef &Def);
void InitSubView(CCore *Core); void InitSubView(CCore *Core);
void GUIInit(CCore *Core); void GUIInit(CCore *Core);
void GUIKill(CCore *Core); void GUIKill(CCore *Core);
void GUIUpdate(CCore *Core); void GUIUpdate(CCore *Core);
void GUIChanged(CCore *Core); void GUIChanged(CCore *Core);
bool GUIReady();
void Load(CFile *File,int Version); void GUIThingDefClear();
void Save(CFile *File); void GUIThingUpdate();
void LoadThingScript(const char *Filename); void GUIThingPointUpdate();
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
void Export(CCore *Core,CExport &Exp);
protected: protected:
CGUIToolBar GUIToolBar; CGUILayerActor GUI;
}; };

View File

@ -21,8 +21,6 @@
#include "Select.h" #include "Select.h"
#include "Export.h" #include "Export.h"
GString ColFName="Collision.bmp";
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
@ -48,7 +46,7 @@ GString Filename;
SubView=TileBank; SubView=TileBank;
Core->GetExecPath(Filename); Core->GetExecPath(Filename);
Filename+=ColFName; Filename+=theApp.GetConfigStr("FileLocation","Collision");
TileBank->AddSet(Filename); TileBank->AddSet(Filename);
} }

View File

@ -1,6 +1,6 @@
/******************/ /**********************/
/*** Layer Item ***/ /*** Layer Item ***/
/******************/ /**********************/
#include "stdafx.h" #include "stdafx.h"
#include <Vector3.h> #include <Vector3.h>
@ -22,28 +22,16 @@
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
// New Layer CLayerItem::CLayerItem(sLayerDef &Def)
CLayerItem::CLayerItem(sLayerDef &Def) : CLayerThing (Def)
{ {
LoadThingScript("c:\\temp\\character.txt"); InitLayer(Def);
} }
/*****************************************************************************/ /*****************************************************************************/
//CLayerItem::CLayerItem(CFile *File,int Version) :CLayerThing (File,Version) void CLayerItem::InitLayer(sLayerDef &Def)
//{
//
//}
/*****************************************************************************/
void CLayerItem::Load(CFile *File,int Version)
{ {
CLayerThing::Load(File,Version); CLayerThing::InitLayer(Def);
} LoadThingScript(theApp.GetConfigStr("LayerScript","ItemScript"));
/*****************************************************************************/
void CLayerItem::Save(CFile *File)
{
CLayerThing::Save(File);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -51,51 +39,159 @@ void CLayerItem::InitSubView(CCore *Core)
{ {
} }
/*****************************************************************************/
void CLayerItem::LoadThingScript(const char *Filename)
{
CLayerThing::LoadThingScript(Filename);
// CLayerThing::ThingScript.LoadAndImport(Filename);
int Count=ThingScript.GetGroupCount();
for (int i=0; i<Count; i++)
{
char *Name=ThingScript.GetGroupName(i);
char *Gfx=ThingScript.GetData(Name,"gfx");
TRACE2("%s\t\t%s\n",Name,Gfx);
if (Gfx)
ThingBank->AddSet(Gfx);
}
}
/*****************************************************************************/ /*****************************************************************************/
/*** Gui *********************************************************************/ /*** Gui *********************************************************************/
/*****************************************************************************/ /*****************************************************************************/
void CLayerItem::GUIInit(CCore *Core) void CLayerItem::GUIInit(CCore *Core)
{ {
// Core->GUIAdd(GUIToolBar,IDD_TOOLBAR); // GUI.DisableCallback(true);
// Core->GUIAdd(GUI,IDD_LAYER_Item);
// GUI.DisableCallback(false);
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerItem::GUIKill(CCore *Core) void CLayerItem::GUIKill(CCore *Core)
{ {
// Core->GUIRemove(GUIToolBar,IDD_TOOLBAR); // Core->GUIRemove(GUI,IDD_LAYER_Item);
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerItem::GUIUpdate(CCore *Core) void CLayerItem::GUIUpdate(CCore *Core)
{ {
/*
int i,ListSize;
CComboBox &List=GUI.m_List;
// Setup Def Item List
ListSize=DefList.size();
List.ResetContent();
for (i=0; i<ListSize; i++)
{
List.AddString(DefList[i].Name);
}
List.SetCurSel(CurrentDefThing);
GUIThingUpdate();
*/
}
/*****************************************************************************/
void CLayerItem::GUIThingDefClear()
{
/*
CComboBox &List=GUI.m_List;
CurrentDefThing=-1;
List.SetCurSel(CurrentDefThing);
*/
}
/*****************************************************************************/
void CLayerItem::GUIThingUpdate()
{
/*
int i,ListSize;
CComboBox &List=GUI.m_LevelList;
// Setup ThingList
ListSize=ThingList.size();
TRACE1("%i\n",ListSize);
List.ResetContent();
for (i=0; i<ListSize; i++)
{
List.AddString(ThingList[i].Name);
}
List.SetCurSel(CurrentThing);
GUIThingPointUpdate();
// Params
GUI.DisableCallback(true);
if (CurrentThing!=-1)
{
sLayerThing &ThisThing=ThingList[CurrentThing];
GUI.SetVal(GUI.m_Speed,ThisThing.Data.Speed);
GUI.SetVal(GUI.m_TurnRate,ThisThing.Data.TurnRate);
GUI.SetVal(GUI.m_Health,ThisThing.Data.Health);
GUI.SetVal(GUI.m_Attack,ThisThing.Data.AttackStrength);
GUI.m_Collision.SetCheck(ThisThing.Data.CollisionFlag);
GUI.m_Player.SetCheck(ThisThing.Data.PlayerFlag);
}
else
{
GUI.m_Speed.SetWindowText("");
GUI.m_TurnRate.SetWindowText("");
GUI.m_Health.SetWindowText("");
GUI.m_Attack.SetWindowText("");
GUI.m_Collision.SetCheck(false);
GUI.m_Player.SetCheck(false);
}
GUI.DisableCallback(false);
*/
}
/*****************************************************************************/
void CLayerItem::GUIThingPointUpdate()
{
/*
int i,ListSize;
sLayerThing &ThisThing=ThingList[CurrentThing];
CListBox &List=GUI.m_PosList;
List.ResetContent();
if (CurrentThing==-1)
{
}
else
{
// Setup ThingPointList
ListSize=ThisThing.XY.size();
for (i=0; i<ListSize; i++)
{
CString Str;
Str.Format("%i: %i, %i",i,ThisThing.XY[i].x,ThisThing.XY[i].y);
List.AddString(Str);
}
List.SetCurSel(CurrentThingPoint);
}
*/
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerItem::GUIChanged(CCore *Core) void CLayerItem::GUIChanged(CCore *Core)
{ {
/*
if (CurrentThing!=-1)
{
sLayerThing &ThisThing=ThingList[CurrentThing];
ThisThing.Data.Speed=GUI.GetVal(GUI.m_Speed);
ThisThing.Data.TurnRate=GUI.GetVal(GUI.m_TurnRate);
ThisThing.Data.Health=GUI.GetVal(GUI.m_Health);
ThisThing.Data.AttackStrength=GUI.GetVal(GUI.m_Attack);
ThisThing.Data.CollisionFlag=GUI.m_Collision.GetCheck()!=0;
ThisThing.Data.PlayerFlag=GUI.m_Player.GetCheck()!=0;
}
*/
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Functions ***************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ void CLayerItem::ExportThing(CExport &Exp,sLayerThing &ThisThing)
void CLayerItem::Export(CCore *Core,CExport &Exp)
{ {
/*
int i,ListSize=ThisThing.XY.size();
sExpLayerItem OutThing;
// Point List
Exp.Write(&ListSize,sizeof(int));
for (i=0 ;i<ListSize; i++)
{
Exp.Write(&ThisThing.XY[i],sizeof(CPoint));
}
// Thing
OutThing.Health=ThisThing.Data.Health;
OutThing.AttackStrength=ThisThing.Data.AttackStrength;
OutThing.Speed=ThisThing.Data.Speed;
OutThing.TurnRate=ThisThing.Data.TurnRate;
OutThing.CollisionFlag=ThisThing.Data.CollisionFlag;
OutThing.PlayerFlag=ThisThing.Data.PlayerFlag;
Exp.Write(&OutThing,sizeof(sExpLayerItem));
*/
} }

View File

@ -1,6 +1,6 @@
/******************/ /*******************/
/*** Layer Item ***/ /*** Layer Item ***/
/******************/ /*******************/
#ifndef __LAYER_ITEM_HEADER__ #ifndef __LAYER_ITEM_HEADER__
#define __LAYER_ITEM_HEADER__ #define __LAYER_ITEM_HEADER__
@ -8,7 +8,7 @@
#include "LayerThing.h" #include "LayerThing.h"
#include "Layer.h" #include "Layer.h"
#include "MapEdit.h" #include "MapEdit.h"
#include "GUIToolbar.h" //#include "GUILayerItem.h"
#include "Elem.h" #include "Elem.h"
/*****************************************************************************/ /*****************************************************************************/
@ -18,21 +18,24 @@ public:
CLayerItem(sLayerDef &Def); CLayerItem(sLayerDef &Def);
CLayerItem(CFile *File,int Version) {Load(File,Version);} CLayerItem(CFile *File,int Version) {Load(File,Version);}
void InitLayer(sLayerDef &Def);
void InitSubView(CCore *Core); void InitSubView(CCore *Core);
void GUIInit(CCore *Core); void GUIInit(CCore *Core);
void GUIKill(CCore *Core); void GUIKill(CCore *Core);
void GUIUpdate(CCore *Core); void GUIUpdate(CCore *Core);
void GUIChanged(CCore *Core); void GUIChanged(CCore *Core);
bool GUIReady();
void Load(CFile *File,int Version); void GUIThingDefClear();
void Save(CFile *File); void GUIThingUpdate();
void LoadThingScript(const char *Filename); void GUIThingPointUpdate();
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
void Export(CCore *Core,CExport &Exp);
protected: protected:
CGUIToolBar GUIToolBar; // CGUILayerItem GUI;
}; };

View File

@ -22,27 +22,16 @@
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
// New Layer CLayerPlatform::CLayerPlatform(sLayerDef &Def)
CLayerPlatform::CLayerPlatform(sLayerDef &Def) : CLayerThing(Def)
{ {
LoadThingScript("c:\\temp\\character.txt"); InitLayer(Def);
} }
/*****************************************************************************/ /*****************************************************************************/
//CLayerPlatform::CLayerPlatform(CFile *File,int Version) :CLayerThing (File,Version) void CLayerPlatform::InitLayer(sLayerDef &Def)
//{
//}
/*****************************************************************************/
void CLayerPlatform::Load(CFile *File,int Version)
{ {
CLayerThing::Load(File,Version); CLayerThing::InitLayer(Def);
} LoadThingScript(theApp.GetConfigStr("LayerScript","PlatformScript"));
/*****************************************************************************/
void CLayerPlatform::Save(CFile *File)
{
CLayerThing::Save(File);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -50,51 +39,159 @@ void CLayerPlatform::InitSubView(CCore *Core)
{ {
} }
/*****************************************************************************/
void CLayerPlatform::LoadThingScript(const char *Filename)
{
CLayerThing::LoadThingScript(Filename);
// CLayerThing::ThingScript.LoadAndImport(Filename);
int Count=ThingScript.GetGroupCount();
for (int i=0; i<Count; i++)
{
char *Name=ThingScript.GetGroupName(i);
char *Gfx=ThingScript.GetData(Name,"gfx");
TRACE2("%s\t\t%s\n",Name,Gfx);
if (Gfx)
ThingBank->AddSet(Gfx);
}
}
/*****************************************************************************/ /*****************************************************************************/
/*** Gui *********************************************************************/ /*** Gui *********************************************************************/
/*****************************************************************************/ /*****************************************************************************/
void CLayerPlatform::GUIInit(CCore *Core) void CLayerPlatform::GUIInit(CCore *Core)
{ {
// Core->GUIAdd(GUIToolBar,IDD_TOOLBAR); // GUI.DisableCallback(true);
// Core->GUIAdd(GUI,IDD_LAYER_Platform);
// GUI.DisableCallback(false);
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerPlatform::GUIKill(CCore *Core) void CLayerPlatform::GUIKill(CCore *Core)
{ {
// Core->GUIRemove(GUIToolBar,IDD_TOOLBAR); // Core->GUIRemove(GUI,IDD_LAYER_Platform);
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerPlatform::GUIUpdate(CCore *Core) void CLayerPlatform::GUIUpdate(CCore *Core)
{ {
/*
int i,ListSize;
CComboBox &List=GUI.m_List;
// Setup Def Platform List
ListSize=DefList.size();
List.ResetContent();
for (i=0; i<ListSize; i++)
{
List.AddString(DefList[i].Name);
}
List.SetCurSel(CurrentDefThing);
GUIThingUpdate();
*/
}
/*****************************************************************************/
void CLayerPlatform::GUIThingDefClear()
{
/*
CComboBox &List=GUI.m_List;
CurrentDefThing=-1;
List.SetCurSel(CurrentDefThing);
*/
}
/*****************************************************************************/
void CLayerPlatform::GUIThingUpdate()
{
/*
int i,ListSize;
CComboBox &List=GUI.m_LevelList;
// Setup ThingList
ListSize=ThingList.size();
TRACE1("%i\n",ListSize);
List.ResetContent();
for (i=0; i<ListSize; i++)
{
List.AddString(ThingList[i].Name);
}
List.SetCurSel(CurrentThing);
GUIThingPointUpdate();
// Params
GUI.DisableCallback(true);
if (CurrentThing!=-1)
{
sLayerThing &ThisThing=ThingList[CurrentThing];
GUI.SetVal(GUI.m_Speed,ThisThing.Data.Speed);
GUI.SetVal(GUI.m_TurnRate,ThisThing.Data.TurnRate);
GUI.SetVal(GUI.m_Health,ThisThing.Data.Health);
GUI.SetVal(GUI.m_Attack,ThisThing.Data.AttackStrength);
GUI.m_Collision.SetCheck(ThisThing.Data.CollisionFlag);
GUI.m_Player.SetCheck(ThisThing.Data.PlayerFlag);
}
else
{
GUI.m_Speed.SetWindowText("");
GUI.m_TurnRate.SetWindowText("");
GUI.m_Health.SetWindowText("");
GUI.m_Attack.SetWindowText("");
GUI.m_Collision.SetCheck(false);
GUI.m_Player.SetCheck(false);
}
GUI.DisableCallback(false);
*/
}
/*****************************************************************************/
void CLayerPlatform::GUIThingPointUpdate()
{
/*
int i,ListSize;
sLayerThing &ThisThing=ThingList[CurrentThing];
CListBox &List=GUI.m_PosList;
List.ResetContent();
if (CurrentThing==-1)
{
}
else
{
// Setup ThingPointList
ListSize=ThisThing.XY.size();
for (i=0; i<ListSize; i++)
{
CString Str;
Str.Format("%i: %i, %i",i,ThisThing.XY[i].x,ThisThing.XY[i].y);
List.AddString(Str);
}
List.SetCurSel(CurrentThingPoint);
}
*/
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerPlatform::GUIChanged(CCore *Core) void CLayerPlatform::GUIChanged(CCore *Core)
{ {
/*
if (CurrentThing!=-1)
{
sLayerThing &ThisThing=ThingList[CurrentThing];
ThisThing.Data.Speed=GUI.GetVal(GUI.m_Speed);
ThisThing.Data.TurnRate=GUI.GetVal(GUI.m_TurnRate);
ThisThing.Data.Health=GUI.GetVal(GUI.m_Health);
ThisThing.Data.AttackStrength=GUI.GetVal(GUI.m_Attack);
ThisThing.Data.CollisionFlag=GUI.m_Collision.GetCheck()!=0;
ThisThing.Data.PlayerFlag=GUI.m_Player.GetCheck()!=0;
}
*/
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Functions ***************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ void CLayerPlatform::ExportThing(CExport &Exp,sLayerThing &ThisThing)
void CLayerPlatform::Export(CCore *Core,CExport &Exp)
{ {
/*
int i,ListSize=ThisThing.XY.size();
sExpLayerPlatform OutThing;
// Point List
Exp.Write(&ListSize,sizeof(int));
for (i=0 ;i<ListSize; i++)
{
Exp.Write(&ThisThing.XY[i],sizeof(CPoint));
}
// Thing
OutThing.Health=ThisThing.Data.Health;
OutThing.AttackStrength=ThisThing.Data.AttackStrength;
OutThing.Speed=ThisThing.Data.Speed;
OutThing.TurnRate=ThisThing.Data.TurnRate;
OutThing.CollisionFlag=ThisThing.Data.CollisionFlag;
OutThing.PlayerFlag=ThisThing.Data.PlayerFlag;
Exp.Write(&OutThing,sizeof(sExpLayerPlatform));
*/
} }

View File

@ -1,6 +1,6 @@
/**********************/ /*******************/
/*** Layer Platform ***/ /*** Layer Platform ***/
/**********************/ /*******************/
#ifndef __LAYER_PLATFORM_HEADER__ #ifndef __LAYER_PLATFORM_HEADER__
#define __LAYER_PLATFORM_HEADER__ #define __LAYER_PLATFORM_HEADER__
@ -8,7 +8,7 @@
#include "LayerThing.h" #include "LayerThing.h"
#include "Layer.h" #include "Layer.h"
#include "MapEdit.h" #include "MapEdit.h"
#include "GUIToolbar.h" //#include "GUILayerPlatform.h"
#include "Elem.h" #include "Elem.h"
/*****************************************************************************/ /*****************************************************************************/
@ -18,21 +18,24 @@ public:
CLayerPlatform(sLayerDef &Def); CLayerPlatform(sLayerDef &Def);
CLayerPlatform(CFile *File,int Version) {Load(File,Version);} CLayerPlatform(CFile *File,int Version) {Load(File,Version);}
void InitLayer(sLayerDef &Def);
void InitSubView(CCore *Core); void InitSubView(CCore *Core);
void GUIInit(CCore *Core); void GUIInit(CCore *Core);
void GUIKill(CCore *Core); void GUIKill(CCore *Core);
void GUIUpdate(CCore *Core); void GUIUpdate(CCore *Core);
void GUIChanged(CCore *Core); void GUIChanged(CCore *Core);
bool GUIReady();
void Load(CFile *File,int Version); void GUIThingDefClear();
void Save(CFile *File); void GUIThingUpdate();
void LoadThingScript(const char *Filename); void GUIThingPointUpdate();
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
void Export(CCore *Core,CExport &Exp);
protected: protected:
CGUIToolBar GUIToolBar; // CGUILayerPlatform GUI;
}; };

View File

@ -23,19 +23,11 @@
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
// New Layer
CLayerThing::CLayerThing(sLayerDef &Def) CLayerThing::CLayerThing(sLayerDef &Def)
{ {
InitLayer(Def); InitLayer(Def);
} }
/*****************************************************************************/
// Load Layer
//CLayerThing::CLayerThing(CFile *File,int Version)
//{
//Load(File,Version);
//}
/*****************************************************************************/ /*****************************************************************************/
CLayerThing::~CLayerThing() CLayerThing::~CLayerThing()
{ {
@ -46,26 +38,116 @@ CLayerThing::~CLayerThing()
/*****************************************************************************/ /*****************************************************************************/
void CLayerThing::InitLayer(sLayerDef &Def) void CLayerThing::InitLayer(sLayerDef &Def)
{ {
CLayer::InitLayer(Def);
Mode=MouseModeNormal; Mode=MouseModeNormal;
LayerDef.Width=Width;
LayerDef.Height=Height;
ThingBank=new CElemBank(-1,-1,false,true); ThingBank=new CElemBank(-1,-1,false,true);
Cursor.XY.resize(1);
Cursor.ElemID=-1;
CurrentDefThing=-1;
CurrentThing=-1; CurrentThing=-1;
CurrentPoint=0; CurrentThingPoint=0;
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerThing::Load(CFile *File,int Version) void CLayerThing::Load(CFile *File,int Version)
{ {
int i,ListSize;
File->Read(&Mode,sizeof(MouseMode)); File->Read(&Mode,sizeof(MouseMode));
File->Read(&CurrentDefThing,sizeof(int));
File->Read(&CurrentThing,sizeof(int));
File->Read(&CurrentThingPoint,sizeof(int));
File->Read(&ListSize,sizeof(int));
ThingList.resize(ListSize);
// Load Data
for (i=0;i<ListSize;i++)
{
sLayerThing &ThisThing=ThingList[i];
LoadThing(File,Version,ThisThing);
File->Read(&ThisThing.Data,sizeof(sLayerThingData));
}
LoadThingNames(File,Version);
}
/*****************************************************************************/
void CLayerThing::LoadThing(CFile *File,int Version,sLayerThing &ThisThing)
{
int i,ListSize;
File->Read(&ListSize,sizeof(int));
ThisThing.XY.resize(ListSize);
for (i=0 ;i<ListSize; i++)
{
File->Read(&ThisThing.XY[i],sizeof(CPoint));
}
}
/*****************************************************************************/
void CLayerThing::LoadThingNames(CFile *File,int Version)
{
int i,ListSize=ThingList.size();
for (i=0;i<ListSize;i++)
{
char c=1;
sLayerThing &ThisThing=ThingList[i];
GString &ThisName=ThisThing.Name;
while (c)
{
File->Read(&c,1);
ThisName.Append(c);
}
// Update Gfx ID
int Idx=FindDefThing(ThisName);
ThisThing.ElemID=DefList[Idx].ElemID;
}
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerThing::Save(CFile *File) void CLayerThing::Save(CFile *File)
{ {
int i,ListSize=ThingList.size();
// Always Save current version // Always Save current version
File->Write(&Mode,sizeof(MouseMode)); File->Write(&Mode,sizeof(MouseMode));
File->Write(&CurrentDefThing,sizeof(int));
File->Write(&CurrentThing,sizeof(int));
File->Write(&CurrentThingPoint,sizeof(int));
File->Write(&ListSize,sizeof(int));
for (i=0;i<ListSize; i++)
{
sLayerThing &ThisThing=ThingList[i];
SaveThing(File,ThisThing);
File->Write(&ThisThing.Data,sizeof(sLayerThingData));
}
SaveThingNames(File);
}
/*****************************************************************************/
void CLayerThing::SaveThing(CFile *File,sLayerThing &ThisThing)
{
int i,ListSize=ThisThing.XY.size();
File->Write(&ListSize,sizeof(int));
for (i=0 ;i<ListSize; i++)
{
File->Write(&ThisThing.XY[i],sizeof(CPoint));
}
}
/*****************************************************************************/
void CLayerThing::SaveThingNames(CFile *File)
{
int i,ListSize=ThingList.size();
for (i=0; i<ListSize; i++)
{
char Txt[256];
sprintf(Txt,ThingList[i].Name);
File->Write(Txt,strlen(Txt)+1);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -77,6 +159,40 @@ void CLayerThing::InitSubView(CCore *Core)
void CLayerThing::LoadThingScript(const char *Filename) void CLayerThing::LoadThingScript(const char *Filename)
{ {
ThingScript.LoadAndImport(Filename); ThingScript.LoadAndImport(Filename);
int i,ListSize=ThingScript.GetGroupCount();
DefList.resize(ListSize);
for (i=0; i<ListSize; i++)
{
sLayerThing &ThisDef=DefList[i];
char *Name=ThingScript.GetGroupName(i);
char *Gfx=ThingScript.GetStr(Name,"gfx");
ThisDef.Name=Name;
ThisDef.Data.WaypointFlag=ThingScript.GetInt(Name,"WayPoints")==1;
ThisDef.Data.Speed=ThingScript.GetInt(Name,"Speed");
ThisDef.Data.TurnRate=ThingScript.GetInt(Name,"TurnRate");
ThisDef.Data.Health=ThingScript.GetInt(Name,"Health");
ThisDef.Data.AttackStrength=ThingScript.GetInt(Name,"AttackStrength");
ThisDef.Data.PlayerFlag=ThingScript.GetInt(Name,"Player")==1;
ThisDef.Data.CollisionFlag=ThingScript.GetInt(Name,"Collision")==1;
ThisDef.XY.resize(1);
TRACE2("%s\t\t%s\n",Name,Gfx);
ThisDef.ElemID=ThingBank->GetSetCount();
if (Gfx)
{
ThingBank->AddSet(Gfx);
}
else
{
TRACE1("BAD %s\n",Name);
}
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -87,7 +203,6 @@ void CLayerThing::Render(CCore *Core,Vector3 &CamPos,bool Is3d)
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor()); Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
int i,ListSize=ThingList.size(); int i,ListSize=ThingList.size();
// Is3d&=Render3dFlag;
for (i=0; i<ListSize; i++) for (i=0; i<ListSize; i++)
{ {
RenderThing(Core,ThisCam,ThingList[i],Is3d,i==CurrentThing); RenderThing(Core,ThisCam,ThingList[i],Is3d,i==CurrentThing);
@ -102,7 +217,6 @@ float ZoomH=Core->GetZoomH();
float ScrOfsX=(ZoomW/2); float ScrOfsX=(ZoomW/2);
float ScrOfsY=(ZoomH/2); float ScrOfsY=(ZoomH/2);
Vector3 &Scale=Core->GetScaleVector(); Vector3 &Scale=Core->GetScaleVector();
CElemBank *IconBank=Core->GetIconBank();
if (ThingBank->NeedLoad()) ThingBank->LoadAllSets(Core); if (ThingBank->NeedLoad()) ThingBank->LoadAllSets(Core);
@ -126,11 +240,11 @@ int ListSize=ThisThing.XY.size();
else else
glColor4f(1,1,1,0.5); glColor4f(1,1,1,0.5);
IconBank->RenderElem(0,i,0,Render3d); Core->RenderNumber(i);
if (i==0) if (i==0)
{ {
glColor4f(1,1,1,1); // Set default Color glColor4f(1,1,1,1); // Set default Color
ThingBank->RenderElem(ThisThing.Type,0,0,Render3d); ThingBank->RenderElem(ThisThing.ElemID,0,0,Render3d);
} }
glPopMatrix(); glPopMatrix();
} }
@ -144,6 +258,7 @@ int ListSize=ThisThing.XY.size();
void CLayerThing::GUIInit(CCore *Core) void CLayerThing::GUIInit(CCore *Core)
{ {
// Core->GUIAdd(GUIToolBar,IDD_TOOLBAR); // Core->GUIAdd(GUIToolBar,IDD_TOOLBAR);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -169,19 +284,21 @@ bool CLayerThing::LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool
{ {
bool Ret=false; bool Ret=false;
if (!DownFlag) return(false);
switch(Mode) switch(Mode)
{ {
case MouseModeNormal: case MouseModeNormal:
if (DownFlag) SelectThing(CursorPos);
{ GUIThingUpdate();
if (CurrentThing==-1) break;
case MouseModeNew:
AddThing(CursorPos); AddThing(CursorPos);
else GUIThingDefClear();
AddThingPoint(CursorPos); GUIThingUpdate();
}
break; break;
case MouseModePoints: case MouseModePoints:
AddThingPoint(CursorPos);
GUIThingPointUpdate();
break; break;
default: default:
break; break;
@ -193,21 +310,9 @@ bool Ret=false;
/*****************************************************************************/ /*****************************************************************************/
bool CLayerThing::RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag) bool CLayerThing::RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
{ {
bool Ret=FALSE; if (!DownFlag) return(false);
Cancel();
switch(Mode) return(true);
{
case MouseModeNormal:
if (DownFlag)
{
SelectThing(CursorPos);
}
break;
case MouseModePoints:
break;
}
return(Ret);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -219,13 +324,14 @@ bool Ret=false;
{ {
if (nFlags & MK_LBUTTON) // Drag if (nFlags & MK_LBUTTON) // Drag
{ {
UpdatePos(CursorPos,CurrentThing,CurrentPoint,true); UpdatePos(CursorPos,CurrentThing,CurrentThingPoint,(nFlags & MK_CONTROL)!=0);
GUIThingPointUpdate();
Ret=true; Ret=true;
} }
else else
if (nFlags & MK_RBUTTON) // Cancel if (nFlags & MK_RBUTTON) // Cancel
{ {
CurrentThing=-1; Cancel();
Ret=true; Ret=true;
} }
} }
@ -233,51 +339,98 @@ bool Ret=false;
} }
/*****************************************************************************/ /*****************************************************************************/
bool CLayerThing::Command(int CmdMsg,CCore *Core,int Param0,int Param1) void CLayerThing::Cancel()
{ {
bool Ret=false; switch(Mode)
/*
switch(CmdMsg)
{ {
case CmdMsg_SetMode: case MouseModeNormal:
// Mode=(MouseMode)Param0; CurrentThing=-1;
// Core->GUIUpdate(); case MouseModeNew:
// break; case MouseModePoints:
// case CmdMsg_SubViewSet: Mode=MouseModeNormal;
// Ret=ThingBank->Command(CmdMsg,Core,Param0,Param1); CurrentThingPoint=0;
GUIThingDefClear();
GUIThingUpdate();
break; break;
default: default:
break; break;
} }
*/ }
/*****************************************************************************/
bool CLayerThing::Command(int CmdMsg,CCore *Core,int Param0,int Param1)
{
bool Ret=false;
switch(CmdMsg)
{
case CmdMsg_ThingListDelete:
DeleteThing();
GUIThingUpdate();
break;
case CmdMsg_ThingListSelect:
CurrentDefThing=Param0;
SetCursor(DefList[CurrentDefThing].Name);
Mode=MouseModeNew;
break;
case CmdMsg_ThingLevelSelect:
SelectThing(Param0);
GUIThingUpdate();
break;
case CmdMsg_ThingPosSelect:
CurrentThingPoint=Param0;
GUIThingPointUpdate();
break;
case CmdMsg_ThingPosUp:
MovePoint(-1);
break;
case CmdMsg_ThingPosDown:
MovePoint(+1);
break;
case CmdMsg_ThingPosDelete:
DeletePoint();
break;
default:
break;
}
return(Ret); return(Ret);
} }
/*****************************************************************************/
int CLayerThing::FindDefThing(const char *Name)
{
int i,ListSize=DefList.size();
for (i=0; i<ListSize; i++)
{
if (DefList[i]==Name) return(i);
}
return(-1);
}
/*****************************************************************************/
void CLayerThing::SetCursor(const char *Name)
{
int Idx=FindDefThing(Name);
if (Idx==-1) return;
Cursor=DefList[Idx];
}
/*****************************************************************************/ /*****************************************************************************/
void CLayerThing::RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d) void CLayerThing::RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d)
{ {
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor()); Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
CPoint &CursPos=Core->GetCursorPos(); CPoint &CursPos=Core->GetCursorPos();
Vector3 Ofs;
Cursor.XY[0]=CursPos;
if (CursPos.x<0 || CursPos.y<0) return; if (CursPos.x<0 || CursPos.y<0) return;
if (Mode!=MouseModeNew) return;
if (Cursor.ElemID==-1) return;
Ofs.x=-(CursPos.x-(int)ThisCam.x); RenderThing(Core,ThisCam,Cursor,Is3d,true);
Ofs.y=-(CursPos.y-(int)ThisCam.y);
ThisCam.x-=(int)ThisCam.x;
ThisCam.y-=(int)ThisCam.y;
Is3d&=GetRender3dFlag();
if (Is3d)
{
glEnable(GL_DEPTH_TEST);
// Render(Core,ThisCam,,TRUE,0.5,&Ofs);
glDisable(GL_DEPTH_TEST);
}
else
{
// Render(Core,ThisCam,Brush,FALSE,0.5,&Ofs);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -313,26 +466,52 @@ int StartIdx=0;
void CLayerThing::AddThing(CPoint &Pos) void CLayerThing::AddThing(CPoint &Pos)
{ {
if (Pos.x==-1 || Pos.y==-1) return; // Off Map? if (Pos.x==-1 || Pos.y==-1) return; // Off Map?
CurrentThing=CheckThing(Pos); CurrentThing=SelectThing(Pos);
CurrentPoint=0;
if (CurrentThing!=-1) return; if (CurrentThing!=-1) return;
CurrentThing=ThingList.size(); CurrentThing=ThingList.size();
ThingList.resize(CurrentThing+1); ThingList.resize(CurrentThing+1);
sLayerThing &ThisThing=ThingList[CurrentThing]; sLayerThing &ThisThing=ThingList[CurrentThing];
ThisThing=Cursor;
ThisThing.XY.push_back(Pos); SelectThing(CurrentThing);
ThisThing.Type=ThingList.size()%22;
ThisThing.SubType=0;
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerThing::SelectThing(CPoint &Pos) int CLayerThing::SelectThing(CPoint &Pos)
{ {
if (Pos.x==-1 || Pos.y==-1) return; // Off Map? if (Pos.x==-1 || Pos.y==-1) return(-1); // Off Map?
CurrentThing=CheckThing(Pos); SelectThing(CheckThing(Pos));
CurrentPoint=0; return(CurrentThing);
}
/*****************************************************************************/
int CLayerThing::SelectThing(int Idx)
{
CurrentThing=Idx;
CurrentThingPoint=0;
if (CurrentThing!=-1)
{
sLayerThing &ThisThing=ThingList[CurrentThing];
if (ThisThing.Data.WaypointFlag)
{
Mode=MouseModePoints;
}
else
{
Mode=MouseModeNormal;
}
}
return(CurrentThing);
}
/*****************************************************************************/
void CLayerThing::DeleteThing()
{
if (!ThingList.size()) return;
ThingList.erase(CurrentThing);
CurrentThing--;
} }
@ -369,21 +548,22 @@ int StartIdx=0;
void CLayerThing::AddThingPoint(CPoint &Pos) void CLayerThing::AddThingPoint(CPoint &Pos)
{ {
if (Pos.x==-1 || Pos.y==-1) return; // Off Map? if (Pos.x==-1 || Pos.y==-1) return; // Off Map?
CurrentPoint=CheckThingPoint(Pos); CurrentThingPoint=SelectThingPoint(Pos);
if (CurrentPoint!=-1) return; if (CurrentThingPoint!=-1) return;
sLayerThing &ThisThing=ThingList[CurrentThing]; sLayerThing &ThisThing=ThingList[CurrentThing];
CurrentPoint=ThisThing.XY.size(); CurrentThingPoint=ThisThing.XY.size();
ThisThing.XY.resize(CurrentPoint+1); ThisThing.XY.resize(CurrentThingPoint+1);
ThisThing.XY[CurrentPoint]=Pos; ThisThing.XY[CurrentThingPoint]=Pos;
} }
/*****************************************************************************/ /*****************************************************************************/
void CLayerThing::SelectThingPoint(CPoint &Pos) int CLayerThing::SelectThingPoint(CPoint &Pos)
{ {
if (Pos.x==-1 || Pos.y==-1) return; // Off Map? if (Pos.x==-1 || Pos.y==-1) return(-1); // Off Map?
CurrentPoint=CheckThing(Pos); CurrentThingPoint=CheckThingPoint(Pos);
return(CurrentThingPoint);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -398,7 +578,7 @@ int StartIdx=PosIdx,EndIdx=ThisThing.XY.size();
if (!Recurs) if (!Recurs)
{ {
StartIdx=PosIdx; StartIdx=PosIdx;
EndIdx=StartIdx++; EndIdx=StartIdx+1;
} }
for (int i=StartIdx; i<EndIdx; i++) for (int i=StartIdx; i<EndIdx; i++)
@ -407,46 +587,63 @@ int StartIdx=PosIdx,EndIdx=ThisThing.XY.size();
} }
} }
/*****************************************************************************/
void CLayerThing::MovePoint(int Dir)
{
if (CurrentThing==-1) return;
int NewPos=CurrentThingPoint+Dir;
sLayerThing &ThisThing=ThingList[CurrentThing];
if (NewPos<0 || NewPos>=ThisThing.XY.size()) return;
CPoint Tmp=ThisThing.XY[CurrentThingPoint];
ThisThing.XY[CurrentThingPoint]=ThisThing.XY[NewPos];
ThisThing.XY[NewPos]=Tmp;
CurrentThingPoint=NewPos;
GUIThingPointUpdate();
}
/*****************************************************************************/
void CLayerThing::DeletePoint()
{
if (!CurrentThingPoint) return;
if (CurrentThing==-1) return;
sLayerThing &ThisThing=ThingList[CurrentThing];
ThisThing.XY.erase(CurrentThingPoint);
CurrentThingPoint--;
if (CurrentThingPoint<0) CurrentThingPoint=0;
GUIThingPointUpdate();
}
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
void CLayerThing::Export(CCore *Core,CExport &Exp) void CLayerThing::Export(CCore *Core,CExport &Exp)
{ {
/* int i,ListSize=ThingList.size();
int Width=Map.GetWidth(); Exp.ExportLayerHeader(LayerDef);
int Height=Map.GetHeight();
Exp.ExportLayerHeader(LAYER_TYPE_Elem,SubType,Width,Height); Exp.Write(&ListSize,sizeof(int));
for (i=0;i<ListSize; i++)
for (int Y=0; Y<Height; Y++)
{ {
for (int X=0; X<Width; X++) ExportThing(Exp,ThingList[i]);
{ }
sMapElem &MapElem=Map.Get(X,Y); ExportThingNames(Exp);
sExpLayerThing OutElem; }
if (MapElem.Set==0 && MapElem.Elem==0)
{ // Blank /*****************************************************************************/
OutElem.Elem=0; void CLayerThing::ExportThingNames(CExport &Exp)
OutElem.Flags=0; {
int i,ListSize=ThingList.size();
for (i=0; i<ListSize; i++)
{
char Txt[256];
sprintf(Txt,ThingList[i].Name);
Exp.Write(Txt,strlen(Txt)+1);
} }
else
{
sExpElem OutElem;
CElem &ThisElem=ElemBank->GetElem(MapElem.Set,MapElem.Elem);
OutElem.Set=MapElem.Set;
OutElem.Elem=MapElem.Elem;
OutElem.TriStart=0;
OutElem.TriCount=0;
OutElem.XOfs=ThisElem.GetTexXOfs();
OutElem.YOfs=ThisElem.GetTexYOfs();
OutElem.Elem=Exp.AddElem(OutElem);
OutElem.Flags=MapElem.Flags;
}
Exp.Write(&OutElem,sizeof(sExpLayerThing));
}
}
*/
} }

View File

@ -11,19 +11,27 @@
#include "Elem.h" #include "Elem.h"
/*****************************************************************************/ /*****************************************************************************/
struct sLayerThing struct sLayerThingData
{ {
std::vector<CPoint> XY; bool WaypointFlag;
int Type;
int SubType; int Speed;
int TurnRate;
int Health;
int AttackStrength;
bool CollisionFlag;
bool PlayerFlag;
int Spare[8]; int Spare[8];
bool operator==(sLayerThing const &v1) };
struct sLayerThing
{ {
if (XY[0]!=v1.XY[0]) return(false); GString Name;
return(true); CList<CPoint> XY;
} int ElemID;
sLayerThingData Data;
bool operator==(const char *Name1) {return (Name==Name1);}
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -34,6 +42,7 @@ public:
enum MouseMode enum MouseMode
{ {
MouseModeNormal=0, MouseModeNormal=0,
MouseModeNew,
MouseModePoints, MouseModePoints,
}; };
@ -54,14 +63,21 @@ virtual void GUIKill(CCore *Core);
virtual void GUIUpdate(CCore *Core); virtual void GUIUpdate(CCore *Core);
virtual void GUIChanged(CCore *Core); virtual void GUIChanged(CCore *Core);
int GetWidth() {return(Width);} virtual void GUIThingDefClear(){};
int GetHeight() {return(Height);} virtual void GUIThingUpdate(){};
virtual void GUIThingPointUpdate(){};
virtual void Load(CFile *File,int Version); virtual void Load(CFile *File,int Version);
virtual void LoadThing(CFile *File,int Version,sLayerThing &ThisThing);
virtual void LoadThingNames(CFile *File,int Version);
virtual void Save(CFile *File); virtual void Save(CFile *File);
virtual void SaveThing(CFile *File,sLayerThing &ThisThing);
virtual void SaveThingNames(CFile *File);
virtual void LoadThingScript(const char *Filename); virtual void LoadThingScript(const char *Filename);
virtual void Export(CCore *Core,CExport &Exp); virtual void Export(CCore *Core,CExport &Exp);
virtual void ExportThing(CExport &Exp,sLayerThing &ThisThing)=0;
virtual void ExportThingNames(CExport &Exp);
// Functions // Functions
virtual bool LButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag); virtual bool LButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag);
@ -70,22 +86,32 @@ virtual bool MouseMove(CCore *Core,UINT nFlags, CPoint &point);
virtual bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0); virtual bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0);
protected: protected:
virtual int FindDefThing(const char *Name);
virtual void SetCursor(const char *Name);
void RenderThing(CCore *Core,Vector3 &CamPos,sLayerThing &ThisThing,bool Render3d,bool Selected); void RenderThing(CCore *Core,Vector3 &CamPos,sLayerThing &ThisThing,bool Render3d,bool Selected);
int CheckThing(CPoint &Pos); int CheckThing(CPoint &Pos);
void AddThing(CPoint &Pos); void AddThing(CPoint &Pos);
void SelectThing(CPoint &Pos); int SelectThing(CPoint &Pos);
int SelectThing(int Idx);
void DeleteThing();
int CheckThingPoint(CPoint &Pos); int CheckThingPoint(CPoint &Pos);
void AddThingPoint(CPoint &Pos); void AddThingPoint(CPoint &Pos);
void SelectThingPoint(CPoint &Pos); int SelectThingPoint(CPoint &Pos);
void UpdatePos(CPoint &Pos,int Thing,int PosNo,bool Recurs=false); void UpdatePos(CPoint &Pos,int Thing,int PosNo,bool Recurs=false);
void MovePoint(int Dir);
void DeletePoint();
void Cancel();
int Width,Height;
CIni ThingScript; CIni ThingScript;
CElemBank *ThingBank; CElemBank *ThingBank;
CList<sLayerThing> DefList;
CList<sLayerThing> ThingList; CList<sLayerThing> ThingList;
int CurrentThing,CurrentPoint; int CurrentDefThing;
int CurrentThing,CurrentThingPoint;
MouseMode Mode; MouseMode Mode;
sLayerThing Cursor;
}; };
/*****************************************************************************/ /*****************************************************************************/

View File

@ -2,13 +2,13 @@
[General Info] [General Info]
Version=1 Version=1
LastClass=CAboutDlg LastClass=CGUINewMap
LastTemplate=CDialog LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h" NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mapedit.h" NewFileInclude2=#include "mapedit.h"
LastPage=0 LastPage=0
ClassCount=18 ClassCount=19
Class1=CChildFrame Class1=CChildFrame
Class2=CGLEnabledView Class2=CGLEnabledView
Class3=CGUIAddLayer Class3=CGUIAddLayer
@ -28,21 +28,25 @@ Class16=CAboutDlg
Class17=CMapEditDoc Class17=CMapEditDoc
Class18=CMapEditView Class18=CMapEditView
ResourceCount=14 ResourceCount=17
Resource1=IDD_ADDLAYER Resource1=IDR_TOOLBAR (English (U.S.))
Resource2=IDR_MAPEDITYPE (English (U.S.)) Resource2=IDR_MAPEDITYPE (English (U.S.))
Resource3=IDD_TOOLBAR Resource3=IDD_NEWMAP
Resource4=IDD_NEWMAP Resource4=IDD_TOOLBAR
Resource5=IDD_LAYER_LIST Resource5=IDD_LAYER_COLLISION
Resource6=IDD_TILEBANK Resource6=IDD_RESIZE
Resource7=IDD_RESIZE Resource7=IDD_ABOUTBOX (English (U.S.))
Resource8=IDD_LAYER_SHADE Resource8=xxxx
Resource9=IDD_LAYER_COLLISION Resource9=IDD_TILEBANK
Resource10=IDR_TOOLBAR (English (U.S.)) Resource10=IDD_LAYER_SHADE
Resource11=IDR_MAINFRAME (English (U.S.)) Resource11=IDD_ADDLAYER
Resource12=IDD_ABOUTBOX (English (U.S.)) Resource12=IDD_MULTIBAR (English (U.S.))
Resource13=IDD_MULTIBAR (English (U.S.)) Resource13=IDD_ELEMLIST
Resource14=IDD_ELEMLIST Resource14=IDD_LAYER_LIST
Resource15=IDD_LAYER_ACTOR2
Resource16=IDR_MAINFRAME (English (U.S.))
Class19=CGUILayerActor
Resource17=IDD_LAYER_ACTOR
[CLS:CChildFrame] [CLS:CChildFrame]
Type=0 Type=0
@ -79,6 +83,7 @@ Type=0
BaseClass=CDialog BaseClass=CDialog
HeaderFile=GUILayerList.h HeaderFile=GUILayerList.h
ImplementationFile=GUILayerList.cpp ImplementationFile=GUILayerList.cpp
LastObject=IDC_LAYERLIST_LIST
[CLS:CGUIMultiBar] [CLS:CGUIMultiBar]
Type=0 Type=0
@ -91,6 +96,9 @@ Type=0
BaseClass=CDialog BaseClass=CDialog
HeaderFile=GUINewMap.h HeaderFile=GUINewMap.h
ImplementationFile=GUINewMap.cpp ImplementationFile=GUINewMap.cpp
Filter=D
VirtualFilter=dWC
LastObject=IDC_MAPSIZE_HEIGHT
[CLS:CGUIResize] [CLS:CGUIResize]
Type=0 Type=0
@ -166,19 +174,6 @@ Class=CGUIElemList
ControlCount=1 ControlCount=1
Control1=IDD_ELEM_LIST,combobox,1344339971 Control1=IDD_ELEM_LIST,combobox,1344339971
[DLG:IDD_LAYER_COLLISION]
Type=1
Class=GUILayerCollision
ControlCount=8
Control1=IDC_LAYERCOLLISION_NORMAL,button,1342242816
Control2=IDC_LAYERCOLLISION_DAMAGE,button,1342242816
Control3=IDC_LAYERCOLLISION_SLIPPERY,button,1342242816
Control4=IDC_LAYERCOLLISION_ELECTRIC,button,1342242816
Control5=IDC_LAYERCOLLISION_STICKY,button,1342242816
Control6=IDC_LAYERCOLLISION_WATER,button,1342242816
Control7=IDC_LAYERCOLLISION_SOLID,button,1342242816
Control8=IDC_LAYERCOLLISION_DEATH,button,1342242816
[DLG:IDD_LAYER_LIST] [DLG:IDD_LAYER_LIST]
Type=1 Type=1
Class=CGUILayerList Class=CGUILayerList
@ -363,3 +358,71 @@ ControlCount=2
Control1=IDD_LAYERTILE_BTN_PAINT,button,1342177344 Control1=IDD_LAYERTILE_BTN_PAINT,button,1342177344
Control2=IDD_LAYERTILE_BTN_SELECT,button,1342177344 Control2=IDD_LAYERTILE_BTN_SELECT,button,1342177344
[DLG:IDD_LAYER_ACTOR2]
Type=1
Class=GUILayerCollision
ControlCount=8
Control1=IDC_LAYERCOLLISION_NORMAL,button,1342242816
Control2=IDC_LAYERCOLLISION_DAMAGE,button,1342242816
Control3=IDC_LAYERCOLLISION_SLIPPERY,button,1342242816
Control4=IDC_LAYERCOLLISION_ELECTRIC,button,1342242816
Control5=IDC_LAYERCOLLISION_STICKY,button,1342242816
Control6=IDC_LAYERCOLLISION_WATER,button,1342242816
Control7=IDC_LAYERCOLLISION_SOLID,button,1342242816
Control8=IDC_LAYERCOLLISION_DEATH,button,1342242816
[DLG:xxxx]
Type=1
Class=?
ControlCount=1
Control1=IDC_COMBO1,combobox,1344340226
[DLG:IDD_LAYER_COLLISION]
Type=1
Class=?
ControlCount=8
Control1=IDC_LAYERCOLLISION_NORMAL,button,1342242816
Control2=IDC_LAYERCOLLISION_DAMAGE,button,1342242816
Control3=IDC_LAYERCOLLISION_SLIPPERY,button,1342242816
Control4=IDC_LAYERCOLLISION_ELECTRIC,button,1342242816
Control5=IDC_LAYERCOLLISION_STICKY,button,1342242816
Control6=IDC_LAYERCOLLISION_WATER,button,1342242816
Control7=IDC_LAYERCOLLISION_SOLID,button,1342242816
Control8=IDC_LAYERCOLLISION_DEATH,button,1342242816
[DLG:IDD_LAYER_ACTOR]
Type=1
Class=CGUILayerActor
ControlCount=22
Control1=IDC_LEVEL_ACTOR_LIST,combobox,1344339971
Control2=IDC_ACTOR_POS_LIST,listbox,1352728833
Control3=IDC_ACTOR_POS_UP,button,1342242816
Control4=IDC_ACTOR_POS_DOWN,button,1342242816
Control5=IDC_ACTOR_POS_DELETE,button,1342242816
Control6=IDC_ACTOR_SPEED_TEXT,static,1342308354
Control7=IDC_ACTOR_SPEED,edit,1350633600
Control8=IDC_ACTOR_SPEED_SPIN,msctls_updown32,1342177334
Control9=IDC_ACTOR_TURNRATE_TEXT,static,1342308354
Control10=IDC_ACTOR_TURNRATE,edit,1350633600
Control11=IDC_ACTOR_TURNRATE_SPIN,msctls_updown32,1342177334
Control12=IDC_ACTOR_HEALTH_TEXT,static,1342308354
Control13=IDC_ACTOR_HEALTH,edit,1350633600
Control14=IDC_ACTOR_HEALTH_SPIN,msctls_updown32,1342177334
Control15=IDC_ACTOR_ATTACK_TEXT,static,1342308354
Control16=IDC_ACTOR_ATTACK,edit,1350633600
Control17=IDC_ACTOR_ATTACK_SPIN,msctls_updown32,1342177334
Control18=IDC_ACTOR_PLAYER,button,1476461091
Control19=IDC_ACTOR_COLLISION,button,1342243363
Control20=IDC_LAYER_ACTOR_GROUP,button,1342177287
Control21=IDC_ACTOR_LIST,combobox,1344339971
Control22=IDC_ACTOR_DELETE,button,1342242816
[CLS:CGUILayerActor]
Type=0
HeaderFile=GUILayerActor.h
ImplementationFile=GUILayerActor.cpp
BaseClass=CDialog
Filter=D
VirtualFilter=dWC
LastObject=CGUILayerActor

View File

@ -19,6 +19,8 @@
static char THIS_FILE[] = __FILE__; static char THIS_FILE[] = __FILE__;
#endif #endif
const char* ConfigFilename="Mapedit.ini";
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CMapEditApp // CMapEditApp
@ -106,6 +108,8 @@ BOOL CMapEditApp::InitInstance()
pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow(); pMainFrame->UpdateWindow();
MainIni.LoadAndImport(ConfigFilename);
return TRUE; return TRUE;
} }
@ -129,6 +133,16 @@ void CMapEditApp::CloseDoc(CMapEditDoc *Cur)
} }
} }
char *CMapEditApp::GetConfigStr(char *Grp,char *Key)
{
return(MainIni.GetStr(Grp,Key));
}
int CMapEditApp::GetConfigInt(char *Grp,char *Key)
{
return(MainIni.GetInt(Grp,Key));
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About // CAboutDlg dialog used for App About

View File

@ -84,7 +84,7 @@ LINK32=link.exe
ProjDir=. ProjDir=.
TargetDir=.\Debug TargetDir=.\Debug
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PostBuild_Cmds=if not exist $(TargetDir)\collision.bmp copy $(ProjDir)\res\collision.bmp $(TargetDir)\collision.bmp if not exist $(TargetDir)\iconz.bmp copy $(ProjDir)\res\iconz.bmp $(TargetDir)\iconz.bmp PostBuild_Cmds=if not exist $(TargetDir)\collision.bmp copy $(ProjDir)\res\collision.bmp $(TargetDir)\collision.bmp if not exist $(TargetDir)\iconz.bmp copy $(ProjDir)\res\iconz.bmp $(TargetDir)\iconz.bmp copy $(ProjDir)\res\iconz.bmp $(TargetDir)\iconz.bmp
# End Special Build Tool # End Special Build Tool
!ENDIF !ENDIF
@ -391,6 +391,14 @@ SOURCE=.\GUIElemList.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\GUILayerActor.cpp
# End Source File
# Begin Source File
SOURCE=.\GUILayerActor.h
# End Source File
# Begin Source File
SOURCE=.\GUILayerCollision.cpp SOURCE=.\GUILayerCollision.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -14,6 +14,7 @@
#include "resource.h" // main symbols #include "resource.h" // main symbols
#include "CmdMsg.h" #include "CmdMsg.h"
#include "IniClass.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CMapEditApp: // CMapEditApp:
@ -32,6 +33,8 @@ public:
{ {
return(CurrentDoc); return(CurrentDoc);
} }
char *GetConfigStr(char *Grp,char *Key);
int GetConfigInt(char *Grp,char *Key);
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
@ -50,6 +53,7 @@ public:
private: private:
CMapEditDoc *CurrentDoc; CMapEditDoc *CurrentDoc;
CIni MainIni;
}; };

View File

@ -584,6 +584,52 @@ BEGIN
WS_TABSTOP WS_TABSTOP
END END
IDD_LAYER_ACTOR DIALOG DISCARDABLE 0, 0, 156, 256
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
COMBOBOX IDC_LEVEL_ACTOR_LIST,5,25,145,185,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_ACTOR_POS_LIST,5,55,145,55,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Pos Up",IDC_ACTOR_POS_UP,10,110,45,15
PUSHBUTTON "Pos Down",IDC_ACTOR_POS_DOWN,55,110,45,15
PUSHBUTTON "Pos Delete",IDC_ACTOR_POS_DELETE,100,110,45,15
RTEXT "Speed",IDC_ACTOR_SPEED_TEXT,10,130,32,8
EDITTEXT IDC_ACTOR_SPEED,45,130,35,12,ES_AUTOHSCROLL |
ES_READONLY
CONTROL "Spin1",IDC_ACTOR_SPEED_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,80,130,11,10
RTEXT "TurnRate",IDC_ACTOR_TURNRATE_TEXT,10,145,31,8
EDITTEXT IDC_ACTOR_TURNRATE,45,145,35,12,ES_AUTOHSCROLL |
ES_READONLY
CONTROL "Spin1",IDC_ACTOR_TURNRATE_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,80,145,11,10
RTEXT "Health",IDC_ACTOR_HEALTH_TEXT,10,164,32,8
EDITTEXT IDC_ACTOR_HEALTH,45,164,35,12,ES_AUTOHSCROLL |
ES_READONLY
CONTROL "Spin1",IDC_ACTOR_HEALTH_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,80,164,11,10
RTEXT "Attack",IDC_ACTOR_ATTACK_TEXT,10,180,31,8
EDITTEXT IDC_ACTOR_ATTACK,45,180,35,12,ES_AUTOHSCROLL |
ES_READONLY
CONTROL "Spin1",IDC_ACTOR_ATTACK_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,80,180,11,10
CONTROL "Player",IDC_ACTOR_PLAYER,"Button",BS_AUTOCHECKBOX |
BS_LEFTTEXT | BS_RIGHT | WS_DISABLED | WS_TABSTOP,95,130,
50,10
CONTROL "Collision",IDC_ACTOR_COLLISION,"Button",BS_AUTOCHECKBOX |
BS_LEFTTEXT | BS_RIGHT | WS_TABSTOP,95,145,50,10
GROUPBOX "",IDC_LAYER_ACTOR_GROUP,0,20,155,175
COMBOBOX IDC_ACTOR_LIST,5,5,145,185,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "Delete Actor",IDC_ACTOR_DELETE,5,40,75,15
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -664,6 +710,14 @@ BEGIN
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 19 BOTTOMMARGIN, 19
END END
IDD_LAYER_ACTOR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 149
TOPMARGIN, 7
BOTTOMMARGIN, 249
END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -18,6 +18,7 @@
#define IDD_LAYER_SHADE 175 #define IDD_LAYER_SHADE 175
#define IDD_LAYER_COLLISION 177 #define IDD_LAYER_COLLISION 177
#define IDD_ELEMLIST 178 #define IDD_ELEMLIST 178
#define IDD_LAYER_ACTOR 179
#define IDC_TOOLBAR_COMBO 1018 #define IDC_TOOLBAR_COMBO 1018
#define IDC_LAYERLIST_LIST 1019 #define IDC_LAYERLIST_LIST 1019
#define IDD_TILEBANK_UPDATE 1029 #define IDD_TILEBANK_UPDATE 1029
@ -45,19 +46,42 @@
#define IDC_LAYERCOLLISION_NORMAL 1078 #define IDC_LAYERCOLLISION_NORMAL 1078
#define IDD_ELEM_LIST 1080 #define IDD_ELEM_LIST 1080
#define IDC_LAYERSHADE_EDITR2 1081 #define IDC_LAYERSHADE_EDITR2 1081
#define IDC_LEVEL_ACTOR_LIST 1081
#define IDC_LAYERSHADE_EDITG2 1082 #define IDC_LAYERSHADE_EDITG2 1082
#define IDC_LAYERCOLLISION_DAMAGE 1082 #define IDC_LAYERCOLLISION_DAMAGE 1082
#define IDC_ACTOR_POS_LIST 1082
#define IDC_LAYERSHADE_EDITB2 1083 #define IDC_LAYERSHADE_EDITB2 1083
#define IDC_LAYERCOLLISION_SLIPPERY 1083 #define IDC_LAYERCOLLISION_SLIPPERY 1083
#define IDC_ACTOR_POS_UP 1083
#define IDC_LAYERCOLLISION_ELECTRIC 1084 #define IDC_LAYERCOLLISION_ELECTRIC 1084
#define IDC_ACTOR_POS_DOWN 1084
#define IDC_LAYERCOLLISION_STICKY 1085 #define IDC_LAYERCOLLISION_STICKY 1085
#define IDC_ACTOR_POS_DELETE 1085
#define IDC_LAYERSHADE_TEXT7 1086 #define IDC_LAYERSHADE_TEXT7 1086
#define IDC_LAYERCOLLISION_WATER 1086 #define IDC_LAYERCOLLISION_WATER 1086
#define IDC_ACTOR_SPEED_TEXT 1086
#define IDC_LAYERSHADE_EDITR3 1087 #define IDC_LAYERSHADE_EDITR3 1087
#define IDC_LAYERCOLLISION_SOLID 1087 #define IDC_LAYERCOLLISION_SOLID 1087
#define IDC_ACTOR_SPEED 1087
#define IDC_LAYERSHADE_EDITG3 1088 #define IDC_LAYERSHADE_EDITG3 1088
#define IDC_LAYERCOLLISION_DEATH 1088 #define IDC_LAYERCOLLISION_DEATH 1088
#define IDC_LAYERSHADE_EDITB3 1089 #define IDC_LAYERSHADE_EDITB3 1089
#define IDC_ACTOR_LIST 1089
#define IDC_ACTOR_NEW 1090
#define IDC_ACTOR_DELETE 1091
#define IDC_ACTOR_SPEED_SPIN 1092
#define IDC_ACTOR_PLAYER 1094
#define IDC_LAYER_ACTOR_GROUP 1095
#define IDC_ACTOR_TURNRATE_TEXT 1097
#define IDC_ACTOR_TURNRATE 1098
#define IDC_ACTOR_TURNRATE_SPIN 1099
#define IDC_ACTOR_HEALTH_TEXT 1112
#define IDC_ACTOR_HEALTH 1113
#define IDC_ACTOR_HEALTH_SPIN 1114
#define IDC_ACTOR_ATTACK_TEXT 1115
#define IDC_ACTOR_ATTACK 1116
#define IDC_ACTOR_ATTACK_SPIN 1117
#define IDC_ACTOR_COLLISION 1118
#define ID_TOOLBAR_TILEPALETTE 32774 #define ID_TOOLBAR_TILEPALETTE 32774
#define ID_TOOLBAR_PARAMBAR 32783 #define ID_TOOLBAR_PARAMBAR 32783
#define ID_TOGGLE_SUBVIEW 32785 #define ID_TOGGLE_SUBVIEW 32785
@ -80,9 +104,9 @@
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1 #define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 178 #define _APS_NEXT_RESOURCE_VALUE 180
#define _APS_NEXT_COMMAND_VALUE 32800 #define _APS_NEXT_COMMAND_VALUE 32800
#define _APS_NEXT_CONTROL_VALUE 1081 #define _APS_NEXT_CONTROL_VALUE 1097
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif