diff --git a/source/level/level.cpp b/source/level/level.cpp index 114381786..4da371283 100644 --- a/source/level/level.cpp +++ b/source/level/level.cpp @@ -440,9 +440,24 @@ void CLevel::initThings(int _respawningLevel) int spatNumber=0; for(int i=0;iType==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++; } } diff --git a/source/pickups/pnet.h b/source/pickups/pnet.h index ee8b61279..5573a29fb 100644 --- a/source/pickups/pnet.h +++ b/source/pickups/pnet.h @@ -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); diff --git a/source/player/player.cpp b/source/player/player.cpp index 8cb9775ab..beeae5460 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -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; diff --git a/source/player/player.h b/source/player/player.h index 10801e10a..d54163893 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -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: diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 4ab6af071..7a2ee8e6c 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -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;idontKillDuringLevelRespawn()) + { + thing=thing->m_nextListThing; + } + else { - thing=s_thingLists[i]; thing->shutdown(); delete thing; + thing=s_thingLists[i]; } } } diff --git a/source/thing/thing.h b/source/thing/thing.h index 79705e926..ce2d87975 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -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);