mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
Renamed some objects to Game*
This commit is contained in:
parent
45d0c5b77c
commit
dc32c9c6ce
@ -12,7 +12,7 @@ class GTAAIController;
|
|||||||
class Model;
|
class Model;
|
||||||
class Animator;
|
class Animator;
|
||||||
|
|
||||||
class GTAEngine;
|
class GameWorld;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The GTAObject struct
|
* @brief The GTAObject struct
|
||||||
@ -25,7 +25,7 @@ struct GTAObject
|
|||||||
|
|
||||||
Model* model; /// Cached pointer to Object's Model.
|
Model* model; /// Cached pointer to Object's Model.
|
||||||
|
|
||||||
GTAEngine* engine;
|
GameWorld* engine;
|
||||||
|
|
||||||
Animator* animator; /// Object's animator.
|
Animator* animator; /// Object's animator.
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ struct GTAObject
|
|||||||
*/
|
*/
|
||||||
float mHealth;
|
float mHealth;
|
||||||
|
|
||||||
GTAObject(GTAEngine* engine, const glm::vec3& pos, const glm::quat& rot, Model* model)
|
GTAObject(GameWorld* engine, const glm::vec3& pos, const glm::quat& rot, Model* model)
|
||||||
: position(pos), rotation(rot), model(model), engine(engine), animator(nullptr), mHealth(0.f) {}
|
: position(pos), rotation(rot), model(model), engine(engine), animator(nullptr), mHealth(0.f) {}
|
||||||
|
|
||||||
virtual ~GTAObject() {};
|
virtual ~GTAObject() {};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef _GTADATA_HPP_
|
#ifndef _GAMEDATA_HPP_
|
||||||
#define _GTADATA_HPP_
|
#define _GAMEDATA_HPP_
|
||||||
|
|
||||||
#include <engine/GTATypes.hpp>
|
#include <engine/GTATypes.hpp>
|
||||||
#include <loaders/LoaderIMG.hpp>
|
#include <loaders/LoaderIMG.hpp>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class GTAEngine;
|
class GameWorld;
|
||||||
class TextureAtlas;
|
class TextureAtlas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,7 +38,7 @@ struct TextureInfo
|
|||||||
/**
|
/**
|
||||||
* Handles loading and management of the Game's DAT
|
* Handles loading and management of the Game's DAT
|
||||||
*/
|
*/
|
||||||
class GTAData
|
class GameData
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -61,9 +61,9 @@ public:
|
|||||||
* ctor
|
* ctor
|
||||||
* @param path Path to the root of the game data.
|
* @param path Path to the root of the game data.
|
||||||
*/
|
*/
|
||||||
GTAData(const std::string& path);
|
GameData(const std::string& path);
|
||||||
|
|
||||||
GTAEngine* engine;
|
GameWorld* engine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current platform
|
* Returns the current platform
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef _GTAENGINE_HPP_
|
#ifndef _GAMEWORLD_HPP_
|
||||||
#define _GTAENGINE_HPP_
|
#define _GAMEWORLD_HPP_
|
||||||
|
|
||||||
#include <engine/GTAData.hpp>
|
#include <engine/GameData.hpp>
|
||||||
#include <render/GTARenderer.hpp>
|
#include <render/GTARenderer.hpp>
|
||||||
#include <loaders/LoaderIPL.hpp>
|
#include <loaders/LoaderIPL.hpp>
|
||||||
#include <ai/GTAAINode.hpp>
|
#include <ai/GTAAINode.hpp>
|
||||||
@ -26,11 +26,11 @@ class GTAVehicle;
|
|||||||
* @class GTAEngine
|
* @class GTAEngine
|
||||||
* Provides a simple interface to the framework's internals
|
* Provides a simple interface to the framework's internals
|
||||||
*/
|
*/
|
||||||
class GTAEngine
|
class GameWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GTAEngine(const std::string& gamepath);
|
GameWorld(const std::string& gamepath);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the game data
|
* Loads the game data
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Game data
|
* Game data
|
||||||
*/
|
*/
|
||||||
GTAData gameData;
|
GameData gameData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renderer
|
* Renderer
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
|
|
||||||
class GTAData;
|
class GameData;
|
||||||
|
|
||||||
class LoaderDFF
|
class LoaderDFF
|
||||||
{
|
{
|
||||||
@ -22,7 +22,7 @@ private:
|
|||||||
RW::BSSectionHeader readHeader(char *data, size_t &dataI);
|
RW::BSSectionHeader readHeader(char *data, size_t &dataI);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Model* loadFromMemory(char *data, GTAData* gameData);
|
Model* loadFromMemory(char *data, GameData* gameData);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class GTAData;
|
class GameData;
|
||||||
|
|
||||||
class TextureLoader
|
class TextureLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool loadFromFile(std::string filename, GTAData* gameData);
|
bool loadFromFile(std::string filename, GameData* gameData);
|
||||||
bool loadFromMemory(char *data, GTAData* gameData);
|
bool loadFromMemory(char *data, GameData* gameData);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
class GTAVehicle;
|
class GTAVehicle;
|
||||||
|
class GameWorld;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The GTACharacter struct
|
* @brief The GTACharacter struct
|
||||||
@ -51,7 +52,7 @@ public:
|
|||||||
* @param model
|
* @param model
|
||||||
* @param ped PEDS_t struct to use.
|
* @param ped PEDS_t struct to use.
|
||||||
*/
|
*/
|
||||||
GTACharacter(GTAEngine* engine, const glm::vec3& pos, const glm::quat& rot, Model* model, std::shared_ptr<CharacterData> data);
|
GTACharacter(GameWorld* engine, const glm::vec3& pos, const glm::quat& rot, Model* model, std::shared_ptr<CharacterData> data);
|
||||||
|
|
||||||
~GTACharacter();
|
~GTACharacter();
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ struct GTAInstance : public GTAObject
|
|||||||
std::shared_ptr<GTAInstance> LODinstance;
|
std::shared_ptr<GTAInstance> LODinstance;
|
||||||
|
|
||||||
GTAInstance(
|
GTAInstance(
|
||||||
GTAEngine* engine,
|
GameWorld* engine,
|
||||||
const glm::vec3& pos,
|
const glm::vec3& pos,
|
||||||
const glm::quat& rot,
|
const glm::quat& rot,
|
||||||
Model* model,
|
Model* model,
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
btVehicleRaycaster* physRaycaster;
|
btVehicleRaycaster* physRaycaster;
|
||||||
btRaycastVehicle* physVehicle;
|
btRaycastVehicle* physVehicle;
|
||||||
|
|
||||||
GTAVehicle(GTAEngine* engine,
|
GTAVehicle(GameWorld* engine,
|
||||||
const glm::vec3& pos,
|
const glm::vec3& pos,
|
||||||
const glm::quat& rot,
|
const glm::quat& rot,
|
||||||
Model* model,
|
Model* model,
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
#include <render/ViewCamera.hpp>
|
#include <render/ViewCamera.hpp>
|
||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
class GTAEngine;
|
class GameWorld;
|
||||||
class GTAObject;
|
class GTAObject;
|
||||||
class Animator;
|
class Animator;
|
||||||
|
|
||||||
class GTARenderer
|
class GTARenderer
|
||||||
{
|
{
|
||||||
GTAEngine* engine;
|
GameWorld* engine;
|
||||||
|
|
||||||
struct RQueueEntry {
|
struct RQueueEntry {
|
||||||
Model* model;
|
Model* model;
|
||||||
@ -35,7 +35,7 @@ class GTARenderer
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GTARenderer(GTAEngine*);
|
GTARenderer(GameWorld*);
|
||||||
|
|
||||||
ViewCamera camera;
|
ViewCamera camera;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "ai/GTADefaultAIController.hpp"
|
#include "ai/GTADefaultAIController.hpp"
|
||||||
#include <objects/GTACharacter.hpp>
|
#include <objects/GTACharacter.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <objects/GTAVehicle.hpp>
|
#include <objects/GTAVehicle.hpp>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "ai/GTAPlayerAIController.hpp"
|
#include "ai/GTAPlayerAIController.hpp"
|
||||||
#include <objects/GTACharacter.hpp>
|
#include <objects/GTACharacter.hpp>
|
||||||
#include <objects/GTAVehicle.hpp>
|
#include <objects/GTAVehicle.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
GTAPlayerAIController::GTAPlayerAIController(GTACharacter* character)
|
GTAPlayerAIController::GTAPlayerAIController(GTACharacter* character)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <engine/GTAObject.hpp>
|
#include <engine/GTAObject.hpp>
|
||||||
#include <loaders/LoaderIFP.hpp>
|
#include <loaders/LoaderIFP.hpp>
|
||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
|
||||||
|
|
||||||
void GTAObject::setPosition(const glm::vec3& pos)
|
void GTAObject::setPosition(const glm::vec3& pos)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <engine/GTAData.hpp>
|
#include <engine/GameData.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <loaders/LoaderIPL.hpp>
|
#include <loaders/LoaderIPL.hpp>
|
||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <loaders/LoaderIDE.hpp>
|
#include <loaders/LoaderIDE.hpp>
|
||||||
@ -70,13 +70,13 @@ std::string fixPath(std::string path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GTAData::GTAData(const std::string& path)
|
GameData::GameData(const std::string& path)
|
||||||
: datpath(path), engine(nullptr)
|
: datpath(path), engine(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::load()
|
void GameData::load()
|
||||||
{
|
{
|
||||||
parseDAT(datpath+"/data/default.dat");
|
parseDAT(datpath+"/data/default.dat");
|
||||||
parseDAT(datpath+"/data/gta3.dat");
|
parseDAT(datpath+"/data/gta3.dat");
|
||||||
@ -96,7 +96,7 @@ void GTAData::load()
|
|||||||
loadIFP(datpath+"/anim/ped.ifp");
|
loadIFP(datpath+"/anim/ped.ifp");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::parseDAT(const std::string& path)
|
void GameData::parseDAT(const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream datfile(path.c_str());
|
std::ifstream datfile(path.c_str());
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ void GTAData::parseDAT(const std::string& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadIDE(const std::string& name)
|
void GameData::loadIDE(const std::string& name)
|
||||||
{
|
{
|
||||||
std::string lowername = name;
|
std::string lowername = name;
|
||||||
for(size_t t = 0; t < lowername.size(); ++t)
|
for(size_t t = 0; t < lowername.size(); ++t)
|
||||||
@ -167,7 +167,7 @@ void GTAData::loadIDE(const std::string& name)
|
|||||||
ideLocations.insert({lowername, datpath+"/"+lowername});
|
ideLocations.insert({lowername, datpath+"/"+lowername});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadCOL(const size_t zone, const std::string& name)
|
void GameData::loadCOL(const size_t zone, const std::string& name)
|
||||||
{
|
{
|
||||||
LoaderCOL col;
|
LoaderCOL col;
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ void GTAData::loadCOL(const size_t zone, const std::string& name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadIMG(const std::string& name)
|
void GameData::loadIMG(const std::string& name)
|
||||||
{
|
{
|
||||||
LoaderIMG imgLoader;
|
LoaderIMG imgLoader;
|
||||||
std::string archivePath = datpath + name;
|
std::string archivePath = datpath + name;
|
||||||
@ -211,7 +211,7 @@ void GTAData::loadIMG(const std::string& name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadIPL(const std::string& name)
|
void GameData::loadIPL(const std::string& name)
|
||||||
{
|
{
|
||||||
iplLocations.insert({name, name});
|
iplLocations.insert({name, name});
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ enum ColSection {
|
|||||||
CAR4 ///> Used in GTASA, contains quadruple colors
|
CAR4 ///> Used in GTASA, contains quadruple colors
|
||||||
};
|
};
|
||||||
|
|
||||||
void GTAData::loadCarcols(const std::string& path)
|
void GameData::loadCarcols(const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream fstream(path.c_str());
|
std::ifstream fstream(path.c_str());
|
||||||
|
|
||||||
@ -275,12 +275,12 @@ void GTAData::loadCarcols(const std::string& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadWeather(const std::string &path)
|
void GameData::loadWeather(const std::string &path)
|
||||||
{
|
{
|
||||||
weatherLoader.load(path);
|
weatherLoader.load(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadHandling(const std::string& path)
|
void GameData::loadHandling(const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream hndFile(path.c_str());
|
std::ifstream hndFile(path.c_str());
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ void GTAData::loadHandling(const std::string& path)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadWaterpro(const std::string& path)
|
void GameData::loadWaterpro(const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream ifstr(path.c_str());
|
std::ifstream ifstr(path.c_str());
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ void GTAData::loadWaterpro(const std::string& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadWater(const std::string& path)
|
void GameData::loadWater(const std::string& path)
|
||||||
{
|
{
|
||||||
std::ifstream ifstr(path.c_str());
|
std::ifstream ifstr(path.c_str());
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ void GTAData::loadWater(const std::string& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadTXD(const std::string& name)
|
void GameData::loadTXD(const std::string& name)
|
||||||
{
|
{
|
||||||
if( loadedFiles.find(name) != loadedFiles.end()) {
|
if( loadedFiles.find(name) != loadedFiles.end()) {
|
||||||
return;
|
return;
|
||||||
@ -393,7 +393,7 @@ void GTAData::loadTXD(const std::string& name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadDFF(const std::string& name)
|
void GameData::loadDFF(const std::string& name)
|
||||||
{
|
{
|
||||||
if( loadedFiles.find(name) != loadedFiles.end()) {
|
if( loadedFiles.find(name) != loadedFiles.end()) {
|
||||||
return;
|
return;
|
||||||
@ -408,7 +408,7 @@ void GTAData::loadDFF(const std::string& name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAData::loadIFP(const std::string &name)
|
void GameData::loadIFP(const std::string &name)
|
||||||
{
|
{
|
||||||
std::ifstream dfile(name.c_str());
|
std::ifstream dfile(name.c_str());
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ void GTAData::loadIFP(const std::string &name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* GTAData::loadFile(const std::string& name)
|
char* GameData::loadFile(const std::string& name)
|
||||||
{
|
{
|
||||||
if( loadedFiles.find(name) != loadedFiles.end()) {
|
if( loadedFiles.find(name) != loadedFiles.end()) {
|
||||||
std::cerr << "File " << name << " already loaded!" << std::endl;
|
std::cerr << "File " << name << " already loaded!" << std::endl;
|
||||||
@ -483,7 +483,7 @@ char* GTAData::loadFile(const std::string& name)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureAtlas* GTAData::getAtlas(size_t i)
|
TextureAtlas* GameData::getAtlas(size_t i)
|
||||||
{
|
{
|
||||||
if( i < atlases.size() ) {
|
if( i < atlases.size() ) {
|
||||||
return atlases[i];
|
return atlases[i];
|
@ -1,4 +1,4 @@
|
|||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <loaders/LoaderIPL.hpp>
|
#include <loaders/LoaderIPL.hpp>
|
||||||
#include <loaders/LoaderIDE.hpp>
|
#include <loaders/LoaderIDE.hpp>
|
||||||
#include <ai/GTADefaultAIController.hpp>
|
#include <ai/GTADefaultAIController.hpp>
|
||||||
@ -10,13 +10,13 @@
|
|||||||
#include <objects/GTAInstance.hpp>
|
#include <objects/GTAInstance.hpp>
|
||||||
#include <objects/GTAVehicle.hpp>
|
#include <objects/GTAVehicle.hpp>
|
||||||
|
|
||||||
GTAEngine::GTAEngine(const std::string& path)
|
GameWorld::GameWorld(const std::string& path)
|
||||||
: gameTime(0.f), gameData(path), renderer(this), randomEngine(rand())
|
: gameTime(0.f), gameData(path), renderer(this), randomEngine(rand())
|
||||||
{
|
{
|
||||||
gameData.engine = this;
|
gameData.engine = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GTAEngine::load()
|
bool GameWorld::load()
|
||||||
{
|
{
|
||||||
collisionConfig = new btDefaultCollisionConfiguration;
|
collisionConfig = new btDefaultCollisionConfiguration;
|
||||||
collisionDispatcher = new btCollisionDispatcher(collisionConfig);
|
collisionDispatcher = new btCollisionDispatcher(collisionConfig);
|
||||||
@ -31,22 +31,22 @@ bool GTAEngine::load()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAEngine::logInfo(const std::string& info)
|
void GameWorld::logInfo(const std::string& info)
|
||||||
{
|
{
|
||||||
log.push_back({LogEntry::Info, gameTime, info});
|
log.push_back({LogEntry::Info, gameTime, info});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAEngine::logError(const std::string& error)
|
void GameWorld::logError(const std::string& error)
|
||||||
{
|
{
|
||||||
log.push_back({LogEntry::Error, gameTime, error});
|
log.push_back({LogEntry::Error, gameTime, error});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAEngine::logWarning(const std::string& warning)
|
void GameWorld::logWarning(const std::string& warning)
|
||||||
{
|
{
|
||||||
log.push_back({LogEntry::Warning, gameTime, warning});
|
log.push_back({LogEntry::Warning, gameTime, warning});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GTAEngine::defineItems(const std::string& name)
|
bool GameWorld::defineItems(const std::string& name)
|
||||||
{
|
{
|
||||||
auto i = gameData.ideLocations.find(name);
|
auto i = gameData.ideLocations.find(name);
|
||||||
std::string path = name;
|
std::string path = name;
|
||||||
@ -103,7 +103,7 @@ bool GTAEngine::defineItems(const std::string& name)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GTAEngine::placeItems(const std::string& name)
|
bool GameWorld::placeItems(const std::string& name)
|
||||||
{
|
{
|
||||||
auto i = gameData.iplLocations.find(name);
|
auto i = gameData.iplLocations.find(name);
|
||||||
std::string path = name;
|
std::string path = name;
|
||||||
@ -150,7 +150,7 @@ bool GTAEngine::placeItems(const std::string& name)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GTAEngine::loadZone(const std::string& path)
|
bool GameWorld::loadZone(const std::string& path)
|
||||||
{
|
{
|
||||||
LoaderIPL ipll;
|
LoaderIPL ipll;
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ bool GTAEngine::loadZone(const std::string& path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GTAInstance *GTAEngine::createInstance(const uint16_t id, const glm::vec3& pos, const glm::quat& rot)
|
GTAInstance *GameWorld::createInstance(const uint16_t id, const glm::vec3& pos, const glm::quat& rot)
|
||||||
{
|
{
|
||||||
auto oi = objectTypes.find(id);
|
auto oi = objectTypes.find(id);
|
||||||
if( oi != objectTypes.end()) {
|
if( oi != objectTypes.end()) {
|
||||||
@ -204,7 +204,7 @@ GTAInstance *GTAEngine::createInstance(const uint16_t id, const glm::vec3& pos,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GTAVehicle *GTAEngine::createVehicle(const uint16_t id, const glm::vec3& pos, const glm::quat& rot)
|
GTAVehicle *GameWorld::createVehicle(const uint16_t id, const glm::vec3& pos, const glm::quat& rot)
|
||||||
{
|
{
|
||||||
auto vti = vehicleTypes.find(id);
|
auto vti = vehicleTypes.find(id);
|
||||||
if(vti != vehicleTypes.end()) {
|
if(vti != vehicleTypes.end()) {
|
||||||
@ -266,7 +266,7 @@ GTAVehicle *GTAEngine::createVehicle(const uint16_t id, const glm::vec3& pos, co
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GTACharacter* GTAEngine::createPedestrian(const uint16_t id, const glm::vec3 &pos, const glm::quat& rot)
|
GTACharacter* GameWorld::createPedestrian(const uint16_t id, const glm::vec3 &pos, const glm::quat& rot)
|
||||||
{
|
{
|
||||||
auto pti = pedestrianTypes.find(id);
|
auto pti = pedestrianTypes.find(id);
|
||||||
if( pti != pedestrianTypes.end() ) {
|
if( pti != pedestrianTypes.end() ) {
|
||||||
@ -294,7 +294,7 @@ GTACharacter* GTAEngine::createPedestrian(const uint16_t id, const glm::vec3 &po
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GTAEngine::destroyObject(GTAObject* object)
|
void GameWorld::destroyObject(GTAObject* object)
|
||||||
{
|
{
|
||||||
if(object->type() == GTAObject::Character)
|
if(object->type() == GTAObject::Character)
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <engine/GTAData.hpp>
|
#include <engine/GameData.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <render/Model.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
Model* LoaderDFF::loadFromMemory(char *data, GTAData *gameData)
|
Model* LoaderDFF::loadFromMemory(char *data, GameData *gameData)
|
||||||
{
|
{
|
||||||
auto model = new Model;
|
auto model = new Model;
|
||||||
RW::BinaryStreamSection root(data);
|
RW::BinaryStreamSection root(data);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include <loaders/TextureLoader.hpp>
|
#include <loaders/TextureLoader.hpp>
|
||||||
#include <engine/GTAData.hpp>
|
#include <engine/GameData.hpp>
|
||||||
#include <render/TextureAtlas.hpp>
|
#include <render/TextureAtlas.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
bool TextureLoader::loadFromFile(std::string filename, GTAData* gameData)
|
bool TextureLoader::loadFromFile(std::string filename, GameData* gameData)
|
||||||
{
|
{
|
||||||
std::ifstream dfile(filename);
|
std::ifstream dfile(filename);
|
||||||
if ( ! dfile.is_open()) {
|
if ( ! dfile.is_open()) {
|
||||||
@ -194,7 +194,7 @@ GLuint createTexture(RW::BSTextureNative& texNative, RW::BinaryStreamSection& ro
|
|||||||
return textureName;
|
return textureName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureLoader::loadFromMemory(char *data, GTAData *gameData)
|
bool TextureLoader::loadFromMemory(char *data, GameData *gameData)
|
||||||
{
|
{
|
||||||
RW::BinaryStreamSection root(data);
|
RW::BinaryStreamSection root(data);
|
||||||
/*auto texDict =*/ root.readStructure<RW::BSTextureDictionary>();
|
/*auto texDict =*/ root.readStructure<RW::BSTextureDictionary>();
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include <objects/GTACharacter.hpp>
|
#include <objects/GTACharacter.hpp>
|
||||||
#include <ai/GTAAIController.hpp>
|
#include <ai/GTAAIController.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <objects/GTAVehicle.hpp>
|
#include <objects/GTAVehicle.hpp>
|
||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
|
|
||||||
GTACharacter::GTACharacter(GTAEngine* engine, const glm::vec3& pos, const glm::quat& rot, Model* model, std::shared_ptr<CharacterData> data)
|
GTACharacter::GTACharacter(GameWorld* engine, const glm::vec3& pos, const glm::quat& rot, Model* model, std::shared_ptr<CharacterData> data)
|
||||||
: GTAObject(engine, pos, rot, model),
|
: GTAObject(engine, pos, rot, model),
|
||||||
currentVehicle(nullptr), currentSeat(0), ped(data), physCharacter(nullptr),
|
currentVehicle(nullptr), currentSeat(0), ped(data), physCharacter(nullptr),
|
||||||
controller(nullptr), currentActivity(None)
|
controller(nullptr), currentActivity(None)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <objects/GTAInstance.hpp>
|
#include <objects/GTAInstance.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <data/CollisionModel.hpp>
|
#include <data/CollisionModel.hpp>
|
||||||
|
|
||||||
GTAInstance::GTAInstance(
|
GTAInstance::GTAInstance(
|
||||||
GTAEngine* engine,
|
GameWorld* engine,
|
||||||
const glm::vec3& pos,
|
const glm::vec3& pos,
|
||||||
const glm::quat& rot,
|
const glm::quat& rot,
|
||||||
Model* model,
|
Model* model,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include <objects/GTAVehicle.hpp>
|
#include <objects/GTAVehicle.hpp>
|
||||||
#include <objects/GTACharacter.hpp>
|
#include <objects/GTACharacter.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <BulletDynamics/Vehicle/btRaycastVehicle.h>
|
#include <BulletDynamics/Vehicle/btRaycastVehicle.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <data/CollisionModel.hpp>
|
#include <data/CollisionModel.hpp>
|
||||||
|
|
||||||
GTAVehicle::GTAVehicle(GTAEngine* engine, const glm::vec3& pos, const glm::quat& rot, Model* model, std::shared_ptr<CarData> data, const VehicleInfo& info, const glm::vec3& prim, const glm::vec3& sec)
|
GTAVehicle::GTAVehicle(GameWorld* engine, const glm::vec3& pos, const glm::quat& rot, Model* model, std::shared_ptr<CarData> data, const VehicleInfo& info, const glm::vec3& prim, const glm::vec3& sec)
|
||||||
: GTAObject(engine, pos, rot, model),
|
: GTAObject(engine, pos, rot, model),
|
||||||
steerAngle(0.f), throttle(0.f), brake(0.f), handbrake(false),
|
steerAngle(0.f), throttle(0.f), brake(0.f), handbrake(false),
|
||||||
vehicle(data), info(info), colourPrimary(prim), colourSecondary(sec),
|
vehicle(data), info(info), colourPrimary(prim), colourSecondary(sec),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <render/GTARenderer.hpp>
|
#include <render/GTARenderer.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <engine/Animator.hpp>
|
#include <engine/Animator.hpp>
|
||||||
#include <render/TextureAtlas.hpp>
|
#include <render/TextureAtlas.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <render/Model.hpp>
|
||||||
@ -125,7 +125,7 @@ GLuint compileShader(GLenum type, const char *source)
|
|||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
GTARenderer::GTARenderer(GTAEngine* engine)
|
GTARenderer::GTARenderer(GameWorld* engine)
|
||||||
: engine(engine)
|
: engine(engine)
|
||||||
{
|
{
|
||||||
GLuint vertexShader = compileShader(GL_VERTEX_SHADER, vertexShaderSource);
|
GLuint vertexShader = compileShader(GL_VERTEX_SHADER, vertexShaderSource);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <render/DebugDraw.hpp>
|
#include <render/DebugDraw.hpp>
|
||||||
#include <ai/GTAAIController.hpp>
|
#include <ai/GTAAIController.hpp>
|
||||||
@ -26,7 +26,7 @@ constexpr double PiOver180 = 3.1415926535897932384626433832795028/180;
|
|||||||
|
|
||||||
sf::RenderWindow window;
|
sf::RenderWindow window;
|
||||||
|
|
||||||
GTAEngine* gta = nullptr;
|
GameWorld* gta = nullptr;
|
||||||
|
|
||||||
GTAPlayerAIController* player = nullptr;
|
GTAPlayerAIController* player = nullptr;
|
||||||
GTACharacter* playerCharacter = nullptr;
|
GTACharacter* playerCharacter = nullptr;
|
||||||
@ -84,7 +84,7 @@ void handleEvent(sf::Event &event)
|
|||||||
void init(std::string gtapath)
|
void init(std::string gtapath)
|
||||||
{
|
{
|
||||||
// GTA GET
|
// GTA GET
|
||||||
gta = new GTAEngine(gtapath);
|
gta = new GameWorld(gtapath);
|
||||||
|
|
||||||
// This is harcoded in GTA III for some reason
|
// This is harcoded in GTA III for some reason
|
||||||
gta->gameData.loadIMG("/models/gta3");
|
gta->gameData.loadIMG("/models/gta3");
|
||||||
@ -267,10 +267,10 @@ void render()
|
|||||||
for(auto it = gta->log.begin(); it != gta->log.end(); ++it) {
|
for(auto it = gta->log.begin(); it != gta->log.end(); ++it) {
|
||||||
text.setString(it->message);
|
text.setString(it->message);
|
||||||
switch(it->type) {
|
switch(it->type) {
|
||||||
case GTAEngine::LogEntry::Error:
|
case GameWorld::LogEntry::Error:
|
||||||
text.setColor(sf::Color::Red);
|
text.setColor(sf::Color::Red);
|
||||||
break;
|
break;
|
||||||
case GTAEngine::LogEntry::Warning:
|
case GameWorld::LogEntry::Warning:
|
||||||
text.setColor(sf::Color::Yellow);
|
text.setColor(sf::Color::Yellow);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define _TESTGLOBABLS_HPP_
|
#define _TESTGLOBABLS_HPP_
|
||||||
|
|
||||||
#include <SFML/Window.hpp>
|
#include <SFML/Window.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
|
|
||||||
// Many tests require OpenGL be functional, seems like a reasonable solution.
|
// Many tests require OpenGL be functional, seems like a reasonable solution.
|
||||||
|
|
||||||
@ -10,13 +10,13 @@ class Global
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
sf::Window wnd;
|
sf::Window wnd;
|
||||||
GTAEngine* e;
|
GameWorld* e;
|
||||||
|
|
||||||
Global() {
|
Global() {
|
||||||
wnd.create(sf::VideoMode(640, 360), "Testing");
|
wnd.create(sf::VideoMode(640, 360), "Testing");
|
||||||
glewExperimental = GL_TRUE;
|
glewExperimental = GL_TRUE;
|
||||||
glewInit();
|
glewInit();
|
||||||
e = new GTAEngine("data");
|
e = new GameWorld("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
~Global() {
|
~Global() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include "test_globals.hpp"
|
#include "test_globals.hpp"
|
||||||
#include <objects/GTAInstance.hpp>
|
#include <objects/GTAInstance.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(ObjectUnitTests)
|
BOOST_AUTO_TEST_SUITE(ObjectUnitTests)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(WorldTests)
|
BOOST_AUTO_TEST_SUITE(WorldTests)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
#include <engine/GTAEngine.hpp>
|
#include <engine/GameWorld.hpp>
|
||||||
#include <loaders/LoaderDFF.hpp>
|
#include <loaders/LoaderDFF.hpp>
|
||||||
#include <render/DebugDraw.hpp>
|
#include <render/DebugDraw.hpp>
|
||||||
#include <render/Model.hpp>
|
#include <render/Model.hpp>
|
||||||
@ -28,7 +28,7 @@ constexpr double PiOver180 = 3.1415926535897932384626433832795028/180;
|
|||||||
|
|
||||||
sf::RenderWindow window;
|
sf::RenderWindow window;
|
||||||
|
|
||||||
GTAEngine* gta = nullptr;
|
GameWorld* gta = nullptr;
|
||||||
|
|
||||||
GTAPlayerAIController* player = nullptr;
|
GTAPlayerAIController* player = nullptr;
|
||||||
GTACharacter* playerCharacter = nullptr;
|
GTACharacter* playerCharacter = nullptr;
|
||||||
@ -384,7 +384,7 @@ void handleCommandEvent(sf::Event &event)
|
|||||||
void init(std::string gtapath, bool loadWorld)
|
void init(std::string gtapath, bool loadWorld)
|
||||||
{
|
{
|
||||||
// GTA GET
|
// GTA GET
|
||||||
gta = new GTAEngine(gtapath);
|
gta = new GameWorld(gtapath);
|
||||||
|
|
||||||
// This is harcoded in GTA III for some reason
|
// This is harcoded in GTA III for some reason
|
||||||
gta->gameData.loadIMG("/models/gta3");
|
gta->gameData.loadIMG("/models/gta3");
|
||||||
@ -596,10 +596,10 @@ void render()
|
|||||||
for(auto it = gta->log.begin(); it != gta->log.end(); ++it) {
|
for(auto it = gta->log.begin(); it != gta->log.end(); ++it) {
|
||||||
text.setString(it->message);
|
text.setString(it->message);
|
||||||
switch(it->type) {
|
switch(it->type) {
|
||||||
case GTAEngine::LogEntry::Error:
|
case GameWorld::LogEntry::Error:
|
||||||
text.setColor(sf::Color::Red);
|
text.setColor(sf::Color::Red);
|
||||||
break;
|
break;
|
||||||
case GTAEngine::LogEntry::Warning:
|
case GameWorld::LogEntry::Warning:
|
||||||
text.setColor(sf::Color::Yellow);
|
text.setColor(sf::Color::Yellow);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user