bonus(NO_BONUS),
max_fire_bullets(0),
max_ice_bullets(0),
+ max_air_time(0),
+ max_earth_time(0),
displayed_coins(DISPLAYED_COINS_UNSET),
displayed_coins_frame(0),
coin_surface()
void
PlayerStatus::add_coins(int count, bool play_sound)
{
- static float sound_played_time = 0;
coins = std::min(coins + count, MAX_COINS);
- if(play_sound) {
- if(count >= 100)
- SoundManager::current()->play("sounds/lifeup.wav");
- else if (real_time > sound_played_time + 0.010) {
- SoundManager::current()->play("sounds/coin.wav");
- sound_played_time = real_time;
- }
+
+ if(!play_sound)
+ return;
+
+ static float sound_played_time = 0;
+ if(count >= 100)
+ SoundManager::current()->play("sounds/lifeup.wav");
+ else if (real_time > sound_played_time + 0.010) {
+ SoundManager::current()->play("sounds/coin.wav");
+ sound_played_time = real_time;
}
}
case ICE_BONUS:
writer.write("bonus", "iceflower");
break;
+ case AIR_BONUS:
+ writer.write("bonus", "airflower");
+ break;
+ case EARTH_BONUS:
+ writer.write("bonus", "earthflower");
+ break;
default:
log_warning << "Unknown bonus type." << std::endl;
writer.write("bonus", "none");
}
writer.write("fireflowers", max_fire_bullets);
writer.write("iceflowers", max_ice_bullets);
+ writer.write("airflowers", max_air_time);
+ writer.write("earthflowers", max_earth_time);
writer.write("coins", coins);
}
bonus = FIRE_BONUS;
} else if(bonusname == "iceflower") {
bonus = ICE_BONUS;
+ } else if(bonusname == "airflower") {
+ bonus = AIR_BONUS;
+ } else if(bonusname == "earthflower") {
+ bonus = EARTH_BONUS;
} else {
log_warning << "Unknown bonus '" << bonusname << "' in savefile" << std::endl;
bonus = NO_BONUS;
}
lisp.get("fireflowers", max_fire_bullets);
lisp.get("iceflowers", max_ice_bullets);
+ lisp.get("airflowers", max_air_time);
+ lisp.get("earthflowers", max_earth_time);
lisp.get("coins", coins);
}