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?
[STR__BACKEND__PRESS_START]
eng=PRESS START
[STR__BACKEND__CONTINUES_REMAINING]
eng=Continues:

View File

@ -26,8 +26,8 @@
#include "pad\pads.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#ifndef __MAP_MAP_H__
#include "map\map.h"
#endif
#ifndef __FRONTEND_FRONTEND_H__
@ -54,6 +54,10 @@
#include "locale\textdbase.h"
#endif
#ifndef __GAME_GAMESLOT_H__
#include "game\gameslot.h"
#endif
/* Std Lib
------- */
@ -108,7 +112,14 @@ void CGameOverScene::init()
initContinue();
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;
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;
}
else
@ -287,19 +300,19 @@ void CGameOverScene::thinkContinue(int _frames)
}
void CGameOverScene::renderContinue()
{
int yOfs;
char buf[100];
int yOfs;
char buf[100];
m_font->setColour(242/2,245/2,15/2);
yOfs=m_continueFontOffset>>2;
m_font->setColour(242/2,245/2,15/2);
yOfs=m_continueFontOffset>>2;
sprintf(buf,TranslationDatabase::getString(STR__BACKEND__CONTINUE));
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);
sprintf(buf,TranslationDatabase::getString(STR__BACKEND__CONTINUE));
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);
sprintf(buf,"%d",m_continueTimer/COUNTDOWN_TIME_SECOND_LENGTH);
m_font->setScale(CONTINUE_FONT_SCALE+CONTINUE_FONT_BASE_SIZE);
m_font->print(256,80-m_font->getStringHeight(buf)-yOfs,buf);
sprintf(buf,"%d",m_continueTimer/COUNTDOWN_TIME_SECOND_LENGTH);
m_font->setScale(CONTINUE_FONT_SCALE+CONTINUE_FONT_BASE_SIZE);
m_font->print(256,80-m_font->getStringHeight(buf)-yOfs,buf);
if(!CFader::isFading())
{
@ -310,6 +323,11 @@ void CGameOverScene::renderContinue()
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)
{
if(!m_finishedGrowingText)
if(!CFader::isFading())
{
m_gameOverTimer+=_frames;
}
else
{
if(!CFader::isFading()&&!m_readyToExit&&
PadGetDown(0)&(PAD_START|PAD_CROSS))
if(!m_finishedGrowingText)
{
m_readyToExit=true;
CFader::setFadingOut();
GameState::setNextScene(&FrontEndScene);
m_state=STATE__EXITING_TO_FRONT_END;
m_gameOverTimer+=_frames;
}
else
{
if(!m_readyToExit&&PadGetDown(0)&(PAD_START|PAD_CROSS))
{
m_readyToExit=true;
CFader::setFadingOut();
GameState::setNextScene(&FrontEndScene);
m_state=STATE__EXITING_TO_FRONT_END;
}
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -626,11 +626,9 @@ m_animFrame=0;
setFacing(FACING_RIGHT);
m_currentPlayerModeClass=NULL;
m_lastModeBeforeDeath=PLAYER_MODE_BASICUNARMED; // Player will then respawn into this mode
m_lives++;respawn();
respawn();
m_canExitLevel=false;
m_lives=CGameSlotManager::getSlotData()->m_lives;
m_lastPadInput=m_padInput=PI_NONE;
s_screenPos=128;
@ -1535,10 +1533,13 @@ int CPlayer::getHeightFromGroundNoPlatform(int _x,int _y,int _maxHeight=32)
---------------------------------------------------------------------- */
void CPlayer::addLife()
{
m_lives++;
if(m_lives>MAX_LIVES)
CGameSlotManager::GameSlot *gameSlot;
gameSlot=CGameSlotManager::getSlotData();
if(gameSlot->m_lives<MAX_LIVES)
{
m_lives=MAX_LIVES;
gameSlot->m_lives++;
}
}
@ -1834,8 +1835,6 @@ void CPlayer::respawn()
updateCollisionArea();
m_lives--;
m_ignoreNewlyPressedButtonsOnPadThisThink=true;
}
@ -2161,6 +2160,17 @@ void CPlayer::collectedQuestItem()
m_currentPlayerModeClass->setState(STATE_CELEBRATE);
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CPlayer::getLivesLeft()
{
return CGameSlotManager::getSlotData()->m_lives;
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -2174,6 +2184,10 @@ void CPlayer::dieYouPorousFreak(DEATH_TYPE _deathType)
m_deathType=_deathType;
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_DEFEATED_JINGLE);
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;}
void collectedQuestItem();
int getLivesLeft() {return m_lives;}
int getLivesLeft();
public:
@ -354,7 +354,6 @@ public:
DEATH_TYPE getDeathType() {return m_deathType;}
private:
int m_lives;
int m_numSpatulasHeld;
int m_healthWaterLevel;
int m_helmetSoundTimer; // Timer for breathing sound when using the helmet