This commit is contained in:
Paul 2001-02-26 20:42:25 +00:00
parent 90194896f7
commit 25ce2449ae
24 changed files with 84 additions and 108 deletions

View File

@ -186,6 +186,8 @@ system_src := main \
clickcount \ clickcount \
except except
thing_src := thing
utils_src := utils \ utils_src := utils \
sincos sincos

View File

@ -84,6 +84,8 @@ CGameScene GameScene;
/*****************************************************************************/ /*****************************************************************************/
void CGameScene::init() void CGameScene::init()
{ {
CThingManager::init();
SetIdentNoTrans(&CamMtx); SetIdentNoTrans(&CamMtx);
CamMtx.t[2]=ZPos; CamMtx.t[2]=ZPos;
@ -159,8 +161,7 @@ void CGameScene::shutdown()
{ {
m_pauseMenu->shutdown(); delete m_pauseMenu; m_pauseMenu->shutdown(); delete m_pauseMenu;
m_player->shutdown(); delete m_player; CThingManager::shutdown();
CThing::shutdownAndDeleteAllThings();
Level.shutdown(); Level.shutdown();
CConversation::shutdown(); CConversation::shutdown();
@ -174,7 +175,7 @@ void CGameScene::render()
m_pauseMenu->render(); m_pauseMenu->render();
CConversation::render(); CConversation::render();
CThing::renderAllThings(); CThingManager::renderAllThings();
Level.render(); Level.render();
} }
@ -200,7 +201,7 @@ void CGameScene::think(int _frames)
!m_pauseMenu->isActive()) !m_pauseMenu->isActive())
{ {
DVECTOR camPos; DVECTOR camPos;
CThing::thinkAllThings(_frames); CThingManager::thinkAllThings(_frames);
camPos=m_player->getCameraPos(); camPos=m_player->getCameraPos();
//PKG //PKG
// if(camPos.vx<0){camPos.vx=0;PAUL_DBGMSG("cx<0");} // if(camPos.vx<0){camPos.vx=0;PAUL_DBGMSG("cx<0");}
@ -245,7 +246,7 @@ CPlayer * CGameScene::getPlayer()
/*****************************************************************************/ /*****************************************************************************/
void CGameScene::sendEvent( GAME_EVENT evt, CThing *sourceThing ) void CGameScene::sendEvent( GAME_EVENT evt, CThing *sourceThing )
{ {
CThing::processEventAllThings(evt, sourceThing); CThingManager::processEventAllThings(evt, sourceThing);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -73,8 +73,13 @@
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CBalloonPickup::init() void CBalloonPickup::init()
{ {
sFrameHdr *fh;
CBaseRespawningPickup::init(); CBaseRespawningPickup::init();
m_sin=0; m_sin=0;
fh=getSpriteBank()->getFrameHeader(FRM__BALLOON);
setCollisionSize(fh->W,fh->H);
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -151,6 +156,7 @@ void CBalloonPickup::renderPickup(DVECTOR *_pos)
x=_pos->vx-(fh->W/2); x=_pos->vx-(fh->W/2);
y=_pos->vy-(fh->H/2); y=_pos->vy-(fh->H/2);
sprites->printFT4(fh,x+xo1,y,0,0,PICKUPS_OT_POS); sprites->printFT4(fh,x+xo1,y,0,0,PICKUPS_OT_POS);
setCollisionCentreOffset(xo1,0);
x=_pos->vx; x=_pos->vx;
y=_pos->vy+(fh->H/2); y=_pos->vy+(fh->H/2);

View File

@ -65,17 +65,6 @@ void CBubbleMixturePickup::init()
m_sin=0; m_sin=0;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBubbleMixturePickup::shutdown()
{
CBasePickup::shutdown();
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -38,7 +38,6 @@ class CBubbleMixturePickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual void shutdown();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View File

@ -65,17 +65,6 @@ void CBaseHealthPickup::init()
m_sin=0; m_sin=0;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBaseHealthPickup::shutdown()
{
CBasePickup::shutdown();
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -38,7 +38,6 @@ class CBaseHealthPickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual void shutdown();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View File

@ -103,7 +103,7 @@
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CBasePickup::init() void CBasePickup::init()
{ {
CThing::init(); CPickupThing::init();
m_spriteBank=new ("pickup sprite") SpriteBank(); m_spriteBank=new ("pickup sprite") SpriteBank();
m_spriteBank->load(INGAMEFX_INGAMEFX_SPR); m_spriteBank->load(INGAMEFX_INGAMEFX_SPR);
@ -118,7 +118,7 @@ void CBasePickup::init()
void CBasePickup::shutdown() void CBasePickup::shutdown()
{ {
m_spriteBank->dump(); delete m_spriteBank; m_spriteBank->dump(); delete m_spriteBank;
CThing::shutdown(); CPickupThing::shutdown();
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -130,7 +130,7 @@ void CBasePickup::shutdown()
#include "pad\pads.h" #include "pad\pads.h"
void CBasePickup::think(int _frames) void CBasePickup::think(int _frames)
{ {
CThing::think(_frames); CPickupThing::think(_frames);
thinkPickup(_frames); thinkPickup(_frames);
if(PadGetDown(0)&PAD_L2) if(PadGetDown(0)&PAD_L2)
@ -150,7 +150,7 @@ void CBasePickup::render()
DVECTOR ofs,pos; DVECTOR ofs,pos;
int visibilityRadius; int visibilityRadius;
CThing::render(); CPickupThing::render();
ofs=CLevel::getCameraPos(); ofs=CLevel::getCameraPos();
pos.vx=Pos.vx-ofs.vx; pos.vx=Pos.vx-ofs.vx;
@ -167,6 +167,26 @@ void CBasePickup::render()
*/ */
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBasePickup::collidedWith(CThing *_thisThing)
{
switch(_thisThing->getThingType())
{
case TYPE_PLAYER:
collect((CPlayer*)_thisThing);
break;
default:
ASSERT(0);
break;
}
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -18,8 +18,8 @@
Includes Includes
-------- */ -------- */
#ifndef __GAME_THING_H__ #ifndef __GAME_TPICKUP_H__
#include "game/thing.h" #include "thing/tpickup.h"
#endif #endif
@ -52,7 +52,7 @@ PICKUP_TYPE;
Structure defintions Structure defintions
-------------------- */ -------------------- */
class CBasePickup : public CThing class CBasePickup : public CPickupThing
{ {
public: public:
virtual void init(); virtual void init();
@ -76,6 +76,8 @@ protected:
virtual void thinkPickup(int _Frames) {;} virtual void thinkPickup(int _Frames) {;}
virtual void renderPickup(DVECTOR *_pos)=0; virtual void renderPickup(DVECTOR *_pos)=0;
virtual void collidedWith(CThing *_thisThing);
private: private:
class SpriteBank *m_spriteBank; class SpriteBank *m_spriteBank;

View File

@ -65,17 +65,6 @@ void CJellyLauncherAmmoPickup::init()
m_rattle=0; m_rattle=0;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CJellyLauncherAmmoPickup::shutdown()
{
CBasePickup::shutdown();
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -38,7 +38,6 @@ class CJellyLauncherAmmoPickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual void shutdown();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View File

@ -65,17 +65,6 @@ void CLifePickup::init()
m_sin=0; m_sin=0;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CLifePickup::shutdown()
{
CBasePickup::shutdown();
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -38,7 +38,6 @@ class CLifePickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual void shutdown();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View File

@ -69,17 +69,6 @@ void CBaseQuestItemPickup::init()
m_pingFrame=0; m_pingFrame=0;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CBaseQuestItemPickup::shutdown()
{
CBasePickup::shutdown();
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -38,7 +38,6 @@ class CBaseQuestItemPickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual void shutdown();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View File

@ -65,17 +65,6 @@ void CShoesPickup::init()
m_sin=0; m_sin=0;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CShoesPickup::shutdown()
{
CBasePickup::shutdown();
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -38,7 +38,6 @@ class CShoesPickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual void shutdown();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View File

@ -61,17 +61,6 @@ void CSpatulaPickup::init()
m_glint=0; m_glint=0;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CSpatulaPickup::shutdown()
{
CBasePickup::shutdown();
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:

View File

@ -38,7 +38,6 @@ class CSpatulaPickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual void shutdown();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View File

@ -47,8 +47,8 @@
/* Data /* Data
---- */ ---- */
#ifndef __ANIM_PLAYER_ANIM_HEADER__ #ifndef __ANIM_SPONGEBOB_HEADER__
#include <player_anim.h> #include <ACTOR_SPONGEBOB_ANIM.h>
#endif #endif
@ -178,7 +178,7 @@ void CPlayer::init()
sActorHdr *Hdr=m_skel.Load(ACTORS_SPONGEBOB_A3D); sActorHdr *Hdr=m_skel.Load(ACTORS_SPONGEBOB_A3D);
m_skel.Init(Hdr); m_skel.Init(Hdr);
TPLoadTex(ACTORS_SPONGEBOB_TEX); TPLoadTex(ACTORS_SPONGEBOB_TEX);
m_skel.setAnimDatabase(CAnimDB::Load(ANIMS_PLAYER_ABK)); m_skel.setAnimDatabase(CAnimDB::Load(ACTORS_SPONGEBOB_ABK));
// Temporary default respawn pos... should realy be set with setRespawnPos() from the level (pkg) // Temporary default respawn pos... should realy be set with setRespawnPos() from the level (pkg)
@ -209,6 +209,9 @@ m_skel.setAng(512);
s_debugFont.initialise(&standardFont); s_debugFont.initialise(&standardFont);
s_debugFont.setJustification(FontBank::JUST_LEFT); s_debugFont.setJustification(FontBank::JUST_LEFT);
#endif #endif
setCollisionSize(25,50);
setCollisionCentreOffset(0,-25);
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -405,7 +408,7 @@ void CPlayer::thinkVerticalMovement()
{ {
// Landed from a jump with no x movement // Landed from a jump with no x movement
setState(STATE_IDLE); setState(STATE_IDLE);
setAnimNo(ANIM_PLAYER_ANIM_JUMPEND); setAnimNo(ANIM_SPONGEBOB_JUMPEND);
} }
} }
} }
@ -1162,6 +1165,5 @@ PLAYERINPUT CPlayer::readPadInput()
return input; return input;
} }
/*=========================================================================== /*===========================================================================
end */ end */

View File

@ -18,8 +18,8 @@
Includes Includes
-------- */ -------- */
#ifndef __GAME_THING_H__ #ifndef __THING_TPLAYER_H__
#include "game/thing.h" #include "thing/tplayer.h"
#endif #endif
#ifndef __GFX_SKELSPNG_H__ #ifndef __GFX_SKELSPNG_H__
@ -134,7 +134,7 @@ struct PlayerMetrics
}; };
class CPlayer : public CThing class CPlayer : public CPlayerThing
{ {
public: public:
enum enum
@ -277,6 +277,7 @@ private:
DVECTOR m_mapCameraEdges; DVECTOR m_mapCameraEdges;
DVECTOR m_mapEdge; DVECTOR m_mapEdge;
DVECTOR m_respawnPos; DVECTOR m_respawnPos;
}; };

View File

@ -45,6 +45,7 @@
---- */ ---- */
CThing *CThingManager::s_thingLists[CThing::MAX_TYPE]={NULL,NULL}; CThing *CThingManager::s_thingLists[CThing::MAX_TYPE]={NULL,NULL};
int CThingManager::s_initialised=false;
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -57,10 +58,12 @@ void CThingManager::init()
{ {
int i; int i;
ASSERT(!s_initialised);
for(i=0;i<CThing::MAX_TYPE;i++) for(i=0;i<CThing::MAX_TYPE;i++)
{ {
s_thingLists[i]=NULL; s_thingLists[i]=NULL;
} }
s_initialised=true;
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -74,6 +77,7 @@ void CThingManager::shutdown()
int i; int i;
CThing *thing; CThing *thing;
ASSERT(!s_initialised);
for(i=0;i<CThing::MAX_TYPE;i++) for(i=0;i<CThing::MAX_TYPE;i++)
{ {
while(s_thingLists[i]) while(s_thingLists[i])
@ -83,6 +87,7 @@ void CThingManager::shutdown()
delete thing; delete thing;
} }
} }
s_initialised=false;
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------

View File

@ -56,6 +56,7 @@ protected:
private: private:
static class CThing *s_thingLists[]; static class CThing *s_thingLists[];
static int s_initialised;
}; };

View File

@ -1056,6 +1056,26 @@ SOURCE=..\..\..\source\system\vsprintf.cpp
SOURCE=..\..\..\source\system\vsprintf.h SOURCE=..\..\..\source\system\vsprintf.h
# End Source File # End Source File
# End Group # End Group
# Begin Group "thing"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\source\thing\thing.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\thing\thing.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\thing\tpickup.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\thing\tplayer.h
# End Source File
# End Group
# Begin Group "utils" # Begin Group "utils"
# PROP Default_Filter "" # PROP Default_Filter ""
@ -1196,6 +1216,10 @@ SOURCE=..\..\..\out\USA\include\actor_spongebob.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\out\USA\include\ACTOR_SPONGEBOB_Anim.h
# End Source File
# Begin Source File
SOURCE=..\..\..\out\USA\include\BigLump.h SOURCE=..\..\..\out\USA\include\BigLump.h
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -1208,10 +1232,6 @@ SOURCE=..\..\..\out\USA\include\ingamefx.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\out\USA\include\Player_Anim.h
# End Source File
# Begin Source File
SOURCE=..\..\..\out\USA\include\trans.h SOURCE=..\..\..\out\USA\include\trans.h
# End Source File # End Source File
# Begin Source File # Begin Source File