This commit is contained in:
parent
94be656b68
commit
569ce5a865
9 changed files with 136 additions and 21 deletions
|
@ -18,6 +18,8 @@
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "LayerTile.h"
|
#include "LayerTile.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -182,13 +184,13 @@ int ListSize=Layer.size();
|
||||||
Layer[ActiveLayer]->FindCursorPos(this,View,GetCam(),CurrentMousePos);
|
Layer[ActiveLayer]->FindCursorPos(this,View,GetCam(),CurrentMousePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
void CCore::RenderTileView(CMapEditView *View)
|
void CCore::RenderTileView(CMapEditView *View)
|
||||||
{
|
{
|
||||||
Vec &ThisCam=GetCam();
|
Vec &ThisCam=GetCam();
|
||||||
|
|
||||||
TileBank.RenderSet(this,ThisCam,Is3dFlag);
|
TileBank.RenderSet(this,ThisCam,Is3dFlag);
|
||||||
// TileBank.RenderCursor(this,ThisCam,Is3dFlag);
|
|
||||||
|
|
||||||
// Get Cursor Pos
|
// Get Cursor Pos
|
||||||
TileBank.FindCursorPos(this,View,GetCam(),CurrentMousePos);
|
TileBank.FindCursorPos(this,View,GetCam(),CurrentMousePos);
|
||||||
|
@ -333,6 +335,29 @@ CMultiBar *ParamBar=Frm->GetParamBar();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CCore::UpdateLayerGUI(CMapEditView *View)
|
||||||
|
{
|
||||||
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
|
CMultiBar *ParamBar=Frm->GetParamBar();
|
||||||
|
CLayerList *List=(CLayerList*)Frm->GetDialog(IDD_LAYER_LIST_DIALOG);
|
||||||
|
int ListSize=Layer.size();
|
||||||
|
|
||||||
|
List->ListBox.ResetContent();
|
||||||
|
|
||||||
|
for (int i=0; i<ListSize; i++)
|
||||||
|
{
|
||||||
|
List->ListBox.AddString(Layer[i]->GetName());
|
||||||
|
// List->ListBox.SetCheck(i,Layer[i]->IsVisible());
|
||||||
|
}
|
||||||
|
// Now sets checks (silly MSoft bug!!)
|
||||||
|
for (i=0; i<ListSize; i++)
|
||||||
|
{
|
||||||
|
List->ListBox.SetCheck(i,Layer[i]->IsVisible());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
void CCore::SetActiveLayer(int i)
|
void CCore::SetActiveLayer(int i)
|
||||||
|
@ -442,9 +467,9 @@ Vec &CCore::GetCam()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::UpdateAll(CMapEditView *View)
|
void CCore::UpdateGUI(CMapEditView *View)
|
||||||
{
|
{
|
||||||
UpdateView(View);
|
UpdateLayerGUI(View);
|
||||||
UpdateGrid(View);
|
UpdateGrid(View);
|
||||||
|
|
||||||
TileBank.UpdateGUI(this,TileViewFlag);
|
TileBank.UpdateGUI(this,TileViewFlag);
|
||||||
|
@ -452,6 +477,13 @@ void CCore::UpdateAll(CMapEditView *View)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CCore::UpdateAll(CMapEditView *View)
|
||||||
|
{
|
||||||
|
UpdateGUI(View);
|
||||||
|
UpdateView(View);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::UpdateView(CMapEditView *View,Vec Ofs)
|
void CCore::UpdateView(CMapEditView *View,Vec Ofs)
|
||||||
{
|
{
|
||||||
|
@ -463,6 +495,7 @@ Vec &ThisCam=GetCam();
|
||||||
if (View) View->Invalidate();
|
if (View) View->Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::SetMapSize(CMapEditView *View,int Width,int Height)
|
void CCore::SetMapSize(CMapEditView *View,int Width,int Height)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,7 @@ public:
|
||||||
void UpdateParamBar();
|
void UpdateParamBar();
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
|
void UpdateLayerGUI(CMapEditView *View);
|
||||||
// void SetActiveLayer(int Layer);
|
// void SetActiveLayer(int Layer);
|
||||||
// int GetActiveLayer() {return(ActiveLayer);}
|
// int GetActiveLayer() {return(ActiveLayer);}
|
||||||
// CLayer *GetLayer(int i) {return(Layer[i]);}
|
// CLayer *GetLayer(int i) {return(Layer[i]);}
|
||||||
|
@ -74,6 +75,7 @@ public:
|
||||||
CTexCache &GetTexCache() {return(TexCache);}
|
CTexCache &GetTexCache() {return(TexCache);}
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
void UpdateGUI(CMapEditView *View);
|
||||||
void UpdateAll(CMapEditView *View);
|
void UpdateAll(CMapEditView *View);
|
||||||
void UpdateView(CMapEditView *View,Vec Ofs=Vec(0,0,0));
|
void UpdateView(CMapEditView *View,Vec Ofs=Vec(0,0,0));
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@ virtual ~CLayer(){};
|
||||||
|
|
||||||
virtual char *GetName();
|
virtual char *GetName();
|
||||||
virtual void SetName(char *_Name);
|
virtual void SetName(char *_Name);
|
||||||
|
|
||||||
|
virtual void SetVisible(BOOL f) {VisibleFlag=f;}
|
||||||
|
virtual BOOL IsVisible() {return(VisibleFlag);}
|
||||||
virtual int GetType()=0;
|
virtual int GetType()=0;
|
||||||
|
|
||||||
virtual float GetLayerZPosDiv() {return(ZPosDiv);}
|
virtual float GetLayerZPosDiv() {return(ZPosDiv);}
|
||||||
|
@ -71,6 +74,7 @@ protected:
|
||||||
BOOL Render3dFlag;
|
BOOL Render3dFlag;
|
||||||
float ZPosDiv,MapSizeDiv;
|
float ZPosDiv,MapSizeDiv;
|
||||||
BOOL ResizeFlag;
|
BOOL ResizeFlag;
|
||||||
|
BOOL VisibleFlag;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ CLayerTile::CLayerTile(char *_Name,int Width,int Height,float MapDiv,float ZDiv,
|
||||||
MapSizeDiv=MapDiv;
|
MapSizeDiv=MapDiv;
|
||||||
ResizeFlag=Resizable;
|
ResizeFlag=Resizable;
|
||||||
Render3dFlag=Is3d;
|
Render3dFlag=Is3d;
|
||||||
|
VisibleFlag=TRUE;
|
||||||
Mode=MouseModePaint;
|
Mode=MouseModePaint;
|
||||||
|
|
||||||
Map.SetSize(Width/MapDiv,Height/MapDiv,TRUE);
|
Map.SetSize(Width/MapDiv,Height/MapDiv,TRUE);
|
||||||
|
@ -58,6 +59,7 @@ void CLayerTile::Load(CFile *File,float Version)
|
||||||
File->Read(&ZPosDiv,sizeof(float));
|
File->Read(&ZPosDiv,sizeof(float));
|
||||||
File->Read(&MapSizeDiv,sizeof(float));
|
File->Read(&MapSizeDiv,sizeof(float));
|
||||||
File->Read(&ResizeFlag,sizeof(BOOL));
|
File->Read(&ResizeFlag,sizeof(BOOL));
|
||||||
|
File->Read(&VisibleFlag,sizeof(BOOL));
|
||||||
File->Read(&Mode,sizeof(MouseMode));
|
File->Read(&Mode,sizeof(MouseMode));
|
||||||
Map.Load(File,Version);
|
Map.Load(File,Version);
|
||||||
}
|
}
|
||||||
|
@ -72,9 +74,9 @@ void CLayerTile::Save(CFile *File)
|
||||||
File->Write(&ZPosDiv,sizeof(float));
|
File->Write(&ZPosDiv,sizeof(float));
|
||||||
File->Write(&MapSizeDiv,sizeof(float));
|
File->Write(&MapSizeDiv,sizeof(float));
|
||||||
File->Write(&ResizeFlag,sizeof(BOOL));
|
File->Write(&ResizeFlag,sizeof(BOOL));
|
||||||
|
File->Write(&VisibleFlag,sizeof(BOOL));
|
||||||
File->Write(&Mode,sizeof(MouseMode));
|
File->Write(&Mode,sizeof(MouseMode));
|
||||||
Map.Save(File);
|
Map.Save(File);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[General Info]
|
[General Info]
|
||||||
Version=1
|
Version=1
|
||||||
LastClass=CMapSizeDlg
|
LastClass=CLayerList
|
||||||
LastTemplate=CDialog
|
LastTemplate=CDialog
|
||||||
NewFileInclude1=#include "stdafx.h"
|
NewFileInclude1=#include "stdafx.h"
|
||||||
NewFileInclude2=#include "mapedit.h"
|
NewFileInclude2=#include "mapedit.h"
|
||||||
|
@ -18,19 +18,19 @@ Class6=CMapEditDoc
|
||||||
Class7=CMapEditView
|
Class7=CMapEditView
|
||||||
|
|
||||||
ResourceCount=10
|
ResourceCount=10
|
||||||
Resource1=IDD_LAYER_LIST_DIALOG
|
Resource1=IDD_MULTIBAR (English (U.S.))
|
||||||
Resource2=IDR_MAINFRAME (English (U.S.))
|
Resource2=IDD_LAYER_LIST_DIALOG
|
||||||
Resource3=IDR_TOOLBAR (English (U.S.))
|
Resource3=IDD_GFXTOOLBAR
|
||||||
Resource4=IDD_DIALOGBAR (English (U.S.))
|
Resource4=IDD_DIALOGBAR (English (U.S.))
|
||||||
Resource5=IDR_MAPEDITYPE (English (U.S.))
|
Resource5=IDR_MAPEDITYPE (English (U.S.))
|
||||||
Class8=CMultiBar
|
Class8=CMultiBar
|
||||||
Resource6=IDD_TILESET_DIALOG
|
Resource6=IDR_MAINFRAME (English (U.S.))
|
||||||
Resource7=IDD_MULTIBAR (English (U.S.))
|
Resource7=IDR_TOOLBAR (English (U.S.))
|
||||||
Class9=CLayerList
|
Class9=CLayerList
|
||||||
Class10=CTileSetDlg
|
Class10=CTileSetDlg
|
||||||
Resource8=IDD_GFXTOOLBAR
|
Resource8=IDD_ABOUTBOX (English (U.S.))
|
||||||
Class11=CGfxToolBar
|
Class11=CGfxToolBar
|
||||||
Resource9=IDD_ABOUTBOX (English (U.S.))
|
Resource9=IDD_TILESET_DIALOG
|
||||||
Class12=CMapSizeDlg
|
Class12=CMapSizeDlg
|
||||||
Resource10=IDD_MAPSIZE
|
Resource10=IDD_MAPSIZE
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ ImplementationFile=LayerList.cpp
|
||||||
BaseClass=CDialog
|
BaseClass=CDialog
|
||||||
Filter=D
|
Filter=D
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
LastObject=CLayerList
|
LastObject=IDC_LAYER_LIST
|
||||||
|
|
||||||
[DLG:IDD_TILESET_DIALOG]
|
[DLG:IDD_TILESET_DIALOG]
|
||||||
Type=1
|
Type=1
|
||||||
|
|
|
@ -61,7 +61,7 @@ CMapEditView::~CMapEditView()
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
void CMapEditView::VideoMode(ColorsNumber & c, ZAccuracy & z, BOOL & dbuf)
|
void CMapEditView::VideoMode(ColorsNumber & c, ZAccuracy & z, BOOL & dbuf)
|
||||||
{
|
{
|
||||||
c=THOUSANDS; // ask for 65355 colors...
|
c=MILLIONS; // ask for 65355 colors...
|
||||||
z=NORMAL; // ...16 bit Z-buffer...
|
z=NORMAL; // ...16 bit Z-buffer...
|
||||||
dbuf=TRUE; // ...double-buffering
|
dbuf=TRUE; // ...double-buffering
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,9 @@ CTileBank::CTileBank()
|
||||||
SelStart=-1;
|
SelStart=-1;
|
||||||
SelEnd=1;
|
SelEnd=1;
|
||||||
|
|
||||||
#ifdef _DEBUGx
|
#ifdef _DEBUG
|
||||||
AddTileSet("c:/temp/rockp/rockp.gin");
|
// AddTileSet("c:/temp/rockp/rockp.gin");
|
||||||
|
AddTileSet("c:/temp/3/test.gin");
|
||||||
|
|
||||||
int W=3;
|
int W=3;
|
||||||
int H=3;
|
int H=3;
|
||||||
|
@ -113,6 +114,7 @@ int ListSize=TileSet.size();
|
||||||
sprintf(Filename,"%s%s.%s",ThisSet.GetPath(),ThisSet.GetName(),"Gin");
|
sprintf(Filename,"%s%s.%s",ThisSet.GetPath(),ThisSet.GetName(),"Gin");
|
||||||
File->Write(Filename,256+64);
|
File->Write(Filename,256+64);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -148,6 +150,7 @@ int ListSize=TileSet.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadFlag=TRUE;
|
LoadFlag=TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -324,6 +327,7 @@ int ChildCount=ThisNode.GetPruneChildCount();
|
||||||
Tile.push_back(CTile(Core,this,Scene,ThisNode.PruneChildList[Child]));
|
Tile.push_back(CTile(Core,this,Scene,ThisNode.PruneChildList[Child]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Loaded=TRUE;
|
Loaded=TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
/*************/
|
/*************/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
//#include <windows.h> // Header File For Windows
|
|
||||||
//#include <stdio.h> // Header File For Standard Input/Output
|
|
||||||
#include "gl3d.h"
|
#include "gl3d.h"
|
||||||
#include <gl\gl.h>
|
#include <gl\gl.h>
|
||||||
#include <gl\glu.h>
|
#include <gl\glu.h>
|
||||||
|
@ -210,8 +209,8 @@ int Status=FALSE;
|
||||||
// Typical Texture Generation Using Data From The Bitmap
|
// Typical Texture Generation Using Data From The Bitmap
|
||||||
glBindTexture(GL_TEXTURE_2D, Text);
|
glBindTexture(GL_TEXTURE_2D, Text);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
|
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,3 +226,72 @@ int Status=FALSE;
|
||||||
|
|
||||||
return Status; // Return The Status
|
return Status; // Return The Status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
struct sTgaHdr
|
||||||
|
{
|
||||||
|
char id; // 0
|
||||||
|
char colmaptype; // 1
|
||||||
|
char imagetype; // 2
|
||||||
|
char fei[2]; // 3
|
||||||
|
char cml[2]; // 5
|
||||||
|
char cmes; // 7
|
||||||
|
short xorig; // 8
|
||||||
|
short yorig; // 10
|
||||||
|
short width; // 12
|
||||||
|
short height; // 14
|
||||||
|
char depth; // 15
|
||||||
|
char imagedesc; // 16
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void SaveTGA(char *Filename,int SX,int SY,int SW,int SH)
|
||||||
|
{
|
||||||
|
FILE *File;
|
||||||
|
sTgaHdr FileHdr;
|
||||||
|
|
||||||
|
File=fopen(Filename,"wb");
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Header
|
||||||
|
memset(&FileHdr,0 ,sizeof(sTgaHdr));
|
||||||
|
|
||||||
|
FileHdr.imagetype= 2; //imagetype
|
||||||
|
FileHdr.width = SW;
|
||||||
|
FileHdr.height= SH;
|
||||||
|
FileHdr.depth=24;
|
||||||
|
// FileHdr.imagedesc=24;
|
||||||
|
|
||||||
|
fwrite(&FileHdr,sizeof(sTgaHdr),1,File);
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Data
|
||||||
|
for (int Y=0; Y<SH; Y++)
|
||||||
|
{
|
||||||
|
for (int X=0; X<SW; X++)
|
||||||
|
{
|
||||||
|
float Col[3];
|
||||||
|
unsigned char R,G,B;
|
||||||
|
|
||||||
|
glReadPixels(X,Y,1,1,GL_RED, GL_FLOAT,&Col[0]);
|
||||||
|
glReadPixels(X,Y,1,1,GL_GREEN, GL_FLOAT,&Col[1]);
|
||||||
|
glReadPixels(X,Y,1,1,GL_BLUE, GL_FLOAT,&Col[2]);
|
||||||
|
|
||||||
|
R=Col[0]*255;
|
||||||
|
G=Col[1]*255;
|
||||||
|
B=Col[2]*255;
|
||||||
|
|
||||||
|
fwrite(&B,1,1,File);
|
||||||
|
fwrite(&G,1,1,File);
|
||||||
|
fwrite(&R,1,1,File);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
fclose(File);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ TVECTOR TCrossProduct(TVECTOR const &V0,TVECTOR const &V1,const TVECTOR &V2 );
|
||||||
CPoint IDToPoint(int ID,int Width);
|
CPoint IDToPoint(int ID,int Width);
|
||||||
int PointToID(CPoint &Pnt,int Width);
|
int PointToID(CPoint &Pnt,int Width);
|
||||||
|
|
||||||
|
void SaveTGA(char *Filename,int SX,int SY,int SW,int SH);
|
||||||
|
|
||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Reference in a new issue