This commit is contained in:
Paul 2001-07-11 16:15:44 +00:00
parent a295c8f0d9
commit 1af72054fa
3 changed files with 76 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 384 KiB

View File

@ -58,6 +58,14 @@
#include "game\gameslot.h" #include "game\gameslot.h"
#endif #endif
#ifndef __ACTOR_HEADER__
#include "gfx\actor.h"
#endif
#ifndef __SOUND_SOUND_H__
#include "sound\sound.h"
#endif
/* Std Lib /* Std Lib
------- */ ------- */
@ -69,6 +77,10 @@
#include <trans.h> #include <trans.h>
#endif #endif
#ifndef __ANIM_PATRICK_HEADER__
#include <actor_patrick_anim.h>
#endif
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Tyepdefs && Defines Tyepdefs && Defines
@ -106,6 +118,12 @@ void CGameOverScene::init()
m_font->setJustification(ScalableFontBank::JUST_CENTRE); m_font->setJustification(ScalableFontBank::JUST_CENTRE);
m_font->setOt(5); m_font->setOt(5);
CActorPool::Reset();
m_patrickGfx=CActorPool::GetActor(ACTORS_PATRICK_SBK);
m_animFrame=0;
CActorPool::SetUpCache();
CActorPool::CleanUpCache();
m_readyToExit=false; m_readyToExit=false;
CFader::setFadingIn(); CFader::setFadingIn();
@ -120,6 +138,9 @@ void CGameOverScene::init()
{ {
m_state=STATE__GAME_OVER; m_state=STATE__GAME_OVER;
} }
m_hasPlayedFirstSpeech=false;
m_hasPlayedSecondSpeech=false;
} }
@ -131,6 +152,9 @@ void CGameOverScene::init()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CGameOverScene::shutdown() void CGameOverScene::shutdown()
{ {
delete m_patrickGfx;
CActorPool::Reset();
m_font->dump(); delete m_font; m_font->dump(); delete m_font;
MemFree(m_image); MemFree(m_image);
@ -154,16 +178,22 @@ void CGameOverScene::render()
renderContinue(); renderContinue();
renderGameOver(); renderGameOver();
break; break;
case STATE__SPEECH_BEFORE_EXITING_TO_GAME:
renderContinue();
break;
case STATE__GAME_OVER: case STATE__GAME_OVER:
renderGameOver(); renderGameOver();
break; break;
case STATE__EXITING_TO_GAME: case STATE__EXITING_TO_GAME:
renderContinue(); renderContinue();
break;
case STATE__EXITING_TO_FRONT_END: case STATE__EXITING_TO_FRONT_END:
renderGameOver(); renderGameOver();
break; break;
} }
DVECTOR ppos={255,210};
m_patrickGfx->Render(ppos,0,m_animFrame);
CActorPool::CleanUpCache();
} }
@ -175,6 +205,11 @@ void CGameOverScene::render()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CGameOverScene::think(int _frames) void CGameOverScene::think(int _frames)
{ {
int animLength;
m_animFrame+=_frames;
animLength=m_patrickGfx->getFrameCount(0);
while(m_animFrame>=animLength)m_animFrame-=animLength;
switch(m_state) switch(m_state)
{ {
case STATE__CONTINUE: case STATE__CONTINUE:
@ -187,6 +222,9 @@ void CGameOverScene::think(int _frames)
case STATE__GAME_OVER: case STATE__GAME_OVER:
thinkGameOver(_frames); thinkGameOver(_frames);
break; break;
case STATE__SPEECH_BEFORE_EXITING_TO_GAME:
thinkContinue(_frames);
break;
case STATE__EXITING_TO_GAME: case STATE__EXITING_TO_GAME:
thinkContinue(_frames); thinkContinue(_frames);
break; break;
@ -229,6 +267,13 @@ void CGameOverScene::thinkContinue(int _frames)
{ {
if(!CFader::isFading()) if(!CFader::isFading())
{ {
if(!m_hasPlayedFirstSpeech)
{
CSoundMediator::playSpeech(SPEECH_085);
PAUL_DBGMSG("WHERE IS EVERYBODY?");
m_hasPlayedFirstSpeech=true;
}
if(m_continueFontOffset) if(m_continueFontOffset)
{ {
move=m_continueFontOffset/10; move=m_continueFontOffset/10;
@ -254,12 +299,12 @@ void CGameOverScene::thinkContinue(int _frames)
} }
else if(pad&PAD_START) else if(pad&PAD_START)
{ {
m_readyToExit=true; // m_readyToExit=true;
CFader::setFadingOut(); // CFader::setFadingOut();
GameState::setNextScene(&MapScene); // GameState::setNextScene(&MapScene);
CGameSlotManager::getSlotData()->m_lives=CGameSlotManager::INITIAL_LIVES; // CGameSlotManager::getSlotData()->m_lives=CGameSlotManager::INITIAL_LIVES;
CGameSlotManager::getSlotData()->m_continues--; // CGameSlotManager::getSlotData()->m_continues--;
m_state=STATE__EXITING_TO_GAME; m_state=STATE__SPEECH_BEFORE_EXITING_TO_GAME;
} }
else else
{ {
@ -275,8 +320,15 @@ void CGameOverScene::thinkContinue(int _frames)
} }
} }
} }
else if(m_state==STATE__CONTINUE_TIMED_OUT||STATE__EXITING_TO_GAME) else if(m_state==STATE__SPEECH_BEFORE_EXITING_TO_GAME||m_state==STATE__CONTINUE_TIMED_OUT||STATE__EXITING_TO_GAME)
{ {
if(m_state==STATE__SPEECH_BEFORE_EXITING_TO_GAME&&!m_hasPlayedSecondSpeech)
{
CSoundMediator::playSpeech(SPEECH_086);
PAUL_DBGMSG("LETS TRY AGAIN!");
m_hasPlayedSecondSpeech=true;
}
// Slide text back off the screen // Slide text back off the screen
m_continueFontOffset=(100<<2)-m_continueFontOffset; m_continueFontOffset=(100<<2)-m_continueFontOffset;
move=m_continueFontOffset/10; move=m_continueFontOffset/10;
@ -287,6 +339,15 @@ void CGameOverScene::thinkContinue(int _frames)
m_continueFontOffset-=move; m_continueFontOffset-=move;
if(m_continueFontOffset<0) if(m_continueFontOffset<0)
{ {
if(m_state==STATE__SPEECH_BEFORE_EXITING_TO_GAME)
{
m_readyToExit=true;
CFader::setFadingOut();
GameState::setNextScene(&MapScene);
CGameSlotManager::getSlotData()->m_lives=CGameSlotManager::INITIAL_LIVES;
CGameSlotManager::getSlotData()->m_continues--;
m_state=STATE__EXITING_TO_GAME;
}
if(m_state==STATE__CONTINUE_TIMED_OUT) if(m_state==STATE__CONTINUE_TIMED_OUT)
{ {
m_state=STATE__GAME_OVER; m_state=STATE__GAME_OVER;

View File

@ -51,6 +51,7 @@ private:
STATE__CONTINUE, STATE__CONTINUE,
STATE__CONTINUE_TIMED_OUT, STATE__CONTINUE_TIMED_OUT,
STATE__GAME_OVER, STATE__GAME_OVER,
STATE__SPEECH_BEFORE_EXITING_TO_GAME,
STATE__EXITING_TO_GAME, STATE__EXITING_TO_GAME,
STATE__EXITING_TO_FRONT_END, STATE__EXITING_TO_FRONT_END,
} GAMEOVER_STATE; } GAMEOVER_STATE;
@ -91,6 +92,12 @@ private:
int m_readyToExit; int m_readyToExit;
unsigned char *m_image; unsigned char *m_image;
int m_hasPlayedFirstSpeech;
int m_hasPlayedSecondSpeech;
class CActorGfx *m_patrickGfx;
int m_animFrame;
}; };