pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r2681 - in branches/pingus_sdl: . data/levels/playable src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r2681 - in branches/pingus_sdl: . data/levels/playable src src/actions src/editor src/gui src/sound src/worldmap
Date: Wed, 17 Jan 2007 21:50:32 +0100

Author: grumbel
Date: 2007-01-17 21:50:29 +0100 (Wed, 17 Jan 2007)
New Revision: 2681

Modified:
   branches/pingus_sdl/ChangeLog
   branches/pingus_sdl/data/levels/playable/Dentist.pingus
   branches/pingus_sdl/src/actions/bridger.cxx
   branches/pingus_sdl/src/actions/faller.cxx
   branches/pingus_sdl/src/credits.cxx
   branches/pingus_sdl/src/editor/context_menu.cxx
   branches/pingus_sdl/src/editor/editor_panel.cxx
   branches/pingus_sdl/src/editor/editor_panel.hxx
   branches/pingus_sdl/src/editor/editor_screen.cxx
   branches/pingus_sdl/src/editor/level_head.cxx
   branches/pingus_sdl/src/file_dialog.cxx
   branches/pingus_sdl/src/graphic_context_state.cxx
   branches/pingus_sdl/src/gui/gui_manager.cxx
   branches/pingus_sdl/src/gui/gui_manager.hxx
   branches/pingus_sdl/src/pingus_menu.cxx
   branches/pingus_sdl/src/result_screen.cxx
   branches/pingus_sdl/src/sound/sound_real.cxx
   branches/pingus_sdl/src/start_screen.cxx
   branches/pingus_sdl/src/story_screen.cxx
   branches/pingus_sdl/src/worldmap/manager.cxx
Log:
merged all remaining changes (GUIComponent deletion) in trunk back into 
pingus_sdl:
   svn merge -r 2627:2680 (HEAD)


Modified: branches/pingus_sdl/ChangeLog
===================================================================
--- branches/pingus_sdl/ChangeLog       2007-01-17 20:26:34 UTC (rev 2680)
+++ branches/pingus_sdl/ChangeLog       2007-01-17 20:50:29 UTC (rev 2681)
@@ -1,3 +1,9 @@
+2006-04-07 10:15  jave27
+
+       * The Changelog is now maintained via the SVN commit comments.
+       You can see a public archive of those at:
+       http://lists.gnu.org/archive/html/pingus-cvs/
+
 2003-04-16 03:15  grumbel
 
        * NEWS, src/config.cxx: - added check if config file is present -

Modified: branches/pingus_sdl/data/levels/playable/Dentist.pingus
===================================================================
--- branches/pingus_sdl/data/levels/playable/Dentist.pingus     2007-01-17 
20:26:34 UTC (rev 2680)
+++ branches/pingus_sdl/data/levels/playable/Dentist.pingus     2007-01-17 
20:50:29 UTC (rev 2681)
@@ -29,6 +29,11 @@
 <image>textures/happyclouds</image>
 <modifier>ROT0</modifier>
 </surface>
+<position>
+<x>0</x>
+<y>0</y>
+<z>-150</z>
+</position>
 <color>
     <red>0</red>
     <green>0</green>

Modified: branches/pingus_sdl/src/actions/bridger.cxx
===================================================================
--- branches/pingus_sdl/src/actions/bridger.cxx 2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/actions/bridger.cxx 2007-01-17 20:50:29 UTC (rev 
2681)
@@ -126,7 +126,7 @@
 void
 Bridger::update_build ()
 {
-  build_sprite[pingu->direction].update ();
+  build_sprite[pingu->direction].update (0.033);
 
   if (build_sprite[pingu->direction].get_current_frame () >= 7 && !block_build)
     {

Modified: branches/pingus_sdl/src/actions/faller.cxx
===================================================================
--- branches/pingus_sdl/src/actions/faller.cxx  2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/actions/faller.cxx  2007-01-17 20:50:29 UTC (rev 
2681)
@@ -30,146 +30,148 @@
 #include "../worldobj.hxx"
 #include "faller.hxx"
 
-namespace Actions {
+  namespace Actions {
 
-Faller::Faller (Pingu* p)
-  : PinguAction(p)
-{
-  faller.load(Direction::LEFT,  Resource::load_sprite("pingus/player" + 
-    pingu->get_owner_str() + "/faller/left"));
-  faller.load(Direction::RIGHT, Resource::load_sprite("pingus/player" + 
-    pingu->get_owner_str() + "/faller/right"));
+    Faller::Faller (Pingu* p)
+      : PinguAction(p)
+    {
+      faller.load(Direction::LEFT,  Resource::load_sprite("pingus/player" + 
+        pingu->get_owner_str() + "/faller/left"));
+      faller.load(Direction::RIGHT, Resource::load_sprite("pingus/player" + 
+        pingu->get_owner_str() + "/faller/right"));
 
-  tumbler.load(Direction::LEFT,  Resource::load_sprite("pingus/player" +
-    pingu->get_owner_str() + "/tumbler/left"));
-  tumbler.load(Direction::RIGHT, Resource::load_sprite("pingus/player" + 
-    pingu->get_owner_str() + "/tumbler/right"));
-}
+      tumbler.load(Direction::LEFT,  Resource::load_sprite("pingus/player" +
+        pingu->get_owner_str() + "/tumbler/left"));
+      tumbler.load(Direction::RIGHT, Resource::load_sprite("pingus/player" + 
+        pingu->get_owner_str() + "/tumbler/right"));
+    }
 
-Faller::~Faller () { }
+    Faller::~Faller () { }
 
-void
-Faller::update ()
-{
-  tumbler[pingu->direction].update();
-  faller[pingu->direction].update();
-
-  // Pingu stands on ground
-  if (rel_getpixel(0, -1) !=  Groundtype::GP_NOTHING)
+    void
+      Faller::update ()
     {
-      pingu->set_action(Actions::Walker);
-      return;
-    }
+      tumbler[pingu->direction].update();
+      faller[pingu->direction].update();
 
-  // FIXME: This should be triggered at a later point, when close to
-  // FIXME: deadly_velocity or something like that. A translation
-  // FIXME: animation for the floater might also help
-  if (pingu->get_velocity().y > 5.0 && pingu->request_fall_action())
-    return;
+      // Pingu stands on ground
+      if (rel_getpixel(0, -1) !=  Groundtype::GP_NOTHING)
+      {
+        pingu->set_action(Actions::Walker);
+        return;
+      }
 
-  // Apply gravity
-  pingu->set_velocity(pingu->get_velocity()
-                     + Vector3f(0.0f, WorldObj::get_world()->get_gravity()) );
+      // FIXME: This should be triggered at a later point, when close to
+      // FIXME: deadly_velocity or something like that. A translation
+      // FIXME: animation for the floater might also help
+      if (pingu->get_velocity().y > 5.0 && pingu->request_fall_action())
+        return;
 
-  bool collided;
+      // Apply gravity
+      pingu->set_velocity(pingu->get_velocity()
+        + Vector3f(0.0f, WorldObj::get_world()->get_gravity()) );
 
-  Vector3f velocity = pingu->get_velocity();
-  Vector3f move = velocity;
+      Vector3f velocity = pingu->get_velocity();
+      Vector3f move = velocity;
+      bool collided;
 
-  Movers::LinearMover mover(WorldObj::get_world(), pingu->get_pos());
+      Movers::LinearMover mover(WorldObj::get_world(), pingu->get_pos());
 
-  do
-    {
-      // Move the Pingu as far is it can go
-      mover.update(move, Colliders::PinguCollider(pingu_height));
+      do
+      {
+        // Move the Pingu as far is it can go
+        mover.update(move, Colliders::PinguCollider(pingu_height));
 
-      pingu->set_pos(mover.get_pos());
+        pingu->set_pos(mover.get_pos());
 
-      collided = mover.collided();
+        collided = mover.collided();
 
-      // If the Pingu collided with something...
-      if (collided)
-       {
-         move = mover.remaining();
+        // If the Pingu collided with something...
+        if (collided)
+        {
+          move = mover.remaining();
 
-         // If the Pingu collided into something while moving down...
-         if (velocity.y > 0.0f
-             && rel_getpixel(0, -2) != Groundtype::GP_NOTHING)
-           {
-             // Ping is on ground/water/something
-             if (   rel_getpixel(0, -1) == Groundtype::GP_WATER
-                 || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
-               {
-                 pingu->set_action(Actions::Drown);
-               }
-             // Did we stop too fast?
-             else if (fabs(pingu->get_velocity().y) > deadly_velocity)
-               {
-                 pingu->set_action(Actions::Splashed);
-               }
-             else if (fabs(pingu->get_velocity().x) > deadly_velocity)
-               {
-                 pout(PINGUS_DEBUG_ACTIONS) << "Pingu: x Smashed on ground, 
jumping" << std::endl;
-               }
+          // If the Pingu collided into something while moving down...
+          if (velocity.y > 0.0f
+            && rel_getpixel(0, -2) != Groundtype::GP_NOTHING)
+          {
+            // Ping is on ground/water/something
+            if (   rel_getpixel(0, -1) == Groundtype::GP_WATER
+              || rel_getpixel(0, -1) == Groundtype::GP_LAVA)
+            {
+              pingu->set_action(Actions::Drown);
+            }
+            // Did we stop too fast?
+            else if (fabs(pingu->get_velocity().y) > deadly_velocity)
+            {
+              pingu->set_action(Actions::Splashed);
+            }
+            else if (fabs(pingu->get_velocity().x) > deadly_velocity)
+            {
+              pout(PINGUS_DEBUG_ACTIONS) << "Pingu: x Smashed on ground, 
jumping" << std::endl;
+            }
 
-             break;
-           }
-         // If the Pingu collided into something while moving up...
-         // NB: +1 because Mover backs out of something it has collided with.
-         else if (velocity.y < 0.0f
-                   && rel_getpixel(0, pingu_height + 1) != 
Groundtype::GP_NOTHING)
-           {
-             // Don't make the Pingu go up any further.
-             move.y = 0.0f;
-             velocity.y = 0.0f;
-           }
-         else
-           {
-             // Make Pingu bounce off wall
-             move.x = -(move.x / 3.0f);
-             velocity.x = -(velocity.x / 3.0f);
+            break;
+          }
+          // If the Pingu collided into something while moving up...
+          // NB: +1 because Mover backs out of something it has collided with.
+          else if (velocity.y < 0.0f
+            && rel_getpixel(0, pingu_height + 1) != Groundtype::GP_NOTHING)
+          {
+            // Don't make the Pingu go up any further.
+            move.y = 0.0f;
+            velocity.y = 0.0f;
+          }
+          else
+          {
+            // Make Pingu bounce off wall
+            move.x = -(move.x / 3.0f);
+            velocity.x = -(velocity.x / 3.0f);
 
-             // Make the Pingu face the correct direction.  NB: Pingu may
-             // previously have been facing in the opposite direction of its
-             // velocity because of an explosion.
-             if (velocity.x > 0.0f)
-               pingu->direction.right();
-             else
-               pingu->direction.left();
-           }
-       }
+            // Make the Pingu face the correct direction.  NB: Pingu may
+            // previously have been facing in the opposite direction of its
+            // velocity because of an explosion.
+            if (velocity.x > 0.0f)
+              pingu->direction.right();
+            else
+              pingu->direction.left();
 
-      // Update the Pingu's velocity
-      pingu->set_velocity(velocity);
+            pingu->set_velocity(velocity);
+            break;
+          }
+        }
+
+        // Update the Pingu's velocity
+        pingu->set_velocity(velocity);
+      }
+      // Loop if the Pingu still needs to be moved
+      while (collided);
     }
-  // Loop if the Pingu still needs to be moved
-  while (collided);
-}
 
-void
-Faller::draw (SceneContext& gc)
-{
-  if (is_tumbling()) {
-    gc.color().draw(tumbler[pingu->direction], pingu->get_pos ());
-  } else {
-    gc.color().draw(faller[pingu->direction], pingu->get_pos ());
-  }
-}
+    void
+      Faller::draw (SceneContext& gc)
+    {
+      if (is_tumbling()) {
+        gc.color().draw(tumbler[pingu->direction], pingu->get_pos ());
+      } else {
+        gc.color().draw(faller[pingu->direction], pingu->get_pos ());
+      }
+    }
 
-bool
-Faller::is_tumbling () const
-{
-  // If we are going fast enough to get smashed, start tumbling
-  return (   fabs(pingu->get_velocity().x) > deadly_velocity
-          || fabs(pingu->get_velocity().y) > deadly_velocity);
-}
+    bool
+      Faller::is_tumbling () const
+    {
+      // If we are going fast enough to get smashed, start tumbling
+      return (   fabs(pingu->get_velocity().x) > deadly_velocity
+        || fabs(pingu->get_velocity().y) > deadly_velocity);
+    }
 
-bool
-Faller::change_allowed (ActionName new_action)
-{
-  return new_action == Actions::Floater || new_action == Actions::Climber;
-}
+    bool
+      Faller::change_allowed (ActionName new_action)
+    {
+      return new_action == Actions::Floater || new_action == Actions::Climber;
+    }
 
-} // namespace Actions
+  } // namespace Actions
 
 /* EOF */

Modified: branches/pingus_sdl/src/credits.cxx
===================================================================
--- branches/pingus_sdl/src/credits.cxx 2007-01-17 20:26:34 UTC (rev 2680)
+++ branches/pingus_sdl/src/credits.cxx 2007-01-17 20:50:29 UTC (rev 2681)
@@ -66,7 +66,7 @@
   background = Resource::load_sprite("core/menu/startscreenbg");
   pingu = Resource::load_sprite("core/misc/creditpingu");
 
-  gui_manager->add(new CreditsOkButton(this));
+  gui_manager->add(new CreditsOkButton(this), true);
 
   ////background.set_alignment(origin_center);
   ////pingu.set_alignment(origin_center);

Modified: branches/pingus_sdl/src/editor/context_menu.cxx
===================================================================
--- branches/pingus_sdl/src/editor/context_menu.cxx     2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/editor/context_menu.cxx     2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -162,7 +162,7 @@
                if (available_attribs & CAN_ROTATE)
                {
                        menu = new ContextMenu(objs, Vector3f(pos.x + width, 
pos.y), viewport, false);
-                       viewport->get_screen()->get_gui_manager()->add(menu);
+                       viewport->get_screen()->get_gui_manager()->add(menu, 
true);
                        menu->add_action(ContextItem("0 degrees", "ROT0", 
ROTATE, 0));
                        menu->add_action(ContextItem("90 Degrees", "ROT90", 
ROTATE, 0));
                        menu->add_action(ContextItem("180 Degrees", "ROT180", 
ROTATE, 0));
@@ -176,7 +176,7 @@
                if (available_attribs & HAS_OWNER)
                {
                        menu = new ContextMenu(objs, Vector3f(pos.x + width, 
pos.y), viewport, false);
-                       viewport->get_screen()->get_gui_manager()->add(menu);
+                       viewport->get_screen()->get_gui_manager()->add(menu, 
true);
                        menu->add_action(ContextItem("0", "0", SET_OWNER, 0));
                        menu->add_action(ContextItem("1", "1", SET_OWNER, 0));
                        menu->add_action(ContextItem("2", "2", SET_OWNER, 0));
@@ -186,14 +186,14 @@
                if (available_attribs & HAS_DIRECTION)
                {
                        menu = new ContextMenu(objs, Vector3f(pos.x + width, 
pos.y), viewport, false);
-                       viewport->get_screen()->get_gui_manager()->add(menu);
+                       viewport->get_screen()->get_gui_manager()->add(menu, 
true);
                        menu->add_action(ContextItem("Left", "left", 
SET_DIRECTION, 0));
                        menu->add_action(ContextItem("Right", "right", 
SET_DIRECTION, 0));
                        menu->add_action(ContextItem("Misc.", "misc", 
SET_DIRECTION, 0));
                        add_action(ContextItem("Direction >", "", 
SET_DIRECTION, menu));
                }
                menu = new ContextMenu(objs, Vector3f(pos.x + width, pos.y), 
viewport, false);
-               viewport->get_screen()->get_gui_manager()->add(menu);
+               viewport->get_screen()->get_gui_manager()->add(menu, true);
                menu->add_action(ContextItem("-50", "-50", SET_Z_POS, 0));
                menu->add_action(ContextItem("-25", "-25", SET_Z_POS, 0));
                menu->add_action(ContextItem("0", "0", SET_Z_POS, 0));

Modified: branches/pingus_sdl/src/editor/editor_panel.cxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_panel.cxx     2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/editor/editor_panel.cxx     2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -66,15 +66,15 @@
   add((PanelButton*)(new PanelButtonHead(this)));
        // Create Checkboxes
        snap_to_checkbox = new GUI::Checkbox(Vector3f(370, 5), "Snap To Grid: 
", this);
-       get_screen()->get_gui_manager()->add(snap_to_checkbox);
+       get_screen()->get_gui_manager()->add(snap_to_checkbox, true);
        
        // Create Comboboxes
        combobox_3 = new GUI::Combobox(Vector3f(500, 36), this);
        combobox_2 = new GUI::Combobox(Vector3f(500, 18), this);
        combobox_1 = new GUI::Combobox(Vector3f(500,  0), this);
-       get_screen()->get_gui_manager()->add(combobox_3);
-       get_screen()->get_gui_manager()->add(combobox_2);
-       get_screen()->get_gui_manager()->add(combobox_1);
+       get_screen()->get_gui_manager()->add(combobox_3, true);
+       get_screen()->get_gui_manager()->add(combobox_2, true);
+       get_screen()->get_gui_manager()->add(combobox_1, true);
        combobox_3->set_enabled(false);
        combobox_2->set_enabled(false);
        combobox_1->set_enabled(false);
@@ -108,7 +108,7 @@
        button->set_pos(new_pos);
 
        // Add the button to the GUI Manager
-       get_screen()->get_gui_manager()->add((GUI::Component*)button);
+       get_screen()->get_gui_manager()->add((GUI::Component*)button, true);
 }
 
 void 

Modified: branches/pingus_sdl/src/editor/editor_panel.hxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_panel.hxx     2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/editor/editor_panel.hxx     2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -71,7 +71,8 @@
        void init();
 
        /** Add a button to the panel 
-               @param button The PanelButton that you'd like to add */
+               @param button The PanelButton that you'd like to add. The given 
object will be
+                       deleted automaticly at the end. */
        void add(PanelButton* button);
 
        /** Draws the panel */

Modified: branches/pingus_sdl/src/editor/editor_screen.cxx
===================================================================
--- branches/pingus_sdl/src/editor/editor_screen.cxx    2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/editor/editor_screen.cxx    2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -63,11 +63,11 @@
 {
        // Create the viewport for the images and data
        viewport = new EditorViewport(this);
-       gui_manager->add(viewport);     
+       gui_manager->add(viewport, true);       
        
        // Create the panel for the buttons
        panel = new EditorPanel(this);
-       gui_manager->add(panel);
+       gui_manager->add(panel, true);
        panel->init();
 
 }

Modified: branches/pingus_sdl/src/editor/level_head.cxx
===================================================================
--- branches/pingus_sdl/src/editor/level_head.cxx       2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/editor/level_head.cxx       2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -44,7 +44,7 @@
 
     public:
       LevelHeadCloseButton(LevelHead* h)
-      : GUI::SurfaceButton(Display::get_width() -100,
+      : GUI::SurfaceButton(Display::get_width() -200,
                            Display::get_height() -100,
                            ResDescriptor("core/menu/exit_button_normal"),
                            ResDescriptor("core/menu/exit_button_pressed"),
@@ -78,7 +78,7 @@
   gui_manager(p->get_screen()->get_gui_manager()), 
        pos(Vector3f(50, 75))
 {
-  gui_manager->add((GUI::Component*)this); 
+  gui_manager->add((GUI::Component*)this, false); 
    
   // Create GUI items
   name = new GUI::InputBox(400, Vector3f(pos.x + 175, pos.y + 10),
@@ -87,12 +87,12 @@
                            impl->description, false, "Level Description");     
        
   
   // Add GUI Items to the GUIManager 
-  gui_manager->add((GUI::Component*)name);
-  gui_manager->add((GUI::Component*)desc); 
+  gui_manager->add((GUI::Component*)name, true);
+  gui_manager->add((GUI::Component*)desc, true); 
   
   // Add close button
   close_button = new LevelHeadCloseButton(this); 
-  gui_manager->add((GUI::Component*)close_button);
+  gui_manager->add((GUI::Component*)close_button, true);
 }
 
 LevelHead::~LevelHead()

Modified: branches/pingus_sdl/src/file_dialog.cxx
===================================================================
--- branches/pingus_sdl/src/file_dialog.cxx     2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/file_dialog.cxx     2007-01-17 20:50:29 UTC (rev 
2681)
@@ -253,7 +253,7 @@
                gui_manager->add(up_button, true);
                gui_manager->add(down_button, true);
                gui_manager->add(new FileDialogCancelButton(this), true);
-               gui_manager->add(new FileDialogParentFolderButton(this));
+               gui_manager->add(new FileDialogParentFolderButton(this), true);
 
                // FIXME: Ugly - hardcoded values for items in file dialog.  
Should be dynamic.
                // Create 8 FileDialogItems and add them to the gui_manager.
@@ -262,7 +262,7 @@
 
                inputbox = new GUI::InputBox(450, Vector3f(center_x - 225, 
                        center_y - 170), "", for_loading);
-               gui_manager->add((GUI::Component*)inputbox);
+               gui_manager->add((GUI::Component*)inputbox, true);
 
                file_dialog_items.push_back(new FileDialogItem(this, 
                        Vector3f(center_x - 280, center_y - 140)));
@@ -283,7 +283,7 @@
 
                for (std::vector<FileDialogItem*>::const_iterator i = 
file_dialog_items.begin();
                        i != file_dialog_items.end(); i++)
-                       gui_manager->add((GUI::Component*)(*i));
+                       gui_manager->add((GUI::Component*)(*i), true);
 
                refresh();
        }

Modified: branches/pingus_sdl/src/graphic_context_state.cxx
===================================================================
--- branches/pingus_sdl/src/graphic_context_state.cxx   2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/graphic_context_state.cxx   2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -154,9 +154,6 @@
 void
 GraphicContextState::set_pos(const Vector2f& pos)
 {
-  float old_x = impl->offset.x;
-  float old_y = impl->offset.y;
-       
   impl->offset.x = -pos.x + (get_width()/2  / impl->zoom);
   impl->offset.y = -pos.y + (get_height()/2 / impl->zoom);
 
@@ -164,20 +161,20 @@
     {
       if (-impl->offset.x < impl->limit.left)
         {
-          impl->offset.x = old_x;
+         impl->offset.x = -( impl->limit.left );
         }
       else if (-impl->offset.x + get_width() >= impl->limit.right)
         {
-          impl->offset.x = old_x;
+         impl->offset.x = -( impl->limit.right - get_width() - 1 );
         }
 
       if (-impl->offset.y < impl->limit.top)
         {
-          impl->offset.y = old_y;
+          impl->offset.y = -( impl->limit.top );
         }
       else if (-impl->offset.y + get_height() >= impl->limit.bottom)
         {
-          impl->offset.y = old_y;
+          impl->offset.y = -( impl->limit.bottom - get_height() - 1 );
         }
     }
 }

Modified: branches/pingus_sdl/src/gui/gui_manager.cxx
===================================================================
--- branches/pingus_sdl/src/gui/gui_manager.cxx 2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/gui/gui_manager.cxx 2007-01-17 20:50:29 UTC (rev 
2681)
@@ -37,6 +37,17 @@
 {
 }
 
+GUIManager::~GUIManager ()
+{
+  for (std::vector<Component*>::iterator i = components_for_delete.begin ();
+       i != components_for_delete.end (); ++i)
+    {
+      delete (*i);
+    }
+
+  components_for_delete.clear();
+}
+
 void
 GUIManager::draw (DrawingContext& gc)
 {
@@ -96,7 +107,8 @@
 GUIManager::add(Component* c, bool delete_component)
 {
   components.push_back(c);
-  UNUSED_ARG(delete_component);
+  if( delete_component )
+    components_for_delete.push_back(c);
 }
 
 void

Modified: branches/pingus_sdl/src/gui/gui_manager.hxx
===================================================================
--- branches/pingus_sdl/src/gui/gui_manager.hxx 2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/gui/gui_manager.hxx 2007-01-17 20:50:29 UTC (rev 
2681)
@@ -44,6 +44,7 @@
 private:
   typedef std::vector<Component*> Components;
   Components components;
+  Components components_for_delete;
 
   /** The component which recieved the last pressed event */
   Component* primary_pressed_component;
@@ -70,7 +71,7 @@
        
 public:
   GUIManager ();
-  virtual ~GUIManager () {}
+  virtual ~GUIManager ();
 
   virtual void draw (DrawingContext& gc);
   virtual void update (const GameDelta& delta);
@@ -80,7 +81,7 @@
       the component will get deleted on destruction of the manager,
       if false is supplied the user has to handle the component
       itself */
-  void add (Component*, bool delete_component = true);
+  void add (Component*, bool delete_component);
 
   /** */
   void remove (Component*);

Modified: branches/pingus_sdl/src/pingus_menu.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_menu.cxx     2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/pingus_menu.cxx     2007-01-17 20:50:29 UTC (rev 
2681)
@@ -100,8 +100,8 @@
   gui_manager->remove(multiplayer_button);
   gui_manager->remove(editor_button);
 
-  gui_manager->add(quit_button);
-  gui_manager->add(start_button);
+  gui_manager->add(quit_button, false);
+  gui_manager->add(start_button, false);
 }
 
 void
@@ -109,12 +109,13 @@
 {
   gui_manager->remove(start_button);
 
-  gui_manager->add(contrib_button);
-  gui_manager->add(story_button);
-  gui_manager->add(editor_button);
+  gui_manager->add(contrib_button, false);
+  gui_manager->add(story_button, false);
+  gui_manager->add(editor_button, false);
   // FIXME: Re-enable this next line once multiplayer functionality
   // is actually available.
-  //gui_manager->add(multiplayer_button);
+
+  //gui_manager->add(multiplayer_button, false);
 }
 
 void

Modified: branches/pingus_sdl/src/result_screen.cxx
===================================================================
--- branches/pingus_sdl/src/result_screen.cxx   2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/result_screen.cxx   2007-01-17 20:50:29 UTC (rev 
2681)
@@ -263,19 +263,19 @@
   ResDescriptor cancel_desc("core/result/retry");
 
   ResultScreenComponent* comp = new ResultScreenComponent(result);
-  gui_manager->add(comp);
+  gui_manager->add(comp, true);
 
   if (result.success())
     {
-      gui_manager->add(new ResultScreenOkButton(this));
+      gui_manager->add(new ResultScreenOkButton(this), true);
     }
   else
     {
-      gui_manager->add(new ResultScreenAbortButton(this));
-      gui_manager->add(new ResultScreenRetryButton(this));
+      gui_manager->add(new ResultScreenAbortButton(this), true);
+      gui_manager->add(new ResultScreenRetryButton(this), true);
     }
 
-  //gui_manager->add(new GUI::SurfaceButton(500, 500, cancel_desc, 
cancel_desc, cancel_desc));
+  //gui_manager->add(new GUI::SurfaceButton(500, 500, cancel_desc, 
cancel_desc, cancel_desc), true);
 }
 
 void

Modified: branches/pingus_sdl/src/sound/sound_real.cxx
===================================================================
--- branches/pingus_sdl/src/sound/sound_real.cxx        2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/sound/sound_real.cxx        2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -146,7 +146,7 @@
     {
       music_session = new CL_SoundBuffer_Session(music_sample->prepare());
       music_session->set_volume(volume * 0.5f); // FIXME: music_volume
-      music_session->set_looping(false);
+      music_session->set_looping(true);
       music_session->play();
     }
 }

Modified: branches/pingus_sdl/src/start_screen.cxx
===================================================================
--- branches/pingus_sdl/src/start_screen.cxx    2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/start_screen.cxx    2007-01-17 20:50:29 UTC (rev 
2681)
@@ -209,9 +209,9 @@
   : plf(arg_plf)
 {
   StartScreenComponent* comp = new StartScreenComponent(plf);
-  gui_manager->add(comp);
-  gui_manager->add(new StartScreenOkButton(this));
-  gui_manager->add(new StartScreenAbortButton(this));
+  gui_manager->add(comp, true);
+  gui_manager->add(new StartScreenOkButton(this), true);
+  gui_manager->add(new StartScreenAbortButton(this), true);
 }
 
 void

Modified: branches/pingus_sdl/src/story_screen.cxx
===================================================================
--- branches/pingus_sdl/src/story_screen.cxx    2007-01-17 20:26:34 UTC (rev 
2680)
+++ branches/pingus_sdl/src/story_screen.cxx    2007-01-17 20:50:29 UTC (rev 
2681)
@@ -93,8 +93,8 @@
 StoryScreen::StoryScreen(WorldMapNS::WorldMapStory *arg_pages)
 {
   story_comp = new StoryScreenComponent(arg_pages);
-  gui_manager->add (story_comp);
-  gui_manager->add (new StoryScreenContinueButton(story_comp));
+  gui_manager->add (story_comp, true);
+  gui_manager->add (new StoryScreenContinueButton(story_comp), true);
 }
 
 StoryScreen::~StoryScreen()

Modified: branches/pingus_sdl/src/worldmap/manager.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/manager.cxx        2007-01-17 20:26:34 UTC 
(rev 2680)
+++ branches/pingus_sdl/src/worldmap/manager.cxx        2007-01-17 20:50:29 UTC 
(rev 2681)
@@ -226,11 +226,11 @@
   // FIXME: well enough. GUIScreen could also use multi-inheritage,
   // FIXME: but that could lead to member function name conflicts
   worldmap_component = new WorldMapComponent();
-  gui_manager->add (worldmap_component);
-  gui_manager->add(new WorldMapManagerCloseButton());
-  gui_manager->add(new WorldMapManagerEnterButton());
+  gui_manager->add (worldmap_component, true);
+  gui_manager->add(new WorldMapManagerCloseButton(), true);
+  gui_manager->add(new WorldMapManagerEnterButton(), true);
 
-  gui_manager->add(new WorldMapManagerStoryButton());
+  gui_manager->add(new WorldMapManagerStoryButton(), true);
 }
 
 void
@@ -246,7 +246,7 @@
                credits_unlocked);
   if (credits_unlocked)
        {
-               gui_manager->add(new WorldMapManagerCreditsButton());
+               gui_manager->add(new WorldMapManagerCreditsButton(), true);
        }
 }
 





reply via email to

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