/*! -------------------------------------------------------------------- \file spaceship.h \brief Spaceship abstract class \author Roy Thompson \date 2002-11-15 // -------------------------------------------------------------------*/ #ifndef __SPACESHIP_H__ #define __SPACESHIP_H__ //#include #include "m3d.h" #include "mquat.h" #include "m4x4.h" //#include "world.h" enum SpaceshipType { PLAYER = 0, ENEMY = 1, NUM_STYPES }; struct BoundingVol { Math3d::M3d center; float radius; }; // abstract base class for all spaceships in world class Spaceship { public: Spaceship(int shipType); virtual ~Spaceship() { } virtual void Render() = 0; virtual void UpdateState(float timeElapsed, bool roll); virtual void Hit(float damage); void SetMaxVelocity(float velocity) { maxVelocity = velocity; } void UpdateState(float timeElapsed) { UpdateState(timeElapsed, false); } int GetType() { return _shipType; } //void SetState(const SpaceshipState &shipState) { _shipState = shipState; } // const SpaceshipState& GetState() const { return _shipState; } Math3d::M4x4 GetRotationMat(); Math3d::M3d GetPosition() { return position; } // + hover; } void SetPosition(Math3d::M3d pos) { position = pos; } Math3d::M3d GetDirection(); Math3d::M3d GetDirection(Math3d::MQuat orient); bool IsCollision(BoundingVol bvol); void SetMissleDamage(float damage) { missleDamage = damage; } const BoundingVol GetBoundingVol() const { BoundingVol bv; bv.radius = radius; bv.center = position; return bv; } bool IsAlive() { return alive; } void Restart(); float health; float cycler; float velocity; float rollinc; float pitchinc; float yawinc; float velinc; protected: int _shipType; float radius; float maxVelocity; bool alive; float missleDamage; Math3d::M3d position; // Math3d::M3d side; //Math3d::M3d up; Math3d::M3d hover; // hover movement (subtle hovering effect) // Math3d::M4x4 rotQuat; Math3d::M4x4 matYaw; Math3d::MQuat yawQuat; Math3d::M4x4 matPitch; Math3d::MQuat pitchQuat; Math3d::M4x4 matRoll; Math3d::MQuat rollQuat; float dampenrotlots, dampenrot, dampenvel; Math3d::MQuat orientation; Math3d::M4x4 matFinal, matScale, matTrans, matTransFlare, matRotQuat, matRotQuatInv; }; #endif