SBSPSS/source/paul/paul.cpp

204 lines
3.9 KiB
C++
Raw Normal View History

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-09-12 01:52:04 +02:00
/* Std Lib
------- */
/* Data
---- */
/*----------------------------------------------------------------------
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:
---------------------------------------------------------------------- */
void CPaulScene::init()
{
s_fontBank.initialise(&standardFont);
2000-10-05 16:16:09 +02:00
CSoundMediator::initialise();
CSoundMediator::setSong(CSoundMediator::DROPPOP);
// CSoundMediator::playSong();
CSoundMediator::setSfxBank(CSoundMediator::INGAME);
2000-09-15 18:51:09 +02:00
2000-10-05 16:16:09 +02:00
//CXAStream::Init();
PAUL_DBGMSG("initialised..");
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;
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2000-10-05 16:16:09 +02:00
int psfx=3;
#include "sound\speech.h"
int mvol=10;
int svol=255;
2000-09-12 01:52:04 +02:00
void CPaulScene::think()
{
2000-10-05 16:16:09 +02:00
int pad;
int sfxId=-1;
int setVolumes=false;
2000-09-15 18:51:09 +02:00
2000-10-05 16:16:09 +02:00
pad=PadGetDown(0);
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);
// PAUL_DBGMSG("---- sfx %d",sfxId);
//CSoundMediator::playSpeech(speechId);
// CXAStream::Stop();
// CXAStream::PlaySpeech(speechId,true);
// PAUL_DBGMSG("----- playing speech %d",speechId);
}
// CXAStream::SetVolume(32700,32700);
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-05 16:16:09 +02:00
if(++mvol>CSoundMediator::MAX_VOLUME)mvol=CSoundMediator::MAX_VOLUME;
setVolumes=true;
2000-09-15 18:51:09 +02:00
}
2000-10-05 16:16:09 +02:00
if(pad&PAD_DOWN)
{
if(--mvol<CSoundMediator::MIN_VOLUME)mvol=CSoundMediator::MIN_VOLUME;
setVolumes=true;
}
if(pad&PAD_RIGHT)
{
if(++svol>CSoundMediator::MAX_VOLUME)svol=CSoundMediator::MAX_VOLUME;
setVolumes=true;
}
if(pad&PAD_LEFT)
{
if(--svol<CSoundMediator::MIN_VOLUME)svol=CSoundMediator::MIN_VOLUME;
setVolumes=true;
}
if(setVolumes)
{
CSoundMediator::setVolume(CSoundMediator::SONG,mvol);
CSoundMediator::setVolume(CSoundMediator::SFX,svol);
}
CSoundMediator::think(GameState::getTimeSinceLast());
//CXAStream::ControlXA();
2000-09-12 01:52:04 +02:00
}
/*===========================================================================
end */