This commit is contained in:
Paul 2001-06-01 18:59:33 +00:00
parent 6630244a6f
commit a7949471f1
23 changed files with 110 additions and 38 deletions

View File

@ -95,8 +95,8 @@ public:
// Kelp Token functions..
int getKelpTokenCollectedCount(unsigned int _chapter,unsigned int _level)
{
ASSERT(_chapter==NUM_CHAPTERS);
ASSERT(_level==NUM_LEVELS_WITH_SPATULAS+1);
ASSERT(_chapter<=NUM_CHAPTERS);
ASSERT(_level==NUM_LEVELS_WITH_SPATULAS);
int i,j,count;
count=0;
for(i=0;i<8;i++)
@ -112,15 +112,15 @@ public:
}
void collectKelpToken(unsigned int _chapter,unsigned int _level,unsigned int _token)
{
ASSERT(_chapter==NUM_CHAPTERS);
ASSERT(_level<=NUM_LEVELS_WITH_SPATULAS+1);
ASSERT(_chapter<=NUM_CHAPTERS);
ASSERT(_level==NUM_LEVELS_WITH_SPATULAS);
ASSERT(_token<=128);
m_kelpTokenCollectedFlags[_level][_token>>3]|=1<<(_token&7);
}
int isKelpTokenUncollected(unsigned int _chapter,unsigned int _level,unsigned int _token)
{
ASSERT(_chapter==NUM_CHAPTERS);
ASSERT(_level<=NUM_LEVELS_WITH_SPATULAS+1);
ASSERT(_chapter<=NUM_CHAPTERS);
ASSERT(_level<=NUM_LEVELS_WITH_SPATULAS);
ASSERT(_token<=128);
return (m_kelpTokenCollectedFlags[_level][_token>>3]>>(_token&7))&1?false:true;
}

View File

@ -50,6 +50,10 @@
#include "pickups\pspatula.h"
#endif
#ifndef __PICKUPS_PKELP_H__
#include "pickups\pkelp.h"
#endif
#ifndef __SOUND_SOUND_H__
#include "sound\sound.h"
#endif
@ -413,23 +417,35 @@ void CLevel::initThings(int _respawningLevel)
// Items
if (LevelHdr->ItemList)
{
DVECTOR pos;
int itemNumber;
sThingHdr *Hdr=(sThingHdr*)MakePtr(LevelHdr,LevelHdr->ItemList);
ItemCount=Hdr->Count;
ItemList=(sThingItem*)MakePtr(Hdr,sizeof(sThingHdr));
DVECTOR pos;
int spatNumber=0;
itemNumber=0;
for(int i=0;i<ItemCount;i++)
{
int createThisPickup;
int isSpat;
int isNumberedItem;
CBasePickup *newPickup;
createThisPickup=true;
isSpat=(PICKUP_TYPE)ItemList->Type==PICKUP__SPATULA;
if(isSpat&&CGameSlotManager::getSlotData()->isSpatulaUncollected(GameScene.getChapterNumber()-1,GameScene.getLevelNumber()-1,spatNumber)==false)
isNumberedItem=false;
if((PICKUP_TYPE)ItemList->Type==PICKUP__SPATULA)
{
createThisPickup=false;
isNumberedItem=true;
if(CGameSlotManager::getSlotData()->isSpatulaUncollected(GameScene.getChapterNumber()-1,GameScene.getLevelNumber()-1,itemNumber)==false)
{
createThisPickup=false;
}
}
else if((PICKUP_TYPE)ItemList->Type==PICKUP__KELP_TOKEN)
{
isNumberedItem=true;
if(CGameSlotManager::getSlotData()->isKelpTokenUncollected(GameScene.getChapterNumber()-1,GameScene.getLevelNumber()-1,itemNumber)==false)
{
createThisPickup=false;
}
}
if((PICKUP_TYPE)ItemList->Type==PICKUP__HELMET&&
@ -443,20 +459,47 @@ void CLevel::initThings(int _respawningLevel)
pos.vx=ItemList->Pos.X<<4;
pos.vy=ItemList->Pos.Y<<4;
newPickup=createPickup((PICKUP_TYPE)ItemList->Type,&pos);
if(isSpat)
if(isNumberedItem)
{
((CSpatulaPickup*)newPickup)->setSpatulaNumber(spatNumber);
if((PICKUP_TYPE)ItemList->Type==PICKUP__SPATULA)
{
((CSpatulaPickup*)newPickup)->setSpatulaNumber(itemNumber);
}
else if((PICKUP_TYPE)ItemList->Type==PICKUP__KELP_TOKEN)
{
((CKelpTokenPickup*)newPickup)->setTokenNumber(itemNumber);
}
else
{
ASSERT(0);
}
}
}
if(isSpat)
if(isNumberedItem)
{
spatNumber++;
itemNumber++;
}
ItemList++;
}
}
///////
{
int i;
DVECTOR pos={100,100};
for(i=PICKUP__BIG_HEALTH;i<PICKUP__MAX;i++)
{
if(i!=PICKUP__SPATULA&&i!=PICKUP__KELP_TOKEN&&i!=PICKUP__BALLOON_AND_SPATULA)
{
createPickup((PICKUP_TYPE)i,&pos);
pos.vx+=60;
}
}
}
///////
// Init actors (needs moving and tidying
int actorNum;
int platformNum;

View File

@ -219,9 +219,6 @@ void CMapScene::render()
SpriteBank *sb;
sMapLevelData *level;
int i;
sFrameHdr *fh;
DVECTOR pos;
POLY_FT4 *ft4;
char buf[100];
sb=CGameScene::getSpriteBank();
@ -230,10 +227,15 @@ void CMapScene::render()
// Render spatula/kelp counts and quest items
for(i=0;i<MAP_NUM_LEVELS_PER_CHAPTER;i++)
{
DVECTOR pos;
pos=s_mapLevelPositions[i];
if(!level->m_kelpWorldLevel)
{
sFrameHdr *fh;
POLY_FT4 *ft4;
// Normal level
m_font->setColour(253,251,67);
sprintf(buf,"%d/%d",CGameSlotManager::getSlotData()->getSpatulaCollectedCount(m_currentChapterSelection,i),level->m_spatulaOrTokenCounts);
@ -248,7 +250,7 @@ void CMapScene::render()
{
// Bonuse level
m_font->setColour(67,251,67);
sprintf(buf,"-");//"%d/%d",CGameSlotManager::getSlotData()->getKelpTokenCollectedCount(m_currentChapterSelection,i),level->m_spatulaOrTokenCounts);
sprintf(buf,"%d/%d",CGameSlotManager::getSlotData()->getKelpTokenCollectedCount(m_currentChapterSelection,i),level->m_spatulaOrTokenCounts);
}
m_font->print(pos.vx,pos.vy,buf);

View File

@ -117,7 +117,6 @@ DVECTOR CBalloonPickup::getSizeForPlacement()
void CBalloonPickup::collect(class CPlayer *_player)
{
_player->setMode(PLAYER_MODE_BALLOON);
CSoundMediator::playSfx(CSoundMediator::SFX_BALLOON_INFLATE);
CBaseWeaponPickup::collect(_player);
}

View File

@ -50,6 +50,8 @@ protected:
virtual void renderPickup(DVECTOR *_pos);
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_BALLOON_INFLATE;}
int m_sin;
};

View File

@ -43,6 +43,8 @@ public:
protected:
virtual int getWeaponSpriteFrame();
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__CORAL_BLOWER;}
};

View File

@ -49,6 +49,8 @@ protected:
virtual void renderPickup(DVECTOR *_pos);
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__JAMJAR_AMMO;}
int m_sin;
};

View File

@ -109,7 +109,6 @@ DVECTOR CGlassesPickup::getSizeForPlacement()
void CGlassesPickup::collect(class CPlayer *_player)
{
_player->giveGlasses();
CSoundMediator::playSfx(CSoundMediator::SFX_GLASSES_ON);
CBasePickup::collect(_player);
}

View File

@ -47,6 +47,8 @@ protected:
virtual void renderPickup(DVECTOR *_pos);
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_GLASSES_ON;}
int m_glint;
int m_glintRot;

View File

@ -101,7 +101,6 @@ void CHelmetPickup::collect(class CPlayer *_player)
{
_player->giveDivingHelmet();
CBasePickup::collect(_player);
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_DIVING_HELMET);
}
/*----------------------------------------------------------------------

View File

@ -184,6 +184,7 @@ void CBasePickup::collidedWith(CThing *_thisThing)
{
case TYPE_PLAYER:
collect((CPlayer*)_thisThing);
CSoundMediator::playSfx(sfxToPlayWhenCollected());
break;
default:
@ -339,6 +340,7 @@ void CBaseWeaponPickup::collidedWith(CThing *_thisThing)
(!m_dontAutoPickUpUntilPlayerMovesOffMe&&player->tryingToAutomaticallyPickupWeapon()))
{
collect(player);
CSoundMediator::playSfx(sfxToPlayWhenCollected());
}
else
{

View File

@ -22,6 +22,10 @@
#include "thing/thing.h"
#endif
#ifndef __SOUND_SOUND_H__
#include "sound\sound.h"
#endif
/* Std Lib
------- */
@ -88,7 +92,9 @@ protected:
virtual void collidedWith(CThing *_thisThing);
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__ANY_OTHER_ITEM;}
};
@ -123,6 +129,9 @@ protected:
int m_dontAutoPickUpUntilPlayerMovesOffMe;
int m_collidedWithPlayer;
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__POWER_UP_ITEM;}
};

View File

@ -46,6 +46,8 @@ protected:
virtual void renderPickup(DVECTOR *_pos);
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__JAMJAR_AMMO;}
int m_rattle;
};

View File

@ -108,7 +108,7 @@ DVECTOR CKelpTokenPickup::getSizeForPlacement()
void CKelpTokenPickup::collect(class CPlayer *_player)
{
CBasePickup::collect(_player);
// CGameSlotManager::getSlotData()->collectSpatula(GameScene.getChapterNumber(),GameScene.getLevelNumber(),m_spatulaNumber);
CGameSlotManager::getSlotData()->collectKelpToken(GameScene.getChapterNumber()-1,GameScene.getLevelNumber()-1,m_tokenNumber);
}
/*----------------------------------------------------------------------

View File

@ -48,6 +48,8 @@ protected:
virtual void renderPickup(DVECTOR *_pos);
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__SKILL_ITEM;}
int m_tokenNumber;
};

View File

@ -48,6 +48,8 @@ private:
virtual void thinkPickup(int _frames);
virtual void renderPickup(DVECTOR *_pos);
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__LEVEL_ITEM;}
int m_pingFrame;
int m_gfxFrame;

View File

@ -53,6 +53,8 @@ protected:
virtual void renderPickup(DVECTOR *_pos);
private:
virtual CSoundMediator::SFXID sfxToPlayWhenCollected(){return CSoundMediator::SFX_ITEM__SKILL_ITEM;}
int m_glint;
int m_glintRot;
int m_spatulaNumber;

View File

@ -96,8 +96,6 @@ static const int s_jumpEndCount=sizeof(s_jumpEndSfx)/sizeof(CPlayer::AnimFrameSf
// ANIM_PLAYER_ANIM_KARATE
static const CPlayer::AnimFrameSfx s_karateSfx[]=
{
{ 12, CSoundMediator::SFX_SPONGEBOB_WALK_1 },
{ 13, CSoundMediator::SFX_SPONGEBOB_WALK_2 },
{ 13, CSoundMediator::SFX_SPONGEBOB_KARATE_1 },
};
static const int s_karateCount=sizeof(s_karateSfx)/sizeof(CPlayer::AnimFrameSfx);

View File

@ -679,6 +679,7 @@ void CPlayer::shutdown()
static int oldmode=-1;
int newmode=-1;
void CPlayer::think(int _frames)
{
int i;
@ -1016,11 +1017,20 @@ if(newmode!=-1)
if(isWearingDivingHelmet()&&getIsInWater()==false&&
m_currentMode!=PLAYER_MODE_DEAD&&m_currentMode!=PLAYER_MODE_FLY)
{
// Drain water/health
m_healthWaterLevel-=waterDrainSpeed*_frames;
if(m_healthWaterLevel<=0)
{
dieYouPorousFreak(DEATHTYPE__DRYUP);
}
// Breath sound
m_helmetSoundTimer+=_frames;
if(m_helmetSoundTimer>150+(m_healthWaterLevel>>WATERLEVELSHIFT))
{
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_DIVING_HELMET);
m_helmetSoundTimer=0;
}
}
// Ledge look-ahead stuff
@ -1305,14 +1315,6 @@ if(drawlastpos)
CGameScene::getSpriteBank()->printFT4(fh,x-2,y-2,0,0,0);
itemX+=COLLECTEDITEM_GAP;
}
/*
if(isWearingDivingHelmet())
{
sFrameHdr *fh=CGameScene::getSpriteBank()->getFrameHeader(FRM__HELMET);
CGameScene::getSpriteBank()->printFT4(fh,itemX-(fh->W/2),COLLECTEDITEM_BASEY-(fh->H/2),0,0,0);
itemX+=COLLECTEDITEM_GAP;
}
*/
}
@ -1675,6 +1677,7 @@ void CPlayer::respawn()
m_healthWaterLevel=WATERMAXHEALTH;
m_healthReactFrames=0;
m_invincibleFrameCount=INVINCIBLE_FRAMES__START;
m_helmetSoundTimer=0;
Pos=m_respawnPos;
m_cameraLookOffset=0;
@ -2183,6 +2186,7 @@ u32 CPlayer::getColourOfNextJellyfishAmmo()
---------------------------------------------------------------------- */
void CPlayer::justButtBouncedABadGuy()
{
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_BUTTBOUNCE);
m_currentPlayerModeClass->setState(STATE_BUTTBOUNCEUP);
}

View File

@ -327,6 +327,8 @@ private:
int m_health;
int m_healthWaterLevel;
int m_healthReactFrames;
int m_helmetSoundTimer; // Timer for breathing sound when using the helmet
void dieYouPorousFreak(DEATH_TYPE _deathType=DEATHTYPE__NORMAL);
DEATH_TYPE m_deathType;
@ -383,7 +385,7 @@ public:
int getJellyFishAmmo();
u32 getColourOfNextJellyfishAmmo();
void setIsInWater(int _in) {m_isInWater=_in;}
void setIsInWater(int _in) {m_isInWater=_in;m_helmetSoundTimer=0;}
int getIsInWater() {return m_isInWater;}
int getIsHealthFullSoICanStopSoakingUp() {return m_healthWaterLevel==WATERMAXHEALTH;}
int getIsHealthSoFullThatIDontNeedToSoakUp(){return m_healthWaterLevel>=WATERMINSOACKUPLEVEL;}

View File

@ -67,7 +67,6 @@
void CPlayerModeBubbleMixture::enter()
{
CPlayerModeBase::enter();
CSoundMediator::playSfx(CSoundMediator::SFX_BUBBLE_WAND);
m_blowing=false;
m_bubbleDelay=0;
m_player->giveBubbleAmmo();

View File

@ -162,7 +162,6 @@ void CPlayerModeCoralBlower::enter()
{
CPlayerModeBase::enter();
m_blowerState=BLOWER_STATE__EMPTY;
CSoundMediator::playSfx(CSoundMediator::SFX_ITEM__CORAL_BLOWER);
}
/*----------------------------------------------------------------------

View File

@ -293,6 +293,7 @@ void CSoundMediator::initialise()
s_targetVolume[i]=INITIAL_VOLUME;
s_volumeDirty[i]=true;
}
s_targetVolume[VOL_SONG]=32;
ASSERT(CXAStream::MIN_VOLUME==0); // Just incase someone decides to change any of these.. things in here will break ( PKG )
ASSERT(CXAStream::MAX_VOLUME==32767);