This commit is contained in:
Paul 2001-05-15 16:48:29 +00:00
parent d4738f9b8a
commit 4eda6e85fe
6 changed files with 45 additions and 20 deletions

View file

@ -440,9 +440,24 @@ void CLevel::initThings(int _respawningLevel)
int spatNumber=0; int spatNumber=0;
for(int i=0;i<ItemCount;i++) for(int i=0;i<ItemCount;i++)
{ {
int isSpat=(PICKUP_TYPE)ItemList->Type==PICKUP__SPATULA; int createThisPickup;
int isSpat;
CBasePickup *newPickup; CBasePickup *newPickup;
if(!isSpat||CGameSlotManager::getSlotData()->isSpatulaUncollected(GameScene.getChapterNumber(),GameScene.getLevelNumber(),spatNumber))
createThisPickup=true;
isSpat=(PICKUP_TYPE)ItemList->Type==PICKUP__SPATULA;
if(isSpat&&CGameSlotManager::getSlotData()->isSpatulaUncollected(GameScene.getChapterNumber(),GameScene.getLevelNumber(),spatNumber)==false)
{
createThisPickup=false;
}
if((PICKUP_TYPE)ItemList->Type==PICKUP__NET&&_respawningLevel)
{
createThisPickup=false;
}
if(createThisPickup)
{ {
pos.vx=ItemList->Pos.X<<4; pos.vx=ItemList->Pos.X<<4;
pos.vy=ItemList->Pos.Y<<4; pos.vy=ItemList->Pos.Y<<4;
@ -456,6 +471,7 @@ void CLevel::initThings(int _respawningLevel)
{ {
spatNumber++; spatNumber++;
} }
ItemList++; ItemList++;
} }
} }

View file

@ -38,6 +38,7 @@ class CNetPickup : public CBasePickup
{ {
public: public:
virtual void init(); virtual void init();
virtual int dontKillDuringLevelRespawn() {return true;}
virtual DVECTOR getSizeForPlacement(); virtual DVECTOR getSizeForPlacement();
virtual void collect(class CPlayer *_player); virtual void collect(class CPlayer *_player);

View file

@ -567,12 +567,12 @@ void CPlayer::init()
{ {
s_playerModes[i]->initialise(this); s_playerModes[i]->initialise(this);
} }
m_currentPlayerModeClass=NULL;
setMode(PLAYER_MODE_FULLUNARMED); //PKG
m_animNo=0; m_animNo=0;
m_animFrame=0; m_animFrame=0;
setFacing(FACING_RIGHT); setFacing(FACING_RIGHT);
m_currentPlayerModeClass=NULL;
m_lastModeBeforeDeath=PLAYER_MODE_FULLUNARMED; // Player will then respawn into this mode
m_lives++;respawn(); m_lives++;respawn();
m_lives=CGameSlotManager::getSlotData()->m_lives; m_lives=CGameSlotManager::getSlotData()->m_lives;
@ -1257,6 +1257,12 @@ void CPlayer::registerAddon(PLAYER_ADDONS _addon)
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayer::setMode(PLAYER_MODE _mode) void CPlayer::setMode(PLAYER_MODE _mode)
{ {
if(_mode==PLAYER_MODE_DEAD)
{
ASSERT(m_currentMode!=PLAYER_MODE_DEAD);
m_lastModeBeforeDeath=m_currentMode;
}
resetPlayerCollisionSizeToBase(); resetPlayerCollisionSizeToBase();
m_currentMode=_mode; m_currentMode=_mode;
m_currentPlayerModeClass=s_playerModes[_mode]; m_currentPlayerModeClass=s_playerModes[_mode];
@ -1424,15 +1430,7 @@ void CPlayer::calcCameraFocusPointTarget()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayer::respawn() void CPlayer::respawn()
{ {
// Strip any items that the player might be holding setMode(m_lastModeBeforeDeath);
// if(m_currentMode!=PLAYER_MODE_BASICUNARMED)
// {
setMode(PLAYER_MODE_FULLUNARMED);
// }
// else
// {
// setMode(PLAYER_MODE_BASICUNARMED);
// }
m_allowConversation=false; m_allowConversation=false;

View file

@ -191,6 +191,7 @@ public:
virtual void shutdown(); virtual void shutdown();
virtual void think(int _frames); virtual void think(int _frames);
virtual void render(); virtual void render();
virtual int dontKillDuringLevelRespawn() {return true;}
virtual void shove(DVECTOR move); virtual void shove(DVECTOR move);
void moveLeft(); // This is only for camera scroll right now.. void moveLeft(); // This is only for camera scroll right now..
void moveRight(); // " " " " " void moveRight(); // " " " " "
@ -305,7 +306,8 @@ private:
static class CPlayerMode *s_playerModes[NUM_PLAYERMODES]; static class CPlayerMode *s_playerModes[NUM_PLAYERMODES];
class CPlayerMode *m_currentPlayerModeClass; class CPlayerMode *m_currentPlayerModeClass;
int m_currentMode; PLAYER_MODE m_currentMode;
PLAYER_MODE m_lastModeBeforeDeath;
private: private:

View file

@ -63,7 +63,7 @@ static const int s_ThinkBBoxX1=512+526;
static const int s_ThinkBBoxY0=0-128; static const int s_ThinkBBoxY0=0-128;
static const int s_ThinkBBoxY1=256+128; static const int s_ThinkBBoxY1=256+128;
CThing *CThingManager::s_thingLists[CThing::MAX_TYPE];//={NULL,NULL}; CThing *CThingManager::s_thingLists[CThing::MAX_TYPE];
CThing *CThingManager::s_CollisionLists[CThing::MAX_TYPE]; CThing *CThingManager::s_CollisionLists[CThing::MAX_TYPE];
int CThingManager::s_initialised=false; int CThingManager::s_initialised=false;
@ -127,25 +127,32 @@ int i;
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Kills every CThing except the player Purpose:
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CThingManager::killAllThingsForRespawn() void CThingManager::killAllThingsForRespawn()
{ {
int i; int i;
CThing *thing;
ASSERT(s_initialised); ASSERT(s_initialised);
for(i=0;i<CThing::MAX_TYPE;i++) for(i=0;i<CThing::MAX_TYPE;i++)
{ {
if(i!=CThing::TYPE_PLAYER) // Hey - it's not optimal in speed, but it's vaguely funny :)
{ // ( and anyway.. it probly *is* optimal in size.. )
while(s_thingLists[i]) CThing *thing;
{
thing=s_thingLists[i]; thing=s_thingLists[i];
while(thing)
{
if(thing->dontKillDuringLevelRespawn())
{
thing=thing->m_nextListThing;
}
else
{
thing->shutdown(); thing->shutdown();
delete thing; delete thing;
thing=s_thingLists[i];
} }
} }
} }

View file

@ -115,6 +115,7 @@ virtual void shutdown();
virtual void think(int _frames); virtual void think(int _frames);
virtual void render(); virtual void render();
virtual u8 isSetToShutdown() {return( false );} virtual u8 isSetToShutdown() {return( false );}
virtual int dontKillDuringLevelRespawn() {return false;}
// Linkage // Linkage
void addChild(CThing *Child); void addChild(CThing *Child);