#include <teleportation.h>
Inheritance diagram for Teleportation:


| Public Member Functions | |
| Teleportation () | |
| void | Draw () | 
| void | ChooseTarget (Point2i mouse_pos) | 
| WeaponConfig & | cfg () | 
| Protected Member Functions | |
| bool | p_Shoot () | 
| void | Refresh () | 
| Private Attributes | |
| bool | target_chosen | 
| uint | time | 
| Point2i | src | 
| Point2i | dst | 
Definition at line 28 of file teleportation.h.
| Teleportation::Teleportation | ( | ) | 
Definition at line 35 of file teleportation.cpp.
00035 : Weapon(WEAPON_TELEPORTATION, "teleportation", 00036 new WeaponConfig(), 00037 VISIBLE_ONLY_WHEN_INACTIVE) 00038 { 00039 m_name = _("Teleportation"); 00040 target_chosen = false; 00041 }
| WeaponConfig & Teleportation::cfg | ( | ) | 
| void Teleportation::ChooseTarget | ( | Point2i | mouse_pos | ) |  [virtual] | 
Reimplemented from Weapon.
Definition at line 92 of file teleportation.cpp.
00093 { 00094 dst = mouse_pos - ActiveCharacter().GetSize()/2; 00095 if(!world.ParanoiacRectIsInVacuum(Rectanglei(dst,ActiveCharacter().GetSize())) || 00096 !ActiveCharacter().IsInVacuumXY(dst)) 00097 return; 00098 target_chosen = true; 00099 Shoot(); 00100 }
Here is the call graph for this function:

| void Teleportation::Draw | ( | ) |  [virtual] | 
Reimplemented from Weapon.
Definition at line 86 of file teleportation.cpp.
00087 { 00088 if (!m_is_active) 00089 Weapon::Draw(); 00090 }
Here is the call graph for this function:

| bool Teleportation::p_Shoot | ( | ) |  [protected, virtual] | 
Implements Weapon.
Definition at line 43 of file teleportation.cpp.
00044 { 00045 if(!target_chosen) 00046 return false; 00047 00048 // Check we are not going outside of the world ! 00049 if( ActiveCharacter().IsOutsideWorldXY(dst) ) 00050 return false; 00051 00052 Rectanglei rect = ActiveCharacter().GetTestRect(); 00053 rect.SetPosition(dst); 00054 00055 GameLoop::GetInstance()->interaction_enabled = false; 00056 00057 jukebox.Play("share", "weapon/teleport_start"); 00058 00059 time = Time::GetInstance()->Read(); 00060 ActiveCharacter().Hide(); 00061 ActiveCharacter().body->MakeTeleportParticles(ActiveCharacter().GetPosition(), dst); 00062 00063 target_chosen = false; // ensure next teleportation cannot be done pressing key space 00064 return true; 00065 }
Here is the call graph for this function:

| void Teleportation::Refresh | ( | ) |  [protected, virtual] | 
Implements Weapon.
Definition at line 67 of file teleportation.cpp.
00068 { 00069 if (!m_is_active) return; 00070 00071 double dt = Time::GetInstance()->Read() - time; 00072 00073 if(dt > teleportation_anim_duration) 00074 { 00075 camera.SetXYabs(dst - camera.GetSize()/2); 00076 ActiveCharacter().SetXY(dst); 00077 m_is_active = false; 00078 ActiveCharacter().SetSpeed(0.0,0.0); 00079 ActiveCharacter().Show(); 00080 jukebox.Play("share","weapon/teleport_end"); 00081 GameLoop::GetInstance()->interaction_enabled = true; 00082 return; 00083 } 00084 }
Here is the call graph for this function:

| Point2i Teleportation::dst  [private] | 
Definition at line 33 of file teleportation.h.
| Point2i Teleportation::src  [private] | 
Definition at line 33 of file teleportation.h.
| bool Teleportation::target_chosen  [private] | 
Definition at line 31 of file teleportation.h.
| uint Teleportation::time  [private] | 
Definition at line 32 of file teleportation.h.
 1.4.7
 1.4.7