pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3150 - in trunk/pingus: . src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3150 - in trunk/pingus: . src
Date: Sat, 15 Sep 2007 03:30:44 +0200

Author: grumbel
Date: 2007-09-15 03:30:41 +0200 (Sat, 15 Sep 2007)
New Revision: 3150

Modified:
   trunk/pingus/TODO
   trunk/pingus/src/blitter.cpp
   trunk/pingus/src/collision_mask.hpp
   trunk/pingus/src/ground_map.cpp
   trunk/pingus/src/resource.cpp
   trunk/pingus/src/surface.cpp
Log:
- fixed missing handling of Colorkey and Palette in 
Blitter::create_from_format()

Modified: trunk/pingus/TODO
===================================================================
--- trunk/pingus/TODO   2007-09-15 01:09:22 UTC (rev 3149)
+++ trunk/pingus/TODO   2007-09-15 01:30:41 UTC (rev 3150)
@@ -74,7 +74,8 @@
 - What happened with StartPos?!
 
 - do we need z-pos for anything or does implicit object position serve
-  the same purpose?
+  the same purpose? Problem: Groundpieces all have the same z-level,
+  the editor doesn't handle that and allows insertions inbetween
 
 - object raising doesn't work for group
 
@@ -117,6 +118,12 @@
   f      - flip
   r      - rotate
 
+-  
+
+- implement proper tmpfile Support (including backup use?)
+
+- ObjectSelector need to support more object types: Starbackground, 
SolidColorBackground
+
 - make combo box open to the top or bottom depending on variable
 
 - ObjectSelector scroll limit is missing, also doesn't display all objects

Modified: trunk/pingus/src/blitter.cpp
===================================================================
--- trunk/pingus/src/blitter.cpp        2007-09-15 01:09:22 UTC (rev 3149)
+++ trunk/pingus/src/blitter.cpp        2007-09-15 01:30:41 UTC (rev 3150)
@@ -254,12 +254,21 @@
   if (surface->flags & SDL_SRCALPHA)
     flags |= SDL_SRCALPHA;
 
-  return SDL_CreateRGBSurface(flags, w, h,
-                              surface->format->BitsPerPixel, 
-                              surface->format->Rmask,
-                              surface->format->Gmask,
-                              surface->format->Bmask,
-                              surface->format->Amask);
+  SDL_Surface* new_surface = SDL_CreateRGBSurface(flags, w, h,
+                                                  
surface->format->BitsPerPixel, 
+                                                  surface->format->Rmask,
+                                                  surface->format->Gmask,
+                                                  surface->format->Bmask,
+                                                  surface->format->Amask);
+
+  if (surface->format->palette)
+    SDL_SetPalette(new_surface, SDL_LOGPAL, surface->format->palette->colors, 
+                   0, surface->format->palette->ncolors);
+
+  if (surface->flags & SDL_SRCCOLORKEY)
+    SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY, surface->format->colorkey);
+
+  return new_surface;
 }
 
 /* EOF */

Modified: trunk/pingus/src/collision_mask.hpp
===================================================================
--- trunk/pingus/src/collision_mask.hpp 2007-09-15 01:09:22 UTC (rev 3149)
+++ trunk/pingus/src/collision_mask.hpp 2007-09-15 01:30:41 UTC (rev 3150)
@@ -28,10 +28,10 @@
 class CollisionMask
 {
 public:
-  Surface    surface;
-  uint8_t*    buffer;
-  int         width;
-  int         height;
+  Surface   surface;
+  uint8_t*  buffer;
+  int       width;
+  int       height;
 
 public:
   CollisionMask();

Modified: trunk/pingus/src/ground_map.cpp
===================================================================
--- trunk/pingus/src/ground_map.cpp     2007-09-15 01:09:22 UTC (rev 3149)
+++ trunk/pingus/src/ground_map.cpp     2007-09-15 01:30:41 UTC (rev 3150)
@@ -226,9 +226,9 @@
               if (*sptr != colorkey && colmap->getpixel(real_x_arg+x, 
real_y_arg+y) != Groundtype::GP_SOLID)
                 {
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
-                    *tptr = 0;
+                  *tptr = 0;
 #else
-                    tptr[3] = 0;
+                  tptr[3] = 0;
 #endif
                 }
 
@@ -249,9 +249,9 @@
               if (colmap->getpixel(real_x_arg+x, real_y_arg+y) != 
Groundtype::GP_SOLID)
                 {
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
-                    *tptr = 0;
+                  *tptr = 0;
 #else
-                    tptr[3] = 0;
+                  tptr[3] = 0;
 #endif
                 }
               

Modified: trunk/pingus/src/resource.cpp
===================================================================
--- trunk/pingus/src/resource.cpp       2007-09-15 01:09:22 UTC (rev 3149)
+++ trunk/pingus/src/resource.cpp       2007-09-15 01:30:41 UTC (rev 3150)
@@ -137,9 +137,16 @@
 {
   SpriteDescription* desc = resmgr.get_sprite_description(desc_.res_name);
   if (desc)
-    return Surface(desc->filename).mod(desc_.modifier);
+    {
+      if (desc_.modifier == ResourceModifierNS::ROT0)
+        return Surface(desc->filename);
+      else
+        return Surface(desc->filename).mod(desc_.modifier);
+    }
   else
-    return Surface(desc->filename).mod(desc_.modifier);
+    {
+      return Surface(Pathname("images/core/misc/404.png", 
Pathname::DATA_PATH));
+    }
 }
 
 Surface

Modified: trunk/pingus/src/surface.cpp
===================================================================
--- trunk/pingus/src/surface.cpp        2007-09-15 01:09:22 UTC (rev 3149)
+++ trunk/pingus/src/surface.cpp        2007-09-15 01:30:41 UTC (rev 3150)
@@ -24,7 +24,7 @@
 #include "debug.hpp"
 #include "blitter.hpp"
 #include "surface.hpp"
-
+
 class SurfaceImpl
 {
 public:
@@ -32,7 +32,13 @@
   bool  delete_surface;
   bool       optimized;
 
-  SurfaceImpl(SDL_Surface* surface = NULL, bool delete_surface_ = true) 
+  SurfaceImpl()
+    : surface(0),
+      delete_surface(false),
+      optimized(false)
+  {}
+
+  SurfaceImpl(SDL_Surface* surface, bool delete_surface_ = true) 
     : surface(surface),
       delete_surface(delete_surface_),
       optimized(false)
@@ -44,7 +50,7 @@
       SDL_FreeSurface(surface);
   }
 };
-
+
 Surface::Surface()
 {
 }
@@ -59,8 +65,7 @@
   SDL_Surface* surface = IMG_Load(pathname.get_sys_path().c_str());
   if (surface)
     {
-      impl = boost::shared_ptr<SurfaceImpl>(new SurfaceImpl());
-      impl->surface = surface;
+      impl = boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(surface, true));
     }
 }
 
@@ -302,17 +307,12 @@
     SDL_SetPalette(new_surface, SDL_LOGPAL, 
impl->surface->format->palette->colors, 
                    0, impl->surface->format->palette->ncolors);
 
+  if (impl->surface->flags & SDL_SRCCOLORKEY)
+    SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY, 
impl->surface->format->colorkey);
+
   SDL_BlitSurface(impl->surface, NULL, new_surface, &dst_rect);
 
-  /* FIXME: Need to copy palette and color key?!
-    if (impl->surface->format->palette)
-    SDL_SetPalette(subsurface, SDL_LOGPAL, 
impl->surface->format->palette->colors, 
-    0, impl->surface->format->palette->ncolors);
 
-    if (impl->surface->flags & SDL_SRCCOLORKEY)
-    SDL_SetColorKey(subsurface, SDL_SRCCOLORKEY, 
impl->surface->format->colorkey);
-  */
-
   return Surface(boost::shared_ptr<SurfaceImpl>(new SurfaceImpl(new_surface, 
true)));
 }
 
@@ -332,5 +332,5 @@
 
   SDL_FreeSurface(tmp);
 }
-
+
 /* EOF */





reply via email to

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