This commit is contained in:
Paul 2001-07-10 18:15:12 +00:00
parent ecad098615
commit e59dac8580
8 changed files with 84 additions and 42 deletions

View file

@ -180,7 +180,8 @@ eng=GAME OVER
eng=CONTINUE? eng=CONTINUE?
[STR__BACKEND__PRESS_START] [STR__BACKEND__PRESS_START]
eng=PRESS START eng=PRESS START
[STR__BACKEND__CONTINUES_REMAINING]
eng=Continues:

View file

@ -26,8 +26,8 @@
#include "pad\pads.h" #include "pad\pads.h"
#endif #endif
#ifndef __GAME_GAME_H__ #ifndef __MAP_MAP_H__
#include "game\game.h" #include "map\map.h"
#endif #endif
#ifndef __FRONTEND_FRONTEND_H__ #ifndef __FRONTEND_FRONTEND_H__
@ -54,6 +54,10 @@
#include "locale\textdbase.h" #include "locale\textdbase.h"
#endif #endif
#ifndef __GAME_GAMESLOT_H__
#include "game\gameslot.h"
#endif
/* Std Lib /* Std Lib
------- */ ------- */
@ -108,8 +112,15 @@ void CGameOverScene::init()
initContinue(); initContinue();
initGameOver(); initGameOver();
if(CGameSlotManager::getSlotData()->m_continues>=1)
{
m_state=STATE__CONTINUE; m_state=STATE__CONTINUE;
} }
else
{
m_state=STATE__GAME_OVER;
}
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
@ -245,7 +256,9 @@ void CGameOverScene::thinkContinue(int _frames)
{ {
m_readyToExit=true; m_readyToExit=true;
CFader::setFadingOut(); CFader::setFadingOut();
GameState::setNextScene(&GameScene); GameState::setNextScene(&MapScene);
CGameSlotManager::getSlotData()->m_lives=CGameSlotManager::INITIAL_LIVES;
CGameSlotManager::getSlotData()->m_continues--;
m_state=STATE__EXITING_TO_GAME; m_state=STATE__EXITING_TO_GAME;
} }
else else
@ -310,6 +323,11 @@ void CGameOverScene::renderContinue()
m_font->print(256,200-m_font->getStringHeight(buf),buf); m_font->print(256,200-m_font->getStringHeight(buf),buf);
} }
} }
sprintf(buf,"%s%d",TranslationDatabase::getString(STR__BACKEND__CONTINUES_REMAINING),CGameSlotManager::getSlotData()->m_continues);
m_font->setScale(256);
m_font->setColour(100,100,100);
m_font->print(490-(m_font->getStringWidth(buf)/2),210,buf);
} }
@ -325,6 +343,8 @@ void CGameOverScene::initGameOver()
m_finishedGrowingText=false; m_finishedGrowingText=false;
} }
void CGameOverScene::thinkGameOver(int _frames) void CGameOverScene::thinkGameOver(int _frames)
{
if(!CFader::isFading())
{ {
if(!m_finishedGrowingText) if(!m_finishedGrowingText)
{ {
@ -332,8 +352,7 @@ void CGameOverScene::thinkGameOver(int _frames)
} }
else else
{ {
if(!CFader::isFading()&&!m_readyToExit&& if(!m_readyToExit&&PadGetDown(0)&(PAD_START|PAD_CROSS))
PadGetDown(0)&(PAD_START|PAD_CROSS))
{ {
m_readyToExit=true; m_readyToExit=true;
CFader::setFadingOut(); CFader::setFadingOut();
@ -342,6 +361,7 @@ void CGameOverScene::thinkGameOver(int _frames)
} }
} }
} }
}
void CGameOverScene::renderGameOver() void CGameOverScene::renderGameOver()
{ {
char buf[100],*bufPtr; char buf[100],*bufPtr;

View file

@ -451,6 +451,8 @@ void CFrontEndStart::think(int _frames)
int chapter,level; int chapter,level;
gameSlot->getHighestLevelOpen(&chapter,&level); gameSlot->getHighestLevelOpen(&chapter,&level);
CMapScene::setLevelToStartOn(chapter,level); CMapScene::setLevelToStartOn(chapter,level);
gameSlot->m_lives=CGameSlotManager::INITIAL_LIVES;
gameSlot->m_continues=CGameSlotManager::INITIAL_CONTINUES;
m_state=STATE_EXITING_TO_GAME; m_state=STATE_EXITING_TO_GAME;
CFader::setFadingOut(); CFader::setFadingOut();
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK); CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK);

View file

@ -87,6 +87,10 @@
#include "fma\fma.h" #include "fma\fma.h"
#endif #endif
#ifndef __BACKEND_GAMEOVER_H__
#include "backend\gameover.h"
#endif
#ifndef __GAME_GAMESLOT_H__ #ifndef __GAME_GAMESLOT_H__
#include "game\gameslot.h" #include "game\gameslot.h"
#endif #endif
@ -291,6 +295,7 @@ void CGameScene::render()
void CGameScene::render_showing_lives() void CGameScene::render_showing_lives()
{ {
int colour; int colour;
char buf[20];
POLY_F4 *f4; POLY_F4 *f4;
POLY_FT3 *ft3; POLY_FT3 *ft3;
@ -318,7 +323,8 @@ void CGameScene::render_showing_lives()
s_genericFont->print(256,50,"Now entering:"); s_genericFont->print(256,50,"Now entering:");
s_genericFont->print(256,80,Level.getChapterLoadingText()); s_genericFont->print(256,80,Level.getChapterLoadingText());
s_genericFont->print(256,100,Level.getLevelLoadingText()); s_genericFont->print(256,100,Level.getLevelLoadingText());
s_genericFont->print(256,140,"Lives x 5"); sprintf(buf,"Lives x %d",CGameSlotManager::getSlotData()->m_lives);
s_genericFont->print(256,140,buf);
// Black background // Black background
f4=GetPrimF4(); f4=GetPrimF4();
@ -641,14 +647,14 @@ void CGameScene::think_playing(int _frames)
#endif #endif
else if (s_restartLevel) else if (s_restartLevel)
{ {
if(m_player->getLivesLeft()!=0) if(m_player->getLivesLeft()>=0)
{ {
respawnLevel(); respawnLevel();
} }
else else
{ {
s_readyToExit=true; s_readyToExit=true;
GameState::setNextScene(&FrontEndScene); GameState::setNextScene(&GameOverScene);
CFader::setFadingOut(); CFader::setFadingOut();
} }
s_restartLevel=false; s_restartLevel=false;

View file

@ -66,8 +66,8 @@ public:
typedef struct typedef struct
{ {
unsigned char m_isInUse; unsigned char m_isInUse;
unsigned char m_lives; signed char m_lives;
unsigned char m_continues; signed char m_continues;
unsigned char m_hasSeenOpeningFMA; unsigned char m_hasSeenOpeningFMA;
unsigned char m_spatulaCollectedCounts[NUM_CHAPTERS*NUM_LEVELS_WITH_SPATULAS]; unsigned char m_spatulaCollectedCounts[NUM_CHAPTERS*NUM_LEVELS_WITH_SPATULAS];
unsigned char m_kelpTokenCollectedFlags[NUM_CHAPTERS][16]; // Enuf space for 128 tokens per level unsigned char m_kelpTokenCollectedFlags[NUM_CHAPTERS][16]; // Enuf space for 128 tokens per level

View file

@ -92,7 +92,7 @@ private:
enum enum
{ {
SAVELOAD_HEADERID=0, SAVELOAD_HEADERID=1,
}; };

View file

@ -626,11 +626,9 @@ m_animFrame=0;
setFacing(FACING_RIGHT); setFacing(FACING_RIGHT);
m_currentPlayerModeClass=NULL; m_currentPlayerModeClass=NULL;
m_lastModeBeforeDeath=PLAYER_MODE_BASICUNARMED; // Player will then respawn into this mode m_lastModeBeforeDeath=PLAYER_MODE_BASICUNARMED; // Player will then respawn into this mode
m_lives++;respawn(); respawn();
m_canExitLevel=false; m_canExitLevel=false;
m_lives=CGameSlotManager::getSlotData()->m_lives;
m_lastPadInput=m_padInput=PI_NONE; m_lastPadInput=m_padInput=PI_NONE;
s_screenPos=128; s_screenPos=128;
@ -1535,10 +1533,13 @@ int CPlayer::getHeightFromGroundNoPlatform(int _x,int _y,int _maxHeight=32)
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CPlayer::addLife() void CPlayer::addLife()
{ {
m_lives++; CGameSlotManager::GameSlot *gameSlot;
if(m_lives>MAX_LIVES)
gameSlot=CGameSlotManager::getSlotData();
if(gameSlot->m_lives<MAX_LIVES)
{ {
m_lives=MAX_LIVES; gameSlot->m_lives++;
} }
} }
@ -1834,8 +1835,6 @@ void CPlayer::respawn()
updateCollisionArea(); updateCollisionArea();
m_lives--;
m_ignoreNewlyPressedButtonsOnPadThisThink=true; m_ignoreNewlyPressedButtonsOnPadThisThink=true;
} }
@ -2161,6 +2160,17 @@ void CPlayer::collectedQuestItem()
m_currentPlayerModeClass->setState(STATE_CELEBRATE); m_currentPlayerModeClass->setState(STATE_CELEBRATE);
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CPlayer::getLivesLeft()
{
return CGameSlotManager::getSlotData()->m_lives;
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -2174,6 +2184,10 @@ void CPlayer::dieYouPorousFreak(DEATH_TYPE _deathType)
m_deathType=_deathType; m_deathType=_deathType;
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_DEFEATED_JINGLE); CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_DEFEATED_JINGLE);
setMode(PLAYER_MODE_DEAD); setMode(PLAYER_MODE_DEAD);
// Take a life off..
CGameSlotManager::getSlotData()->m_lives--;
PAUL_DBGMSG("lives now %d",CGameSlotManager::getSlotData()->m_lives);
} }

View file

@ -299,7 +299,7 @@ public:
int getCanExitLevelNow() {return m_canExitLevel;} int getCanExitLevelNow() {return m_canExitLevel;}
void collectedQuestItem(); void collectedQuestItem();
int getLivesLeft() {return m_lives;} int getLivesLeft();
public: public:
@ -354,7 +354,6 @@ public:
DEATH_TYPE getDeathType() {return m_deathType;} DEATH_TYPE getDeathType() {return m_deathType;}
private: private:
int m_lives;
int m_numSpatulasHeld; int m_numSpatulasHeld;
int m_healthWaterLevel; int m_healthWaterLevel;
int m_helmetSoundTimer; // Timer for breathing sound when using the helmet int m_helmetSoundTimer; // Timer for breathing sound when using the helmet