#include <blowtorch.h>
Inheritance diagram for Blowtorch:
Public Member Functions | |
Blowtorch () | |
BlowtorchConfig & | cfg () |
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 |
Definition at line 36 of file blowtorch.h.
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:
BlowtorchConfig & Blowtorch::cfg | ( | ) |
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] |
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.