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_BUBICLES__
|
|
|
|
#include "gfx\bubicles.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GFX_SPRBANK_H__
|
|
|
|
#include "gfx\sprbank.h"
|
|
|
|
#endif
|
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
#ifndef __SPR_INGAMEFX_H__
|
|
|
|
#include <ingamefx.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
static FontBank s_fontBank;
|
2000-09-15 18:51:09 +02:00
|
|
|
char *s_mem[3];
|
2000-09-12 01:52:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-10-12 16:35:13 +02:00
|
|
|
int ploopid1=0;
|
|
|
|
int ploopid2=0;
|
2000-10-18 00:04:57 +02:00
|
|
|
BubicleEmitterData data=
|
|
|
|
{
|
|
|
|
206,200,40,40, // m_x,m_y,m_w,m_h
|
|
|
|
3,1, // m_birthRate,m_birthAmount
|
|
|
|
{ // m_bubicleBase
|
|
|
|
100, // m_life
|
|
|
|
0,0,0, // m_vx,m_vdx,m_vxmax
|
|
|
|
-40,-15,-200, // 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 tb;
|
|
|
|
int tbx=64,tby=230;
|
|
|
|
int tbw=512-128,tbh=20;
|
|
|
|
|
|
|
|
static SpriteBank *sprites=NULL;
|
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
void CPaulScene::init()
|
|
|
|
{
|
|
|
|
s_fontBank.initialise(&standardFont);
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-06 00:40:39 +02:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
CSoundMediator::setSfxBank(CSoundMediator::INGAME);
|
2000-09-15 18:51:09 +02:00
|
|
|
|
2000-10-06 00:40:39 +02:00
|
|
|
CSoundMediator::setSong(CSoundMediator::MUSIC);
|
|
|
|
CSoundMediator::playSong();
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
|
|
|
|
//CXAStream::Init();
|
|
|
|
PAUL_DBGMSG("initialised..");
|
2000-10-11 18:47:03 +02:00
|
|
|
|
2000-10-12 16:35:13 +02:00
|
|
|
ploopid1=CSoundMediator::playSfx(0);
|
|
|
|
ploopid2=CSoundMediator::playSfx(0);
|
2000-10-18 00:04:57 +02:00
|
|
|
|
|
|
|
tb.init(&data);
|
|
|
|
|
|
|
|
sprites=new ("bg sprite") SpriteBank();
|
|
|
|
sprites->load(INGAMEFX_INGAMEFX_SPR);
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPaulScene::shutdown()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
void CPaulScene::render()
|
|
|
|
{
|
|
|
|
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-10-18 00:04:57 +02:00
|
|
|
|
|
|
|
tb.render();
|
|
|
|
|
|
|
|
POLY_FT4 *ft4=sprites->printFT4(FRM_BACKGROUND,0,0,0,0,1023);
|
|
|
|
setXYWH(ft4,20,20,512-40,256-40);
|
|
|
|
setRGB0(ft4,64,64,64);
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-10-05 16:16:09 +02:00
|
|
|
int psfx=3;
|
2000-10-10 00:05:41 +02:00
|
|
|
int pkill=0;
|
2000-10-05 16:16:09 +02:00
|
|
|
#include "sound\speech.h"
|
|
|
|
int mvol=10;
|
|
|
|
int svol=255;
|
2000-10-11 18:47:03 +02:00
|
|
|
VECTOR ppos;
|
2000-10-12 17:18:47 +02:00
|
|
|
int psp=0;
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-09-12 01:52:04 +02:00
|
|
|
void CPaulScene::think()
|
|
|
|
{
|
2000-10-05 16:16:09 +02:00
|
|
|
int pad;
|
|
|
|
int sfxId=-1;
|
2000-10-11 18:47:03 +02:00
|
|
|
int setSfxVolume=false;
|
|
|
|
int setSongVolume=false;
|
2000-09-15 18:51:09 +02:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
pad=PadGetDown(0);
|
2000-10-06 00:40:39 +02:00
|
|
|
if(pad&PAD_R1)
|
|
|
|
{
|
2000-10-18 00:04:57 +02:00
|
|
|
tb.init(&data);
|
2000-10-06 00:40:39 +02:00
|
|
|
PAUL_DBGMSG("-------------------");
|
|
|
|
}
|
|
|
|
else if(pad&PAD_CROSS)
|
2000-09-15 18:51:09 +02:00
|
|
|
{
|
2000-10-05 16:16:09 +02:00
|
|
|
sfxId=psfx;
|
2000-09-15 18:51:09 +02:00
|
|
|
}
|
2000-10-05 16:16:09 +02:00
|
|
|
else if(pad&PAD_SQUARE)
|
2000-09-15 18:51:09 +02:00
|
|
|
{
|
2000-10-05 16:16:09 +02:00
|
|
|
sfxId=0;
|
2000-09-15 18:51:09 +02:00
|
|
|
}
|
2000-10-05 16:16:09 +02:00
|
|
|
else if(pad&PAD_TRIANGLE)
|
|
|
|
{
|
|
|
|
sfxId=1;
|
|
|
|
}
|
|
|
|
else if(pad&PAD_CIRCLE)
|
|
|
|
{
|
|
|
|
sfxId=2;
|
|
|
|
}
|
|
|
|
if(sfxId!=-1)
|
|
|
|
{
|
|
|
|
CSoundMediator::playSfx(sfxId);
|
2000-10-10 00:05:41 +02:00
|
|
|
}
|
|
|
|
if(pad&PAD_START)
|
|
|
|
{
|
2000-10-12 17:18:47 +02:00
|
|
|
// PAUL_DBGMSG("stop loopers..");
|
|
|
|
// CSoundMediator::stopSfx((xmPlayingId)ploopid1);
|
|
|
|
// CSoundMediator::stopSfx((xmPlayingId)ploopid2);
|
|
|
|
PAUL_DBGMSG("speech..\n");
|
|
|
|
CSoundMediator::playSpeech((SpeechEquate)psp);
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
2000-10-11 18:47:03 +02:00
|
|
|
if(pad&PAD_R2)
|
|
|
|
{
|
|
|
|
PAUL_DBGMSG("stop all");
|
|
|
|
CSoundMediator::stopAllSound();
|
|
|
|
}
|
2000-10-12 16:35:13 +02:00
|
|
|
#ifdef __USER_paul__
|
|
|
|
if(pad&PAD_L2)
|
|
|
|
{
|
|
|
|
extern int dump;
|
|
|
|
dump=true;
|
|
|
|
}
|
|
|
|
#endif
|
2000-10-05 16:16:09 +02:00
|
|
|
|
2000-10-11 18:47:03 +02:00
|
|
|
//CSoundMediator::setposition((xmPlayingId)ploopid,&ppos);
|
2000-09-15 18:51:09 +02:00
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
pad=PadGetHeld(0);
|
|
|
|
if(pad&PAD_UP)
|
2000-09-15 18:51:09 +02:00
|
|
|
{
|
2000-10-11 18:47:03 +02:00
|
|
|
mvol+=16;
|
|
|
|
if(mvol>CSoundMediator::MAX_VOLUME)mvol=CSoundMediator::MAX_VOLUME;
|
|
|
|
setSongVolume=true;
|
2000-09-15 18:51:09 +02:00
|
|
|
}
|
2000-10-05 16:16:09 +02:00
|
|
|
if(pad&PAD_DOWN)
|
|
|
|
{
|
2000-10-11 18:47:03 +02:00
|
|
|
mvol-=16;
|
|
|
|
if(mvol<CSoundMediator::MIN_VOLUME)mvol=CSoundMediator::MIN_VOLUME;
|
|
|
|
setSongVolume=true;
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
if(pad&PAD_RIGHT)
|
|
|
|
{
|
2000-10-11 18:47:03 +02:00
|
|
|
svol+=16;
|
|
|
|
if(svol>CSoundMediator::MAX_VOLUME)svol=CSoundMediator::MAX_VOLUME;
|
|
|
|
setSfxVolume=true;
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
if(pad&PAD_LEFT)
|
|
|
|
{
|
2000-10-11 18:47:03 +02:00
|
|
|
svol-=16;
|
|
|
|
if(svol<CSoundMediator::MIN_VOLUME)svol=CSoundMediator::MIN_VOLUME;
|
|
|
|
setSfxVolume=true;
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
2000-10-12 17:18:47 +02:00
|
|
|
if(setSongVolume) CSoundMediator::setVolume(CSoundMediator::SPEECH,mvol);
|
2000-10-11 18:47:03 +02:00
|
|
|
if(setSfxVolume) CSoundMediator::setVolume(CSoundMediator::SFX,svol);
|
|
|
|
|
|
|
|
if(setSongVolume||setSfxVolume)
|
2000-10-05 16:16:09 +02:00
|
|
|
{
|
2000-10-12 17:18:47 +02:00
|
|
|
PAUL_DBGMSG("speech:%d sfx:%d",mvol,svol);
|
2000-10-05 16:16:09 +02:00
|
|
|
}
|
|
|
|
|
2000-10-18 00:04:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-10-05 16:16:09 +02:00
|
|
|
//CXAStream::ControlXA();
|
2000-10-18 00:04:57 +02:00
|
|
|
|
|
|
|
pad=PadGetHeld(1);
|
|
|
|
if(pad&PAD_L1)
|
|
|
|
{
|
|
|
|
if(pad&PAD_UP)
|
|
|
|
tbh--;
|
|
|
|
if(pad&PAD_DOWN)
|
|
|
|
tbh++;
|
|
|
|
if(pad&PAD_LEFT)
|
|
|
|
tbw--;
|
|
|
|
if(pad&PAD_RIGHT)
|
|
|
|
tbw++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(pad&PAD_UP)
|
|
|
|
tby-=5;
|
|
|
|
if(pad&PAD_DOWN)
|
|
|
|
tby+=5;
|
|
|
|
if(pad&PAD_LEFT)
|
|
|
|
tbx-=5;
|
|
|
|
if(pad&PAD_RIGHT)
|
|
|
|
tbx+=5;
|
|
|
|
}
|
|
|
|
tb.setPosAndSize(tbx,tby,tbw,tbh);
|
|
|
|
|
|
|
|
tb.think();
|
2000-09-12 01:52:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|