From 4cbe1ef5dd45ecab302ae696927eca61d06b79a4 Mon Sep 17 00:00:00 2001 From: Daveo Date: Wed, 25 Apr 2001 19:11:45 +0000 Subject: [PATCH] --- source/gfx/actor.cpp | 45 +++++++++++++++++++++++++------------------- source/gfx/actor.h | 16 ++++------------ source/gfx/prim.h | 2 +- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/source/gfx/actor.cpp b/source/gfx/actor.cpp index fbc1067a2..c17ba5d2b 100644 --- a/source/gfx/actor.cpp +++ b/source/gfx/actor.cpp @@ -16,7 +16,7 @@ CActorCache CActorPool::Cache; sActorPool *CActorPool::ActorList,*CActorPool::LastActor; -u8 CActorGfx::UnpackBuffer[CActorCache::MAX_ACTOR_SIZE]; +u8 *CActorCache::UnpackBuffer; /*****************************************************************************/ /*** Cache *******************************************************************/ @@ -25,8 +25,10 @@ CActorCache::CActorCache() { for (int i=0;iListMem=(u8*)MemAlloc(Total*sizeof(sPoolNode),"CacheNodeList"); + List=(sPoolNode*)ThisSlot->ListMem; // Create List Entries for (int Y=0; YAnimList=(sSpriteAnim*) MakePtr(Spr,(int)Spr->AnimList); @@ -436,8 +437,6 @@ sPoolNode *ThisNode;; POLY_FT4 *Ft4; // Is cached? -// if(this->PoolEntry->Filename==ACTORS_SPONGEBOB_SBK) return(0); - ThisNode=PoolEntry->ThisCache.List; while (ThisNode) { @@ -454,12 +453,12 @@ POLY_FT4 *Ft4; ThisNode->Anim=Anim; ThisNode->Frame=Frame; - PAK_doUnpak(UnpackBuffer,FrameGfx->PAKSpr); + PAK_doUnpak(CActorCache::UnpackBuffer,FrameGfx->PAKSpr); R.x=ThisNode->TexX; R.y=ThisNode->TexY; R.w=FrameGfx->W>>2; // div 4 cos 16 color R.h=FrameGfx->H; - LoadImage( &R, (u32*)UnpackBuffer); + LoadImage( &R, (u32*)CActorCache::UnpackBuffer); } Ft4=GetPrimFT4(); @@ -481,6 +480,14 @@ POLY_FT4 *Ft4; setRGB0(sFt4,0,0,0); AddPrimToList(sFt4,ActorOT); } +// Set BBox +int HalfW=FrameGfx->W>>1; +int HalfH=FrameGfx->H>>1; + + BBox.XMin=-HalfW; + BBox.XMax=+HalfW; + BBox.YMin=-HalfH; + BBox.YMax=+HalfH; return(Ft4); } diff --git a/source/gfx/actor.h b/source/gfx/actor.h index 4d772f142..11f5d3880 100644 --- a/source/gfx/actor.h +++ b/source/gfx/actor.h @@ -37,6 +37,7 @@ struct sPoolSlot u16 RefCount; u16 FrameCount; sNodeList NodeList; + u8 *ListMem; }; /*****************************************************************************/ @@ -69,14 +70,7 @@ public: CACHE_PALW =64, CACHE_PALH =1, - CACHE_TABLE_W =(TPAGE_W*CACHE_W)/32, - CACHE_TABLE_H =(TPAGE_H*CACHE_H)/32, - CACHE_TYPE_MAX =8, - - MAX_ACTOR_W =128, - MAX_ACTOR_H =128, - MAX_ACTOR_SIZE =MAX_ACTOR_W*MAX_ACTOR_H, }; CActorCache(); @@ -91,19 +85,19 @@ public: static sPoolNode *RemoveHeadNode(sNodeList *Root); static void RemoveNode(sPoolNode *Node,sNodeList *Root); static void AddNode(sPoolNode *Node,sNodeList *Root); +static u8 *UnpackBuffer; protected: int GetSlot(int W,int H); void InitCache(int Type,int Count); int GetSizeType(int Size); - - u8 SlotTable[CACHE_TABLE_W][CACHE_TABLE_H]; sPoolSlot SlotList[CACHE_TYPE_MAX]; int CurrentTPX; int CurrentPalette; int SlotCount; + }; /*****************************************************************************/ @@ -136,7 +130,6 @@ public: { ShadowXOfs =32, ShadowYOfs =32, - }; CActorGfx(sActorPool *ThisActor); @@ -152,8 +145,7 @@ protected: sSpriteFrame *GetFrame(int Anim,int Frame); sActorPool *PoolEntry; - -static u8 UnpackBuffer[CActorCache::MAX_ACTOR_SIZE]; + sBBox BBox; }; /*****************************************************************************/ diff --git a/source/gfx/prim.h b/source/gfx/prim.h index 611a38834..54cd43687 100644 --- a/source/gfx/prim.h +++ b/source/gfx/prim.h @@ -16,7 +16,7 @@ #endif #define MAX_OT (16) -#define MAX_PRIMS (1024*4) +#define MAX_PRIMS (1024*2) //#define USE_NTAGS 1