pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src pingus_main.cxx,1.54,1.55 result.hxx


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src pingus_main.cxx,1.54,1.55 result.hxx,1.6,1.7 result_screen.cxx,1.4,1.5 result_screen.hxx,1.1,1.2 start_screen.cxx,1.2,1.3 stat_manager.cxx,1.2,1.3
Date: 28 Mar 2003 16:16:02 -0000

Update of /var/lib/cvs/Games/Pingus/src
In directory dark:/tmp/cvs-serv30830/src

Modified Files:
        pingus_main.cxx result.hxx result_screen.cxx result_screen.hxx 
        start_screen.cxx stat_manager.cxx 
Log Message:
experimental stuff

Index: pingus_main.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/pingus_main.cxx,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- pingus_main.cxx     28 Mar 2003 13:06:55 -0000      1.54
+++ pingus_main.cxx     28 Mar 2003 16:16:00 -0000      1.55
@@ -612,11 +612,10 @@
   std::list<std::string> file_list;
 
   file_list.push_back ("data/core.scr");
-  file_list.push_back ("images/core/misc/404.png");
 
   if (!path_manager.find_path (file_list))
     {
-      std::cout << "Error: Couldn't find `data/core.scr', please set the 
enviroment variable\n"
+      std::cout << "Error: Couldn't find 'data/core.scr', please set the 
enviroment variable\n"
                << "PINGUS_DATADIR to the path of the file `data/core.scr' or 
use the\n"
                << "-d option." << std::endl;
       exit(EXIT_FAILURE);

Index: result.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/result.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- result.hxx  16 Mar 2003 22:54:32 -0000      1.6
+++ result.hxx  28 Mar 2003 16:16:00 -0000      1.7
@@ -46,6 +46,10 @@
   
   /** Number of Pingus needed to save */
   int needed;
+
+  bool success() {
+    return (saved >= needed);
+  }
 };
 
 #endif

Index: result_screen.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/result_screen.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- result_screen.cxx   25 Mar 2003 00:37:44 -0000      1.4
+++ result_screen.cxx   28 Mar 2003 16:16:00 -0000      1.5
@@ -18,21 +18,27 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <iostream>
+#include "my_gettext.hxx"
 #include "gui/surface_button.hxx"
 #include "gui/gui_manager.hxx"
 #include "gui/screen_manager.hxx"
 #include "res_descriptor.hxx"
+#include "pingus_resource.hxx"
 #include "fonts.hxx"
 #include "plf.hxx"
 #include "string_converter.hxx"
 #include "game_session.hxx"
 #include "system.hxx"
+#include "sound/sound.hxx"
 #include "result_screen.hxx"
 
 class ResultScreenComponent : public GUI::Component
 {
 public:
   Result result;
+  CL_Surface background;
+
+  std::vector<CL_Surface> chalk_pingus;
 
   ResultScreenComponent(Result arg_result);
   void draw(GraphicContext& gc) ;
@@ -80,36 +86,49 @@
 ResultScreenComponent::ResultScreenComponent(Result arg_result)
   : result(arg_result)
 {
+  background = PingusResource::load_surface("menu/startscreenbg", "core");
+
+  chalk_pingus.push_back(PingusResource::load_surface("misc/chalk_pingu1", 
"core"));
+  chalk_pingus.push_back(PingusResource::load_surface("misc/chalk_pingu2", 
"core"));
+  chalk_pingus.push_back(PingusResource::load_surface("misc/chalk_pingu3", 
"core"));
+  chalk_pingus.push_back(PingusResource::load_surface("misc/chalk_pingu4", 
"core"));
 }
 
 void
 ResultScreenComponent::draw(GraphicContext& gc) 
 {
-  gc.clear(.0f, .0f, .0f);
-  gc.print_center(Fonts::pingus_large, gc.get_width()/2, 20, "Results for ");
-  gc.print_center(Fonts::pingus_large, gc.get_width()/2, 70, "\"" + 
System::translate(result.plf->get_levelname()) + "\"");
+  gc.draw(background, 0, 0);
+  gc.print_center(Fonts::chalk_large, gc.get_width()/2, 100, 
System::translate(result.plf->get_levelname()));
+  gc.print_left(Fonts::chalk_large, 150, 180, _("Results:"));
 
-  gc.print_left(Fonts::pingus_small, 100, 180, "Saved: ");
-  gc.print_left(Fonts::pingus_small, 200, 180, to_string(result.saved));
-  gc.print_left(Fonts::pingus_small, 100, 210, "Killed: ");    
-  gc.print_left(Fonts::pingus_small, 200, 210, to_string(result.killed));
+  gc.print_left(Fonts::chalk_small, 150, 280, "Saved: ");
+  for (int i = 0; i < result.saved; ++i)
+    {
+      gc.draw(chalk_pingus[rand() % chalk_pingus.size()], 230 + i * 15, 210);
+    }
+  gc.print_left(Fonts::chalk_small, 650, 280, to_string(result.saved));
 
-  gc.print_left(Fonts::pingus_small, 100, 240, "Needed: ");    
-  gc.print_left(Fonts::pingus_small, 200, 240, to_string(result.needed));
+  gc.print_left(Fonts::chalk_small, 150, 310, "Killed: ");    
+  gc.print_left(Fonts::chalk_small, 250, 310, to_string(result.killed));
 
-  gc.print_left(Fonts::pingus_small, 100, 270, "Time left: ");    
+
+  gc.print_left(Fonts::chalk_small, 150, 340, "Needed: ");    
+  gc.print_left(Fonts::chalk_small, 250, 340, to_string(result.needed));
+
+  gc.print_left(Fonts::chalk_small, 150, 370, "Time left: ");    
   if (result.max_time == -1)
-    gc.print_left(Fonts::pingus_small, 200, 270, "-");
+    gc.print_left(Fonts::chalk_small, 250, 370, "-");
   else
-    gc.print_left(Fonts::pingus_small, 200, 270, to_string(result.max_time - 
result.used_time));
+    gc.print_left(Fonts::chalk_small, 250, 370, to_string(result.max_time - 
result.used_time));
 
-  if (result.saved >= result.needed)
-    gc.print_center(Fonts::pingus_large, gc.get_width()/2, 350, "Success! 
=:-)");
+  if (result.success())
+    gc.print_center(Fonts::chalk_large, gc.get_width()/2, 450, "Success! 
=:-)");
   else
-    gc.print_center(Fonts::pingus_large, gc.get_width()/2, 350, "Failure! 
:-(");
+    gc.print_center(Fonts::chalk_large, gc.get_width()/2, 450, "Failure! :-(");
 }
 
-ResultScreen::ResultScreen(Result result)
+ResultScreen::ResultScreen(Result arg_result)
+  : result(arg_result)
 {
   ResDescriptor ok_desc("result/ok", "core", ResDescriptor::RD_RESOURCE);
   ResDescriptor cancel_desc("result/retry", "core", 
ResDescriptor::RD_RESOURCE);
@@ -119,6 +138,19 @@
   gui_manager->add(new ResultScreenOkButton());
   gui_manager->add(new ResultScreenRetryButton(comp));
   //gui_manager->add(new GUI::SurfaceButton(500, 500, cancel_desc, 
cancel_desc, cancel_desc));
+}
+
+void
+ResultScreen::on_startup()
+{
+  if (result.success())
+    {
+      PingusSound::play_music("success_1.it");
+    }
+  else
+    {
+      PingusSound::play_music("pingus-2.it");
+    }
 }
 
 /* EOF */

Index: result_screen.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/result_screen.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- result_screen.hxx   10 Mar 2003 11:29:49 -0000      1.1
+++ result_screen.hxx   28 Mar 2003 16:16:00 -0000      1.2
@@ -27,8 +27,11 @@
 class ResultScreen : public GUIScreen
 {
 private:
+  Result result;
 public:
   ResultScreen(Result result);
+  void on_startup();
+
 private:
   ResultScreen (const ResultScreen&);
   ResultScreen& operator= (const ResultScreen&);

Index: start_screen.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/start_screen.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- start_screen.cxx    25 Mar 2003 00:37:44 -0000      1.2
+++ start_screen.cxx    28 Mar 2003 16:16:00 -0000      1.3
@@ -22,6 +22,7 @@
 #include "gui/surface_button.hxx"
 #include "gui/component.hxx"
 #include "gui/screen_manager.hxx"
+#include "my_gettext.hxx"
 #include "game_session.hxx"
 #include "globals.hxx"
 #include "string_converter.hxx"
@@ -89,19 +90,19 @@
   gc.print_center(Fonts::chalk_large, gc.get_width()/2, 100, 
System::translate(plf->get_levelname()));
   gc.print_center(Fonts::chalk_normal, gc.get_width()/2, 160, 
System::translate(plf->get_description()));
 
-  gc.print_left(Fonts::chalk_normal, 250, 250, "Number of Pingus: " + 
to_string(plf->get_pingus()));
-  gc.print_left(Fonts::chalk_normal, 250, 280, "Number to Save: " + 
to_string(plf->get_number_to_save()));
-  gc.print_left(Fonts::chalk_normal, 250, 310, "Time: " + 
to_string(plf->get_time()));
+  gc.print_left(Fonts::chalk_normal, 250, 250, _("Number of Pingus: ") + 
to_string(plf->get_pingus()));
+  gc.print_left(Fonts::chalk_normal, 250, 280, _("Number to Save: ") + 
to_string(plf->get_number_to_save()));
+  gc.print_left(Fonts::chalk_normal, 250, 310, _("Time: ") + 
to_string(plf->get_time()));
   
-  gc.print_left(Fonts::chalk_normal, 250, 340, "Difficulty: 
lllllllllll|||||||||");
+  gc.print_left(Fonts::chalk_normal, 250, 340, _("Difficulty:"));
   /*for (int i = 0; plf->get_difficulty())
     {
     }*/
 
-  gc.print_left(Fonts::chalk_small, 110, 460, "Author: " + plf->get_author());
+  gc.print_left(Fonts::chalk_small, 110, 460, _("Author: ") + 
plf->get_author());
 
   if (maintainer_mode)
-    gc.print_left(Fonts::chalk_small, 110, 430, "Filename: " + 
plf->get_filename());
+    gc.print_left(Fonts::chalk_small, 110, 430, _("Filename: ") + 
plf->get_filename());
 }
 
 /* EOF */

Index: stat_manager.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/stat_manager.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- stat_manager.cxx    28 Mar 2003 13:12:10 -0000      1.2
+++ stat_manager.cxx    28 Mar 2003 16:16:00 -0000      1.3
@@ -156,18 +156,21 @@
 StatManager::set_string(const std::string& name, const std::string& value)
 {
   stats[name] = value;
+  flush();
 }
 
 void
 StatManager::set_int(const std::string& name, int value)
 {
   stats[name] = to_string(value);
+  flush();
 }
 
 void
 StatManager::set_bool(const std::string& name, bool value)
 {
   stats[name] = to_string(value);
+  flush();
 }
 
 /* EOF */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]