#include <parachute.h>
Inheritance diagram for Parachute:
Public Member Functions | |
Parachute () | |
void | Draw () |
void | SignalTurnEnd () |
ParachuteConfig & | cfg () |
Protected Member Functions | |
void | p_Select () |
void | p_Deselect () |
void | Refresh () |
bool | p_Shoot () |
Private Attributes | |
bool | open |
bool | closing |
Sprite * | image |
Definition at line 39 of file parachute.h.
Parachute::Parachute | ( | ) |
Definition at line 33 of file parachute.cpp.
00033 : Weapon(WEAPON_PARACHUTE, "parachute", new ParachuteConfig(), NEVER_VISIBLE) 00034 { 00035 m_name = _("Parachute"); 00036 m_initial_nb_ammo = 2 ; 00037 use_unit_on_first_shoot = false; 00038 00039 image = resource_manager.LoadSprite(weapons_res_profile,"parachute_sprite"); 00040 }
Here is the call graph for this function:
ParachuteConfig & Parachute::cfg | ( | ) |
void Parachute::Draw | ( | ) | [virtual] |
void Parachute::p_Deselect | ( | ) | [protected, virtual] |
Reimplemented from Weapon.
Definition at line 50 of file parachute.cpp.
00051 { 00052 ActiveCharacter().ResetConstants(); 00053 m_is_active = false; 00054 }
Here is the call graph for this function:
Here is the caller graph for this function:
void Parachute::p_Select | ( | ) | [protected, virtual] |
Reimplemented from Weapon.
Definition at line 42 of file parachute.cpp.
00043 { 00044 m_is_active = true ; 00045 open = false ; 00046 closing = false ; 00047 image->animation.SetShowOnFinish(SpriteAnimation::show_last_frame); 00048 }
Here is the call graph for this function:
bool Parachute::p_Shoot | ( | ) | [protected, virtual] |
Implements Weapon.
Definition at line 56 of file parachute.cpp.
00057 { 00058 GameMessages::GetInstance()->Add(_("Parachute is activated automatically.")); 00059 return false; 00060 }
Here is the call graph for this function:
void Parachute::Refresh | ( | ) | [protected, virtual] |
Implements Weapon.
Definition at line 71 of file parachute.cpp.
00072 { 00073 double speed; 00074 double angle; 00075 00076 ActiveCharacter().GetSpeed(speed, angle); 00077 00078 if (ActiveCharacter().FootsInVacuum() && speed != 0.0) 00079 { 00080 if (!open && (speed > GameMode::GetInstance()->safe_fall)) 00081 { 00082 if (EnoughAmmo()) 00083 { 00084 UseAmmo(); 00085 ActiveCharacter().SetAirResistFactor(cfg().air_resist_factor); 00086 ActiveCharacter().SetWindFactor(cfg().wind_factor); 00087 open = true ; 00088 image->animation.SetPlayBackward(false); 00089 image->Start(); 00090 ActiveCharacter().SetSpeedXY(Point2d(0,0)); 00091 ActiveCharacter().SetMovement("parachute"); 00092 } 00093 } 00094 } 00095 else 00096 { 00097 /* We are on the ground */ 00098 if (open) 00099 { 00100 /* The parachute is opened */ 00101 if (!closing) 00102 { 00103 /* We have just hit the ground. Start closing animation */ 00104 image->animation.SetPlayBackward(true); 00105 image->animation.SetShowOnFinish(SpriteAnimation::show_blank); 00106 image->Start(); 00107 closing = true ; 00108 } 00109 else 00110 {/* The parachute is closing */ 00111 if (image->IsFinished()) 00112 { 00113 /* The animation is finished... 00114 We are done with the parachute */ 00115 open = false ; 00116 closing = false ; 00117 UseAmmoUnit(); 00118 } 00119 } 00120 } 00121 } 00122 }
Here is the call graph for this function:
void Parachute::SignalTurnEnd | ( | ) | [virtual] |
Reimplemented from Weapon.
Definition at line 124 of file parachute.cpp.
00125 { 00126 p_Deselect(); 00127 }
Here is the call graph for this function:
bool Parachute::closing [private] |
Definition at line 43 of file parachute.h.
Sprite* Parachute::image [private] |
Definition at line 44 of file parachute.h.
bool Parachute::open [private] |
Definition at line 42 of file parachute.h.