This commit is contained in:
Paul 2000-11-15 15:37:12 +00:00
parent 545a3d1304
commit f92df2b5bf
12 changed files with 352 additions and 55 deletions

View File

@ -33,6 +33,17 @@ eng=NOW LOADING..
eng= eng=
; ---------------------------------------------------------------
; Front end
; ---------------------------------------------------------------
[STR__FRONTEND__GAME_TITLE]
eng=SPONGEBOBS UNTITLED ADVENTURE
[STR__FRONTEND__PRESS_START]
eng=PRESS START
; --------------------------------------------------------------- ; ---------------------------------------------------------------

View File

@ -51,7 +51,9 @@ CD_FILESYS_LIB := CMXBoot
fileio_src := fileio \ fileio_src := fileio \
$($(FILE_SYSTEM)_FILESYS_SRC) $($(FILE_SYSTEM)_FILESYS_SRC)
frontend_src := scrollbg frontend_src := frontend \
scrollbg \
maintitl
game_src := game game_src := game
@ -59,8 +61,9 @@ gfx_src := prim \
tpage \ tpage \
animtex \ animtex \
sprbank \ sprbank \
font \ fader \
fdata \ fdata \
font \
bubicles bubicles
# camera \ # camera \

View File

@ -147,10 +147,10 @@ GFX_DATA_OUT += $(INGAMEFX_GFX_TEX_OUT)
FRONTEND_GFX_DIR := $(GRAF_DIR)/frontend FRONTEND_GFX_DIR := $(GRAF_DIR)/frontend
FRONTEND_GFX_OUT_DIR := $(DATA_OUT)/frontend FRONTEND_GFX_OUT_DIR := $(DATA_OUT)/frontend
FRONTEND_GFX_NONTRANS := FRONTEND_GFX_NONTRANS := sky.bmp
FRONTEND_GFX_NONTRANS_IN := $(foreach FILE,$(FRONTEND_GFX_NONTRANS),$(FRONTEND_NONTRANS_DIR)/$(FILE)) FRONTEND_GFX_NONTRANS_IN := $(foreach FILE,$(FRONTEND_GFX_NONTRANS),$(FRONTEND_GFX_DIR)/$(FILE))
FRONTEND_GFX_TRANS := +bg1.bmp +sblogo.bmp FRONTEND_GFX_TRANS := +bg1.bmp +island.bmp +sblogo.bmp
FRONTEND_GFX_TRANS_IN := $(foreach FILE,$(FRONTEND_GFX_TRANS),$(FRONTEND_GFX_DIR)/$(FILE)) FRONTEND_GFX_TRANS_IN := $(foreach FILE,$(FRONTEND_GFX_TRANS),$(FRONTEND_GFX_DIR)/$(FILE))
FRONTEND_GFX_TEX_IN := ${FRONTEND_GFX_NONTRANS_IN} ${FRONTEND_GFX_TRANS_IN} FRONTEND_GFX_TEX_IN := ${FRONTEND_GFX_NONTRANS_IN} ${FRONTEND_GFX_TRANS_IN}

View File

@ -18,16 +18,12 @@
#include "frontend\frontend.h" #include "frontend\frontend.h"
#ifndef __FRONTEND_SCROLLBG_H__
#include "frontend\scrollbg.h"
#endif
#ifndef __MEMORY_HEADER__ #ifndef __MEMORY_HEADER__
#include "mem\memory.h" #include "mem\memory.h"
#endif #endif
#ifndef __GFX_SPRBANK_H__ #ifndef __FRONTEND_MAINTITL_H__
#include "gfx\sprbank.h" #include "frontend\maintitl.h"
#endif #endif
@ -37,11 +33,6 @@
/* Data /* Data
---- */ ---- */
#ifndef __SPR_FRONTEND_H__
#include <frontend.h>
#endif
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Tyepdefs && Defines Tyepdefs && Defines
------------------- */ ------------------- */
@ -58,11 +49,6 @@
Vars Vars
---- */ ---- */
static CScrollyBackground *s_bg1;
CFrontEndScene FrontEndScene; CFrontEndScene FrontEndScene;
@ -74,13 +60,8 @@ CFrontEndScene FrontEndScene;
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CFrontEndScene::init() void CFrontEndScene::init()
{ {
s_bg1=new ("scrolly background") CScrollyBackground(); m_mainTitles=new ("FEMainTitles") CFrontEndMainTitles();
s_bg1->init(); m_mainTitles->init();
s_bg1->setSpeed(+2,+2);
m_sprites=new ("FE Sprites") SpriteBank();
m_sprites->load(FRONTEND_FRONTEND_SPR);
} }
@ -92,8 +73,7 @@ void CFrontEndScene::init()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CFrontEndScene::shutdown() void CFrontEndScene::shutdown()
{ {
m_sprites->dump(); delete m_sprites; m_mainTitles->shutdown(); delete m_mainTitles;
s_bg1->shutdown(); delete s_bg1;
} }
@ -105,12 +85,7 @@ void CFrontEndScene::shutdown()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CFrontEndScene::render() void CFrontEndScene::render()
{ {
sFrameHdr *fh; m_mainTitles->render();
fh=m_sprites->getFrameHeader(FRM__SBLOGO);
m_sprites->printFT4(fh,(512-fh->W)/2,(256-fh->H)/2,0,0,10);
s_bg1->render();
} }
@ -122,7 +97,7 @@ void CFrontEndScene::render()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CFrontEndScene::think(int _frames) void CFrontEndScene::think(int _frames)
{ {
s_bg1->think(_frames); m_mainTitles->think(_frames);
} }

View File

@ -45,7 +45,7 @@ public:
private: private:
class SpriteBank *m_sprites; class CFrontEndMainTitles *m_mainTitles;
}; };

View File

@ -26,6 +26,26 @@
#include "gfx\sprbank.h" #include "gfx\sprbank.h"
#endif #endif
#ifndef __GFX_FONT_H__
#include "gfx\font.h"
#endif
#ifndef __MATHTABLE_HEADER__
#include "utils\mathtab.h"
#endif
#ifndef __LOCALE_TEXTDBASE_H__
#include "locale\textdbase.h"
#endif
#ifndef __PAD_PADS_H__
#include "pad\pads.h"
#endif
#ifndef __GFX_FADER_H__
#include "gfx\fader.h"
#endif
/* Std Lib /* Std Lib
------- */ ------- */
@ -54,6 +74,18 @@
Vars Vars
---- */ ---- */
///////////////
int seaw=10;
int seah=70;
int seaspeed=20;
int seagap=120;
int seascale=4000;
int seascalegrow=-50;
int sval=0;
///////////////
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -62,8 +94,21 @@
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CFrontEndMainTitles::init() void CFrontEndMainTitles::init()
{ {
m_sprites=new ("FE Sprites") SpriteBank(); m_sprites=new ("MainTitle Sprites") SpriteBank();
m_sprites->load(FRONTEND_FRONTEND_SPR); m_sprites->load(FRONTEND_FRONTEND_SPR);
m_smallFont=new ("MainTitle SmallFont") FontBank();
m_smallFont->initialise(&standardFont);
m_smallFont->setJustification(FontBank::JUST_CENTRE);
m_bigFont=new ("MainTitle BigFont") FontBank();
m_bigFont->initialise(&largeFont);
m_bigFont->setJustification(FontBank::JUST_CENTRE);
m_bigFont->setColour(PRESS_START_TEXT_R,PRESS_START_TEXT_G,PRESS_START_TEXT_B);
m_mode=MODE__PRESS_START;
CFader::setFadingIn();
} }
@ -75,10 +120,19 @@ void CFrontEndMainTitles::init()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CFrontEndMainTitles::shutdown() void CFrontEndMainTitles::shutdown()
{ {
m_sprites->dump(); delete m_sprites; m_bigFont->dump(); delete m_bigFont;
m_smallFont->dump(); delete m_smallFont;
m_sprites->dump(); delete m_sprites;
} }
typedef struct
{
int x,y;
}xy;
xy pos[10]={{0,0},{3,0},{-3,0},{0,2},{0,-2}};
int posnum=5;
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -88,9 +142,40 @@ void CFrontEndMainTitles::shutdown()
void CFrontEndMainTitles::render() void CFrontEndMainTitles::render()
{ {
sFrameHdr *fh; sFrameHdr *fh;
POLY_FT4 *ft4;
// Game logo/title
fh=m_sprites->getFrameHeader(FRM__SBLOGO); fh=m_sprites->getFrameHeader(FRM__SBLOGO);
m_sprites->printFT4(fh,(512-fh->W)/2,(256-fh->H)/2,0,0,10); m_sprites->printFT4(fh,256-(fh->W/2),LOGO_CENTRE_Y-(fh->H/2),0,0,20);
m_smallFont->setColour(GAME_TITLE_TEXT_R,GAME_TITLE_TEXT_G,GAME_TITLE_TEXT_B);
m_smallFont->print(256,GAME_TITLE_TEXT_CENTRE_Y,STR__FRONTEND__GAME_TITLE);
m_smallFont->setColour(0,0,0);
m_smallFont->print(256+1,GAME_TITLE_TEXT_CENTRE_Y+1,STR__FRONTEND__GAME_TITLE);
// The island
fh=m_sprites->getFrameHeader(FRM__ISLAND);
m_sprites->printFT4(fh,ISLAND_LEFT_X,ISLAND_BOTTOM_Y-(fh->H),0,0,11);
// Sky
fh=m_sprites->getFrameHeader(FRM_SKY);
for(int i=0;i<posnum;i++)
{
ft4=m_sprites->printFT4(fh,0,0,0,0,1020-i);
setXYWH(ft4,pos[i].x,pos[i].y,512,HORIZON_LEVEL);
if(i)
setSemiTrans(ft4,true);
}
renderSea();
switch(m_mode)
{
case MODE__PRESS_START:
renderPressStart();
break;
case MODE__SELECT_OPTION:
break;
}
} }
@ -102,6 +187,152 @@ void CFrontEndMainTitles::render()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CFrontEndMainTitles::think(int _frames) void CFrontEndMainTitles::think(int _frames)
{ {
sval=(sval+(seaspeed*_frames))&4095;
switch(m_mode)
{
case MODE__PRESS_START:
if(!CFader::isFading()&&PadGetDown(0)&PAD_START)
{
m_mode=MODE__SELECT_OPTION;
CFader::setFadingOut();
}
break;
case MODE__SELECT_OPTION:
break;
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
POLY_FT4 *CFrontEndMainTitles::prepareSeaPortionFT4(sFrameHdr *_fh,int _x,int _y,int _w,int _h)
{
int u,v,w,h;
POLY_FT4 *ft4;
w=(_fh->W*_w)>>8;
h=(_fh->H*_h)>>8;
u=_fh->U+((_fh->W*_x)>>8);
v=_fh->V+_fh->H-((_fh->H*_y)>>8)-h;
ft4=GetPrimFT4();
setShadeTexPolyFT4(ft4);
setShadeTex(ft4,0);
setRGB0(ft4,64,64,64);
ft4->u0=u;
ft4->u1=u+w;
ft4->u2=u;
ft4->u3=u+w;
ft4->v0=v+h-1;
ft4->v1=v+h-1;
ft4->v2=v-1;
ft4->v3=v-1;
ft4->tpage=_fh->TPage;
ft4->clut=_fh->Clut;
return ft4;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndMainTitles::renderSea()
{
sFrameHdr *fh;
int xloop,yloop;
int xstep,ystep;
int x,y;
int scale;
POLY_FT4 *ft4;
int grid[seaw+1][seah+1][2];
int waveval;
// Grow the grid
xstep=(512<<8)/seaw;
ystep=((256-HORIZON_LEVEL+(2048/(seascale+(seascalegrow*seah))))<<8)/seah;
y=HORIZON_LEVEL<<8;
waveval=sval;
scale=seascale;
for(yloop=0;yloop<seah+1;yloop++)
{
x=0;
for(xloop=0;xloop<seaw+1;xloop++)
{
grid[xloop][yloop][0]=(x>>8)+0;
grid[xloop][yloop][1]=(y>>8)+(msin(waveval)/scale);
x+=xstep;
}
y+=ystep;
scale+=seascalegrow;
waveval=(waveval+seagap)&4095;
}
// Hmm.. let's stick the top line to the horizon shall we?
for(xloop=0;xloop<seaw+1;xloop++)
{
grid[xloop][yloop][1]=HORIZON_LEVEL;
}
// Draw it
fh=m_sprites->getFrameHeader(FRM_SKY);
//fh=m_sprites->getFrameHeader(FRM__SBLOGO);
xstep=(256<<8)/seaw;
ystep=(256<<8)/seah;
y=0;
for(yloop=0;yloop<seah;yloop++)
{
x=0;
for(xloop=0;xloop<seaw;xloop++)
{
ft4=prepareSeaPortionFT4(fh,x>>8,y>>8,xstep>>8,ystep>>8);
ft4->x0=grid[xloop ][yloop ][0];
ft4->y0=grid[xloop ][yloop ][1];
ft4->x1=grid[xloop+1][yloop ][0];
ft4->y1=grid[xloop+1][yloop ][1];
ft4->x3=grid[xloop+1][yloop+1][0];
ft4->y3=grid[xloop+1][yloop+1][1];
ft4->x2=grid[xloop ][yloop+1][0];
ft4->y2=grid[xloop ][yloop+1][1];
AddPrimToList(ft4,1000);
x+=xstep;
}
y+=ystep;
}
//////////////////////// bg
POLY_F4 *f4;
f4=GetPrimF4();
setXYWH(f4,0,HORIZON_LEVEL,512,256-HORIZON_LEVEL);
setRGB0(f4,80,70,60);
AddPrimToList(f4,1020);
//////////////////////// bg
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndMainTitles::renderPressStart()
{
if(!CFader::isFading())
{
m_bigFont->print(256,PRESS_START_TEXT_Y,STR__FRONTEND__PRESS_START);
}
} }

View File

@ -17,8 +17,8 @@
Includes Includes
-------- */ -------- */
#ifndef __SYSTEM_GSTATE_H__ #ifndef __PRIM_HEADER__
#include "system\gstate.h" #include "gfx\prim.h"
#endif #endif
@ -43,7 +43,41 @@ public:
private: private:
enum
{
LOGO_CENTRE_Y=74,
GAME_TITLE_TEXT_CENTRE_Y=120,
GAME_TITLE_TEXT_R=128,
GAME_TITLE_TEXT_G=128,
GAME_TITLE_TEXT_B=128,
PRESS_START_TEXT_Y=180,
PRESS_START_TEXT_R=150,
PRESS_START_TEXT_G=100,
PRESS_START_TEXT_B=100,
HORIZON_LEVEL=160,
ISLAND_LEFT_X=40,
ISLAND_BOTTOM_Y=HORIZON_LEVEL+10,
};
enum
{
MODE__PRESS_START,
MODE__SELECT_OPTION,
};
POLY_FT4 *prepareSeaPortionFT4(struct sFrameHdr *_fh,int _x,int _y,int _w,int _h);
void renderSea();
void renderPressStart();
class SpriteBank *m_sprites; class SpriteBank *m_sprites;
class FontBank *m_smallFont;
class FontBank *m_bigFont;
int m_mode;
}; };

View File

@ -393,7 +393,7 @@ void CBubicleFactory::shutdown()
Params: Params:
Returns: Returns:
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void CBubicleFactory::think() void CBubicleFactory::think(int _frames)
{ {
ASSERT(s_initialised); ASSERT(s_initialised);
@ -402,20 +402,18 @@ void CBubicleFactory::think()
CBubicleEmitter *emt; CBubicleEmitter *emt;
CBubicle *bub; CBubicle *bub;
frames=GameState::getFramesSinceLast();
emt=s_emitters; emt=s_emitters;
for(i=0;i<NUM_EMITTERS;i++,emt++) for(i=0;i<NUM_EMITTERS;i++,emt++)
{ {
if(emt->isActive()) if(emt->isActive())
emt->think(frames); emt->think(_frames);
} }
bub=s_bubicles; bub=s_bubicles;
for(i=0;i<NUM_BUBICLES;i++,bub++) for(i=0;i<NUM_BUBICLES;i++,bub++)
{ {
if(bub->isActive()) if(bub->isActive())
bub->think(frames); bub->think(_frames);
} }
} }

View File

@ -156,7 +156,7 @@ class CBubicleFactory
public: public:
static void init(); static void init();
static void shutdown(); static void shutdown();
static void think(); static void think(int _frames);
static void render(); static void render();
static CBubicleEmitter *spawnEmitter(BubicleEmitterData *_init); static CBubicleEmitter *spawnEmitter(BubicleEmitterData *_init);
@ -169,7 +169,7 @@ private:
enum enum
{ {
NUM_EMITTERS=10, NUM_EMITTERS=10,
NUM_BUBICLES=100, NUM_BUBICLES=150,
}; };
CBubicleFactory() {;} CBubicleFactory() {;}

View File

@ -78,7 +78,7 @@ private:
DEFAULT_G=128, DEFAULT_G=128,
DEFAULT_B=128, DEFAULT_B=128,
DEFAULT_JUSTIFICATION=JUST_LEFT, DEFAULT_JUSTIFICATION=JUST_LEFT,
DEFAULT_OT=1, DEFAULT_OT=10,
}; };

View File

@ -17,6 +17,17 @@
// scenes // scenes
#include "game\game.h" #include "game\game.h"
#ifndef __FRONTEND_FRONTEND_H__
#include "frontend\frontend.h"
#endif
#ifdef __USER_paul__
#include "paul\paul.h"
CPaulScene s_paulScene;
#endif
#ifndef __SYSTEM_GSTATE_H__ #ifndef __SYSTEM_GSTATE_H__
#include "system\gstate.h" #include "system\gstate.h"
#endif #endif
@ -29,10 +40,6 @@
#include "sound\sound.h" #include "sound\sound.h"
#endif #endif
#ifdef __USER_paul__
#include "paul\paul.h"
CPaulScene s_paulScene;
#endif
#ifndef __SYSTEM_EXCEPT_H__ #ifndef __SYSTEM_EXCEPT_H__
#include "system\except.h" #include "system\except.h"
@ -46,6 +53,15 @@ CPaulScene s_paulScene;
#include "gui\gui.h" #include "gui\gui.h"
#endif #endif
#ifndef __GFX_FADER_H__
#include "gfx\fader.h"
#endif
#ifndef __GFX_BUBICLES_H__
#include "gfx\bubicles.h"
#endif
#define SCREEN_GRAB #define SCREEN_GRAB
@ -89,6 +105,8 @@ void InitSystem() // reordered to reduce black screen (hope all is well
initGUIStuff(); initGUIStuff();
CBubicleFactory::init();
#ifdef __USER_paul__ #ifdef __USER_paul__
s_paulScene.init(); s_paulScene.init();
#endif #endif
@ -109,9 +127,16 @@ void MainLoop()
frames=GameState::getFramesSinceLast(); frames=GameState::getFramesSinceLast();
FontBank::think(frames); FontBank::think(frames);
GameState::think(); GameState::think();
GameState::render(); GameState::render();
CBubicleFactory::think(frames);
CBubicleFactory::render();
CFader::think(frames);
CFader::render();
CSoundMediator::think(frames); CSoundMediator::think(frames);
#ifdef __USER_paul__ #ifdef __USER_paul__
@ -153,7 +178,11 @@ int main()
CFileIO::GetAllFilePos(); CFileIO::GetAllFilePos();
InitSystem(); InitSystem();
#ifdef __USER_paul__
GameState::setNextScene( &FrontEndScene );
#else
GameState::setNextScene( &GameScene ); GameState::setNextScene( &GameScene );
#endif
// CXAStream::Init(); // PKG - Stuck here so that it doesn't affect any startup stuff (7/8/00) // CXAStream::Init(); // PKG - Stuck here so that it doesn't affect any startup stuff (7/8/00)
MainLoop(); MainLoop();

View File

@ -485,6 +485,22 @@ SOURCE=..\..\..\source\utils\utils.h
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Source File # Begin Source File
SOURCE=..\..\..\source\frontend\frontend.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\frontend\frontend.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\frontend\maintitl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\frontend\maintitl.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\frontend\scrollbg.cpp SOURCE=..\..\..\source\frontend\scrollbg.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File