2013-09-09 01:18:36 +02:00
|
|
|
#pragma once
|
|
|
|
#ifndef _GTAVEHICLE_HPP_
|
|
|
|
#define _GTAVEHICLE_HPP_
|
|
|
|
#include <renderwure/engine/GTAObject.hpp>
|
2013-09-09 05:04:21 +02:00
|
|
|
#include <bullet/btBulletDynamicsCommon.h>
|
2013-12-12 16:36:50 +01:00
|
|
|
#include <map>
|
2013-09-15 03:42:35 +02:00
|
|
|
#include <renderwure/objects/VehicleInfo.hpp>
|
2013-09-09 01:18:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @class GTAVehicle
|
|
|
|
* Stores references to the vehicle data and the instance
|
|
|
|
*/
|
|
|
|
struct GTAVehicle : public GTAObject
|
|
|
|
{
|
2013-09-16 00:44:24 +02:00
|
|
|
private:
|
|
|
|
float steerAngle;
|
|
|
|
float throttle;
|
|
|
|
float brake;
|
|
|
|
bool handbrake;
|
|
|
|
public:
|
2013-09-19 00:16:26 +02:00
|
|
|
|
2013-11-26 17:14:13 +01:00
|
|
|
std::shared_ptr<CarData> vehicle;
|
2013-09-15 03:42:35 +02:00
|
|
|
VehicleInfo info;
|
2013-09-09 01:18:36 +02:00
|
|
|
glm::vec3 colourPrimary;
|
|
|
|
glm::vec3 colourSecondary;
|
2013-12-12 16:36:50 +01:00
|
|
|
|
|
|
|
std::map<size_t, GTAObject*> seatOccupants;
|
2013-09-09 01:18:36 +02:00
|
|
|
|
2013-09-09 05:04:21 +02:00
|
|
|
btRigidBody* physBody;
|
2013-09-15 03:42:35 +02:00
|
|
|
btVehicleRaycaster* physRaycaster;
|
|
|
|
btRaycastVehicle* physVehicle;
|
2013-09-09 05:04:21 +02:00
|
|
|
|
2013-09-15 03:42:35 +02:00
|
|
|
GTAVehicle(GTAEngine* engine,
|
|
|
|
const glm::vec3& pos,
|
|
|
|
const glm::quat& rot,
|
|
|
|
Model* model,
|
2013-11-26 17:14:13 +01:00
|
|
|
std::shared_ptr<CarData> data,
|
2013-09-15 03:42:35 +02:00
|
|
|
const VehicleInfo& info,
|
|
|
|
const glm::vec3& prim,
|
|
|
|
const glm::vec3& sec);
|
2013-12-12 16:36:50 +01:00
|
|
|
|
|
|
|
virtual ~GTAVehicle();
|
2013-09-09 05:04:21 +02:00
|
|
|
|
|
|
|
glm::vec3 getPosition() const;
|
|
|
|
|
|
|
|
glm::quat getRotation() const;
|
2013-09-09 01:18:36 +02:00
|
|
|
|
|
|
|
Type type() { return Vehicle; }
|
2013-09-15 03:42:35 +02:00
|
|
|
|
2013-09-16 00:44:24 +02:00
|
|
|
void setSteeringAngle(float);
|
|
|
|
|
|
|
|
float getSteeringAngle() const;
|
|
|
|
|
|
|
|
void setThrottle(float);
|
|
|
|
|
|
|
|
float getThrottle() const;
|
|
|
|
|
|
|
|
void setBraking(float);
|
|
|
|
|
|
|
|
float getBraking() const;
|
|
|
|
|
|
|
|
void setHandbraking(bool);
|
|
|
|
|
|
|
|
bool getHandbraking() const;
|
|
|
|
|
2013-09-15 03:42:35 +02:00
|
|
|
void tick(float dt);
|
2013-12-06 22:25:34 +01:00
|
|
|
|
2013-12-12 16:36:50 +01:00
|
|
|
void ejectAll();
|
|
|
|
|
|
|
|
GTAObject* getOccupant(size_t seat);
|
|
|
|
|
|
|
|
void setOccupant(size_t seat, GTAObject* occupant);
|
|
|
|
|
2013-12-06 22:25:34 +01:00
|
|
|
virtual bool takeDamage(const DamageInfo& damage);
|
2013-09-09 01:18:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|