1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-08 03:42:35 +01:00
openrw/rwengine/include/objects/GTAVehicle.hpp

80 lines
1.5 KiB
C++
Raw Normal View History

2013-09-09 01:18:36 +02:00
#pragma once
#ifndef _GTAVEHICLE_HPP_
#define _GTAVEHICLE_HPP_
#include <engine/GameObject.hpp>
2013-09-09 05:04:21 +02:00
#include <bullet/btBulletDynamicsCommon.h>
#include <map>
#include <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 GameObject
2013-09-09 01:18:36 +02:00
{
private:
float steerAngle;
float throttle;
float brake;
bool handbrake;
public:
VehicleDataHandle vehicle;
VehicleInfoHandle info;
2013-09-09 01:18:36 +02:00
glm::vec3 colourPrimary;
glm::vec3 colourSecondary;
std::map<size_t, GameObject*> 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-12-20 17:02:46 +01:00
GTAVehicle(GameWorld* engine,
2013-09-15 03:42:35 +02:00
const glm::vec3& pos,
const glm::quat& rot,
Model* model,
VehicleDataHandle data,
VehicleInfoHandle info,
2013-09-15 03:42:35 +02:00
const glm::vec3& prim,
const glm::vec3& sec);
virtual ~GTAVehicle();
void setPosition(const glm::vec3& pos);
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
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
void ejectAll();
GameObject* getOccupant(size_t seat);
void setOccupant(size_t seat, GameObject* occupant);
2013-12-06 22:25:34 +01:00
virtual bool takeDamage(const DamageInfo& damage);
2013-09-09 01:18:36 +02:00
};
#endif