2000-09-12 01:52:04 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
paul.cpp
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#include "paul\paul.h"
|
|
|
|
|
|
|
|
#ifndef __SYSTEM_DBG_H__
|
|
|
|
#include "system\dbg.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GFX_FONT_H__
|
|
|
|
#include "gfx\font.h"
|
|
|
|
#endif
|
|
|
|
|
2000-09-15 18:51:09 +02:00
|
|
|
#ifndef __MEMORY_HEADER__
|
|
|
|
#include "mem\memory.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __UTILS_HEADER__
|
|
|
|
#include "utils\utils.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
#ifndef __SOUND_SOUND_H__
|
|
|
|
#include "sound\sound.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __PAD_PADS_H__
|
|
|
|
#include "pad\pads.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
#ifndef __GFX_SPRBANK_H__
|
|
|
|
#include "gfx\sprbank.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
#ifndef __GUI_GUI_H__
|
|
|
|
#include "gui\gui.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GUI_GTEXTBOX_H__
|
|
|
|
#include "gui\gtextbox.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
#ifndef __GUI_GFRAME_H__
|
|
|
|
#include "gui\gframe.h"
|
|
|
|
#endif
|
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
#ifndef __GUI_GREADOUT_H__
|
|
|
|
#include "gui\greadout.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
#ifndef __GUI_GBUTTON_H__
|
|
|
|
#include "gui\gbutton.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-20 16:45:17 +01:00
|
|
|
//#ifndef __GUI_GTEXTENT_H__
|
|
|
|
//#include "gui\gtextent.h"
|
|
|
|
//#endif
|
2000-11-07 23:05:42 +01:00
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
#ifndef __LOCALE_TEXTDBASE_H__
|
|
|
|
#include "locale\textdbase.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-13 18:03:20 +01:00
|
|
|
#ifndef __FRONTEND_SCROLLBG_H__
|
|
|
|
#include "frontend\scrollbg.h"
|
|
|
|
#endif
|
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
2000-11-03 01:07:42 +01:00
|
|
|
#ifndef __SPR_UIGFX_H__
|
|
|
|
#include <uigfx.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
static FontBank s_fontBank;
|
2000-11-13 18:03:20 +01:00
|
|
|
static CScrollyBackground *s_bg1;
|
|
|
|
static CScrollyBackground *s_bg2;
|
|
|
|
static CScrollyBackground *s_bg3;
|
2000-09-12 01:52:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-11-22 17:04:18 +01:00
|
|
|
/*
|
2000-10-31 17:43:44 +01:00
|
|
|
unsigned int str=STR__PAULS_TEST_STRING_1;
|
|
|
|
int w=150;
|
|
|
|
int h=40;
|
2000-10-18 00:04:57 +02:00
|
|
|
|
2000-11-03 01:07:42 +01:00
|
|
|
CGUITextReadout::TextReadoutData onOffTextReadouts[]=
|
|
|
|
{
|
2000-11-03 17:41:57 +01:00
|
|
|
{ false, STR__ON, },
|
|
|
|
{ true, STR__OFF, },
|
|
|
|
{ 0, 0, },
|
2000-11-03 01:07:42 +01:00
|
|
|
};
|
|
|
|
CGUISpriteReadout::SpriteReadoutData onOffSpriteReadouts[]=
|
2000-09-12 01:52:04 +02:00
|
|
|
{
|
2000-11-03 17:41:57 +01:00
|
|
|
{ false, FRM__CROSS, },
|
|
|
|
{ true, FRM__TICK, },
|
|
|
|
{ 0, 0, },
|
2000-10-31 17:43:44 +01:00
|
|
|
};
|
2000-11-03 17:41:57 +01:00
|
|
|
int musicStatus=false;
|
|
|
|
int sfxStatus=false;
|
|
|
|
int readyToExit=false;
|
2000-11-03 22:22:27 +01:00
|
|
|
int musicVol=0;
|
2000-11-07 23:05:42 +01:00
|
|
|
char textEntry[16+1]="SOME TEXT";
|
2000-11-03 01:07:42 +01:00
|
|
|
|
|
|
|
|
2000-09-15 18:51:09 +02:00
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
CGUIControlFrame *baseGUIObject;
|
2000-11-22 17:04:18 +01:00
|
|
|
*/
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
void CPaulScene::init()
|
|
|
|
{
|
2000-11-20 16:45:17 +01:00
|
|
|
s_fontBank.initialise(&standardFont);
|
|
|
|
s_fontBank.setColour(255,255,255);
|
|
|
|
|
|
|
|
/*
|
2000-11-03 01:07:42 +01:00
|
|
|
CGUIGroupFrame *fr;
|
|
|
|
CGUITextBox *tb;
|
2000-11-03 17:41:57 +01:00
|
|
|
CGUIToggleButton *tg;
|
2000-11-03 01:07:42 +01:00
|
|
|
CGUITextReadout *tr;
|
|
|
|
CGUISpriteReadout *sr;
|
2000-11-03 22:22:27 +01:00
|
|
|
CGUIBarReadout *br;
|
|
|
|
CGUISliderButton *sl;
|
2000-11-07 23:05:42 +01:00
|
|
|
CGUITextEntry *te;
|
2000-11-20 16:45:17 +01:00
|
|
|
|
2000-11-07 23:05:42 +01:00
|
|
|
int mem=MainRam.TotalRam-MainRam.RamUsed;
|
|
|
|
PAUL_DBGMSG("initial mem free=%d",mem);
|
|
|
|
|
2000-11-02 18:16:10 +01:00
|
|
|
baseGUIObject=new ("Uber GUI object") CGUIControlFrame();
|
2000-11-03 17:41:57 +01:00
|
|
|
baseGUIObject->init(NULL);
|
2000-11-03 01:07:42 +01:00
|
|
|
baseGUIObject->setObjectXYWH(32,32,512-64,256-64);
|
|
|
|
|
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
2000-11-03 17:41:57 +01:00
|
|
|
fr->init(baseGUIObject);
|
2000-11-03 01:07:42 +01:00
|
|
|
fr->setObjectXYWH(10,10,448-20,30);
|
|
|
|
tb=new ("textbox") CGUITextBox();
|
2000-11-03 17:41:57 +01:00
|
|
|
tb->init(fr);
|
2000-11-03 01:07:42 +01:00
|
|
|
tb->setObjectXYWH(0,0,300,30);
|
|
|
|
tb->setText(STR__PAULS_TEST__MUSIC);
|
2000-11-03 17:41:57 +01:00
|
|
|
tg=new ("togglebutton") CGUIToggleButton();
|
|
|
|
tg->init(fr);
|
|
|
|
tg->setButtonTarget(&musicStatus);
|
2000-11-03 01:07:42 +01:00
|
|
|
tr=new ("textreadout") CGUITextReadout();
|
2000-11-03 17:41:57 +01:00
|
|
|
tr->init(fr);
|
2000-11-03 01:07:42 +01:00
|
|
|
tr->setObjectXYWH(300,0,128,30);
|
|
|
|
tr->setReadoutTarget(&musicStatus);
|
|
|
|
tr->setReadoutData(onOffTextReadouts);
|
2000-11-02 18:16:10 +01:00
|
|
|
|
2000-11-03 01:07:42 +01:00
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
2000-11-03 17:41:57 +01:00
|
|
|
fr->init(baseGUIObject);
|
2000-11-03 01:07:42 +01:00
|
|
|
fr->setObjectXYWH(10,50,448-20,30);
|
|
|
|
tb=new ("textbox") CGUITextBox();
|
2000-11-03 17:41:57 +01:00
|
|
|
tb->init(fr);
|
2000-11-03 01:07:42 +01:00
|
|
|
tb->setObjectXYWH(0,0,300,30);
|
|
|
|
tb->setText(STR__PAULS_TEST__SFX);
|
2000-11-03 17:41:57 +01:00
|
|
|
tg=new ("togglebutton") CGUIToggleButton();
|
|
|
|
tg->init(fr);
|
|
|
|
tg->setButtonTarget(&sfxStatus);
|
2000-11-03 01:07:42 +01:00
|
|
|
sr=new ("spritereadout") CGUISpriteReadout();
|
2000-11-03 17:41:57 +01:00
|
|
|
sr->init(fr);
|
2000-11-03 01:07:42 +01:00
|
|
|
sr->setObjectXYWH(300,0,128,30);
|
|
|
|
sr->setReadoutTarget(&sfxStatus);
|
|
|
|
sr->setReadoutData(onOffSpriteReadouts);
|
|
|
|
|
2000-11-07 23:05:42 +01:00
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
|
|
|
fr->init(baseGUIObject);
|
|
|
|
fr->setObjectXYWH(10,90,448-20,30);
|
|
|
|
sl=new("sliderbutton") CGUISliderButton();
|
|
|
|
sl->init(fr);
|
|
|
|
sl->setButtonTarget(&musicVol);
|
|
|
|
sl->setButtonRange(0,255);
|
|
|
|
br=new ("spritereadout") CGUIBarReadout();
|
|
|
|
br->init(fr);
|
|
|
|
br->setObjectXYWH(0,0,448-20,30);
|
|
|
|
br->setReadoutTarget(&musicVol);
|
|
|
|
br->setReadoutRange(0,255);
|
2000-11-03 22:22:27 +01:00
|
|
|
|
2000-11-03 01:07:42 +01:00
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
2000-11-03 17:41:57 +01:00
|
|
|
fr->init(baseGUIObject);
|
2000-11-07 23:05:42 +01:00
|
|
|
fr->setObjectXYWH(10,155,200,30);
|
2000-11-03 01:07:42 +01:00
|
|
|
tb=new ("textbox") CGUITextBox();
|
2000-11-03 17:41:57 +01:00
|
|
|
tb->init(fr);
|
2000-11-07 23:05:42 +01:00
|
|
|
tb->setObjectXYWH(0,0,200,30);
|
2000-11-03 17:41:57 +01:00
|
|
|
tb->setText(STR__PAULS_TEST__EXIT);
|
|
|
|
tg=new ("togglebutton") CGUIToggleButton();
|
|
|
|
tg->init(fr);
|
|
|
|
tg->setButtonTarget(&readyToExit);
|
2000-11-02 18:16:10 +01:00
|
|
|
|
2000-11-07 23:05:42 +01:00
|
|
|
fr=new ("frame") CGUIGroupFrame();
|
|
|
|
fr->init(baseGUIObject);
|
|
|
|
fr->setObjectXYWH(220,155,200,30);
|
|
|
|
te=new ("textentry") CGUITextEntry();
|
|
|
|
te->init(fr);
|
|
|
|
te->setObjectXYWH(0,0,200,30);
|
|
|
|
te->setTextDetails(textEntry,16);
|
2000-11-02 18:16:10 +01:00
|
|
|
|
|
|
|
baseGUIObject->select();
|
2000-11-07 23:05:42 +01:00
|
|
|
|
|
|
|
// Heh.. this'll actually work =)
|
|
|
|
//ASSERT(0);
|
|
|
|
// baseGUIObject->shutdown();
|
|
|
|
// baseGUIObject=0;
|
|
|
|
|
|
|
|
PAUL_DBGMSG("change=%d",mem-(MainRam.TotalRam-MainRam.RamUsed));
|
2000-11-13 18:03:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
s_bg1=new ("scrolly background") CScrollyBackground();
|
|
|
|
s_bg1->init();
|
|
|
|
s_bg1->setSpeed(+2,+2);
|
|
|
|
|
|
|
|
s_bg2=new ("scrolly background") CScrollyBackground();
|
|
|
|
s_bg2->init();
|
|
|
|
s_bg2->setSpeed(-2,0);
|
|
|
|
s_bg2->setOt(1001);
|
|
|
|
|
|
|
|
s_bg3=new ("scrolly background") CScrollyBackground();
|
|
|
|
s_bg3->init();
|
|
|
|
s_bg3->setSpeed(0,-2);
|
|
|
|
s_bg3->setOt(1002);
|
2000-11-20 16:45:17 +01:00
|
|
|
*/
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-13 18:03:20 +01:00
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPaulScene::shutdown()
|
|
|
|
{
|
2000-11-20 16:45:17 +01:00
|
|
|
/*
|
2000-11-13 18:03:20 +01:00
|
|
|
s_bg3->shutdown();
|
|
|
|
s_bg2->shutdown();
|
|
|
|
s_bg1->shutdown();
|
2000-10-31 17:43:44 +01:00
|
|
|
s_fontBank.dump();
|
2000-11-20 16:45:17 +01:00
|
|
|
*/
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-11-03 01:07:42 +01:00
|
|
|
int showDebugLog=false;
|
2000-09-12 01:52:04 +02:00
|
|
|
void CPaulScene::render()
|
|
|
|
{
|
2000-11-03 01:07:42 +01:00
|
|
|
if(showDebugLog)
|
2000-09-12 01:52:04 +02:00
|
|
|
{
|
2000-11-03 01:07:42 +01:00
|
|
|
int logCount;
|
|
|
|
int i,y,charHeight;
|
|
|
|
logCount=getNumberOfDbgLinesInLog();
|
|
|
|
y=20;
|
|
|
|
charHeight=s_fontBank.getCharHeight();
|
|
|
|
for(i=0;i<logCount;i++)
|
|
|
|
{
|
|
|
|
s_fontBank.print(20,y,getDbgLineFromLog(i));
|
|
|
|
y+=charHeight;
|
|
|
|
}
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
2000-11-03 17:41:57 +01:00
|
|
|
|
2000-11-16 18:23:31 +01:00
|
|
|
/*
|
2000-11-03 17:41:57 +01:00
|
|
|
if(baseGUIObject)
|
|
|
|
baseGUIObject->render();
|
2000-11-13 18:03:20 +01:00
|
|
|
|
|
|
|
s_bg1->render();
|
|
|
|
s_bg2->render();
|
|
|
|
s_bg3->render();
|
|
|
|
*/
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
2000-10-31 17:43:44 +01:00
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-10-19 17:40:24 +02:00
|
|
|
void CPaulScene::think(int _frames)
|
2000-09-12 01:52:04 +02:00
|
|
|
{
|
2000-11-16 18:23:31 +01:00
|
|
|
if(PadGetHeld(0)&PAD_R1&&PadGetDown(0)&PAD_R2)
|
|
|
|
{
|
|
|
|
showDebugLog=!showDebugLog;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2000-11-03 17:41:57 +01:00
|
|
|
if(readyToExit)
|
|
|
|
{
|
|
|
|
baseGUIObject->shutdown();
|
|
|
|
delete baseGUIObject;
|
|
|
|
baseGUIObject=NULL;
|
|
|
|
readyToExit=0;
|
|
|
|
}
|
2000-11-16 18:23:31 +01:00
|
|
|
|
2000-11-03 17:41:57 +01:00
|
|
|
if(baseGUIObject)
|
|
|
|
baseGUIObject->think(_frames);
|
2000-11-13 18:03:20 +01:00
|
|
|
|
|
|
|
s_bg1->think(_frames);
|
|
|
|
s_bg2->think(_frames);
|
|
|
|
s_bg3->think(_frames);
|
2000-11-16 18:23:31 +01:00
|
|
|
*/
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
2000-11-13 18:03:20 +01:00
|
|
|
end */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
BubicleEmitterData bubData=
|
|
|
|
{
|
|
|
|
206,200,60,60, // m_x,m_y,m_w,m_h
|
|
|
|
10,1, // m_birthRate,m_birthAmount
|
|
|
|
-1, // m_life
|
|
|
|
{ // m_bubicleBase
|
|
|
|
100, // m_life
|
|
|
|
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
|
|
-40,-15,-100, // m_vy,m_vdy,m_vymax
|
|
|
|
13,10, // m_w,m_h
|
|
|
|
10, // m_dvSizeChange
|
|
|
|
0,100, // m_theta,m_vtheta
|
|
|
|
100,2,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
|
|
40, // m_ot
|
|
|
|
{ 128,128,128, } // m_colour
|
|
|
|
},
|
|
|
|
{ // m_bubicleRange
|
|
|
|
100, // m_life
|
|
|
|
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
|
|
20,10,0, // m_vy,m_vdy,m_vymax
|
|
|
|
5,5, // m_w,m_h
|
|
|
|
10, // m_dvSizeChange
|
|
|
|
4095,50, // m_theta,m_vtheta
|
|
|
|
100,5,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
|
|
|
|
0, // m_ot
|
|
|
|
{ 0, 64,127, } // m_colour
|
|
|
|
}
|
|
|
|
};
|
|
|
|
CBubicleEmitter *testBub;
|
|
|
|
|
|
|
|
|
|
|
|
CBubicleFactory::init();
|
|
|
|
testBub=CBubicleFactory::spawnEmitter(&bubData);
|
|
|
|
|
|
|
|
CBubicleFactory::shutdown();
|
|
|
|
|
|
|
|
testBub->setPos(X,Y);
|
|
|
|
|
|
|
|
CBubicleFactory::render();
|
|
|
|
CBubicleFactory::think();
|
|
|
|
|
|
|
|
|
|
|
|
*/
|