This commit is contained in:
parent
c716046995
commit
1ba0ce001d
@ -243,11 +243,13 @@ void TestFX(DVECTOR Pos)
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
int FXType=(CFX::FX_TYPE)CFX::FX_TYPE_THWACK;
|
||||
#include "game\game.h"
|
||||
void TestFX(DVECTOR Pos,CThing *Parent)
|
||||
{
|
||||
CFXAttachAnim *FX=(CFXAttachAnim*)CFX::Create((CFX::FX_TYPE)FXType,Pos);
|
||||
//CFXAttachAnim *FX=(CFXAttachAnim*)CFX::Create((CFX::FX_TYPE)FXType,Pos);
|
||||
// Parent->addChild(FX);
|
||||
// TestFXPtr->setLife(32);
|
||||
CGameScene::dropHealth(Pos,0,0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -69,6 +69,7 @@ static CFX *Create(const FX_TYPE Type);
|
||||
static CFX *Create(const FX_TYPE Type,CThing *Parent);
|
||||
static CFX *Create(const FX_TYPE Type,DVECTOR const &Pos);
|
||||
virtual bool alwaysThink() {return(!RelativeToMap);}
|
||||
virtual void leftThinkZone(int _frames) {killFX();}
|
||||
|
||||
virtual void init();
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
|
@ -39,12 +39,6 @@ void CFXBaseAnim::init(DVECTOR const &_Pos)
|
||||
renderFrame=DataPtr->StartFrame;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXBaseAnim::shutdown()
|
||||
{
|
||||
CFX::shutdown();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Think *******************************************************************/
|
||||
/*****************************************************************************/
|
||||
@ -86,7 +80,7 @@ void CFXBaseAnim::killFX()
|
||||
{
|
||||
setToShutdown();
|
||||
// If has follow on effect, create it now
|
||||
if (DataPtr->EndFX)
|
||||
if (DataPtr->EndFX || canThink())
|
||||
{
|
||||
CFX::Create((CFX::FX_TYPE)DataPtr->EndFX,getPos());
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
};
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
virtual void killFX();
|
||||
|
@ -25,12 +25,6 @@ void CFXBaseTrail::init(DVECTOR const &_Pos)
|
||||
ListCount=0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXBaseTrail::shutdown()
|
||||
{
|
||||
CFX::shutdown();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Think *******************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
};
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
|
||||
|
@ -36,12 +36,6 @@ sLevelHdr *LevelHdr=CLevel::getLevelHdr();
|
||||
Life=FallingTile_DefLife;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXFallingTile::shutdown()
|
||||
{
|
||||
CFX::shutdown();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Think *******************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -13,7 +13,6 @@ class CFXFallingTile : public CFX
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
void SetTile(int T) {Tile=T;}
|
||||
|
@ -32,12 +32,6 @@ void CFXJellyFishLegs::init(DVECTOR const &_Pos)
|
||||
Scale = ONE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXJellyFishLegs::shutdown()
|
||||
{
|
||||
CFX::shutdown();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXJellyFishLegs::Setup(int XOfs,int YOfs,bool XFlip)
|
||||
{
|
||||
|
@ -13,7 +13,6 @@ class CFXJellyFishLegs : public CFX
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
|
||||
|
@ -32,12 +32,6 @@ SpriteBank *SprBank=CGameScene::getSpriteBank();
|
||||
DrawW=NRGW;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXNRGBar::shutdown()
|
||||
{
|
||||
CFX::shutdown();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Think *******************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -13,7 +13,6 @@ class CFXNRGBar : public CFX
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
|
||||
|
@ -33,12 +33,6 @@ void CFXSteam::init(DVECTOR const &_Pos)
|
||||
IsHorizontal=false;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXSteam::shutdown()
|
||||
{
|
||||
CFX::shutdown();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CFXSteam::SetSize(int Size)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ class CFXSteam : public CFXBaseTrail
|
||||
{
|
||||
public:
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
|
||||
virtual void think(int _frames);
|
||||
virtual void killFX();
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "mem\memory.h"
|
||||
#include "fileio\fileio.h"
|
||||
#include "utils\utils.h"
|
||||
//#include "utils\pak.h"
|
||||
#include "gfx\prim.h"
|
||||
#include "gfx\actor.h"
|
||||
#include "gfx\otpos.h"
|
||||
@ -99,7 +98,7 @@ int Slot=0;
|
||||
SlotCount++;
|
||||
}
|
||||
}
|
||||
SlotList[Slot].RefCount++;
|
||||
// SlotList[Slot].RefCount++;
|
||||
|
||||
return(Slot);
|
||||
}
|
||||
@ -208,7 +207,7 @@ sPoolNode *DstTail=Dst->Tail;
|
||||
int CActorCache::ReserveSlot(int W,int H,int FrameCount)
|
||||
{
|
||||
int Slot=GetSlot(W,H);
|
||||
SlotList[Slot].FrameCount+=FrameCount;
|
||||
// SlotList[Slot].FrameCount+=FrameCount;
|
||||
return(Slot);
|
||||
}
|
||||
|
||||
@ -282,8 +281,8 @@ void CActorCache::Reset()
|
||||
SlotList[i].ListMem=0;
|
||||
SlotList[i].NodeList.Head=0;
|
||||
SlotList[i].NodeList.Tail=0;
|
||||
SlotList[i].RefCount=0;
|
||||
SlotList[i].FrameCount=0;
|
||||
// SlotList[i].RefCount=0;
|
||||
// SlotList[i].FrameCount=0;
|
||||
SlotList[i].Width=0;
|
||||
SlotList[i].Height=0;
|
||||
}
|
||||
@ -524,12 +523,7 @@ sActorPool *Actor=ActorList;
|
||||
/*****************************************************************************/
|
||||
CActorGfx::CActorGfx(sActorPool *ThisActor)
|
||||
{
|
||||
PoolEntry=ThisActor;
|
||||
ShadowXOfs=DEF_SHADOW_OFS;
|
||||
ShadowYOfs=DEF_SHADOW_OFS;
|
||||
ShadowFlag=false;
|
||||
OtPos=OTPOS__ACTOR_POS;
|
||||
|
||||
setActor(ThisActor);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -537,6 +531,17 @@ CActorGfx::~CActorGfx()
|
||||
{
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CActorGfx::setActor(sActorPool *ThisActor)
|
||||
{
|
||||
PoolEntry=ThisActor;
|
||||
// ShadowXOfs=DEF_SHADOW_OFS;
|
||||
// ShadowYOfs=DEF_SHADOW_OFS;
|
||||
// ShadowFlag=false;
|
||||
OtPos=OTPOS__ACTOR_POS;
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
POLY_FT4 *CActorGfx::Render(DVECTOR &Pos,int Anim,int Frame,bool XFlip,bool YFlip)
|
||||
@ -622,7 +627,7 @@ sSpriteAnim *ThisAnim=SpriteBank->AnimList+Anim;
|
||||
Ft4->tpage=ThisNode->TPage;
|
||||
Ft4->clut=PoolEntry->ActorGfx->Clut;
|
||||
addPrim(OtPtr+OtPos,Ft4);
|
||||
|
||||
/*
|
||||
if (ShadowFlag)
|
||||
{
|
||||
POLY_FT4 *sFt4=GetPrimFT4();
|
||||
@ -635,6 +640,7 @@ sSpriteAnim *ThisAnim=SpriteBank->AnimList+Anim;
|
||||
setRGB0(sFt4,0,0,0);
|
||||
addPrim(OtPtr+OtPos,sFt4);
|
||||
}
|
||||
*/
|
||||
// Set BBox
|
||||
//int HalfW=CurrentFrameGfx->W>>1;
|
||||
// Sizes now depend on aspect corrected sizes, so get sizes back from poly
|
||||
|
@ -31,19 +31,19 @@ struct sNodeList
|
||||
struct sPoolSlot
|
||||
{
|
||||
u16 Width,Height;
|
||||
u16 RefCount;
|
||||
u16 FrameCount;
|
||||
// u16 RefCount;
|
||||
// u16 FrameCount;
|
||||
sNodeList NodeList;
|
||||
u8 *ListMem;
|
||||
int SlotCount;
|
||||
u16 SlotCount;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
struct sActorPool
|
||||
{
|
||||
FileEquate Filename;
|
||||
s16 CacheSlot;
|
||||
sSpriteAnimBank *ActorGfx;
|
||||
int CacheSlot;
|
||||
sNodeList *GlobalCache;
|
||||
sNodeList LocalCache;
|
||||
sNodeList LastCache;
|
||||
@ -138,6 +138,8 @@ public:
|
||||
CActorGfx(sActorPool *ThisActor);
|
||||
virtual ~CActorGfx();
|
||||
|
||||
void setActor(sActorPool *ThisActor);
|
||||
|
||||
POLY_FT4 *Render(DVECTOR &Pos,int Anim,int Frame,bool FlipX=false,bool FlipY=false);
|
||||
POLY_FT4 *RotateScale(POLY_FT4 *Ft4,DVECTOR &Pos,int Angle,int XScale,int YScale);
|
||||
|
||||
@ -146,8 +148,8 @@ virtual ~CActorGfx();
|
||||
|
||||
sBBox &GetBBox() {return(BBox);}
|
||||
|
||||
void SetShadow(bool f) {ShadowFlag=f;}
|
||||
void SetShadowOfs(int X,int Y) {ShadowXOfs=X; ShadowYOfs=Y;}
|
||||
// void SetShadow(bool f) {ShadowFlag=f;}
|
||||
// void SetShadowOfs(int X,int Y) {ShadowXOfs=X; ShadowYOfs=Y;}
|
||||
void SetOtPos(int Ot) {OtPos=Ot;}
|
||||
|
||||
protected:
|
||||
@ -158,8 +160,8 @@ protected:
|
||||
sSpriteFrameGfx *CurrentFrameGfx;
|
||||
|
||||
sBBox BBox;
|
||||
bool ShadowFlag;
|
||||
s16 ShadowXOfs,ShadowYOfs;
|
||||
// bool ShadowFlag;
|
||||
// s16 ShadowXOfs,ShadowYOfs;
|
||||
u32 OtPos;
|
||||
};
|
||||
|
||||
|
@ -227,7 +227,7 @@ public:
|
||||
void setLedgeLookAhead(int _lookAhead) {m_ledgeLookAhead=_lookAhead;}
|
||||
|
||||
void addLife();
|
||||
void addSpatula() {m_numSpatulasHeld++;}
|
||||
void addSpatula(int Count=1) {m_numSpatulasHeld+=Count;}
|
||||
int getSpatulasHeld() {return m_numSpatulasHeld;}
|
||||
ATTACK_STATE getAttackState();
|
||||
int isRecoveringFromHit() {return m_invincibleFrameCount!=0||m_currentMode==PLAYER_MODE_DEAD;}
|
||||
|
@ -418,6 +418,7 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||
if (ThingRect->y2<m_ThinkBBox.YMin || ThingRect->y1>m_ThinkBBox.YMax) Flag=0;
|
||||
}
|
||||
thing->setThinkFlag(Flag);
|
||||
// Is in think zone
|
||||
if (Flag)
|
||||
{
|
||||
thing->think(_frames);
|
||||
@ -428,15 +429,16 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||
}
|
||||
}
|
||||
Flag|=lastFlag;
|
||||
// Handle enter/leave states (not sure of viabilty now)
|
||||
switch (Flag)
|
||||
{ // Last This
|
||||
case 0: // 0 0
|
||||
break;
|
||||
case 1: // 0 1
|
||||
thing->enterThingZone(_frames);
|
||||
thing->enterThinkZone(_frames);
|
||||
break;
|
||||
case 2: // 1 0
|
||||
thing->leftThingZone(_frames);
|
||||
thing->leftThinkZone(_frames);
|
||||
break;
|
||||
case 3: // 1 1
|
||||
break;
|
||||
@ -444,11 +446,8 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
||||
ASSERT("Invalid Think State");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* THIS WILL NOT STAY HERE, THINGS MUST BE INITIALISED CORRECTLY */
|
||||
thing->updateCollisionArea();
|
||||
|
||||
thing=thing->m_nextListThing;
|
||||
}
|
||||
}
|
||||
@ -916,6 +915,7 @@ void CThingManager::resetFreeList()
|
||||
while (ThisThing)
|
||||
{
|
||||
CThing *Next=ThisThing->NextFreeThing;
|
||||
ThisThing->destroy();
|
||||
delete ThisThing;
|
||||
FreeListCount--;
|
||||
ThisThing=Next;
|
||||
@ -979,21 +979,12 @@ int SubType=Thing->getThingSubType();
|
||||
CThing **List=s_FreeList[Type];
|
||||
|
||||
// Check its been aquired/set correctly
|
||||
// ASSERT(SubType!=1234);
|
||||
if (SubType!=1234)
|
||||
{
|
||||
Thing->NextFreeThing=List[SubType];
|
||||
List[SubType]=Thing;
|
||||
FreeListCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%i %i\n",Type,SubType);
|
||||
ASSERT(!"Thing not Setup Correctly");
|
||||
Thing->NextFreeThing=DuffList;
|
||||
DuffList=Thing;
|
||||
DuffListCount++;
|
||||
}
|
||||
|
||||
ASSERT(SubType!=1234);
|
||||
|
||||
Thing->NextFreeThing=List[SubType];
|
||||
List[SubType]=Thing;
|
||||
FreeListCount++;
|
||||
|
||||
#else
|
||||
delete Thing;
|
||||
@ -1249,30 +1240,6 @@ CThing *List=NextThing;
|
||||
m_numChildren = 0;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
/*
|
||||
bool CThing::hasChild(CThing *Child)
|
||||
{
|
||||
CThing *nextChild = NextThing;
|
||||
|
||||
while( nextChild )
|
||||
{
|
||||
if ( nextChild == Child )
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
|
||||
nextChild = nextChild->NextThing;
|
||||
}
|
||||
|
||||
return( false );
|
||||
}
|
||||
*/
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
@ -1315,7 +1282,7 @@ void CThing::updateCollisionArea()
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
s32 CThing::getNewYPos(CThing *_thisThing)
|
||||
{
|
||||
CRECT thisRect;
|
||||
@ -1330,7 +1297,7 @@ s32 CThing::getNewYPos(CThing *_thisThing)
|
||||
return( thisRect.y2 );
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
|
@ -140,8 +140,11 @@ virtual TYPE getThingType()=0;
|
||||
virtual void setThingSubType(int T) {m_SubType=T;}
|
||||
virtual int getThingSubType() {return(m_SubType);}
|
||||
|
||||
virtual void init();
|
||||
virtual void shutdown();
|
||||
virtual void create() {;} // Once only init (for mem alloc)
|
||||
virtual void init(); // re-usable init
|
||||
virtual void shutdown(); // re-usable shutdown
|
||||
virtual void destroy() {;} // memory clean up when totally killing the poor things
|
||||
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
void setToShutdown(bool f=true) {m_isShuttingDown = f;}
|
||||
@ -153,10 +156,8 @@ virtual int dontKillDuringLevelRespawn() {return false;}
|
||||
void removeChild(CThing *Child);
|
||||
void removeAllChild();
|
||||
void deleteAllChild();
|
||||
// bool hasChild(CThing *Child);
|
||||
int getNumChildren() {return( m_numChildren );}
|
||||
|
||||
|
||||
DVECTOR const &getPos() {return Pos;}
|
||||
void setPos(DVECTOR newPos) {Pos=newPos;}
|
||||
DVECTOR getPosDelta() {return PosDelta;}
|
||||
@ -186,8 +187,8 @@ public:
|
||||
virtual CRECT const *getRenderBBox() {return &m_collisionArea;}
|
||||
virtual CRECT const *getThinkBBox() {return &m_collisionArea;}
|
||||
virtual bool alwaysThink() {return(false);}
|
||||
virtual void leftThingZone(int _frames) {}
|
||||
virtual void enterThingZone(int _frames) {}
|
||||
virtual void leftThinkZone(int _frames) {}
|
||||
virtual void enterThinkZone(int _frames) {}
|
||||
|
||||
void ShowBBox();
|
||||
DVECTOR const &getCollisionCentre() {return m_collisionCentre;}
|
||||
@ -203,7 +204,7 @@ virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
||||
virtual void collidedWith(CThing *_thisThing) {;}
|
||||
virtual void setHasPlatformCollided( bool newVal ) {;}
|
||||
virtual bool getHasPlatformCollided() {return false;}
|
||||
virtual s32 getNewYPos( CThing *_thisThing );
|
||||
//virtual s32 getNewYPos( CThing *_thisThing );
|
||||
|
||||
public:
|
||||
// Thing states
|
||||
@ -213,6 +214,7 @@ public:
|
||||
bool canRender() {return (m_renderFlag);}
|
||||
DVECTOR &getRenderPos() {return(m_RenderPos);}
|
||||
bool canThink() {return (m_thinkFlag);}
|
||||
|
||||
protected:
|
||||
bool m_renderFlag,m_thinkFlag;
|
||||
DVECTOR m_RenderPos;
|
||||
|
Loading…
Reference in New Issue
Block a user