This commit is contained in:
parent
337d6965ba
commit
9f1e03e8fc
@ -105,7 +105,8 @@ GFName Path=Filename;
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// 2d Elem (From Bmp File)
|
// 2d Elem (From Bmp File)
|
||||||
CElem::CElem(CCore *Core,const char *Filename,int TexID,int XOfs,int YOfs,int Width,int Height,bool Centre)
|
// 0,0 1,0 1,1 0,1
|
||||||
|
CElem::CElem(CCore *Core,const char *Filename,int TexID,int XOfs,int YOfs,int Width,int Height,int CentreMode)
|
||||||
{
|
{
|
||||||
CTexCache &TexCache=Core->GetTexCache();
|
CTexCache &TexCache=Core->GetTexCache();
|
||||||
GFName Path=Filename;
|
GFName Path=Filename;
|
||||||
@ -119,10 +120,32 @@ GFName Path=Filename;
|
|||||||
TexXOfs=XOfs;
|
TexXOfs=XOfs;
|
||||||
TexYOfs=YOfs;
|
TexYOfs=YOfs;
|
||||||
Ofs.Zero();
|
Ofs.Zero();
|
||||||
if (Centre)
|
|
||||||
|
if (CentreMode & CentreModeL)
|
||||||
{
|
{
|
||||||
Ofs.x=0.5-UnitWidth/2;
|
// Nothing to do, already there
|
||||||
Ofs.y=-1.0f;
|
}
|
||||||
|
if (CentreMode & CentreModeR)
|
||||||
|
{
|
||||||
|
Ofs.x-=UnitWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CentreMode & CentreModeT)
|
||||||
|
{
|
||||||
|
Ofs.y-=UnitHeight;
|
||||||
|
}
|
||||||
|
if (CentreMode & CentreModeB)
|
||||||
|
{
|
||||||
|
// Nothing to do, already there
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CentreMode & CentreModeLR)
|
||||||
|
{
|
||||||
|
Ofs.x-=(UnitWidth-1.0f)/2;
|
||||||
|
}
|
||||||
|
if (CentreMode & CentreModeTB)
|
||||||
|
{
|
||||||
|
Ofs.y-=(UnitHeight-1.0f)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Build2dElem(Core,Path.File(),TexID);
|
Build2dElem(Core,Path.File(),TexID);
|
||||||
@ -580,7 +603,7 @@ int Size=RGBData.TexW*RGBData.TexH;
|
|||||||
/*** Elem Set ****************************************************************/
|
/*** Elem Set ****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CElemSet::CElemSet(const char *_Filename,int Idx,int Width,int Height,bool CreateBlank,bool Centre)
|
CElemSet::CElemSet(const char *_Filename,int Idx,int Width,int Height,bool CreateBlank,int Centre)
|
||||||
{
|
{
|
||||||
GFName FName=_Filename;
|
GFName FName=_Filename;
|
||||||
|
|
||||||
@ -589,7 +612,7 @@ GFName FName=_Filename;
|
|||||||
|
|
||||||
MaxWidth=Width;
|
MaxWidth=Width;
|
||||||
MaxHeight=Height;
|
MaxHeight=Height;
|
||||||
CentreFlag=Centre;
|
CentreMode=Centre;
|
||||||
Loaded=FALSE;
|
Loaded=FALSE;
|
||||||
SetNumber=Idx;
|
SetNumber=Idx;
|
||||||
|
|
||||||
@ -648,7 +671,7 @@ int Width,Height;
|
|||||||
{
|
{
|
||||||
for (int X=0; X<Width; X++)
|
for (int X=0; X<Width; X++)
|
||||||
{
|
{
|
||||||
ElemList.push_back(CElem(Core,Filename,TexID,X,Y,MaxWidth,MaxHeight,CentreFlag));
|
ElemList.push_back(CElem(Core,Filename,TexID,X,Y,MaxWidth,MaxHeight,CentreMode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ElemBrowserWidth=Width;
|
ElemBrowserWidth=Width;
|
||||||
@ -707,12 +730,12 @@ int ListSize=ElemList.size();
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CElemBank::CElemBank(int W,int H,bool Blank,bool Centre)
|
CElemBank::CElemBank(int W,int H,bool Blank,int Centre)
|
||||||
{
|
{
|
||||||
MaxWidth=W;
|
MaxWidth=W;
|
||||||
MaxHeight=H;
|
MaxHeight=H;
|
||||||
BlankFlag=Blank;
|
BlankFlag=Blank;
|
||||||
CentreFlag=Centre;
|
CentreMode=Centre;
|
||||||
|
|
||||||
LoadFlag=false;
|
LoadFlag=false;
|
||||||
CurrentSet=0;
|
CurrentSet=0;
|
||||||
@ -810,7 +833,7 @@ GString SavePath;
|
|||||||
int CElemBank::AddSet(const char *Filename)
|
int CElemBank::AddSet(const char *Filename)
|
||||||
{
|
{
|
||||||
int ListSize=SetList.size();
|
int ListSize=SetList.size();
|
||||||
CElemSet NewSet(Filename,ListSize,MaxWidth,MaxHeight,BlankFlag,CentreFlag);
|
CElemSet NewSet(Filename,ListSize,MaxWidth,MaxHeight,BlankFlag,CentreMode);
|
||||||
|
|
||||||
int Idx=SetList.Add(NewSet);
|
int Idx=SetList.Add(NewSet);
|
||||||
if (SetList.size()!=ListSize) LoadFlag=TRUE;
|
if (SetList.size()!=ListSize) LoadFlag=TRUE;
|
||||||
|
@ -39,13 +39,22 @@ public:
|
|||||||
ElemType3d,
|
ElemType3d,
|
||||||
ElemTypeMax
|
ElemTypeMax
|
||||||
};
|
};
|
||||||
|
enum CentreMode
|
||||||
|
{
|
||||||
|
CentreModeL =1<<0,
|
||||||
|
CentreModeR =1<<1,
|
||||||
|
CentreModeLR=1<<2,
|
||||||
|
CentreModeT =1<<3,
|
||||||
|
CentreModeB =1<<4,
|
||||||
|
CentreModeTB=1<<5,
|
||||||
|
};
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
UnitSize=16,
|
UnitSize=16,
|
||||||
};
|
};
|
||||||
|
|
||||||
CElem(int Width,int Height); // Blank (2d)
|
CElem(int Width,int Height); // Blank (2d)
|
||||||
CElem(CCore *Core,const char *Filename,int TexId,int XOfs,int YOfs,int Width,int Height,bool Centre); // 2d elem
|
CElem(CCore *Core,const char *Filename,int TexId,int XOfs,int YOfs,int Width,int Height,int CentreMode=0); // 2d elem
|
||||||
CElem(CCore *Core,const char *Filename,CScene &ThisScene,int Node); // 3d elem
|
CElem(CCore *Core,const char *Filename,CScene &ThisScene,int Node); // 3d elem
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
@ -105,7 +114,7 @@ public:
|
|||||||
DEF_ELEMBROWSWEWIDTH=8,
|
DEF_ELEMBROWSWEWIDTH=8,
|
||||||
};
|
};
|
||||||
|
|
||||||
CElemSet(const char *_Filename,int Idx,int MaxWidth,int MaxHeight,bool CreateBlank,bool Centre);
|
CElemSet(const char *_Filename,int Idx,int MaxWidth,int MaxHeight,bool CreateBlank,int Centre=0);
|
||||||
~CElemSet();
|
~CElemSet();
|
||||||
|
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
@ -136,7 +145,7 @@ private:
|
|||||||
int SetNumber;
|
int SetNumber;
|
||||||
int MaxWidth,MaxHeight;
|
int MaxWidth,MaxHeight;
|
||||||
int BmpW,BmpH;
|
int BmpW,BmpH;
|
||||||
bool CentreFlag;
|
int CentreMode;
|
||||||
CList<CElem> ElemList;
|
CList<CElem> ElemList;
|
||||||
bool Loaded;
|
bool Loaded;
|
||||||
int ElemBrowserWidth;
|
int ElemBrowserWidth;
|
||||||
@ -147,7 +156,7 @@ class CElemBank : public CLayer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Local
|
// Local
|
||||||
CElemBank(int MaxWidth,int MaxHeight,bool Blank,bool Centre);
|
CElemBank(int MaxWidth,int MaxHeight,bool Blank,int Centre=0);
|
||||||
virtual ~CElemBank();
|
virtual ~CElemBank();
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
@ -200,7 +209,8 @@ protected:
|
|||||||
int CursorPos;
|
int CursorPos;
|
||||||
|
|
||||||
int MaxWidth,MaxHeight;
|
int MaxWidth,MaxHeight;
|
||||||
bool BlankFlag,CentreFlag;
|
bool BlankFlag;
|
||||||
|
int CentreMode;
|
||||||
|
|
||||||
CGUIElemList GUIElemList;
|
CGUIElemList GUIElemList;
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ CLayerActor::CLayerActor(sLayerDef &Def)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerActor::InitLayer(sLayerDef &Def)
|
void CLayerActor::InitLayer(sLayerDef &Def)
|
||||||
{
|
{
|
||||||
|
ThingBank=new CElemBank(-1,-1,false,CElem::CentreModeLR | CElem::CentreModeB);
|
||||||
CLayerThing::InitLayer(Def);
|
CLayerThing::InitLayer(Def);
|
||||||
LoadThingScript(theApp.GetConfigStr("LayerScript","ActorScript"));
|
LoadThingScript(theApp.GetConfigStr("LayerScript","ActorScript"));
|
||||||
}
|
}
|
||||||
@ -82,21 +83,9 @@ CComboBox &List=GUI.m_List;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerActor::GUIThingUpdate()
|
void CLayerActor::GUIThingUpdate(bool OnlySel)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
GUIThingUpdateList(GUI.m_LevelList,false);
|
||||||
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
|
// Params
|
||||||
GUI.DisableCallback(true);
|
GUI.DisableCallback(true);
|
||||||
if (CurrentThing!=-1)
|
if (CurrentThing!=-1)
|
||||||
@ -122,28 +111,9 @@ CComboBox &List=GUI.m_LevelList;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerActor::GUIThingPointUpdate()
|
void CLayerActor::GUIThingPointUpdate(bool OnlySel)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
GUIThingPointUpdateList(GUI.m_PosList,OnlySel);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -28,8 +28,8 @@ public:
|
|||||||
bool GUIReady();
|
bool GUIReady();
|
||||||
|
|
||||||
void GUIThingDefClear();
|
void GUIThingDefClear();
|
||||||
void GUIThingUpdate();
|
void GUIThingUpdate(bool OnlySel=false);
|
||||||
void GUIThingPointUpdate();
|
void GUIThingPointUpdate(bool OnlySel=false);
|
||||||
|
|
||||||
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
|
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
|
||||||
|
|
||||||
|
@ -30,8 +30,11 @@ CLayerItem::CLayerItem(sLayerDef &Def)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerItem::InitLayer(sLayerDef &Def)
|
void CLayerItem::InitLayer(sLayerDef &Def)
|
||||||
{
|
{
|
||||||
|
ThingBank=new CElemBank(-1,-1,false,CElem::CentreModeLR || CElem::CentreModeTB);
|
||||||
CLayerThing::InitLayer(Def);
|
CLayerThing::InitLayer(Def);
|
||||||
LoadThingScript(theApp.GetConfigStr("LayerScript","ItemScript"));
|
LoadThingScript(theApp.GetConfigStr("LayerScript","ItemScript"));
|
||||||
|
DrawPoints=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -82,10 +85,17 @@ CComboBox &List=GUI.m_List;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerItem::GUIThingUpdate()
|
void CLayerItem::GUIThingUpdate(bool OnlySel)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
int i,ListSize;
|
||||||
CComboBox &List=GUI.m_LevelList;
|
CComboBox &List=GUI.m_LevelList;
|
||||||
|
|
||||||
|
if (OnlySel)
|
||||||
|
{
|
||||||
|
List.SetCurSel(CurrentThing);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup ThingList
|
// Setup ThingList
|
||||||
ListSize=ThingList.size();
|
ListSize=ThingList.size();
|
||||||
TRACE1("%i\n",ListSize);
|
TRACE1("%i\n",ListSize);
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
bool GUIReady();
|
bool GUIReady();
|
||||||
|
|
||||||
void GUIThingDefClear();
|
void GUIThingDefClear();
|
||||||
void GUIThingUpdate();
|
void GUIThingUpdate(bool OnlySel=false);
|
||||||
|
|
||||||
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
|
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ CLayerPlatform::CLayerPlatform(sLayerDef &Def)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerPlatform::InitLayer(sLayerDef &Def)
|
void CLayerPlatform::InitLayer(sLayerDef &Def)
|
||||||
{
|
{
|
||||||
|
ThingBank=new CElemBank(-1,-1,false,0);
|
||||||
CLayerThing::InitLayer(Def);
|
CLayerThing::InitLayer(Def);
|
||||||
LoadThingScript(theApp.GetConfigStr("LayerScript","PlatformScript"));
|
LoadThingScript(theApp.GetConfigStr("LayerScript","PlatformScript"));
|
||||||
}
|
}
|
||||||
@ -86,49 +87,13 @@ CComboBox &List=GUI.m_List;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerPlatform::GUIThingUpdate()
|
void CLayerPlatform::GUIThingUpdate(bool OnlySel)
|
||||||
{
|
{
|
||||||
/*
|
// CLayerThing::GUIThingUpdateList(GUI.
|
||||||
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()
|
void CLayerPlatform::GUIThingPointUpdate(bool OnlySel)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
int i,ListSize;
|
int i,ListSize;
|
||||||
|
@ -28,8 +28,8 @@ public:
|
|||||||
bool GUIReady();
|
bool GUIReady();
|
||||||
|
|
||||||
void GUIThingDefClear();
|
void GUIThingDefClear();
|
||||||
void GUIThingUpdate();
|
void GUIThingUpdate(bool OnlySel=false);
|
||||||
void GUIThingPointUpdate();
|
void GUIThingPointUpdate(bool OnlySel=false);
|
||||||
|
|
||||||
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
|
void ExportThing(CExport &Exp,sLayerThing &ThisThing);
|
||||||
|
|
||||||
|
@ -40,13 +40,12 @@ void CLayerThing::InitLayer(sLayerDef &Def)
|
|||||||
{
|
{
|
||||||
CLayer::InitLayer(Def);
|
CLayer::InitLayer(Def);
|
||||||
Mode=MouseModeNormal;
|
Mode=MouseModeNormal;
|
||||||
ThingBank=new CElemBank(-1,-1,false,true);
|
|
||||||
Cursor.XY.resize(1);
|
Cursor.XY.resize(1);
|
||||||
Cursor.ElemID=-1;
|
Cursor.ElemID=-1;
|
||||||
CurrentDefThing=-1;
|
CurrentDefThing=-1;
|
||||||
CurrentThing=-1;
|
CurrentThing=-1;
|
||||||
CurrentThingPoint=0;
|
CurrentThingPoint=0;
|
||||||
|
DrawPoints=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -244,20 +243,28 @@ int ListSize=ThisThing.XY.size();
|
|||||||
// Render Thing
|
// Render Thing
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(ThisThing.XY[i].x,-ThisThing.XY[i].y,0); // Set Pos
|
glTranslatef(ThisThing.XY[i].x,-ThisThing.XY[i].y,0); // Set Pos
|
||||||
if (Selected)
|
|
||||||
glColor4f(1,1,1,1); // Set default Color
|
|
||||||
else
|
|
||||||
glColor4f(1,1,1,0.5);
|
|
||||||
|
|
||||||
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
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glTranslatef(0,0,ScrOfs.z);
|
glTranslatef(0,0,ScrOfs.z);
|
||||||
ThingBank->RenderElem(ThisThing.ElemID,0,0,Render3d);
|
ThingBank->RenderElem(ThisThing.ElemID,0,0,Render3d);
|
||||||
glTranslatef(0,0,-ScrOfs.z);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glTranslatef(0,0,-ScrOfs.z);
|
||||||
|
if (Selected)
|
||||||
|
glColor4f(1,1,0,0.8f);
|
||||||
|
else
|
||||||
|
glColor4f(1,1,0,0.5f);
|
||||||
|
if (DrawPoints) Core->RenderNumber(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Selected)
|
||||||
|
glColor4f(1,1,1,1); // Set default Color
|
||||||
|
else
|
||||||
|
glColor4f(1,1,1,0.5);
|
||||||
|
if (DrawPoints) Core->RenderNumber(i);
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
@ -287,6 +294,47 @@ void CLayerThing::GUIChanged(CCore *Core)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayerThing::GUIThingUpdateList(CComboBox &List,bool OnlySel)
|
||||||
|
{
|
||||||
|
int i,ListSize;
|
||||||
|
|
||||||
|
if (!OnlySel)
|
||||||
|
{
|
||||||
|
// Setup ThingList
|
||||||
|
ListSize=ThingList.size();
|
||||||
|
List.ResetContent();
|
||||||
|
for (i=0; i<ListSize; i++)
|
||||||
|
{
|
||||||
|
List.AddString(ThingList[i].Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List.SetCurSel(CurrentThing);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayerThing::GUIThingPointUpdateList(CListBox &List,bool OnlySel)
|
||||||
|
{
|
||||||
|
int i,ListSize;
|
||||||
|
|
||||||
|
if (!OnlySel)
|
||||||
|
{
|
||||||
|
// Setup ThingPointList
|
||||||
|
List.ResetContent();
|
||||||
|
if (CurrentThing==-1) return;
|
||||||
|
sLayerThing &ThisThing=ThingList[CurrentThing];
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Functions ***************************************************************/
|
/*** Functions ***************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -299,16 +347,12 @@ bool Ret=false;
|
|||||||
{
|
{
|
||||||
case MouseModeNormal:
|
case MouseModeNormal:
|
||||||
SelectThing(CursorPos);
|
SelectThing(CursorPos);
|
||||||
GUIThingUpdate();
|
|
||||||
break;
|
break;
|
||||||
case MouseModeNew:
|
case MouseModeNew:
|
||||||
AddThing(CursorPos);
|
AddThing(CursorPos);
|
||||||
GUIThingDefClear();
|
|
||||||
GUIThingUpdate();
|
|
||||||
break;
|
break;
|
||||||
case MouseModePoints:
|
case MouseModePoints:
|
||||||
AddThingPoint(CursorPos);
|
AddThingPoint(CursorPos);
|
||||||
GUIThingPointUpdate();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -320,7 +364,6 @@ 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)
|
||||||
{
|
{
|
||||||
if (!DownFlag) return(false);
|
|
||||||
Cancel();
|
Cancel();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@ -335,7 +378,6 @@ bool Ret=false;
|
|||||||
if (nFlags & MK_LBUTTON) // Drag
|
if (nFlags & MK_LBUTTON) // Drag
|
||||||
{
|
{
|
||||||
UpdatePos(CursorPos,CurrentThing,CurrentThingPoint,(nFlags & MK_CONTROL)!=0);
|
UpdatePos(CursorPos,CurrentThing,CurrentThingPoint,(nFlags & MK_CONTROL)!=0);
|
||||||
GUIThingPointUpdate();
|
|
||||||
Ret=true;
|
Ret=true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -361,6 +403,7 @@ void CLayerThing::Cancel()
|
|||||||
CurrentThingPoint=0;
|
CurrentThingPoint=0;
|
||||||
GUIThingDefClear();
|
GUIThingDefClear();
|
||||||
GUIThingUpdate();
|
GUIThingUpdate();
|
||||||
|
GUIThingPointUpdate();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -376,7 +419,6 @@ bool Ret=false;
|
|||||||
{
|
{
|
||||||
case CmdMsg_ThingListDelete:
|
case CmdMsg_ThingListDelete:
|
||||||
DeleteThing();
|
DeleteThing();
|
||||||
GUIThingUpdate();
|
|
||||||
break;
|
break;
|
||||||
case CmdMsg_ThingListSelect:
|
case CmdMsg_ThingListSelect:
|
||||||
CurrentDefThing=Param0;
|
CurrentDefThing=Param0;
|
||||||
@ -385,7 +427,6 @@ bool Ret=false;
|
|||||||
break;
|
break;
|
||||||
case CmdMsg_ThingLevelSelect:
|
case CmdMsg_ThingLevelSelect:
|
||||||
SelectThing(Param0);
|
SelectThing(Param0);
|
||||||
GUIThingUpdate();
|
|
||||||
break;
|
break;
|
||||||
case CmdMsg_ThingPosSelect:
|
case CmdMsg_ThingPosSelect:
|
||||||
CurrentThingPoint=Param0;
|
CurrentThingPoint=Param0;
|
||||||
@ -479,12 +520,14 @@ void CLayerThing::AddThing(CPoint &Pos)
|
|||||||
CurrentThing=SelectThing(Pos);
|
CurrentThing=SelectThing(Pos);
|
||||||
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=Cursor;
|
||||||
SelectThing(CurrentThing);
|
SelectThing(CurrentThing);
|
||||||
|
GUIThingDefClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -511,6 +554,8 @@ int CLayerThing::SelectThing(int Idx)
|
|||||||
{
|
{
|
||||||
Mode=MouseModeNormal;
|
Mode=MouseModeNormal;
|
||||||
}
|
}
|
||||||
|
GUIThingUpdate();
|
||||||
|
GUIThingPointUpdate();
|
||||||
}
|
}
|
||||||
return(CurrentThing);
|
return(CurrentThing);
|
||||||
}
|
}
|
||||||
@ -522,6 +567,7 @@ void CLayerThing::DeleteThing()
|
|||||||
|
|
||||||
ThingList.erase(CurrentThing);
|
ThingList.erase(CurrentThing);
|
||||||
CurrentThing--;
|
CurrentThing--;
|
||||||
|
GUIThingUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -557,15 +603,22 @@ int StartIdx=0;
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerThing::AddThingPoint(CPoint &Pos)
|
void CLayerThing::AddThingPoint(CPoint &Pos)
|
||||||
{
|
{
|
||||||
|
TRACE1("ADDTHINGPOINT %i\n",CurrentThingPoint);
|
||||||
if (Pos.x==-1 || Pos.y==-1) return; // Off Map?
|
if (Pos.x==-1 || Pos.y==-1) return; // Off Map?
|
||||||
CurrentThingPoint=SelectThingPoint(Pos);
|
CurrentThingPoint=SelectThingPoint(Pos);
|
||||||
|
|
||||||
if (CurrentThingPoint!=-1) return;
|
if (CurrentThingPoint!=-1)
|
||||||
|
{
|
||||||
|
GUIThingPointUpdate(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
sLayerThing &ThisThing=ThingList[CurrentThing];
|
sLayerThing &ThisThing=ThingList[CurrentThing];
|
||||||
|
|
||||||
CurrentThingPoint=ThisThing.XY.size();
|
CurrentThingPoint=ThisThing.XY.size();
|
||||||
ThisThing.XY.resize(CurrentThingPoint+1);
|
ThisThing.XY.resize(CurrentThingPoint+1);
|
||||||
ThisThing.XY[CurrentThingPoint]=Pos;
|
ThisThing.XY[CurrentThingPoint]=Pos;
|
||||||
|
TRACE0("Add Point\n");
|
||||||
|
GUIThingPointUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -585,6 +638,8 @@ sLayerThing &ThisThing=ThingList[Thing];
|
|||||||
CPoint dPos=Pos-ThisThing.XY[PosIdx];
|
CPoint dPos=Pos-ThisThing.XY[PosIdx];
|
||||||
int StartIdx=PosIdx,EndIdx=ThisThing.XY.size();
|
int StartIdx=PosIdx,EndIdx=ThisThing.XY.size();
|
||||||
|
|
||||||
|
if (!dPos.x && !dPos.y) return;
|
||||||
|
|
||||||
if (!Recurs)
|
if (!Recurs)
|
||||||
{
|
{
|
||||||
StartIdx=PosIdx;
|
StartIdx=PosIdx;
|
||||||
@ -595,6 +650,8 @@ int StartIdx=PosIdx,EndIdx=ThisThing.XY.size();
|
|||||||
{
|
{
|
||||||
ThisThing.XY[i]+=dPos;
|
ThisThing.XY[i]+=dPos;
|
||||||
}
|
}
|
||||||
|
GUIThingPointUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -64,8 +64,10 @@ virtual void GUIUpdate(CCore *Core);
|
|||||||
virtual void GUIChanged(CCore *Core);
|
virtual void GUIChanged(CCore *Core);
|
||||||
|
|
||||||
virtual void GUIThingDefClear(){};
|
virtual void GUIThingDefClear(){};
|
||||||
virtual void GUIThingUpdate(){};
|
virtual void GUIThingUpdate(bool OnlySel=false){};
|
||||||
virtual void GUIThingPointUpdate(){};
|
virtual void GUIThingUpdateList(CComboBox &List,bool OnlySel=false);
|
||||||
|
virtual void GUIThingPointUpdate(bool OnlySel=false){};
|
||||||
|
virtual void GUIThingPointUpdateList(CListBox &List,bool OnlySel=false);
|
||||||
|
|
||||||
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 LoadThing(CFile *File,int Version,sLayerThing &ThisThing);
|
||||||
@ -112,6 +114,7 @@ virtual void SetCursor(const char *Name);
|
|||||||
int CurrentThing,CurrentThingPoint;
|
int CurrentThing,CurrentThingPoint;
|
||||||
MouseMode Mode;
|
MouseMode Mode;
|
||||||
sLayerThing Cursor;
|
sLayerThing Cursor;
|
||||||
|
bool DrawPoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user