2000-10-27 02:06:19 +02:00
|
|
|
/*********************/
|
|
|
|
/*** TileSet Stuph ***/
|
|
|
|
/*********************/
|
|
|
|
|
|
|
|
#ifndef __TILESET_HEADER__
|
|
|
|
#define __TILESET_HEADER__
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "gl3d.h"
|
|
|
|
#include <gl\gl.h>
|
|
|
|
#include <gl\glu.h>
|
|
|
|
#include <gl\glut.h>
|
|
|
|
#include <Vector>
|
|
|
|
|
2000-10-27 20:18:30 +02:00
|
|
|
#include "TexCache.h"
|
|
|
|
#include "Tile.h"
|
2000-10-27 02:06:19 +02:00
|
|
|
|
2000-11-14 16:03:04 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
enum TileSetEnum
|
|
|
|
{
|
|
|
|
TileBrowserWidth=8,
|
|
|
|
};
|
2000-10-27 20:18:30 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
2000-11-06 21:24:11 +01:00
|
|
|
class CCore;
|
|
|
|
class CTile;
|
|
|
|
|
2000-10-27 20:18:30 +02:00
|
|
|
/*****************************************************************************/
|
2000-11-06 21:24:11 +01:00
|
|
|
class CTileBank
|
|
|
|
{
|
|
|
|
public:
|
2000-11-14 16:03:04 +01:00
|
|
|
CTileBank();
|
|
|
|
~CTileBank();
|
|
|
|
|
2000-11-17 22:36:13 +01:00
|
|
|
enum BrushEnum
|
|
|
|
{
|
|
|
|
LBrush=0,
|
|
|
|
RBrush,
|
|
|
|
MaxBrush
|
|
|
|
};
|
|
|
|
|
2000-11-15 22:22:40 +01:00
|
|
|
void AddTileSet(char *Filename);
|
|
|
|
int NeedLoad() {return(LoadFlag);}
|
|
|
|
void Reload();
|
|
|
|
void LoadTileSets(CCore *Core);
|
|
|
|
CTile &GetTile(int Bank,int Tile);
|
|
|
|
|
|
|
|
void SetCurrent(int Set) {CurrentSet=Set;}
|
|
|
|
|
2000-11-17 22:36:13 +01:00
|
|
|
CMap &GetLBrush() {return(Brush[LBrush]);}
|
|
|
|
CMap &GetRBrush() {return(Brush[RBrush]);}
|
|
|
|
CMap &GetBrush(int i) {return(Brush[i]);}
|
|
|
|
CMap &GetActiveBrush() {return(GetBrush(ActiveBrush));}
|
2000-11-06 21:24:11 +01:00
|
|
|
|
2000-11-15 22:22:40 +01:00
|
|
|
void RenderSet(CCore *Core,Vec &CamPos,BOOL Is3d);
|
|
|
|
void FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos);
|
2000-11-17 22:36:13 +01:00
|
|
|
void RenderCursor(CCore *Core,Vec &CamPos,BOOL Is3d);
|
2000-11-14 16:03:04 +01:00
|
|
|
|
2000-11-15 22:22:40 +01:00
|
|
|
void UpdateGUI(CCore *Core,BOOL IsTileView);
|
2000-11-14 16:03:04 +01:00
|
|
|
|
2000-11-15 22:22:40 +01:00
|
|
|
// Functions
|
2000-11-17 22:36:13 +01:00
|
|
|
BOOL SelectL(BOOL DownFlag) {return(Select(LBrush,DownFlag));}
|
|
|
|
BOOL SelectR(BOOL DownFlag) {return(Select(RBrush,DownFlag));}
|
|
|
|
BOOL SelectCancel();
|
|
|
|
|
|
|
|
void SetActiveBrushL() {ActiveBrush=LBrush;}
|
|
|
|
void SetActiveBrushR() {ActiveBrush=RBrush;}
|
2000-11-06 21:24:11 +01:00
|
|
|
|
2000-11-20 21:33:42 +01:00
|
|
|
void Load(CFile *File,float Version);
|
|
|
|
void Save(CFile *File);
|
|
|
|
|
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
private:
|
2000-11-17 22:36:13 +01:00
|
|
|
BOOL Select(int BrushID,BOOL DownFlag);
|
|
|
|
void SetBrush(CMap &ThisBrush);
|
2000-11-14 16:03:04 +01:00
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
std::vector<CTileSet> TileSet;
|
2000-11-15 22:22:40 +01:00
|
|
|
int CurrentSet;
|
2000-11-17 22:36:13 +01:00
|
|
|
CMap Brush[2];
|
|
|
|
int ActiveBrush;
|
|
|
|
int SelStart,SelEnd;
|
2000-11-06 21:24:11 +01:00
|
|
|
|
2000-11-15 22:22:40 +01:00
|
|
|
BOOL LoadFlag;
|
2000-11-17 22:36:13 +01:00
|
|
|
int LastCursorPos,CursorPos;
|
2000-11-06 21:24:11 +01:00
|
|
|
};
|
|
|
|
|
2000-10-27 02:06:19 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
class CTileSet
|
|
|
|
{
|
|
|
|
public:
|
2000-11-17 22:36:13 +01:00
|
|
|
CTileSet(char *_Filename,int Idx);
|
2000-10-27 02:06:19 +02:00
|
|
|
~CTileSet();
|
2000-10-27 22:21:39 +02:00
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
int IsLoaded() {return(Loaded);}
|
2000-11-17 22:36:13 +01:00
|
|
|
int GetTileCount() {return(Tile.size());}
|
2000-11-22 23:08:47 +01:00
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
void Load(CCore *Core);
|
2000-11-22 23:08:47 +01:00
|
|
|
void Load2d(CCore *Core);
|
|
|
|
void Load3d(CCore *Core);
|
|
|
|
|
2000-10-27 22:21:39 +02:00
|
|
|
char *GetPath() {return(Path);}
|
2000-11-07 21:38:19 +01:00
|
|
|
char *GetName() {return(Name);}
|
2000-11-22 23:08:47 +01:00
|
|
|
char *GetExt() {return(Ext);}
|
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
CTile &GetTile(int No) {return(Tile[No]);}
|
2000-11-14 16:03:04 +01:00
|
|
|
void Purge();
|
|
|
|
int FindCursorPos(CCore *Core,CMapEditView *View,Vec &CamPos,CPoint &MousePos);
|
2000-11-22 23:08:47 +01:00
|
|
|
void Render(Vec &CamPos,CMap &LBrush,CMap &RBrush,BOOL Render3d);
|
2000-11-17 22:36:13 +01:00
|
|
|
void RenderCursor(Vec &CamPos,int Pos,int Width, int Height);
|
|
|
|
void RenderBrush(Vec &CamPos,CMap &LBrush,CMap &RBrush);
|
|
|
|
void RenderGrid(Vec &CamPos);
|
2000-10-27 02:06:19 +02:00
|
|
|
|
|
|
|
private:
|
2000-11-15 22:22:40 +01:00
|
|
|
|
2000-11-22 23:08:47 +01:00
|
|
|
char Drive[_MAX_DRIVE],Path[_MAX_DIR],Name[_MAX_FNAME],Ext[_MAX_EXT];
|
2000-11-17 22:36:13 +01:00
|
|
|
int SetNumber;
|
2000-10-27 20:18:30 +02:00
|
|
|
std::vector<CTile> Tile;
|
2000-11-06 21:24:11 +01:00
|
|
|
BOOL Loaded;
|
2000-10-27 02:06:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
#endif
|