~ubuntu-branches/ubuntu/precise/pingus/precise

« back to all changes in this revision

Viewing changes to src/level_result.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Goulais
  • Date: 2004-08-09 10:26:00 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040809102600-lg2q9lfars0q1p42
Tags: 0.6.0-8
Applied patch from Andreas Jochens (Closes: #263992)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  $Id: level_result.cxx,v 1.11 2003/04/08 19:56:40 torangan Exp $
 
2
//
 
3
//  Pingus - A free Lemmings clone
 
4
//  Copyright (C) 1999 Ingo Ruhnke <grumbel@gmx.de>
 
5
//
 
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.
 
10
//
 
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.
 
15
//
 
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.
 
19
 
 
20
#include <stdio.h>
 
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>
 
25
 
 
26
#include "gui/display.hxx"
 
27
#include "pingus_resource.hxx"
 
28
#include "level_result.hxx"
 
29
#include "sound/sound.hxx"
 
30
#include "world.hxx"
 
31
#include "pingu_holder.hxx"
 
32
#include "my_gettext.hxx"
 
33
 
 
34
PingusLevelResult::PingusLevelResult(World* w, Controller* c)
 
35
  : controller (c)
 
36
{
 
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");
 
40
  //result = r;
 
41
  world = w;
 
42
}
 
43
 
 
44
void
 
45
PingusLevelResult::draw(void)
 
46
{
 
47
  char  str[128];
 
48
 
 
49
  PingusSound::play_music("pingus-2.it");
 
50
 
 
51
  Display::hide_cursor();
 
52
 
 
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);
 
56
 
 
57
  CL_Display::fill_rect(0, 0, CL_Display::get_width(), CL_Display::get_height(), 0.0, 0.0, 0.0, 0.5);
 
58
  
 
59
  title->print_center(CL_Display::get_width() / 2, 50, _("Results:"));
 
60
  
 
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());
 
64
  */
 
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);
 
69
 
 
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);
 
75
 
 
76
  /*
 
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);
 
81
  */
 
82
 
 
83
  //font->print_center(CL_Display::get_width() / 2, 180, str);
 
84
 
 
85
  font->print_center(CL_Display::get_width()/2, CL_Display::get_height() - 80,
 
86
                     _("Press button to continue..."));
 
87
  Display::flip_display();
 
88
 
 
89
  while(!CL_Mouse::left_pressed())
 
90
    CL_System::keep_alive();
 
91
  
 
92
  while(CL_Mouse::left_pressed())
 
93
    CL_System::keep_alive();
 
94
}
 
95
 
 
96
std::string
 
97
PingusLevelResult::get_message (int saved)
 
98
{
 
99
  if (saved == 100) {
 
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.");
 
125
  } else {
 
126
    return _("You've got a negative save/total value, something is buggy.");
 
127
  }
 
128
}
 
129
 
 
130
/* EOF */