Commit af651999 authored by Gerstrong's avatar Gerstrong

Walking sound now works correctly and in all levels

parent a57d3502
......@@ -13,7 +13,8 @@
const unsigned char SndSlotMapGalaxy[]=
{
52,52,
//52,52,
0,1,
28,7,
23,20,
15,
......
......@@ -28,6 +28,7 @@ m_Cheatmode(Cheatmode),
mp_processState(NULL)
{
m_index = 0;
m_walktimer = 0;
m_timer = 0;
m_dying = false;
m_hDir = facedir;
......@@ -200,6 +201,24 @@ void CPlayerBase::processLevelMiscFlagsCheck()
const int MAX_WALKSOUNDTIMER = 20;
void CPlayerBase::makeWalkSound()
{
const int time = m_walktimer % MAX_WALKSOUNDTIMER;
// Process walk timer. This is only for the walking sound
if( time == MAX_WALKSOUNDTIMER/2 )
playSound( SOUND_KEEN_WALK2 );
else if( time == 0 )
playSound( SOUND_KEEN_WALK );
m_walktimer++;
}
void CPlayerBase::processDead()
{
......
......@@ -55,6 +55,13 @@ public:
void processLevelMiscFlagsCheck();
/**
* Produces the walking sound. To produce that sound correctly, it uses a special timer.
* That's the reason we need that aiding function
*/
void makeWalkSound();
void processDead();
void processDying();
void kill();
......@@ -74,6 +81,9 @@ protected:
stCheat& m_Cheatmode;
void (CPlayerBase::*mp_processState)();
private:
unsigned char m_walktimer;
};
};
......
......@@ -938,7 +938,13 @@ void CPlayerLevel::processPoleClimbing()
}
l_y_up = getYUpPos()+(16<<STC);
// Check for the and upper lower side, upper because the hand can touch the edge in that case
if(!hitdetectWithTileProperty(1, l_x, l_y_down))
solid = true;
else
solid = false;
// Check for the and upper and lower side, upper because the hand can touch the edge in that case
if( hitdetectWithTileProperty(1, l_x, l_y_down) || hitdetectWithTileProperty(1, l_x, l_y_up) )
{
// Slide down if there is more of the pole
......@@ -949,12 +955,21 @@ void CPlayerLevel::processPoleClimbing()
{
// Fall down if there isn't any pole to slide down
m_climbing = false;
setAction(A_KEEN_FALL);
playSound( SOUND_KEEN_FALL );
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processFalling;
m_vDir = NONE;
yinertia = 0;
solid = true;
if(!blockedd)
{
setAction(A_KEEN_FALL);
playSound( SOUND_KEEN_FALL );
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processFalling;
}
else
{
setAction(A_KEEN_STAND);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processStanding;
}
}
}
else
......@@ -1133,6 +1148,7 @@ void CPlayerLevel::processShootWhileStanding()
void CPlayerLevel::processRunning()
{
// Most of the walking routine is done by the action script itself
......@@ -1147,7 +1163,7 @@ void CPlayerLevel::processRunning()
setAction(A_KEEN_STAND);
}
// or he could change the walking direction
else if( m_playcontrol[PA_X]<0 ) // left
else if( m_playcontrol[PA_X]<0 ) // left
{
// Is he blocked make him stand, else continue walking
if( blockedl )
......@@ -1159,10 +1175,10 @@ void CPlayerLevel::processRunning()
{
// walk to the left
m_hDir = LEFT;
playSound( SOUND_KEEN_WALK2 );
makeWalkSound();
}
}
else if( m_playcontrol[PA_X]>0 ) // right
else if( m_playcontrol[PA_X]>0 ) // right
{
// Is he blocked make him stand, else continue walking
if( blockedr )
......@@ -1174,7 +1190,7 @@ void CPlayerLevel::processRunning()
{
// walk to the right
m_hDir = RIGHT;
playSound( SOUND_KEEN_WALK2 );
makeWalkSound();
}
}
......@@ -1209,6 +1225,10 @@ void CPlayerLevel::processRunning()
{
m_ObjectPtrs.push_back(new CBullets(mp_Map, newx, newy, m_hDir));
}
else
{
playSound(SOUND_GUN_CLICK);
}
setAction(A_KEEN_SHOOT);
mp_processState = (void (CPlayerBase::*)()) &CPlayerLevel::processShootWhileStanding;
......
......@@ -234,8 +234,6 @@ private:
int m_fire_recharge_time;
bool m_EnterDoorAttempt;
//void (CPlayerLevel::*mp_processState)();
};
}
......
......@@ -265,6 +265,7 @@ void CPlayerWM::performWalkingAnimation(bool walking)
{
m_animation_time = 5;
sprite += m_animation%3;
makeWalkSound();
}
else
sprite += 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment