This commit is contained in:
parent
4f2649a592
commit
057cb931bb
19 changed files with 919 additions and 590 deletions
|
@ -85,7 +85,7 @@ int Width,Height;
|
||||||
// AddLayer(LAYER_TYPE_SHADE,LAYER_SUBTYPE_NONE, Width, Height);
|
// AddLayer(LAYER_TYPE_SHADE,LAYER_SUBTYPE_NONE, Width, Height);
|
||||||
// AddLayer(LAYER_TYPE_TRIGGER,LAYER_SUBTYPE_NONE, Width, Height);
|
// AddLayer(LAYER_TYPE_TRIGGER,LAYER_SUBTYPE_NONE, Width, Height);
|
||||||
// AddLayer(LAYER_TYPE_PLATFORM,LAYER_SUBTYPE_NONE, Width, Height);
|
// AddLayer(LAYER_TYPE_PLATFORM,LAYER_SUBTYPE_NONE, Width, Height);
|
||||||
AddLayer(LAYER_TYPE_HAZARD,LAYER_SUBTYPE_NONE, Width, Height);
|
AddLayer(LAYER_TYPE_RGB,LAYER_SUBTYPE_NONE, Width, Height);
|
||||||
// AddLayer(LAYER_TYPE_FX,LAYER_SUBTYPE_NONE, Width, Height);
|
// AddLayer(LAYER_TYPE_FX,LAYER_SUBTYPE_NONE, Width, Height);
|
||||||
// AddLayer(LAYER_TYPE_ACTOR,LAYER_SUBTYPE_NONE, Width, Height);
|
// AddLayer(LAYER_TYPE_ACTOR,LAYER_SUBTYPE_NONE, Width, Height);
|
||||||
// AddLayer(LAYER_TYPE_ITEM,LAYER_SUBTYPE_NONE, Width, Height);
|
// AddLayer(LAYER_TYPE_ITEM,LAYER_SUBTYPE_NONE, Width, Height);
|
||||||
|
|
|
@ -107,6 +107,7 @@ public:
|
||||||
void Toggle2d3d();
|
void Toggle2d3d();
|
||||||
int FindLayer(int Type,int SubType=-1);
|
int FindLayer(int Type,int SubType=-1);
|
||||||
int SetActionLayer(CLayerTile *Lyr) {ActionLayer=Lyr;}
|
int SetActionLayer(CLayerTile *Lyr) {ActionLayer=Lyr;}
|
||||||
|
CLayer *GetActionLayer() {return(ActionLayer);}
|
||||||
|
|
||||||
void SetScale();
|
void SetScale();
|
||||||
Vector3 &GetScaleVector() {return(ScaleVector);}
|
Vector3 &GetScaleVector() {return(ScaleVector);}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
struct sRGBCol
|
struct sRGBCol
|
||||||
{
|
{
|
||||||
u8 R,G,B,P;
|
u8 R,G,B,P;
|
||||||
|
bool operator ==(sRGBCol const &v1) {return(R==v1.R && G==v1.G && B==v1.B);}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sXY
|
struct sXY
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include "mapedit.h"
|
#include "mapedit.h"
|
||||||
#include "GUILayerRGB.h"
|
#include "GUILayerRGB.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
|
||||||
|
@ -19,7 +22,6 @@ CGUILayerRGB::CGUILayerRGB(CWnd* pParent /*=NULL*/)
|
||||||
: CDialog(CGUILayerRGB::IDD, pParent)
|
: CDialog(CGUILayerRGB::IDD, pParent)
|
||||||
{
|
{
|
||||||
//{{AFX_DATA_INIT(CGUILayerRGB)
|
//{{AFX_DATA_INIT(CGUILayerRGB)
|
||||||
// NOTE: the ClassWizard will add member initialization here
|
|
||||||
//}}AFX_DATA_INIT
|
//}}AFX_DATA_INIT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,16 +30,97 @@ void CGUILayerRGB::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
CDialog::DoDataExchange(pDX);
|
CDialog::DoDataExchange(pDX);
|
||||||
//{{AFX_DATA_MAP(CGUILayerRGB)
|
//{{AFX_DATA_MAP(CGUILayerRGB)
|
||||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
DDX_Control(pDX, IDC_LAYERSHADE_MODELIST, m_ModeList);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_SHADE, m_Shade);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_BSPIN, m_BSpin);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_B, m_B);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_GSPIN, m_GSpin);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_G, m_G);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_RSPIN, m_RSpin);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_R, m_R);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_BRUSHSPIN, m_BrushSpin);
|
||||||
|
DDX_Control(pDX, IDC_LAYERSHADE_BRUSH, m_Brush);
|
||||||
//}}AFX_DATA_MAP
|
//}}AFX_DATA_MAP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(CGUILayerRGB, CDialog)
|
BEGIN_MESSAGE_MAP(CGUILayerRGB, CDialog)
|
||||||
//{{AFX_MSG_MAP(CGUILayerRGB)
|
//{{AFX_MSG_MAP(CGUILayerRGB)
|
||||||
// NOTE: the ClassWizard will add message map macros here
|
ON_EN_CHANGE(IDC_LAYERSHADE_BRUSH, OnParamChange)
|
||||||
|
ON_EN_CHANGE(IDC_LAYERSHADE_R, OnParamChange)
|
||||||
|
ON_EN_CHANGE(IDC_LAYERSHADE_G, OnParamChange)
|
||||||
|
ON_EN_CHANGE(IDC_LAYERSHADE_B, OnParamChange)
|
||||||
|
ON_CBN_SELCHANGE(IDC_LAYERSHADE_MODELIST, OnParamChange)
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CGUILayerRGB message handlers
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CGUILayerRGB::SetVal(CEdit &Dlg,int &Val,int Min,int Max)
|
||||||
|
{
|
||||||
|
CString Str;
|
||||||
|
bool CF=CallbackFlag;
|
||||||
|
if (!Dlg) return;
|
||||||
|
if (Min!=-1 && Val<Min) Val=Min;
|
||||||
|
if (Max!=-1 && Val>Max) Val=Max;
|
||||||
|
CallbackFlag=false;
|
||||||
|
Str.Format("%i",Val);
|
||||||
|
Dlg.SetWindowText(Str);
|
||||||
|
CallbackFlag=CF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CGUILayerRGB::GetVal(CEdit &Dlg,int &Val,int Min,int Max)
|
||||||
|
{
|
||||||
|
CString Str;
|
||||||
|
Val=0;
|
||||||
|
if (!Dlg) return;
|
||||||
|
Dlg.GetWindowText(Str);
|
||||||
|
if (Str.GetLength())
|
||||||
|
{
|
||||||
|
Val=atoi(Str);
|
||||||
|
if (Min!=-1 && Val<Min) {Val=Min;SetVal(Dlg,Val,Min,Max);}
|
||||||
|
if (Max!=-1 && Val>Max) {Val=Max;SetVal(Dlg,Val,Min,Max);}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CGUILayerRGB::SetRGB(u8 &R,u8 &G,u8 &B)
|
||||||
|
{
|
||||||
|
int iR,iG,iB;
|
||||||
|
|
||||||
|
iR=R;
|
||||||
|
iG=G;
|
||||||
|
iB=B;
|
||||||
|
|
||||||
|
SetVal(m_R,iR,0,255);
|
||||||
|
SetVal(m_G,iG,0,255);
|
||||||
|
SetVal(m_B,iB,0,255);
|
||||||
|
|
||||||
|
R=iR;
|
||||||
|
G=iG;
|
||||||
|
B=iB;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CGUILayerRGB::GetRGB(u8 &R,u8 &G,u8 &B)
|
||||||
|
{
|
||||||
|
int iR,iG,iB;
|
||||||
|
|
||||||
|
iR=R;
|
||||||
|
iG=G;
|
||||||
|
iB=B;
|
||||||
|
|
||||||
|
GetVal(m_R,iR,0,255);
|
||||||
|
GetVal(m_G,iG,0,255);
|
||||||
|
GetVal(m_B,iB,0,255);
|
||||||
|
|
||||||
|
R=iR;
|
||||||
|
G=iG;
|
||||||
|
B=iB;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CGUILayerRGB::OnParamChange() {if (CallbackFlag) theApp.GetCurrent()->GUIChanged();}
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
#endif // _MSC_VER > 1000
|
#endif // _MSC_VER > 1000
|
||||||
// GUILayerRGB.h : header file
|
// GUILayerRGB.h : header file
|
||||||
//
|
//
|
||||||
|
#ifndef u8
|
||||||
|
typedef unsigned char u8;
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CGUILayerRGB dialog
|
// CGUILayerRGB dialog
|
||||||
|
@ -19,7 +22,16 @@ public:
|
||||||
// Dialog Data
|
// Dialog Data
|
||||||
//{{AFX_DATA(CGUILayerRGB)
|
//{{AFX_DATA(CGUILayerRGB)
|
||||||
enum { IDD = IDD_LAYER_RGB };
|
enum { IDD = IDD_LAYER_RGB };
|
||||||
// NOTE: the ClassWizard will add data members here
|
CComboBox m_ModeList;
|
||||||
|
CButton m_Shade;
|
||||||
|
CSpinButtonCtrl m_BSpin;
|
||||||
|
CEdit m_B;
|
||||||
|
CSpinButtonCtrl m_GSpin;
|
||||||
|
CEdit m_G;
|
||||||
|
CSpinButtonCtrl m_RSpin;
|
||||||
|
CEdit m_R;
|
||||||
|
CSpinButtonCtrl m_BrushSpin;
|
||||||
|
CEdit m_Brush;
|
||||||
//}}AFX_DATA
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,11 +43,21 @@ public:
|
||||||
//}}AFX_VIRTUAL
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
|
public:
|
||||||
|
void EnableCallback() {CallbackFlag=true;}
|
||||||
|
void DisableCallback() {CallbackFlag=false;}
|
||||||
|
|
||||||
|
void SetVal(CEdit &Dlg,int &Val,int Min=-1,int Max=-1);
|
||||||
|
void GetVal(CEdit &Dlg,int &Val,int Min=-1,int Max=-1);
|
||||||
|
void SetRGB(u8 &R,u8 &G,u8 &B);
|
||||||
|
void GetRGB(u8 &R,u8 &G,u8 &B);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool CallbackFlag;
|
||||||
|
|
||||||
// Generated message map functions
|
// Generated message map functions
|
||||||
//{{AFX_MSG(CGUILayerRGB)
|
//{{AFX_MSG(CGUILayerRGB)
|
||||||
// NOTE: the ClassWizard will add member functions here
|
afx_msg void OnParamChange();
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "LayerTrigger.h"
|
#include "LayerTrigger.h"
|
||||||
#include "LayerFX.h"
|
#include "LayerFX.h"
|
||||||
#include "LayerHazard.h"
|
#include "LayerHazard.h"
|
||||||
|
#include "LayerRGB.h"
|
||||||
|
|
||||||
#include "LayerDef.h"
|
#include "LayerDef.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
@ -47,6 +48,7 @@ sLayerInfoTable CLayer::InfoTable[]=
|
||||||
{LAYER_TYPE_TRIGGER, LAYER_SUBTYPE_NONE, "Trigger", true, 1.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
{LAYER_TYPE_TRIGGER, LAYER_SUBTYPE_NONE, "Trigger", true, 1.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
||||||
{LAYER_TYPE_FX, LAYER_SUBTYPE_NONE, "FX", true, 1.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
{LAYER_TYPE_FX, LAYER_SUBTYPE_NONE, "FX", true, 1.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
||||||
{LAYER_TYPE_HAZARD, LAYER_SUBTYPE_NONE, "Hazard", true, 1.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
{LAYER_TYPE_HAZARD, LAYER_SUBTYPE_NONE, "Hazard", true, 1.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
||||||
|
{LAYER_TYPE_RGB, LAYER_SUBTYPE_NONE, "RGB", true, 1.0f, false, true, true, LAYER_SUBVIEW_NONE,},
|
||||||
};
|
};
|
||||||
|
|
||||||
int CLayer::InfoTableSize=sizeof(InfoTable)/sizeof(sLayerInfoTable);
|
int CLayer::InfoTableSize=sizeof(InfoTable)/sizeof(sLayerInfoTable);
|
||||||
|
@ -105,6 +107,9 @@ CLayer *New;
|
||||||
case LAYER_TYPE_HAZARD:
|
case LAYER_TYPE_HAZARD:
|
||||||
New=new CLayerHazard(Def);
|
New=new CLayerHazard(Def);
|
||||||
break;
|
break;
|
||||||
|
case LAYER_TYPE_RGB:
|
||||||
|
New=new CLayerRGB(Def);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(!"Unknown Layer");
|
ASSERT(!"Unknown Layer");
|
||||||
}
|
}
|
||||||
|
@ -148,6 +153,9 @@ CLayer *New;
|
||||||
case LAYER_TYPE_HAZARD:
|
case LAYER_TYPE_HAZARD:
|
||||||
New=new CLayerHazard(File,Version);
|
New=new CLayerHazard(File,Version);
|
||||||
break;
|
break;
|
||||||
|
case LAYER_TYPE_RGB:
|
||||||
|
New=new CLayerRGB(File,Version);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(!"Unknown Layer");
|
ASSERT(!"Unknown Layer");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ enum LAYER_TYPE
|
||||||
LAYER_TYPE_TRIGGER,
|
LAYER_TYPE_TRIGGER,
|
||||||
LAYER_TYPE_FX,
|
LAYER_TYPE_FX,
|
||||||
LAYER_TYPE_HAZARD,
|
LAYER_TYPE_HAZARD,
|
||||||
|
LAYER_TYPE_RGB,
|
||||||
LAYER_TYPE_MAX
|
LAYER_TYPE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************/
|
/*****************/
|
||||||
/*** Layer Shade ***/
|
/*** Layer RGB ***/
|
||||||
/*******************/
|
/*****************/
|
||||||
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
@ -16,167 +16,173 @@
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "LayerShade.h"
|
#include "LayerRGB.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "Select.h"
|
#include "Select.h"
|
||||||
#include "Export.h"
|
#include "Export.h"
|
||||||
#include "GUILayerShade.h"
|
#include "GUILayerRGB.h"
|
||||||
#include "Elem.h"
|
#include "Elem.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
char *CLayerRGB::RGBModeName[CLayerRGB::GUI_MODE_MAX]={"Paint","Tint","Lighten","Darken"};
|
||||||
|
|
||||||
|
u8 BrushGfx1[]=
|
||||||
|
{
|
||||||
|
1
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 BrushGfx2[]=
|
||||||
|
{
|
||||||
|
1,1,
|
||||||
|
1,1,
|
||||||
|
};
|
||||||
|
u8 BrushGfx3[]=
|
||||||
|
{
|
||||||
|
0,1,0,
|
||||||
|
1,2,1,
|
||||||
|
0,1,0,
|
||||||
|
};
|
||||||
|
u8 BrushGfx4[]=
|
||||||
|
{
|
||||||
|
0,1,1,0,
|
||||||
|
1,2,2,1,
|
||||||
|
1,2,2,1,
|
||||||
|
0,1,1,0,
|
||||||
|
};
|
||||||
|
u8 BrushGfx5[]=
|
||||||
|
{
|
||||||
|
0,0,1,0,0,
|
||||||
|
0,1,2,1,0,
|
||||||
|
1,2,3,2,1,
|
||||||
|
0,1,2,1,0,
|
||||||
|
0,0,1,0,0,
|
||||||
|
};
|
||||||
|
u8 BrushGfx6[]=
|
||||||
|
{
|
||||||
|
0,0,1,1,0,0,
|
||||||
|
0,1,2,2,1,0,
|
||||||
|
1,2,3,3,2,1,
|
||||||
|
1,2,3,3,2,1,
|
||||||
|
0,1,2,2,1,0,
|
||||||
|
0,0,1,1,0,0,
|
||||||
|
};
|
||||||
|
u8 BrushGfx7[]=
|
||||||
|
{
|
||||||
|
0,0,1,1,1,0,0,
|
||||||
|
0,1,2,2,2,1,0,
|
||||||
|
1,2,3,3,3,2,1,
|
||||||
|
1,2,3,4,3,2,1,
|
||||||
|
1,2,3,3,3,2,1,
|
||||||
|
0,1,2,2,2,1,0,
|
||||||
|
0,0,1,1,1,0,0,
|
||||||
|
};
|
||||||
|
u8 BrushGfx8[]=
|
||||||
|
{
|
||||||
|
0,0,1,1,1,1,0,0,
|
||||||
|
0,1,2,2,2,2,1,0,
|
||||||
|
1,2,3,3,3,3,2,1,
|
||||||
|
1,2,3,4,4,3,2,1,
|
||||||
|
1,2,3,4,4,3,2,1,
|
||||||
|
1,2,3,3,3,3,2,1,
|
||||||
|
0,1,2,2,2,2,1,0,
|
||||||
|
0,0,1,1,1,1,0,0,
|
||||||
|
};
|
||||||
|
|
||||||
|
CLayerRGB::sRGBBrush CLayerRGB::RGBBrushTable[CLayerRGB::RGB_BRUSH_MAX]=
|
||||||
|
{
|
||||||
|
{1,0,BrushGfx1},
|
||||||
|
{2,1,BrushGfx2},
|
||||||
|
{3,1,BrushGfx3},
|
||||||
|
{4,2,BrushGfx4},
|
||||||
|
{5,2,BrushGfx5},
|
||||||
|
{6,3,BrushGfx6},
|
||||||
|
{7,3,BrushGfx7},
|
||||||
|
{8,4,BrushGfx8},
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// New Layer
|
// New Layer
|
||||||
CLayerShade::CLayerShade(sLayerDef &Def)
|
CLayerRGB::CLayerRGB(sLayerDef &Def)
|
||||||
{
|
{
|
||||||
InitLayer(Def);
|
InitLayer(Def);
|
||||||
GString ExecPath;
|
|
||||||
GString ScriptName;
|
|
||||||
|
|
||||||
GfxBank=new CElemBank(-1,-1,false,CElem::CentreModeLR | CElem::CentreModeTB);
|
CurrentRGB.R=128;
|
||||||
LoadGfx();
|
CurrentRGB.G=128;
|
||||||
Cursor.Gfx=-1;
|
CurrentRGB.B=128;
|
||||||
Cursor.Ofs[0].x=-2; Cursor.Ofs[0].y=-2;
|
CurrentMode=0;
|
||||||
Cursor.Ofs[1].x=+2; Cursor.Ofs[1].y=-2;
|
CurrentBrush=0;
|
||||||
Cursor.Ofs[2].x=-2; Cursor.Ofs[2].y=+2;
|
ShadeFlag=false;
|
||||||
Cursor.Ofs[3].x=+2; Cursor.Ofs[3].y=+2;
|
LastCursPos.x=-1;
|
||||||
Cursor.TransMode=0;
|
LastCursPos.y=-1;
|
||||||
|
|
||||||
for(int i=0; i<4; i++)
|
|
||||||
{
|
|
||||||
Cursor.RGB[i].R=Cursor.RGB[i].G=Cursor.RGB[i].B=255;
|
|
||||||
}
|
|
||||||
CurrentGfx=-1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CLayerShade::~CLayerShade()
|
CLayerRGB::~CLayerRGB()
|
||||||
{
|
{
|
||||||
GfxBank->CleanUp();
|
|
||||||
delete GfxBank;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::LoadGfx()
|
void CLayerRGB::InitLayer(sLayerDef &Def)
|
||||||
{
|
|
||||||
GString ExecPath;
|
|
||||||
GString ScriptName;
|
|
||||||
GetExecPath(ExecPath);
|
|
||||||
ScriptName=ExecPath+theApp.GetConfigStr("LayerScript","BackGfxScript");
|
|
||||||
Script.LoadAndImport(ScriptName);
|
|
||||||
|
|
||||||
int i,ListSize=Script.GetGroupCount();
|
|
||||||
BankList.resize(ListSize);
|
|
||||||
|
|
||||||
for (i=0; i<ListSize; i++)
|
|
||||||
{
|
|
||||||
sBackList &ThisGfx=BankList[i];
|
|
||||||
|
|
||||||
char *Name=Script.GetGroupName(i);
|
|
||||||
char *Gfx=Script.GetStr(Name,"gfx");
|
|
||||||
|
|
||||||
ThisGfx.Name=Name;
|
|
||||||
if (Gfx)
|
|
||||||
{
|
|
||||||
char Filename[512];
|
|
||||||
GFName::makeabsolute(ExecPath,Gfx,Filename);
|
|
||||||
ThisGfx.ElemID=GfxBank->AddSet(Filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerShade::InitLayer(sLayerDef &Def)
|
|
||||||
{
|
{
|
||||||
CLayer::InitLayer(Def);
|
CLayer::InitLayer(Def);
|
||||||
// LayerDef.Width=TileLayerMinWidth+(Def.Width-TileLayerMinWidth)/GetScaleFactor();
|
SetSize(Def.Width,Def.Height,true);
|
||||||
// LayerDef.Height=TileLayerMinHeight+(Def.Height-TileLayerMinHeight)/GetScaleFactor();
|
|
||||||
|
|
||||||
ShadeRGB[0].R=255; ShadeRGB[0].G=255; ShadeRGB[0].B=255;
|
|
||||||
ShadeRGB[1].R=255; ShadeRGB[1].G=0; ShadeRGB[1].B=0;
|
|
||||||
ShadeRGB[2].R=0; ShadeRGB[2].G=255; ShadeRGB[2].B=0;
|
|
||||||
ShadeRGB[3].R=0; ShadeRGB[3].G=0; ShadeRGB[3].B=255;
|
|
||||||
|
|
||||||
ShadeCount=2;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::Load(CFile *File,int Version)
|
void CLayerRGB::Load(CFile *File,int Version)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
InitLayer(LayerDef);
|
InitLayer(LayerDef);
|
||||||
|
|
||||||
File->Read(&ShadeCount,sizeof(int));
|
File->Read(&CurrentRGB,sizeof(sRGBElem));
|
||||||
|
File->Read(&CurrentBrush,sizeof(int));
|
||||||
|
File->Read(&CurrentMode,sizeof(int));
|
||||||
|
File->Read(&ShadeFlag,sizeof(bool));
|
||||||
|
|
||||||
if (Version<9)
|
// Read Map
|
||||||
{ // GOD I HATE FILE VERSIONS NOW!!
|
File->Read(&MapWidth,sizeof(int));
|
||||||
int DummyInt;
|
File->Read(&MapHeight,sizeof(int));
|
||||||
|
SetSize(MapWidth,MapHeight,false);
|
||||||
|
for (int Y=0; Y<MapHeight; Y++)
|
||||||
|
{
|
||||||
|
for (int X=0; X<MapWidth; X++)
|
||||||
|
{
|
||||||
|
sRGBElem &ThisElem=Map[X][Y];
|
||||||
|
|
||||||
for (i=0; i<LAYER_SHADE_RGB_MAX; i++)
|
File->Read(&ThisElem,sizeof(sRGBElem));
|
||||||
{
|
|
||||||
RGBQUAD RGB;
|
|
||||||
File->Read(&DummyInt,sizeof(int));
|
|
||||||
File->Read(&RGB,sizeof(RGBQUAD));
|
|
||||||
ShadeRGB[i].R=RGB.rgbRed;
|
|
||||||
ShadeRGB[i].G=RGB.rgbGreen;
|
|
||||||
ShadeRGB[i].B=RGB.rgbBlue;
|
|
||||||
}
|
}
|
||||||
File->Read(&DummyInt,sizeof(int));
|
|
||||||
File->Read(&DummyInt,sizeof(int));
|
|
||||||
if (Version==8)
|
|
||||||
{
|
|
||||||
File->Read(&DummyInt,sizeof(int));
|
|
||||||
File->Read(&DummyInt,sizeof(int));
|
|
||||||
File->Read(&DummyInt,sizeof(int));
|
|
||||||
File->Read(&DummyInt,sizeof(int));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int GfxCount;
|
|
||||||
for (i=0; i<LAYER_SHADE_RGB_MAX; i++)
|
|
||||||
{
|
|
||||||
File->Read(&ShadeRGB[i],sizeof(sRGBCol));
|
|
||||||
}
|
|
||||||
// Load GfxList
|
|
||||||
File->Read(&GfxCount,sizeof(int));
|
|
||||||
GfxList.resize(GfxCount);
|
|
||||||
for (i=0; i<GfxCount; i++)
|
|
||||||
{
|
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[i];
|
|
||||||
File->Read(&ThisGfx,sizeof(sLayerShadeGfx));
|
|
||||||
}
|
|
||||||
if (GfxCount) CurrentGfx=0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::Save(CFile *File)
|
void CLayerRGB::Save(CFile *File)
|
||||||
{
|
{
|
||||||
// Always Save current version
|
// Always Save current version
|
||||||
File->Write(&ShadeCount,sizeof(int));
|
File->Write(&CurrentRGB,sizeof(sRGBElem));
|
||||||
for (int i=0; i<LAYER_SHADE_RGB_MAX; i++)
|
File->Write(&CurrentBrush,sizeof(int));
|
||||||
|
File->Write(&CurrentMode,sizeof(int));
|
||||||
|
File->Write(&ShadeFlag,sizeof(bool));
|
||||||
|
|
||||||
|
// Read Map
|
||||||
|
File->Write(&MapWidth,sizeof(int));
|
||||||
|
File->Write(&MapHeight,sizeof(int));
|
||||||
|
for (int Y=0; Y<MapHeight; Y++)
|
||||||
{
|
{
|
||||||
File->Write(&ShadeRGB[i],sizeof(sRGBCol));
|
for (int X=0; X<MapWidth; X++)
|
||||||
}
|
|
||||||
int GfxCount=GfxList.size();
|
|
||||||
File->Write(&GfxCount,sizeof(int));
|
|
||||||
|
|
||||||
for (i=0; i<GfxCount; i++)
|
|
||||||
{
|
{
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[i];
|
sRGBElem &ThisElem=Map[X][Y];
|
||||||
File->Write(&ThisGfx,sizeof(sLayerShadeGfx));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
File->Write(&ThisElem,sizeof(sRGBElem));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::Render(CCore *Core,Vector3 &CamPos,bool Is3d)
|
void CLayerRGB::Render(CCore *Core,Vector3 &CamPos,bool Is3d)
|
||||||
{
|
{
|
||||||
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
Vector3 ThisCam=Core->OffsetCam(CamPos,GetScaleFactor());
|
||||||
float ZoomW=Core->GetZoomW();
|
float ZoomW=Core->GetZoomW();
|
||||||
|
@ -184,93 +190,133 @@ 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();
|
||||||
int ThisCount=ShadeCount-1;
|
int StartX=(int)ThisCam.x;
|
||||||
float X0=0;
|
int StartY=(int)ThisCam.y;
|
||||||
float X1=LayerDef.Width;
|
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
||||||
float Y=(0+1);
|
float ShiftY=ThisCam.y - (int)ThisCam.y;
|
||||||
float YInc=(float)LayerDef.Height/(float)ThisCount;
|
CLayerTile *ActionLayer=(CLayerTile*)Core->GetActionLayer();
|
||||||
int i,ListSize;
|
|
||||||
|
if (StartX<0) StartX=0;
|
||||||
|
if (StartY<0) StartY=0;
|
||||||
|
|
||||||
|
int DrawW=ZoomW+8;
|
||||||
|
int DrawH=ZoomH+8;
|
||||||
|
|
||||||
|
if (StartX+DrawW>MapWidth) DrawW=MapWidth-StartX;
|
||||||
|
if (StartY+DrawH>MapHeight) DrawH=MapHeight-StartY;
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
glScalef(Scale.x,Scale.y,Scale.z);
|
||||||
glTranslatef(-ThisCam.x,ThisCam.y,0); // Set scroll offset
|
glTranslatef(-ShiftX,ShiftY,0); // Set scroll offset
|
||||||
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
||||||
|
|
||||||
glBegin (GL_QUADS);
|
for (int YLoop=0; YLoop<DrawH; YLoop++)
|
||||||
for (i=0; i<ThisCount; i++)
|
|
||||||
{
|
{
|
||||||
glColor3ub(ShadeRGB[i+0].R,ShadeRGB[i+0].G,ShadeRGB[i+0].B);
|
for (int XLoop=0; XLoop<DrawW; XLoop++)
|
||||||
glVertex3f( X0,Y,0.0f);
|
|
||||||
glVertex3f( X1,Y,0.0f);
|
|
||||||
Y-=YInc;
|
|
||||||
glColor3ub(ShadeRGB[i+1].R,ShadeRGB[i+1].G,ShadeRGB[i+1].B);
|
|
||||||
glVertex3f( X1,Y,0.0f);
|
|
||||||
glVertex3f( X0,Y,0.0f);
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
glPopMatrix();
|
|
||||||
// Render Gfx
|
|
||||||
ListSize=GfxList.size();
|
|
||||||
for (i=0; i<ListSize; i++)
|
|
||||||
{
|
{
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[i];
|
int XPos=StartX+XLoop;
|
||||||
RenderBackGfx(Core,ThisCam,ThisGfx);
|
int YPos=StartY+YLoop;
|
||||||
}
|
|
||||||
|
|
||||||
|
sRGBElem &ThisElem=Map[XPos][YPos];
|
||||||
|
sMapElem &MapElem=ActionLayer->GetMapElem(XPos,YPos);
|
||||||
|
if (MapElem.Tile)
|
||||||
|
{
|
||||||
|
float fR=(1.0f/255.0f)*ThisElem.R;
|
||||||
|
float fG=(1.0f/255.0f)*ThisElem.G;
|
||||||
|
float fB=(1.0f/255.0f)*ThisElem.B;
|
||||||
|
glLoadName (0);
|
||||||
|
glBegin (GL_QUADS);
|
||||||
|
glColor4f(fR,fG,fB,0.5);
|
||||||
|
BuildGLQuad(0,1,0,1,0);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
glTranslatef(1.0f,0,0); // Next X
|
||||||
|
}
|
||||||
|
glTranslatef(-DrawW,-1,0); // Next y, rewind to start X
|
||||||
|
}
|
||||||
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d)
|
void CLayerRGB::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();
|
||||||
|
|
||||||
Cursor.Pos.x=CursPos.x;
|
|
||||||
Cursor.Pos.y=CursPos.y;
|
|
||||||
if (CursPos.x<0 || CursPos.y<0) return;
|
if (CursPos.x<0 || CursPos.y<0) return;
|
||||||
if (Cursor.Gfx==-1) return;
|
sRGBBrush &ThisBrush=RGBBrushTable[CurrentBrush];
|
||||||
RenderBackGfx(Core,ThisCam,Cursor);
|
|
||||||
}
|
CursPos.x-=ThisBrush.XYOfs;
|
||||||
|
CursPos.y-=ThisBrush.XYOfs;
|
||||||
|
CursPos.x-=(int)ThisCam.x;
|
||||||
|
CursPos.y-=(int)ThisCam.y;
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerShade::RenderBackGfx(CCore *Core,Vector3 &ThisCam,sLayerShadeGfx &ThisGfx)
|
|
||||||
{
|
|
||||||
float ZoomW=Core->GetZoomW();
|
float ZoomW=Core->GetZoomW();
|
||||||
float ZoomH=Core->GetZoomH();
|
float ZoomH=Core->GetZoomH();
|
||||||
|
float ScrOfsX=(ZoomW/2);
|
||||||
|
float ScrOfsY=(ZoomH/2);
|
||||||
Vector3 &Scale=Core->GetScaleVector();
|
Vector3 &Scale=Core->GetScaleVector();
|
||||||
Vector3 ScrOfs(ZoomW/2,ZoomH/2,0);
|
float ShiftX=ThisCam.x - (int)ThisCam.x;
|
||||||
int i;
|
float ShiftY=ThisCam.y - (int)ThisCam.y;
|
||||||
|
u8 *Gfx=ThisBrush.Gfx;
|
||||||
CElem Elem=GfxBank->GetElem(ThisGfx.Gfx,0);
|
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glScalef(Scale.x,Scale.y,Scale.z);
|
glScalef(Scale.x,Scale.y,Scale.z);
|
||||||
glTranslatef(-ThisCam.x,ThisCam.y,0); // Set scroll offset
|
glTranslatef(-ShiftX,ShiftY,0); // Set scroll offset
|
||||||
glTranslatef(-ScrOfs.x,ScrOfs.y,0); // Bring to top left corner
|
glTranslatef(-ScrOfsX,ScrOfsY,0); // Bring to top left corner
|
||||||
|
glTranslatef(CursPos.x,-CursPos.y,0); // Bring to top left corner
|
||||||
|
|
||||||
glTranslatef(ThisGfx.Pos.x,-ThisGfx.Pos.y,0); // Set Pos
|
for (int YLoop=0; YLoop<ThisBrush.WH; YLoop++)
|
||||||
glColor3ub(255,255,255);
|
{
|
||||||
|
for (int XLoop=0; XLoop<ThisBrush.WH; XLoop++)
|
||||||
|
{
|
||||||
|
u8 B=*Gfx++;
|
||||||
|
float fR,fG,fB,Bi;
|
||||||
|
Bi=(1.0f/8.0f)*(float)B;
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
if (B)
|
||||||
glBindTexture(GL_TEXTURE_2D, Elem.GetTexID());
|
{
|
||||||
|
glLoadName (0);
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
i=0; glColor3ub(ThisGfx.RGB[i].R,ThisGfx.RGB[i].G,ThisGfx.RGB[i].B); glTexCoord2f(0.0f,1.0f); glVertex3f(ThisGfx.Ofs[i].x ,-ThisGfx.Ofs[i].y,0.0f);
|
switch(CurrentMode)
|
||||||
i=1; glColor3ub(ThisGfx.RGB[i].R,ThisGfx.RGB[i].G,ThisGfx.RGB[i].B); glTexCoord2f(1.0f,1.0f); glVertex3f(ThisGfx.Ofs[i].x ,-ThisGfx.Ofs[i].y,0.0f);
|
{
|
||||||
i=3; glColor3ub(ThisGfx.RGB[i].R,ThisGfx.RGB[i].G,ThisGfx.RGB[i].B); glTexCoord2f(1.0f,0.0f); glVertex3f(ThisGfx.Ofs[i].x ,-ThisGfx.Ofs[i].y,0.0f);
|
case GUI_MODE_PAINT:
|
||||||
i=2; glColor3ub(ThisGfx.RGB[i].R,ThisGfx.RGB[i].G,ThisGfx.RGB[i].B); glTexCoord2f(0.0f,0.0f); glVertex3f(ThisGfx.Ofs[i].x ,-ThisGfx.Ofs[i].y,0.0f);
|
fR=CurrentRGB.R;
|
||||||
|
fG=CurrentRGB.G;
|
||||||
|
fB=CurrentRGB.B;
|
||||||
|
break;
|
||||||
|
case GUI_MODE_TINT:
|
||||||
|
fR=((1.0f/255.0f)*CurrentRGB.R)+Bi;
|
||||||
|
fG=((1.0f/255.0f)*CurrentRGB.G)+Bi;
|
||||||
|
fB=((1.0f/255.0f)*CurrentRGB.B)+Bi;
|
||||||
|
break;
|
||||||
|
case GUI_MODE_LIGHTEN:
|
||||||
|
case GUI_MODE_DARKEN:
|
||||||
|
fR=1;
|
||||||
|
fG=1;
|
||||||
|
fB=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
glColor4f(fR,fG,fB,0.5);
|
||||||
|
BuildGLQuad(0,1,0,1,0);
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
|
}
|
||||||
|
glTranslatef(1.0f,0,0); // Next X
|
||||||
|
}
|
||||||
|
glTranslatef(-ThisBrush.WH,-1,0); // Next y, rewind to start X
|
||||||
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::CheckLayerSize(int Width,int Height)
|
void CLayerRGB::CheckLayerSize(int Width,int Height)
|
||||||
{
|
{
|
||||||
if (Resize(Width,Height))
|
if (Resize(Width,Height))
|
||||||
{
|
{
|
||||||
|
@ -281,262 +327,236 @@ void CLayerShade::CheckLayerSize(int Width,int Height)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool CLayerShade::Resize(int Width,int Height)
|
void CLayerRGB::SetSize(int Width,int Height,BOOL ClearFlag)
|
||||||
{
|
{
|
||||||
|
MapWidth=Width;
|
||||||
Width=TileLayerMinWidth+(Width-TileLayerMinWidth)/GetScaleFactor();
|
MapHeight=Height;
|
||||||
Height=TileLayerMinHeight+(Height-TileLayerMinHeight)/GetScaleFactor();
|
Map.resize(Width);
|
||||||
if (LayerDef.Width!=Width || LayerDef.Height!=Height)
|
for (int i=0;i<Width;i++)
|
||||||
{
|
{
|
||||||
LayerDef.Width=Width;
|
Map[i].resize(Height);
|
||||||
LayerDef.Height=Height;
|
|
||||||
return(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ClearFlag) Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayerRGB::Clear()
|
||||||
|
{
|
||||||
|
for (int Y=0;Y<MapHeight;Y++)
|
||||||
|
{
|
||||||
|
for (int X=0;X<MapWidth;X++)
|
||||||
|
{
|
||||||
|
Map[X][Y].R=128;
|
||||||
|
Map[X][Y].G=128;
|
||||||
|
Map[X][Y].B=128;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
bool CLayerRGB::Resize(int Width,int Height)
|
||||||
|
{
|
||||||
|
if (MapWidth!= Width || MapHeight!=Height)
|
||||||
|
{
|
||||||
|
SetSize(Width,Height,true);
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Gui *********************************************************************/
|
/*** Gui *********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::GUIInit(CCore *Core)
|
void CLayerRGB::GUIInit(CCore *Core)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
|
||||||
|
|
||||||
GUIShade.DisableCallback();
|
int i;
|
||||||
Core->GUIAdd(GUIShade,IDD_LAYER_SHADE);
|
|
||||||
|
|
||||||
// Init BankList
|
GUIRGB.DisableCallback();
|
||||||
ListSize=BankList.size();
|
Core->GUIAdd(GUIRGB,IDD_LAYER_RGB);
|
||||||
GUIShade.m_GfxBankList.ResetContent();
|
|
||||||
GUIShade.m_DefList.ResetContent();
|
// Init ModeList
|
||||||
for (i=0; i<ListSize; i++)
|
GUIRGB.m_ModeList.ResetContent();
|
||||||
|
for (i=0; i<GUI_MODE_MAX; i++)
|
||||||
{
|
{
|
||||||
GUIShade.m_GfxBankList.AddString(BankList[i].Name);
|
GUIRGB.m_ModeList.AddString(RGBModeName[i]);
|
||||||
GUIShade.m_DefList.AddString(BankList[i].Name);
|
|
||||||
}
|
}
|
||||||
|
GUIRGB.m_RSpin.SetRange(0,255);
|
||||||
|
GUIRGB.m_GSpin.SetRange(0,255);
|
||||||
|
GUIRGB.m_BSpin.SetRange(0,255);
|
||||||
|
GUIRGB.m_BrushSpin.SetRange(0,RGB_BRUSH_MAX-1);
|
||||||
|
|
||||||
GUIShade.m_GfxTransList.ResetContent();
|
GUIRGB.EnableCallback();
|
||||||
GUIShade.m_GfxTransList.AddString("Normal");
|
|
||||||
GUIShade.m_GfxTransList.AddString("50%");
|
|
||||||
GUIShade.m_GfxTransList.AddString("Subtractive");
|
|
||||||
GUIShade.m_GfxTransList.AddString("Another one");
|
|
||||||
|
|
||||||
GUIShade.m_GfxPosXSpin.SetRange(0,32000); GUIShade.m_GfxPosYSpin.SetRange(0,32000);
|
|
||||||
GUIShade.m_GfxSpinx0.SetRange(-32,+32); GUIShade.m_GfxSpiny0.SetRange(-32,+32);
|
|
||||||
GUIShade.m_GfxSpinx1.SetRange(-32,+32); GUIShade.m_GfxSpiny1.SetRange(-32,+32);
|
|
||||||
GUIShade.m_GfxSpinx2.SetRange(-32,+32); GUIShade.m_GfxSpiny2.SetRange(-32,+32);
|
|
||||||
GUIShade.m_GfxSpinx3.SetRange(-32,+32); GUIShade.m_GfxSpiny3.SetRange(-32,+32);
|
|
||||||
GUIShade.EnableCallback();
|
|
||||||
Core->RedrawView();
|
Core->RedrawView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::GUIKill(CCore *Core)
|
void CLayerRGB::GUIKill(CCore *Core)
|
||||||
{
|
{
|
||||||
|
|
||||||
GUIChanged(Core);
|
GUIChanged(Core);
|
||||||
Core->GUIRemove(GUIShade,IDD_LAYER_SHADE);
|
Core->GUIRemove(GUIRGB,IDD_LAYER_RGB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::GUIUpdate(CCore *Core)
|
void CLayerRGB::GUIUpdate(CCore *Core)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
GUIRGB.DisableCallback();
|
||||||
|
|
||||||
// Shades
|
GUIRGB.m_ModeList.SetCurSel(CurrentMode);
|
||||||
GUIShade.DisableCallback();
|
GUIRGB.SetRGB(CurrentRGB.R,CurrentRGB.G,CurrentRGB.B);
|
||||||
|
GUIRGB.SetVal(GUIRGB.m_Brush,CurrentBrush);
|
||||||
|
GUIRGB.m_Shade.SetCheck(ShadeFlag);
|
||||||
|
|
||||||
for (i=0; i<LAYER_SHADE_MAX; i++)
|
|
||||||
{
|
|
||||||
GUIShade.SetShadeRGB(i,ShadeRGB[i].R,ShadeRGB[i].G,ShadeRGB[i].B);
|
|
||||||
}
|
|
||||||
GUIShade.m_ShadeCountSpin.SetRange(2,4);
|
|
||||||
GUIShade.SetVal(GUIShade.m_ShadeCount,ShadeCount,2,4);
|
|
||||||
|
|
||||||
// Gfx
|
GUIRGB.EnableCallback();
|
||||||
ListSize=GfxList.size();
|
|
||||||
if (!ListSize)
|
|
||||||
{
|
|
||||||
GUIShade.m_GfxCurrent.SetWindowText("");
|
|
||||||
GUIShade.m_GfxCurrentSpin.SetRange(0,0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[CurrentGfx];
|
|
||||||
|
|
||||||
GUIShade.m_GfxCurrentSpin.SetRange(0,ListSize);
|
|
||||||
GUIShade.SetVal(GUIShade.m_GfxCurrent,CurrentGfx,0,ListSize-1);
|
|
||||||
GUIShade.SetVal(GUIShade.m_GfxPosX,ThisGfx.Pos.x);
|
|
||||||
GUIShade.SetVal(GUIShade.m_GfxPosY,ThisGfx.Pos.y);
|
|
||||||
GUIShade.m_GfxBankList.SetCurSel(ThisGfx.Gfx);
|
|
||||||
|
|
||||||
for ( i=0;i<4; i++)
|
|
||||||
{
|
|
||||||
GUIShade.SetGfxRGB(i,ThisGfx.RGB[i].R,ThisGfx.RGB[i].G,ThisGfx.RGB[i].B);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUIShade.SetVal(GUIShade.m_Gfxx0,ThisGfx.Ofs[0].x); GUIShade.SetVal(GUIShade.m_Gfxy0,ThisGfx.Ofs[0].y);
|
|
||||||
GUIShade.SetVal(GUIShade.m_Gfxx1,ThisGfx.Ofs[1].x); GUIShade.SetVal(GUIShade.m_Gfxy1,ThisGfx.Ofs[1].y);
|
|
||||||
GUIShade.SetVal(GUIShade.m_Gfxx2,ThisGfx.Ofs[2].x); GUIShade.SetVal(GUIShade.m_Gfxy2,ThisGfx.Ofs[2].y);
|
|
||||||
GUIShade.SetVal(GUIShade.m_Gfxx3,ThisGfx.Ofs[3].x); GUIShade.SetVal(GUIShade.m_Gfxy3,ThisGfx.Ofs[3].y);
|
|
||||||
|
|
||||||
GUIShade.m_GfxTransList.SetCurSel(ThisGfx.TransMode);
|
|
||||||
GUIShade.EnableCallback();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::GUIChanged(CCore *Core)
|
void CLayerRGB::GUIChanged(CCore *Core)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
CurrentMode=GUIRGB.m_ModeList.GetCurSel();
|
||||||
int LastGfx=CurrentGfx;
|
GUIRGB.GetRGB(CurrentRGB.R,CurrentRGB.G,CurrentRGB.B);
|
||||||
// Shade
|
GUIRGB.GetVal(GUIRGB.m_Brush,CurrentBrush);
|
||||||
for (i=0; i<LAYER_SHADE_MAX; i++)
|
ShadeFlag=GUIRGB.m_Shade.GetCheck()!=0;
|
||||||
{
|
|
||||||
GUIShade.GetShadeRGB(i,ShadeRGB[i].R,ShadeRGB[i].G,ShadeRGB[i].B);
|
|
||||||
}
|
|
||||||
GUIShade.GetVal(GUIShade.m_ShadeCount,ShadeCount,2,4);
|
|
||||||
// Gfx
|
|
||||||
ListSize=GfxList.size();
|
|
||||||
GUIShade.GetVal(GUIShade.m_GfxCurrent,ListSize,0,ListSize);
|
|
||||||
if (!ListSize || CurrentGfx==-1) return;
|
|
||||||
|
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[CurrentGfx];
|
|
||||||
|
|
||||||
GUIShade.GetVal(GUIShade.m_GfxPosX,ThisGfx.Pos.x);
|
|
||||||
GUIShade.GetVal(GUIShade.m_GfxPosY,ThisGfx.Pos.y);
|
|
||||||
ThisGfx.Gfx=GUIShade.m_GfxBankList.GetCurSel();
|
|
||||||
|
|
||||||
for ( i=0;i<4; i++)
|
|
||||||
{
|
|
||||||
GUIShade.GetGfxRGB(i,ThisGfx.RGB[i].R,ThisGfx.RGB[i].G,ThisGfx.RGB[i].B);
|
|
||||||
}
|
|
||||||
GUIShade.GetVal(GUIShade.m_Gfxx0,ThisGfx.Ofs[0].x); GUIShade.GetVal(GUIShade.m_Gfxy0,ThisGfx.Ofs[0].y);
|
|
||||||
GUIShade.GetVal(GUIShade.m_Gfxx1,ThisGfx.Ofs[1].x); GUIShade.GetVal(GUIShade.m_Gfxy1,ThisGfx.Ofs[1].y);
|
|
||||||
GUIShade.GetVal(GUIShade.m_Gfxx2,ThisGfx.Ofs[2].x); GUIShade.GetVal(GUIShade.m_Gfxy2,ThisGfx.Ofs[2].y);
|
|
||||||
GUIShade.GetVal(GUIShade.m_Gfxx3,ThisGfx.Ofs[3].x); GUIShade.GetVal(GUIShade.m_Gfxy3,ThisGfx.Ofs[3].y);
|
|
||||||
ThisGfx.TransMode=GUIShade.m_GfxTransList.GetCurSel();
|
|
||||||
|
|
||||||
if (CurrentGfx!=LastGfx)
|
|
||||||
{
|
|
||||||
GUIUpdate(Core);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Functions ***************************************************************/
|
/*** Functions ***************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
bool CLayerShade::LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
bool CLayerRGB::LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
||||||
{
|
{
|
||||||
if (DownFlag) AddGfx(Core);
|
if (DownFlag)
|
||||||
|
{
|
||||||
|
Paint(Core,CursorPos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LastCursPos.x=-1;
|
||||||
|
LastCursPos.y=-1;
|
||||||
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool CLayerShade::RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
bool CLayerRGB::RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag)
|
||||||
{
|
{
|
||||||
if (DownFlag) Cursor.Gfx=-1;
|
if (DownFlag) Grab(Core,CursorPos);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool CLayerShade::MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos)
|
bool CLayerRGB::MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos)
|
||||||
{
|
{
|
||||||
|
if (nFlags & MK_LBUTTON)
|
||||||
|
{
|
||||||
|
Paint(Core,CursorPos);
|
||||||
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool CLayerShade::Command(int CmdMsg,CCore *Core,int Param0,int Param1)
|
void CLayerRGB::Paint(CCore *Core,CPoint &CursorPos)
|
||||||
{
|
{
|
||||||
bool Ret=false;
|
if (CursorPos.x<0 || CursorPos.x>MapWidth) return;
|
||||||
|
if (CursorPos.y<0 || CursorPos.y>MapHeight) return;
|
||||||
|
|
||||||
switch(CmdMsg)
|
if (CursorPos.x== LastCursPos.x && CursorPos.y==LastCursPos.y) return;
|
||||||
|
LastCursPos=CursorPos;
|
||||||
|
|
||||||
|
sRGBBrush &ThisBrush=RGBBrushTable[CurrentBrush];
|
||||||
|
u8 *Gfx=ThisBrush.Gfx;
|
||||||
|
CPoint CursPos;
|
||||||
|
|
||||||
|
CursPos.x=CursorPos.x-ThisBrush.XYOfs;
|
||||||
|
CursPos.y=CursorPos.y-ThisBrush.XYOfs;
|
||||||
|
|
||||||
|
for (int Y=0; Y<ThisBrush.WH; Y++)
|
||||||
{
|
{
|
||||||
case CmdMsg_ShadeGfxNew:
|
for (int X=0; X<ThisBrush.WH; X++)
|
||||||
Cursor.Gfx=Param0;
|
{
|
||||||
GUIShade.m_DefList.SetCurSel(-1);
|
CPoint Pos=CursPos;
|
||||||
|
Pos.x+=X;
|
||||||
|
Pos.y+=Y;
|
||||||
|
int Blk=*Gfx++;
|
||||||
|
|
||||||
|
if (Blk)
|
||||||
|
if (Pos.x>=0 && Pos.x<MapWidth &&
|
||||||
|
Pos.y>=0 && Pos.y<MapHeight)
|
||||||
|
{
|
||||||
|
sRGBElem MapElem=GetRGB(Pos.x,Pos.y);
|
||||||
|
int R=CurrentRGB.R;
|
||||||
|
int G=CurrentRGB.G;
|
||||||
|
int B=CurrentRGB.B;
|
||||||
|
int Br=(R/8)*Blk;
|
||||||
|
int Bg=(G/8)*Blk;
|
||||||
|
int Bb=(B/8)*Blk;
|
||||||
|
|
||||||
|
switch(CurrentMode)
|
||||||
|
{
|
||||||
|
case GUI_MODE_PAINT:
|
||||||
break;
|
break;
|
||||||
case CmdMsg_ShadeGfxSelect:
|
case GUI_MODE_TINT:
|
||||||
GUIShade.GetVal(GUIShade.m_GfxCurrent,CurrentGfx);
|
R=(MapElem.R+Br);
|
||||||
if (CurrentGfx>GfxList.size()-1) CurrentGfx=GfxList.size()-1;
|
G=(MapElem.G+Bg);
|
||||||
GUIUpdate(Core);
|
B=(MapElem.B+Bb);
|
||||||
break;
|
break;
|
||||||
case CmdMsg_ShadeGfxGoto:
|
case GUI_MODE_LIGHTEN:
|
||||||
GotoGfx(Core);
|
R=MapElem.R+4;
|
||||||
|
G=MapElem.G+4;
|
||||||
|
B=MapElem.B+4;
|
||||||
break;
|
break;
|
||||||
case CmdMsg_ShadeGfxDelete:
|
case GUI_MODE_DARKEN:
|
||||||
DeleteGfx(Core);
|
R=MapElem.R-4;
|
||||||
break;
|
G=MapElem.G-4;
|
||||||
default:
|
B=MapElem.B-4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (R<0) R=0; else if (R>255) R=255;
|
||||||
return(Ret);
|
if (G<0) G=0; else if (G>255) G=255;
|
||||||
|
if (B<0) B=0; else if (B>255) B=255;
|
||||||
|
Map[Pos.x][Pos.y].R=R;
|
||||||
|
Map[Pos.x][Pos.y].G=G;
|
||||||
|
Map[Pos.x][Pos.y].B=B;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::AddGfx(CCore *Core)
|
void CLayerRGB::Grab(CCore *Core,CPoint &CursorPos)
|
||||||
{
|
{
|
||||||
if (Cursor.Gfx==-1) return;
|
if (CursorPos.x<0 || CursorPos.x>MapWidth) return;
|
||||||
|
if (CursorPos.y<0 || CursorPos.y>MapHeight) return;
|
||||||
|
|
||||||
CurrentGfx=GfxList.size();
|
CurrentRGB=Map[CursorPos.x][CursorPos.y];
|
||||||
GfxList.push_back(Cursor);
|
|
||||||
|
|
||||||
Cursor.Gfx=-1;
|
|
||||||
GUIUpdate(Core);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerShade::GotoGfx(CCore *Core)
|
|
||||||
{
|
|
||||||
if (CurrentGfx==-1) return;
|
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[CurrentGfx];
|
|
||||||
CPoint Pos;
|
|
||||||
Pos.x=ThisGfx.Pos.x;
|
|
||||||
Pos.y=ThisGfx.Pos.y;
|
|
||||||
Core->SetCamPos(Pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerShade::DeleteGfx(CCore *Core)
|
|
||||||
{
|
|
||||||
if (!GfxList.size()) return;
|
|
||||||
|
|
||||||
GfxList.erase(CurrentGfx);
|
|
||||||
if (CurrentGfx) CurrentGfx--;
|
|
||||||
GUIUpdate(Core);
|
GUIUpdate(Core);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerShade::Export(CCore *Core,CExport &Exp)
|
void CLayerRGB::Export(CCore *Core,CExport &Exp)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
Exp.ExportLayerHeader(LayerDef);//LAYER_TYPE_RGB,LayerDef.SubType,LayerDef.Width,LayerDef.Height);
|
||||||
|
|
||||||
Exp.ExportLayerHeader(LayerDef);//LAYER_TYPE_SHADE,LayerDef.SubType,LayerDef.Width,LayerDef.Height);
|
int f=ShadeFlag;
|
||||||
Exp.Write(&ShadeCount,sizeof(int));
|
Exp.Write(&f,sizeof(int));
|
||||||
for (i=0; i<LAYER_SHADE_RGB_MAX; i++)
|
|
||||||
{
|
|
||||||
Exp.Write(&ShadeRGB[i],sizeof(sRGBCol));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write Gfx List
|
for (int Y=0; Y<MapHeight; Y++)
|
||||||
ListSize=GfxList.size();
|
{
|
||||||
Exp.Write(&ListSize,sizeof(int));
|
for (int X=0; X<MapWidth; X++)
|
||||||
|
{
|
||||||
|
sRGBElem &ThisElem=Map[X][Y];
|
||||||
|
sRGBCol RGB;
|
||||||
|
|
||||||
for (i=0; i<ListSize; i++)
|
RGB.R=ThisElem.R;
|
||||||
{
|
RGB.G=ThisElem.G;
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[i];
|
RGB.B=ThisElem.B;
|
||||||
Exp.Write(&ThisGfx,sizeof(sLayerShadeGfx));
|
|
||||||
}
|
Exp.Write(&RGB,sizeof(sRGBCol));
|
||||||
// Write Gfx Names
|
}
|
||||||
ListSize=BankList.size();
|
|
||||||
Exp.Write(&ListSize,sizeof(int));
|
|
||||||
for (i=0; i<ListSize; i++)
|
|
||||||
{
|
|
||||||
char Txt[256];
|
|
||||||
sprintf(Txt,BankList[i].Name);
|
|
||||||
Exp.Write(Txt,strlen(Txt)+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,52 @@
|
||||||
/*******************/
|
/*******************/
|
||||||
/*** Layer Shade ***/
|
/*** Layer RGB ***/
|
||||||
/*******************/
|
/*******************/
|
||||||
|
|
||||||
#ifndef __LAYER_SHADE_HEADER__
|
#ifndef __LAYER_RGB_HEADER__
|
||||||
#define __LAYER_SHADE_HEADER__
|
#define __LAYER_RGB_HEADER__
|
||||||
|
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "MapEdit.h"
|
#include "MapEdit.h"
|
||||||
#include "GUILayerShade.h"
|
#include "GUILayerRGB.h"
|
||||||
#include "Elem.h"
|
#include "Elem.h"
|
||||||
#include "ExportHdr.h"
|
#include "ExportHdr.h"
|
||||||
|
|
||||||
|
struct sRGBElem
|
||||||
/*****************************************************************************/
|
|
||||||
struct sBackList
|
|
||||||
{
|
{
|
||||||
GString Name;
|
u8 R,G,B;
|
||||||
int ElemID;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CCore;
|
class CCore;
|
||||||
class CLayerShade : public CLayer
|
class CLayerRGB : public CLayer
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
LAYER_SHADE_RGB_MAX=4,
|
GUI_MODE_PAINT=0,
|
||||||
|
GUI_MODE_TINT,
|
||||||
|
GUI_MODE_LIGHTEN,
|
||||||
|
GUI_MODE_DARKEN,
|
||||||
|
|
||||||
|
GUI_MODE_MAX
|
||||||
|
};
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
RGB_BRUSH_MAX=8,
|
||||||
};
|
};
|
||||||
|
|
||||||
CLayerShade(sLayerDef &Def);
|
struct sRGBBrush
|
||||||
CLayerShade(CFile *File,int Version) {Load(File,Version);}
|
{
|
||||||
~CLayerShade();
|
int WH;
|
||||||
|
int XYOfs;
|
||||||
|
u8 *Gfx;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CLayerRGB(sLayerDef &Def);
|
||||||
|
CLayerRGB(CFile *File,int Version) {Load(File,Version);}
|
||||||
|
~CLayerRGB();
|
||||||
|
|
||||||
void InitLayer(sLayerDef &Def);
|
void InitLayer(sLayerDef &Def);
|
||||||
|
|
||||||
|
@ -48,8 +61,6 @@ public:
|
||||||
void GUIUpdate(CCore *Core);
|
void GUIUpdate(CCore *Core);
|
||||||
void GUIChanged(CCore *Core);
|
void GUIChanged(CCore *Core);
|
||||||
|
|
||||||
// int GetWidth() {return(LayerDef.Width);}
|
|
||||||
// int GetHeight() {return(LayerDef.Height);}
|
|
||||||
void CheckLayerSize(int Width,int Height);
|
void CheckLayerSize(int Width,int Height);
|
||||||
bool Resize(int Width,int Height);
|
bool Resize(int Width,int Height);
|
||||||
|
|
||||||
|
@ -57,33 +68,37 @@ public:
|
||||||
void Save(CFile *File);
|
void Save(CFile *File);
|
||||||
|
|
||||||
void Export(CCore *Core,CExport &Exp);
|
void Export(CCore *Core,CExport &Exp);
|
||||||
virtual void LoadGfx(CCore *Core) {if (GfxBank->NeedLoad()) GfxBank->LoadAllSets(Core);}
|
virtual void LoadGfx(CCore *Core){}
|
||||||
|
|
||||||
|
void SetSize(int Width,int Height,BOOL ClearFlag);
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
|
bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
|
||||||
bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
|
bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
|
||||||
bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos);
|
bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos);
|
||||||
bool Command(int CmdMsg,CCore *Core,int Param0=0,int Param1=0);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void LoadGfx();
|
|
||||||
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,bool Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,bool Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
|
||||||
void RenderBackGfx(CCore *Core,Vector3 &ThisCam,sLayerShadeGfx &ThisGfx);
|
void Paint(CCore *Core,CPoint &CursorPos);
|
||||||
void AddGfx(CCore *Core);
|
void Grab(CCore *Core,CPoint &CursorPos);
|
||||||
void GotoGfx(CCore *Core);
|
sRGBElem const &GetRGB(int X,int Y) {return(Map[X][Y]);}
|
||||||
void DeleteGfx(CCore *Core);
|
|
||||||
|
|
||||||
CGUILayerShade GUIShade;
|
CGUILayerRGB GUIRGB;
|
||||||
CIni Script;
|
|
||||||
CList<sBackList> BankList;
|
|
||||||
CElemBank *GfxBank;
|
|
||||||
sLayerShadeGfx Cursor;
|
|
||||||
|
|
||||||
int ShadeCount;
|
sRGBElem CurrentRGB;
|
||||||
sRGBCol ShadeRGB[LAYER_SHADE_RGB_MAX];
|
int CurrentBrush;
|
||||||
|
int CurrentMode;
|
||||||
|
bool ShadeFlag;
|
||||||
|
|
||||||
|
int MapWidth,MapHeight;
|
||||||
|
std::vector< std::vector<sRGBElem> > Map;
|
||||||
|
|
||||||
|
CPoint LastCursPos;
|
||||||
|
static char *RGBModeName[GUI_MODE_MAX];
|
||||||
|
static sRGBBrush RGBBrushTable[CLayerRGB::RGB_BRUSH_MAX];
|
||||||
|
|
||||||
CList<sLayerShadeGfx> GfxList;
|
|
||||||
int CurrentGfx;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ virtual bool RButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFl
|
||||||
virtual bool MouseMove(CCore *Core,UINT nFlags, CPoint &point);
|
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);
|
||||||
|
|
||||||
|
sMapElem GetMapElem(int X,int Y) {return(Map.Get(X,Y));}
|
||||||
bool MirrorX(CCore *Core);
|
bool MirrorX(CCore *Core);
|
||||||
bool MirrorY(CCore *Core);
|
bool MirrorY(CCore *Core);
|
||||||
bool SetColFlags(CCore *Core,int Flags);
|
bool SetColFlags(CCore *Core,int Flags);
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[General Info]
|
[General Info]
|
||||||
Version=1
|
Version=1
|
||||||
LastClass=CGUILayerTrigger
|
LastClass=CGUILayerRGB
|
||||||
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=26
|
ClassCount=27
|
||||||
Class1=CChildFrame
|
Class1=CChildFrame
|
||||||
Class2=CGLEnabledView
|
Class2=CGLEnabledView
|
||||||
Class3=CGUIAddLayer
|
Class3=CGUIAddLayer
|
||||||
|
@ -36,28 +36,30 @@ Class24=CAboutDlg
|
||||||
Class25=CMapEditDoc
|
Class25=CMapEditDoc
|
||||||
Class26=CMapEditView
|
Class26=CMapEditView
|
||||||
|
|
||||||
ResourceCount=21
|
ResourceCount=22
|
||||||
Resource1=IDD_NEWMAP
|
Resource1=IDD_LAYER_PLATFORM
|
||||||
Resource2=IDD_LAYER_SHADE
|
Resource2=IDR_TOOLBAR (English (U.S.))
|
||||||
Resource3=IDD_LAYER_TRIGGER
|
Resource3=IDD_ADDLAYER
|
||||||
Resource4=IDD_TOOLBAR
|
Resource4=IDD_LAYER_HAZARD
|
||||||
Resource5=IDR_TOOLBAR (English (U.S.))
|
Resource5=IDD_LAYER_SHADE
|
||||||
Resource6=IDD_ABOUTBOX (English (U.S.))
|
Resource6=IDD_ELEMLIST
|
||||||
Resource7=IDD_RESIZE
|
Resource7=IDD_LAYER_THING_POS
|
||||||
Resource8=IDD_MULTIBAR (English (U.S.))
|
Resource8=IDD_LAYER_ACTOR
|
||||||
Resource9=IDR_MAINFRAME (English (U.S.))
|
Resource9=IDD_LAYER_COLLISION
|
||||||
Resource10=IDD_LAYER_COLLISION
|
Resource10=IDR_MAINFRAME (English (U.S.))
|
||||||
Resource11=IDD_LAYER_ACTOR
|
Resource11=IDD_MULTIBAR (English (U.S.))
|
||||||
Resource12=IDD_LAYER_LIST
|
Resource12=IDD_LAYER_THING
|
||||||
Resource13=IDD_LAYER_FX
|
Resource13=IDD_TILEBANK
|
||||||
Resource14=IDD_TILEBANK
|
Resource14=IDD_LAYER_FX
|
||||||
Resource15=IDD_LAYER_PLATFORM
|
Resource15=IDD_NEWMAP
|
||||||
Resource16=IDD_ELEMLIST
|
Resource16=IDD_ABOUTBOX (English (U.S.))
|
||||||
Resource17=IDR_MAPEDITYPE (English (U.S.))
|
Resource17=IDR_MAPEDITYPE (English (U.S.))
|
||||||
Resource18=IDD_ADDLAYER
|
Resource18=IDD_LAYER_TRIGGER
|
||||||
Resource19=IDD_LAYER_THING
|
Resource19=IDD_LAYER_LIST
|
||||||
Resource20=IDD_LAYER_THING_POS
|
Resource20=IDD_RESIZE
|
||||||
Resource21=IDD_LAYER_HAZARD
|
Resource21=IDD_TOOLBAR
|
||||||
|
Class27=CGUILayerRGB
|
||||||
|
Resource22=IDD_LAYER_RGB
|
||||||
|
|
||||||
[CLS:CChildFrame]
|
[CLS:CChildFrame]
|
||||||
Type=0
|
Type=0
|
||||||
|
@ -139,7 +141,7 @@ HeaderFile=GUILayerShade.h
|
||||||
ImplementationFile=GUILayerShade.cpp
|
ImplementationFile=GUILayerShade.cpp
|
||||||
Filter=D
|
Filter=D
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
LastObject=IDC_LAYERSHADE_GFX_XSPIN
|
LastObject=CGUILayerShade
|
||||||
|
|
||||||
[CLS:CGUILayerThing]
|
[CLS:CGUILayerThing]
|
||||||
Type=0
|
Type=0
|
||||||
|
@ -160,7 +162,7 @@ HeaderFile=GUILayerTrigger.h
|
||||||
ImplementationFile=GUILayerTrigger.cpp
|
ImplementationFile=GUILayerTrigger.cpp
|
||||||
Filter=D
|
Filter=D
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
LastObject=IDC_TRIGGER_VAL0_SPIN
|
LastObject=CGUILayerTrigger
|
||||||
|
|
||||||
[CLS:CGUIMultiBar]
|
[CLS:CGUIMultiBar]
|
||||||
Type=0
|
Type=0
|
||||||
|
@ -612,3 +614,31 @@ Type=1
|
||||||
Class=?
|
Class=?
|
||||||
ControlCount=0
|
ControlCount=0
|
||||||
|
|
||||||
|
[DLG:IDD_LAYER_RGB]
|
||||||
|
Type=1
|
||||||
|
Class=CGUILayerRGB
|
||||||
|
ControlCount=14
|
||||||
|
Control1=IDC_LAYERSHADE_BRUSHTEXT,static,1342308352
|
||||||
|
Control2=IDC_LAYERSHADE_BRUSH,edit,1350641792
|
||||||
|
Control3=IDC_LAYERSHADE_BRUSHSPIN,msctls_updown32,1342177334
|
||||||
|
Control4=IDC_LAYERSHADE_MODELIST,combobox,1344339971
|
||||||
|
Control5=IDC_LAYERSHADE_RTEXT,static,1342308352
|
||||||
|
Control6=IDC_LAYERSHADE_R,edit,1350641792
|
||||||
|
Control7=IDC_LAYERSHADE_RSPIN,msctls_updown32,1342177334
|
||||||
|
Control8=IDC_LAYERSHADE_GTEXT,static,1342308352
|
||||||
|
Control9=IDC_LAYERSHADE_G,edit,1350641792
|
||||||
|
Control10=IDC_LAYERSHADE_GSPIN,msctls_updown32,1342177334
|
||||||
|
Control11=IDC_LAYERSHADE_BTEXT,static,1342308352
|
||||||
|
Control12=IDC_LAYERSHADE_B,edit,1350641792
|
||||||
|
Control13=IDC_LAYERSHADE_BSPIN,msctls_updown32,1342177334
|
||||||
|
Control14=IDC_LAYERSHADE_SHADE,button,1342242851
|
||||||
|
|
||||||
|
[CLS:CGUILayerRGB]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=GUILayerRGB.h
|
||||||
|
ImplementationFile=GUILayerRGB.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=IDC_LAYERSHADE_MODELIST
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,14 @@ SOURCE=.\LayerPlatform.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LayerRGB.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\LayerRGB.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\LayerShade.cpp
|
SOURCE=.\LayerShade.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -457,6 +465,14 @@ SOURCE=.\GUILayerPlatform.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\GUILayerRGB.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\GUILayerRGB.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\GUILayerShade.cpp
|
SOURCE=.\GUILayerShade.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -884,6 +884,40 @@ BEGIN
|
||||||
UDS_ARROWKEYS,75,70,11,10
|
UDS_ARROWKEYS,75,70,11,10
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_LAYER_RGB DIALOG DISCARDABLE 0, 0, 156, 56
|
||||||
|
STYLE WS_CHILD
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
LTEXT "Brush",IDC_LAYERSHADE_BRUSHTEXT,10,5,25,10
|
||||||
|
EDITTEXT IDC_LAYERSHADE_BRUSH,30,5,25,12,ES_AUTOHSCROLL |
|
||||||
|
ES_READONLY | ES_NUMBER
|
||||||
|
CONTROL "Spin1",IDC_LAYERSHADE_BRUSHSPIN,"msctls_updown32",
|
||||||
|
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
|
||||||
|
UDS_ARROWKEYS,45,0,11,15
|
||||||
|
COMBOBOX IDC_LAYERSHADE_MODELIST,60,5,90,65,CBS_DROPDOWNLIST |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "R",IDC_LAYERSHADE_RTEXT,10,25,15,10
|
||||||
|
EDITTEXT IDC_LAYERSHADE_R,10,35,30,12,ES_AUTOHSCROLL |
|
||||||
|
ES_READONLY | ES_NUMBER
|
||||||
|
CONTROL "Spin1",IDC_LAYERSHADE_RSPIN,"msctls_updown32",
|
||||||
|
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
|
||||||
|
UDS_ARROWKEYS,25,30,11,15
|
||||||
|
LTEXT "G",IDC_LAYERSHADE_GTEXT,45,25,15,10
|
||||||
|
EDITTEXT IDC_LAYERSHADE_G,45,35,30,12,ES_AUTOHSCROLL |
|
||||||
|
ES_READONLY | ES_NUMBER
|
||||||
|
CONTROL "Spin1",IDC_LAYERSHADE_GSPIN,"msctls_updown32",
|
||||||
|
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
|
||||||
|
UDS_ARROWKEYS,61,30,11,15
|
||||||
|
LTEXT "B",IDC_LAYERSHADE_BTEXT,75,25,15,10
|
||||||
|
EDITTEXT IDC_LAYERSHADE_B,75,35,30,12,ES_AUTOHSCROLL |
|
||||||
|
ES_READONLY | ES_NUMBER
|
||||||
|
CONTROL "Spin1",IDC_LAYERSHADE_BSPIN,"msctls_updown32",
|
||||||
|
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
|
||||||
|
UDS_ARROWKEYS,91,30,11,15
|
||||||
|
CONTROL "Shade",IDC_LAYERSHADE_SHADE,"Button",BS_AUTOCHECKBOX |
|
||||||
|
BS_LEFTTEXT | WS_TABSTOP,105,35,35,10
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -1020,6 +1054,14 @@ BEGIN
|
||||||
TOPMARGIN, 7
|
TOPMARGIN, 7
|
||||||
BOTTOMMARGIN, 89
|
BOTTOMMARGIN, 89
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_LAYER_RGB, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 149
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 49
|
||||||
|
END
|
||||||
END
|
END
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define IDD_LAYER_TRIGGER 184
|
#define IDD_LAYER_TRIGGER 184
|
||||||
#define IDD_LAYER_FX 185
|
#define IDD_LAYER_FX 185
|
||||||
#define IDD_LAYER_HAZARD 186
|
#define IDD_LAYER_HAZARD 186
|
||||||
|
#define IDD_LAYER_RGB 187
|
||||||
#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
|
||||||
|
@ -211,6 +212,20 @@
|
||||||
#define IDC_LAYERSHADE_GFX_Y 1212
|
#define IDC_LAYERSHADE_GFX_Y 1212
|
||||||
#define IDC_LAYERSHADE_GFX_YSPIN 1213
|
#define IDC_LAYERSHADE_GFX_YSPIN 1213
|
||||||
#define IDC_LAYERSHADE_DEF_LIST 1214
|
#define IDC_LAYERSHADE_DEF_LIST 1214
|
||||||
|
#define IDC_LAYERSHADE_BRUSHTEXT 1215
|
||||||
|
#define IDC_LAYERSHADE_BRUSH 1216
|
||||||
|
#define IDC_LAYERSHADE_BRUSHSPIN 1217
|
||||||
|
#define IDC_LAYERSHADE_MODELIST 1218
|
||||||
|
#define IDC_LAYERSHADE_RTEXT 1219
|
||||||
|
#define IDC_LAYERSHADE_R 1220
|
||||||
|
#define IDC_LAYERSHADE_RSPIN 1221
|
||||||
|
#define IDC_LAYERSHADE_GTEXT 1222
|
||||||
|
#define IDC_LAYERSHADE_G 1223
|
||||||
|
#define IDC_LAYERSHADE_GSPIN 1224
|
||||||
|
#define IDC_LAYERSHADE_BTEXT 1225
|
||||||
|
#define IDC_LAYERSHADE_B 1226
|
||||||
|
#define IDC_LAYERSHADE_BSPIN 1227
|
||||||
|
#define IDC_LAYERSHADE_SHADE 1229
|
||||||
#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
|
||||||
|
@ -238,7 +253,7 @@
|
||||||
#define _APS_3D_CONTROLS 1
|
#define _APS_3D_CONTROLS 1
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 180
|
#define _APS_NEXT_RESOURCE_VALUE 180
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32803
|
#define _APS_NEXT_COMMAND_VALUE 32803
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1215
|
#define _APS_NEXT_CONTROL_VALUE 1230
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
/*******************/
|
/*****************/
|
||||||
/*** Layer Shade ***/
|
/*** Layer RGB ***/
|
||||||
/*******************/
|
/*****************/
|
||||||
|
|
||||||
#include <DaveLib.h>
|
#include <DaveLib.h>
|
||||||
#include <List2d.h>
|
#include <List2d.h>
|
||||||
|
|
||||||
#include "MkLevelLayer.h"
|
#include "MkLevelLayer.h"
|
||||||
#include "MkLevelLayerShade.h"
|
#include "MkLevelLayerRGB.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CMkLevelLayerShade::CMkLevelLayerShade(sExpLayerHdr *LayerHdr)
|
CMkLevelLayerRGB::CMkLevelLayerRGB(sExpLayerHdr *LayerHdr)
|
||||||
{
|
{
|
||||||
int i,ListSize;
|
|
||||||
int *iPtr;
|
int *iPtr;
|
||||||
u8 *Ptr=(u8*)LayerHdr;
|
u8 *Ptr=(u8*)LayerHdr;
|
||||||
|
|
||||||
|
@ -22,36 +21,27 @@ u8 *Ptr=(u8*)LayerHdr;
|
||||||
Width=LayerHdr->Width;
|
Width=LayerHdr->Width;
|
||||||
Height=LayerHdr->Height;
|
Height=LayerHdr->Height;
|
||||||
|
|
||||||
|
RGBMap.SetSize(Width,Height);
|
||||||
|
|
||||||
iPtr=(int*)(Ptr+sizeof(sExpLayerHdr));
|
iPtr=(int*)(Ptr+sizeof(sExpLayerHdr));
|
||||||
|
|
||||||
ShadeHdr.BandCount=*iPtr++;
|
ShadeFlag=*iPtr++;
|
||||||
|
|
||||||
sRGBCol *RGB=(sRGBCol*)iPtr;
|
sRGBCol *RGB=(sRGBCol*)iPtr;
|
||||||
for (i=0; i<LAYER_SHADE_RGB_MAX; i++)
|
for (int Y=0; Y<Height; Y++)
|
||||||
{
|
{
|
||||||
ShadeHdr.RGB[i][0]=RGB->R;
|
for (int X=0; X<Width; X++)
|
||||||
ShadeHdr.RGB[i][1]=RGB->G;
|
{
|
||||||
ShadeHdr.RGB[i][2]=RGB->B;
|
sRGBElem ThisElem;
|
||||||
RGB++;
|
ThisElem.RGB=*RGB++;
|
||||||
}
|
ThisElem.RGB.P=0;
|
||||||
iPtr=(int*)RGB;
|
ThisElem.TableIdx=0;
|
||||||
|
// ThisElem.RGB.R&=-8;
|
||||||
|
// ThisElem.RGB.G&=-8;
|
||||||
|
// ThisElem.RGB.B&=-8;
|
||||||
|
RGBMap.Set(X,Y,ThisElem);
|
||||||
|
|
||||||
ListSize=*iPtr++;
|
|
||||||
GfxList.resize(ListSize);
|
|
||||||
sLayerShadeGfx *GfxPtr=(sLayerShadeGfx*)iPtr;
|
|
||||||
for (i=0; i<ListSize; i++)
|
|
||||||
{
|
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[i];
|
|
||||||
GfxList[i]=*GfxPtr++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iPtr=(int*)GfxPtr;
|
|
||||||
ListSize=*iPtr++;
|
|
||||||
TypeNameList.resize(ListSize);
|
|
||||||
char *TypePtr=(char*)iPtr;
|
|
||||||
for (i=0; i<ListSize; i++)
|
|
||||||
{
|
|
||||||
TypeNameList[i]=TypePtr;
|
|
||||||
TypePtr+=strlen(TypePtr)+1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,33 +50,123 @@ char *TypePtr=(char*)iPtr;
|
||||||
/*** Pre-Process *************************************************************/
|
/*** Pre-Process *************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Build unique tiles, including pre-genned flips, and replace tile idx with new one
|
void CMkLevelLayerRGB::PreProcess(CMkLevel *Core)
|
||||||
void CMkLevelLayerShade::PreProcess(CMkLevel *Core)
|
|
||||||
{
|
{
|
||||||
int i,ListSize=GfxList.size();
|
int X,Y;
|
||||||
int Idx;
|
int ColorCount;
|
||||||
GString Path=Core->GetConfigStr("MISC","BackGfxDir");
|
int c;
|
||||||
CTexGrab &TexGrab=Core->GetTexGrab();
|
|
||||||
|
|
||||||
for (i=0; i<ListSize; i++)
|
// build RGB List
|
||||||
|
for (Y=0; Y<Height; Y++)
|
||||||
{
|
{
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[i];
|
for (X=0; X<Width; X++)
|
||||||
sBackGfxList NewType;
|
|
||||||
|
|
||||||
NewType.Name=Path+TypeNameList[ThisGfx.Gfx]+".Bmp";
|
|
||||||
Idx=OutTypeList.Find(NewType);
|
|
||||||
|
|
||||||
if (Idx==-1)
|
|
||||||
{
|
{
|
||||||
TexGrab.ZeroColZero(true);
|
sRGBElem &ThisElem=RGBMap.Get(X,Y);
|
||||||
NewType.TexID=TexGrab.AddFile(NewType.Name);
|
sRGBList ThisRGB;
|
||||||
TexGrab.ZeroColZero(false);
|
ThisRGB.RGB=ThisElem.RGB;
|
||||||
|
ThisRGB.Count=0;
|
||||||
Idx=OutTypeList.Add(NewType);
|
int Idx=InRGBList.Add(ThisRGB);
|
||||||
|
ThisElem.TableIdx=Idx;
|
||||||
|
InRGBList[Idx].Count++;
|
||||||
}
|
}
|
||||||
ThisGfx.Gfx=Idx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColorCount=InRGBList.size();
|
||||||
|
printf("------ %i Colors ------\n",ColorCount);
|
||||||
|
|
||||||
|
// Sort RGB List by usage
|
||||||
|
for (c=0; c<ColorCount; c++)
|
||||||
|
{
|
||||||
|
sRGBList &ThisRGB=InRGBList[c];
|
||||||
|
int s=0;
|
||||||
|
int SortListSize=SortRGBList.size();
|
||||||
|
for (; s<SortListSize; s++)
|
||||||
|
{
|
||||||
|
if (SortRGBList[s].Count<ThisRGB.Count) break;
|
||||||
|
|
||||||
|
}
|
||||||
|
SortRGBList.insert(s,ThisRGB);
|
||||||
|
}
|
||||||
|
// Build Remap table
|
||||||
|
for (c=0; c<ColorCount; c++)
|
||||||
|
{
|
||||||
|
int Idx=SortRGBList.Find(InRGBList[c]);
|
||||||
|
RemapTable.push_back(Idx);
|
||||||
|
/*
|
||||||
|
sRGBCol &In=InRGBList[c].RGB;
|
||||||
|
sRGBCol &Out=SortRGBList[RemapTable[c]].RGB;
|
||||||
|
if (In.R!=Out.R || In.G!=Out.G || In.B!=Out.B)
|
||||||
|
{
|
||||||
|
printf("%i %i %i\t%i %i %i\n",In.R,In.G,In.B,Out.R,Out.G,Out.B);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
// Remap all above 256
|
||||||
|
for (c=256;c<ColorCount;c++)
|
||||||
|
{
|
||||||
|
sRGBCol &ThisRGB=InRGBList[RemapTable[c]].RGB;
|
||||||
|
RemapTable[c ]=FindClosestRGB(ThisRGB);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build Out Map
|
||||||
|
OutMap.SetSize(Width,Height);
|
||||||
|
for (Y=0; Y<Height; Y++)
|
||||||
|
{
|
||||||
|
for (X=0; X<Width; X++)
|
||||||
|
{
|
||||||
|
sRGBElem &ThisElem=RGBMap.Get(X,Y);
|
||||||
|
|
||||||
|
u8 Idx=RemapTable[ThisElem.TableIdx];
|
||||||
|
OutMap.Set(X,Y,Idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build Out RGB Table
|
||||||
|
if (ColorCount>256) ColorCount=256;
|
||||||
|
OutRGBTable.SetSize(ColorCount,16);
|
||||||
|
int RGBInc=6;
|
||||||
|
if (ShadeFlag) RGBInc=-6;
|
||||||
|
for (c=0;c<ColorCount;c++)
|
||||||
|
{
|
||||||
|
sRGBCol &ThisRGB=SortRGBList[c].RGB;
|
||||||
|
int R=ThisRGB.R;
|
||||||
|
int G=ThisRGB.G;
|
||||||
|
int B=ThisRGB.B;
|
||||||
|
for (int s=0; s<16; s++)
|
||||||
|
{
|
||||||
|
sRGBCol RGB;
|
||||||
|
RGB.R=R; RGB.G=G; RGB.B=B;
|
||||||
|
OutRGBTable.Set(c,s,RGB);
|
||||||
|
|
||||||
|
R+=RGBInc;
|
||||||
|
G+=RGBInc;
|
||||||
|
B+=RGBInc;
|
||||||
|
if (R<0) R=0; else if (R>255) R=255;
|
||||||
|
if (G<0) G=0; else if (G>255) G=255;
|
||||||
|
if (B<0) B=0; else if (B>255) B=255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int CMkLevelLayerRGB::FindClosestRGB(sRGBCol const &RGB)
|
||||||
|
{
|
||||||
|
int CIdx=-1;
|
||||||
|
int CVal=0;
|
||||||
|
|
||||||
|
for (int i=0; i<256; i++)
|
||||||
|
{
|
||||||
|
int ThisVal=(SortRGBList[i].RGB.R*SortRGBList[i].RGB.R)+ (SortRGBList[i].RGB.G*SortRGBList[i].RGB.G)+(SortRGBList[i].RGB.B*SortRGBList[i].RGB.B);
|
||||||
|
|
||||||
|
if (CIdx==-1 || ThisVal<CVal)
|
||||||
|
{
|
||||||
|
CIdx=i;
|
||||||
|
CVal=ThisVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(CIdx);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -94,26 +174,8 @@ CTexGrab &TexGrab=Core->GetTexGrab();
|
||||||
/*** Process *****************************************************************/
|
/*** Process *****************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CMkLevelLayerShade::Process(CMkLevel *Core)
|
void CMkLevelLayerRGB::Process(CMkLevel *Core)
|
||||||
{
|
{
|
||||||
int i,ListSize=OutTypeList.size();
|
|
||||||
CTexGrab &TexGrab=Core->GetTexGrab();
|
|
||||||
|
|
||||||
//printf("Process Shade Layer\n");
|
|
||||||
for (i=0; i<ListSize; i++)
|
|
||||||
{
|
|
||||||
sBackGfxList &ThisType=OutTypeList[i];
|
|
||||||
|
|
||||||
sTexOutInfo &ThisTex=TexGrab.GetTexInfo()[ThisType.TexID];
|
|
||||||
ThisType.Out.TPage=ThisTex.Tpage;
|
|
||||||
ThisType.Out.Clut=ThisTex.Clut;
|
|
||||||
ThisType.Out.U=ThisTex.u;
|
|
||||||
ThisType.Out.V=ThisTex.v;
|
|
||||||
ThisType.Out.W=ThisTex.w;
|
|
||||||
ThisType.Out.H=ThisTex.h;
|
|
||||||
// ThisType.TPage|=Trans[i]<<5;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -121,10 +183,11 @@ CTexGrab &TexGrab=Core->GetTexGrab();
|
||||||
/** Write ********************************************************************/
|
/** Write ********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int CMkLevelLayerShade::Write(CMkLevel *Core,FILE *File,const char *LayerName)
|
int CMkLevelLayerRGB::Write(CMkLevel *Core,FILE *File,const char *LayerName)
|
||||||
{
|
{
|
||||||
sLayerHdr Hdr;
|
|
||||||
int ThisPos=ftell(File);
|
int ThisPos=ftell(File);
|
||||||
|
sLayerHdr Hdr;
|
||||||
|
sLayerRGBHdr RGBHdr;
|
||||||
|
|
||||||
Hdr.Type=Type;
|
Hdr.Type=Type;
|
||||||
Hdr.SubType=SubType;
|
Hdr.SubType=SubType;
|
||||||
|
@ -133,65 +196,53 @@ int ThisPos=ftell(File);
|
||||||
fwrite(&Hdr,sizeof(sLayerHdr),1,File);
|
fwrite(&Hdr,sizeof(sLayerHdr),1,File);
|
||||||
|
|
||||||
int HdrPos=ftell(File);
|
int HdrPos=ftell(File);
|
||||||
fwrite(&ShadeHdr,sizeof(sLayerShadeHdr),1,File);
|
fwrite(&RGBHdr,sizeof(sLayerRGBHdr),1,File);
|
||||||
|
|
||||||
|
|
||||||
// Write Gfx Stuff
|
|
||||||
ShadeHdr.GfxList=(sLayerShadeBackGfx*)(WriteGfxList(File)-ThisPos);
|
|
||||||
ShadeHdr.TypeList=(sLayerShadeBackGfxType*)(WriteTypeList(File)-ThisPos);
|
|
||||||
|
|
||||||
|
RGBHdr.RGBMap=WriteRGBMap(File);
|
||||||
|
PadFile(File);
|
||||||
|
RGBHdr.RGBTable=WriteRGBTable(File);
|
||||||
|
PadFile(File);
|
||||||
// rewrite header
|
// rewrite header
|
||||||
int RetPos=ftell(File);
|
int RetPos=ftell(File);
|
||||||
fseek(File,HdrPos,SEEK_SET);
|
fseek(File,HdrPos,SEEK_SET);
|
||||||
fwrite(&ShadeHdr,sizeof(sLayerShadeHdr),1,File);
|
fwrite(&RGBHdr,sizeof(sLayerRGBHdr),1,File);
|
||||||
fseek(File,RetPos,SEEK_SET);
|
fseek(File,RetPos,SEEK_SET);
|
||||||
|
|
||||||
|
|
||||||
Size=ftell(File)-ThisPos;
|
Size=ftell(File)-ThisPos;
|
||||||
|
|
||||||
return(ThisPos);
|
return(ThisPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int CMkLevelLayerShade::WriteTypeList(FILE *File)
|
int CMkLevelLayerRGB::WriteRGBMap(FILE *File)
|
||||||
{
|
{
|
||||||
int Pos=ftell(File);
|
int ThisPos=ftell(File);
|
||||||
int i,ListSize=OutTypeList.size();
|
|
||||||
|
|
||||||
for (i=0; i<ListSize; i++)
|
for (int Y=0; Y<Height; Y++)
|
||||||
{
|
{
|
||||||
sBackGfxList &ThisType=OutTypeList[i];
|
for (int X=0; X<Width; X++)
|
||||||
|
{
|
||||||
fwrite(&ThisType.Out,sizeof(sLayerShadeBackGfxType),1,File);
|
u8 Idx=OutMap.Get(X,Y);
|
||||||
|
fwrite(&Idx,1,sizeof(u8),File);
|
||||||
}
|
}
|
||||||
return(Pos);
|
|
||||||
}
|
}
|
||||||
|
printf("--> RGBMap %i %i\n",ThisPos,ftell(File)-ThisPos);
|
||||||
|
return(ThisPos);
|
||||||
|
}
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int CMkLevelLayerShade::WriteGfxList(FILE *File)
|
int CMkLevelLayerRGB::WriteRGBTable(FILE *File)
|
||||||
{
|
{
|
||||||
int Pos=ftell(File);
|
int ThisPos=ftell(File);
|
||||||
int i,ListSize=GfxList.size();
|
int ListSize=OutRGBTable.GetWidth();
|
||||||
|
|
||||||
ShadeHdr.GfxCount=ListSize;
|
for (int c=0; c<ListSize; c++)
|
||||||
|
|
||||||
for (i=0; i<ListSize; i++)
|
|
||||||
{
|
{
|
||||||
sLayerShadeGfx &ThisGfx=GfxList[i];
|
for (int s=0; s<16; s++)
|
||||||
sLayerShadeBackGfx Out;
|
|
||||||
|
|
||||||
Out.Type=ThisGfx.Gfx;
|
|
||||||
Out.PosX=ThisGfx.Pos.x;
|
|
||||||
Out.PosY=ThisGfx.Pos.y;
|
|
||||||
Out.Trans=ThisGfx.TransMode;
|
|
||||||
for (int p=0; p<4; p++)
|
|
||||||
{
|
{
|
||||||
Out.Ofs[p][0]=ThisGfx.Ofs[p].x;
|
sRGBCol &RGB=OutRGBTable.Get(c,s);
|
||||||
Out.Ofs[p][1]=ThisGfx.Ofs[p].y;
|
fwrite(&RGB,1,sizeof(sRGBCol),File);
|
||||||
Out.RGB[p][0]=ThisGfx.RGB[p].R;
|
|
||||||
Out.RGB[p][1]=ThisGfx.RGB[p].G;
|
|
||||||
Out.RGB[p][2]=ThisGfx.RGB[p].B;
|
|
||||||
}
|
}
|
||||||
fwrite(&Out,sizeof(sLayerShadeBackGfx),1,File);
|
|
||||||
}
|
}
|
||||||
return(Pos);
|
printf("--> RGBTable %i %i\n",ThisPos,ftell(File)-ThisPos);
|
||||||
|
return(ThisPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,50 @@
|
||||||
/*******************/
|
/*****************/
|
||||||
/*** Layer Shade ***/
|
/*** Layer RGB ***/
|
||||||
/*******************/
|
/*****************/
|
||||||
|
|
||||||
#ifndef __MKLEVEL_LAYER_SHADE_HEADER__
|
#ifndef __MKLEVEL_LAYER_RGB_HEADER__
|
||||||
#define __MKLEVEL_LAYER_SHADE_HEADER__
|
#define __MKLEVEL_LAYER_RGB_HEADER__
|
||||||
|
|
||||||
#include "MkLevelLayer.h"
|
#include "MkLevelLayer.h"
|
||||||
#include <List2d.h>
|
#include <List2d.h>
|
||||||
|
|
||||||
/*****************************************************************************/
|
struct sRGBElem
|
||||||
struct sBackGfxList
|
|
||||||
{
|
{
|
||||||
GString Name;
|
sRGBCol RGB;
|
||||||
int TexID;
|
int TableIdx;
|
||||||
sLayerShadeBackGfxType Out;
|
};
|
||||||
|
|
||||||
|
struct sRGBList
|
||||||
|
{
|
||||||
|
sRGBCol RGB;
|
||||||
|
int Count;
|
||||||
|
bool operator==(sRGBList const &v1) {return(RGB==v1.RGB);}
|
||||||
|
|
||||||
bool operator ==(sBackGfxList const &v1) {return(Name==v1.Name);}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CMkLevelLayerShade : public CMkLevelLayer
|
class CMkLevelLayerRGB : public CMkLevelLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMkLevelLayerShade(sExpLayerHdr *LayerHdr);
|
CMkLevelLayerRGB(sExpLayerHdr *LayerHdr);
|
||||||
|
|
||||||
void PreProcess(CMkLevel *Core);
|
void PreProcess(CMkLevel *Core);
|
||||||
void Process(CMkLevel *Core);
|
void Process(CMkLevel *Core);
|
||||||
int Write(CMkLevel *Core,FILE *File,const char *LayerName);
|
int Write(CMkLevel *Core,FILE *File,const char *LayerName);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int WriteTypeList(FILE *File);
|
int WriteRGBMap(FILE *File);
|
||||||
int WriteGfxList(FILE *File);
|
int WriteRGBTable(FILE *File);
|
||||||
|
int FindClosestRGB(sRGBCol const &RGB);
|
||||||
|
|
||||||
CList<GString> TypeNameList;
|
CList2d<sRGBElem> RGBMap;
|
||||||
CList<sLayerShadeGfx> GfxList;
|
CList<sRGBList> InRGBList;
|
||||||
|
CList<sRGBList> SortRGBList;
|
||||||
|
CList<int> RemapTable;
|
||||||
|
int ShadeFlag;
|
||||||
|
|
||||||
CList<sBackGfxList> OutTypeList;
|
CList2d<u8> OutMap;
|
||||||
sLayerShadeHdr ShadeHdr;
|
CList2d<sRGBCol> OutRGBTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Layers\MkLevelLayerFX.h"
|
#include "Layers\MkLevelLayerFX.h"
|
||||||
#include "Layers\MkLevelLayerTrigger.h"
|
#include "Layers\MkLevelLayerTrigger.h"
|
||||||
#include "Layers\MkLevelLayerHazard.h"
|
#include "Layers\MkLevelLayerHazard.h"
|
||||||
|
#include "Layers\MkLevelLayerRGB.h"
|
||||||
|
|
||||||
#define PSX_TILE2D_HEIGHT (12)
|
#define PSX_TILE2D_HEIGHT (12)
|
||||||
#define PSX_TILE3D_HEIGHT (16)
|
#define PSX_TILE3D_HEIGHT (16)
|
||||||
|
@ -46,6 +47,7 @@ sLayerNameTable LayerNameTable[]=
|
||||||
{LAYER_TYPE_TRIGGER,LAYER_SUBTYPE_NONE,"Trigger List"},
|
{LAYER_TYPE_TRIGGER,LAYER_SUBTYPE_NONE,"Trigger List"},
|
||||||
{LAYER_TYPE_FX,LAYER_SUBTYPE_NONE,"FX List"},
|
{LAYER_TYPE_FX,LAYER_SUBTYPE_NONE,"FX List"},
|
||||||
{LAYER_TYPE_HAZARD,LAYER_SUBTYPE_NONE,"Hazard List"},
|
{LAYER_TYPE_HAZARD,LAYER_SUBTYPE_NONE,"Hazard List"},
|
||||||
|
{LAYER_TYPE_RGB,LAYER_SUBTYPE_NONE,"RGB"},
|
||||||
|
|
||||||
};
|
};
|
||||||
#define LayerNameTableSize sizeof(LayerNameTable)/sizeof(sLayerNameTable)
|
#define LayerNameTableSize sizeof(LayerNameTable)/sizeof(sLayerNameTable)
|
||||||
|
@ -401,6 +403,9 @@ u8 *ByteHdr=(u8*)FileHdr;
|
||||||
case LAYER_TYPE_HAZARD:
|
case LAYER_TYPE_HAZARD:
|
||||||
LayerList.push_back(new CMkLevelLayerHazard(LayerHdr));
|
LayerList.push_back(new CMkLevelLayerHazard(LayerHdr));
|
||||||
break;
|
break;
|
||||||
|
case LAYER_TYPE_RGB:
|
||||||
|
LayerList.push_back(new CMkLevelLayerRGB(LayerHdr));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
GObject::Error(ERR_FATAL,"Unknown Layer Type\n");
|
GObject::Error(ERR_FATAL,"Unknown Layer Type\n");
|
||||||
}
|
}
|
||||||
|
@ -632,7 +637,7 @@ CFaceStore &ThisList=ThisElem.FaceStore;
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
int OTMin=0;
|
int OTMin=0;
|
||||||
int OTMax=16-1;
|
int OTMax=15-1;
|
||||||
|
|
||||||
void CMkLevel::CalcOtOfs(vector<sTri> &PList,vector<sVtx> &VtxList,int Start,int Count)
|
void CMkLevel::CalcOtOfs(vector<sTri> &PList,vector<sVtx> &VtxList,int Start,int Count)
|
||||||
{
|
{
|
||||||
|
@ -1134,7 +1139,8 @@ void CMkLevel::WriteLayers()
|
||||||
LevelHdr.ActionLayer=WriteLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION);
|
LevelHdr.ActionLayer=WriteLayer(LAYER_TYPE_TILE,LAYER_SUBTYPE_ACTION);
|
||||||
// Collision
|
// Collision
|
||||||
LevelHdr.CollisionLayer=WriteLayer(LAYER_TYPE_COLLISION,LAYER_SUBTYPE_NONE);
|
LevelHdr.CollisionLayer=WriteLayer(LAYER_TYPE_COLLISION,LAYER_SUBTYPE_NONE);
|
||||||
|
// RGB
|
||||||
|
LevelHdr.RGBLayer=WriteLayer(LAYER_TYPE_RGB,LAYER_SUBTYPE_NONE);
|
||||||
// Things
|
// Things
|
||||||
int ThingStart=ftell(File);
|
int ThingStart=ftell(File);
|
||||||
LevelHdr.ActorList=WriteThings(LAYER_TYPE_ACTOR);
|
LevelHdr.ActorList=WriteThings(LAYER_TYPE_ACTOR);
|
||||||
|
@ -1144,6 +1150,7 @@ int ThingStart=ftell(File);
|
||||||
LevelHdr.FXList=WriteThings(LAYER_TYPE_FX);
|
LevelHdr.FXList=WriteThings(LAYER_TYPE_FX);
|
||||||
LevelHdr.HazardList=WriteThings(LAYER_TYPE_HAZARD);
|
LevelHdr.HazardList=WriteThings(LAYER_TYPE_HAZARD);
|
||||||
LevelHdr.ModelList=(sModel*)WriteModelList();
|
LevelHdr.ModelList=(sModel*)WriteModelList();
|
||||||
|
|
||||||
printf("Things =\t(%i Bytes)\n",ftell(File)-ThingStart);
|
printf("Things =\t(%i Bytes)\n",ftell(File)-ThingStart);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,14 @@ SOURCE=.\Layers\MkLevelLayerPlatform.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Layers\MkLevelLayerRGB.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Layers\MkLevelLayerRGB.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\Layers\MkLevelLayerShade.cpp
|
SOURCE=.\Layers\MkLevelLayerShade.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue