Skip to content

Commit

Permalink
Using a reset point no longer marks statistics as invalid.
Browse files Browse the repository at this point in the history
The rationale for this change is as follows: stats should only be marked as invalid in cases of cheating, not normal game mechanics.  When a player uses a reset point, they typically gain no advantage over starting from the begining of a level since all of the collection stats are reset while time continues to count up.  Not displaying/recording statistics once a reset point is used has traditionally confused players (the fine print in one infoblock in the first level is easily missed/forgotten).  Also in the case of custom levels with incredible difficulty, stats are essentially never recorded making the levels even less fun.

In addition to this change, the fine print has been removed from the first level infoblock, and additional conditions were added to Statistics::merge to eliminate any stat that wanders above the total possible for the level.  Thus any programming mistake that allows stats to record values higher than possible (e.g. the dispenser issue recently fixed) are essentially hidden from players (and unfortunately harder for developers to find).
  • Loading branch information
LMH0013 committed Sep 2, 2013
1 parent 5298bef commit 5b54978
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
3 changes: 1 addition & 2 deletions data/levels/world1/01 - Welcome to Antarctica.stl
Expand Up @@ -77,8 +77,7 @@
(infoblock
(message (_ "-Checkpoints
!images/objects/resetpoints/bell-m.png
#Activate the checkpoint. If you die, you can retry the level from here.
Statistics are only recorded if you don't need to respawn at a checkpoint."))
#Activate the checkpoint. If you die, you can retry the level from here."))
(x 5360)
(y 864)
)
Expand Down
1 change: 0 additions & 1 deletion src/supertux/game_session.cpp
Expand Up @@ -113,7 +113,6 @@ GameSession::restart_level()
msg << "Couldn't find sector '" << reset_sector << "' for resetting tux.";
throw std::runtime_error(msg.str());
}
level->stats.declare_invalid();
currentsector->activate(reset_pos);
} else {
currentsector = level->get_sector("main");
Expand Down
33 changes: 3 additions & 30 deletions src/supertux/statistics.cpp
Expand Up @@ -59,32 +59,6 @@ Statistics::~Statistics()
{
}

/*
void
Statistics::parse(const Reader& reader)
{
reader.get("coins-collected", coins);
reader.get("coins-collected-total", total_coins);
reader.get("badguys-killed", badguys);
reader.get("badguys-killed-total", total_badguys);
reader.get("time-needed", time);
reader.get("secrets-found", secrets);
reader.get("secrets-found-total", total_secrets);
}
void
Statistics::write(lisp::Writer& writer)
{
writer.write("coins-collected", coins);
writer.write("coins-collected-total", total_coins);
writer.write("badguys-killed", badguys);
writer.write("badguys-killed-total", total_badguys);
writer.write("time-needed", time);
writer.write("secrets-found", secrets);
writer.write("secrets-found-total", total_secrets);
}
*/

void
Statistics::serialize_to_squirrel(HSQUIRRELVM vm)
{
Expand Down Expand Up @@ -170,10 +144,6 @@ Statistics::draw_worldmap_info(DrawingContext& context)
void
Statistics::draw_endseq_panel(DrawingContext& context, Statistics* best_stats, SurfacePtr backdrop)
{
// skip draw if level was never played
// TODO: do we need this?
if (coins == nv_coins) return;

// skip draw if stats were declared invalid
if (!valid) return;

Expand Down Expand Up @@ -265,11 +235,14 @@ Statistics::merge(const Statistics& s2)
if (!s2.valid) return;
coins = std::max(coins, s2.coins);
total_coins = s2.total_coins;
coins = std::min(coins, total_coins);
badguys = std::max(badguys, s2.badguys);
total_badguys = s2.total_badguys;
badguys = std::min(badguys, total_badguys);
time = std::min(time, s2.time);
secrets = std::max(secrets, s2.secrets);
total_secrets = s2.total_secrets;
secrets = std::min(secrets, total_secrets);
}

void
Expand Down

0 comments on commit 5b54978

Please sign in to comment.