Merge remote-tracking branch 'origin/master' into network-items,

fixed conflicts.
This commit is contained in:
hiker
2018-06-08 10:55:14 +10:00
259 changed files with 7953 additions and 3205 deletions

View File

@@ -55,25 +55,28 @@
* \param init_pos The start coordinates and heading of the kart.
*/
LocalPlayerController::LocalPlayerController(AbstractKart *kart,
const int local_playerID)
const int local_player_id,
PerPlayerDifficulty d)
: PlayerController(kart), m_sky_particles_emitter(NULL)
{
m_player = StateManager::get()->getActivePlayer(local_playerID);
m_difficulty = d;
m_player = StateManager::get()->getActivePlayer(local_player_id);
if(m_player)
m_player->setKart(kart);
// Keep a pointer to the camera to remove the need to search for
// the right camera once per frame later.
Camera *camera = Camera::createCamera(kart, local_playerID);
Camera *camera = Camera::createCamera(kart, local_player_id);
m_camera_index = camera->getIndex();
m_wee_sound = SFXManager::get()->createSoundSource("wee");
m_bzzt_sound = SFXManager::get()->getBuffer("bzzt");
m_ugh_sound = SFXManager::get()->getBuffer("ugh");
m_grab_sound = SFXManager::get()->getBuffer("grab_collectable");
m_full_sound = SFXManager::get()->getBuffer("energy_bar_full");
m_unfull_sound = SFXManager::get()->getBuffer("energy_bar_unfull");
m_is_above_nitro_target = false;
// Attach Particle System
Track *track = Track::getCurrentTrack();
@@ -235,6 +238,10 @@ void LocalPlayerController::update(int ticks)
}
}
}
if (m_is_above_nitro_target == true &&
m_kart->getEnergy() < race_manager->getCoinTarget())
nitroNotFullSound();
#endif
if (m_kart->getKartAnimation() && m_sound_schedule == false)
{
@@ -341,9 +348,10 @@ void LocalPlayerController::collectedItem(const ItemState &item_state,
}
else if (race_manager->getCoinTarget() > 0 &&
old_energy < race_manager->getCoinTarget() &&
m_kart->getEnergy() == race_manager->getCoinTarget())
m_kart->getEnergy() >= race_manager->getCoinTarget())
{
m_kart->playSound(m_full_sound);
m_is_above_nitro_target = true;
}
else
{
@@ -367,6 +375,15 @@ void LocalPlayerController::collectedItem(const ItemState &item_state,
}
} // collectedItem
//-----------------------------------------------------------------------------
/** If the nitro level has gone under the nitro goal, play a bad effect sound
*/
void LocalPlayerController::nitroNotFullSound()
{
m_kart->playSound(m_unfull_sound);
m_is_above_nitro_target = false;
} //nitroNotFullSound
// ----------------------------------------------------------------------------
/** Returns true if the player of this controller can collect achievements.
* At the moment only the current player can collect them.
@@ -384,5 +401,10 @@ core::stringw LocalPlayerController::getName() const
{
if (NetworkConfig::get()->isNetworking())
return PlayerController::getName();
return m_player->getProfile()->getName();
core::stringw name = m_player->getProfile()->getName();
if (m_difficulty == PLAYER_DIFFICULTY_HANDICAP)
name = _("%s (handicapped)", name);
return name;
} // getName