This commit is contained in:
parent
ecad098615
commit
e59dac8580
8 changed files with 84 additions and 42 deletions
|
@ -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:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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,7 +112,14 @@ void CGameOverScene::init()
|
||||||
initContinue();
|
initContinue();
|
||||||
initGameOver();
|
initGameOver();
|
||||||
|
|
||||||
m_state=STATE__CONTINUE;
|
if(CGameSlotManager::getSlotData()->m_continues>=1)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
@ -287,19 +300,19 @@ void CGameOverScene::thinkContinue(int _frames)
|
||||||
}
|
}
|
||||||
void CGameOverScene::renderContinue()
|
void CGameOverScene::renderContinue()
|
||||||
{
|
{
|
||||||
int yOfs;
|
int yOfs;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
|
|
||||||
m_font->setColour(242/2,245/2,15/2);
|
m_font->setColour(242/2,245/2,15/2);
|
||||||
yOfs=m_continueFontOffset>>2;
|
yOfs=m_continueFontOffset>>2;
|
||||||
|
|
||||||
sprintf(buf,TranslationDatabase::getString(STR__BACKEND__CONTINUE));
|
sprintf(buf,TranslationDatabase::getString(STR__BACKEND__CONTINUE));
|
||||||
m_font->setScale(((msin(m_continueFontSin)*CONTINUE_FONT_SCALE)>>12)+CONTINUE_FONT_BASE_SIZE);
|
m_font->setScale(((msin(m_continueFontSin)*CONTINUE_FONT_SCALE)>>12)+CONTINUE_FONT_BASE_SIZE);
|
||||||
m_font->print(256,50-m_font->getStringHeight(buf)-yOfs,buf);
|
m_font->print(256,50-m_font->getStringHeight(buf)-yOfs,buf);
|
||||||
|
|
||||||
sprintf(buf,"%d",m_continueTimer/COUNTDOWN_TIME_SECOND_LENGTH);
|
sprintf(buf,"%d",m_continueTimer/COUNTDOWN_TIME_SECOND_LENGTH);
|
||||||
m_font->setScale(CONTINUE_FONT_SCALE+CONTINUE_FONT_BASE_SIZE);
|
m_font->setScale(CONTINUE_FONT_SCALE+CONTINUE_FONT_BASE_SIZE);
|
||||||
m_font->print(256,80-m_font->getStringHeight(buf)-yOfs,buf);
|
m_font->print(256,80-m_font->getStringHeight(buf)-yOfs,buf);
|
||||||
|
|
||||||
if(!CFader::isFading())
|
if(!CFader::isFading())
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,19 +344,21 @@ void CGameOverScene::initGameOver()
|
||||||
}
|
}
|
||||||
void CGameOverScene::thinkGameOver(int _frames)
|
void CGameOverScene::thinkGameOver(int _frames)
|
||||||
{
|
{
|
||||||
if(!m_finishedGrowingText)
|
if(!CFader::isFading())
|
||||||
{
|
{
|
||||||
m_gameOverTimer+=_frames;
|
if(!m_finishedGrowingText)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!CFader::isFading()&&!m_readyToExit&&
|
|
||||||
PadGetDown(0)&(PAD_START|PAD_CROSS))
|
|
||||||
{
|
{
|
||||||
m_readyToExit=true;
|
m_gameOverTimer+=_frames;
|
||||||
CFader::setFadingOut();
|
}
|
||||||
GameState::setNextScene(&FrontEndScene);
|
else
|
||||||
m_state=STATE__EXITING_TO_FRONT_END;
|
{
|
||||||
|
if(!m_readyToExit&&PadGetDown(0)&(PAD_START|PAD_CROSS))
|
||||||
|
{
|
||||||
|
m_readyToExit=true;
|
||||||
|
CFader::setFadingOut();
|
||||||
|
GameState::setNextScene(&FrontEndScene);
|
||||||
|
m_state=STATE__EXITING_TO_FRONT_END;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SAVELOAD_HEADERID=0,
|
SAVELOAD_HEADERID=1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue