projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- fixed warnings pointed out by Frank
[supertux.git]
/
src
/
sector.cpp
diff --git
a/src/sector.cpp
b/src/sector.cpp
index
35faf64
..
017eff7
100644
(file)
--- a/
src/sector.cpp
+++ b/
src/sector.cpp
@@
-45,7
+45,8
@@
Sector* Sector::_current = 0;
Sector::Sector()
Sector* Sector::_current = 0;
Sector::Sector()
- : gravity(10), player(0), solids(0), background(0), camera(0),
+ : end_sequence_animation_type(NONE_ENDSEQ_ANIM),
+ gravity(10), player(0), solids(0), background(0), camera(0),
currentmusic(LEVEL_MUSIC)
{
song_title = "Mortimers_chipdisko.mod";
currentmusic(LEVEL_MUSIC)
{
song_title = "Mortimers_chipdisko.mod";
@@
-86,6
+87,10
@@
Sector::parse(LispReader& lispreader)
} else if(token == "music") {
song_title = lisp_string(data);
load_music();
} else if(token == "music") {
song_title = lisp_string(data);
load_music();
+ } else if(token == "end-sequence-animation") {
+ std::string end_seq_anim = lisp_string(data);
+ if(end_seq_anim == "fireworks")
+ end_sequence_animation_type = FIREWORKS_ENDSEQ_ANIM;
} else if(token == "camera") {
if(camera) {
std::cerr << "Warning: More than 1 camera defined in sector.\n";
} else if(token == "camera") {
if(camera) {
std::cerr << "Warning: More than 1 camera defined in sector.\n";
@@
-184,6
+189,13
@@
Sector::parse_old_format(LispReader& reader)
add_object(background);
}
add_object(background);
}
+ std::string end_seq_anim;
+ reader.read_string("end-sequence-animation", end_seq_anim);
+ if(end_seq_anim == "fireworks")
+ end_sequence_animation_type = FIREWORKS_ENDSEQ_ANIM;
+// else
+// end_sequence_animation = NONE_ENDSEQ_ANIM;
+
std::string particlesystem;
reader.read_string("particle_system", particlesystem);
if(particlesystem == "clouds")
std::string particlesystem;
reader.read_string("particle_system", particlesystem);
if(particlesystem == "clouds")
@@
-656,7
+668,7
@@
Sector::add_score(const Vector& pos, int s)
{
global_stats.add_points(SCORE_STAT, s);
{
global_stats.add_points(SCORE_STAT, s);
- add_object(new Floating
Score
(pos, s));
+ add_object(new Floating
Text
(pos, s));
}
void
}
void
@@
-724,7
+736,7
@@
Sector::add_bullet(const Vector& pos, float xm, Direction dir)
else
throw std::runtime_error("wrong bullet type.");
add_object(new_bullet);
else
throw std::runtime_error("wrong bullet type.");
add_object(new_bullet);
-
+
SoundManager::get()->play_sound(IDToSound(SND_SHOOT));
return true;
SoundManager::get()->play_sound(IDToSound(SND_SHOOT));
return true;
@@
-783,6
+795,7
@@
Sector::trybreakbrick(const Vector& pos, bool small)
SoundManager::get()->play_sound(IDToSound(SND_DISTRO));
global_stats.add_points(SCORE_STAT, SCORE_DISTRO);
SoundManager::get()->play_sound(IDToSound(SND_DISTRO));
global_stats.add_points(SCORE_STAT, SCORE_DISTRO);
+ global_stats.add_points(COINS_COLLECTED_STAT, 1);
player_status.distros++;
return true;
}
player_status.distros++;
return true;
}
@@
-837,6
+850,7
@@
Sector::tryemptybox(const Vector& pos, Direction col_side)
add_bouncy_distro(Vector(posx, posy));
SoundManager::get()->play_sound(IDToSound(SND_DISTRO));
global_stats.add_points(SCORE_STAT, SCORE_DISTRO);
add_bouncy_distro(Vector(posx, posy));
SoundManager::get()->play_sound(IDToSound(SND_DISTRO));
global_stats.add_points(SCORE_STAT, SCORE_DISTRO);
+ global_stats.add_points(COINS_COLLECTED_STAT, 1);
player_status.distros++;
break;
player_status.distros++;
break;
@@
-894,7
+908,7
@@
Sector::trygrabdistro(const Vector& pos, int bounciness)
solids->change_at(pos, tile->next_tile);
SoundManager::get()->play_sound(IDToSound(SND_DISTRO));
solids->change_at(pos, tile->next_tile);
SoundManager::get()->play_sound(IDToSound(SND_DISTRO));
-
+
if (bounciness == BOUNCE)
{
add_bouncy_distro(Vector(((int)(pos.x + 1) / 32) * 32,
if (bounciness == BOUNCE)
{
add_bouncy_distro(Vector(((int)(pos.x + 1) / 32) * 32,
@@
-902,6
+916,7
@@
Sector::trygrabdistro(const Vector& pos, int bounciness)
}
global_stats.add_points(SCORE_STAT, SCORE_DISTRO);
}
global_stats.add_points(SCORE_STAT, SCORE_DISTRO);
+ global_stats.add_points(COINS_COLLECTED_STAT, 1);
player_status.distros++;
}
player_status.distros++;
}
@@
-980,3
+995,16
@@
Sector::get_music_type()
{
return currentmusic;
}
{
return currentmusic;
}
+
+int
+Sector::get_total_badguys()
+{
+ int total_badguys = 0;
+ for(GameObjects::iterator i = gameobjects_new.begin(); i != gameobjects_new.end(); ++i)
+ {
+ BadGuy* badguy = dynamic_cast<BadGuy*> (*i);
+ if(badguy)
+ total_badguys++;
+ }
+ return total_badguys;
+}