#include <Ship.h>
Inheritance diagram for Teddy::SpaceGame::Ship:
Public Methods | |
Ship (char *name, ShipType *ship_type, Root *root) | |
Ship constructor. More... | |
ShipType * | getShipType () |
void | setTarget (ModelInstance *mi, Vector offset=Vector(0, 0, 0)) |
ModelInstance * | getTarget () |
void | setTargetPosition () |
Teleport instantly to target postion. Used to initialize wingmen position. More... | |
float | getPitch () const |
float | getRoll () const |
float | getSpeed () const |
virtual void | tick () |
Simulate one tick. More... | |
void | controlPitchUp (bool apply) |
Ship has activated or deactivated pitch up control. More... | |
void | controlPitchDown (bool apply) |
Ship has activated or deactivated pitch down control. More... | |
void | controlRollLeft (bool apply) |
Ship has activated or deactivated roll left control. More... | |
void | controlRollRight (bool apply) |
Ship has activated or deactivated roll right control. More... | |
void | controlMoreSpeed (bool apply) |
Ship wants more speed. More... | |
void | controlLessSpeed (bool apply) |
Ship wants less speed. More... | |
void | controlStop (bool apply) |
Ship wants to stop. More... | |
void | controlFireWeapon (bool apply) |
Ship wants to fire its weapon. More... | |
void | stopSpeed () |
void | stopPitch () |
void | stopRoll () |
void | collide () |
float | getBrakeDistance () const |
float | getTargetDistance () const |
float | getPitchDistance () |
float | getRollDistance () |
void | trackTarget () |
virtual void | applyControls (float age) |
Apply ship controls. More... | |
Protected Attributes | |
Root * | root |
Application root. More... | |
ShipType * | ship_type |
ModelInstance * | target |
Ship navigation aimpoint. More... | |
Vector | target_offset |
Aimpoint offset. More... | |
float | prev_bullet_time |
bool | control_pitch_up |
True if pitch up key is pressed down. More... | |
bool | control_pitch_down |
True if pitch down key is pressed down. More... | |
bool | control_roll_left |
True if roll left key is pressed down. More... | |
bool | control_roll_right |
True if roll right key is pressed down. More... | |
bool | control_more_speed |
True if player wants more speed. More... | |
bool | control_less_speed |
True if player wants less speed. More... | |
bool | control_stop |
True if player wants to stop. More... | |
bool | control_fire_weapon |
True if player wants to fire weapon. More... | |
bool | active_pitch |
True if player is controlling pitch. More... | |
bool | active_roll |
True if player is controlling roll. More... | |
float | pitch_delta |
float | roll_delta |
float | pitch |
Current ship pitch delta. More... | |
float | roll |
Current ship roll delta. More... | |
float | speed |
Current ship speed. More... | |
float | accel |
Current ship acceleration. More... | |
float | pitch_distance |
float | roll_distance |
Definition at line 47 of file Ship.h.
|
Ship constructor.
Definition at line 48 of file Ship.cpp. References accel, active_pitch, active_roll, control_fire_weapon, control_less_speed, control_more_speed, control_pitch_down, control_pitch_up, control_roll_left, control_roll_right, control_stop, pitch, pitch_delta, roll, roll_delta, root, ship_type, speed, target, and target_offset. |
|
Apply ship controls.
Reimplemented in Teddy::SpaceGame::ComputerShip, and Teddy::SpaceGame::PlayerShip. Definition at line 34 of file ShipControls.cpp. References active_pitch, active_roll, pitch, pitch_delta, roll, roll_delta, ship_type, speed, and Teddy::SpaceGame::SimulatedInstance::tick_translation. Referenced by tick(). |
|
Definition at line 36 of file Ship.cpp. References speed, and Teddy::SpaceGame::SimulatedInstance::tick_translation. |
|
Ship wants to fire its weapon.
Definition at line 231 of file ShipControls.cpp. References control_fire_weapon. |
|
Ship wants less speed.
Definition at line 220 of file ShipControls.cpp. References control_less_speed. Referenced by stopSpeed(), and trackTarget(). |
|
Ship wants more speed.
Definition at line 214 of file ShipControls.cpp. References control_more_speed. Referenced by stopSpeed(), and trackTarget(). |
|
Ship has activated or deactivated pitch down control.
Definition at line 163 of file ShipControls.cpp. References active_pitch, control_pitch_down, pitch_delta, and ship_type. Referenced by stopPitch(), and trackTarget(). |
|
Ship has activated or deactivated pitch up control.
Definition at line 146 of file ShipControls.cpp. References active_pitch, control_pitch_up, pitch_delta, and ship_type. Referenced by stopPitch(), and trackTarget(). |
|
Ship has activated or deactivated roll left control.
Definition at line 197 of file ShipControls.cpp. References active_roll, control_roll_right, roll_delta, and ship_type. Referenced by stopRoll(), and trackTarget(). |
|
Ship has activated or deactivated roll right control.
Definition at line 180 of file ShipControls.cpp. References active_roll, control_roll_left, roll_delta, and ship_type. Referenced by stopRoll(), and trackTarget(). |
|
Ship wants to stop.
Definition at line 226 of file ShipControls.cpp. References control_stop. |
|
|
|
Definition at line 368 of file Ship.cpp. References pitch. |
|
Definition at line 82 of file Ship.h. References pitch_distance. |
|
Definition at line 372 of file Ship.cpp. References roll. |
|
Definition at line 83 of file Ship.h. References roll_distance. |
|
Definition at line 337 of file Ship.cpp. References ship_type. |
|
Definition at line 376 of file Ship.cpp. References speed. |
|
Definition at line 364 of file Ship.cpp. References target. |
|
Definition at line 120 of file Ship.cpp. References target. Referenced by trackTarget(). |
|
Definition at line 341 of file Ship.cpp. References target, and target_offset. |
|
Teleport instantly to target postion. Used to initialize wingmen position.
Definition at line 348 of file Ship.cpp. References target, and target_offset. |
|
Definition at line 95 of file Ship.cpp. References controlPitchDown(), controlPitchUp(), and pitch. Referenced by trackTarget(). |
|
Definition at line 106 of file Ship.cpp. References controlRollLeft(), controlRollRight(), and roll. Referenced by trackTarget(). |
|
Definition at line 84 of file Ship.cpp. References controlLessSpeed(), controlMoreSpeed(), and speed. Referenced by trackTarget(). |
|
Simulate one tick.
Reimplemented from Teddy::SpaceGame::SimulatedInstance. Definition at line 76 of file Ship.cpp. References applyControls(). |
|
Tactics: If V: > 0.5 -> forward If V: < 0.5 -> backward If U: < 0 -> pitch up ; do only if If U: > 0 -> pitch down ; fabs(U) > fabs(R) If R: > 0 -> roll right If R: < 0 -> roll left Definition at line 155 of file Ship.cpp. References controlLessSpeed(), controlMoreSpeed(), controlPitchDown(), controlPitchUp(), controlRollLeft(), controlRollRight(), getTargetDistance(), pitch, pitch_distance, roll, roll_distance, ship_type, Teddy::SpaceGame::SimulatedInstance::SimulatedInstance(), speed, stopPitch(), stopRoll(), stopSpeed(), target, and target_offset. Referenced by Teddy::SpaceGame::ComputerShip::applyControls(). |
|
Current ship acceleration.
Definition at line 114 of file Ship.h. Referenced by Ship(). |
|
True if player is controlling pitch.
Definition at line 106 of file Ship.h. Referenced by applyControls(), controlPitchDown(), controlPitchUp(), and Ship(). |
|
True if player is controlling roll.
Definition at line 107 of file Ship.h. Referenced by applyControls(), controlRollLeft(), controlRollRight(), and Ship(). |
|
True if player wants to fire weapon.
Definition at line 105 of file Ship.h. Referenced by controlFireWeapon(), and Ship(). |
|
True if player wants less speed.
Definition at line 103 of file Ship.h. Referenced by controlLessSpeed(), and Ship(). |
|
True if player wants more speed.
Definition at line 102 of file Ship.h. Referenced by controlMoreSpeed(), and Ship(). |
|
True if pitch down key is pressed down.
Definition at line 99 of file Ship.h. Referenced by controlPitchDown(), and Ship(). |
|
True if pitch up key is pressed down.
Definition at line 98 of file Ship.h. Referenced by controlPitchUp(), and Ship(). |
|
True if roll left key is pressed down.
Definition at line 100 of file Ship.h. Referenced by controlRollRight(), and Ship(). |
|
True if roll right key is pressed down.
Definition at line 101 of file Ship.h. Referenced by controlRollLeft(), and Ship(). |
|
True if player wants to stop.
Definition at line 104 of file Ship.h. Referenced by controlStop(), and Ship(). |
|
Current ship pitch delta.
Definition at line 111 of file Ship.h. Referenced by applyControls(), getPitch(), Ship(), stopPitch(), and trackTarget(). |
|
Definition at line 109 of file Ship.h. Referenced by applyControls(), controlPitchDown(), controlPitchUp(), and Ship(). |
|
Definition at line 115 of file Ship.h. Referenced by getPitchDistance(), and trackTarget(). |
|
Definition at line 96 of file Ship.h. Referenced by Teddy::SpaceGame::PlayerShip::applyControls(), and Teddy::SpaceGame::PlayerShip::PlayerShip(). |
|
Current ship roll delta.
Definition at line 112 of file Ship.h. Referenced by applyControls(), getRoll(), Ship(), stopRoll(), and trackTarget(). |
|
Definition at line 110 of file Ship.h. Referenced by applyControls(), controlRollLeft(), controlRollRight(), and Ship(). |
|
Definition at line 116 of file Ship.h. Referenced by getRollDistance(), and trackTarget(). |
|
Application root.
Definition at line 92 of file Ship.h. Referenced by Teddy::SpaceGame::PlayerShip::applyControls(), Teddy::SpaceGame::PlayerShip::PlayerShip(), and Ship(). |
|
Definition at line 93 of file Ship.h. Referenced by applyControls(), controlPitchDown(), controlPitchUp(), controlRollLeft(), controlRollRight(), getBrakeDistance(), getShipType(), Ship(), and trackTarget(). |
|
Current ship speed.
Definition at line 113 of file Ship.h. Referenced by applyControls(), collide(), getBrakeDistance(), getSpeed(), Ship(), stopSpeed(), and trackTarget(). |
|
Ship navigation aimpoint.
Definition at line 94 of file Ship.h. Referenced by getTarget(), getTargetDistance(), setTarget(), setTargetPosition(), Ship(), and trackTarget(). |
|
Aimpoint offset.
Definition at line 95 of file Ship.h. Referenced by setTarget(), setTargetPosition(), Ship(), and trackTarget(). |