This commit is contained in:
parent
26994bdf43
commit
dc1a196981
4 changed files with 38 additions and 42 deletions
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CActorGfx *CActorPool::ActorList[CActorPool::MAX_ACTORS];
|
CActorGfx *CActorPool::ActorList[CActorPool::MAX_ACTORS];
|
||||||
|
u8 CActorPool::UnpackBuffer[CActorPool::MAX_ACTOR_SIZE];
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -77,26 +78,45 @@ CActorGfx::~CActorGfx()
|
||||||
MemFree(SpriteBank);
|
MemFree(SpriteBank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
sSpriteFrame *CActorGfx::GetFrame(int Anim,int Frame)
|
||||||
|
{
|
||||||
|
sSpriteAnim *ThisAnim=SpriteBank->AnimList+Anim;
|
||||||
|
u16 ThisFrame=ThisAnim->Anim[Frame];
|
||||||
|
|
||||||
|
return(SpriteBank->FrameList+ThisFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int CActorGfx::getFrameWidth(int Anim,int Frame)
|
||||||
|
{
|
||||||
|
sSpriteFrame *ThisFrame=GetFrame(Anim,Frame);
|
||||||
|
return(ThisFrame->W);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int CActorGfx::getFrameHeight(int Anim,int Frame)
|
||||||
|
{
|
||||||
|
sSpriteFrame *ThisFrame=GetFrame(Anim,Frame);
|
||||||
|
return(ThisFrame->H);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
POLY_FT4 *CActorGfx::Render(DVECTOR &Pos,int Anim,int Frame,bool XFlip,bool YFlip,bool Shadow)
|
POLY_FT4 *CActorGfx::Render(DVECTOR &Pos,int Anim,int Frame,bool XFlip,bool YFlip,bool Shadow)
|
||||||
{
|
{
|
||||||
sSpriteAnim &ThisAnim=SpriteBank->AnimList[Anim];
|
sSpriteFrame *FrameGfx=GetFrame(Anim,Frame);
|
||||||
u16 FrameNo=ThisAnim.Anim[Frame];
|
|
||||||
sSpriteFrame &ThisFrame=SpriteBank->FrameList[FrameNo];
|
|
||||||
u8 Buffer[64*64];
|
|
||||||
|
|
||||||
PAK_doUnpak(Buffer,ThisFrame.PAKSpr);
|
|
||||||
|
|
||||||
|
PAK_doUnpak(CActorPool::UnpackBuffer,FrameGfx->PAKSpr);
|
||||||
// Gfx
|
// Gfx
|
||||||
RECT Rect;
|
RECT Rect;
|
||||||
Rect.x=TexX;
|
Rect.x=TexX;
|
||||||
Rect.y=TexY;
|
Rect.y=TexY;
|
||||||
Rect.w=ThisFrame.W/4;
|
Rect.w=FrameGfx->W/4;
|
||||||
Rect.h=ThisFrame.H;
|
Rect.h=FrameGfx->H;
|
||||||
LoadImage( &Rect, (u32*)Buffer);
|
LoadImage( &Rect, (u32*)CActorPool::UnpackBuffer);
|
||||||
|
|
||||||
POLY_FT4 *Ft4=GetPrimFT4();
|
POLY_FT4 *Ft4=GetPrimFT4();
|
||||||
SetUpFT4(Ft4,&ThisFrame,Pos.vx,Pos.vy,XFlip,YFlip);
|
SetUpFT4(Ft4,FrameGfx,Pos.vx,Pos.vy,XFlip,YFlip);
|
||||||
setRGB0(Ft4,128,128,128);
|
setRGB0(Ft4,128,128,128);
|
||||||
setTPage(Ft4,0,0,TexX,TexY);
|
setTPage(Ft4,0,0,TexX,TexY);
|
||||||
setClut(Ft4, ClutX, ClutY);
|
setClut(Ft4, ClutX, ClutY);
|
||||||
|
@ -167,24 +187,6 @@ int H=ThisFrame->H;
|
||||||
void CActorGfx::Dump()
|
void CActorGfx::Dump()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/*****************************************************************************/
|
|
||||||
int CActorGfx::getFrameWidth(int Anim,int Frame)
|
|
||||||
{
|
|
||||||
sSpriteAnim &ThisAnim=SpriteBank->AnimList[Anim];
|
|
||||||
u16 FrameNo=ThisAnim.Anim[Frame];
|
|
||||||
sSpriteFrame &ThisFrame=SpriteBank->FrameList[FrameNo];
|
|
||||||
return(ThisFrame.W);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
int CActorGfx::getFrameHeight(int Anim,int Frame)
|
|
||||||
{
|
|
||||||
sSpriteAnim &ThisAnim=SpriteBank->AnimList[Anim];
|
|
||||||
u16 FrameNo=ThisAnim.Anim[Frame];
|
|
||||||
sSpriteFrame &ThisFrame=SpriteBank->FrameList[FrameNo];
|
|
||||||
return(ThisFrame.H);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -220,11 +222,13 @@ int CActorPool::FindFreeIdx()
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Load ********************************************************************/
|
/*** Load ********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
int ActorNo=0;
|
||||||
CActorGfx *CActorPool::GetActor(FileEquate Filename)
|
CActorGfx *CActorPool::GetActor(FileEquate Filename)
|
||||||
{
|
{
|
||||||
CActorGfx *NewActor;
|
CActorGfx *NewActor;
|
||||||
int Idx;
|
int Idx;
|
||||||
|
|
||||||
|
Filename=(FileEquate)(ACTORS_SPONGEBOB_SBK+ActorNo);
|
||||||
// Already Loaded?
|
// Already Loaded?
|
||||||
Idx=FindIdx(Filename);
|
Idx=FindIdx(Filename);
|
||||||
if (Idx!=-1) return(ActorList[Idx]);
|
if (Idx!=-1) return(ActorList[Idx]);
|
||||||
|
@ -254,4 +258,3 @@ int Idx;
|
||||||
ActorList[Idx]=0;
|
ActorList[Idx]=0;
|
||||||
delete ThisActor;
|
delete ThisActor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ virtual ~CActorGfx();
|
||||||
FileEquate GetFilename() {return(Filename);}
|
FileEquate GetFilename() {return(Filename);}
|
||||||
private:
|
private:
|
||||||
void SetUpFT4(POLY_FT4 *Ft4,sSpriteFrame *ThisFrame,int X,int Y,bool XFlip,bool YFlip);
|
void SetUpFT4(POLY_FT4 *Ft4,sSpriteFrame *ThisFrame,int X,int Y,bool XFlip,bool YFlip);
|
||||||
|
sSpriteFrame *GetFrame(int Anim,int Frame);
|
||||||
|
|
||||||
FileEquate Filename;
|
FileEquate Filename;
|
||||||
sSpriteAnimBank *SpriteBank;
|
sSpriteAnimBank *SpriteBank;
|
||||||
|
@ -45,6 +46,7 @@ public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MAX_ACTORS=8,
|
MAX_ACTORS=8,
|
||||||
|
MAX_ACTOR_SIZE=128*128,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Init();
|
static void Init();
|
||||||
|
@ -53,6 +55,8 @@ static void AddActor(FileEquate Filename) {GetActor(Filename);}
|
||||||
static CActorGfx *GetActor(FileEquate Filename);
|
static CActorGfx *GetActor(FileEquate Filename);
|
||||||
static void DumpActor(FileEquate Filename);
|
static void DumpActor(FileEquate Filename);
|
||||||
|
|
||||||
|
static u8 UnpackBuffer[MAX_ACTOR_SIZE];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int FindIdx(FileEquate Filename);
|
static int FindIdx(FileEquate Filename);
|
||||||
static int FindFreeIdx();
|
static int FindFreeIdx();
|
||||||
|
|
Binary file not shown.
|
@ -108,18 +108,6 @@ struct sQuad
|
||||||
//*** Game Types and Headers ************************************************
|
//*** Game Types and Headers ************************************************
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
// Maps
|
// Maps
|
||||||
/*
|
|
||||||
enum TILE3D_FLAGS
|
|
||||||
{
|
|
||||||
TILE3D_FLAGS_F=0,
|
|
||||||
TILE3D_FLAGS_U,
|
|
||||||
TILE3D_FLAGS_D,
|
|
||||||
TILE3D_FLAGS_L,
|
|
||||||
TILE3D_FLAGS_R,
|
|
||||||
// TILE3D_FLAGS_B, // Should never have back facing polys
|
|
||||||
TILE3D_FLAGS_MAX
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
typedef u16 sTileMapElem; // Tile or Tri Start
|
typedef u16 sTileMapElem; // Tile or Tri Start
|
||||||
|
|
||||||
struct sTile
|
struct sTile
|
||||||
|
@ -203,7 +191,8 @@ struct sSpriteFrame
|
||||||
struct sSpriteAnim
|
struct sSpriteAnim
|
||||||
{
|
{
|
||||||
u16 FrameCount; // 2
|
u16 FrameCount; // 2
|
||||||
u16 *Anim; // 2
|
u16 Pad;
|
||||||
|
u16 *Anim; // 4
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sSpriteAnimBank
|
struct sSpriteAnimBank
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue