This commit is contained in:
parent
7305dd575f
commit
499849fae1
6 changed files with 91 additions and 15 deletions
|
@ -135,7 +135,8 @@ pad_src := pads
|
|||
paul_src := paul \
|
||||
scenesel
|
||||
|
||||
player_src := player \
|
||||
player_src := panimsfx \
|
||||
player \
|
||||
pmodes \
|
||||
psbutt \
|
||||
pschop \
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
Author: PKG
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
Purpose: Handles automatically generated sound effects based upon anim frames
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
|
@ -70,6 +70,7 @@ static const int s_buttBounceEndCount=sizeof(s_buttBounceEndSfx)/sizeof(CPlayer:
|
|||
// ANIM_PLAYER_ANIM_IDLEHOOLA
|
||||
// ANIM_PLAYER_ANIM_IDLELOOK
|
||||
// ANIM_PLAYER_ANIM_IDLEWIGGLEARM
|
||||
|
||||
// ANIM_PLAYER_ANIM_JUMPEND
|
||||
static CPlayer::AnimFrameSfx s_jumpEndSfx[]=
|
||||
{
|
||||
|
@ -78,7 +79,13 @@ static CPlayer::AnimFrameSfx s_jumpEndSfx[]=
|
|||
};
|
||||
static const int s_jumpEndCount=sizeof(s_jumpEndSfx)/sizeof(CPlayer::AnimFrameSfx);
|
||||
|
||||
// ANIM_PLAYER_ANIM_KARATE
|
||||
// ANIM_PLAYER_ANIM_KARATE Might have to go into the CPlayerStateChop::enter code (PKG)
|
||||
static CPlayer::AnimFrameSfx s_chopSfx[]=
|
||||
{
|
||||
{ 1, CSoundMediator::SFX_SPONGEBOB_KARATE_1, },
|
||||
};
|
||||
static const int s_chopCount=sizeof(s_chopSfx)/sizeof(CPlayer::AnimFrameSfx);
|
||||
|
||||
// ANIM_PLAYER_ANIM_KNOCKBACK
|
||||
// ANIM_PLAYER_ANIM_KNOCKFORWARD
|
||||
|
||||
|
@ -111,6 +118,9 @@ static const int s_runStopCount=sizeof(s_runStopSfx)/sizeof(CPlayer::AnimFrameSf
|
|||
|
||||
|
||||
|
||||
|
||||
// This is the table that ties up anims to sfx
|
||||
// CPlayer::setAnimFrame() uses this table to generate sfx based upon anim frames
|
||||
CPlayer::AnimSfx CPlayer::s_animSfx[]=
|
||||
{
|
||||
{ s_buttBounceEndCount, s_buttBounceEndSfx }, // ANIM_PLAYER_ANIM_BUTTBOUNCEEND
|
||||
|
@ -137,7 +147,7 @@ CPlayer::AnimSfx CPlayer::s_animSfx[]=
|
|||
{ 0, NULL }, // ANIM_PLAYER_ANIM_IDLELOOK
|
||||
{ 0, NULL }, // ANIM_PLAYER_ANIM_IDLEWIGGLEARM
|
||||
{ s_jumpEndCount, s_jumpEndSfx }, // ANIM_PLAYER_ANIM_JUMPEND
|
||||
{ 0, NULL }, // ANIM_PLAYER_ANIM_KARATE
|
||||
{ s_chopCount, s_chopSfx }, // ANIM_PLAYER_ANIM_KARATE
|
||||
{ 0, NULL }, // ANIM_PLAYER_ANIM_KNOCKBACK
|
||||
{ 0, NULL }, // ANIM_PLAYER_ANIM_KNOCKFORWARD
|
||||
{ s_runCount, s_runSfx }, // ANIM_PLAYER_ANIM_RUN
|
||||
|
|
|
@ -438,13 +438,45 @@ void CPlayer::setFacing(int _facing)
|
|||
m_skel.setDir(_facing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayer::getAnimFrame()
|
||||
{
|
||||
return m_animFrame;
|
||||
}
|
||||
void CPlayer::setAnimFrame(int _animFrame)
|
||||
{
|
||||
AnimSfx *sfx;
|
||||
|
||||
m_animFrame=_animFrame;
|
||||
|
||||
// Are there any sfx for this frame?
|
||||
sfx=&s_animSfx[m_animNo];
|
||||
if(sfx->m_numAnimFrameSfx)
|
||||
{
|
||||
AnimFrameSfx *frameSfx;
|
||||
int i;
|
||||
|
||||
frameSfx=sfx->m_animFrameSfx;
|
||||
for(i=0;i<sfx->m_numAnimFrameSfx;i++)
|
||||
{
|
||||
if(m_animFrame==frameSfx->m_frame)
|
||||
{
|
||||
CSoundMediator::playSfx(frameSfx->m_sfxId);
|
||||
}
|
||||
if(m_animFrame<frameSfx->m_frame)
|
||||
{
|
||||
break;
|
||||
}
|
||||
frameSfx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
int CPlayer::getAnimFrameCount()
|
||||
{
|
||||
|
@ -459,6 +491,14 @@ void CPlayer::setAnimNo(int _animNo)
|
|||
m_animNo=_animNo;
|
||||
m_animFrame=0;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
DVECTOR CPlayer::getMoveVelocity()
|
||||
{
|
||||
return m_moveVel;
|
||||
|
@ -471,6 +511,14 @@ DVECTOR CPlayer::getPlayerPos()
|
|||
{
|
||||
return Pos;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int CPlayer::getPadInputHeld()
|
||||
{
|
||||
return m_padInput;
|
||||
|
@ -480,21 +528,12 @@ int CPlayer::getPadInputDown()
|
|||
return m_padInputDown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int CPlayer::isOnSolidGround()
|
||||
{
|
||||
return Pos.vy>23*16;//16*15;
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
#include "player\pstates.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SOUND_SOUND_H__
|
||||
#include "sound\sound.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -162,14 +166,26 @@ friend class CPlayerState;
|
|||
|
||||
|
||||
private:
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PlayerMetrics m_metrics;
|
||||
class CPlayerState *m_states[NUM_STATES];
|
||||
}PlayerMode;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
typedef struct
|
||||
{
|
||||
int m_frame;
|
||||
CSoundMediator::SFXID m_sfxId;
|
||||
} AnimFrameSfx;
|
||||
private:
|
||||
typedef struct
|
||||
{
|
||||
int m_numAnimFrameSfx;
|
||||
struct AnimFrameSfx *m_animFrameSfx;
|
||||
} AnimSfx;
|
||||
static AnimSfx s_animSfx[];
|
||||
int m_animFrame;
|
||||
int m_animNo;
|
||||
CSkel m_skel;
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
#include "pad\pads.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SOUND_SOUND_H__
|
||||
#include "sound\sound.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -72,6 +76,8 @@ void CPlayerStateJump::enter(CPlayer *_player)
|
|||
DVECTOR move=getMoveVelocity(_player);
|
||||
move.vy=-metrics->m_metric[PM__JUMP_VELOCITY]<<CPlayer::VELOCITY_SHIFT;
|
||||
setMoveVelocity(_player,&move);
|
||||
|
||||
CSoundMediator::playSfx(CSoundMediator::SFX_SPONGEBOB_JUMP);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -629,6 +629,10 @@ SOURCE=..\..\..\source\paul\scenesel.h
|
|||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\player\panimsfx.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\player\player.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue