1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef STRAFE_AIR_MOVE_TYPE_H_
#define STRAFE_AIR_MOVE_TYPE_H_
#include "AAirMoveType.h"
#include <vector>
/**
* Air movement type definition
*/
class CStrafeAirMoveType: public AAirMoveType
{
CR_DECLARE_DERIVED(CStrafeAirMoveType)
CR_DECLARE_SUB(DrawLine)
public:
enum {
MANEUVER_FLY_STRAIGHT = 0,
MANEUVER_IMMELMAN = 1,
MANEUVER_IMMELMAN_INV = 2,
};
CStrafeAirMoveType(CUnit* owner);
bool Update() override;
void SlowUpdate() override;
bool SetMemberValue(unsigned int memberHash, void* memberValue) override;
void UpdateManeuver();
void UpdateAttack();
bool UpdateFlying(float wantedHeight, float engine);
void UpdateLanding();
void UpdateAirPhysics(
float rudder,
float aileron,
float elevator,
float engine,
const float3& engineVector
);
void SetState(AircraftState state) override;
void UpdateTakeOff();
float3 FindLandingPos();
void SetMaxSpeed(float speed) override;
float BrakingDistance(float speed, float rate) const override;
void KeepPointingTo(float3 pos, float distance, bool aggressive) override {}
void StartMoving(float3 pos, float goalRadius) override;
void StartMoving(float3 pos, float goalRadius, float speed) override;
void StopMoving(bool callScript = false, bool hardStop = false, bool cancelRaw = false) override;
void Takeoff() override;
int maneuverState;
int maneuverSubState;
bool loopbackAttack;
bool isFighter;
float wingDrag;
float wingAngle;
float invDrag;
/// actually the invDrag of crashDrag
float crashDrag;
float frontToSpeed;
float speedToFront;
float myGravity;
float maxBank;
float maxPitch;
float turnRadius;
float maxAileron;
float maxElevator;
float maxRudder;
// fighters abort dive toward target if within this distance and climb back to normal altitude
float attackSafetyDistance;
/// used while landing
float crashAileron;
float crashElevator;
float crashRudder;
float lastRudderPos;
float lastElevatorPos;
float lastAileronPos;
private:
bool HandleCollisions(bool checkCollisions);
};
#endif // _AIR_MOVE_TYPE_H_
|