From 2c598e1731002d4766821a5c4ba7c611077ae9bc Mon Sep 17 00:00:00 2001 From: LMH Date: Sun, 1 Sep 2013 19:54:20 -1000 Subject: [PATCH] Using a reset point no longer marks statistics as invalid. 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). --- data/levels/world1/01 - Welcome to Antarctica.stl | 3 +-- src/supertux/game_session.cpp | 1 - src/supertux/statistics.cpp | 33 +++-------------------- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/data/levels/world1/01 - Welcome to Antarctica.stl b/data/levels/world1/01 - Welcome to Antarctica.stl index 73c57af21..3440892e7 100755 --- a/data/levels/world1/01 - Welcome to Antarctica.stl +++ b/data/levels/world1/01 - Welcome to Antarctica.stl @@ -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) ) diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp index 2ff948399..f843c5d53 100644 --- a/src/supertux/game_session.cpp +++ b/src/supertux/game_session.cpp @@ -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"); diff --git a/src/supertux/statistics.cpp b/src/supertux/statistics.cpp index 098ec8590..c749bd614 100644 --- a/src/supertux/statistics.cpp +++ b/src/supertux/statistics.cpp @@ -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) { @@ -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; @@ -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 -- 2.11.0