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

188 lines
3.2 KiB
C++
Raw Normal View History

#pragma once
2013-12-20 17:02:46 +01:00
#ifndef _GAMEWORLD_HPP_
#define _GAMEWORLD_HPP_
2013-12-20 17:02:46 +01:00
#include <engine/GameData.hpp>
#include <render/GTARenderer.hpp>
#include <loaders/LoaderIPL.hpp>
#include <ai/GTAAINode.hpp>
#include <ai/AIGraph.hpp>
2013-09-09 01:18:36 +02:00
class GTAObject;
class GTACharacter;
class GTAInstance;
class GTAVehicle;
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
*/
2013-12-20 17:02:46 +01:00
class GameWorld
2013-07-02 08:06:03 +02:00
{
public:
2013-12-20 17:02:46 +01:00
GameWorld(const std::string& gamepath);
2013-07-02 08:06:03 +02:00
/**
* 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 an instance
*/
GTAInstance *createInstance(const uint16_t id, const glm::vec3& pos, const glm::quat& rot = glm::quat());
/**
* Creates a vehicle
*/
GTAVehicle *createVehicle(const uint16_t id, const glm::vec3& pos, const glm::quat& rot = glm::quat());
/**
* Creates a pedestrian.
*/
2013-08-12 23:35:23 +02:00
GTACharacter* createPedestrian(const uint16_t id, const glm::vec3& pos, const glm::quat& rot = glm::quat());
2013-12-12 03:55:31 +01:00
/**
* Destroys an existing Object
*/
void destroyObject(GTAObject* object);
2013-07-02 12:48:01 +02:00
/**
* Game Clock
*/
float gameTime;
2013-07-02 08:06:03 +02:00
/**
* Game data
*/
2013-12-20 17:02:46 +01:00
GameData gameData;
2013-07-02 08:06:03 +02:00
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
*/
std::map<uint16_t, std::shared_ptr<ObjectData>> objectTypes;
/**
* Paths associated with each object definition.
*/
std::map<uint16_t, std::vector<std::shared_ptr<PathData>>> objectNodes;
/**
* Vehicle definitions
*/
std::map<uint16_t, std::shared_ptr<CarData>> vehicleTypes;
/**
* Ped definitions
*/
std::map<uint16_t, std::shared_ptr<CharacterData>> pedestrianTypes;
2013-07-02 14:49:20 +02:00
/**
* Game Objects!
*/
2013-08-16 01:05:41 +02:00
std::vector<std::shared_ptr<GTAInstance>> objectInstances;
/**
* Map of Model Names to Instances
*/
std::map<std::string, std::shared_ptr<GTAInstance>> modelInstances;
/**
* Game Vehicles!
*/
2013-09-09 05:04:21 +02:00
std::vector<GTAVehicle*> vehicleInstances;
2013-07-02 14:49:20 +02:00
/**
* Pedestrians and PCs.
*/
2013-08-11 22:42:54 +02:00
std::vector<GTACharacter*> pedestrians;
2013-12-12 03:55:31 +01:00
2013-09-21 04:27:33 +02:00
/**
* AI Graph
*/
AIGraph aigraph;
2013-07-30 17:59:44 +02:00
/**
* 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