Removed traffic jam noise (played when a certain number of

collisions happend in a short time).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1373 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-01-07 00:53:22 +00:00
parent fbfec1c54f
commit e0a96abe15
8 changed files with 1 additions and 60 deletions

View File

@ -474,32 +474,6 @@ void Kart::doLapCounting ()
}
} // doLapCounting
//-----------------------------------------------------------------------------
void Kart::doObjectInteractions ()
{
int i;
// FIXME: a lot of work for the 'traffic jam' sound - perhaps just remove it?
for ( i = 0 ; i < m_grid_position ; i++ )
{
sgVec3 xyz ;
Kart *other_kart = world->getKart(i);
sgSubVec3(xyz, getCoord()->xyz, other_kart->getCoord()->xyz );
//FIXME
// the dist calculation is very very basic, and 1.1f is far too low
// must be from 2.4f to 3.0f
float dist = sgLengthSquaredVec3(xyz);
if ( dist < 1.1f )
{
// Avoid division by zero
if(dist>0.00001) sgNormalizeVec2(xyz) ;
world->addCollisions(m_grid_position, 1);
world->addCollisions(i, 1);
} // if sgLengthSquaredVec2(xy)<1.0
} // for i
} // doObjectInteractions
//-----------------------------------------------------------------------------
void Kart::collectedHerring(Herring* herring)
{
@ -657,7 +631,6 @@ void Kart::update (float dt)
} // for i<getNumWheels
} // if there is terrain and it's not a reset material
doObjectInteractions();
// Check if any herring was hit.
herring_manager->hitHerring(this);

View File

@ -244,7 +244,6 @@ public:
virtual void crashed () {};
virtual void doLapCounting ();
virtual void update (float dt );
virtual void doObjectInteractions();
};
class TrafficDriver : public Kart
@ -257,7 +256,6 @@ public:
sgCopyVec3 ( m_reset_pos.xyz, _pos ) ;
reset () ;
}
virtual void doObjectInteractions () ;
virtual void doLapCounting () ;
virtual void doZipperProcessing () ;
virtual void update (float delta) ;

View File

@ -101,7 +101,6 @@ SoundManager::SoundManager()
sfx = new SFXImpl("wavs/tintagel/pre_start_race.wav"); m_sfxs[SOUND_PRESTART] = sfx;
sfx = new SFXImpl("wavs/tintagel/start_race.wav"); m_sfxs[SOUND_START] = sfx;
sfx = new SFXImpl("wavs/radio/radarping.wav"); m_sfxs[SOUND_MISSILE_LOCK] = sfx;
sfx = new SFXImpl("wavs/radio/trafficjam.wav"); m_sfxs[SOUND_TRAFFIC_JAM] = sfx;
}
}

View File

@ -31,7 +31,7 @@ enum enumSFX {SOUND_UGH, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB,
SOUND_BACK_MENU, SOUND_USE_ANVIL, SOUND_USE_PARACHUTE,
SOUND_SELECT_MENU, SOUND_MOVE_MENU, SOUND_FULL,
SOUND_PRESTART, SOUND_START, SOUND_MISSILE_LOCK,
SOUND_TRAFFIC_JAM, NUM_SOUNDS};
NUM_SOUNDS};
class SoundManager
{

View File

@ -49,8 +49,6 @@ void TrafficDriver::update (float dt)
Kart::update (dt) ;
}
//-----------------------------------------------------------------------------
void TrafficDriver::doObjectInteractions () {}
//-----------------------------------------------------------------------------
void TrafficDriver::doLapCounting () {}
//-----------------------------------------------------------------------------

View File

@ -145,8 +145,6 @@ World::World(const RaceSetup& raceSetup_) : m_race_setup(raceSetup_)
} // for i
resetAllKarts();
m_number_collisions = new int[m_race_setup.getNumKarts()];
for(unsigned int i=0; i<m_race_setup.getNumKarts(); i++) m_number_collisions[i]=0;
#ifdef SSG_BACKFACE_COLLISIONS_SUPPORTED
//ssgSetBackFaceCollisions ( m_race_setup.mirror ) ;
@ -206,7 +204,6 @@ World::~World()
m_kart.clear();
projectile_manager->cleanup();
delete [] m_number_collisions;
delete m_physics;
sound_manager -> stopMusic();
@ -273,16 +270,6 @@ void World::update(float dt)
// replay-recording
m_clock += dt;
// Count the number of collision in the next 'FRAMES_FOR_TRAFFIC_JAM' frames.
// If a kart has more than one hit, play 'traffic jam' noise.
static int nCount=0;
const int FRAMES_FOR_TRAFFIC_JAM=20;
nCount++;
if(nCount==FRAMES_FOR_TRAFFIC_JAM)
{
for(unsigned int i=0; i<m_race_setup.getNumKarts(); i++) m_number_collisions[i]=0;
nCount=0;
}
if( getPhase() == FINISH_PHASE )
{
// Add times to highscore list. First compute the order of karts,
@ -344,18 +331,6 @@ void World::update(float dt)
/* Routine stuff we do even when paused */
callback_manager->update(dt);
// Check for traffic jam. The sound is played even if it's
// not a player kart - a traffic jam happens rarely anyway.
for(unsigned int i=0; i<m_race_setup.getNumKarts(); i++)
{
if(m_number_collisions[i]>1)
{
sound_manager->playSfx(SOUND_TRAFFIC_JAM);
nCount = FRAMES_FOR_TRAFFIC_JAM-1; // sets all fields to zero in next frame
break;
}
}
#ifdef HAVE_GHOST_REPLAY
// we start recording after START_PHASE, since during start-phase m_clock is incremented
// normally, but after switching to RACE_PHASE m_clock is set back to 0.0

View File

@ -92,7 +92,6 @@ public:
return m_kart[kartId];
}
unsigned int getNumKarts() const {return (int)m_kart.size(); }
void addCollisions(int kartNumber, int n) {m_number_collisions[kartNumber]+=n; }
/** Returns the phase of the game */
Phase getPhase() const { return m_phase; }
@ -109,7 +108,6 @@ public:
private:
Karts m_kart;
float m_finish_delay_start_time;
int* m_number_collisions;
Physics* m_physics;
float m_fastest_lap;
Kart* m_fastest_kart;

Binary file not shown.