pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src game_session.cxx,1.21,1.22 goal_manag


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src game_session.cxx,1.21,1.22 goal_manager.hxx,1.2,1.3 pingus_main.cxx,1.23,1.24 screenshot.cxx,1.8,1.9 smallmap.cxx,1.22,1.23 smallmap.hxx,1.13,1.14 world.cxx,1.31,1.32 world.hxx,1.18,1.19 worldobj.cxx,1.9,1.10 worldobj.hxx,1.10,1.11
Date: 10 Oct 2002 12:25:56 -0000

Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv2198

Modified Files:
        game_session.cxx goal_manager.hxx pingus_main.cxx 
        screenshot.cxx smallmap.cxx smallmap.hxx world.cxx world.hxx 
        worldobj.cxx worldobj.hxx 
Log Message:
- added exit/entrances back to the smallmap
- misc other cleanup

Index: game_session.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_session.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- game_session.cxx    8 Oct 2002 18:18:21 -0000       1.21
+++ game_session.cxx    10 Oct 2002 12:25:53 -0000      1.22
@@ -83,6 +83,11 @@
 void
 PingusGameSession::update (const GameDelta& delta)
 {
+  if (number_of_redraws == 1)
+    {
+      last_update = CL_System::get_time();
+    }
+
   if (server->is_finished())
     {
       ScreenManager::instance()->pop_screen();

Index: goal_manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/goal_manager.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goal_manager.hxx    9 Oct 2002 23:09:45 -0000       1.2
+++ goal_manager.hxx    10 Oct 2002 12:25:53 -0000      1.3
@@ -37,7 +37,7 @@
   GoalType goal;
 
   /** time at which is_finished() will return true */
-  unsigned int exit_time;
+  int exit_time;
 
 public:
   GoalManager(Server* plf);

Index: pingus_main.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_main.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- pingus_main.cxx     8 Oct 2002 18:06:25 -0000       1.23
+++ pingus_main.cxx     10 Oct 2002 12:25:53 -0000      1.24
@@ -61,6 +61,7 @@
 #include "pingus_error.hxx"
 #include "global_event.hxx"
 #include "config.hxx"
+#include "config_xml.hxx"
 #include "console.hxx"
 #include "fps_counter.hxx"
 #include "message_box.hxx"
@@ -151,6 +152,7 @@
 
       // FIXME: kind of weird...
       boost::shared_ptr<Config> config(new Config(rcfile));
+      
//ConfigXML("/home/ingo/projects/pingus/cvs/data/levels/stone3-grumbel.xml");
     }
 }
 

Index: screenshot.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/screenshot.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- screenshot.cxx      6 Oct 2002 17:33:32 -0000       1.8
+++ screenshot.cxx      10 Oct 2002 12:25:53 -0000      1.9
@@ -131,12 +131,6 @@
   std::cout << "Target: bit: " << target->get_depth() << "\n"
            << "        bitperpiexel: " << target->get_bytes_per_pixel()  << 
std::endl;
 
-  /*  printf("ColorMask: r:%x g:%x b:%x a:%x\n",
-        target->get_red_mask(),
-        target->get_green_mask(),
-        target->get_blue_mask(),
-        target->get_alpha_mask());
-  */
   out << "P3\n" 
       << "# CREATOR: Pingus... some version\n"
       << target->get_width() << " "
@@ -144,15 +138,16 @@
       << "255" << std::endl;
 
   target->lock();
-  for (unsigned int y=0; y < target->get_height(); ++y) {
-    for (unsigned int x=0; x < target->get_width(); ++x)
-      {
-       target->get_pixel(x, y, &red, &green, &blue, &alpha);
-       out << (int)(red * 255) << " " 
-           << (int)(green * 255) << " "
-           << (int)(blue * 255) << "\n";
-      }
-  }
+  for (unsigned int y=0; y < target->get_height(); ++y) 
+    {
+      for (unsigned int x=0; x < target->get_width(); ++x)
+        {
+          target->get_pixel(x, y, &red, &green, &blue, &alpha);
+          out << (int)(red * 255) << " " 
+              << (int)(green * 255) << " "
+              << (int)(blue * 255) << "\n";
+        }
+    }
   target->unlock();
 }
 

Index: smallmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- smallmap.cxx        7 Oct 2002 23:09:14 -0000       1.22
+++ smallmap.cxx        10 Oct 2002 12:25:53 -0000      1.23
@@ -35,7 +35,8 @@
 
 SmallMap::SmallMap()
   : canvas(0),
-    update_count(0)
+    update_count(0),
+    gc_ptr(0)
 {
   max_width = 175;
   max_height = 100;
@@ -149,24 +150,6 @@
             }
        }
     }
-  /* FIXME: due to API change in PLF disabled
-     std::vector<ExitData>     exit_d     = plf->get_exit();
-     for(std::vector<ExitData>::iterator i = exit_d.begin(); i != 
exit_d.end(); ++i)
-     {
-     // FIXME: Replace this with put_target() when it is bug free
-     Blitter::put_surface(canvas, exit_sur, 
-     i->pos.x * width / colmap->get_width() - (exit_sur.get_width()/2), 
-     i->pos.y * height / colmap->get_height());
-     }
-
-     std::vector<EntranceData>     entrance_d     = plf->get_entrance();
-     for(std::vector<EntranceData>::iterator i = entrance_d.begin(); i != 
entrance_d.end(); ++i)
-     {
-     Blitter::put_surface(canvas, entrance_sur,
-     i->pos.x * width / colmap->get_width() - (entrance_sur.get_width()/2),
-     i->pos.y * height / colmap->get_height() - (entrance_sur.get_height()));
-     }
-  */
   canvas->unlock();
 
   //Timer surface_timer("Smallmap surface creation");
@@ -190,6 +173,8 @@
 void
 SmallMap::draw (GraphicContext& gc)
 {
+  gc_ptr = &gc;
+
   Playfield* playfield = client->get_playfield();
 
   int x_of = playfield->get_x_offset();
@@ -228,8 +213,11 @@
                               i->y_pos * height / colmap->get_height() + 
y_pos);
     }
   */
+  client->get_server()->get_world()->draw_smallmap(this);
+
   draw_pingus();
-  UNUSED_ARG(gc);
+
+  gc_ptr = 0;
 }
 
 void
@@ -257,7 +245,6 @@
 {
   float smallmap_update_time = 2.0f;
 
-  UNUSED_ARG(delta);
   update_count += delta;
 
   if (update_count > smallmap_update_time)
@@ -270,6 +257,16 @@
           init();
         }
     }
+}
+
+void
+SmallMap::draw_sprite(Sprite sprite, Vector pos)
+{
+  World* world = client->get_server()->get_world();
+  float x = x_pos + (pos.x * width  / world->get_colmap()->get_width());
+  float y = y_pos + (pos.y * height / world->get_colmap()->get_height());
+  
+  gc_ptr->draw(sprite, Vector(x, y));
 }
 
 bool

Index: smallmap.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap.hxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- smallmap.hxx        7 Oct 2002 23:09:14 -0000       1.13
+++ smallmap.hxx        10 Oct 2002 12:25:53 -0000      1.14
@@ -80,28 +80,41 @@
 
   unsigned int colmap_serial;
 
+  /** Pointer to the current GC, only valid inside draw() */
+  GraphicContext* gc_ptr;
+
 public:
   SmallMap();
   virtual ~SmallMap();
-  
+
+  /*{ @name Stuff called from the GUIManager */
   void on_primary_button_press(int x, int y);
   void on_primary_button_release(int x, int y);
   void on_pointer_move(int x, int y);
 
+  // Events
+  void on_pointer_enter ();
+  void on_pointer_leave ();
+
   void set_client(Client* c);
+
+  bool is_at (int x, int y);
   bool mouse_over();
-  void init();
+
   void draw(GraphicContext& gc);
-  void draw_pingus();
   void update(float delta);
+  /*}*/
 
-  bool is_at (int x, int y);
-
-  // Events
-  void on_pointer_enter ();
-  void on_pointer_leave ();
+  /** draws a symbolic sprite onto the smallmap 
+      @param sprite the Sprite to draw, it will keep its original size
+      @param pos the position to draw it in World COs, it will get
+      recalculated to screen CO */
+  void draw_sprite(Sprite sprite, Vector pos);
   
 private:
+  void init();
+  void draw_pingus();
+  
   SmallMap (const SmallMap&);
   SmallMap& operator= (const SmallMap&);
 };

Index: world.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/world.cxx,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- world.cxx   8 Oct 2002 00:09:55 -0000       1.31
+++ world.cxx   10 Oct 2002 12:25:53 -0000      1.32
@@ -145,6 +145,15 @@
   particle_holder->draw (gc); 
 }
 
+void
+World::draw_smallmap(SmallMap* smallmap)
+{
+  for(WorldObjIter obj = world_obj.begin(); obj != world_obj.end(); ++obj)
+    {
+      (*obj)->draw_smallmap (smallmap);
+    } 
+}
+
 void 
 World::update()
 {

Index: world.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/world.hxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- world.hxx   8 Oct 2002 00:09:55 -0000       1.18
+++ world.hxx   10 Oct 2002 12:25:53 -0000      1.19
@@ -42,6 +42,7 @@
 class ColMap;
 class WorldObj;
 class GameTime;
+class SmallMap;
 class GraphicContext;
 
 using std::list;
@@ -87,6 +88,9 @@
 
   /** Draw the world onto the given GraphicContext */
   void    draw (GraphicContext& gc);
+
+  /** Draw the world onte the given SmallMap*/
+  void    draw_smallmap(SmallMap* smallmap);
 
   /** Update the World */
   void    update ();

Index: worldobj.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- worldobj.cxx        1 Oct 2002 19:53:44 -0000       1.9
+++ worldobj.cxx        10 Oct 2002 12:25:53 -0000      1.10
@@ -62,6 +62,12 @@
 }
 
 void
+WorldObj::draw_smallmap(SmallMap* smallmap)
+{
+  UNUSED_ARG(smallmap);
+}
+
+void
 WorldObj::draw (GraphicContext& gc)
 {
   // FIXME: I need some docu on the meaning of get_x_offset() and co.

Index: worldobj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- worldobj.hxx        1 Oct 2002 19:53:44 -0000       1.10
+++ worldobj.hxx        10 Oct 2002 12:25:53 -0000      1.11
@@ -23,6 +23,7 @@
 #include "pingus.hxx"
 
 class GraphicContext;
+class SmallMap;
 class World;
 class WorldObjData;
 
@@ -68,6 +69,7 @@
 
   /** Draw the WorldObj to the given GraphicContext */
   virtual void draw (GraphicContext& gc);
+  virtual void draw_smallmap(SmallMap* smallmap);
 
   /** Draws the objects collision map to the main collision map, draws
       stuff onto the gfx map or do other manipulations to the World */





reply via email to

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