1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-03 09:09:47 +02:00

Renamed some objects to Game*

This commit is contained in:
Daniel Evans 2013-12-20 16:02:46 +00:00
parent 45d0c5b77c
commit dc32c9c6ce
25 changed files with 89 additions and 89 deletions

View File

@ -12,7 +12,7 @@ class GTAAIController;
class Model;
class Animator;
class GTAEngine;
class GameWorld;
/**
* @brief The GTAObject struct
@ -25,7 +25,7 @@ struct GTAObject
Model* model; /// Cached pointer to Object's Model.
GTAEngine* engine;
GameWorld* engine;
Animator* animator; /// Object's animator.
@ -34,7 +34,7 @@ struct GTAObject
*/
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) {}
virtual ~GTAObject() {};

View File

@ -1,6 +1,6 @@
#pragma once
#ifndef _GTADATA_HPP_
#define _GTADATA_HPP_
#ifndef _GAMEDATA_HPP_
#define _GAMEDATA_HPP_
#include <engine/GTATypes.hpp>
#include <loaders/LoaderIMG.hpp>
@ -14,7 +14,7 @@
#include <memory>
class GTAEngine;
class GameWorld;
class TextureAtlas;
/**
@ -38,7 +38,7 @@ struct TextureInfo
/**
* Handles loading and management of the Game's DAT
*/
class GTAData
class GameData
{
private:
@ -61,9 +61,9 @@ public:
* ctor
* @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

View File

@ -1,8 +1,8 @@
#pragma once
#ifndef _GTAENGINE_HPP_
#define _GTAENGINE_HPP_
#ifndef _GAMEWORLD_HPP_
#define _GAMEWORLD_HPP_
#include <engine/GTAData.hpp>
#include <engine/GameData.hpp>
#include <render/GTARenderer.hpp>
#include <loaders/LoaderIPL.hpp>
#include <ai/GTAAINode.hpp>
@ -26,11 +26,11 @@ class GTAVehicle;
* @class GTAEngine
* Provides a simple interface to the framework's internals
*/
class GTAEngine
class GameWorld
{
public:
GTAEngine(const std::string& gamepath);
GameWorld(const std::string& gamepath);
/**
* Loads the game data
@ -111,7 +111,7 @@ public:
/**
* Game data
*/
GTAData gameData;
GameData gameData;
/**
* Renderer

View File

@ -13,7 +13,7 @@
class Model;
class GTAData;
class GameData;
class LoaderDFF
{
@ -22,7 +22,7 @@ private:
RW::BSSectionHeader readHeader(char *data, size_t &dataI);
public:
Model* loadFromMemory(char *data, GTAData* gameData);
Model* loadFromMemory(char *data, GameData* gameData);
};
#endif

View File

@ -10,13 +10,13 @@
#include <string>
#include <map>
class GTAData;
class GameData;
class TextureLoader
{
public:
bool loadFromFile(std::string filename, GTAData* gameData);
bool loadFromMemory(char *data, GTAData* gameData);
bool loadFromFile(std::string filename, GameData* gameData);
bool loadFromMemory(char *data, GameData* gameData);
};
#endif

View File

@ -8,6 +8,7 @@
#include <glm/glm.hpp>
class GTAVehicle;
class GameWorld;
/**
* @brief The GTACharacter struct
@ -51,7 +52,7 @@ public:
* @param model
* @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();

View File

@ -14,7 +14,7 @@ struct GTAInstance : public GTAObject
std::shared_ptr<GTAInstance> LODinstance;
GTAInstance(
GTAEngine* engine,
GameWorld* engine,
const glm::vec3& pos,
const glm::quat& rot,
Model* model,

View File

@ -30,7 +30,7 @@ public:
btVehicleRaycaster* physRaycaster;
btRaycastVehicle* physVehicle;
GTAVehicle(GTAEngine* engine,
GTAVehicle(GameWorld* engine,
const glm::vec3& pos,
const glm::quat& rot,
Model* model,

View File

@ -9,13 +9,13 @@
#include <render/ViewCamera.hpp>
class Model;
class GTAEngine;
class GameWorld;
class GTAObject;
class Animator;
class GTARenderer
{
GTAEngine* engine;
GameWorld* engine;
struct RQueueEntry {
Model* model;
@ -35,7 +35,7 @@ class GTARenderer
public:
GTARenderer(GTAEngine*);
GTARenderer(GameWorld*);
ViewCamera camera;

View File

@ -1,6 +1,6 @@
#include "ai/GTADefaultAIController.hpp"
#include <objects/GTACharacter.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <engine/Animator.hpp>
#include <objects/GTAVehicle.hpp>

View File

@ -1,7 +1,7 @@
#include "ai/GTAPlayerAIController.hpp"
#include <objects/GTACharacter.hpp>
#include <objects/GTAVehicle.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <glm/gtc/matrix_transform.hpp>
GTAPlayerAIController::GTAPlayerAIController(GTACharacter* character)

View File

@ -1,7 +1,6 @@
#include <engine/GTAObject.hpp>
#include <loaders/LoaderIFP.hpp>
#include <loaders/LoaderDFF.hpp>
#include <engine/GTAEngine.hpp>
void GTAObject::setPosition(const glm::vec3& pos)
{

View File

@ -1,5 +1,5 @@
#include <engine/GTAData.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameData.hpp>
#include <engine/GameWorld.hpp>
#include <loaders/LoaderIPL.hpp>
#include <loaders/LoaderDFF.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)
{
}
void GTAData::load()
void GameData::load()
{
parseDAT(datpath+"/data/default.dat");
parseDAT(datpath+"/data/gta3.dat");
@ -96,7 +96,7 @@ void GTAData::load()
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());
@ -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;
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});
}
void GTAData::loadCOL(const size_t zone, const std::string& name)
void GameData::loadCOL(const size_t zone, const std::string& name)
{
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;
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});
}
@ -224,7 +224,7 @@ enum ColSection {
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());
@ -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);
}
void GTAData::loadHandling(const std::string& path)
void GameData::loadHandling(const std::string& path)
{
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());
@ -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());
@ -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()) {
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()) {
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());
@ -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()) {
std::cerr << "File " << name << " already loaded!" << std::endl;
@ -483,7 +483,7 @@ char* GTAData::loadFile(const std::string& name)
return nullptr;
}
TextureAtlas* GTAData::getAtlas(size_t i)
TextureAtlas* GameData::getAtlas(size_t i)
{
if( i < atlases.size() ) {
return atlases[i];

View File

@ -1,4 +1,4 @@
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <loaders/LoaderIPL.hpp>
#include <loaders/LoaderIDE.hpp>
#include <ai/GTADefaultAIController.hpp>
@ -10,13 +10,13 @@
#include <objects/GTAInstance.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())
{
gameData.engine = this;
}
bool GTAEngine::load()
bool GameWorld::load()
{
collisionConfig = new btDefaultCollisionConfiguration;
collisionDispatcher = new btCollisionDispatcher(collisionConfig);
@ -31,22 +31,22 @@ bool GTAEngine::load()
return true;
}
void GTAEngine::logInfo(const std::string& info)
void GameWorld::logInfo(const std::string& 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});
}
void GTAEngine::logWarning(const std::string& warning)
void GameWorld::logWarning(const std::string& 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);
std::string path = name;
@ -103,7 +103,7 @@ bool GTAEngine::defineItems(const std::string& name)
return false;
}
bool GTAEngine::placeItems(const std::string& name)
bool GameWorld::placeItems(const std::string& name)
{
auto i = gameData.iplLocations.find(name);
std::string path = name;
@ -150,7 +150,7 @@ bool GTAEngine::placeItems(const std::string& name)
return false;
}
bool GTAEngine::loadZone(const std::string& path)
bool GameWorld::loadZone(const std::string& path)
{
LoaderIPL ipll;
@ -168,7 +168,7 @@ bool GTAEngine::loadZone(const std::string& path)
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);
if( oi != objectTypes.end()) {
@ -204,7 +204,7 @@ GTAInstance *GTAEngine::createInstance(const uint16_t id, const glm::vec3& pos,
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);
if(vti != vehicleTypes.end()) {
@ -266,7 +266,7 @@ GTAVehicle *GTAEngine::createVehicle(const uint16_t id, const glm::vec3& pos, co
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);
if( pti != pedestrianTypes.end() ) {
@ -294,7 +294,7 @@ GTACharacter* GTAEngine::createPedestrian(const uint16_t id, const glm::vec3 &po
return nullptr;
}
void GTAEngine::destroyObject(GTAObject* object)
void GameWorld::destroyObject(GTAObject* object)
{
if(object->type() == GTAObject::Character)
{

View File

@ -1,5 +1,5 @@
#include <loaders/LoaderDFF.hpp>
#include <engine/GTAData.hpp>
#include <engine/GameData.hpp>
#include <render/Model.hpp>
#include <iostream>
@ -9,7 +9,7 @@
#include <glm/gtc/matrix_transform.hpp>
Model* LoaderDFF::loadFromMemory(char *data, GTAData *gameData)
Model* LoaderDFF::loadFromMemory(char *data, GameData *gameData)
{
auto model = new Model;
RW::BinaryStreamSection root(data);

View File

@ -1,12 +1,12 @@
#include <loaders/TextureLoader.hpp>
#include <engine/GTAData.hpp>
#include <engine/GameData.hpp>
#include <render/TextureAtlas.hpp>
#include <fstream>
#include <iostream>
#include <algorithm>
bool TextureLoader::loadFromFile(std::string filename, GTAData* gameData)
bool TextureLoader::loadFromFile(std::string filename, GameData* gameData)
{
std::ifstream dfile(filename);
if ( ! dfile.is_open()) {
@ -194,7 +194,7 @@ GLuint createTexture(RW::BSTextureNative& texNative, RW::BinaryStreamSection& ro
return textureName;
}
bool TextureLoader::loadFromMemory(char *data, GTAData *gameData)
bool TextureLoader::loadFromMemory(char *data, GameData *gameData)
{
RW::BinaryStreamSection root(data);
/*auto texDict =*/ root.readStructure<RW::BSTextureDictionary>();

View File

@ -1,11 +1,11 @@
#include <objects/GTACharacter.hpp>
#include <ai/GTAAIController.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <engine/Animator.hpp>
#include <objects/GTAVehicle.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),
currentVehicle(nullptr), currentSeat(0), ped(data), physCharacter(nullptr),
controller(nullptr), currentActivity(None)

View File

@ -1,9 +1,9 @@
#include <objects/GTAInstance.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <data/CollisionModel.hpp>
GTAInstance::GTAInstance(
GTAEngine* engine,
GameWorld* engine,
const glm::vec3& pos,
const glm::quat& rot,
Model* model,

View File

@ -1,11 +1,11 @@
#include <objects/GTAVehicle.hpp>
#include <objects/GTACharacter.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <BulletDynamics/Vehicle/btRaycastVehicle.h>
#include <sys/stat.h>
#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),
steerAngle(0.f), throttle(0.f), brake(0.f), handbrake(false),
vehicle(data), info(info), colourPrimary(prim), colourSecondary(sec),

View File

@ -1,5 +1,5 @@
#include <render/GTARenderer.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <engine/Animator.hpp>
#include <render/TextureAtlas.hpp>
#include <render/Model.hpp>
@ -125,7 +125,7 @@ GLuint compileShader(GLenum type, const char *source)
return shader;
}
GTARenderer::GTARenderer(GTAEngine* engine)
GTARenderer::GTARenderer(GameWorld* engine)
: engine(engine)
{
GLuint vertexShader = compileShader(GL_VERTEX_SHADER, vertexShaderSource);

View File

@ -1,7 +1,7 @@
#define GLEW_STATIC
#include <GL/glew.h>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <loaders/LoaderDFF.hpp>
#include <render/DebugDraw.hpp>
#include <ai/GTAAIController.hpp>
@ -26,7 +26,7 @@ constexpr double PiOver180 = 3.1415926535897932384626433832795028/180;
sf::RenderWindow window;
GTAEngine* gta = nullptr;
GameWorld* gta = nullptr;
GTAPlayerAIController* player = nullptr;
GTACharacter* playerCharacter = nullptr;
@ -84,7 +84,7 @@ void handleEvent(sf::Event &event)
void init(std::string gtapath)
{
// GTA GET
gta = new GTAEngine(gtapath);
gta = new GameWorld(gtapath);
// This is harcoded in GTA III for some reason
gta->gameData.loadIMG("/models/gta3");
@ -267,10 +267,10 @@ void render()
for(auto it = gta->log.begin(); it != gta->log.end(); ++it) {
text.setString(it->message);
switch(it->type) {
case GTAEngine::LogEntry::Error:
case GameWorld::LogEntry::Error:
text.setColor(sf::Color::Red);
break;
case GTAEngine::LogEntry::Warning:
case GameWorld::LogEntry::Warning:
text.setColor(sf::Color::Yellow);
break;
default:

View File

@ -2,7 +2,7 @@
#define _TESTGLOBABLS_HPP_
#include <SFML/Window.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
// Many tests require OpenGL be functional, seems like a reasonable solution.
@ -10,13 +10,13 @@ class Global
{
public:
sf::Window wnd;
GTAEngine* e;
GameWorld* e;
Global() {
wnd.create(sf::VideoMode(640, 360), "Testing");
glewExperimental = GL_TRUE;
glewInit();
e = new GTAEngine("data");
e = new GameWorld("data");
}
~Global() {

View File

@ -1,7 +1,7 @@
#include <boost/test/unit_test.hpp>
#include "test_globals.hpp"
#include <objects/GTAInstance.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
BOOST_AUTO_TEST_SUITE(ObjectUnitTests)

View File

@ -1,5 +1,5 @@
#include <boost/test/unit_test.hpp>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
BOOST_AUTO_TEST_SUITE(WorldTests)

View File

@ -1,7 +1,7 @@
#define GLEW_STATIC
#include <GL/glew.h>
#include <engine/GTAEngine.hpp>
#include <engine/GameWorld.hpp>
#include <loaders/LoaderDFF.hpp>
#include <render/DebugDraw.hpp>
#include <render/Model.hpp>
@ -28,7 +28,7 @@ constexpr double PiOver180 = 3.1415926535897932384626433832795028/180;
sf::RenderWindow window;
GTAEngine* gta = nullptr;
GameWorld* gta = nullptr;
GTAPlayerAIController* player = nullptr;
GTACharacter* playerCharacter = nullptr;
@ -384,7 +384,7 @@ void handleCommandEvent(sf::Event &event)
void init(std::string gtapath, bool loadWorld)
{
// GTA GET
gta = new GTAEngine(gtapath);
gta = new GameWorld(gtapath);
// This is harcoded in GTA III for some reason
gta->gameData.loadIMG("/models/gta3");
@ -596,10 +596,10 @@ void render()
for(auto it = gta->log.begin(); it != gta->log.end(); ++it) {
text.setString(it->message);
switch(it->type) {
case GTAEngine::LogEntry::Error:
case GameWorld::LogEntry::Error:
text.setColor(sf::Color::Red);
break;
case GTAEngine::LogEntry::Warning:
case GameWorld::LogEntry::Warning:
text.setColor(sf::Color::Yellow);
break;
default: