From c5db78cc663d5bfef95bebb7b53395b4b0858d4b Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 19 Jul 2001 19:13:21 +0000 Subject: [PATCH] --- makefile.gaz | 1 + source/paul/scenesel.cpp | 5 + source/paul/sndtest.cpp | 235 +++++------------- source/paul/sndtest.h | 32 +-- .../spongebob project/spongebob project.dsp | 8 + 5 files changed, 81 insertions(+), 200 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index 8348bbeeb..523b18cad 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -253,6 +253,7 @@ pad_src := pads \ vibe paul_src := paul \ + sndtest \ scenesel \ animtest diff --git a/source/paul/scenesel.cpp b/source/paul/scenesel.cpp index a6d76686c..d6a7408b8 100644 --- a/source/paul/scenesel.cpp +++ b/source/paul/scenesel.cpp @@ -67,6 +67,10 @@ #include "paul\animtest.h" #endif +#ifndef __PAUL_SNDTEST_H__ +#include "paul\sndtest.h" +#endif + #ifndef __SAVE_SAVE_H__ #include "save\save.h" #endif @@ -115,6 +119,7 @@ CScene *CSceneSelector::s_sceneList[]= &CreditsScene, &AnimTestScene, &SaveScene, + &SoundTestScene, }; int CSceneSelector::s_sceneCount=sizeof(s_sceneList)/sizeof(CScene*); diff --git a/source/paul/sndtest.cpp b/source/paul/sndtest.cpp index a6d76686c..46dc7adfc 100644 --- a/source/paul/sndtest.cpp +++ b/source/paul/sndtest.cpp @@ -1,6 +1,6 @@ /*========================================================================= - scenesel.cpp + sndtest.cpp Author: PKG Created: @@ -16,7 +16,7 @@ Includes -------- */ -#include "paul\scenesel.h" +#include "paul\sndtest.h" #ifndef __GFX_FONT_H__ #include "gfx\font.h" @@ -26,53 +26,12 @@ #include "pad\pads.h" #endif -#ifndef __DATA_STRUCTS_HEADER__ -#include "Dstructs.h" -#endif - #ifndef __PRIM_HEADER__ #include "gfx\prim.h" #endif -// Scenes -#ifndef __FRONTEND_FRONTEND_H__ -#include "frontend\frontend.h" -#endif - -#ifndef __GAME_GAME_H__ -#include "game\game.h" -#endif - -#ifndef __FMA_FMA_H__ -#include "fma\fma.h" -#endif - -#ifndef __SHOP_SHOP_H__ -#include "shop\shop.h" -#endif - -#ifndef __BACKEND_GAMEOVER_H__ -#include "backend\gameover.h" -#endif - -#ifndef __MAP_MAP_H__ -#include "map\map.h" -#endif - -#ifndef __BACKEND_CREDITS_H__ -#include "backend\credits.h" -#endif - -#ifndef __PAUL_ANIMTEST_H__ -#include "paul\animtest.h" -#endif - -#ifndef __SAVE_SAVE_H__ -#include "save\save.h" -#endif - -#ifndef __GFX_FADER_H__ -#include "gfx\fader.h" +#ifndef __SOUND_SOUND_H__ +#include "sound\sound.h" #endif @@ -86,12 +45,6 @@ Tyepdefs && Defines ------------------- */ -// Uncomment this to make the selector automatically choose the default ( first ) scene -// You can still use L1&L2 to force the selection menu to appear -#if defined (__USER_art__)||defined (__USER_sbart__) -#define AUTOMATICALLY_CHOOSE_DEFAULT -#endif - /*---------------------------------------------------------------------- Structure defintions -------------------- */ @@ -104,22 +57,9 @@ Vars ---- */ -CScene *CSceneSelector::s_sceneList[]= -{ - &FrontEndScene, // First scene in the list is the default scene - &GameScene, - &GameOverScene, - &FmaScene, - &MapScene, - &ShopScene, - &CreditsScene, - &AnimTestScene, - &SaveScene, -}; -int CSceneSelector::s_sceneCount=sizeof(s_sceneList)/sizeof(CScene*); +CSceneSoundTest SoundTestScene; - -CSceneSelector SceneSelector; +static int s_soundId; /*---------------------------------------------------------------------- @@ -128,18 +68,15 @@ CSceneSelector SceneSelector; Params: Returns: ---------------------------------------------------------------------- */ -void CSceneSelector::init() +void CSceneSoundTest::init() { - m_font=new ("scene select font") FontBank(); + m_font=new ("scene select font") ScalableFontBank(); m_font->initialise(&standardFont); m_font->setJustification(FontBank::JUST_CENTRE); m_font->setOt(10); + m_font->setScale(400); - m_currentSelection=0; - m_state=STATE_INIT; - m_countdown=2; // Need a couple of frames for the pad handler to wake up.. - - CFader::setFadingIn(); + s_soundId=0; } @@ -149,7 +86,7 @@ void CSceneSelector::init() Params: Returns: ---------------------------------------------------------------------- */ -void CSceneSelector::shutdown() +void CSceneSoundTest::shutdown() { m_font->dump(); delete m_font; } @@ -161,33 +98,57 @@ void CSceneSelector::shutdown() Params: Returns: ---------------------------------------------------------------------- */ -void CSceneSelector::render() +void CSceneSoundTest::render() { - if(m_state==STATE_SELECTING) + POLY_F4 *f4; + char buf[20]; + + f4=GetPrimF4(); + setXYWH(f4,0,0,512,256); + setRGB0(f4,10,20,30); + AddPrimToList(f4,15); + + sprintf(buf,"%d",s_soundId); + m_font->print(256,80,buf); + m_font->print(256,140,"UP/DOWN - Select"); + m_font->print(256,160,"X - Play"); + + +} + + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CSceneSoundTest::think(int _frames) +{ + int padDown,padRepeat; + + padDown=PadGetDown(0); + padRepeat=PadGetRepeat(0); + + if(padRepeat&PAD_DOWN) { - POLY_F4 *f4; - int i; - - f4=GetPrimF4(); - setXYWH(f4,0,0,512,256); - setRGB0(f4,10,20,30); - AddPrimToList(f4,15); - - m_font->setColour(255,255,255); - m_font->print(256,50,"Select scene:"); - for(i=0;isetColour(100,255,100); - } - else - { - m_font->setColour(255,100,100); - } - m_font->print(256,80+(i*m_font->getCharHeight()),s_sceneList[i]->getSceneName()); + s_soundId=CSoundMediator::NUM_SFXIDS-1; } } + else if(padRepeat&PAD_UP) + { + if(++s_soundId==CSoundMediator::NUM_SFXIDS) + { + s_soundId=0; + } + } + + if(padDown&PAD_CROSS) + { + CSoundMediator::playSfx((CSoundMediator::SFXID)s_soundId); + } } @@ -197,87 +158,9 @@ void CSceneSelector::render() Params: Returns: ---------------------------------------------------------------------- */ -#include "pad\vibe.h" - -void CSceneSelector::think(int _frames) +int CSceneSoundTest::readyToShutdown() { -if(PadGetDown(0)&PAD_L1) CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_LONG_STROBEY); -if(PadGetDown(0)&PAD_L2) CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_LONG_STROBEY,127); - - switch(m_state) - { - case STATE_INIT: - { - if(--m_countdown==0) - { -#ifdef AUTOMATICALLY_CHOOSE_DEFAULT - int pad; - pad=PadGetHeld(0); - if(pad&(PAD_L1|PAD_L2)) - { - m_state=STATE_SELECTING; - } - else - { - m_state=STATE_SELECTED; - } -#else - m_state=STATE_SELECTING; -#endif - } - break; - } - - case STATE_SELECTING: - { - int pad; - pad=PadGetDown(0); - if(pad&PAD_UP) - { - if(--m_currentSelection==-1)m_currentSelection=s_sceneCount-1; - } - else if(pad&PAD_DOWN) - { - if(++m_currentSelection==s_sceneCount)m_currentSelection=0; - } - else if(pad&(PAD_CROSS|PAD_START)) - { - m_state=STATE_SELECTED; - } - break; - } - - case STATE_SELECTED: - { - selectScene(m_currentSelection); - m_state=STATE_READY_TO_EXIT; - break; - } - } -} - - -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -int CSceneSelector::readyToShutdown() -{ - return m_state==STATE_READY_TO_EXIT; -} - - -/*---------------------------------------------------------------------- - Function: - Purpose: - Params: - Returns: - ---------------------------------------------------------------------- */ -void CSceneSelector::selectScene(int _scene) -{ - GameState::setNextScene(s_sceneList[_scene]); + return false; } diff --git a/source/paul/sndtest.h b/source/paul/sndtest.h index 4a6192450..6fbd0369a 100644 --- a/source/paul/sndtest.h +++ b/source/paul/sndtest.h @@ -1,6 +1,6 @@ /*========================================================================= - scenesel.h + sndtest.h Author: PKG Created: @@ -11,8 +11,8 @@ ===========================================================================*/ -#ifndef __PAUL_SCENESEL_H__ -#define __PAUL_SCENESEL_H__ +#ifndef __PAUL_SNDTEST_H__ +#define __PAUL_SNDTEST_H__ /*---------------------------------------------------------------------- Includes @@ -34,7 +34,7 @@ Structure defintions -------------------- */ -class CSceneSelector : public CScene +class CSceneSoundTest : public CScene { public: void init(); @@ -42,28 +42,12 @@ public: void render(); void think(int _frames); int readyToShutdown(); - char *getSceneName() {return"SceneSelector";} + char *getSceneName() {return"SoundTest";} private: - enum - { - STATE_INIT, - STATE_SELECTING, - STATE_SELECTED, - STATE_READY_TO_EXIT, - }; - static class CScene *s_sceneList[]; - static int s_sceneCount; - int m_currentSelection; - int m_state; - int m_countdown; - - class FontBank *m_font; - - - void selectScene(int _scene); + class ScalableFontBank *m_font; }; @@ -72,7 +56,7 @@ private: Globals ------- */ -extern CSceneSelector SceneSelector; +extern CSceneSoundTest SoundTestScene; /*---------------------------------------------------------------------- @@ -81,7 +65,7 @@ extern CSceneSelector SceneSelector; /*---------------------------------------------------------------------- */ -#endif /* __PAUL_SCENESEL_H__ */ +#endif /* __PAUL_SNDTEST_H__ */ /*=========================================================================== end */ diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 462c0f6f2..da47d51c2 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1327,6 +1327,14 @@ SOURCE=..\..\..\source\paul\scenesel.cpp SOURCE=..\..\..\source\paul\scenesel.h # End Source File +# Begin Source File + +SOURCE=..\..\..\source\paul\sndtest.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\paul\sndtest.h +# End Source File # End Group # Begin Group "pickups"