#include <construct.h>
Inheritance diagram for Construct:
Public Member Functions | |
Construct () | |
~Construct () | |
void | Draw () |
void | ChooseTarget (Point2i mouse_pos) |
void | HandleKeyEvent (Action::Action_t action, Keyboard::Key_Event_t event_type) |
void | ActionUp () |
void | ActionDown () |
void | Up () |
void | Down () |
WeaponConfig & | cfg () |
Protected Member Functions | |
bool | p_Shoot () |
void | Refresh () |
Private Attributes | |
bool | target_chosen |
Sprite * | construct_spr |
double | angle |
Point2i | dst |
Definition at line 29 of file construct.h.
Construct::Construct | ( | ) |
Definition at line 37 of file construct.cpp.
00037 : Weapon(WEAPON_CONSTRUCT, "construct", 00038 new WeaponConfig(), 00039 NEVER_VISIBLE) 00040 { 00041 construct_spr = resource_manager.LoadSprite( weapons_res_profile, "construct_spr"); 00042 construct_spr->EnableRotationCache(static_cast<int>(2 * M_PI / angle_step)); 00043 m_name = _("Construct"); 00044 angle = 0; 00045 force_override_keys = true; 00046 target_chosen = false; 00047 }
Here is the call graph for this function:
Construct::~Construct | ( | ) |
void Construct::ActionDown | ( | ) | [virtual] |
Reimplemented from Weapon.
Definition at line 109 of file construct.cpp.
00110 { 00111 Down(); 00112 }
Here is the call graph for this function:
void Construct::ActionUp | ( | ) | [virtual] |
Reimplemented from Weapon.
Definition at line 104 of file construct.cpp.
00105 { 00106 Up(); 00107 }
Here is the call graph for this function:
WeaponConfig & Construct::cfg | ( | ) |
void Construct::ChooseTarget | ( | Point2i | mouse_pos | ) | [virtual] |
Reimplemented from Weapon.
Definition at line 80 of file construct.cpp.
00081 { 00082 dst = mouse_pos; 00083 target_chosen = true; 00084 Shoot(); 00085 }
Here is the call graph for this function:
void Construct::Down | ( | ) |
Definition at line 122 of file construct.cpp.
00123 { 00124 Action a(Action::ACTION_CONSTRUCTION_DOWN); 00125 if(ActiveTeam().IsLocal() || ActiveTeam().IsLocalAI()) 00126 network.SendAction(&a); 00127 angle -= angle_step; 00128 }
Here is the call graph for this function:
Here is the caller graph for this function:
void Construct::Draw | ( | ) | [virtual] |
Reimplemented from Weapon.
Definition at line 69 of file construct.cpp.
00070 { 00071 if (!m_is_active) { 00072 Weapon::Draw(); 00073 00074 dst = Mouse::GetInstance()->GetWorldPosition(); 00075 construct_spr->SetRotation_rad(angle); 00076 construct_spr->Draw(dst - construct_spr->GetSize()/2); 00077 } 00078 }
Here is the call graph for this function:
void Construct::HandleKeyEvent | ( | Action::Action_t | action, | |
Keyboard::Key_Event_t | event_type | |||
) | [virtual] |
Reimplemented from Weapon.
Definition at line 87 of file construct.cpp.
00088 { 00089 switch (action) { 00090 case Action::ACTION_UP: 00091 if (event_type == Keyboard::KEY_PRESSED) 00092 Up(); 00093 break ; 00094 case Action::ACTION_DOWN: 00095 if (event_type == Keyboard::KEY_PRESSED) 00096 Down(); 00097 break ; 00098 default: 00099 ActiveCharacter().HandleKeyEvent( action, event_type); 00100 break ; 00101 } 00102 }
Here is the call graph for this function:
bool Construct::p_Shoot | ( | ) | [protected, virtual] |
Implements Weapon.
Definition at line 54 of file construct.cpp.
00055 { 00056 if(!target_chosen) 00057 return false; 00058 jukebox.Play("share", "weapon/construct"); 00059 world.MergeSprite(dst - construct_spr->GetSizeMax()/2, construct_spr); 00060 GameLoop::GetInstance()->interaction_enabled = false; 00061 return true; 00062 }
Here is the call graph for this function:
void Construct::Refresh | ( | ) | [protected, virtual] |
Implements Weapon.
Definition at line 64 of file construct.cpp.
00065 { 00066 m_is_active = false; 00067 }
void Construct::Up | ( | ) |
Definition at line 114 of file construct.cpp.
00115 { 00116 Action a(Action::ACTION_CONSTRUCTION_UP); 00117 if(ActiveTeam().IsLocal() || ActiveTeam().IsLocalAI()) 00118 network.SendAction(&a); 00119 angle += angle_step; 00120 }
Here is the call graph for this function:
Here is the caller graph for this function:
double Construct::angle [private] |
Definition at line 34 of file construct.h.
Sprite* Construct::construct_spr [private] |
Definition at line 33 of file construct.h.
Point2i Construct::dst [private] |
Definition at line 35 of file construct.h.
bool Construct::target_chosen [private] |
Definition at line 32 of file construct.h.