#include <launcher.h>
Inheritance diagram for WeaponLauncher:
Definition at line 99 of file launcher.h.
WeaponLauncher::WeaponLauncher | ( | Weapon_type | type, | |
const std::string & | id, | |||
EmptyWeaponConfig * | params, | |||
weapon_visibility_t | visibility = ALWAYS_VISIBLE | |||
) |
Definition at line 306 of file launcher.cpp.
00309 : 00310 Weapon(type, id, params, visibility) 00311 { 00312 projectile = NULL; 00313 nb_active_projectile = 0; 00314 missed_shots = 0; 00315 announce_missed_shots = true; 00316 ignore_timeout_signal = false; 00317 ignore_collision_signal = false; 00318 ignore_explosion_signal = false; 00319 ignore_ghost_state_signal = false; 00320 ignore_drowning_signal = false; 00321 }
WeaponLauncher::~WeaponLauncher | ( | ) | [virtual] |
Definition at line 323 of file launcher.cpp.
00324 { 00325 if (projectile) delete projectile; 00326 }
void WeaponLauncher::ActionDown | ( | ) | [virtual] |
Reimplemented from Weapon.
Definition at line 522 of file launcher.cpp.
00523 { 00524 projectile->DecrementTimeOut(); 00525 }
Here is the call graph for this function:
void WeaponLauncher::ActionUp | ( | ) | [virtual] |
Reimplemented from Weapon.
Definition at line 516 of file launcher.cpp.
00517 { 00518 projectile->IncrementTimeOut(); 00519 }
Here is the call graph for this function:
ExplosiveWeaponConfig & WeaponLauncher::cfg | ( | ) |
Reimplemented in AutomaticBazooka, ClusterLauncher, Mine, and TuxLauncher.
Definition at line 527 of file launcher.cpp.
Here is the caller graph for this function:
void WeaponLauncher::DecActiveProjectile | ( | ) |
Definition at line 393 of file launcher.cpp.
00394 { 00395 --nb_active_projectile; 00396 }
Here is the caller graph for this function:
void WeaponLauncher::DirectExplosion | ( | ) | [private] |
Definition at line 350 of file launcher.cpp.
00351 { 00352 Point2i pos = ActiveCharacter().GetCenter(); 00353 ApplyExplosion (pos, cfg()); 00354 }
Here is the call graph for this function:
void WeaponLauncher::Draw | ( | ) | [virtual] |
Reimplemented from Weapon.
Reimplemented in AutomaticBazooka, and SnipeRifle.
Definition at line 403 of file launcher.cpp.
00404 { 00405 //Display timeout for projectil if can be changed. 00406 if (projectile->change_timeout_allowed()) 00407 { 00408 if( IsActive() ) //Do not display after launching. 00409 return; 00410 00411 int tmp = projectile->GetTotalTimeout(); 00412 std::ostringstream ss; 00413 ss << tmp; 00414 ss << "s"; 00415 int txt_x = ActiveCharacter().GetX() + ActiveCharacter().GetWidth() / 2; 00416 int txt_y = ActiveCharacter().GetY() - ActiveCharacter().GetHeight(); 00417 (*Font::GetInstance(Font::FONT_SMALL)).WriteCenterTop( Point2i(txt_x, txt_y) - camera.GetPosition(), 00418 ss.str(), white_color); 00419 } 00420 00421 Weapon::Draw(); 00422 00423 #ifdef DEBUG_EXPLOSION_CONFIG 00424 ExplosiveWeaponConfig* cfg = dynamic_cast<ExplosiveWeaponConfig*>(extra_params); 00425 if( cfg != NULL ) 00426 { 00427 Point2i p = ActiveCharacter().GetHandPosition() - camera.GetPosition(); 00428 // Red color for the blast range (should be superior to the explosion_range) 00429 AppWormux::GetInstance()->video.window.CircleColor(p.x, p.y, (int)cfg->blast_range, c_red); 00430 // Yellow color for the blast range (should be superior to the explosion_range) 00431 AppWormux::GetInstance()->video.window.CircleColor(p.x, p.y, (int)cfg->explosion_range, c_black); 00432 } 00433 AppWormux::GetInstance()->video.window.CircleColor(GetGunHolePosition().x-camera.GetPositionX(), GetGunHolePosition().y-camera.GetPositionY(), 5, c_black); 00434 #endif 00435 }
Here is the call graph for this function:
Here is the caller graph for this function:
WeaponProjectile* WeaponLauncher::GetProjectile | ( | ) | [inline] |
Definition at line 149 of file launcher.h.
00149 { return projectile; };
Here is the caller graph for this function:
virtual WeaponProjectile* WeaponLauncher::GetProjectileInstance | ( | ) | [protected, pure virtual] |
Implemented in AnvilLauncher, AutomaticBazooka, Bazooka, BounceBallLauncher, ClusterLauncher, DiscoGrenadeLauncher, Dynamite, GnuLauncher, GrenadeLauncher, Gun, Mine, PolecatLauncher, RiotBomb, Shotgun, SnipeRifle, SubMachineGun, and TuxLauncher.
Here is the caller graph for this function:
void WeaponLauncher::HandleKeyEvent | ( | Action::Action_t | action, | |
Keyboard::Key_Event_t | event_type | |||
) | [virtual] |
Reimplemented from Weapon.
Reimplemented in SubMachineGun, and TuxLauncher.
Definition at line 463 of file launcher.cpp.
00464 { 00465 if (event_type == Keyboard::KEY_RELEASED) 00466 switch (action) { 00467 case Action::ACTION_WEAPON_1: 00468 projectile->SetTimeOut(1); 00469 break; 00470 case Action::ACTION_WEAPON_2: 00471 projectile->SetTimeOut(2); 00472 break; 00473 case Action::ACTION_WEAPON_3: 00474 projectile->SetTimeOut(3); 00475 break; 00476 case Action::ACTION_WEAPON_4: 00477 projectile->SetTimeOut(4); 00478 break; 00479 case Action::ACTION_WEAPON_5: 00480 projectile->SetTimeOut(5); 00481 break; 00482 case Action::ACTION_WEAPON_6: 00483 projectile->SetTimeOut(6); 00484 break; 00485 case Action::ACTION_WEAPON_7: 00486 projectile->SetTimeOut(7); 00487 break; 00488 case Action::ACTION_WEAPON_8: 00489 projectile->SetTimeOut(8); 00490 break; 00491 case Action::ACTION_WEAPON_9: 00492 projectile->SetTimeOut(9); 00493 break; 00494 00495 case Action::ACTION_WEAPON_MORE: 00496 projectile->IncrementTimeOut(); 00497 break ; 00498 00499 case Action::ACTION_WEAPON_LESS: 00500 projectile->DecrementTimeOut(); 00501 break ; 00502 00503 default: 00504 break ; 00505 00506 }; 00507 00508 if((action >= Action::ACTION_WEAPON_1 && action <= Action::ACTION_WEAPON_9) 00509 || action == Action::ACTION_WEAPON_MORE || action == Action::ACTION_WEAPON_LESS) 00510 ActionHandler::GetInstance()->NewAction(new Action(Action::ACTION_SET_TIMEOUT, projectile->m_timeout_modifier)); 00511 00512 ActiveCharacter().HandleKeyEvent(action, event_type); 00513 }
Here is the call graph for this function:
void WeaponLauncher::IncActiveProjectile | ( | ) |
Definition at line 388 of file launcher.cpp.
00389 { 00390 ++nb_active_projectile; 00391 }
Here is the caller graph for this function:
void WeaponLauncher::IncMissedShots | ( | ) | [virtual] |
Reimplemented in Shotgun, and SubMachineGun.
Definition at line 456 of file launcher.cpp.
00457 { 00458 missed_shots++; 00459 if(announce_missed_shots) 00460 GameMessages::GetInstance()->Add (_("Your shot has missed!")); 00461 }
Here is the call graph for this function:
Here is the caller graph for this function:
void WeaponLauncher::p_Deselect | ( | ) | [protected, virtual] |
Reimplemented from Weapon.
Reimplemented in AutomaticBazooka, and SnipeRifle.
Definition at line 448 of file launcher.cpp.
00449 { 00450 if (projectile->change_timeout_allowed()) 00451 { 00452 force_override_keys = false; 00453 } 00454 }
Here is the call graph for this function:
Here is the caller graph for this function:
void WeaponLauncher::p_Select | ( | ) | [protected, virtual] |
Reimplemented from Weapon.
Reimplemented in AutomaticBazooka.
Definition at line 437 of file launcher.cpp.
00438 { 00439 missed_shots = 0; 00440 if (projectile->change_timeout_allowed()) 00441 { 00442 force_override_keys = true; //Allow overriding key during movement. 00443 projectile->ResetTimeOut(); 00444 } 00445 Weapon::p_Select(); 00446 }
Here is the call graph for this function:
Here is the caller graph for this function:
bool WeaponLauncher::p_Shoot | ( | ) | [protected, virtual] |
Implements Weapon.
Reimplemented in AnvilLauncher, BounceBallLauncher, Dynamite, Gun, Mine, Shotgun, SnipeRifle, SubMachineGun, and TuxLauncher.
Definition at line 328 of file launcher.cpp.
00329 { 00330 // if (m_strength == max_strength) 00331 // { 00332 // m_strength = 0; 00333 // DirectExplosion(); 00334 // return true; 00335 // } 00336 projectile->Shoot (m_strength); 00337 projectile = NULL; 00338 ReloadLauncher(); 00339 return true; 00340 }
Here is the call graph for this function:
Here is the caller graph for this function:
void WeaponLauncher::Refresh | ( | ) | [protected, virtual] |
Implements Weapon.
Reimplemented in AutomaticBazooka.
Definition at line 399 of file launcher.cpp.
Here is the caller graph for this function:
bool WeaponLauncher::ReloadLauncher | ( | ) | [protected, virtual] |
Definition at line 342 of file launcher.cpp.
00343 { 00344 if (projectile) return false; 00345 projectile = GetProjectileInstance(); 00346 return true; 00347 }
Here is the call graph for this function:
Here is the caller graph for this function:
void WeaponLauncher::SignalProjectileCollision | ( | ) | [virtual] |
Definition at line 364 of file launcher.cpp.
00365 { 00366 m_is_active = false; 00367 }
Here is the caller graph for this function:
void WeaponLauncher::SignalProjectileDrowning | ( | ) | [virtual] |
Definition at line 382 of file launcher.cpp.
00383 { 00384 m_is_active = false; 00385 }
Here is the caller graph for this function:
void WeaponLauncher::SignalProjectileExplosion | ( | ) | [virtual] |
Definition at line 357 of file launcher.cpp.
00358 { 00359 DecActiveProjectile(); 00360 m_is_active = false; 00361 }
Here is the call graph for this function:
Here is the caller graph for this function:
void WeaponLauncher::SignalProjectileGhostState | ( | ) | [virtual] |
Reimplemented in SnipeRifle.
Definition at line 370 of file launcher.cpp.
00371 { 00372 m_is_active = false; 00373 }
Here is the caller graph for this function:
void WeaponLauncher::SignalProjectileTimeout | ( | ) | [virtual] |
Definition at line 376 of file launcher.cpp.
00377 { 00378 m_is_active = false; 00379 }
Here is the caller graph for this function:
bool WeaponLauncher::announce_missed_shots [protected] |
Definition at line 112 of file launcher.h.
Definition at line 103 of file launcher.h.
Definition at line 106 of file launcher.h.
Definition at line 104 of file launcher.h.
Definition at line 105 of file launcher.h.
Definition at line 102 of file launcher.h.
bool WeaponLauncher::m_allow_change_timeout [protected] |
Definition at line 110 of file launcher.h.
int WeaponLauncher::missed_shots [protected] |
Definition at line 111 of file launcher.h.
uint WeaponLauncher::nb_active_projectile [protected] |
Definition at line 109 of file launcher.h.
WeaponProjectile* WeaponLauncher::projectile [protected] |
Definition at line 108 of file launcher.h.