2001-04-01 22:22:49 +02:00
|
|
|
/*******************/
|
|
|
|
/*** Actor Stuff ***/
|
|
|
|
/*******************/
|
2001-04-01 09:22:30 +02:00
|
|
|
|
|
|
|
#ifndef __ACTOR_HEADER__
|
|
|
|
#define __ACTOR_HEADER__
|
|
|
|
|
|
|
|
#include "system\global.h"
|
|
|
|
#include <dstructs.h>
|
|
|
|
|
|
|
|
#ifndef __BigLump_H__
|
|
|
|
#include <biglump.h>
|
|
|
|
#endif
|
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
// Pack together Actor anim & frame for quicker check later
|
|
|
|
struct sPoolNode
|
2001-04-09 23:27:21 +02:00
|
|
|
{
|
2001-04-25 18:41:16 +02:00
|
|
|
u16 Actor;
|
|
|
|
u16 Anim;
|
|
|
|
u16 Frame;
|
|
|
|
u16 TPage;
|
|
|
|
u16 TexX,TexY;
|
|
|
|
u8 U,V;
|
|
|
|
sPoolNode *Prev,*Next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sNodeList
|
|
|
|
{
|
2001-04-27 22:28:47 +02:00
|
|
|
sPoolNode *Head;
|
|
|
|
sPoolNode *Tail;
|
2001-04-25 18:41:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sPoolSlot
|
|
|
|
{
|
|
|
|
u16 Width,Height;
|
|
|
|
u16 RefCount;
|
|
|
|
u16 FrameCount;
|
|
|
|
sNodeList NodeList;
|
2001-04-25 21:11:45 +02:00
|
|
|
u8 *ListMem;
|
2001-04-09 23:27:21 +02:00
|
|
|
};
|
|
|
|
|
2001-04-01 09:22:30 +02:00
|
|
|
/*****************************************************************************/
|
2001-04-09 23:27:21 +02:00
|
|
|
struct sActorPool
|
|
|
|
{
|
|
|
|
FileEquate Filename;
|
2001-04-25 18:41:16 +02:00
|
|
|
sSpriteAnimBank *ActorGfx;
|
|
|
|
int CacheSlot;
|
2001-04-27 22:28:47 +02:00
|
|
|
sNodeList *PoolCache;
|
|
|
|
sNodeList ActorCache;
|
2001-04-25 18:41:16 +02:00
|
|
|
sActorPool *Next;
|
2001-04-09 23:27:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-04-25 18:41:16 +02:00
|
|
|
class CActorCache
|
2001-04-01 09:22:30 +02:00
|
|
|
{
|
|
|
|
public:
|
2001-04-09 23:27:21 +02:00
|
|
|
enum
|
|
|
|
{
|
2001-04-25 18:41:16 +02:00
|
|
|
TPAGE_W =256,
|
|
|
|
TPAGE_H =256-4,
|
|
|
|
|
2001-04-27 23:42:38 +02:00
|
|
|
CACHE_X =512,
|
|
|
|
CACHE_Y =256,
|
|
|
|
CACHE_W =8,
|
|
|
|
CACHE_H =1,
|
|
|
|
/*
|
2001-04-25 18:41:16 +02:00
|
|
|
CACHE_X =512+256,
|
|
|
|
CACHE_Y =256,
|
|
|
|
CACHE_W =4,
|
|
|
|
CACHE_H =1,
|
|
|
|
|
2001-04-27 23:42:38 +02:00
|
|
|
*/
|
|
|
|
CACHE_PALX =CACHE_X+64,
|
2001-04-25 18:41:16 +02:00
|
|
|
CACHE_PALY =511,
|
|
|
|
CACHE_PALW =64,
|
|
|
|
CACHE_PALH =1,
|
|
|
|
|
|
|
|
CACHE_TYPE_MAX =8,
|
2001-04-09 23:27:21 +02:00
|
|
|
};
|
2001-04-01 09:22:30 +02:00
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
CActorCache();
|
|
|
|
~CActorCache();
|
|
|
|
|
|
|
|
int ReserveSlot(int W,int H,int FrameCount);
|
|
|
|
void AllocCache();
|
|
|
|
void Reset();
|
|
|
|
void LoadPalette(sActorPool *NewActor);
|
|
|
|
sNodeList *GetSlotList(int Slot) {return(&SlotList[Slot].NodeList);}
|
|
|
|
|
|
|
|
static sPoolNode *RemoveHeadNode(sNodeList *Root);
|
|
|
|
static void RemoveNode(sPoolNode *Node,sNodeList *Root);
|
|
|
|
static void AddNode(sPoolNode *Node,sNodeList *Root);
|
2001-04-27 22:28:47 +02:00
|
|
|
static void AddNodeList(sNodeList *Src,sNodeList *Dst);
|
2001-04-25 21:11:45 +02:00
|
|
|
static u8 *UnpackBuffer;
|
2001-04-01 09:22:30 +02:00
|
|
|
|
2001-04-09 23:27:21 +02:00
|
|
|
protected:
|
2001-04-25 18:41:16 +02:00
|
|
|
int GetSlot(int W,int H);
|
|
|
|
void InitCache(int Type,int Count);
|
|
|
|
int GetSizeType(int Size);
|
2001-04-02 22:24:58 +02:00
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
sPoolSlot SlotList[CACHE_TYPE_MAX];
|
|
|
|
|
|
|
|
int CurrentTPX;
|
|
|
|
int CurrentPalette;
|
|
|
|
int SlotCount;
|
2001-04-25 21:11:45 +02:00
|
|
|
|
2001-04-01 09:22:30 +02:00
|
|
|
};
|
2001-04-25 18:41:16 +02:00
|
|
|
|
2001-04-01 09:22:30 +02:00
|
|
|
/*****************************************************************************/
|
2001-04-09 23:27:21 +02:00
|
|
|
class CActorGfx;
|
2001-04-01 22:22:49 +02:00
|
|
|
class CActorPool
|
2001-04-01 09:22:30 +02:00
|
|
|
{
|
|
|
|
public:
|
2001-04-04 18:51:04 +02:00
|
|
|
|
2001-04-01 09:22:30 +02:00
|
|
|
static void Init();
|
2001-04-25 18:41:16 +02:00
|
|
|
static void Reset();
|
|
|
|
static void SetUpCache();
|
2001-04-01 09:22:30 +02:00
|
|
|
|
2001-04-19 18:18:26 +02:00
|
|
|
static void AddActor(FileEquate Filename) {GetActor(Filename);}
|
2001-04-09 23:27:21 +02:00
|
|
|
static CActorGfx *GetActor(FileEquate Filename);
|
2001-04-27 22:28:47 +02:00
|
|
|
static void CleanUpCache();
|
2001-04-04 18:51:04 +02:00
|
|
|
|
2001-04-09 23:27:21 +02:00
|
|
|
protected:
|
2001-04-25 18:41:16 +02:00
|
|
|
static sActorPool *FindActor(FileEquate Filename);
|
|
|
|
static sActorPool *LoadActor(FileEquate Filename);
|
|
|
|
static void AddActor(sActorPool *ThisActor);
|
2001-04-09 23:27:21 +02:00
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
static CActorCache Cache;
|
|
|
|
static sActorPool *ActorList,*LastActor;
|
2001-04-09 23:27:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
class CActorGfx
|
|
|
|
{
|
|
|
|
public:
|
2001-04-25 18:41:16 +02:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ShadowXOfs =32,
|
|
|
|
ShadowYOfs =32,
|
|
|
|
};
|
2001-04-09 23:27:21 +02:00
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
CActorGfx(sActorPool *ThisActor);
|
|
|
|
virtual ~CActorGfx();
|
2001-04-09 23:27:21 +02:00
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
POLY_FT4 *Render(DVECTOR &Pos,int Anim,int Frame,bool FlipX=false,bool FlipY=false,bool Shadow=false);
|
2001-04-26 15:00:44 +02:00
|
|
|
POLY_FT4 *RotateScale(POLY_FT4 *Ft4,DVECTOR &Pos,int Angle,int XScale,int YScale);
|
2001-04-09 23:27:21 +02:00
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
int getFrameCount(int Anim) {return(PoolEntry->ActorGfx->AnimList[Anim].FrameCount);}
|
|
|
|
int GetTotalFrameCount();
|
2001-04-09 23:27:21 +02:00
|
|
|
|
2001-04-26 15:09:15 +02:00
|
|
|
sBBox &GetBBox() {return(BBox);}
|
2001-04-09 23:27:21 +02:00
|
|
|
protected:
|
2001-04-25 18:41:16 +02:00
|
|
|
void SetUpFT4(POLY_FT4 *Ft4,sSpriteFrame *Frame,sPoolNode *Node,int X,int Y,bool XFlip,bool YFlip);
|
2001-04-09 23:27:21 +02:00
|
|
|
sSpriteFrame *GetFrame(int Anim,int Frame);
|
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
sActorPool *PoolEntry;
|
2001-04-26 15:00:44 +02:00
|
|
|
sSpriteFrame *CurrentFrame;
|
|
|
|
|
2001-04-25 21:11:45 +02:00
|
|
|
sBBox BBox;
|
2001-04-01 09:22:30 +02:00
|
|
|
};
|
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
2001-04-21 00:20:58 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
class CModelGfx
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CModelGfx(){};
|
|
|
|
virtual ~CModelGfx(){};
|
|
|
|
|
|
|
|
static void SetData(sModel *Table,sTri *TList,sQuad *QList,sVtx *VList);
|
|
|
|
void SetModel(int Type);
|
|
|
|
|
2001-04-27 22:28:47 +02:00
|
|
|
void Render(DVECTOR &Pos,SVECTOR *Angle=0,VECTOR *Scale=0);
|
2001-04-21 00:20:58 +02:00
|
|
|
|
|
|
|
protected:
|
2001-04-27 22:28:47 +02:00
|
|
|
|
2001-04-21 00:20:58 +02:00
|
|
|
static sModel *ModelTable;
|
|
|
|
static sTri *ModelTriList;
|
|
|
|
static sQuad *ModelQuadList;
|
|
|
|
static sVtx *ModelVtxList;
|
|
|
|
sModel *Model;
|
|
|
|
};
|
|
|
|
|
2001-04-01 09:22:30 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#endif
|