2001-06-09 22:35:28 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
party.cpp
|
2001-06-09 22:35:28 +02:00
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
#include "backend\party.h"
|
2001-06-09 22:35:28 +02:00
|
|
|
|
|
|
|
#ifndef __PAD_PADS_H__
|
|
|
|
#include "pad\pads.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GAME_GAME_H__
|
|
|
|
#include "game\game.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __FRONTEND_FRONTEND_H__
|
|
|
|
#include "frontend\frontend.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GFX_FADER_H__
|
|
|
|
#include "gfx\fader.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _FILEIO_HEADER_
|
|
|
|
#include "fileio\fileio.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __VID_HEADER_
|
|
|
|
#include "system\vid.h"
|
|
|
|
#endif
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
#ifndef __SHOP_SHOP_H__
|
|
|
|
#include "shop\shop.h"
|
2001-06-09 22:35:28 +02:00
|
|
|
#endif
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
#ifndef __GFX_SPRBANK_H__
|
|
|
|
#include "gfx\sprbank.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __ACTOR_HEADER__
|
|
|
|
#include "gfx\actor.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __FRONTEND_FRONTEND_H__
|
|
|
|
#include "frontend\frontend.h"
|
2001-06-09 22:35:28 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
|
|
|
#ifndef __STRING_ENUMS__
|
|
|
|
#include <trans.h>
|
|
|
|
#endif
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
#ifndef __SPR_PARTY_H__
|
|
|
|
#include <party.h>
|
|
|
|
#endif
|
|
|
|
|
2001-06-09 22:35:28 +02:00
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
CPartyScene PartyScene;
|
|
|
|
|
|
|
|
CActorGfx *m_actorSpongebob;
|
|
|
|
CActorGfx *m_actorPatrick;
|
2001-06-09 22:35:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-06-10 19:07:06 +02:00
|
|
|
void CPartyScene::init()
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
m_image=CFileIO::loadFile(BACKDROP_PARTYBACKDROP_GFX);
|
2001-06-09 22:35:28 +02:00
|
|
|
ASSERT(m_image);
|
|
|
|
SetScreenImage((u8*)m_image);
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
// m_font=new ("game over font") ScalableFontBank();
|
|
|
|
// m_font->initialise(&standardFont);
|
|
|
|
// m_font->setJustification(ScalableFontBank::JUST_CENTRE);
|
|
|
|
// m_font->setOt(5);
|
|
|
|
|
|
|
|
m_sprites=new ("Party sprites") SpriteBank();
|
|
|
|
m_sprites->load(PARTY_PARTY_SPR);
|
2001-06-09 22:35:28 +02:00
|
|
|
|
|
|
|
m_readyToExit=false;
|
|
|
|
CFader::setFadingIn(CFader::BLACK_FADE);
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
CActorPool::Reset();
|
|
|
|
m_actorSpongebob=CActorPool::GetActor(ACTORS_SPONGEBOB_SBK);
|
|
|
|
m_actorSpongebob->SetOtPos(5);
|
|
|
|
m_actorPatrick=CActorPool::GetActor(ACTORS_PATRICK_SBK);
|
|
|
|
m_actorPatrick->SetOtPos(5);
|
2001-06-09 22:35:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-06-10 19:07:06 +02:00
|
|
|
void CPartyScene::shutdown()
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
delete m_actorPatrick;
|
|
|
|
delete m_actorSpongebob;
|
|
|
|
CActorPool::Reset();
|
|
|
|
|
|
|
|
m_sprites->dump(); delete m_sprites;
|
|
|
|
// m_font->dump(); delete m_font;
|
2001-06-09 22:35:28 +02:00
|
|
|
|
|
|
|
MemFree(m_image);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-06-10 19:07:06 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CShopScene::SHOPITEM_ID m_itemId;
|
|
|
|
int m_fh;
|
|
|
|
u8 m_xOffsetBroken,m_yOffsetBroken;
|
|
|
|
u8 m_ot;
|
|
|
|
}PARTY_IMAGE;
|
|
|
|
static PARTY_IMAGE images[]=
|
|
|
|
{
|
|
|
|
{ CShopScene::SHOPITEM_BLOWER, FRM_BALLOON1, 0,0, 2 },
|
|
|
|
{ CShopScene::SHOPITEM_BLOWER, FRM_BALLOON2, 1,0, 2 },
|
|
|
|
|
|
|
|
{ CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER1, 0,0, 1 },
|
|
|
|
{ CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER2, 0,0, 1 },
|
|
|
|
{ CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER3, 1,0, 1 },
|
|
|
|
{ CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER4, 1,0, 1 },
|
|
|
|
|
|
|
|
{ CShopScene::SHOPITEM_CAKE, FRM_BIGCAKE, 1,1, 4 },
|
|
|
|
{ CShopScene::SHOPITEM_CAKE, FRM_TABLE2, 1,1, 5 },
|
|
|
|
|
|
|
|
{ CShopScene::SHOPITEM_JELLY2, FRM_JELLY, 1,1, 3 },
|
|
|
|
{ CShopScene::SHOPITEM_JELLY2, FRM_TABLE2, 1,1, 5 },
|
|
|
|
|
|
|
|
{ CShopScene::SHOPITEM_PREZZIE, FRM_PRESENTS1, 0,1, 4 },
|
|
|
|
{ CShopScene::SHOPITEM_PREZZIE, FRM_PRESENTS2, 2,1, 5 },
|
|
|
|
|
|
|
|
{ CShopScene::SHOPITEM_SARNIE, FRM_SANDWICHES, 0,1, 5 },
|
|
|
|
{ CShopScene::SHOPITEM_SARNIE, FRM_LEFTTABLE, 0,1, 5 },
|
|
|
|
|
|
|
|
{ CShopScene::SHOPITEM_CUPCAKE, FRM_SMALLCAKES, 1,1, 4 },
|
|
|
|
{ CShopScene::SHOPITEM_CUPCAKE, FRM_TABLE2, 1,1, 5 },
|
|
|
|
|
|
|
|
{ CShopScene::SHOPITEM_TEDDY, FRM_TOYCHEST, 1,0, 6 },
|
|
|
|
};
|
|
|
|
static const int numimages=sizeof(images)/sizeof(PARTY_IMAGE);
|
|
|
|
|
|
|
|
static int itemsHeld[CShopScene::NUM_SHOP_ITEM_IDS]=
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
true, // SHOPITEM_BLOWER
|
|
|
|
true, // SHOPITEM_CAKE
|
|
|
|
true, // SHOPITEM_CUPCAKE
|
|
|
|
true, // SHOPITEM_JELLY2
|
|
|
|
true, // SHOPITEM_PARTYHAT
|
|
|
|
true, // SHOPITEM_PREZZIE
|
|
|
|
true, // SHOPITEM_SARNIE
|
|
|
|
true, // SHOPITEM_TEDDY
|
|
|
|
};
|
|
|
|
DVECTOR sbpos={100,100};
|
|
|
|
DVECTOR patpos={100,100};
|
|
|
|
void CPartyScene::render()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int drawn[FRM_TOYCHEST+1];
|
|
|
|
PARTY_IMAGE *pimage;
|
|
|
|
|
|
|
|
for(i=0;i<FRM_TOYCHEST+1;i++)
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
drawn[i]=false;
|
2001-06-09 22:35:28 +02:00
|
|
|
}
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
pimage=images;
|
|
|
|
for(i=0;i<numimages;i++)
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
ASSERT(pimage->m_fh<=FRM_TOYCHEST);
|
|
|
|
if(itemsHeld[pimage->m_itemId]&&!drawn[pimage->m_fh])
|
|
|
|
{
|
|
|
|
m_sprites->printFT4(pimage->m_fh,pimage->m_xOffsetBroken*256,pimage->m_yOffsetBroken*256,0,0,pimage->m_ot);
|
|
|
|
drawn[pimage->m_fh]=true;
|
|
|
|
}
|
|
|
|
pimage++;
|
2001-06-09 22:35:28 +02:00
|
|
|
}
|
|
|
|
|
2001-06-10 19:07:06 +02:00
|
|
|
// Actors
|
|
|
|
// m_actorSpongebob->Render(sbpos,0,0,0,0);
|
|
|
|
// m_actorPatrick->Render(patpos,0,0,0,0);
|
2001-06-09 22:35:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-06-10 19:07:06 +02:00
|
|
|
void CPartyScene::think(int _frames)
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
|
|
|
if(!CFader::isFading())
|
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
if(PadGetDown(0)&(PAD_CROSS|PAD_START))
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
m_readyToExit=true;
|
|
|
|
CFader::setFadingOut();
|
|
|
|
GameState::setNextScene(&FrontEndScene);
|
2001-06-09 22:35:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2001-06-10 19:07:06 +02:00
|
|
|
int CPartyScene::readyToShutdown()
|
2001-06-09 22:35:28 +02:00
|
|
|
{
|
2001-06-10 19:07:06 +02:00
|
|
|
return m_readyToExit&&!CFader::isFading();
|
2001-06-09 22:35:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|