feuerkraft-cvs
[Top][All Lists]
Advanced

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

[Feuerkraft-CVS] rev 301 - in trunk: data data/images data/missions src


From: Ingo Ruhnke
Subject: [Feuerkraft-CVS] rev 301 - in trunk: data data/images data/missions src src/particles src/vehicles
Date: Sat, 06 Dec 2003 15:03:37 +0100

Author: grumbel
Date: 2003-12-06 15:03:36 +0100 (Sat, 06 Dec 2003)
New Revision: 301

Added:
   trunk/data/images/rocket.png
   trunk/data/images/rocket1.png
   trunk/data/images/rocket_smoke.png
   trunk/src/particles/rocket_smoke_particle.cxx
   trunk/src/particles/rocket_smoke_particle.hxx
   trunk/src/rocket.cxx
   trunk/src/rocket.hxx
Modified:
   trunk/data/feuerkraft.scm
   trunk/data/feuerkraft.xml
   trunk/data/missions/airport.scm
   trunk/src/Makefile.am
   trunk/src/communication_dialog.cxx
   trunk/src/communication_dialog.hxx
   trunk/src/explosion.cxx
   trunk/src/particles/Makefile.am
   trunk/src/projectile.cxx
   trunk/src/vehicles/helicopter.cxx
   trunk/src/vehicles/helicopter.hxx
   trunk/src/vehicles/turret.cxx
Log:
- added rocket and rocket trails

Modified: trunk/data/feuerkraft.scm
===================================================================
--- trunk/data/feuerkraft.scm   2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/data/feuerkraft.scm   2003-12-06 14:03:36 UTC (rev 301)
@@ -284,7 +284,7 @@
 ;;;;;;;;;;;;;;;;;
 (menu-add-item comm-menu "Help!"
                (lambda ()
-                 (comm-send-message 'player "I need help!")
+                 (comm-unit-message (player-get-current-unit) "I need help!")
 
                  (let* ((obj (player-get-current-unit))
                         (target-x (+ (gameobj-get-property obj "x-pos") 100))
@@ -305,7 +305,7 @@
 
 (menu-add-item comm-menu "Bomb Attack!"
                (lambda ()
-                 (comm-send-message 'player "Request Bomber support!")
+                 (comm-unit-message (player-get-current-unit) "Request Bomber 
support!")
                  (let ((obj (player-get-current-unit)))
                    (bomber-attack (inexact->exact (gameobj-get-property obj 
"x-pos"))
                                   (inexact->exact (gameobj-get-property obj 
"y-pos"))))))

Modified: trunk/data/feuerkraft.xml
===================================================================
--- trunk/data/feuerkraft.xml   2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/data/feuerkraft.xml   2003-12-06 14:03:36 UTC (rev 301)
@@ -15,6 +15,15 @@
       <image file="images/keys.png" />
     </sprite>
 
+    <sprite name="rocket_smoke">
+      <image file="images/rocket_smoke.png" />
+    </sprite>
+
+    <sprite name="rocket">
+      <image file="images/rocket.png" />
+      <image file="images/rocket1.png" />
+    </sprite>
+
     <sprite name="endscreen">
       <image file="images/endscreen.jpg" />
     </sprite>

Added: trunk/data/images/rocket.png
===================================================================
(Binary files differ)


Property changes on: trunk/data/images/rocket.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/images/rocket1.png
===================================================================
(Binary files differ)


Property changes on: trunk/data/images/rocket1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/images/rocket_smoke.png
===================================================================
(Binary files differ)


Property changes on: trunk/data/images/rocket_smoke.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/data/missions/airport.scm
===================================================================
--- trunk/data/missions/airport.scm     2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/data/missions/airport.scm     2003-12-06 14:03:36 UTC (rev 301)
@@ -271,7 +271,7 @@
 
 (menu-add-item comm-menu "Bomb Attack!" 
                (lambda () 
-                 (comm-send-message 'player "Request Bomber support!")
+                 (comm-unit-message (player-get-current-unit) "Request Bomber 
support!")
                  (let ((obj (player-get-current-unit)))
                    (bomber-attack (inexact->exact (gameobj-get-property obj 
"x-pos"))
                                   (inexact->exact (gameobj-get-property obj 
"y-pos"))))))

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am       2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/Makefile.am       2003-12-06 14:03:36 UTC (rev 301)
@@ -119,6 +119,8 @@
 radar.hxx \
 robot_tank.hxx \
 robot_tank.cxx \
+rocket.hxx \
+rocket.cxx \
 resource_manager.cxx \
 resource_manager.hxx \
 satchel_charge.hxx \

Modified: trunk/src/communication_dialog.cxx
===================================================================
--- trunk/src/communication_dialog.cxx  2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/communication_dialog.cxx  2003-12-06 14:03:36 UTC (rev 301)
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <ClanLib/Display/display.h>
+#include <ClanLib/Core/System/system.h>
 #include "fonts.hxx"
 #include "unit.hxx"
 #include "view.hxx"
@@ -45,7 +46,7 @@
       if (unit)
         {
           CL_Font font = Fonts::font;
-          CL_Rect bbox = font.bounding_rect(0, 0, i->second);
+          CL_Rect bbox = font.bounding_rect(0, 0, i->second.text);
 
           FloatVector2d unit_pos   = 
View::current()->world_to_screen(unit->get_pos());
           FloatVector2d dialog_pos = unit_pos + FloatVector2d(0, - 
50-bbox.get_height());
@@ -66,21 +67,33 @@
                                 CL_Color(0,0,0, 100));
 
           font.set_alignment(origin_bottom_center);
-          font.draw(int(dialog_pos.x+10), int(dialog_pos.y+10), i->second);
+          font.draw(int(dialog_pos.x+10), int(dialog_pos.y+10), 
i->second.text);
         }
     }
 }
 
 void
-CommunicationDialog::send(int unit_id, const std::string& message)
+CommunicationDialog::send(int unit_id, const std::string& text)
 {
+  Message message;
+
+  message.time = CL_System::get_time();
+  message.text = text;
+
   messages[unit_id] = message;
 }
 
 void
 CommunicationDialog::update (float delta)
 {
-  
+  // Remove old messages from the display
+  for (Messages::iterator i = messages.begin(); i != messages.end(); ++i)
+    {
+      if (i->second.time + 2000 < CL_System::get_time())
+        {
+          messages.erase(i);
+        }
+    }
 }
 
 /* EOF */

Modified: trunk/src/communication_dialog.hxx
===================================================================
--- trunk/src/communication_dialog.hxx  2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/communication_dialog.hxx  2003-12-06 14:03:36 UTC (rev 301)
@@ -27,7 +27,13 @@
 class CommunicationDialog : public GuiObj
 {
 private:
-  typedef std::map<int, std::string> Messages;
+  class Message {
+  public:
+    unsigned int time;
+    std::string  text;
+  };
+
+  typedef std::map<int, Message> Messages;
   Messages messages;
 
   static CommunicationDialog* current_;

Modified: trunk/src/explosion.cxx
===================================================================
--- trunk/src/explosion.cxx     2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/explosion.cxx     2003-12-06 14:03:36 UTC (rev 301)
@@ -33,11 +33,14 @@
   switch (en_size)
     {
     case SMALL:
-    case LARGE:
       lifetime = .5;
       size = .6;
       break;
     case MEDIUM:
+      lifetime = .5;
+      size = 1.0f;
+      break;
+    case LARGE:
       lifetime = 25;
       GameWorld::current()->add(new Shockwave(pos));
       size = 2;
@@ -69,7 +72,7 @@
        {     
          switch (en_size)
            {
-           case MEDIUM:
+           case LARGE:
              GameWorld::current()->add (new ExplosionParticle(FloatVector2d 
(pos.x + (rand()%40 - 20), 
                                                                           
pos.y + (rand()%40 - 20)),
                                                                FloatVector2d 
(rand ()%20 - 10, rand ()%20 - 10), 
@@ -80,6 +83,13 @@
                                                                
Random::frand(size) + 1.0)); 
              break;
 
+            case MEDIUM:
+              GameWorld::current()->add (new ExplosionParticle(FloatVector2d 
(pos.x + (rand()%10 - 5), 
+                                                                          
pos.y + (rand()%10 - 5)),
+                                                               FloatVector2d 
(rand ()%20 - 10, rand ()%20 - 10), 
+                                                               
Random::frand(size) + .5)); 
+              break;
+
            default:
               GameWorld::current()->add (new ExplosionParticle(FloatVector2d 
(pos.x + (rand()%10 - 5), 
                                                                           
pos.y + (rand()%10 - 5)),

Modified: trunk/src/particles/Makefile.am
===================================================================
--- trunk/src/particles/Makefile.am     2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/particles/Makefile.am     2003-12-06 14:03:36 UTC (rev 301)
@@ -11,7 +11,9 @@
  fire_particle.cxx     \
  fire_emitter.hxx      \
  fire_emitter.cxx      \
+ rocket_smoke_particle.hxx     \
+ rocket_smoke_particle.cxx     \
  smoke_emitter.hxx     \
- smoke_emitter.cxx      
+ smoke_emitter.cxx     
 
 # EOF #
\ No newline at end of file

Added: trunk/src/particles/rocket_smoke_particle.cxx
===================================================================
--- trunk/src/particles/rocket_smoke_particle.cxx       2003-12-06 01:16:00 UTC 
(rev 300)
+++ trunk/src/particles/rocket_smoke_particle.cxx       2003-12-06 14:03:36 UTC 
(rev 301)
@@ -0,0 +1,64 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include "../view.hxx"
+#include "../resource_manager.hxx"
+#include "rocket_smoke_particle.hxx"
+
+RocketSmokeParticle::RocketSmokeParticle(const FloatVector2d& arg_pos)
+{
+  pos = arg_pos;
+  size = 1;
+  angle = rand () % 360;    
+  sprite = resources->get_sprite("feuerkraft/rocket_smoke");
+  max_life_time = 10.0f;
+  life_time = max_life_time;
+  //velocity = FloatVector2d (80.0f, 0.0f);
+}
+
+RocketSmokeParticle::~RocketSmokeParticle()
+{
+}
+
+void
+RocketSmokeParticle::update (float delta) 
+{
+  pos += GameWorld::current()->get_wind() * delta;
+
+  Particle::update (delta);
+
+  life_time -= delta;
+}
+
+void
+RocketSmokeParticle::draw (View& view) 
+{    
+  sprite.set_alpha ((life_time/max_life_time) * .3);
+  sprite.set_scale (0.8f + ((1 - life_time/max_life_time)) * 4.0f,
+                    0.8f + ((1 - life_time/max_life_time)) * 4.0f);
+  view.draw(sprite, pos, angle);
+}
+
+float
+RocketSmokeParticle::get_z_pos () 
+{
+  return 100; 
+}
+
+/* EOF */

Added: trunk/src/particles/rocket_smoke_particle.hxx
===================================================================
--- trunk/src/particles/rocket_smoke_particle.hxx       2003-12-06 01:16:00 UTC 
(rev 300)
+++ trunk/src/particles/rocket_smoke_particle.hxx       2003-12-06 14:03:36 UTC 
(rev 301)
@@ -0,0 +1,48 @@
+//  $Id$
+// 
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_ROCKET_SMOKE_PARTICLE_HXX
+#define HEADER_ROCKET_SMOKE_PARTICLE_HXX
+
+#include "particle.hxx"
+
+/** */
+class RocketSmokeParticle : public Particle
+{
+private:
+  float max_life_time;
+  float size;
+  float angle;
+  CL_Sprite sprite;
+  
+public:
+  RocketSmokeParticle(const FloatVector2d& arg_pos);
+  ~RocketSmokeParticle();
+private:
+  RocketSmokeParticle (const RocketSmokeParticle&);
+  RocketSmokeParticle& operator= (const RocketSmokeParticle&);
+
+  void update (float delta);
+  void draw (View& view);
+  float get_z_pos ();
+};
+
+#endif
+
+/* EOF */

Modified: trunk/src/projectile.cxx
===================================================================
--- trunk/src/projectile.cxx    2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/projectile.cxx    2003-12-06 14:03:36 UTC (rev 301)
@@ -93,7 +93,7 @@
 Projectile::detonate ()
 {
   lifetime = -1;
-  GameWorld::current()->add_front (new Explosion(pos));
+  GameWorld::current()->add_front(new Explosion(pos));
 }
 
 void

Added: trunk/src/rocket.cxx
===================================================================
--- trunk/src/rocket.cxx        2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/rocket.cxx        2003-12-06 14:03:36 UTC (rev 301)
@@ -0,0 +1,74 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include "resource_manager.hxx"
+#include "collision_manager.hxx"
+#include "explosion.hxx"
+#include "particles/rocket_smoke_particle.hxx"
+#include "view.hxx"
+#include "rocket.hxx"
+
+Rocket::Rocket(const FloatVector2d& pos, float orientation)
+  : pos(pos),
+    orientation(orientation),
+    velocity(10.0f),
+    max_velocity(50.0f)
+{
+  sprite = resources->get_sprite("feuerkraft/rocket");
+  smoke  = resources->get_sprite("feuerkraft/rocket_smoke");
+}
+
+Rocket::~Rocket()
+{
+}
+
+void
+Rocket::draw(View& view)
+{
+  view.draw(sprite, pos, orientation);
+}
+
+void
+Rocket::update(float delta)
+{
+  pos += FloatVector2d(velocity, 0).rotate(orientation);
+
+  velocity += 10.0f * delta;
+  if (velocity > max_velocity)
+    velocity = max_velocity;
+
+  CollisionManager::current()->add_point(get_id(), pos.x, pos.y);
+
+  GameWorld::current()->add(new RocketSmokeParticle(pos));
+}
+
+void
+Rocket::on_collision_with_building(Building* building)
+{
+  detonate();
+}
+
+void
+Rocket::detonate()
+{
+  GameWorld::current()->add_front(new Explosion(pos, Explosion::MEDIUM));
+  remove();
+}
+
+/* EOF */

Added: trunk/src/rocket.hxx
===================================================================
--- trunk/src/rocket.hxx        2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/rocket.hxx        2003-12-06 14:03:36 UTC (rev 301)
@@ -0,0 +1,52 @@
+//  $Id$
+// 
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_ROCKET_HXX
+#define HEADER_ROCKET_HXX
+
+#include "vector2d.hxx"
+#include "game_obj.hxx"
+
+/** */
+class Rocket : public GameObj
+{
+private:
+  CL_Sprite sprite;
+  CL_Sprite smoke;
+  FloatVector2d pos;
+  float orientation;
+  float velocity;
+  float max_velocity;
+public:
+  Rocket(const FloatVector2d& pos, float orientation);
+  ~Rocket();
+
+  void draw(View& view);
+  void update(float delta);
+
+  void detonate();
+  void on_collision_with_building(Building* building);
+private:
+  Rocket (const Rocket&);
+  Rocket& operator= (const Rocket&);
+};
+
+#endif
+
+/* EOF */

Modified: trunk/src/vehicles/helicopter.cxx
===================================================================
--- trunk/src/vehicles/helicopter.cxx   2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/vehicles/helicopter.cxx   2003-12-06 14:03:36 UTC (rev 301)
@@ -23,12 +23,12 @@
 #include "../explosion.hxx"
 #include "../vehicle_ai.hxx"
 #include "../ai_manager.hxx"
+#include "../rocket.hxx"
 #include "../resource_manager.hxx"
 #include "helicopter.hxx"
 
 Helicopter::Helicopter(const AList& lst)
   : strafe (0.0),
-    fireing (false),
     reloading (0),
     energie (100),
     destroyed (false),
@@ -178,17 +178,12 @@
   velocity /= 1.03f;
   strafe   /= 1.03f;
 
-  if (fireing && !reloading)
+  if (firing && !reloading)
     {
-      float rot_orientation = orientation;
-      FloatVector2d dir = FloatVector2d (15.0, 0.0).rotate(rot_orientation);
-      GameWorld::current()->add (new Projectile(this, pos
-                                                + FloatVector2d (0.0, 
-5.0).rotate (rot_orientation),
-                                                dir));
-      reloading = 4;
+      GameWorld::current()->add(new Rocket(get_pos(), orientation + 
3.1415927f));
+      reloading = 10;
     }
 
-  //std::cout << "Fireing: " << fireing << " " << reloading << std::endl;
 
   if (reloading)
     --reloading;

Modified: trunk/src/vehicles/helicopter.hxx
===================================================================
--- trunk/src/vehicles/helicopter.hxx   2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/vehicles/helicopter.hxx   2003-12-06 14:03:36 UTC (rev 301)
@@ -43,7 +43,6 @@
   CL_Sprite helidestroyed;
 
   float strafe;
-  bool  fireing;
   int   reloading;
   Energie energie;
   bool destroyed;

Modified: trunk/src/vehicles/turret.cxx
===================================================================
--- trunk/src/vehicles/turret.cxx       2003-12-06 01:16:00 UTC (rev 300)
+++ trunk/src/vehicles/turret.cxx       2003-12-06 14:03:36 UTC (rev 301)
@@ -2,6 +2,7 @@
 #include "../projectile.hxx"
 #include "../math.hxx"
 #include "../resource_manager.hxx"
+#include "../rocket.hxx"
 #include "tank.hxx"
 #include "turret.hxx"
 





reply via email to

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