pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.7,1.8 action_butt


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.7,1.8 action_button.hxx,1.6,1.7 server.hxx,1.2,1.3 true_server.cxx,1.4,1.5 true_server.hxx,1.2,1.3
Date: 3 Aug 2002 12:01:00 -0000

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

Modified Files:
        action_button.cxx action_button.hxx server.hxx true_server.cxx 
        true_server.hxx 
Log Message:
fixed armageddon to require a double click

Index: action_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_button.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- action_button.cxx   3 Aug 2002 11:37:45 -0000       1.7
+++ action_button.cxx   3 Aug 2002 12:00:58 -0000       1.8
@@ -192,7 +192,7 @@
 void
 ArmageddonButton::draw()
 {
-  if (pressed)
+  if (server->get_armageddon ())
     {
       backgroundhl.put_screen (x_pos, y_pos);
       surface.put_screen(x_pos, y_pos, ++counter);
@@ -204,6 +204,25 @@
     }
 }
 
+void
+ArmageddonButton::update(float delta)
+{
+  if (pressed)
+    {
+      press_time += delta;
+      if (press_time > 1.0f)
+       {
+         press_time = 0;
+         pressed = false;
+       }
+    }
+  else
+    {
+      pressed = false;
+      press_time = 0;
+    }
+}
+
 bool
 ArmageddonButton::is_at(int x, int y)
 {
@@ -219,8 +238,14 @@
 void
 ArmageddonButton::on_primary_button_click (int x, int y)
 {
-  pressed = true; // FIXME: should check the server state instead
-  server->get_world()->armageddon();
+  if  (pressed)
+    {
+      server->set_armageddon();
+    }
+  else
+    {
+      pressed = true;
+    }
 }
 
 ForwardButton::ForwardButton(Server* s, int x, int y) 

Index: action_button.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_button.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- action_button.hxx   2 Aug 2002 22:55:19 -0000       1.6
+++ action_button.hxx   3 Aug 2002 12:00:58 -0000       1.7
@@ -42,6 +42,7 @@
   int x_pos;
   int y_pos;
   bool pressed;
+  float press_time;
   CL_Surface surface;
   CL_Surface background;
   CL_Surface backgroundhl;
@@ -53,6 +54,7 @@
   virtual ~ArmageddonButton();
 
   void draw();
+  void update(float);
   bool is_at(int x, int y);
   void on_primary_button_click (int x, int y);
 };

Index: server.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/server.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- server.hxx  24 Jun 2002 22:52:56 -0000      1.2
+++ server.hxx  3 Aug 2002 12:00:58 -0000       1.3
@@ -75,6 +75,9 @@
 
   virtual bool needs_redraw() = 0;
 
+  virtual void set_armageddon () =0;
+  virtual bool get_armageddon () =0;
+
   virtual PLF* get_plf () =0;
 
   World* get_world();

Index: true_server.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/true_server.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- true_server.cxx     3 Aug 2002 11:37:45 -0000       1.4
+++ true_server.cxx     3 Aug 2002 12:00:58 -0000       1.5
@@ -30,6 +30,7 @@
   : Server (arg_plf),
     plf (arg_plf)
 {
+  armageddon = false;
   filename = plf->get_filename();
   world = 0;
   finished = false;
@@ -149,6 +150,19 @@
 TrueServer::get_plf ()
 {
   return plf;
+}
+
+void
+TrueServer::set_armageddon ()
+{
+  armageddon = true;
+  world->armageddon ();
+}
+
+bool
+TrueServer::get_armageddon ()
+{
+  return armageddon;
 }
 
 /* EOF */

Index: true_server.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/true_server.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- true_server.hxx     24 Jun 2002 22:52:57 -0000      1.2
+++ true_server.hxx     3 Aug 2002 12:00:58 -0000       1.3
@@ -32,6 +32,7 @@
   int  local_game_speed;
   bool client_needs_redraw;
   float delta;
+  bool armageddon;
 
   /** Reference to the PLF for this level, this must not be deleted */
   PLF* plf;
@@ -49,6 +50,9 @@
   
   void set_pause(bool);
   bool get_pause();
+
+  void set_armageddon ();
+  bool get_armageddon ();
 };
 
 #endif




reply via email to

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