[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs rain_generator.cxx,NONE,1.1
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs rain_generator.cxx,NONE,1.1 rain_generator.hxx,NONE,1.1 snow_generator.cxx,NONE,1.1 snow_generator.hxx,NONE,1.1 |
Date: |
16 Sep 2002 15:47:38 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv30898/src/worldobjs
Added Files:
rain_generator.cxx rain_generator.hxx snow_generator.cxx
snow_generator.hxx
Log Message:
- made weather thingies real worldobjs
--- NEW FILE: rain_generator.cxx ---
// $Id: rain_generator.cxx,v 1.1 2002/09/16 15:47:35 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 "rain_particle.hxx"
#include "../sound.hxx"
#include "../world.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;
get_world()->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
get_world()->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
get_world()->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
get_world()->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
get_world()->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
get_world()->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
get_world()->get_particle_holder()->add_particle(new RainParticle(rand() %
world->get_width(), -32));
get_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/09/16 15:47:35 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 HEADER_PINGUS_PARTICLES_RAIN_GENERATOR_HXX
#define HEADER_PINGUS_PARTICLES_RAIN_GENERATOR_HXX
#include "../worldobj.hxx"
class RainGenerator : public WorldObj
{
private:
bool do_thunder;
float thunder_count;
float waiter_count;
public:
RainGenerator();
~RainGenerator();
void update(float delta);
void draw_offset(int x, int y, float s = 1.0f);
float get_z_pos() const { return 1000; }
private:
RainGenerator (const RainGenerator&);
RainGenerator operator= (const RainGenerator&);
};
#endif
/* EOF */
--- NEW FILE: snow_generator.cxx ---
// $Id: snow_generator.cxx,v 1.1 2002/09/16 15:47:35 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 "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/09/16 15:47:35 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 HEADER_PINGUS_PARTICLES_SNOW_GENERATOR_HXX
#define HEADER_PINGUS_PARTICLES_SNOW_GENERATOR_HXX
#include "../worldobj.hxx"
class SnowGenerator : public WorldObj
{
private:
public:
SnowGenerator ();
virtual ~SnowGenerator ();
virtual void update (float delta);
float get_z_pos () const { return 1000; }
private:
SnowGenerator (const SnowGenerator&);
SnowGenerator operator= (const SnowGenerator&);
};
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjs rain_generator.cxx,NONE,1.1 rain_generator.hxx,NONE,1.1 snow_generator.cxx,NONE,1.1 snow_generator.hxx,NONE,1.1,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata rain_generator_data.cxx,NONE,1.1 rain_generator_data.hxx,NONE,1.1 snow_generator_data.cxx,NONE,1.1 snow_generator_data.hxx,NONE,1.1 Makefile.am,1.8,1.9
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.99,1.100 exit.cxx,1.6,1.7 exit.hxx,1.4,1.5 groundpiece_data.hxx,1.12,1.13 hotspot_data.hxx,1.5,1.6 liquid.cxx,1.5,1.6 liquid.hxx,1.4,1.5 plf.cxx,1.7,1.8 plf.hxx,1.5,1.6 spot_map.cxx,1.13,1.14 world.cxx,1.23,1.24 worldobj.cxx,1.7,1.8 worldobj.hxx,1.6,1.7 worldobj_data_factory.cxx,1.14,1.15 xml_plf.cxx,1.17,1.18
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata rain_generator_data.cxx,NONE,1.1 rain_generator_data.hxx,NONE,1.1 snow_generator_data.cxx,NONE,1.1 snow_generator_data.hxx,NONE,1.1 Makefile.am,1.8,1.9
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.99,1.100 exit.cxx,1.6,1.7 exit.hxx,1.4,1.5 groundpiece_data.hxx,1.12,1.13 hotspot_data.hxx,1.5,1.6 liquid.cxx,1.5,1.6 liquid.hxx,1.4,1.5 plf.cxx,1.7,1.8 plf.hxx,1.5,1.6 spot_map.cxx,1.13,1.14 world.cxx,1.23,1.24 worldobj.cxx,1.7,1.8 worldobj.hxx,1.6,1.7 worldobj_data_factory.cxx,1.14,1.15 xml_plf.cxx,1.17,1.18
- Index(es):