1
// $Id: explosive_particle.cpp 2986 2007-08-17 16:20:09Z grumbel $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#include "../col_map.hpp"
21
#include "../pingu_map.hpp"
22
#include "../world.hpp"
23
#include "../particles/particle_holder.hpp"
24
#include "../resource.hpp"
25
#include "explosive_particle.hpp"
27
ExplosiveParticle::ExplosiveParticle (int x, int y, float x_a, float y_a)
28
: Particle (x, y, x_a, y_a),
33
ExplosiveParticle::~ExplosiveParticle ()
38
ExplosiveParticle::update (float delta)
40
Vector new_pos = pos + velocity * delta;
42
Vector incr = pos - new_pos;
45
// FIXME: This thing needs to be more abstract, we just need it far
46
// to often to reimplement it over and over again.
47
while ( static_cast<int>(new_pos.x) != static_cast<int>(pos.x)
48
|| static_cast<int>(new_pos.y) != static_cast<int>(pos.y))
54
|| pos.x + 1 > WorldObj::get_world()->get_width ()
55
|| pos.y + 1 > WorldObj::get_world()->get_height())
61
if (WorldObj::get_world()->get_colmap()->getpixel(static_cast<int>(pos.x), static_cast<int>(pos.y)))
71
ExplosiveParticle::detonate ()
74
WorldObj::get_world()->get_particle_holder ()->add_pingu_explo((int)pos.x, (int)pos.y);
76
CollisionMask mask = Resource::load_collision_mask("Other/bomber_radius", "pingus");
77
WorldObj::get_world()->remove(mask,
78
int(pos.x) - (bomber_radius.get_width()/2),
79
int(pos.y) - (bomber_radius.get_height()/2));
83
//ExplosiveParticle::draw_offset(int ofx, int ofy, float /*s*/)
85
// sprite.put_screen (int(pos.x + ofx), int(pos.y + ofy));
90
ExplosiveParticle::is_alive(void)