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;
for(int i=0;i<ItemCount;i++)
{
int isSpat=(PICKUP_TYPE)ItemList->Type==PICKUP__SPATULA;
int createThisPickup;
int isSpat;
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.vy=ItemList->Pos.Y<<4;
@ -456,6 +471,7 @@ void CLevel::initThings(int _respawningLevel)
{
spatNumber++;
}
ItemList++;
}
}

View File

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

View File

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

View File

@ -191,6 +191,7 @@ public:
virtual void shutdown();
virtual void think(int _frames);
virtual void render();
virtual int dontKillDuringLevelRespawn() {return true;}
virtual void shove(DVECTOR move);
void moveLeft(); // This is only for camera scroll right now..
void moveRight(); // " " " " "
@ -305,7 +306,8 @@ private:
static class CPlayerMode *s_playerModes[NUM_PLAYERMODES];
class CPlayerMode *m_currentPlayerModeClass;
int m_currentMode;
PLAYER_MODE m_currentMode;
PLAYER_MODE m_lastModeBeforeDeath;
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_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];
int CThingManager::s_initialised=false;
@ -127,25 +127,32 @@ int i;
/*----------------------------------------------------------------------
Function:
Purpose: Kills every CThing except the player
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CThingManager::killAllThingsForRespawn()
{
int i;
CThing *thing;
ASSERT(s_initialised);
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.. )
CThing *thing;
thing=s_thingLists[i];
while(thing)
{
while(s_thingLists[i])
if(thing->dontKillDuringLevelRespawn())
{
thing=thing->m_nextListThing;
}
else
{
thing=s_thingLists[i];
thing->shutdown();
delete thing;
thing=s_thingLists[i];
}
}
}

View File

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