pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r2615 - in trunk/src: . worldmap


From: jave27
Subject: [Pingus-CVS] r2615 - in trunk/src: . worldmap
Date: Thu, 19 Jan 2006 23:11:57 +0100

Author: jave27
Date: 2006-01-19 23:11:46 +0100 (Thu, 19 Jan 2006)
New Revision: 2615

Modified:
   trunk/src/credits.cxx
   trunk/src/pingus_menu.cxx
   trunk/src/story_screen.cxx
   trunk/src/worldmap/manager.cxx
   trunk/src/worldmap/metamap.cxx
   trunk/src/worldmap/metamap.hxx
   trunk/src/worldmap/pingus.cxx
   trunk/src/worldmap/worldmap.cxx
   trunk/src/worldmap/worldmap.hxx
Log:
Fixed some bugs with the metamap.  

Hardcoded the unlock for the volcano map after tutorial is finished (needs to 
be updated).

Re-enabled the credits (after the final map's end story is shown).



Modified: trunk/src/credits.cxx
===================================================================
--- trunk/src/credits.cxx       2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/credits.cxx       2006-01-19 22:11:46 UTC (rev 2615)
@@ -24,6 +24,7 @@
 #include "gui/surface_button.hxx"
 #include "gui/gui_manager.hxx"
 #include "sound/sound.hxx"
+#include "stat_manager.hxx"
 #include "resource.hxx"
 #include "res_descriptor.hxx"
 #include "credits.hxx"
@@ -93,6 +94,7 @@
   credits.push_back("_David Philippi");
   credits.push_back("_Gervase Lam");
   credits.push_back("_Ingo Ruhnke");
+       credits.push_back("_Jason Green");
   credits.push_back("n");
 
   credits.push_back(_("-Porting (Win32)"));
@@ -210,7 +212,7 @@
   credits.push_back(_("_Thank you for"));
   credits.push_back(_("_playing!"));
 
-  end_offset = -CL_Display::get_height()/2 - 50; // screen height + grace time
+  end_offset = -(float)CL_Display::get_height()/2 - 50; // screen height + 
grace time
   for (std::vector<std::string>::iterator i = credits.begin(); i != 
credits.end(); ++i)
     {
       switch ((*i)[0])
@@ -234,6 +236,7 @@
 
 Credits::~Credits ()
 {
+       StatManager::instance()->set_bool("credits-seen", true);
 }
 
 void
@@ -259,7 +262,7 @@
   float y;
   float yof;
 
-  x = CL_Display::get_width()/2;
+  x = (float)CL_Display::get_width()/2;
   y = offset;
 
   gc.draw(background, Vector(gc.get_width()/2, gc.get_height()/2));
@@ -300,7 +303,7 @@
 void
 Credits::on_startup ()
 {
-  offset = CL_Display::get_height() - 50;
+  offset = (float)CL_Display::get_height() - 50;
   //PingusSound::play_music("pingus-5.it");
 }
 

Modified: trunk/src/pingus_menu.cxx
===================================================================
--- trunk/src/pingus_menu.cxx   2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/pingus_menu.cxx   2006-01-19 22:11:46 UTC (rev 2615)
@@ -176,7 +176,7 @@
   
   bool story_seen = false;
        
StatManager::instance()->get_bool(WorldMapNS::WorldMapManager::instance()->
-               get_worldmap()->get_shortname() + "-story-seen", story_seen);
+               get_worldmap()->get_shortname() + "-startstory-seen", 
story_seen);
        
        if (!story_seen)
                ScreenManager::instance()->push_screen(new StoryScreen(

Modified: trunk/src/story_screen.cxx
===================================================================
--- trunk/src/story_screen.cxx  2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/story_screen.cxx  2006-01-19 22:11:46 UTC (rev 2615)
@@ -43,8 +43,6 @@
 class StoryScreenComponent : public GUI::Component
 {
 private:
-  bool show_credits;
-
   CL_Sprite background;
   std::string display_text;
   float time_passed;
@@ -108,11 +106,6 @@
 StoryScreenComponent::StoryScreenComponent (WorldMapNS::WorldMapStory 
*arg_story)
   : story(arg_story)
 {
-  /*if (&arg_story == &Story::credits)
-    show_credits = true;
-  else */
-    show_credits = false;
-
   page_displayed_completly = false;
   time_passed  = 0;
        pages = story->get_pages();
@@ -194,14 +187,26 @@
         }
       else
         {
-          //Out of story pages
+          //Out of story pages - figure out which one this was (start or end)
+                                       std::string which_story;
+                                       if (story == 
WorldMapNS::WorldMapManager::instance()->get_worldmap()->get_intro_story())
+                                               which_story = "start";
+                                       else
+                                               which_story = "end";
+
+                                       // Record that player has seen this 
story.
                                        
StatManager::instance()->set_bool(WorldMapNS::WorldMapManager::instance()->get_worldmap()->get_shortname()
-                                                       + "-story-seen", true);
+                                                       + "-" + which_story + 
"story-seen", true);
 
-                                       //See if credits have been seen
-                                       /*if 
StatManager::instance()->get_bool(WorldMapNS::WorldMapManager::instance()->get_worldmap()->get_shortname()
-                                               + ") */
-          if (show_credits)
+                                       bool credits_seen = false;
+                                       //Check if this is the last worldmap
+                                       if 
(WorldMapNS::WorldMapManager::instance()->get_worldmap()->is_final_map())
+                                       {
+                                               // Check if final credits have 
been seen
+                                               
StatManager::instance()->get_bool("credits-seen", credits_seen);
+                                       }
+
+          if (!credits_seen)
             ScreenManager::instance()->replace_screen(Credits::instance(), 
false);
           else
             
ScreenManager::instance()->replace_screen(WorldMapNS::WorldMapManager::instance 
());

Modified: trunk/src/worldmap/manager.cxx
===================================================================
--- trunk/src/worldmap/manager.cxx      2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/worldmap/manager.cxx      2006-01-19 22:11:46 UTC (rev 2615)
@@ -238,7 +238,7 @@
   worldmap = new WorldMap (filename);
        
   bool credits_unlocked = false;
-  StatManager::instance()->get_bool(worldmap->get_shortname() + 
"-credits-unlocked", 
+  StatManager::instance()->get_bool(worldmap->get_shortname() + 
"-endstory-seen", 
                credits_unlocked);
   if (credits_unlocked)
        {

Modified: trunk/src/worldmap/metamap.cxx
===================================================================
--- trunk/src/worldmap/metamap.cxx      2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/worldmap/metamap.cxx      2006-01-19 22:11:46 UTC (rev 2615)
@@ -21,6 +21,7 @@
 #include "dot.hxx"
 #include "metamap.hxx"
 #include "path_graph.hxx"
+#include "graph.hxx"
 #include "../pingus_error.hxx"
 #include "../debug.hxx"
 #include "../globals.hxx"
@@ -106,6 +107,22 @@
        return (path_graph->get_dot(default_node)->get_name());
 }
 
+std::string
+MetaMap::get_final_worldmap()
+{
+       return (path_graph->get_dot(final_node)->get_name());
+}
+
+void
+MetaMap::finish_node(const std::string &worldmap_shortname)
+{
+       StatManager::instance()->set_bool(worldmap_shortname + "-finished", 
true);
+       NodeId id = path_graph->lookup_node(worldmap_shortname);
+       // FIXME: Not entirely sure how the whole pathfinder thing works,
+       // FIXME: so I'm hardcoding this for now...  <evil!!!>
+       unlock_default("volcano");
+}
+
 MetaMap::~MetaMap()
 {
        delete path_graph;

Modified: trunk/src/worldmap/metamap.hxx
===================================================================
--- trunk/src/worldmap/metamap.hxx      2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/worldmap/metamap.hxx      2006-01-19 22:11:46 UTC (rev 2615)
@@ -66,7 +66,11 @@
 
        /** Return the name of the default node in this metamap (which is a 
worldmap) */
        std::string get_default_worldmap();
+       std::string get_final_worldmap();
 
+       /** Finish the specified node and unlock it's neighbors */
+       void finish_node(const std::string &worldmap_shortname);
+
 private:
        /** Unlock surrounding nodes.  This sets the "-accessible" tag in the 
StatManager for
        the accessible worldmaps */

Modified: trunk/src/worldmap/pingus.cxx
===================================================================
--- trunk/src/worldmap/pingus.cxx       2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/worldmap/pingus.cxx       2006-01-19 22:11:46 UTC (rev 2615)
@@ -41,9 +41,6 @@
 
   final_target_node = NoNode;
   current_node = NoNode;
-
-  pos.x = 320;
-  pos.y = 200;
 }
 
 Pingus::~Pingus ()

Modified: trunk/src/worldmap/worldmap.cxx
===================================================================
--- trunk/src/worldmap/worldmap.cxx     2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/worldmap/worldmap.cxx     2006-01-19 22:11:46 UTC (rev 2615)
@@ -37,6 +37,7 @@
 #include "../debug.hxx"
 #include "worldmap.hxx"
 #include "worldmap_story.hxx"
+#include "metamap.hxx"
 #include "manager.hxx"
 #include "pingus.hxx"
 #include "drawable_factory.hxx"
@@ -60,18 +61,15 @@
 {
   CL_InputSourceProvider_File provider(".");
   CL_DomDocument doc(provider.open_source(filename), true);
-
   CL_DomElement root = doc.get_document_element();
 
-  parse_file(XMLFileReader(root));
-
+       parse_file(XMLFileReader(root));
   pingus = new Pingus(path_graph);
-
        set_starting_node();
-
   add_drawable(pingus);
 
   levelname_bg = Resource::load_sprite("core/worldmap/levelname_bg");
+       gc_state.set_limit(CL_Rect(CL_Point(0, 0), CL_Size(width, height)));
 }
 
 WorldMap::~WorldMap()
@@ -169,11 +167,10 @@
 
   DrawingContext* display_gc = new DrawingContext();
 
-  gc_state.set_limit(CL_Rect(CL_Point(0, 0), CL_Size(width, height)));
-  gc_state.set_pos(CL_Pointf(pingu_pos.x, pingu_pos.y));
-
+       gc_state.set_pos(CL_Pointf(pingu_pos.x, pingu_pos.y));
+       
   gc_state.push(*display_gc);
-
+  
        // Blank out the screen in case the screen resolution is larger than
        // the worldmap picture.
        // FIXME:  Should probably scale everything to match the resolution 
instead.
@@ -391,7 +388,7 @@
   path_graph->graph.for_each_node(unlock_nodes(path_graph));
 
   bool credits_unlocked = false;
-  StatManager::instance()->get_bool(short_name + "-credits-unlocked", 
credits_unlocked);
+  StatManager::instance()->get_bool(short_name + "-endstory-seen", 
credits_unlocked);
 
   if (!credits_unlocked)
     {
@@ -401,10 +398,9 @@
         {
           if (dot->finished())
             {
-                                                       
StatManager::instance()->set_bool(short_name + "-finished", true);
+                                                       
WorldMapManager::instance()->get_metamap()->finish_node(short_name);
               ScreenManager::instance()->replace_screen(
                                                                new 
StoryScreen(get_end_story()), true);
-              StatManager::instance()->set_bool("credits-unlocked", true);
             }
         }
       else
@@ -437,17 +433,14 @@
 
        LevelDot* leveldot = dynamic_cast<LevelDot*>(path_graph->get_dot(id));
        leveldot->unlock();
-       /*
-       std::string resname = leveldot->get_plf().get_levelname();
-       // Set an accessible flag for this level in the Savegame Manager.
-       if (!SavegameManager::instance()->get(resname))
-       {
-               Savegame savegame(resname, Savegame::ACCESSIBLE, 10000, 0);
-               SavegameManager::instance()->store(savegame);
-               update_locked_nodes();
-       }
-       */
 }
+
+bool
+WorldMap::is_final_map()
+{
+       return 
(WorldMapManager::instance()->get_metamap()->get_final_worldmap() == 
short_name);
+}
+
 } // namespace WorldMapNS
 } // namespace Pingus
 

Modified: trunk/src/worldmap/worldmap.hxx
===================================================================
--- trunk/src/worldmap/worldmap.hxx     2006-01-19 19:57:19 UTC (rev 2614)
+++ trunk/src/worldmap/worldmap.hxx     2006-01-19 22:11:46 UTC (rev 2615)
@@ -108,6 +108,8 @@
        std::string get_filename() const { return filename; }
        std::string get_shortname() const { return short_name; }
 
+       bool is_final_map();
+
   void draw (DrawingContext& gc);
   void update (float delta);
 





reply via email to

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