2000-10-27 02:06:19 +02:00
|
|
|
/*********************/
|
|
|
|
/*** TileSet Stuph ***/
|
|
|
|
/*********************/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "gl3d.h"
|
|
|
|
#include <gl\gl.h>
|
|
|
|
#include <gl\glu.h>
|
|
|
|
#include <gl\glut.h>
|
|
|
|
#include <Vector>
|
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
#include "Core.h"
|
2000-10-27 02:06:19 +02:00
|
|
|
#include "TileSet.h"
|
|
|
|
#include "GinTex.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
2000-11-06 21:24:11 +01:00
|
|
|
/*** TileBank ****************************************************************/
|
2000-10-27 02:06:19 +02:00
|
|
|
/*****************************************************************************/
|
2000-11-06 21:24:11 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
CTileBank::CTileBank()
|
|
|
|
{
|
|
|
|
LoadFlag=FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CTileBank::~CTileBank()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CTileBank::AddTileSet(char *Filename)
|
|
|
|
{
|
|
|
|
TileSet.push_back(CTileSet(Filename));
|
|
|
|
LoadFlag=TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CTileBank::LoadTileSets(CCore *Core)
|
|
|
|
{
|
|
|
|
int ListSize=TileSet.size();
|
|
|
|
|
|
|
|
for (int i=0;i<ListSize;i++)
|
|
|
|
{
|
|
|
|
CTileSet &ThisSet=TileSet[i];
|
|
|
|
|
|
|
|
if (!ThisSet.IsLoaded()) ThisSet.Load(Core);
|
|
|
|
}
|
|
|
|
LoadFlag=FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
CTile &CTileBank::GetTile(int Bank,int Tile)
|
|
|
|
{
|
|
|
|
return(TileSet[Bank].GetTile(Tile));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*** TileSet *****************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
CTileSet::CTileSet(char *_Filename)
|
2000-10-27 02:06:19 +02:00
|
|
|
{
|
2000-10-27 22:21:39 +02:00
|
|
|
char Drive[_MAX_DRIVE];
|
|
|
|
char Dir[_MAX_DIR];
|
|
|
|
char Fname[_MAX_FNAME];
|
|
|
|
char Ext[_MAX_EXT];
|
|
|
|
|
|
|
|
_splitpath(_Filename,Drive,Dir,Fname,Ext);
|
|
|
|
sprintf(Path,"%s%s",Drive,Dir);
|
2000-11-07 21:38:19 +01:00
|
|
|
sprintf(Name,"%s",Fname);
|
2000-11-06 21:24:11 +01:00
|
|
|
Loaded=FALSE;
|
2000-10-27 02:06:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
CTileSet::~CTileSet()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
2000-11-06 21:24:11 +01:00
|
|
|
void CTileSet::Load(CCore *Core)
|
2000-10-27 02:06:19 +02:00
|
|
|
{
|
2000-11-06 21:24:11 +01:00
|
|
|
CScene Scene;
|
2000-11-07 21:38:19 +01:00
|
|
|
char Filename[256+64];
|
2000-10-27 02:06:19 +02:00
|
|
|
|
2000-11-07 21:38:19 +01:00
|
|
|
sprintf(Filename,"%s%s.%s",Path,Name,"Gin");
|
|
|
|
Scene.Load(Filename);
|
2000-10-27 02:06:19 +02:00
|
|
|
|
2000-10-27 20:18:30 +02:00
|
|
|
CNode &ThisNode=Scene.GetSceneNode(0);
|
|
|
|
int ChildCount=ThisNode.GetPruneChildCount();
|
|
|
|
|
|
|
|
for (int Child=0; Child<ChildCount; Child++)
|
2000-10-27 02:06:19 +02:00
|
|
|
{
|
2000-10-27 20:18:30 +02:00
|
|
|
CTile NewTile;
|
2000-10-27 22:21:39 +02:00
|
|
|
NewTile.Load(Core,this,Scene,ThisNode.PruneChildList[Child]);
|
2000-10-27 20:18:30 +02:00
|
|
|
Tile.push_back(NewTile);
|
2000-10-27 02:06:19 +02:00
|
|
|
}
|
2000-10-27 20:18:30 +02:00
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
Loaded=TRUE;
|
2000-10-27 02:06:19 +02:00
|
|
|
}
|
|
|
|
|
2000-11-06 21:24:11 +01:00
|
|
|
/*****************************************************************************/
|