SBSPSS/source/frontend/credits.cpp

253 lines
5.0 KiB
C++
Raw Normal View History

2001-01-04 18:10:13 +01:00
// PKG
// Temporay home of memcard stuff
// Controls:
// UP Save file ( this writes the save file to the memcard, must be done first time )
// DOWN Overwrite saved file
// LEFT Load saved file
2000-11-24 18:30:49 +01:00
/*=========================================================================
credits.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "frontend\credits.h"
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
#ifndef __LOCALE_TEXTDBASE_H__
#include "locale\textdbase.h"
#endif
#ifndef __GFX_FADER_H__
#include "gfx\fader.h"
#endif
#ifndef __PAD_PADS_H__
#include "pad\pads.h"
#endif
2000-11-27 18:28:36 +01:00
#ifndef _FILEIO_HEADER_
#include "fileio\fileio.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
2000-11-24 18:30:49 +01:00
/* Std Lib
------- */
/* Data
---- */
2001-04-20 16:53:35 +02:00
#ifndef __SPR_SPRITES_H__
#include <sprites.h>
2000-11-24 18:30:49 +01:00
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-01-16 16:45:01 +01:00
#ifdef __USER_paul__
2001-01-04 18:10:13 +01:00
#include "memcard\memcard.h"
#include "memcard\saveload.h"
2001-01-10 23:03:20 +01:00
CSaveLoadDatabase *sl;
2001-01-04 18:10:13 +01:00
enum{mode_none,mode_save,mode_load};
int mode=mode_none;
2001-01-15 23:02:25 +01:00
#endif
2000-11-24 18:30:49 +01:00
void CFrontEndCredits::init()
{
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndCredits::shutdown()
{
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2000-11-28 01:06:22 +01:00
static u8 *s_image;
2000-11-24 18:30:49 +01:00
void CFrontEndCredits::select()
{
2001-01-16 16:45:01 +01:00
#ifdef __USER_paul__
2001-01-04 18:10:13 +01:00
MemCard::Start();
2001-01-10 23:03:20 +01:00
sl=new ("sldb") CSaveLoadDatabase();
2001-01-04 18:10:13 +01:00
mode=mode_none;
2001-01-15 23:02:25 +01:00
#endif
2000-11-24 18:30:49 +01:00
m_shuttingDown=false;
2000-11-27 18:28:36 +01:00
s_image=CFileIO::loadFile(BACKDROP_CREDITS_GFX);
ASSERT(s_image);
SetScreenImage(s_image);
2000-11-24 18:30:49 +01:00
CFader::setFadingIn();
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndCredits::unselect()
{
2001-01-16 16:45:01 +01:00
#ifdef __USER_paul__
2001-01-04 18:10:13 +01:00
MemCard::Stop();
delete sl;
2001-01-15 23:02:25 +01:00
#endif
2000-11-27 18:28:36 +01:00
ClearScreenImage();
MemFree(s_image); s_image=NULL;
2000-11-24 18:30:49 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndCredits::render()
{
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndCredits::think(int _frames)
{
2001-01-16 16:45:01 +01:00
#ifdef __USER_paul__
2001-01-04 18:10:13 +01:00
sl->think();
if(mode==mode_none)
{
int pad=PadGetDown(0);
if(pad&PAD_UP)
{
PAUL_DBGMSG("startSave(\"blah\")");
sl->startSave("blah");
mode=mode_save;
}
else if(pad&PAD_DOWN)
{
PAUL_DBGMSG("startSave(\"blah\",0)");
sl->startSave("blah",0);
mode=mode_save;
}
else if(pad&PAD_LEFT)
{
PAUL_DBGMSG("startLoad(0)");
sl->startLoad(0);
mode=mode_load;
}
}
else if(mode==mode_save)
{
int status=sl->getSaveStatus();
2001-01-10 23:03:20 +01:00
if(status!=CSaveLoadDatabase::IN_PROGRESS)
2001-01-04 18:10:13 +01:00
{
2001-01-10 23:03:20 +01:00
if(status==CSaveLoadDatabase::FINISHED_OK)
2001-01-04 18:10:13 +01:00
{
MEMCARD_DBGMSG("saved ok");
}
else
{
MEMCARD_DBGMSG("not saved ok");
}
mode=mode_none;
}
}
else if(mode==mode_load)
{
int status=sl->getLoadStatus();
2001-01-10 23:03:20 +01:00
if(status!=CSaveLoadDatabase::IN_PROGRESS)
2001-01-04 18:10:13 +01:00
{
2001-01-10 23:03:20 +01:00
if(status==CSaveLoadDatabase::FINISHED_OK)
2001-01-04 18:10:13 +01:00
{
MEMCARD_DBGMSG("loaded ok");
}
else
{
MEMCARD_DBGMSG("not loaded ok");
}
mode=mode_none;
}
}
if(mode==mode_none)
2001-01-15 23:02:25 +01:00
#endif
2001-01-04 18:10:13 +01:00
if(!m_shuttingDown&&!CFader::isFading())
2000-11-24 18:30:49 +01:00
{
if(PadGetDown(0)&(PAD_CROSS|PAD_START))
{
m_shuttingDown=true;
CFader::setFadingOut();
}
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CFrontEndCredits::isReadyToExit()
{
return !CFader::isFading()&&m_shuttingDown;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
CFrontEndScene::FrontEndMode CFrontEndCredits::getNextMode()
{
return CFrontEndScene::MODE__MAIN_TITLES;
}
/*===========================================================================
end */