1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-10 12:52:39 +01:00
openrw/framework2/include/renderwure/engine/GTAEngine.hpp

162 lines
2.7 KiB
C++
Raw Normal View History

#pragma once
#ifndef _GTAENGINE_HPP_
#define _GTAENGINE_HPP_
#include <renderwure/engine/GTAData.hpp>
2013-07-02 09:53:23 +02:00
#include <renderwure/render/GTARenderer.hpp>
#include <renderwure/engine/GTAObjects.hpp>
2013-07-02 08:06:03 +02:00
#include <glm/glm.hpp>
#include <btBulletDynamicsCommon.h>
#include <btBulletCollisionCommon.h>
#include <vector>
2013-07-02 12:48:01 +02:00
#include <queue>
#include <random>
2013-07-02 08:06:03 +02:00
/**
* @class GTAEngine
* Provides a simple interface to the framework's internals
*/
class GTAEngine
{
public:
2013-07-02 08:06:03 +02:00
GTAEngine(const std::string& gamepath);
/**
* Loads the game data
*/
bool load();
2013-07-02 12:48:01 +02:00
struct LogEntry
{
enum Type {
Info,
Error,
Warning
};
Type type;
float time;
std::string message;
};
std::deque<LogEntry> log;
2013-07-02 12:48:01 +02:00
/**
* Displays an informative message
*/
void logInfo(const std::string& info);
/**
* Displays an alarming error
*/
void logError(const std::string& error);
/**
* Displays a comforting warning
*/
void logWarning(const std::string& warning);
2013-07-02 14:49:20 +02:00
/**
* Loads an IDE into the game
*/
bool defineItems(const std::string& name);
2013-07-02 08:06:03 +02:00
/**
* Loads an IPL into the game.
* @param name The name of the IPL as it appears in the games' gta.dat
*/
2013-07-02 14:49:20 +02:00
bool placeItems(const std::string& name);
2013-07-02 08:06:03 +02:00
/**
* Loads the Zones from a zon/IPL file
*/
bool loadZone(const std::string& path);
/**
* Creates a vehicle
*/
void createVehicle(const uint16_t id, const glm::vec3& pos, const glm::quat& rot = glm::quat());
/**
* Creates a pedestrian.
*/
void createPedestrian(const uint16_t id, const glm::vec3& pos, const glm::quat& rot = glm::quat());
2013-07-02 08:06:03 +02:00
/**
* Roughly the middle of everything
*/
2013-07-02 14:49:20 +02:00
glm::vec3 itemCentroid;
size_t itemCount;
2013-07-02 08:06:03 +02:00
2013-07-02 12:48:01 +02:00
/**
* Game Clock
*/
float gameTime;
2013-07-02 08:06:03 +02:00
/**
* Game data
*/
GTAData gameData;
2013-07-02 09:53:23 +02:00
/**
* Renderer
*/
GTARenderer renderer;
/**
* Map Zones
*/
std::vector<LoaderIPL::Zone> zones;
2013-07-02 08:06:03 +02:00
/**
2013-07-02 14:49:20 +02:00
* Object Definitions
2013-07-02 08:06:03 +02:00
*/
2013-07-02 14:49:20 +02:00
std::map<uint16_t, std::shared_ptr<LoaderIDE::OBJS_t>> objectTypes;
/**
* Vehicle definitions
*/
std::map<uint16_t, std::shared_ptr<LoaderIDE::CARS_t>> vehicleTypes;
/**
* Ped definitions
*/
std::map<uint16_t, std::shared_ptr<LoaderIDE::PEDS_t>> pedestrianTypes;
2013-07-02 14:49:20 +02:00
/**
* Game Objects!
*/
std::vector<GTAInstance> objectInstances;
/**
* Game Vehicles!
*/
std::vector<GTAVehicle> vehicleInstances;
2013-07-02 14:49:20 +02:00
/**
* Pedestrians and PCs.
*/
std::vector<GTACharacter> pedestrians;
/**
* Randomness Engine
*/
std::default_random_engine randomEngine;
/**
* Bullet
*/
btDefaultCollisionConfiguration* collisionConfig;
btCollisionDispatcher* collisionDispatcher;
btBroadphaseInterface* broadphase;
btSequentialImpulseConstraintSolver* solver;
btDiscreteDynamicsWorld* dynamicsWorld;
2013-07-02 08:06:03 +02:00
};
#endif