- float alpha;
- if(timer.get_timegone() < FADING_TIME)
- alpha = (timer.get_timegone() * 1.0f / FADING_TIME);
- else if(timer.get_timeleft() < FADING_TIME)
- alpha = (timer.get_timeleft() * 1.0f / FADING_TIME);
- else
- alpha = 1.0f;
-
- context.push_transform();
- context.set_alpha(alpha);
-
- char caption_buf[128];
- char stat_buf[128];
- switch (display_stat)
- {
- case 0:
- snprintf(caption_buf, sizeof(caption_buf), _("Max coins collected:"));
- snprintf(stat_buf, sizeof(stat_buf), "%d/%d", coins, total_coins);
- break;
- case 1:
- snprintf(caption_buf, sizeof(caption_buf), _("Max fragging:"));
- snprintf(stat_buf, sizeof(stat_buf), "%d/%d", badguys, total_badguys);
- break;
- case 2:
- snprintf(caption_buf, sizeof(caption_buf), _("Min time needed:"));
- {
- int csecs = (int)(time * 100);
- int mins = (int)(csecs / 6000);
- int secs = (csecs % 6000) / 100;
- snprintf(stat_buf, sizeof(stat_buf), "%02d:%02d", mins,secs);
- }
- break;
- case 3:
- snprintf(caption_buf, sizeof(caption_buf), _("Max secrets found:"));
- snprintf(stat_buf, sizeof(stat_buf), "%d/%d", secrets, total_secrets);
- break;
- default:
- log_debug << "Invalid stat requested to be drawn" << std::endl;
- break;
- }
-
- if (!timer.started())
- {
- timer.start(TOTAL_DISPLAY_TIME);
- display_stat++;
- if (display_stat > 3) display_stat = 0;
+ std::string caption_buf;
+ std::string stat_buf;
+ float posy = WMAP_INFO_TOP_Y2;
+ for (int stat_no = 0; stat_no < 4; stat_no++) {
+ switch (stat_no)
+ {
+ case 0:
+ caption_buf = _("Max coins collected:");
+ stat_buf = coins_to_string(coins, total_coins);
+ break;
+ case 1:
+ caption_buf = _("Max fragging:");
+ stat_buf = frags_to_string(badguys, total_badguys);
+ break;
+ case 2:
+ caption_buf = _("Min time needed:");
+ stat_buf = time_to_string(time);
+ break;
+ case 3:
+ caption_buf = _("Max secrets found:");
+ stat_buf = secrets_to_string(secrets, total_secrets);
+ break;
+ default:
+ log_debug << "Invalid stat requested to be drawn" << std::endl;
+ break;
+ }
+
+ context.draw_text(white_small_text, caption_buf, Vector(WMAP_INFO_LEFT_X, posy), ALIGN_LEFT, LAYER_GUI);
+ context.draw_text(white_small_text, stat_buf, Vector(WMAP_INFO_RIGHT_X, posy), ALIGN_RIGHT, LAYER_GUI);
+ posy += white_small_text->get_height() + 2;