1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-20 17:31:44 +02:00
openrw/framework2/include/renderwure/engine/GTAEngine.hpp

142 lines
2.3 KiB
C++
Raw Normal View History

#pragma once
#ifndef _GTAENGINE_HPP_
#define _GTAENGINE_HPP_
#include <renderwure/engine/GTAData.hpp>
#include <renderwure/loaders/LoaderIPL.hpp>
2013-07-02 09:53:23 +02:00
#include <renderwure/render/GTARenderer.hpp>
2013-07-02 08:06:03 +02:00
#include <glm/glm.hpp>
#include <vector>
2013-07-02 12:48:01 +02:00
#include <queue>
2013-07-02 08:06:03 +02:00
/**
* @class GTAEngine
* Provides a simple interface to the framework's internals
*/
class GTAEngine
{
public:
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::queue<LogEntry> log;
/**
* Displays an informative message
*/
void logInfo(const std::string& info);
/**
* Displays an alarming error
*/
void logError(const std::string& error);
2013-07-02 14:49:20 +02:00
/**
* @struct GTAObject
* Stores references to the Object data and the instance
*/
struct GTAInstance {
LoaderIPLInstance instance;
std::shared_ptr<LoaderIDE::OBJS_t> object;
};
/**
* @class GTAVehicle
* Stores references to the vehicle data and the instance
* @todo some kind of VehicleInstance data so we can save that.
*/
struct GTAVehicle {
glm::vec3 position;
std::shared_ptr<LoaderIDE::CARS_t> vehicle;
};
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);
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;
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
2013-07-02 08:06:03 +02:00
};
#endif