#include <baseball.h>
Inheritance diagram for Baseball:
Public Member Functions | |
Baseball () | |
BaseballConfig & | cfg () |
Protected Member Functions | |
bool | p_Shoot () |
void | Refresh () |
Definition at line 41 of file baseball.h.
Baseball::Baseball | ( | ) |
Definition at line 30 of file baseball.cpp.
00030 : Weapon(WEAPON_BASEBALL, "baseball", new BaseballConfig()) 00031 { 00032 m_name = _("Baseball Bat"); 00033 m_weapon_fire = new Sprite(resource_manager.LoadImage(weapons_res_profile,m_id+"_fire")); 00034 m_weapon_fire->EnableRotationCache(32); 00035 }
Here is the call graph for this function:
BaseballConfig & Baseball::cfg | ( | ) |
bool Baseball::p_Shoot | ( | ) | [protected, virtual] |
Implements Weapon.
Definition at line 37 of file baseball.cpp.
00037 { 00038 00039 double angle = ActiveCharacter().GetFiringAngle(); 00040 double rayon = 0.0; 00041 bool fin = false; 00042 00043 jukebox.Play ("share","weapon/baseball"); 00044 00045 do 00046 { 00047 // Did we have finished the computation 00048 rayon += 1.0; 00049 if (cfg().range < rayon) 00050 { 00051 rayon = cfg().range; 00052 fin = true; 00053 } 00054 00055 // Compute point coordinates 00056 Point2i relative_pos(static_cast<int>(rayon * cos(angle)), 00057 static_cast<int>(rayon * sin(angle)) ); 00058 Point2i pos_to_check = ActiveCharacter().GetHandPosition() + relative_pos; 00059 00060 FOR_ALL_LIVING_CHARACTERS(equipe,ver) 00061 if (&(*ver) != &ActiveCharacter()) 00062 { 00063 // Did we touch somebody ? 00064 if( ver->ObjTouche(pos_to_check) ) 00065 { 00066 // Apply damage (*ver).SetEnergyDelta (-cfg().damage); 00067 ver->SetSpeed (cfg().strength / ver->GetMass(), angle); 00068 ver->SetMovement("fly"); 00069 camera.FollowObject (&(*ver), true, true); 00070 return true; 00071 } 00072 } 00073 } while (!fin); 00074 00075 return true; 00076 }
Here is the call graph for this function:
void Baseball::Refresh | ( | ) | [protected, virtual] |
Implements Weapon.
Definition at line 78 of file baseball.cpp.
00078 { 00079 if (m_is_active) 00080 m_is_active = false; 00081 }