src/weapon/bounce_ball.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Wormux is a convivial mass murder game.
00003  *  Copyright (C) 2001-2004 Lawrence Azzoug.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00018  ******************************************************************************
00019  * Bounce ball:
00020  * bounce since it has not collide a character
00021  *****************************************************************************/
00022 
00023 #include "bounce_ball.h"
00024 //-----------------------------------------------------------------------------
00025 #include <sstream>
00026 #include "../tool/debug.h"
00027 #include "../game/time.h"
00028 #include "../team/teams_list.h"
00029 #include "../graphic/video.h"
00030 #include "../tool/math_tools.h"
00031 #include "../map/camera.h"
00032 #include "../weapon/explosion.h"
00033 #include "../interface/game_msg.h"
00034 #include "../tool/i18n.h"
00035 #include "../object/objects_list.h"
00036 //-----------------------------------------------------------------------------
00037 
00038 BounceBall::BounceBall(ExplosiveWeaponConfig& cfg,
00039                        WeaponLauncher * p_launcher) :
00040   WeaponProjectile ("bounce_ball", cfg, p_launcher)
00041 {
00042   m_rebound_sound = "weapon/grenade_bounce";
00043   explode_colliding_character = true;
00044   explode_with_collision = false;
00045 }
00046 
00047 //-----------------------------------------------------------------------------
00048 
00049 void BounceBall::Refresh()
00050 {
00051   WeaponProjectile::Refresh();
00052   // rotation of ball image...
00053   image->SetRotation_rad(GetSpeedAngle());
00054 }
00055 
00056 
00057 //-----------------------------------------------------------------------------
00058 
00059 void BounceBall::SignalOutOfMap()
00060 {
00061   GameMessages::GetInstance()->Add (_("The ball left the battlefield before exploding"));
00062   WeaponProjectile::SignalOutOfMap();
00063 }
00064 
00065 //-----------------------------------------------------------------------------
00066 
00067 BounceBallLauncher::BounceBallLauncher() :
00068   WeaponLauncher(WEAPON_BOUNCE_BALL, "bounce_ball", new ExplosiveWeaponConfig(), VISIBLE_ONLY_WHEN_INACTIVE)
00069 {
00070   m_name = _("Bounce Ball");
00071   ReloadLauncher();
00072 }
00073 
00074 WeaponProjectile * BounceBallLauncher::GetProjectileInstance()
00075 {
00076   return dynamic_cast<WeaponProjectile *>
00077       (new BounceBall(cfg(),dynamic_cast<WeaponLauncher *>(this)));
00078 }
00079 
00080 bool BounceBallLauncher::p_Shoot ()
00081 {
00082   if (max_strength == 0)
00083     projectile->Shoot (10);
00084   else
00085     projectile->Shoot (m_strength);
00086   projectile = NULL;
00087   ReloadLauncher();
00088   return true;
00089 }

Generated on Mon Jan 1 13:11:00 2007 for Wormux by  doxygen 1.4.7