Conflicts:
	data/achievements.xml
	src/achievements/achievement_info.hpp
This commit is contained in:
Marianne Gagnon 2014-03-18 19:16:43 -04:00
commit 4948f5acb2
3 changed files with 22 additions and 6 deletions

View File

@ -36,5 +36,9 @@
<follow_leader goal="1"/>
<opponents goal="3"/>
</achievement>
<achievement id="7" check-type="all-at-least" reset-after-race="yes"
title="Powerup Love" description="Use 10 or more powerups in a race">
<poweruplover goal="10"/>
</achievement>
</achievements>

View File

@ -33,11 +33,11 @@
class Achievement;
/** This is the base class for storing the definition of an achievement, e.g.
/** This is the base class for storing the definition of an achievement, e.g.
* title, description (which is common for all achievements), but also how
* to achieve this achievement.
* \ingroup achievements
*/
* \ingroup achievements
*/
class AchievementInfo
{
public:
@ -49,12 +49,13 @@ public:
ACHIEVE_MARATHONER = 4,
ACHIEVE_SKIDDING = 5,
ACHIEVE_GOLD_DRIVER = 6
ACHIEVE_POWERUP_LOVER = 7
};
/** Achievement check type:
/** Achievement check type:
* ALL_AT_LEAST: All goal values must be reached (or exceeded).
* ONE_AT_LEAST: At least one current value reaches or exceedes the goal.
*/
enum AchievementCheckType
enum AchievementCheckType
{
AC_ALL_AT_LEAST,
AC_ONE_AT_LEAST

View File

@ -18,6 +18,9 @@
#include "items/powerup.hpp"
#include "achievements/achievement_info.hpp"
#include "config/player_manager.hpp"
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "config/stk_config.hpp"
@ -170,6 +173,14 @@ void Powerup::adjustSound()
*/
void Powerup::use()
{
// The player gets an achievement point for using a powerup
StateManager::ActivePlayer * player = m_owner->getController()->getPlayer();
if (m_type != PowerupManager::POWERUP_NOTHING &&
player != NULL && player->getConstProfile() == PlayerManager::get()->getCurrentPlayer())
{
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_POWERUP_LOVER, "poweruplover");
}
// Play custom kart sound when collectible is used //TODO: what about the bubble gum?
if (m_type != PowerupManager::POWERUP_NOTHING &&
m_type != PowerupManager::POWERUP_SWATTER &&
@ -237,7 +248,7 @@ void Powerup::use()
m_sound_use->play();
pos.setY(hit_point.getY()-0.05f);
ItemManager::get()->newItem(Item::ITEM_BUBBLEGUM, pos, normal, m_owner);
}
else // if the kart is looking forward, use the bubblegum as a shield