1
// $Id: level_result.cxx,v 1.11 2003/04/08 19:56:40 torangan Exp $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 1999 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
#include <ClanLib/Core/System/system.h>
22
#include <ClanLib/Display/Display/display.h>
23
#include <ClanLib/Display/Font/font.h>
24
#include <ClanLib/Display/Input/mouse.h>
26
#include "gui/display.hxx"
27
#include "pingus_resource.hxx"
28
#include "level_result.hxx"
29
#include "sound/sound.hxx"
31
#include "pingu_holder.hxx"
32
#include "my_gettext.hxx"
34
PingusLevelResult::PingusLevelResult(World* w, Controller* c)
37
font = PingusResource::load_font("Fonts/pingus_small","fonts");
38
title = PingusResource::load_font("Fonts/pingus","fonts");
39
background = PingusResource::load_surface("Textures/stone", "textures");
45
PingusLevelResult::draw(void)
49
PingusSound::play_music("pingus-2.it");
51
Display::hide_cursor();
53
for(int y = 0; y < CL_Display::get_height(); y += background.get_height())
54
for(int x = 0; x < CL_Display::get_width(); x += background.get_width())
55
background.put_screen(x, y);
57
CL_Display::fill_rect(0, 0, CL_Display::get_width(), CL_Display::get_height(), 0.0, 0.0, 0.0, 0.5);
59
title->print_center(CL_Display::get_width() / 2, 50, _("Results:"));
61
/* Ending messages are censored for the momement
62
font->print_center(CL_Display::get_width() / 2, 100,
63
get_message(100 * world->get_saved_pingus() / world->get_allowed_pingus()).c_str());
65
snprintf(str, 128, _("Pingus saved: %3d/%3d"),
66
world->get_pingus()->get_number_of_exited(),
67
world->get_pingus()->get_number_of_allowed());
68
font->print_center(CL_Display::get_width() / 2, 140, str);
70
snprintf(str, 128, _("Pingus killed: %3d/%3d"),
71
world->get_pingus()->get_number_of_allowed()
72
- world->get_pingus()->get_number_of_exited(),
73
world->get_pingus()->get_number_of_allowed());
74
font->print_center(CL_Display::get_width() / 2, 160, str);
77
snprintf(str, 128, _("Required Time: %2d:%2d:%2d"),
78
result.time / (60 * game_speed),
79
result.time / game_speed % 60,
80
(result.time * 100) / game_speed % 100);
83
//font->print_center(CL_Display::get_width() / 2, 180, str);
85
font->print_center(CL_Display::get_width()/2, CL_Display::get_height() - 80,
86
_("Press button to continue..."));
87
Display::flip_display();
89
while(!CL_Mouse::left_pressed())
90
CL_System::keep_alive();
92
while(CL_Mouse::left_pressed())
93
CL_System::keep_alive();
97
PingusLevelResult::get_message (int saved)
100
return _("As many Pingus escaped as entered the level. That's going to be hard to beat.... unless this game becomes pornographic.");
101
} else if (saved > 90) {
102
return _("Very impressive indeed.");
103
} else if (saved > 80) {
104
return _("Good work. Still room for improvement though.");
105
} else if (saved > 70) {
106
return _("Not too shabby, not too shabby at all.");
107
} else if (saved > 60) {
108
return _("That was OK, but Pingu life insurance premiums have just gotten more expensive.");
109
} else if (saved > 55) {
110
return _("Maybe this level calls for a different strategy.");
111
} else if (saved > 50) {
112
return _("Exactly half. Are you saving only the female ones?");
113
} else if (saved > 40) {
114
return _("If I were a Pingu, I never would have left that entrance.");
115
} else if (saved > 30) {
116
return _("Maybe you would feel more at home playing Quake.");
117
} else if (saved > 20) {
118
return _("Maybe this level calls for a different stratagy. Like attempting to save them, for example.");
119
} else if (saved > 10) {
120
return _("Ever considered a career as a Pingu exterminator?");
121
} else if (saved > 0) {
122
return _("You missed one! What's your excuse!?");
123
} else if (saved == 0) {
124
return _("Please reassure me that you hit the Armageddon button.");
126
return _("You've got a negative save/total value, something is buggy.");