pingus-cvs
[Top][All Lists]
Advanced

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

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


From: jsalmon3
Subject: [Pingus-CVS] r2735 - in branches/pingus_sdl: data/levels/playable src
Date: Sun, 15 Jul 2007 02:42:01 +0200

Author: jsalmon3
Date: 2007-07-15 02:41:50 +0200 (Sun, 15 Jul 2007)
New Revision: 2735

Modified:
   branches/pingus_sdl/data/levels/playable/future2-jgoebbert.pingus
   branches/pingus_sdl/data/levels/playable/future2-jgoebbert.scm
   branches/pingus_sdl/data/levels/playable/future3-jgoebbert.pingus
   branches/pingus_sdl/data/levels/playable/future3-jgoebbert.scm
   branches/pingus_sdl/src/file_dialog.cpp
   branches/pingus_sdl/src/file_dialog_item.cpp
   branches/pingus_sdl/src/sprite.cpp
Log:
Fixed bug clicking on '..', fixed a couple of broken maps, some cleanup

Modified: branches/pingus_sdl/data/levels/playable/future2-jgoebbert.pingus
===================================================================
--- branches/pingus_sdl/data/levels/playable/future2-jgoebbert.pingus   
2007-07-14 22:26:20 UTC (rev 2734)
+++ branches/pingus_sdl/data/levels/playable/future2-jgoebbert.pingus   
2007-07-15 00:41:50 UTC (rev 2735)
@@ -6442,6 +6442,7 @@
       <position>
 <x>260</x>
 <y>70</y>
+<z>100</z>
 </position>
     </target>
 </teleporter>
@@ -6455,6 +6456,7 @@
       <position>
 <x>260</x>
 <y>70</y>
+<z>100</z>
 </position>
     </target>
 </teleporter>

Modified: branches/pingus_sdl/data/levels/playable/future2-jgoebbert.scm
===================================================================
--- branches/pingus_sdl/data/levels/playable/future2-jgoebbert.scm      
2007-07-14 22:26:20 UTC (rev 2734)
+++ branches/pingus_sdl/data/levels/playable/future2-jgoebbert.scm      
2007-07-15 00:41:50 UTC (rev 2735)
@@ -3227,4 +3227,9 @@
     (teleporter 
       (position 92 466 100)
       (target 
-        (position 260 70 
\ No newline at end of file
+        (position 260 70 100)))
+    (teleporter 
+      (position 1053 465 100)
+      (target 
+        (position 260 70 100)))))
+;; EOF ;;

Modified: branches/pingus_sdl/data/levels/playable/future3-jgoebbert.pingus
===================================================================
--- branches/pingus_sdl/data/levels/playable/future3-jgoebbert.pingus   
2007-07-14 22:26:20 UTC (rev 2734)
+++ branches/pingus_sdl/data/levels/playable/future3-jgoebbert.pingus   
2007-07-15 00:41:50 UTC (rev 2735)
@@ -3072,6 +3072,7 @@
       <position>
 <x>700</x>
 <y>85</y>
+<z>100</z>
 </position>
     </target>
 </teleporter>

Modified: branches/pingus_sdl/data/levels/playable/future3-jgoebbert.scm
===================================================================
--- branches/pingus_sdl/data/levels/playable/future3-jgoebbert.scm      
2007-07-14 22:26:20 UTC (rev 2734)
+++ branches/pingus_sdl/data/levels/playable/future3-jgoebbert.scm      
2007-07-15 00:41:50 UTC (rev 2735)
@@ -1543,4 +1543,5 @@
     (teleporter 
       (position 31 231 100)
       (target 
-        (position 700 85 
\ No newline at end of file
+        (position 700 85 100)))))
+;; EOF ;;

Modified: branches/pingus_sdl/src/file_dialog.cpp
===================================================================
--- branches/pingus_sdl/src/file_dialog.cpp     2007-07-14 22:26:20 UTC (rev 
2734)
+++ branches/pingus_sdl/src/file_dialog.cpp     2007-07-15 00:41:50 UTC (rev 
2735)
@@ -419,7 +419,19 @@
                // If it's a directory, change to it.
                if (current_file.is_directory)
                {
-                       current_path += current_file.name + "/";
+                       if (current_file.name != "..")
+                       {
+                               current_path += current_file.name + "/";
+                       }
+                       else
+                       {
+                               size_t index = current_path.size() > 1 ? 
current_path.size() - 2 : std::string::npos;
+                               size_t pos = current_path.find_last_of('/', 
index);
+                               if (pos != std::string::npos)
+                                       current_path = current_path.substr(0, 
pos + 1);
+                               else
+                                       current_path.clear();
+                       }
                        refresh();
                        ok_button->hide();
                }

Modified: branches/pingus_sdl/src/file_dialog_item.cpp
===================================================================
--- branches/pingus_sdl/src/file_dialog_item.cpp        2007-07-14 22:26:20 UTC 
(rev 2734)
+++ branches/pingus_sdl/src/file_dialog_item.cpp        2007-07-15 00:41:50 UTC 
(rev 2735)
@@ -17,6 +17,7 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <sstream>
 #include "pingus_error.hpp"
 #include "file_dialog_item.hpp"
 #include "file_dialog.hpp"
@@ -58,14 +59,26 @@
                        sprite = 
Resource::load_sprite("core/menu/default_level");
                        file_item.is_accessible = true;
                        file_item.is_finished = false;
+                       file_item.friendly_name.clear();
+                       file_info = _("Difficulty: ");
 
                        // Load information about this file if possible.
                        FileReader reader = 
FileReader::parse(file_dialog->get_path() + file_item.name);
-                       if (reader.get_name() != "pingus-level" || 
reader.get_name() != "pingus-worldmap") {
+                       if (reader.get_name() == "pingus-level" || 
reader.get_name() == "pingus-worldmap")
+                       {
                                FileReader head;
-                               if (reader.read_section("head", head)) {
+                               int difficulty = 0;
+                               std::ostringstream ostr;
+                               if (reader.read_section("head", head))
+                               {
                                        head.read_string("levelname", 
file_item.friendly_name);
-                                       head.read_string("difficulty", 
file_info);
+                                       if (file_item.friendly_name.empty())
+                                               file_item.friendly_name = 
get_filename();
+                                       else
+                                               file_item.friendly_name = 
_(file_item.friendly_name);
+                                       head.read_int("difficulty", difficulty);
+                                       ostr << difficulty;
+                                       file_info += ostr.str();
                                        Savegame* sg = 
SavegameManager::instance()->get(file_item.friendly_name);
                                        status = sg ? _("Finished!") : _("Not 
finished!");
                                }
@@ -166,16 +179,20 @@
                        // Draw thumbnail
                        gc.draw(sprite, pos);
 
-                       // Draw title
-                       gc.print_left(Fonts::pingus_small, pos.x + 
(float)sprite.get_width(), 
-                               pos.y, get_filename());
-
-                       // If mouse over, draw a quick info box about the file 
item
-                       if (mouse_over)
+                       if (!mouse_over || file_item.is_directory)
                        {
+                               // Draw title
+                               gc.print_left(Fonts::pingus_small, pos.x + 
(float)sprite.get_width(), 
+                                       pos.y, get_filename());
+                       }
+                       else
+                       {
+                               // If mouse over, draw a quick info box about 
the file item
                                if (file_item.is_directory)
+                               {
                                        gc.draw_rect(pos.x, pos.y, pos.x + 
sprite.get_width(), 
                                                pos.y + sprite.get_height(), 
Color(255,255,255,150));
+                               }
                                else            // It's a file
                                {
                                        // Determine which color to draw the 
background rectangle.

Modified: branches/pingus_sdl/src/sprite.cpp
===================================================================
--- branches/pingus_sdl/src/sprite.cpp  2007-07-14 22:26:20 UTC (rev 2734)
+++ branches/pingus_sdl/src/sprite.cpp  2007-07-15 00:41:50 UTC (rev 2735)
@@ -57,22 +57,19 @@
 
   SpriteImpl(const SpriteDescription& desc)
     : surface(0),
+      finished(false),
       frame(0),
       tick_count(0)
   {
     surface = IMG_Load(desc.filename.c_str());
-    if (surface)
+    if (!surface)
       {
-        //SDL_SetAlpha(surface, SDL_SRCALPHA, 128);
-      }
-    else
-      {
         std::cout << "Error: Couldn't load " << desc.filename << std::endl;
         surface = IMG_Load("data/images/core/misc/404.png");
         assert(surface);
       }
     
-    frame_pos    = desc.frame_pos;
+    frame_pos = desc.frame_pos;
 
     frame_size.width  = (desc.frame_size.width  == -1) ? surface->w : 
desc.frame_size.width;
     frame_size.height = (desc.frame_size.height == -1) ? surface->h : 
desc.frame_size.height;
@@ -83,7 +80,6 @@
 
     loop = desc.loop;
     loop_last_cycle = false;
-    finished = false;
 
     offset = calc_origin(desc.origin, frame_size) - desc.offset;
   }
@@ -94,13 +90,15 @@
       frame_size(pixelbuffer.get_width(), pixelbuffer.get_height()),
       frame_delay(0),
       array(1,1),
+      loop(true),
+      loop_last_cycle(false),
+      finished(false),
       frame(0),
       tick_count(0)
   {
     if (pixelbuffer.get_surface())
       {
         surface = SDL_DisplayFormatAlpha(pixelbuffer.get_surface());
-        //SDL_SetAlpha(surface, SDL_SRCALPHA, 128);
       }
     else
       {





reply via email to

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