#include <fire.h>
Inheritance diagram for FireParticle:
Public Member Functions | |
FireParticle () | |
~FireParticle () | |
void | Refresh () |
void | Draw () |
Protected Member Functions | |
void | SignalDrowning () |
void | SignalOutOfMap () |
Private Attributes | |
int | direction |
int | creation_time |
bool | on_ground |
int | oscil_delta |
Definition at line 26 of file fire.h.
FireParticle::FireParticle | ( | ) |
Definition at line 34 of file fire.cpp.
00034 : 00035 Particle("fire_particle") 00036 { 00037 SetCollisionModel(false, false, false); 00038 m_left_time_to_live = 100; 00039 m_check_move_on_end_turn = true; 00040 fire_cfg.damage = 1; 00041 fire_cfg.explosion_range = 5; 00042 fire_cfg.blast_range = 0; 00043 fire_cfg.blast_force = 0; 00044 fire_cfg.particle_range = 6; 00045 // direction = randomSync.GetBool() ? -1 : 1; 00046 // oscil_delta = randomSync.GetLong(0, dig_ground_time); 00047 direction = randomObj.GetBool() ? -1 : 1; 00048 oscil_delta = randomObj.GetLong(0, dig_ground_time); 00049 on_ground = false; 00050 image = ParticleEngine::GetSprite(FIRE_spr); 00051 image->SetRotation_HotSpot(Point2i(image->GetWidth()/2,image->GetHeight())); 00052 creation_time = Time::GetInstance()->Read(); 00053 SetSize( image->GetSize() ); 00054 SetTestRect((image->GetWidth() / 2)-1, (image->GetWidth() / 2) - 1, 00055 (image->GetHeight()/2)-1,1); 00056 }
Here is the call graph for this function:
FireParticle::~FireParticle | ( | ) |
Definition at line 58 of file fire.cpp.
00059 { 00060 camera.StopFollowingObj(this); 00061 }
Here is the call graph for this function:
void FireParticle::Draw | ( | ) | [virtual] |
void FireParticle::Refresh | ( | ) | [virtual] |
Reimplemented from Particle.
Definition at line 63 of file fire.cpp.
00064 { 00065 uint now = Time::GetInstance()->Read(); 00066 UpdatePosition(); 00067 image->Update(); 00068 00069 if (creation_time + living_time < now) 00070 m_left_time_to_live = 0; 00071 00072 float scale = (now - creation_time)/(float)living_time; 00073 scale = 1.0 - scale; 00074 image->Scale((float)direction * scale, scale); 00075 00076 if(image->GetSize().x != 0 && image->GetSize().y != 0) 00077 { 00078 SetSize( image->GetSize() ); 00079 SetTestRect((image->GetWidth() / 2)-1, (image->GetWidth() / 2) - 1, 00080 (image->GetHeight()/2)-1,1); 00081 } 00082 else 00083 SetSize( Point2i(1,1) ); 00084 00085 00086 if(on_ground || !FootsInVacuum()) 00087 { 00088 on_ground = true; 00089 if((now + oscil_delta) / dig_ground_time != (m_last_refresh + oscil_delta) / dig_ground_time) 00090 { 00091 ApplyExplosion(Point2i(GetCenter().x,(GetY() + GetHeight() + GetCenter().y)/2), fire_cfg, "", false, ParticleEngine::LittleESmoke); 00092 fire_cfg.explosion_range = (uint)(0.5 * scale * image->GetWidth()) + 1; 00093 fire_cfg.particle_range = (uint)(0.6 * scale * image->GetWidth()) + 1; 00094 } 00095 double angle = 0.0; 00096 angle += cos((((now + oscil_delta) % 1000)/500.0) * M_PI) * 0.5; // 0.5 is arbirtary 00097 image->SetRotation_HotSpot(Point2i(image->GetWidth()/2,image->GetHeight())); 00098 image->SetRotation_rad( angle); 00099 } 00100 else 00101 { 00102 double angle = GetSpeedAngle(); 00103 image->SetRotation_rad((angle - M_PI_2) * direction); 00104 } 00105 00106 m_last_refresh = now; 00107 }
Here is the call graph for this function:
void FireParticle::SignalDrowning | ( | ) | [protected, virtual] |
Reimplemented from Physics.
Definition at line 114 of file fire.cpp.
00115 { 00116 m_left_time_to_live = 0; 00117 // jukebox.Play("share","fire/pschiit"); 00118 }
void FireParticle::SignalOutOfMap | ( | ) | [protected, virtual] |
Reimplemented from PhysicalObj.
Definition at line 120 of file fire.cpp.
00121 { 00122 m_left_time_to_live = 0; 00123 }
int FireParticle::creation_time [private] |
int FireParticle::direction [private] |
bool FireParticle::on_ground [private] |
int FireParticle::oscil_delta [private] |