This commit is contained in:
Paul 2001-06-10 22:56:33 +00:00
parent a1b011dfaa
commit 0079e80562
6 changed files with 455 additions and 67 deletions

View File

@ -233,6 +233,27 @@ eng=RESTART LEVEL
; ---------------------------------------------------------------
; Slot select screen
; ---------------------------------------------------------------
[STR__SLOT_SELECT_SCREEN__LEFT_RIGHT_TO_SELECT_SLOT]
eng=Select slot
[STR__SLOT_SELECT_SCREEN__CROSS_TO_CONFIRM]
eng=Confirm
[STR__SLOT_SELECT_SCREEN__CROSS_TO_CREATE]
eng=Create
[STR__SLOT_SELECT_SCREEN__CIRCLE_TO_ERASE_SLOT]
eng=Erase slot
[STR__SLOT_SELECT_SCREEN__TRIANGLE_TO_EXIT]
eng=Exit
[STR__SLOT_SELECT_SCREEN__NEW_SLOT_CREATED]
eng=New slot created!
[STR__SLOT_SELECT_SCREEN__CONFIRM_ERASE_GAME]
eng=Are you sure that you want to erase this slot?
; ---------------------------------------------------------------
; Map screen
; ---------------------------------------------------------------

View File

@ -153,9 +153,6 @@ void CFrontEndScene::init()
m_exitToGame=false;
m_mode=MODE__NONE;
#if defined(__USER_art__) || defined(__USER_sbart__)
setMode(MODE__CHOOSE_SLOT);
#else
if(s_runOnce)
{
setMode(MODE__FMV_INTRO);
@ -165,7 +162,6 @@ void CFrontEndScene::init()
s_runOnce=true;
setMode(MODE__FMV_THQ);
}
#endif
m_sprites=new ("MainTitle Sprites") SpriteBank();
m_sprites->load(SPRITES_SPRITES_SPR);

View File

@ -372,7 +372,7 @@ CFrontEndScene::FrontEndMode CFrontEndMainTitles::getNextMode()
break;
case MODE__GOTO_CHOOSE_SLOT:
ret=CFrontEndScene::MODE__EXIT_TO_MAP;
ret=CFrontEndScene::MODE__CHOOSE_SLOT;
break;
case MODE__GOTO_OPTIONS:

View File

@ -18,6 +18,10 @@
#include "frontend\start.h"
#ifndef __GFX_FONT_H__
#include "gfx\font.h"
#endif
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
@ -42,6 +46,26 @@
#include "gui\gframe.h"
#endif
#ifndef __GUI_GTEXTBOX_H__
#include "gui\gtextbox.h"
#endif
#ifndef __GAME_GAMESLOT_H__
#include "game\gameslot.h"
#endif
#ifndef __PAD_PADS_H__
#include "pad\pads.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
#ifndef __SOUND_SOUND_H__
#include "sound\sound.h"
#endif
/* Std Lib
------- */
@ -53,6 +77,10 @@
#include <sprites.h>
#endif
#ifndef __SPR_SHOP_H__
#include <shop.h>
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
@ -70,23 +98,6 @@
Vars
---- */
int CFrontEndStart::s_levelValues[]=
{
0,48,96,144,192,240,
-1,
};
CGUITextReadout::TextReadoutData CFrontEndStart::s_levelReadoutText[]=
{
{ 0, STR__DEBUG__LEVEL_SELECT_C1 },
{ 48, STR__DEBUG__LEVEL_SELECT_C2 },
{ 96, STR__DEBUG__LEVEL_SELECT_C3 },
{ 144, STR__DEBUG__LEVEL_SELECT_C4 },
{ 192, STR__DEBUG__LEVEL_SELECT_C5 },
{ 240, STR__DEBUG__LEVEL_SELECT_C6 },
};
extern int s_globalLevelSelectThing;
/*----------------------------------------------------------------------
Function:
@ -94,21 +105,50 @@ extern int s_globalLevelSelectThing;
Params:
Returns:
---------------------------------------------------------------------- */
int result;
void CFrontEndStart::init()
{
m_guiFrame=new ("optionsframe") CGUIControlFrame();
m_guiFrame->init(NULL);
m_guiFrame->setObjectXYWH((512-352)/2,50,352,96);
CGUITextBox *tb;
CGUIFactory::createCycleButtonFrame(m_guiFrame,
10,10,332,40,
STR__DEBUG__LEVEL_SELECT,
&m_level,s_levelValues,s_levelReadoutText);
CGUIFactory::createValueButtonFrame(m_guiFrame,
10,50,332,40,
STR__DEBUG__LEVEL_SELECT_START,
&m_startGame,true);
m_emptyGuiFrame=new ("Frame") CGUIGroupFrame();
m_emptyGuiFrame->init(NULL);
m_emptyGuiFrame->setObjectXYWH((512-416)/2,130,416,96);
m_emptyGuiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER);
m_confirmEraseGuiFrame=new ("Frame") CGUIControlFrame();
m_confirmEraseGuiFrame->init(NULL);
m_confirmEraseGuiFrame->setObjectXYWH((512-416)/2,130,416,96);
CGUIFactory::createValueButtonFrame(m_confirmEraseGuiFrame,
8,55,400,20,
STR__NO,&m_confirmFlag,CONFIRM_NO);
CGUIFactory::createValueButtonFrame(m_confirmEraseGuiFrame,
8,70,400,20,
STR__YES,&m_confirmFlag,CONFIRM_YES);
tb=new ("textbox") CGUITextBox();
tb->init(m_confirmEraseGuiFrame);
tb->setObjectXYWH(8,5,400,35);
tb->setText(STR__SLOT_SELECT_SCREEN__CONFIRM_ERASE_GAME);
m_createdSlotGuiFrame=new ("Frame") CGUIControlFrame();
m_createdSlotGuiFrame->init(NULL);
m_createdSlotGuiFrame->setObjectXYWH((512-416)/2,130,416,96);
CGUIFactory::createValueButtonFrame(m_createdSlotGuiFrame,
8,55,400,20,
STR__OK,&m_confirmFlag,CONFIRM_OK);
tb=new ("textbox") CGUITextBox();
tb->init(m_createdSlotGuiFrame);
tb->setObjectXYWH(8,5,400,35);
tb->setText(STR__SLOT_SELECT_SCREEN__NEW_SLOT_CREATED);
m_font=new ("ChooseSlotFont") FontBank();
m_font->initialise(&standardFont);
m_font->setJustification(FontBank::JUST_LEFT);
m_font->setOt(3);
m_font->setPrintArea(0,0,712,256);
m_spriteBank=new ("PartItemSprites") SpriteBank();
m_spriteBank->load(SHOP_SHOP_SPR);
}
/*----------------------------------------------------------------------
@ -119,7 +159,12 @@ void CFrontEndStart::init()
---------------------------------------------------------------------- */
void CFrontEndStart::shutdown()
{
m_guiFrame->shutdown();
m_spriteBank->dump(); delete m_spriteBank;
m_font->dump(); delete m_font;
m_createdSlotGuiFrame->shutdown();
m_confirmEraseGuiFrame->shutdown();
m_emptyGuiFrame->shutdown();
}
/*----------------------------------------------------------------------
@ -130,12 +175,11 @@ void CFrontEndStart::shutdown()
---------------------------------------------------------------------- */
void CFrontEndStart::select()
{
m_guiFrame->select();
m_shuttingDown=false;
m_selectedSlot=NO_SLOT_SELECTED;
m_escapeToTitles=false;
CFader::setFadingIn();
m_startGame=false;
m_state=STATE_SELECT;
m_selectedSlot=0;
m_slotDrawOffset=0;
}
/*----------------------------------------------------------------------
@ -146,7 +190,6 @@ void CFrontEndStart::select()
---------------------------------------------------------------------- */
void CFrontEndStart::unselect()
{
m_guiFrame->unselect();
}
/*----------------------------------------------------------------------
@ -155,23 +198,220 @@ void CFrontEndStart::unselect()
Params:
Returns:
---------------------------------------------------------------------- */
typedef struct
{
int x,y,w,h;
int levelx,levely;
int itemx,itemy,itemgap;
int tokenx,tokeny;
int emptyslotx,emptysloty;
}SLOTDATA;
SLOTDATA slotdata=
{
(512-416)/2,30,416,64, // x,y,w,h
15,5, // levelx,levely
16,25,50, // itemx,itemy,itemgap
250,5, // tokenx,tokeny
416/2,15, // emptyslotx,emptysloty
};
static const int s_itemFrames[]=
{
FRM_BLOWER, // SHOPITEM_BLOWER
FRM_CAKE, // SHOPITEM_CAKE
FRM_CUPCAKE, // SHOPITEM_CUPCAKE
FRM_JELLY2, // SHOPITEM_JELLY2
FRM_PARTYHAT, // SHOPITEM_PARTYHAT
FRM_PREZZIE, // SHOPITEM_PREZZIE
FRM_SARNIE, // SHOPITEM_SARNIE
FRM_TEDDY, // SHOPITEM_TEDDY
};
void CFrontEndStart::render()
{
POLY_G4 *g4;
g4=GetPrimG4();
setXYWH(g4,0,0,512,256);
setRGB0(g4,50, 0, 0);
setRGB1(g4, 0, 0,50);
setRGB2(g4, 0,50, 0);
setRGB3(g4,50, 0,50);
setRGB0(g4, 0,150, 50);
setRGB1(g4, 0,150, 50);
setRGB2(g4,150, 50, 0);
setRGB3(g4,150, 50, 0);
AddPrimToList(g4,MAX_OT-1);
#if 0
m_guiFrame->render();
drawGameSlot(m_slotDrawOffset,m_selectedSlot);
if(m_slotDrawOffset)
{
int ofs;
ofs=m_slotDrawOffset<0?512:-512;
drawGameSlot(ofs+m_slotDrawOffset,m_lastSelectedSlot);
}
switch(m_state)
{
case STATE_SELECT:
m_emptyGuiFrame->render();
if(!m_slotDrawOffset)
{
drawInstructions();
}
break;
case STATE_CONFIRM_ERASE:
m_confirmEraseGuiFrame->render();
break;
case STATE_EXITING_TO_FRONT_END:
case STATE_EXITING_TO_GAME:
m_emptyGuiFrame->render();
break;
case STATE_SLOT_CREATED:
m_createdSlotGuiFrame->render();
break;
}
#ifdef __USER_paul__
char buf[100];
sprintf(buf,"slot %d",m_selectedSlot);
m_font->print(65,7,buf);
#endif
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndStart::drawGameSlot(int _xOff,int _slotNumber)
{
int xbase;
CGameSlotManager::GameSlot *gameSlot;
POLY_F4 *f4;
int x,y;
sFrameHdr *fh;
char buf[100];
int i;
xbase=_xOff+slotdata.x;
CGameSlotManager::setActiveSlot(_slotNumber);
gameSlot=CGameSlotManager::getSlotData();
drawBambooBorder(xbase,slotdata.y,slotdata.w,slotdata.h,3);
f4=GetPrimF4();
setXYWH(f4,xbase,slotdata.y,slotdata.w,slotdata.h);
setRGB0(f4, 0, 0, 90);
setSemiTrans(f4,true);
AddPrimToList(f4,3);
if(gameSlot->m_isInUse)
{
m_font->print(xbase+slotdata.levelx,slotdata.y+slotdata.levely,"Level 0-0");
x=xbase+slotdata.tokenx;
y=slotdata.y+slotdata.tokeny;
fh=m_spriteBank->getFrameHeader(FRM_SMALLTOKEN);
m_spriteBank->printFT4(fh,x,y,0,0,2);
x+=fh->W;
sprintf(buf,"x%d",CGameSlotManager::getSlotData()->getNumberOfKelpTokensHeld());
m_font->print(x,y,buf);
x=xbase+slotdata.itemx;
y=slotdata.y+slotdata.itemy;
for(i=0;i<8;i++)
{
POLY_FT4 *ft4;
ft4=m_spriteBank->printFT4(s_itemFrames[i],x,y,0,0,2);
if(!gameSlot->isPartyItemHeld(i))
{
setRGB0(ft4,35,35,35);
}
x+=slotdata.itemgap;
}
}
else
{
m_font->setJustification(FontBank::JUST_CENTRE);
m_font->print(xbase+slotdata.emptyslotx,slotdata.y+slotdata.emptysloty,"EMPTY SLOT");
m_font->setJustification(FontBank::JUST_LEFT);
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int MAP_INSTRUCTIONS_YSTART=147;
int MAP_INSTRUCTIONS_BUTTON_Y_OFFSET=3;
int MAP_INSTRUCTIONS_TEXT_R=128;
int MAP_INSTRUCTIONS_TEXT_G=64;
int MAP_INSTRUCTIONS_TEXT_B=64;
int MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS=5;
int MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT=10;
int MAP_INSTRUCTIONS_Y_SPACE_BETWEEN_LINES=15;
void CFrontEndStart::drawInstructions()
{
int slotInUse;
SpriteBank *sb;
sFrameHdr *fh1,*fh2;
int width;
int x,y;
int text;
CGameSlotManager::setActiveSlot(m_selectedSlot);
slotInUse=CGameSlotManager::getSlotData()->m_isInUse;
sb=CGameScene::getSpriteBank();
m_font->setColour(255,255,255);
y=MAP_INSTRUCTIONS_YSTART;
fh1=sb->getFrameHeader(FRM__BUTL);
fh2=sb->getFrameHeader(FRM__BUTR);
width=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS+fh2->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT+m_font->getStringWidth(STR__SLOT_SELECT_SCREEN__LEFT_RIGHT_TO_SELECT_SLOT);
x=256-(width/2);
sb->printFT4(fh1,x,y+MAP_INSTRUCTIONS_BUTTON_Y_OFFSET,0,0,0);
x+=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS;
sb->printFT4(fh2,x,y+MAP_INSTRUCTIONS_BUTTON_Y_OFFSET,0,0,0);
x+=fh2->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT;
m_font->print(x,y,STR__SLOT_SELECT_SCREEN__LEFT_RIGHT_TO_SELECT_SLOT);
text=slotInUse?STR__SLOT_SELECT_SCREEN__CROSS_TO_CONFIRM:STR__SLOT_SELECT_SCREEN__CROSS_TO_CREATE;
y+=MAP_INSTRUCTIONS_Y_SPACE_BETWEEN_LINES;
fh1=sb->getFrameHeader(FRM__BUTX);
width=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT+m_font->getStringWidth(text);
x=256-(width/2);
sb->printFT4(fh1,x,y+MAP_INSTRUCTIONS_BUTTON_Y_OFFSET,0,0,0);
x+=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT;
m_font->print(x,y,text);
y+=MAP_INSTRUCTIONS_Y_SPACE_BETWEEN_LINES;
fh1=sb->getFrameHeader(FRM__BUTC);
width=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT+m_font->getStringWidth(STR__SLOT_SELECT_SCREEN__CIRCLE_TO_ERASE_SLOT);
x=256-(width/2);
if(slotInUse)
{
sb->printFT4(fh1,x,y+MAP_INSTRUCTIONS_BUTTON_Y_OFFSET,0,0,0);
}
x+=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT;
if(slotInUse)
{
m_font->print(x,y,STR__SLOT_SELECT_SCREEN__CIRCLE_TO_ERASE_SLOT);
}
y+=MAP_INSTRUCTIONS_Y_SPACE_BETWEEN_LINES;
fh1=sb->getFrameHeader(FRM__BUTT);
width=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT+m_font->getStringWidth(STR__SLOT_SELECT_SCREEN__TRIANGLE_TO_EXIT);
x=256-(width/2);
sb->printFT4(fh1,x,y+MAP_INSTRUCTIONS_BUTTON_Y_OFFSET,0,0,0);
x+=fh1->W+MAP_INSTRUCTIONS_GAP_BETWEEN_BUTTONS_AND_TEXT;
m_font->print(x,y,STR__SLOT_SELECT_SCREEN__TRIANGLE_TO_EXIT);
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -180,25 +420,133 @@ void CFrontEndStart::render()
---------------------------------------------------------------------- */
void CFrontEndStart::think(int _frames)
{
#if 0
if(!CFader::isFading())
{
m_guiFrame->think(_frames);
}
if(!m_shuttingDown)
if(m_slotDrawOffset==0)
{
if(/*m_selectedSlot!=NO_SLOT_SELECTED||
m_escapeToTitles||*/
m_startGame)
if(m_state==STATE_SELECT)
{
// Select a slot
int pad=PadGetDown(0);
if(pad&PAD_LEFT)
{
m_lastSelectedSlot=m_selectedSlot;
if(--m_selectedSlot<0)
{
m_selectedSlot=CGameSlotManager::NUM_GAME_SLOTS-1;
}
m_slotDrawOffset=-500;
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
}
else if(pad&PAD_RIGHT)
{
m_lastSelectedSlot=m_selectedSlot;
if(++m_selectedSlot>=CGameSlotManager::NUM_GAME_SLOTS)
{
m_selectedSlot=0;
}
m_slotDrawOffset=+500;
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__MOVE_CURSOR);
}
else if(pad&PAD_CROSS)
{
CGameSlotManager::GameSlot *gameSlot;
CGameSlotManager::setActiveSlot(m_selectedSlot);
gameSlot=CGameSlotManager::getSlotData();
if(gameSlot->m_isInUse)
{
m_state=STATE_EXITING_TO_GAME;
CFader::setFadingOut();
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK);
}
else
{
m_state=STATE_SLOT_CREATED;
m_createdSlotGuiFrame->select();
gameSlot->m_isInUse=true;
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK);
}
}
else if(pad&PAD_CIRCLE)
{
CGameSlotManager::GameSlot *gameSlot;
CGameSlotManager::setActiveSlot(m_selectedSlot);
gameSlot=CGameSlotManager::getSlotData();
if(gameSlot->m_isInUse)
{
m_state=STATE_CONFIRM_ERASE;
m_confirmFlag=CONFIRM_NONE;
m_confirmEraseGuiFrame->select();
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK);
}
}
else if(pad&PAD_TRIANGLE)
{
m_state=STATE_EXITING_TO_FRONT_END;
CFader::setFadingOut();
CSoundMediator::playSfx(CSoundMediator::SFX_FRONT_END__OK);
}
m_emptyGuiFrame->think(_frames);
}
else if(m_state==STATE_SLOT_CREATED)
{
m_createdSlotGuiFrame->think(_frames);
if(m_confirmFlag==CONFIRM_OK)
{
m_createdSlotGuiFrame->unselect();
m_state=STATE_SELECT;
}
}
else if(m_state==STATE_CONFIRM_ERASE)
{
m_confirmEraseGuiFrame->think(_frames);
if(m_confirmFlag==CONFIRM_YES)
{
CGameSlotManager::eraseGameSlot(m_selectedSlot);
m_state=STATE_SELECT;
m_confirmEraseGuiFrame->unselect();
}
else if(m_confirmFlag==CONFIRM_NO)
{
m_state=STATE_SELECT;
m_confirmEraseGuiFrame->unselect();
}
}
}
else
{
// Slide the slot boxes about..
for(int i=0;i<_frames;i++)
{
int delta=m_slotDrawOffset/3;
if(m_slotDrawOffset<0)
{
if(!delta)delta=-1;
}
else if(m_slotDrawOffset>0)
{
if(!delta)delta=+1;
}
else
{
break;
}
m_slotDrawOffset-=delta;
}
}
}
/*
if(!m_shuttingDown)
{
if(/m_selectedSlot!=NO_SLOT_SELECTED||
m_escapeToTitles||/
{
m_shuttingDown=true;
s_globalLevelSelectThing=m_level;
CFader::setFadingOut();
}
}
#endif
*/
}
/*----------------------------------------------------------------------
@ -209,7 +557,7 @@ void CFrontEndStart::think(int _frames)
---------------------------------------------------------------------- */
int CFrontEndStart::isReadyToExit()
{
return !CFader::isFading();
return !CFader::isFading()&&(m_state==STATE_EXITING_TO_FRONT_END||m_state==STATE_EXITING_TO_GAME);
}
/*----------------------------------------------------------------------
@ -220,7 +568,7 @@ int CFrontEndStart::isReadyToExit()
---------------------------------------------------------------------- */
CFrontEndScene::FrontEndMode CFrontEndStart::getNextMode()
{
return CFrontEndScene::MODE__EXIT_TO_MAP;
return m_state==STATE_EXITING_TO_GAME?CFrontEndScene::MODE__EXIT_TO_MAP:CFrontEndScene::MODE__MAIN_TITLES;
}
/*===========================================================================

View File

@ -53,21 +53,42 @@ public:
private:
typedef enum
{
STATE_SELECT,
STATE_CONFIRM_ERASE,
STATE_EXITING_TO_FRONT_END,
STATE_EXITING_TO_GAME,
STATE_SLOT_CREATED,
}STATE;
void drawGameSlot(int _xOff,int _slotNumber);
void drawInstructions();
STATE m_state;
int m_selectedSlot,m_lastSelectedSlot;
int m_slotDrawOffset;
class CGUIGroupFrame *m_emptyGuiFrame;
class CGUIControlFrame *m_confirmEraseGuiFrame;
class CGUIControlFrame *m_createdSlotGuiFrame;
enum
{
NO_SLOT_SELECTED=-1,
CONFIRM_NONE=0,
CONFIRM_OK=1,
CONFIRM_YES=1,
CONFIRM_NO,
};
int m_confirmFlag;
int m_selectedSlot;
int m_escapeToTitles;
int m_shuttingDown;
class CGUIControlFrame *m_guiFrame;
int m_level;
static int s_levelValues[];
static CGUITextReadout::TextReadoutData s_levelReadoutText[];
int m_startGame;
class SpriteBank *m_spriteBank;
class FontBank *m_font;
};

View File

@ -65,6 +65,9 @@ void CGameSlotManager::init()
}
setActiveSlot(0);
#ifdef __VERSION_DEBUG__
s_gameSlots[0].m_isInUse=true;
#endif
}
@ -78,7 +81,6 @@ void CGameSlotManager::setActiveSlot(unsigned int _slot)
{
ASSERT(_slot<=NUM_GAME_SLOTS);
s_currentGameSlot=&s_gameSlots[_slot];
s_currentGameSlot->m_isInUse=true;
}