[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,NONE
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,NONE,1.1 explosive_particle.hxx,NONE,1.1 ground_particle.cxx,NONE,1.1 ground_particle.hxx,NONE,1.1 particle.cxx,NONE,1.1 particle.hxx,NONE,1.1 particle_cache.cxx,NONE,1.1 particle_cache.hxx,NONE,1.1 particle_holder.cxx,NONE,1.1 particle_holder.hxx,NONE,1.1 pingu_particle.cxx,NONE,1.1 pingu_particle.hxx,NONE,1.1 rain_generator.cxx,NONE,1.1 rain_generator.hxx,NONE,1.1 rain_particle.cxx,NONE,1.1 rain_particle.hxx,NONE,1.1 smoke_particle.cxx,NONE,1.1 smoke_particle.hxx,NONE,1.1 snow_generator.cxx,NONE,1.1 snow_generator.hxx,NONE,1.1 snow_particle.cxx,NONE,1.1 snow_particle.hxx,NONE,1.1 weather_generator.cxx,NONE,1.1 weather_generator.hxx,NONE,1.1 Makefile.am,1.6,1.7 ExplosiveParticle.cc,1.5,NONE ExplosiveParticle.hh,1.2,NONE GroundParticle.cc,1.10,NONE GroundParticle.hh,1.7,NONE Particle.cc,1.12,NONE Particle.hh,1.13,NONE ParticleCache.cc,1.7,NONE ParticleCache.hh,1.6,NONE ParticleHolder.cc,1.7,NONE ParticleHolder.hh,1.9,NONE PinguParticle.cc,1.16,NONE PinguParticle.hh,1.10,NONE RainGenerator.cc,1.13,NONE RainGenerator.hh,1.5,NONE RainParticle.cc,1.11,NONE RainParticle.hh,1.8,NONE SmokeParticle.cc,1.12,NONE SmokeParticle.hh,1.8,NONE SnowGenerator.cc,1.12,NONE SnowGenerator.hh,1.5,NONE SnowParticle.cc,1.17,NONE SnowParticle.hh,1.8,NONE WeatherGenerator.cc,1.8,NONE WeatherGenerator.hh,1.10,NONE |
Date: |
12 Jun 2002 19:11:34 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/particles
In directory dark:/tmp/cvs-serv13225/particles
Modified Files:
Makefile.am
Added Files:
explosive_particle.cxx explosive_particle.hxx
ground_particle.cxx ground_particle.hxx particle.cxx
particle.hxx particle_cache.cxx particle_cache.hxx
particle_holder.cxx particle_holder.hxx pingu_particle.cxx
pingu_particle.hxx rain_generator.cxx rain_generator.hxx
rain_particle.cxx rain_particle.hxx smoke_particle.cxx
smoke_particle.hxx snow_generator.cxx snow_generator.hxx
snow_particle.cxx snow_particle.hxx weather_generator.cxx
weather_generator.hxx
Removed Files:
ExplosiveParticle.cc ExplosiveParticle.hh GroundParticle.cc
GroundParticle.hh Particle.cc Particle.hh ParticleCache.cc
ParticleCache.hh ParticleHolder.cc ParticleHolder.hh
PinguParticle.cc PinguParticle.hh RainGenerator.cc
RainGenerator.hh RainParticle.cc RainParticle.hh
SmokeParticle.cc SmokeParticle.hh SnowGenerator.cc
SnowGenerator.hh SnowParticle.cc SnowParticle.hh
WeatherGenerator.cc WeatherGenerator.hh
Log Message:
The big rename...
--- NEW FILE: explosive_particle.cxx ---
// $Id: explosive_particle.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 "../col_map.hxx"
#include "../pingu_map.hxx"
#include "../world.hxx"
#include "../particles/particle_holder.hxx"
#include "../pingus_resource.hxx"
#include "explosive_particle.hxx"
ExplosiveParticle::ExplosiveParticle (int x, int y, float x_a, float y_a)
: Particle (x, y, x_a, y_a),
alive (true)
{
sprite = Sprite (PingusResource::load_surface
("Particles/explosive",
"pingus"));
}
ExplosiveParticle::~ExplosiveParticle ()
{
}
void
ExplosiveParticle::update(float delta)
{
CL_Vector new_pos = pos + velocity * delta;
CL_Vector incr = pos - new_pos;
incr.normalize ();
// FIXME: This thing needs to be more abstract, we just need it far
// to often to reimplement it over and over again.
while (int(new_pos.x) != int(pos.x)
|| int(new_pos.y) != int(pos.y))
{
pos -= incr;
if (pos.x < 0 || pos.y < 0
|| pos.x + 1 > world->get_width ()
|| pos.y + 1 > world->get_height ())
{
alive = false;
return;
}
if (world->get_colmap ()->getpixel ((int) pos.x, (int) pos.y))
{
detonate ();
}
}
pos = new_pos;
}
void
ExplosiveParticle::detonate ()
{
alive = false;
CL_Surface bomber_radius = PingusResource::load_surface
("Other/bomber_radius", "pingus");
world->get_particle_holder ()->add_pingu_explo((int)pos.x, (int)pos.y);
// FIXME: Ugly do handle the colmap and the gfx map seperatly
world->get_colmap()->remove(bomber_radius,
int(pos.x) - (bomber_radius.get_width()/2),
int(pos.y) - (bomber_radius.get_height()/2));
world->get_gfx_map()->remove(bomber_radius,
int(pos.x) - (bomber_radius.get_width()/2),
int(pos.y) - (bomber_radius.get_height()/2));
}
void
ExplosiveParticle::draw_offset(int ofx, int ofy, float /*s*/)
{
sprite.put_screen (int(pos.x + ofx), int(pos.y + ofy));
}
bool
ExplosiveParticle::is_alive(void)
{
return alive;
}
/* EOF */
--- NEW FILE: explosive_particle.hxx ---
// $Id: explosive_particle.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 EXPLOSIVEPARTICLE_HH
#define EXPLOSIVEPARTICLE_HH
#include "../sprite.hxx"
#include "particle.hxx"
class ExplosiveParticle
: public Particle
{
private:
Sprite sprite;
bool alive;
public:
ExplosiveParticle (int x, int y, float x_a, float y_a);
~ExplosiveParticle ();
///
void update(float delta);
///
void draw_offset(int ofx, int ofy, float s);
///
bool is_alive(void);
void detonate ();
};
#endif
/* EOF */
--- NEW FILE: ground_particle.cxx ---
// $Id: ground_particle.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 "../globals.hxx"
#include "../pingus_resource.hxx"
#include "ground_particle.hxx"
GroundParticle::GroundParticle(int x, int y, float x_a, float y_a)
: Particle (x,y, x_a, y_a)
{
surface = PingusResource::load_surface("Particles/ground", "pingus");
livetime = 25 + (rand() % 10);
time = livetime;
}
void
GroundParticle::update(float /*delta*/)
{
pos.x += velocity.x;
pos.y += velocity.y;
// y_add += 0.1;
if (livetime > 0)
--livetime;
}
void
GroundParticle::draw_offset(int ofx, int ofy, float s)
{
if (fast_mode)
return;
if (s == 1.0) {
// FIXME: This segfaults from time to time, don't know why
surface.put_screen(int(pos.x + ofx - 16), int(pos.y + ofy - 16), 3 -
(livetime * 4 / time));
} else {
int width = (int)(surface.get_width() * s);
int height = (int)(surface.get_height() * s);
surface.put_screen((int)((pos.x + ofx) * s) - width/2, (int)((pos.y + ofy)
* s) - height/2,
width, height, 3 - (livetime * 4 / time));
}
}
/* EOF */
--- NEW FILE: ground_particle.hxx ---
// $Id: ground_particle.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 GROUNDPARTICLE_HH
#define GROUNDPARTICLE_HH
#include "particle.hxx"
///
class GroundParticle : public Particle
{
private:
int time;
public:
GroundParticle(int x, int y, float x_a, float y_a);
void update(float delta);
void draw_offset(int ofx, int ofy, float s);
};
#endif
/* EOF */
--- NEW FILE: particle.cxx ---
// $Id: particle.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 <cassert>
#include "particle.hxx"
Particle::Particle()
{
}
// Set all parameters to theire default value
Particle::Particle(int x, int y, float x_a, float y_a)
: pos (x, y),
velocity (x_a, y_a)
{
livetime = 50 + ( rand() % 25);
}
Particle::~Particle()
{
}
void
Particle::init(int x, int y, float x_a, float y_a)
{
pos.x = x;
pos.y = y;
velocity.x = x_a;
velocity.y = y_a;
livetime = 50 + ( rand() % 25);
}
void
Particle::update(float /*delta*/)
{
pos.x += velocity.x;
pos.y += velocity.y;
velocity.y += 0.1f;
if (livetime > 0)
--livetime;
}
void
Particle::draw_offset(int ofx, int ofy, float s)
{
if (s == 1.0) {
surface.put_screen((int)pos.x + ofx, (int)pos.y + ofy);
} else {
int width = (int)(surface.get_width() * s);
int height = (int)(surface.get_height() * s);
surface.put_screen((int)((pos.x + ofx) * s) - width/2, (int)((pos.y + ofy)
* s) - height/2,
width, height);
}
}
bool
Particle::is_alive()
{
return livetime;
}
/* EOF */
--- NEW FILE: particle.hxx ---
// $Id: particle.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 PARTICLE_HH
#define PARTICLE_HH
#include <ClanLib/Core/Math/cl_vector.h>
#include <ClanLib/Display/Display/surface.h>
#include "../worldobj.hxx"
///
class Particle : public WorldObj
{
protected:
CL_Surface surface;
/// The current position of the particle
CL_Vector pos;
/// The velocity of the particle
CL_Vector velocity;
CL_Vector force;
int livetime;
public:
Particle();
Particle(int x, int y, float x_a, float y_a);
virtual ~Particle();
/// Reinit a allready created particle with now coordinates
virtual void init(int x, int y, float x_a, float y_a);
/** If false is returned the particle gets deleted by the
ParticleHolder */
virtual bool is_alive(void);
virtual float get_z_pos() const { return pos.z; }
/// Let the particle move
virtual void update(float delta);
/// Draw the particle with the correct zoom resize
virtual void draw_offset(int, int, float);
};
#endif
/* EOF */
--- NEW FILE: particle_cache.cxx ---
// $Id: particle_cache.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 <iostream>
#include "pingu_particle.hxx"
#include "particle_cache.hxx"
ParticleCache::ParticleCache()
{
allocate(10000);
position = particles.begin();
}
ParticleCache::~ParticleCache()
{
std::cout << "ParticleCache:~ParticleCache" << std::endl;
clear();
}
Particle*
ParticleCache::create()
{
if (position != particles.end())
{
std::vector<Particle*>::iterator particle = position;
position++;
return *particle;
}
else
{
std::vector<Particle*>::iterator particle = position;
std::cout << "Out of particles" << std::endl;
particles.push_back(new PinguParticle());
position++;
return *particle;
}
}
void
ParticleCache::allocate(int num_objs)
{
for(int i=0; i < num_objs; i++)
{
particles.push_back(new PinguParticle());
}
}
void
ParticleCache::clear()
{
for(std::vector<Particle*>::iterator i = particles.begin(); i !=
particles.end(); i++)
{
delete (*i);
}
}
/* EOF */
--- NEW FILE: particle_cache.hxx ---
// $Id: particle_cache.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 PARTICLECACHE_HH
#define PARTICLECACHE_HH
#include <vector>
class Particle;
///
class ParticleCache
{
private:
///
std::vector<Particle*>::iterator position;
///
std::vector<Particle*> particles;
public:
///
ParticleCache();
///
~ParticleCache();
/// Returns an allready allocated object
Particle* create();
/// Allocates the given number of objects
void allocate(int);
/// Deletes all allocated objects
void clear();
}///
;
#endif
/* EOF */
--- NEW FILE: particle_holder.cxx ---
// $Id: particle_holder.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 "../globals.hxx"
#include "../algo.hxx"
#include "pingu_particle.hxx"
#include "particle_holder.hxx"
ParticleHolder::ParticleHolder()
{
init_particles();
}
ParticleHolder::~ParticleHolder()
{
std::cout << "ParticleHolder:~ParticleHolder" << std::endl;
}
void
ParticleHolder::update(float delta)
{
for(std::list<Particle*>::iterator i = this->begin(); i != this->end(); i++)
{
if ((*i)->is_alive())
{
(*i)->update(delta);
}
else
{
i = this->erase(i);
i--;
}
}
}
void
ParticleHolder::draw_offset(int x, int y, float s) // const
{
for(std::list<Particle*>::iterator i = this->begin(); i != this->end(); i++)
{
(*i)->draw_offset(x, y, s);
}
}
void
ParticleHolder::add_pingu_explo(int x, int y)
{
for(int i=0; i < 50; i++)
{
add_pingu_particle(x, y, frand()*7 - 3.5, frand()* -7.0);
}
}
void
ParticleHolder::add_particle(Particle* p)
{
if (verbose > 1) std::cout << "--- ParticleHolder: Warrning add_particle() is
slow" << std::endl;
this->push_back(p);
}
void
ParticleHolder::add_pingu_particle(int x, int y, float vx, float vy)
{
Particle* p;
p = pingu_particles.create();
p->init(x, y, vx, vy);
this->push_back(p);
}
void
ParticleHolder::init_particles()
{
pingu_particles.allocate(400);
}
void
ParticleHolder::clear_particles()
{
std::cout << "ParticleHolder:: Clearing particles" << std::endl;
for(std::vector<Particle*>::iterator i = all_particles.begin(); i !=
all_particles.end(); i++)
{
delete (*i);
}
}
/* EOF */
--- NEW FILE: particle_holder.hxx ---
// $Id: particle_holder.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 PARTICLEHOLDER_HH
#define PARTICLEHOLDER_HH
#include <list>
#include "particle_cache.hxx"
class Particle;
///
class ParticleHolder : public std::list<Particle*>
{
private:
///
std::vector<Particle*> all_particles;
///
ParticleCache pingu_particles;
public:
///
ParticleHolder();
///
virtual ~ParticleHolder();
///
void update(float delta);
///
void draw_offset(int, int, float); /// const;
void add_pingu_explo(int x, int y);
///
void add_particle(Particle* p);
///
void init_particles();
///
void clear_particles();
///
void add_pingu_particle(int, int, float, float);
}///
;
#endif
/* EOF */
--- NEW FILE: pingu_particle.cxx ---
// $Id: pingu_particle.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 "../col_map.hxx"
#include "../world.hxx"
#include "../algo.hxx"
#include "../pingus_resource.hxx"
#include "pingu_particle.hxx"
static const float x_collision_decrease = 0.3f;
static const float y_collision_decrease = 0.6f;
CL_Surface PinguParticle::sur;
PinguParticle::PinguParticle()
{
surface = PingusResource::load_surface("Particles/particle", "pingus");
livetime = 50 + (rand() % 25);
size = 1.0;
size_add = (frand() - 0.2) / 35;
}
PinguParticle::PinguParticle(int x, int y, float x_a, float y_a)
: Particle (x, y, x_a, y_a)
{
size = 1.0;
size_add = (frand() - 0.2) / 35;
livetime = 50 + (rand() % 50);
if (sur)
surface = sur;
else
sur = PingusResource::load_surface("Particles/particle", "pingus");
}
void
PinguParticle::init(int x, int y, float x_a, float y_a)
{
pos.x = x;
pos.y = y;
velocity.x = x_a;
velocity.y = y_a;
size = 1.0;
size_add = (frand() - 0.2) / 35;
livetime = 50 + (rand() % 25);
}
void
PinguParticle::draw_offset(int ofx, int ofy, float /*s*/)
{
surface.put_screen(int(pos.x + ofx), int(pos.y + ofy));
/* Particle resizeing is disabled, because it is to slow
if (s * size == 1.0) {
surface->put_screen(x_pos + ofx, y_pos + ofy);
} else {
int width = (int)(surface->get_width() * s * size);
int height = (int)(surface->get_height() * s * size);
surface->put_screen((int)((x_pos + ofx) * s) - width/2, (int)((y_pos + ofy)
* s) - height/2,
width, height);
}
*/
}
void
PinguParticle::update(float /*delta*/)
{
float tmp_x_add = 0.0;
float tmp_y_add = 0.0;
// Simulated gravity
velocity.y += 0.2f;
if (velocity.y > 0)
{
for (tmp_y_add = velocity.y; tmp_y_add >= 1.0; tmp_y_add -= 1.0)
{
if (world->get_colmap()->getpixel((int)pos.x, (int)pos.y))
{
velocity.y = velocity.y * -y_collision_decrease;
tmp_y_add = -tmp_y_add;
pos.y -= 1.0;
break;
}
pos.y += 1.0;
}
pos.y += tmp_y_add;
}
else
{
for (tmp_y_add = velocity.y; tmp_y_add <= -1.0; tmp_y_add += 1.0)
{
if (world->get_colmap()->getpixel((int)pos.x, (int)pos.y)) {
velocity.y = velocity.y * -y_collision_decrease;
tmp_y_add = -tmp_y_add;
pos.y += 1.0;
break;
}
pos.y -= 1.0;
}
pos.y += tmp_y_add;
}
if (velocity.x > 0)
{
for (tmp_x_add = velocity.x; tmp_x_add >= 1.0; tmp_x_add -= 1.0)
{
if (world->get_colmap()->getpixel((int)pos.x, (int)pos.y)) {
velocity.x = velocity.x * -x_collision_decrease;
tmp_x_add = -tmp_x_add;
pos.x -= 1.0;
break;
}
pos.x += 1.0;
}
pos.x += tmp_x_add;
}
else
{
for (tmp_x_add = velocity.x; tmp_x_add <= -1.0; tmp_x_add += 1.0)
{
if (world->get_colmap()->getpixel((int)pos.x, (int)pos.y)) {
velocity.x = velocity.x * -x_collision_decrease;
tmp_x_add = -tmp_x_add;
pos.x += 1.0;
break;
}
pos.x -= 1.0;
}
pos.x += tmp_x_add;
}
// Simple physics
#if 0
size += size_add;
pos.x += x_add * size;
pos.y += y_add * size;
y_add += 0.1;
#endif
if (livetime > 0)
--livetime;
}
/* EOF */
--- NEW FILE: pingu_particle.hxx ---
// $Id: pingu_particle.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 PINGUPARTICLE_HH
#define PINGUPARTICLE_HH
#include "particle.hxx"
class CL_Surface;
///
class PinguParticle : public Particle
{
private:
///
float size;
///
float size_add;
///
static CL_Surface sur;
public:
///
PinguParticle();
///
PinguParticle(int x, int y, float x_a, float y_a);
///
void init(int x, int y, float x_a, float y_a);
///
void draw_offset(int ofx, int ofy, float s);
///
void update(float delta);
}///
;
#endif
/* EOF */
--- NEW FILE: rain_generator.cxx ---
// $Id: rain_generator.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 <ClanLib/Display/Display/display.h>
#include "../world.hxx"
#include "../particles/particle_holder.hxx"
#include "../pingu_map.hxx"
#include "rain_particle.hxx"
#include "../sound.hxx"
#include "rain_generator.hxx"
RainGenerator::RainGenerator ()
: do_thunder (false),
thunder_count (0)
{
}
RainGenerator::~RainGenerator ()
{
}
void
RainGenerator::draw_offset(int /*x*/, int /*y*/, float /*s*/)
{
if (do_thunder)
{
if (thunder_count < 0.0f) {
do_thunder = false;
thunder_count = 0.0f;
waiter_count = 1.0f;
}
CL_Display::fill_rect (0, 0, CL_Display::get_width (),
CL_Display::get_height (),
1.0, 1.0, 1.0, thunder_count);
}
}
void
RainGenerator::update(float delta)
{
if (waiter_count < 0.0f && rand () % 150 == 0)
{
std::cout << "Doing thunder" << std::endl;
do_thunder = true;
thunder_count = 1.0f;
waiter_count = 1.0f;
PingusSound::play_sound ("sounds/thunder.wav");
}
if (do_thunder)
thunder_count -= 10.0 * delta;
waiter_count -= 20.0 * delta;
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
}
/* EOF */
--- NEW FILE: rain_generator.hxx ---
// $Id: rain_generator.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 RAINGENERATOR_HH
#define RAINGENERATOR_HH
#include "weather_generator.hxx"
class RainGenerator : public WeatherGenerator
{
private:
bool do_thunder;
float thunder_count;
float waiter_count;
public:
RainGenerator ();
virtual ~RainGenerator ();
virtual void update(float delta);
virtual void draw_offset(int x, int y, float s = 1.0f);
};
#endif
/* EOF */
--- NEW FILE: rain_particle.cxx ---
// $Id: rain_particle.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 "../world.hxx"
#include "../algo.hxx"
#include "../pingus_resource.hxx"
#include "../col_map.hxx"
#include "rain_particle.hxx"
CL_Surface RainParticle::rain1_surf;
CL_Surface RainParticle::rain2_surf;
RainParticle::RainParticle()
{
alive = true;
splash = false;
splash_counter = 0;
}
RainParticle::RainParticle(int arg_x_pos, int arg_y_pos)
{
pos.x = arg_x_pos;
pos.y = arg_y_pos;
splash = false;
splash_counter = 0;
alive = true;
add = 1.0 + frand() * 3.0;
if (!rain1_surf)
{
rain1_surf = PingusResource::load_surface("Particles/rain1", "pingus");
rain2_surf = PingusResource::load_surface("Particles/rain2", "pingus");
}
rain_splash = Sprite (PingusResource::load_surface ("Particles/rain_splash",
"pingus"), 10.0f,
Sprite::NONE, Sprite::ONCE);
rain_splash.set_align_center_bottom ();
surface = rain2_surf;
type = rand () % 3;
}
RainParticle::~RainParticle()
{
}
void
RainParticle::draw_offset(int x_of, int y_of, float s)
{
if (!splash)
{
if (type == 0)
surface = rain2_surf;
else
surface = rain1_surf;
Particle::draw_offset(x_of, y_of - rain1_surf.get_height(), s);
}
else
{
rain_splash.put_screen(int(pos.x + x_of),
int(pos.y + y_of));
}
}
void
RainParticle::update(float delta)
{
if (splash)
{
if (rain_splash.finished ())
alive = false;
rain_splash.update (delta);
++splash_counter;
if (splash_counter > 3)
{
splash_counter = 3;
alive = false;
}
}
else
{
if (world->get_colmap()->getpixel(int(pos.x), int(pos.y)) !=
ColMap::NOTHING
&& world->get_colmap()->getpixel(int(pos.x), int(pos.y)) !=
ColMap::OUTOFSCREEN)
{
splash = true;
}
else
{
if (pos.y > world->get_height())
alive = false;
pos.x -= 5.0 * add;
pos.y += 16.0 * add;
}
}
}
bool
RainParticle::is_alive()
{
return alive;
}
/* EOF */
--- NEW FILE: rain_particle.hxx ---
// $Id: rain_particle.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 RAINPARTICLE_HH
#define RAINPARTICLE_HH
#include "../sprite.hxx"
#include "particle.hxx"
class RainParticle : public Particle
{
private:
static CL_Surface rain1_surf;
static CL_Surface rain2_surf;
Sprite rain_splash;
float add;
bool alive;
bool splash;
int splash_counter;
int type;
public:
RainParticle();
RainParticle(int, int);
virtual ~RainParticle();
virtual void draw_offset(int, int, float);
virtual void update(float delta);
virtual bool is_alive();
};
#endif
/* EOF */
--- NEW FILE: smoke_particle.cxx ---
// $Id: smoke_particle.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 <cstdlib>
#include "../globals.hxx"
#include "../pingus_resource.hxx"
#include "smoke_particle.hxx"
SmokeParticle::SmokeParticle()
{
}
// FIXME: Why the heck do I get an unresolved reference in
// WoodThing.cc when I try to use SmokeParticle there?!
SmokeParticle::SmokeParticle(int x, int y, float x_a, float y_a)
: Particle (x, y, x_a, y_a)
{
// FIXME: Probably slow??
if (rand() % 2)
surface = PingusResource::load_surface("Particles/smoke", "pingus");
else
surface = PingusResource::load_surface("Particles/smoke2", "pingus");
livetime = 25 + (rand() % 10);
time = livetime;
}
void
SmokeParticle::update(float /*delta*/)
{
pos.x += velocity.x;
pos.y += velocity.y;
// y_add += 0.1;
if (livetime > 0)
--livetime;
}
void
SmokeParticle::draw_offset(int ofx, int ofy, float s)
{
if (fast_mode)
return;
if (s == 1.0) {
// FIXME: This segfaults from time to time, don't know why
surface.put_screen(int(pos.x + ofx - 16), int(pos.y + ofy - 16),
3 - (livetime * 4 / time));
} else {
int width = (int)(surface.get_width() * s);
int height = (int)(surface.get_height() * s);
surface.put_screen((int)((pos.x + ofx) * s) - width/2,
(int)((pos.y + ofy) * s) - height/2,
width, height, 3 - (livetime * 4 / time));
}
}
/* EOF */
--- NEW FILE: smoke_particle.hxx ---
// $Id: smoke_particle.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 SMOKEPARTICLE_HH
#define SMOKEPARTICLE_HH
#include "particle.hxx"
///
class SmokeParticle : public Particle
{
private:
///
int time;
public:
///
SmokeParticle();
///
SmokeParticle(int, int, float, float);
///
void update(float delta);
///
void draw_offset(int ofx, int ofy, float s);
}///
;
#endif
/* EOF */
--- NEW FILE: snow_generator.cxx ---
// $Id: snow_generator.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 "../world.hxx"
#include "snow_particle.hxx"
#include "rain_particle.hxx"
#include "snow_generator.hxx"
#include "../particles/particle_holder.hxx"
SnowGenerator::SnowGenerator()
{
}
SnowGenerator::~SnowGenerator()
{
}
void
SnowGenerator::update(float /*delta*/)
{
world->get_particle_holder()->add_particle(new SnowParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new SnowParticle(rand() %
world->get_width(), -32));
world->get_particle_holder()->add_particle(new CollidingSnowParticle(rand() %
world->get_width(), -32));
}
/* EOF */
--- NEW FILE: snow_generator.hxx ---
// $Id: snow_generator.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 SNOWGENERATOR_HH
#define SNOWGENERATOR_HH
#include "weather_generator.hxx"
class SnowGenerator : public WeatherGenerator
{
private:
public:
///
SnowGenerator();
///
virtual ~SnowGenerator();
///
virtual void update(float delta);
};
#endif
/* EOF */
--- NEW FILE: snow_particle.cxx ---
// $Id: snow_particle.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 "../col_map.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../particles/particle_holder.hxx"
#include "../pingu_map.hxx"
#include "../algo.hxx"
#include "snow_particle.hxx"
SnowParticle::SnowParticle()
{
}
SnowParticle::SnowParticle(int x, int y)
{
init(x, y);
}
void
SnowParticle::init(int x, int y)
{
CL_Surface snow;
pos.x = x;
pos.y = y;
velocity.x = 0.0;
switch (rand() % 10)
{
case 0:
snow = PingusResource::load_surface("Particles/snow1", "pingus");
break;
case 1:
snow = PingusResource::load_surface("Particles/snow2", "pingus");
break;
case 2:
case 3:
snow = PingusResource::load_surface("Particles/snow3", "pingus");
break;
case 5:
case 6:
snow = PingusResource::load_surface("Particles/snow4", "pingus");
default:
snow = PingusResource::load_surface("Particles/snow5", "pingus");
break;
}
surface = snow;
velocity.y = 1.0 + (frand() * 3.5);
}
SnowParticle::~SnowParticle()
{
}
void
SnowParticle::update(float /*delta*/)
{
pos.x += velocity.x;
pos.y += velocity.y;
velocity.x += (frand() - 0.5) / 10;
}
bool
SnowParticle::is_alive()
{
if (pos.y < world->get_height())
return true;
else
return false;
}
CL_Surface CollidingSnowParticle::ground_snow;
CollidingSnowParticle::CollidingSnowParticle()
{
}
CollidingSnowParticle::CollidingSnowParticle(int x, int y)
{
SnowParticle::init(x, y);
alive = true;
if (!ground_snow)
ground_snow = PingusResource::load_surface("Particles/ground_snow",
"pingus");
}
CollidingSnowParticle::~CollidingSnowParticle()
{
}
void
CollidingSnowParticle::update(float delta)
{
assert(ground_snow);
SnowParticle::update(delta);
int pixel = world->get_colmap()->getpixel(int(pos.x), int(pos.y));
if (pixel != ColMap::NOTHING && pixel != ColMap::LAVA
&& pixel != ColMap::WATER && pixel != ColMap::OUTOFSCREEN)
{
//std::cout << "Snow: touch down: " << x_pos << " " << y_pos << std::endl;
world->get_gfx_map()->put(ground_snow,
(int)pos.x - 1,
(int)pos.y - 1);
alive = false;
}
}
bool
CollidingSnowParticle::is_alive()
{
return alive && SnowParticle::is_alive();
}
/* EOF */
--- NEW FILE: snow_particle.hxx ---
// $Id: snow_particle.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 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 SNOWPARTICLE_HH
#define SNOWPARTICLE_HH
#include "particle.hxx"
///
class SnowParticle : public Particle
{
private:
public:
SnowParticle();
///
SnowParticle(int x, int y);
///
void init(int x, int y);
///
virtual ~SnowParticle();
virtual void update(float delta);
virtual bool is_alive();
};
class CollidingSnowParticle : public SnowParticle
{
private:
bool alive;
static CL_Surface ground_snow;
public:
CollidingSnowParticle();
CollidingSnowParticle(int x, int y);
virtual ~CollidingSnowParticle();
virtual void update(float delta);
virtual bool is_alive();
};
#endif
/* EOF */
--- NEW FILE: weather_generator.cxx ---
// $Id: weather_generator.cxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 "../pingus_error.hxx"
#include "../weather_data.hxx"
#include "snow_generator.hxx"
#include "rain_generator.hxx"
#include "../boost/smart_ptr.hpp"
WorldObj*
WeatherGenerator::create(WeatherData data)
{
if (data.type == "snow")
return new SnowGenerator();
else if (data.type == "rain")
return new RainGenerator();
else
{
throw PingusError ("WeatherGenerator: Unknown type: " + data.type);
}
}
/* EOF */
--- NEW FILE: weather_generator.hxx ---
// $Id: weather_generator.hxx,v 1.1 2002/06/12 19:11:31 grumbel Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 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 WEATHERGENERATOR_HH
#define WEATHERGENERATOR_HH
#include "../worldobj.hxx"
class WeatherData;
namespace boost {
template <class T> class shared_ptr;
}
class WeatherGenerator : public WorldObj
{
private:
public:
///
WeatherGenerator() {}
///
virtual ~WeatherGenerator() {}
///
virtual void update(float delta) =0;
///
float get_z_pos() const { return 1000; }
///
void draw_offset(int, int, float) {}
/** Generate an WeatherGenerator which fits to the given data */
static WorldObj* create(WeatherData);
};
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile.am 24 Jul 2001 17:01:26 -0000 1.6
+++ Makefile.am 12 Jun 2002 19:11:31 -0000 1.7
@@ -17,17 +17,14 @@
noinst_LIBRARIES = libpingus_particle.a
-libpingus_particle_a_SOURCES = Particle.cc Particle.hh \
- ParticleHolder.cc ParticleHolder.hh \
- ParticleCache.cc ParticleCache.hh \
- SmokeParticle.cc SmokeParticle.hh \
- GroundParticle.cc GroundParticle.hh \
- PinguParticle.cc PinguParticle.hh \
- SnowParticle.cc SnowParticle.hh \
- SnowGenerator.cc SnowGenerator.hh \
- RainParticle.cc RainParticle.hh \
- WeatherGenerator.cc WeatherGenerator.hh \
- RainGenerator.cc RainGenerator.hh \
- ExplosiveParticle.cc ExplosiveParticle.hh
+libpingus_particle_a_SOURCES = \
+explosive_particle.hxx particle_holder.hxx smoke_particle.hxx \
+ground_particle.hxx pingu_particle.hxx snow_generator.hxx \
+particle.hxx rain_generator.hxx snow_particle.hxx \
+particle_cache.hxx rain_particle.hxx weather_generator.hxx \
+explosive_particle.cxx particle_holder.cxx smoke_particle.cxx \
+ground_particle.cxx pingu_particle.cxx snow_generator.cxx \
+particle.cxx rain_generator.cxx snow_particle.cxx \
+particle_cache.cxx rain_particle.cxx weather_generator.cxx
## EOF ##
--- ExplosiveParticle.cc DELETED ---
--- ExplosiveParticle.hh DELETED ---
--- GroundParticle.cc DELETED ---
--- GroundParticle.hh DELETED ---
--- Particle.cc DELETED ---
--- Particle.hh DELETED ---
--- ParticleCache.cc DELETED ---
--- ParticleCache.hh DELETED ---
--- ParticleHolder.cc DELETED ---
--- ParticleHolder.hh DELETED ---
--- PinguParticle.cc DELETED ---
--- PinguParticle.hh DELETED ---
--- RainGenerator.cc DELETED ---
--- RainGenerator.hh DELETED ---
--- RainParticle.cc DELETED ---
--- RainParticle.hh DELETED ---
--- SmokeParticle.cc DELETED ---
--- SmokeParticle.hh DELETED ---
--- SnowGenerator.cc DELETED ---
--- SnowGenerator.hh DELETED ---
--- SnowParticle.cc DELETED ---
--- SnowParticle.hh DELETED ---
--- WeatherGenerator.cc DELETED ---
--- WeatherGenerator.hh DELETED ---
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,NONE,1.1 explosive_particle.hxx,NONE,1.1 ground_particle.cxx,NONE,1.1 ground_particle.hxx,NONE,1.1 particle.cxx,NONE,1.1 particle.hxx,NONE,1.1 particle_cache.cxx,NONE,1.1 particle_cache.hxx,NONE,1.1 particle_holder.cxx,NONE,1.1 particle_holder.hxx,NONE,1.1 pingu_particle.cxx,NONE,1.1 pingu_particle.hxx,NONE,1.1 rain_generator.cxx,NONE,1.1 rain_generator.hxx,NONE,1.1 rain_particle.cxx,NONE,1.1 rain_particle.hxx,NONE,1.1 smoke_particle.cxx,NONE,1.1 smoke_particle.hxx,NONE,1.1 snow_generator.cxx,NONE,1.1 snow_generator.hxx,NONE,1.1 snow_particle.cxx,NONE,1.1 snow_particle.hxx,NONE,1.1 weather_generator.cxx,NONE,1.1 weather_generator.hxx,NONE,1.1 Makefile.am,1.6,1.7 ExplosiveParticle.cc,1.5,NONE ExplosiveParticle.hh,1.2,NONE GroundParticle.cc,1.10,NONE GroundParticle.hh,1.7,NONE Particle.cc,1.12,NONE Particle.hh,1.13,NONE ParticleCache.cc,1.7,NONE ParticleCache.hh,1.6,NONE ParticleHolder.cc,1.7,NONE ParticleHolder.hh,1.9,NONE PinguParticle.cc,1.16,NONE PinguParticle.hh,1.10,NONE RainGenerator.cc,1.13,NONE RainGenerator.hh,1.5,NONE RainParticle.cc,1.11,NONE RainParticle.hh,1.8,NONE SmokeParticle.cc,1.12,NONE SmokeParticle.hh,1.8,NONE SnowGenerator.cc,1.12,NONE SnowGenerator.hh,1.5,NONE SnowParticle.cc,1.17,NONE SnowParticle.hh,1.8,NONE WeatherGenerator.cc,1.8,NONE WeatherGenerator.hh,1.10,NONE,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/traps bumper.cxx,NONE,1.1 bumper.hxx,NONE,1.1 fake_exit.cxx,NONE,1.1 fake_exit.hxx,NONE,1.1 guillotine.cxx,NONE,1.1 guillotine.hxx,NONE,1.1 hammer.cxx,NONE,1.1 hammer.hxx,NONE,1.1 laser_exit.cxx,NONE,1.1 laser_exit.hxx,NONE,1.1 smasher.cxx,NONE,1.1 smasher.hxx,NONE,1.1 spike.cxx,NONE,1.1 spike.hxx,NONE,1.1 Makefile.am,1.6,1.7 Bumper.cc,1.23,NONE Bumper.hh,1.10,NONE FakeExit.cc,1.21,NONE FakeExit.hh,1.10,NONE Guillotine.cc,1.18,NONE Guillotine.hh,1.11,NONE LaserExit.cc,1.21,NONE LaserExit.hh,1.10,NONE Spike.cc,1.18,NONE Spike.hh,1.10,NONE hammer.cc,1.20,NONE hammer.hh,1.10,NONE smasher.cc,1.35,NONE smasher.hh,1.12,NONE
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src ButtonPanel.cc,1.35,NONE ButtonPanel.hh,1.19,NONE Client.cc,1.88,NONE Client.hh,1.42,NONE EditorHotspot.hh,1.5,NONE EntranceData.cc,1.12,NONE ExitData.cc,1.15,NONE LiquidData.cc,1.13,NONE MultiplayerClientChild.cc,1.17,NONE MultiplayerClientChild.hh,1.12,NONE MultiplayerGame.cc,1.12,NONE PingusMain.cc,1.65,NONE PingusMenu.cc,1.58,NONE PingusMenu.hh,1.26,NONE Story.cc,1.17,NONE SurfaceButton.cc,1.41,NONE SurfaceButton.hh,1.25,NONE TrapData.cc,1.15,NONE WorldObjData.hh,1.15,NONE WorldObjGroupData.cc,1.8,NONE XMLPLF.cc,1.46,NONE
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/traps bumper.cxx,NONE,1.1 bumper.hxx,NONE,1.1 fake_exit.cxx,NONE,1.1 fake_exit.hxx,NONE,1.1 guillotine.cxx,NONE,1.1 guillotine.hxx,NONE,1.1 hammer.cxx,NONE,1.1 hammer.hxx,NONE,1.1 laser_exit.cxx,NONE,1.1 laser_exit.hxx,NONE,1.1 smasher.cxx,NONE,1.1 smasher.hxx,NONE,1.1 spike.cxx,NONE,1.1 spike.hxx,NONE,1.1 Makefile.am,1.6,1.7 Bumper.cc,1.23,NONE Bumper.hh,1.10,NONE FakeExit.cc,1.21,NONE FakeExit.hh,1.10,NONE Guillotine.cc,1.18,NONE Guillotine.hh,1.11,NONE LaserExit.cc,1.21,NONE LaserExit.hh,1.10,NONE Spike.cc,1.18,NONE Spike.hh,1.10,NONE hammer.cc,1.20,NONE hammer.hh,1.10,NONE smasher.cc,1.35,NONE smasher.hh,1.12,NONE
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src ButtonPanel.cc,1.35,NONE ButtonPanel.hh,1.19,NONE Client.cc,1.88,NONE Client.hh,1.42,NONE EditorHotspot.hh,1.5,NONE EntranceData.cc,1.12,NONE ExitData.cc,1.15,NONE LiquidData.cc,1.13,NONE MultiplayerClientChild.cc,1.17,NONE MultiplayerClientChild.hh,1.12,NONE MultiplayerGame.cc,1.12,NONE PingusMain.cc,1.65,NONE PingusMenu.cc,1.58,NONE PingusMenu.hh,1.26,NONE Story.cc,1.17,NONE SurfaceButton.cc,1.41,NONE SurfaceButton.hh,1.25,NONE TrapData.cc,1.15,NONE WorldObjData.hh,1.15,NONE WorldObjGroupData.cc,1.8,NONE XMLPLF.cc,1.46,NONE
- Index(es):