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
|
|
|
/*****************************************************************************/
|
|
|
|
struct sPoolNode
|
2001-04-09 23:27:21 +02:00
|
|
|
{
|
2001-05-15 19:40:54 +02:00
|
|
|
sSpriteFrameGfx *Frame;
|
2001-05-14 21:40:30 +02:00
|
|
|
RECT DstRect;
|
|
|
|
u16 TPage;
|
|
|
|
u8 U,V;
|
|
|
|
sPoolNode *Prev,*Next;
|
2001-04-25 18:41:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2001-06-14 23:17:10 +02:00
|
|
|
// u16 RefCount;
|
|
|
|
// u16 FrameCount;
|
2001-04-25 18:41:16 +02:00
|
|
|
sNodeList NodeList;
|
2001-04-25 21:11:45 +02:00
|
|
|
u8 *ListMem;
|
2001-06-14 23:17:10 +02:00
|
|
|
u16 SlotCount;
|
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-06-14 23:17:10 +02:00
|
|
|
s16 CacheSlot;
|
2001-04-25 18:41:16 +02:00
|
|
|
sSpriteAnimBank *ActorGfx;
|
2001-05-12 01:52:38 +02:00
|
|
|
sNodeList *GlobalCache;
|
|
|
|
sNodeList LocalCache;
|
|
|
|
sNodeList LastCache;
|
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,
|
2001-05-09 19:30:40 +02:00
|
|
|
TPAGE_H =256-2, // (allow for 2 lines of palettes)
|
2001-04-25 18:41:16 +02:00
|
|
|
|
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
|
|
|
|
2001-05-09 19:30:40 +02:00
|
|
|
CACHE_PALX =CACHE_X,
|
|
|
|
CACHE_PALY =510,
|
2001-04-25 18:41:16 +02:00
|
|
|
CACHE_PALW =64,
|
|
|
|
CACHE_PALH =1,
|
|
|
|
|
|
|
|
CACHE_TYPE_MAX =8,
|
2001-05-14 21:40:30 +02:00
|
|
|
|
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);
|
2001-05-12 01:52:38 +02:00
|
|
|
sPoolSlot &GetSlot(int Slot) {return(SlotList[Slot]);}
|
2001-04-25 18:41:16 +02:00
|
|
|
sNodeList *GetSlotList(int Slot) {return(&SlotList[Slot].NodeList);}
|
2001-05-12 01:52:38 +02:00
|
|
|
int GetSlotCount() {return(SlotCount);}
|
2001-04-25 18:41:16 +02:00
|
|
|
|
|
|
|
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-01 09:22:30 +02:00
|
|
|
|
2001-04-09 23:27:21 +02:00
|
|
|
protected:
|
2001-05-05 20:38:24 +02:00
|
|
|
int ReAllocSlot(int W,int H);
|
2001-04-25 18:41:16 +02:00
|
|
|
int GetSlot(int W,int H);
|
|
|
|
void InitCache(int Type,int Count);
|
2001-05-14 21:40:30 +02:00
|
|
|
int GetSizeType(int Size) {return((Size+15)&-16);}
|
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-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-05-14 21:40:30 +02:00
|
|
|
|
2001-04-09 23:27:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
class CActorGfx
|
|
|
|
{
|
|
|
|
public:
|
2001-04-25 18:41:16 +02:00
|
|
|
enum
|
|
|
|
{
|
2001-04-30 23:49:54 +02:00
|
|
|
DEF_SHADOW_OFS=32,
|
2001-04-25 18:41:16 +02:00
|
|
|
};
|
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-06-14 23:17:10 +02:00
|
|
|
void setActor(sActorPool *ThisActor);
|
|
|
|
|
2001-04-30 23:49:54 +02:00
|
|
|
POLY_FT4 *Render(DVECTOR &Pos,int Anim,int Frame,bool FlipX=false,bool FlipY=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);}
|
2001-04-30 23:49:54 +02:00
|
|
|
int GetTotalFrameCount() {return(PoolEntry->ActorGfx->FrameCount);}
|
2001-04-09 23:27:21 +02:00
|
|
|
|
2001-04-26 15:09:15 +02:00
|
|
|
sBBox &GetBBox() {return(BBox);}
|
2001-04-30 23:49:54 +02:00
|
|
|
|
2001-06-14 23:17:10 +02:00
|
|
|
// void SetShadow(bool f) {ShadowFlag=f;}
|
|
|
|
// void SetShadowOfs(int X,int Y) {ShadowXOfs=X; ShadowYOfs=Y;}
|
2001-05-09 18:27:33 +02:00
|
|
|
void SetOtPos(int Ot) {OtPos=Ot;}
|
2001-04-30 23:49:54 +02:00
|
|
|
|
2001-04-09 23:27:21 +02:00
|
|
|
protected:
|
2001-05-15 19:40:54 +02:00
|
|
|
void SetUpFT4(POLY_FT4 *Ft4,sPoolNode *Node,int X,int Y,bool XFlip,bool YFlip);
|
2001-04-09 23:27:21 +02:00
|
|
|
|
2001-04-25 18:41:16 +02:00
|
|
|
sActorPool *PoolEntry;
|
2001-04-26 15:00:44 +02:00
|
|
|
sSpriteFrame *CurrentFrame;
|
2001-05-15 19:40:54 +02:00
|
|
|
sSpriteFrameGfx *CurrentFrameGfx;
|
2001-04-26 15:00:44 +02:00
|
|
|
|
2001-04-25 21:11:45 +02:00
|
|
|
sBBox BBox;
|
2001-06-14 23:17:10 +02:00
|
|
|
// bool ShadowFlag;
|
|
|
|
// s16 ShadowXOfs,ShadowYOfs;
|
2001-05-09 18:27:33 +02:00
|
|
|
u32 OtPos;
|
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-05-09 18:27:33 +02:00
|
|
|
void Render(DVECTOR &Pos,SVECTOR *Angle=0,VECTOR *Scale=0);
|
2001-05-03 16:50:02 +02:00
|
|
|
sBBox &GetBBox() {return(Model->BBox);}
|
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
|