Blowtorch Class Reference

#include <blowtorch.h>

Inheritance diagram for Blowtorch:

Inheritance graph
[legend]
Collaboration diagram for Blowtorch:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Blowtorch ()
BlowtorchConfigcfg ()
void HandleKeyEvent (Action::Action_t action, Keyboard::Key_Event_t event_type)

Protected Member Functions

bool p_Shoot ()
void Refresh ()
void EndTurn ()

Private Attributes

uint new_timer
uint old_timer

Detailed Description

Definition at line 36 of file blowtorch.h.


Constructor & Destructor Documentation

Blowtorch::Blowtorch (  ) 

Definition at line 34 of file blowtorch.cpp.

00034                      : Weapon(WEAPON_BLOWTORCH, "blowtorch", new BlowtorchConfig())
00035 {
00036   m_name = _("Blowtorch");
00037   override_keys = true;
00038 
00039   new_timer = 0;
00040   old_timer = 0;
00041 
00042   m_weapon_fire = new Sprite(resource_manager.LoadImage(weapons_res_profile, "blowtorch_fire"));
00043 }

Here is the call graph for this function:


Member Function Documentation

BlowtorchConfig & Blowtorch::cfg (  ) 

Definition at line 115 of file blowtorch.cpp.

00116 {
00117   return static_cast<BlowtorchConfig&>(*extra_params);
00118 }

Here is the caller graph for this function:

void Blowtorch::EndTurn (  )  [protected]

Definition at line 50 of file blowtorch.cpp.

00051 {
00052   ActiveCharacter().body->ResetWalk();
00053   ActiveCharacter().body->StopWalk();
00054   ActiveTeam().AccessNbUnits() = 0;
00055   m_is_active = false;
00056 
00057         // XXX This doesn't seem to be the correct to end a turn, does it?
00058   GameLoop::GetInstance()->SetState(GameLoop::HAS_PLAYED);
00059 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Blowtorch::HandleKeyEvent ( Action::Action_t  action,
Keyboard::Key_Event_t  event_type 
) [virtual]

Reimplemented from Weapon.

Definition at line 82 of file blowtorch.cpp.

00083 {
00084   switch(action)
00085   {
00086     case Action::ACTION_SHOOT:
00087       if(event_type ==  Keyboard:: Keyboard::KEY_RELEASED)
00088         EndTurn();
00089       else if(event_type == Keyboard::KEY_REFRESH)
00090       {
00091         if(!EnoughAmmoUnit() || ActiveCharacter().GotInjured())
00092           EndTurn();
00093 
00094         new_timer = Time::GetInstance()->Read();
00095         if(new_timer - old_timer >= pause_time)
00096         {
00097           NewActionShoot();
00098           old_timer = new_timer;
00099         }
00100       }
00101 
00102       break;
00103     default:
00104       break;
00105   }
00106 }

Here is the call graph for this function:

bool Blowtorch::p_Shoot (  )  [protected, virtual]

Implements Weapon.

Definition at line 61 of file blowtorch.cpp.

00062 {
00063   ActiveCharacter().SetRebounding(false);
00064   ActiveCharacter().body->StartWalk();
00065 
00066   Point2i hole = ActiveCharacter().GetCenter();
00067 
00068   double angle = ActiveCharacter().GetFiringAngle();
00069   uint h = cfg().range;
00070   double dx = cos(angle) * h;
00071   double dy = sin(angle) * h;
00072 
00073   Point2i pos = Point2i(hole.x+(int)dx, hole.y+(int)dy);
00074   world.Dig(pos, ActiveCharacter().GetHeight()/2);
00075 
00076   MoveCharacter(ActiveCharacter());
00077   ActiveCharacter().SetXY(ActiveCharacter().GetPosition());
00078 
00079   return true;
00080 }

Here is the call graph for this function:

void Blowtorch::Refresh (  )  [protected, virtual]

Implements Weapon.

Definition at line 45 of file blowtorch.cpp.

00046 {
00047 
00048 }


Member Data Documentation

uint Blowtorch::new_timer [private]

Definition at line 39 of file blowtorch.h.

uint Blowtorch::old_timer [private]

Definition at line 39 of file blowtorch.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:35:33 2007 for Wormux by  doxygen 1.4.7