mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
Merge pull request #523 from ShFil119/default_member_initializer
[Ready]Usage of default member initializer
This commit is contained in:
commit
9c22dbbc91
@ -23,16 +23,6 @@
|
||||
|
||||
constexpr float kCloseDoorIdleTime = 2.f;
|
||||
|
||||
CharacterController::CharacterController()
|
||||
: character(nullptr)
|
||||
, _currentActivity(nullptr)
|
||||
, _nextActivity(nullptr)
|
||||
, m_closeDoorTimer(0.f)
|
||||
, currentGoal(None)
|
||||
, leader(nullptr)
|
||||
, targetNode(nullptr) {
|
||||
}
|
||||
|
||||
bool CharacterController::updateActivity() {
|
||||
if (_currentActivity && character->isAlive()) {
|
||||
return _currentActivity->update(character, this);
|
||||
|
@ -58,23 +58,23 @@ protected:
|
||||
/**
|
||||
* The character being controlled.
|
||||
*/
|
||||
CharacterObject* character;
|
||||
CharacterObject* character = nullptr;
|
||||
|
||||
std::unique_ptr<Activity> _currentActivity;
|
||||
std::unique_ptr<Activity> _nextActivity;
|
||||
std::unique_ptr<Activity> _currentActivity = nullptr;
|
||||
std::unique_ptr<Activity> _nextActivity = nullptr;
|
||||
|
||||
bool updateActivity();
|
||||
void setActivity(std::unique_ptr<Activity> activity);
|
||||
|
||||
float m_closeDoorTimer;
|
||||
float m_closeDoorTimer{0.f};
|
||||
|
||||
// Goal related variables
|
||||
Goal currentGoal;
|
||||
CharacterObject* leader;
|
||||
AIGraphNode* targetNode;
|
||||
Goal currentGoal{None};
|
||||
CharacterObject* leader = nullptr;
|
||||
AIGraphNode* targetNode = nullptr;
|
||||
|
||||
public:
|
||||
CharacterController();
|
||||
CharacterController() = default;
|
||||
|
||||
virtual ~CharacterController() = default;
|
||||
|
||||
|
@ -13,15 +13,6 @@
|
||||
|
||||
class Animator;
|
||||
|
||||
PlayerController::PlayerController()
|
||||
: CharacterController()
|
||||
, lastRotation(glm::vec3(0.f, 0.f, 0.f))
|
||||
, missionRestartRequired(false)
|
||||
, _enabled(true)
|
||||
, restartState(Alive)
|
||||
, payphoneState(Left) {
|
||||
}
|
||||
|
||||
void PlayerController::setInputEnabled(bool enabled) {
|
||||
_enabled = enabled;
|
||||
}
|
||||
@ -365,4 +356,4 @@ void PlayerController::freeFromCutscene() {
|
||||
|
||||
// @todo: make player no longer invincible
|
||||
// ignored by police
|
||||
}
|
||||
}
|
||||
|
@ -11,28 +11,28 @@ private:
|
||||
|
||||
glm::vec3 direction{};
|
||||
|
||||
glm::quat lastRotation;
|
||||
glm::quat lastRotation = glm::vec3(0.f, 0.f, 0.f);
|
||||
|
||||
bool missionRestartRequired;
|
||||
bool missionRestartRequired = false;
|
||||
|
||||
bool adrenalineEffect;
|
||||
float adrenalineEffectTime;
|
||||
bool adrenalineEffect = false;
|
||||
float adrenalineEffectTime{0};
|
||||
|
||||
bool _enabled;
|
||||
bool _enabled = true;
|
||||
|
||||
enum RestartState {
|
||||
Alive,
|
||||
FadingOut,
|
||||
Restarting,
|
||||
FadingIn,
|
||||
} restartState;
|
||||
FadingIn
|
||||
} restartState = Alive;
|
||||
|
||||
enum PayphoneState {
|
||||
Left,
|
||||
Talking,
|
||||
PickingUp,
|
||||
HangingUp,
|
||||
} payphoneState;
|
||||
} payphoneState = Left;
|
||||
|
||||
// handles player respawn logic
|
||||
void restartLogic();
|
||||
@ -40,7 +40,7 @@ private:
|
||||
void restart();
|
||||
|
||||
public:
|
||||
PlayerController();
|
||||
PlayerController() = default;
|
||||
|
||||
/**
|
||||
* @brief Enables and disables player input.
|
||||
|
@ -24,11 +24,7 @@
|
||||
|
||||
TrafficDirector::TrafficDirector(AIGraph* g, GameWorld* w)
|
||||
: graph(g)
|
||||
, world(w)
|
||||
, pedDensity(1.f)
|
||||
, carDensity(1.f)
|
||||
, maximumPedestrians(20)
|
||||
, maximumCars(10) {
|
||||
, world(w) {
|
||||
}
|
||||
|
||||
std::vector<AIGraphNode*> TrafficDirector::findAvailableNodes(
|
||||
|
@ -35,12 +35,12 @@ public:
|
||||
void setPopulationLimits(int maxPeds, int maxCars);
|
||||
|
||||
private:
|
||||
AIGraph* graph;
|
||||
GameWorld* world;
|
||||
float pedDensity;
|
||||
float carDensity;
|
||||
int maximumPedestrians;
|
||||
int maximumCars;
|
||||
AIGraph* graph = nullptr;
|
||||
GameWorld* world = nullptr;
|
||||
float pedDensity = 1.f;
|
||||
float carDensity = 1.f;
|
||||
int maximumPedestrians = 20;
|
||||
int maximumCars = 10;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,8 +40,7 @@ struct ChaseKeyframe {
|
||||
*/
|
||||
class ChaseCoordinator {
|
||||
public:
|
||||
ChaseCoordinator() : chaseTime(-1.f) {
|
||||
}
|
||||
ChaseCoordinator() = default;
|
||||
|
||||
bool addChaseVehicle(GameObject* vehicle, int index,
|
||||
const std::string& pathFile);
|
||||
@ -54,7 +53,7 @@ public:
|
||||
void cleanup();
|
||||
|
||||
private:
|
||||
float chaseTime;
|
||||
float chaseTime{-1.f};
|
||||
struct ChaseObject {
|
||||
std::vector<ChaseKeyframe> keyframes;
|
||||
GameObject* object;
|
||||
|
@ -17,12 +17,7 @@ struct VehicleHandlingInfo;
|
||||
*/
|
||||
class CollisionInstance {
|
||||
public:
|
||||
CollisionInstance()
|
||||
: m_body(nullptr)
|
||||
, m_vertArray(nullptr)
|
||||
, m_motionState(nullptr)
|
||||
, m_collisionHeight(0.f) {
|
||||
}
|
||||
CollisionInstance() = default;
|
||||
|
||||
~CollisionInstance();
|
||||
|
||||
@ -41,12 +36,12 @@ public:
|
||||
void changeMass(float newMass);
|
||||
|
||||
private:
|
||||
btRigidBody* m_body;
|
||||
btRigidBody* m_body = nullptr;
|
||||
std::vector<btCollisionShape*> m_shapes;
|
||||
btTriangleIndexVertexArray* m_vertArray;
|
||||
btMotionState* m_motionState;
|
||||
btTriangleIndexVertexArray* m_vertArray = nullptr;
|
||||
btMotionState* m_motionState = nullptr;
|
||||
|
||||
float m_collisionHeight;
|
||||
float m_collisionHeight{0.f};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -31,15 +31,13 @@
|
||||
#include "platform/FileIndex.hpp"
|
||||
|
||||
GameData::GameData(Logger* log, const rwfs::path& path)
|
||||
: datpath(path), logger(log), engine(nullptr) {
|
||||
: datpath(path), logger(log) {
|
||||
dffLoader.setTextureLookupCallback(
|
||||
[&](const std::string& texture, const std::string&) {
|
||||
return findSlotTexture(currenttextureslot, texture);
|
||||
});
|
||||
}
|
||||
|
||||
GameData::~GameData() = default;
|
||||
|
||||
void GameData::load() {
|
||||
index.indexGameDirectory(datpath);
|
||||
index.indexTree(datpath);
|
||||
|
@ -58,9 +58,9 @@ public:
|
||||
* @param path Path to the root of the game data.
|
||||
*/
|
||||
GameData(Logger* log, const rwfs::path& path);
|
||||
~GameData();
|
||||
~GameData() = default;
|
||||
|
||||
GameWorld* engine;
|
||||
GameWorld* engine = nullptr;
|
||||
|
||||
/**
|
||||
* Returns the current platform
|
||||
|
@ -1,133 +1,5 @@
|
||||
#include "engine/GameState.hpp"
|
||||
|
||||
BasicState::BasicState()
|
||||
: saveName{0}
|
||||
, saveTime{0, 0, 0, 0, 0, 0, 0, 0}
|
||||
, islandNumber{0}
|
||||
, cameraPosition{}
|
||||
, gameMinuteMS{0}
|
||||
, lastTick{0}
|
||||
, gameHour{0}
|
||||
, gameMinute{0}
|
||||
, padMode{0}
|
||||
, timeMS{0}
|
||||
, timeScale{1.f}
|
||||
, timeStep{0}
|
||||
, timeStep_unclipped{0}
|
||||
, frameCounter{0}
|
||||
, timeStep2{0}
|
||||
, framesPerUpdate{0}
|
||||
, timeScale2{0}
|
||||
, lastWeather{0}
|
||||
, nextWeather{0}
|
||||
, forcedWeather{0}
|
||||
, weatherInterpolation{1.0}
|
||||
, weatherType{0}
|
||||
, cameraData{0}
|
||||
, cameraData2{0} {
|
||||
}
|
||||
|
||||
PlayerInfo::PlayerInfo()
|
||||
: money{0}
|
||||
, displayedMoney{0}
|
||||
, hiddenPackagesCollected{0}
|
||||
, hiddenPackageCount{0}
|
||||
, neverTired{0}
|
||||
, fastReload{0}
|
||||
, thaneOfLibertyCity{0}
|
||||
, singlePayerHealthcare{0} {
|
||||
}
|
||||
|
||||
GameStats::GameStats()
|
||||
: playerKills{0}
|
||||
, otherKills{0}
|
||||
, carsExploded{0}
|
||||
, shotsHit{0}
|
||||
, pedTypesKilled{}
|
||||
, helicoptersDestroyed{0}
|
||||
, playerProgress{0}
|
||||
, explosiveKgsUsed{0}
|
||||
, bulletsFired{0}
|
||||
, bulletsHit{0}
|
||||
, carsCrushed{0}
|
||||
, headshots{0}
|
||||
, timesBusted{0}
|
||||
, timesHospital{0}
|
||||
, daysPassed{0}
|
||||
, mmRainfall{0}
|
||||
, insaneJumpMaxDistance{0}
|
||||
, insaneJumpMaxHeight{0}
|
||||
, insaneJumpMaxFlips{0}
|
||||
, insaneJumpMaxRotation{0}
|
||||
, bestStunt{0}
|
||||
, uniqueStuntsFound{0}
|
||||
, uniqueStuntsTotal{0}
|
||||
, missionAttempts{0}
|
||||
, missionsPassed{0}
|
||||
, passengersDroppedOff{0}
|
||||
, taxiRevenue{0}
|
||||
, portlandPassed{0}
|
||||
, stauntonPassed{0}
|
||||
, shoresidePassed{0}
|
||||
, bestTurismoTime{0}
|
||||
, distanceWalked{0}
|
||||
, distanceDriven{0}
|
||||
, patriotPlaygroundTime{0}
|
||||
, aRideInTheParkTime{0}
|
||||
, grippedTime{0}
|
||||
, multistoryMayhemTime{0}
|
||||
, peopleSaved{0}
|
||||
, criminalsKilled{0}
|
||||
, highestParamedicLevel{0}
|
||||
, firesExtinguished{0}
|
||||
, longestDodoFlight{0}
|
||||
, bombDefusalTime{0}
|
||||
, rampagesPassed{0}
|
||||
, totalRampages{0}
|
||||
, totalMissions{0}
|
||||
, highestScore{}
|
||||
, peopleKilledSinceCheckpoint{0}
|
||||
, peopleKilledSinceLastBustedOrWasted{0}
|
||||
, lastMissionGXT{""} {
|
||||
}
|
||||
|
||||
GameState::GameState()
|
||||
: basic{}
|
||||
, gameTime(0.f)
|
||||
, currentProgress(0)
|
||||
, maxProgress(1)
|
||||
, maxWantedLevel(0)
|
||||
, playerObject(0)
|
||||
, scriptOnMissionFlag(nullptr)
|
||||
, overrideNextRestart(false)
|
||||
, nextRestartLocation{}
|
||||
, hospitalRestarts{}
|
||||
, policeRestarts{}
|
||||
, hospitalIslandOverride(0)
|
||||
, policeIslandOverride(0)
|
||||
, fadeIn(true)
|
||||
, fadeStart(0.f)
|
||||
, fadeTime(0.f)
|
||||
, fadeSound(false)
|
||||
, fadeColour{0.f, 0.f, 0.f}
|
||||
, skipCutscene(false)
|
||||
, isIntroPlaying(false)
|
||||
, currentCutscene(nullptr)
|
||||
, cutsceneStartTime(-1.f)
|
||||
, isCinematic(false)
|
||||
, hudFlash(HudFlash::Disabled)
|
||||
, cameraNear(0.1f)
|
||||
, cameraFixed(false)
|
||||
, cameraPosition{}
|
||||
, cameraRotation{1.0f, 0.0f, 0.0f, 0.0f}
|
||||
, cameraTarget(0)
|
||||
, importExportPortland(0)
|
||||
, importExportShoreside(0)
|
||||
, importExportUnused(0)
|
||||
, world(nullptr)
|
||||
, script(nullptr) {
|
||||
}
|
||||
|
||||
int GameState::addRadarBlip(BlipData& blip) {
|
||||
int l = 0;
|
||||
for (const auto& radarBlip : radarBlips) {
|
||||
@ -221,4 +93,4 @@ void GameState::setFadeColour(glm::i32vec3 colour) {
|
||||
void GameState::showHelpMessage(const GameStringKey& id) {
|
||||
text.addText<ScreenTextType::Help>(
|
||||
ScreenTextEntry::makeHelp(id, world->data->texts.text(id)));
|
||||
}
|
||||
}
|
||||
|
@ -38,83 +38,83 @@ struct SystemTime {
|
||||
|
||||
/** Block 0 State */
|
||||
struct BasicState {
|
||||
GameStringChar saveName[24];
|
||||
SystemTime saveTime;
|
||||
uint32_t unknown;
|
||||
uint16_t islandNumber;
|
||||
glm::vec3 cameraPosition;
|
||||
uint32_t gameMinuteMS;
|
||||
uint32_t lastTick;
|
||||
uint8_t gameHour;
|
||||
uint8_t _align0[3];
|
||||
uint8_t gameMinute;
|
||||
uint8_t _align1[3];
|
||||
uint16_t padMode;
|
||||
uint8_t _align2[2];
|
||||
uint32_t timeMS;
|
||||
float timeScale;
|
||||
float timeStep;
|
||||
float timeStep_unclipped; // Unknown purpose
|
||||
uint32_t frameCounter;
|
||||
float timeStep2;
|
||||
float framesPerUpdate;
|
||||
float timeScale2;
|
||||
uint16_t lastWeather;
|
||||
uint8_t _align3[2];
|
||||
uint16_t nextWeather;
|
||||
uint8_t _align4[2];
|
||||
uint16_t forcedWeather;
|
||||
uint8_t _align5[2];
|
||||
float weatherInterpolation;
|
||||
uint8_t dateTime[24]; // Unused
|
||||
uint32_t weatherType;
|
||||
float cameraData;
|
||||
float cameraData2;
|
||||
GameStringChar saveName[24]{0};
|
||||
SystemTime saveTime{0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint32_t unknown{0};
|
||||
uint16_t islandNumber{0};
|
||||
glm::vec3 cameraPosition{};
|
||||
uint32_t gameMinuteMS{0};
|
||||
uint32_t lastTick{0};
|
||||
uint8_t gameHour{0};
|
||||
uint8_t _align0[3]{0};
|
||||
uint8_t gameMinute{0};
|
||||
uint8_t _align1[3]{0};
|
||||
uint16_t padMode{0};
|
||||
uint8_t _align2[2]{0};
|
||||
uint32_t timeMS{0};
|
||||
float timeScale{1.f};
|
||||
float timeStep{0.f};
|
||||
float timeStep_unclipped{0}; // Unknown purpose
|
||||
uint32_t frameCounter{0};
|
||||
float timeStep2{0.f};
|
||||
float framesPerUpdate{0.f};
|
||||
float timeScale2{0.f};
|
||||
uint16_t lastWeather{0};
|
||||
uint8_t _align3[2]{0};
|
||||
uint16_t nextWeather{0};
|
||||
uint8_t _align4[2]{0};
|
||||
uint16_t forcedWeather{0};
|
||||
uint8_t _align5[2]{0};
|
||||
float weatherInterpolation{1.f};
|
||||
uint8_t dateTime[24]{0}; // Unused
|
||||
uint32_t weatherType{0};
|
||||
float cameraData{0};
|
||||
float cameraData2{0};
|
||||
|
||||
BasicState();
|
||||
BasicState() = default;
|
||||
};
|
||||
|
||||
/** Block 16 player info */
|
||||
struct PlayerInfo {
|
||||
int32_t money;
|
||||
uint8_t unknown1;
|
||||
uint32_t unknown2;
|
||||
uint16_t unknown3;
|
||||
float unknown4;
|
||||
int32_t displayedMoney;
|
||||
uint32_t hiddenPackagesCollected;
|
||||
uint32_t hiddenPackageCount;
|
||||
uint8_t neverTired;
|
||||
uint8_t fastReload;
|
||||
uint8_t thaneOfLibertyCity;
|
||||
uint8_t singlePayerHealthcare;
|
||||
uint8_t unknown5[70];
|
||||
int32_t money{0};
|
||||
uint8_t unknown1{0};
|
||||
uint32_t unknown2{0};
|
||||
uint16_t unknown3{0};
|
||||
float unknown4{0.f};
|
||||
int32_t displayedMoney{0};
|
||||
uint32_t hiddenPackagesCollected{0};
|
||||
uint32_t hiddenPackageCount{0};
|
||||
uint8_t neverTired{0};
|
||||
uint8_t fastReload{0};
|
||||
uint8_t thaneOfLibertyCity{0};
|
||||
uint8_t singlePayerHealthcare{0};
|
||||
uint8_t unknown5[70]{0};
|
||||
|
||||
PlayerInfo();
|
||||
PlayerInfo() = default;
|
||||
};
|
||||
|
||||
/** Block 17 */
|
||||
struct GameStats {
|
||||
uint32_t playerKills;
|
||||
uint32_t otherKills;
|
||||
uint32_t carsExploded;
|
||||
uint32_t shotsHit;
|
||||
uint32_t pedTypesKilled[23];
|
||||
uint32_t helicoptersDestroyed;
|
||||
uint32_t playerProgress;
|
||||
uint32_t explosiveKgsUsed;
|
||||
uint32_t bulletsFired;
|
||||
uint32_t bulletsHit;
|
||||
uint32_t carsCrushed;
|
||||
uint32_t headshots;
|
||||
uint32_t timesBusted;
|
||||
uint32_t timesHospital;
|
||||
uint32_t daysPassed;
|
||||
uint32_t mmRainfall;
|
||||
uint32_t insaneJumpMaxDistance;
|
||||
uint32_t insaneJumpMaxHeight;
|
||||
int32_t insaneJumpMaxFlips;
|
||||
int32_t insaneJumpMaxRotation;
|
||||
uint32_t playerKills{0};
|
||||
uint32_t otherKills{0};
|
||||
uint32_t carsExploded{0};
|
||||
uint32_t shotsHit{0};
|
||||
uint32_t pedTypesKilled[23]{};
|
||||
uint32_t helicoptersDestroyed{0};
|
||||
uint32_t playerProgress{0};
|
||||
uint32_t explosiveKgsUsed{0};
|
||||
uint32_t bulletsFired{0};
|
||||
uint32_t bulletsHit{0};
|
||||
uint32_t carsCrushed{0};
|
||||
uint32_t headshots{0};
|
||||
uint32_t timesBusted{0};
|
||||
uint32_t timesHospital{0};
|
||||
uint32_t daysPassed{0};
|
||||
uint32_t mmRainfall{0};
|
||||
uint32_t insaneJumpMaxDistance{0};
|
||||
uint32_t insaneJumpMaxHeight{0};
|
||||
int32_t insaneJumpMaxFlips{0};
|
||||
int32_t insaneJumpMaxRotation{0};
|
||||
/*
|
||||
* 0 none completed
|
||||
* 1 insane stunt
|
||||
@ -126,39 +126,39 @@ struct GameStats {
|
||||
* 7 quadruple
|
||||
* 8 perfect quadruple
|
||||
*/
|
||||
int32_t bestStunt;
|
||||
uint32_t uniqueStuntsFound;
|
||||
uint32_t uniqueStuntsTotal;
|
||||
uint32_t missionAttempts;
|
||||
uint32_t missionsPassed;
|
||||
uint32_t passengersDroppedOff;
|
||||
uint32_t taxiRevenue;
|
||||
uint32_t portlandPassed;
|
||||
uint32_t stauntonPassed;
|
||||
uint32_t shoresidePassed;
|
||||
int32_t bestTurismoTime;
|
||||
float distanceWalked;
|
||||
float distanceDriven;
|
||||
int32_t patriotPlaygroundTime;
|
||||
int32_t aRideInTheParkTime;
|
||||
int32_t grippedTime;
|
||||
int32_t multistoryMayhemTime;
|
||||
uint32_t peopleSaved;
|
||||
uint32_t criminalsKilled;
|
||||
int32_t highestParamedicLevel;
|
||||
uint32_t firesExtinguished;
|
||||
int32_t longestDodoFlight;
|
||||
int32_t bombDefusalTime;
|
||||
uint32_t rampagesPassed;
|
||||
uint32_t totalRampages;
|
||||
uint32_t totalMissions;
|
||||
uint32_t fastestTime[16]; // not used
|
||||
int32_t highestScore[16];
|
||||
uint32_t peopleKilledSinceCheckpoint; // ?
|
||||
uint32_t peopleKilledSinceLastBustedOrWasted;
|
||||
char lastMissionGXT[8];
|
||||
int32_t bestStunt{0};
|
||||
uint32_t uniqueStuntsFound{0};
|
||||
uint32_t uniqueStuntsTotal{0};
|
||||
uint32_t missionAttempts{0};
|
||||
uint32_t missionsPassed{0};
|
||||
uint32_t passengersDroppedOff{0};
|
||||
uint32_t taxiRevenue{0};
|
||||
uint32_t portlandPassed{0};
|
||||
uint32_t stauntonPassed{0};
|
||||
uint32_t shoresidePassed{0};
|
||||
int32_t bestTurismoTime{0};
|
||||
float distanceWalked{0};
|
||||
float distanceDriven{0};
|
||||
int32_t patriotPlaygroundTime{0};
|
||||
int32_t aRideInTheParkTime{0};
|
||||
int32_t grippedTime{0};
|
||||
int32_t multistoryMayhemTime{0};
|
||||
uint32_t peopleSaved{0};
|
||||
uint32_t criminalsKilled{0};
|
||||
int32_t highestParamedicLevel{0};
|
||||
uint32_t firesExtinguished{0};
|
||||
int32_t longestDodoFlight{0};
|
||||
int32_t bombDefusalTime{0};
|
||||
uint32_t rampagesPassed{0};
|
||||
uint32_t totalRampages{0};
|
||||
uint32_t totalMissions{0};
|
||||
uint32_t fastestTime[16]{0}; // not used
|
||||
int32_t highestScore[16]{};
|
||||
uint32_t peopleKilledSinceCheckpoint{0}; // ?
|
||||
uint32_t peopleKilledSinceLastBustedOrWasted{0};
|
||||
char lastMissionGXT[8]{""};
|
||||
|
||||
GameStats();
|
||||
GameStats() = default;
|
||||
};
|
||||
|
||||
struct TextDisplayData {
|
||||
@ -255,7 +255,7 @@ public:
|
||||
/**
|
||||
Basic Game State
|
||||
*/
|
||||
BasicState basic;
|
||||
BasicState basic{};
|
||||
|
||||
/**
|
||||
Player stats
|
||||
@ -270,27 +270,28 @@ public:
|
||||
/**
|
||||
* Second since game was started
|
||||
*/
|
||||
float gameTime;
|
||||
unsigned int currentProgress;
|
||||
unsigned int maxProgress;
|
||||
float gameTime = 0.f;
|
||||
unsigned int currentProgress = 0;
|
||||
unsigned int maxProgress = 1;
|
||||
|
||||
unsigned int maxWantedLevel;
|
||||
unsigned int maxWantedLevel = 0;
|
||||
|
||||
GameObjectID playerObject;
|
||||
GameObjectID playerObject = 0;
|
||||
|
||||
/**
|
||||
* @brief Stores a pointer to script global that stores the on-mission
|
||||
* state.
|
||||
*/
|
||||
ScriptInt* scriptOnMissionFlag;
|
||||
ScriptInt* scriptOnMissionFlag = nullptr;
|
||||
|
||||
/** Objects created by the current mission */
|
||||
std::vector<GameObject*> missionObjects;
|
||||
|
||||
bool overrideNextRestart;
|
||||
glm::vec4 nextRestartLocation;
|
||||
bool overrideNextRestart = false;
|
||||
glm::vec4 nextRestartLocation{};
|
||||
std::vector<glm::vec4> hospitalRestarts, policeRestarts;
|
||||
int hospitalIslandOverride, policeIslandOverride;
|
||||
int hospitalIslandOverride = 0;
|
||||
int policeIslandOverride = 0;
|
||||
|
||||
void addHospitalRestart(const glm::vec4 location);
|
||||
void addPoliceRestart(const glm::vec4 location);
|
||||
@ -302,11 +303,11 @@ public:
|
||||
const glm::vec4 getClosestRestart(RestartType type,
|
||||
const glm::vec3 playerPosition) const;
|
||||
|
||||
bool fadeIn;
|
||||
float fadeStart;
|
||||
float fadeTime;
|
||||
bool fadeSound;
|
||||
glm::u16vec3 fadeColour;
|
||||
bool fadeIn = true;
|
||||
float fadeStart = 0.f;
|
||||
float fadeTime = 0.f;
|
||||
bool fadeSound = false;
|
||||
glm::u16vec3 fadeColour{0.f, 0.f, 0.f};
|
||||
|
||||
// @todo fadeOut should be replaced with enum?
|
||||
void fade(float time, bool f);
|
||||
@ -315,13 +316,13 @@ public:
|
||||
|
||||
std::string currentSplash;
|
||||
|
||||
bool skipCutscene;
|
||||
bool isIntroPlaying;
|
||||
CutsceneData* currentCutscene;
|
||||
float cutsceneStartTime;
|
||||
bool skipCutscene = false;
|
||||
bool isIntroPlaying = false;
|
||||
CutsceneData* currentCutscene = nullptr;
|
||||
float cutsceneStartTime{-1.f};
|
||||
/** Flag for rendering cutscene letterbox */
|
||||
bool isCinematic;
|
||||
HudFlash hudFlash;
|
||||
bool isCinematic = false;
|
||||
HudFlash hudFlash{HudFlash::Disabled};
|
||||
|
||||
std::string lastMissionName;
|
||||
|
||||
@ -347,12 +348,12 @@ public:
|
||||
int bigNVeinyPickupsCollected = 0;
|
||||
|
||||
/** The camera near value currently set by the script */
|
||||
float cameraNear;
|
||||
bool cameraFixed;
|
||||
glm::vec3 cameraPosition;
|
||||
glm::quat cameraRotation;
|
||||
float cameraNear{0.1f};
|
||||
bool cameraFixed = false;
|
||||
glm::vec3 cameraPosition{};
|
||||
glm::quat cameraRotation{1.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
GameObjectID cameraTarget;
|
||||
GameObjectID cameraTarget = 0;
|
||||
|
||||
std::vector<VehicleGenerator> vehicleGenerators;
|
||||
|
||||
@ -361,28 +362,28 @@ public:
|
||||
/**
|
||||
* Bitsets for the car import / export list mission
|
||||
*/
|
||||
std::bitset<32> importExportPortland;
|
||||
std::bitset<32> importExportShoreside;
|
||||
std::bitset<32> importExportUnused;
|
||||
std::bitset<32> importExportPortland = 0;
|
||||
std::bitset<32> importExportShoreside = 0;
|
||||
std::bitset<32> importExportUnused = 0;
|
||||
|
||||
/**
|
||||
* State of the game input for the last 2 frames
|
||||
*/
|
||||
GameInputState input[2];
|
||||
GameInputState input[2]{};
|
||||
|
||||
/**
|
||||
* World to use for this state, this isn't saved, just used at runtime
|
||||
*/
|
||||
GameWorld* world;
|
||||
GameWorld* world = nullptr;
|
||||
|
||||
/**
|
||||
* Script Machine associated with this state if it exists.
|
||||
*/
|
||||
ScriptMachine* script;
|
||||
ScriptMachine* script = nullptr;
|
||||
|
||||
std::array<ScriptContactData, 16> scriptContacts = {};
|
||||
|
||||
GameState();
|
||||
GameState() = default;
|
||||
|
||||
/**
|
||||
* Adds a blip to the state, returning it's ID.
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
};
|
||||
|
||||
GameWorld::GameWorld(Logger* log, GameData* dat)
|
||||
: logger(log), data(dat), randomEngine(rand()), paused(false) {
|
||||
: logger(log), data(dat) {
|
||||
data->engine = this;
|
||||
|
||||
collisionConfig = std::make_unique<btDefaultCollisionConfiguration>();
|
||||
|
@ -301,7 +301,7 @@ public:
|
||||
/**
|
||||
* Randomness Engine
|
||||
*/
|
||||
std::default_random_engine randomEngine;
|
||||
std::default_random_engine randomEngine{std::random_device{}()};
|
||||
|
||||
/**
|
||||
* Bullet
|
||||
@ -385,7 +385,7 @@ private:
|
||||
/**
|
||||
* Flag for pausing the simulation
|
||||
*/
|
||||
bool paused;
|
||||
bool paused = false;
|
||||
|
||||
/**
|
||||
* Private data
|
||||
|
@ -30,18 +30,6 @@ CharacterObject::CharacterObject(GameWorld* engine, const glm::vec3& pos,
|
||||
const glm::quat& rot, BaseModelInfo* modelinfo,
|
||||
CharacterController* controller)
|
||||
: GameObject(engine, pos, rot, modelinfo)
|
||||
, currentState({})
|
||||
, currentVehicle(nullptr)
|
||||
, currentSeat(0)
|
||||
, m_look(0.f, glm::half_pi<float>())
|
||||
, running(false)
|
||||
, jumped(false)
|
||||
, jumpSpeed(DefaultJumpSpeed)
|
||||
, motionBlockedByActivity(false)
|
||||
, cycle_(AnimCycle::Idle)
|
||||
, physCharacter(nullptr)
|
||||
, physObject(nullptr)
|
||||
, physShape(nullptr)
|
||||
, controller(controller) {
|
||||
auto info = getModelInfo<PedModelInfo>();
|
||||
setClump(ClumpPtr(info->getModel()->clone()));
|
||||
|
@ -55,34 +55,34 @@ class GameWorld;
|
||||
*/
|
||||
class CharacterObject : public GameObject, public ClumpObject {
|
||||
private:
|
||||
CharacterState currentState;
|
||||
CharacterState currentState{};
|
||||
|
||||
VehicleObject* currentVehicle;
|
||||
size_t currentSeat;
|
||||
VehicleObject* currentVehicle = nullptr;
|
||||
size_t currentSeat{0};
|
||||
|
||||
void createActor(const glm::vec2& size = glm::vec2(0.45f, 1.2f));
|
||||
void destroyActor();
|
||||
|
||||
glm::vec3 movement{};
|
||||
glm::vec2 m_look{};
|
||||
glm::vec2 m_look{0.f, glm::half_pi<float>()};
|
||||
|
||||
bool running;
|
||||
bool jumped;
|
||||
float jumpSpeed;
|
||||
bool running = false;
|
||||
bool jumped = false;
|
||||
float jumpSpeed = DefaultJumpSpeed;
|
||||
|
||||
bool motionBlockedByActivity;
|
||||
bool motionBlockedByActivity = false;
|
||||
|
||||
glm::vec3 updateMovementAnimation(float dt);
|
||||
glm::vec3 currenteMovementStep{};
|
||||
|
||||
AnimCycle cycle_;
|
||||
AnimCycle cycle_ = AnimCycle::Idle;
|
||||
|
||||
public:
|
||||
static const float DefaultJumpSpeed;
|
||||
|
||||
btKinematicCharacterController* physCharacter;
|
||||
btPairCachingGhostObject* physObject;
|
||||
btCapsuleShapeZ* physShape;
|
||||
btKinematicCharacterController* physCharacter = nullptr;
|
||||
btPairCachingGhostObject* physObject = nullptr;
|
||||
btCapsuleShapeZ* physShape = nullptr;
|
||||
|
||||
CharacterController* controller;
|
||||
|
||||
|
@ -8,9 +8,7 @@
|
||||
CutsceneObject::CutsceneObject(GameWorld *engine, const glm::vec3 &pos,
|
||||
const glm::quat &rot, const ClumpPtr& model,
|
||||
BaseModelInfo *modelinfo)
|
||||
: GameObject(engine, pos, rot, modelinfo)
|
||||
, _parent(nullptr)
|
||||
, _bone(nullptr) {
|
||||
: GameObject(engine, pos, rot, modelinfo) {
|
||||
if (model) {
|
||||
setModel(model);
|
||||
}
|
||||
@ -21,8 +19,6 @@ CutsceneObject::CutsceneObject(GameWorld *engine, const glm::vec3 &pos,
|
||||
animator = new Animator(getClump());
|
||||
}
|
||||
|
||||
CutsceneObject::~CutsceneObject() = default;
|
||||
|
||||
void CutsceneObject::tick(float dt) {
|
||||
animator->tick(dt);
|
||||
}
|
||||
|
@ -14,14 +14,14 @@ class ModelFrame;
|
||||
* @brief Object type used for cutscene animations.
|
||||
*/
|
||||
class CutsceneObject : public GameObject, public ClumpObject {
|
||||
GameObject* _parent;
|
||||
ModelFrame* _bone;
|
||||
GameObject* _parent = nullptr;
|
||||
ModelFrame* _bone = nullptr;
|
||||
|
||||
public:
|
||||
CutsceneObject(GameWorld* engine, const glm::vec3& pos,
|
||||
const glm::quat& rot, const ClumpPtr& model,
|
||||
BaseModelInfo* modelinfo);
|
||||
~CutsceneObject() override;
|
||||
~CutsceneObject() override = default;
|
||||
|
||||
Type type() const override {
|
||||
return Cutscene;
|
||||
|
@ -25,14 +25,14 @@ class GameWorld;
|
||||
class GameObject {
|
||||
glm::vec3 _lastPosition;
|
||||
glm::quat _lastRotation;
|
||||
GameObjectID objectID;
|
||||
GameObjectID objectID = 0;
|
||||
|
||||
BaseModelInfo* modelinfo_;
|
||||
|
||||
/**
|
||||
* Model used for rendering
|
||||
*/
|
||||
ClumpPtr model_;
|
||||
ClumpPtr model_ = nullptr;
|
||||
|
||||
protected:
|
||||
void changeModelInfo(BaseModelInfo* next) {
|
||||
@ -43,37 +43,30 @@ public:
|
||||
glm::vec3 position;
|
||||
glm::quat rotation;
|
||||
|
||||
GameWorld* engine;
|
||||
GameWorld* engine = nullptr;
|
||||
|
||||
Animator* animator; /// Object's animator.
|
||||
Animator* animator = nullptr; /// Object's animator.
|
||||
|
||||
bool inWater;
|
||||
bool inWater = false;
|
||||
|
||||
/**
|
||||
* @brief stores the height of water at the last tick
|
||||
*/
|
||||
float _lastHeight;
|
||||
float _lastHeight = std::numeric_limits<float>::max();
|
||||
|
||||
/**
|
||||
* Should object be rendered?
|
||||
*/
|
||||
bool visible;
|
||||
bool visible = true;
|
||||
|
||||
GameObject(GameWorld* engine, const glm::vec3& pos, const glm::quat& rot,
|
||||
BaseModelInfo* modelinfo)
|
||||
: _lastPosition(pos)
|
||||
, _lastRotation(rot)
|
||||
, objectID(0)
|
||||
, modelinfo_(modelinfo)
|
||||
, model_(nullptr)
|
||||
, position(pos)
|
||||
, rotation(rot)
|
||||
, engine(engine)
|
||||
, animator(nullptr)
|
||||
, inWater(false)
|
||||
, _lastHeight(std::numeric_limits<float>::max())
|
||||
, visible(true)
|
||||
, lifetime(GameObject::UnknownLifetime) {
|
||||
, engine(engine) {
|
||||
if (modelinfo_) {
|
||||
modelinfo_->addReference();
|
||||
}
|
||||
@ -241,7 +234,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectLifetime lifetime;
|
||||
ObjectLifetime lifetime = GameObject::UnknownLifetime;
|
||||
};
|
||||
|
||||
class ClumpObject {
|
||||
|
@ -18,13 +18,7 @@ InstanceObject::InstanceObject(GameWorld* engine, const glm::vec3& pos,
|
||||
BaseModelInfo* modelinfo,
|
||||
const std::shared_ptr<DynamicObjectData>& dyn)
|
||||
: GameObject(engine, pos, rot, modelinfo)
|
||||
, health(100.f)
|
||||
, visible(true)
|
||||
, floating(false)
|
||||
, usePhysics(false)
|
||||
, changeAtomic(-1)
|
||||
, scale(scale)
|
||||
, body(nullptr)
|
||||
, dynamics(dyn) {
|
||||
if (modelinfo) {
|
||||
changeModel(modelinfo);
|
||||
|
@ -17,12 +17,12 @@ class GameWorld;
|
||||
* A simple object instance
|
||||
*/
|
||||
class InstanceObject : public GameObject {
|
||||
float health;
|
||||
bool visible;
|
||||
bool floating;
|
||||
bool static_;
|
||||
bool usePhysics;
|
||||
int changeAtomic;
|
||||
float health = 100.f;
|
||||
bool visible =true;
|
||||
bool floating = false;
|
||||
bool static_ = false;
|
||||
bool usePhysics = false;
|
||||
int changeAtomic = -1;
|
||||
|
||||
/**
|
||||
* The Atomic instance for this object
|
||||
|
@ -92,10 +92,6 @@ PickupObject::BehaviourFlags PickupObject::defaultBehaviourFlags(
|
||||
PickupObject::PickupObject(GameWorld* world, const glm::vec3& position,
|
||||
BaseModelInfo* modelinfo, PickupType type)
|
||||
: GameObject(world, position, glm::quat{1.0f, 0.0f, 0.0f, 0.0f}, modelinfo)
|
||||
, m_ghost(nullptr)
|
||||
, m_shape(nullptr)
|
||||
, m_enabled(false)
|
||||
, m_collected(false)
|
||||
, m_type(type) {
|
||||
btTransform tf;
|
||||
tf.setIdentity();
|
||||
|
@ -114,18 +114,18 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
btPairCachingGhostObject* m_ghost;
|
||||
btSphereShape* m_shape;
|
||||
bool m_enabled;
|
||||
float m_enableTimer;
|
||||
bool m_collected;
|
||||
VisualFX* m_corona;
|
||||
short m_colourId;
|
||||
bool respawn;
|
||||
float respawnTime;
|
||||
BehaviourFlags behaviourFlags;
|
||||
btPairCachingGhostObject* m_ghost = nullptr;
|
||||
btSphereShape* m_shape = nullptr;
|
||||
bool m_enabled = false;
|
||||
float m_enableTimer = 0.f;
|
||||
bool m_collected = false;
|
||||
VisualFX* m_corona = nullptr;
|
||||
short m_colourId = 0;
|
||||
bool respawn = false;
|
||||
float respawnTime{};
|
||||
BehaviourFlags behaviourFlags{};
|
||||
|
||||
PickupType m_type;
|
||||
PickupType m_type{};
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -114,10 +114,7 @@ void ProjectileObject::cleanup() {
|
||||
ProjectileObject::ProjectileObject(GameWorld* world, const glm::vec3& position,
|
||||
const ProjectileObject::ProjectileInfo& info)
|
||||
: GameObject(world, position, glm::quat{1.0f,0.0f,0.0f,0.0f}, nullptr)
|
||||
, _info(info)
|
||||
, _body(nullptr)
|
||||
, _ghostBody(nullptr)
|
||||
, _exploded(false) {
|
||||
, _info(info) {
|
||||
_shape = new btSphereShape(0.45f);
|
||||
btVector3 inertia(0.f, 0.f, 0.f);
|
||||
_shape->calculateLocalInertia(1.f, inertia);
|
||||
|
@ -38,12 +38,12 @@ private:
|
||||
|
||||
btSphereShape* _shape;
|
||||
|
||||
btRigidBody* _body;
|
||||
btRigidBody* _body = nullptr;
|
||||
|
||||
/** Used for RPGs and Molotov collision detection */
|
||||
btPairCachingGhostObject* _ghostBody;
|
||||
btPairCachingGhostObject* _ghostBody = nullptr;
|
||||
|
||||
bool _exploded;
|
||||
bool _exploded = false;
|
||||
|
||||
void checkPhysicsContact();
|
||||
void explode();
|
||||
|
@ -92,18 +92,10 @@ VehicleObject::VehicleObject(GameWorld* engine, const glm::vec3& pos,
|
||||
VehicleInfoHandle info, const glm::u8vec3& prim,
|
||||
const glm::u8vec3& sec)
|
||||
: GameObject(engine, pos, rot, modelinfo)
|
||||
, steerAngle(0.f)
|
||||
, throttle(0.f)
|
||||
, brake(0.f)
|
||||
, handbrake(true)
|
||||
, health(1000.f)
|
||||
, info(info)
|
||||
, colourPrimary(prim)
|
||||
, colourSecondary(sec)
|
||||
, mHasSpecial(true)
|
||||
, collision(new CollisionInstance)
|
||||
, physRaycaster(nullptr)
|
||||
, physVehicle(nullptr) {
|
||||
, collision(new CollisionInstance) {
|
||||
collision->createPhysicsBody(this, modelinfo->getCollision(), nullptr,
|
||||
&info->handling);
|
||||
collision->getBulletBody()->forceActivationState(DISABLE_DEACTIVATION);
|
||||
|
@ -32,29 +32,29 @@ class btHingeConstraint;
|
||||
*/
|
||||
class VehicleObject : public GameObject, public ClumpObject {
|
||||
private:
|
||||
float steerAngle;
|
||||
float throttle;
|
||||
float brake;
|
||||
bool handbrake;
|
||||
float steerAngle{0.f};
|
||||
float throttle{0.f};
|
||||
float brake{0.f};
|
||||
bool handbrake = true;
|
||||
|
||||
Atomic* chassishigh_ = nullptr;
|
||||
Atomic* chassislow_ = nullptr;
|
||||
|
||||
std::array<Atomic*, 6> extras_;
|
||||
std::array<Atomic*, 6> extras_{};
|
||||
|
||||
public:
|
||||
float health;
|
||||
float health{1000.f};
|
||||
|
||||
VehicleInfoHandle info;
|
||||
glm::u8vec3 colourPrimary;
|
||||
glm::u8vec3 colourSecondary;
|
||||
bool mHasSpecial;
|
||||
VehicleInfoHandle info{};
|
||||
glm::u8vec3 colourPrimary{};
|
||||
glm::u8vec3 colourSecondary{};
|
||||
bool mHasSpecial = true;
|
||||
|
||||
std::map<size_t, GameObject*> seatOccupants;
|
||||
|
||||
std::unique_ptr<CollisionInstance> collision;
|
||||
btVehicleRaycaster* physRaycaster;
|
||||
btRaycastVehicle* physVehicle;
|
||||
btVehicleRaycaster* physRaycaster = nullptr;
|
||||
btRaycastVehicle* physVehicle = nullptr;
|
||||
|
||||
struct Part {
|
||||
ModelFrame* dummy;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "render/GameRenderer.hpp"
|
||||
|
||||
DebugDraw::DebugDraw() : shaderProgram(nullptr) {
|
||||
DebugDraw::DebugDraw() {
|
||||
lineBuff = new GeometryBuffer;
|
||||
dbuff = new DrawBuffer;
|
||||
dbuff->setFaceType(GL_LINES);
|
||||
|
@ -47,7 +47,7 @@ protected:
|
||||
DrawBuffer *dbuff;
|
||||
|
||||
//Ownership is handled by worldProg in renderer
|
||||
Renderer::ShaderProgram *shaderProgram;
|
||||
Renderer::ShaderProgram *shaderProgram = nullptr;
|
||||
|
||||
GLuint texture;
|
||||
};
|
||||
|
@ -56,10 +56,6 @@ struct ParticleVert {
|
||||
GameRenderer::GameRenderer(Logger* log, GameData* _data)
|
||||
: data(_data)
|
||||
, logger(log)
|
||||
, renderer(std::make_shared<OpenGLRenderer>())
|
||||
, _renderAlpha(0.f)
|
||||
, _renderWorld(nullptr)
|
||||
, cullOverride(false)
|
||||
, map(renderer, _data)
|
||||
, water(this)
|
||||
, text(this) {
|
||||
|
@ -37,11 +37,11 @@ class GameRenderer {
|
||||
Logger* logger;
|
||||
|
||||
/** The low-level drawing interface to use */
|
||||
std::shared_ptr<Renderer> renderer;
|
||||
std::shared_ptr<Renderer> renderer = std::make_shared<OpenGLRenderer>();
|
||||
|
||||
// Temporary variables used during rendering
|
||||
float _renderAlpha;
|
||||
GameWorld* _renderWorld;
|
||||
float _renderAlpha{0.f};
|
||||
GameWorld* _renderWorld = nullptr;
|
||||
|
||||
/** Internal non-descript VAOs */
|
||||
GLuint vao, debugVAO;
|
||||
@ -49,7 +49,7 @@ class GameRenderer {
|
||||
/** Camera values passed to renderWorld() */
|
||||
ViewCamera _camera;
|
||||
ViewCamera cullingCamera;
|
||||
bool cullOverride;
|
||||
bool cullOverride = false;
|
||||
|
||||
/** Number of culling events */
|
||||
size_t culled;
|
||||
|
@ -36,8 +36,7 @@ class ObjectRenderer {
|
||||
public:
|
||||
ObjectRenderer(GameWorld* world, const ViewCamera& camera,
|
||||
float renderAlpha, GLuint errorTexture)
|
||||
: culled(0)
|
||||
, m_world(world)
|
||||
: m_world(world)
|
||||
, m_camera(camera)
|
||||
, m_renderAlpha(renderAlpha)
|
||||
, m_errorTexture(errorTexture) {
|
||||
@ -48,7 +47,7 @@ public:
|
||||
*
|
||||
* Exports rendering instructions for an object
|
||||
*/
|
||||
size_t culled;
|
||||
size_t culled = 0;
|
||||
void buildRenderList(GameObject* object, RenderList& outList);
|
||||
|
||||
void renderGeometry(Geometry* geom, const glm::mat4& modelMatrix,
|
||||
|
@ -77,32 +77,26 @@ public:
|
||||
*/
|
||||
struct DrawParameters {
|
||||
/// Number of indicies
|
||||
size_t count;
|
||||
size_t count{};
|
||||
/// Start index.
|
||||
unsigned int start;
|
||||
unsigned int start{};
|
||||
/// Textures to use
|
||||
Textures textures;
|
||||
Textures textures{};
|
||||
/// Blending mode
|
||||
BlendMode blendMode;
|
||||
BlendMode blendMode = BlendMode::BLEND_NONE;
|
||||
// Depth writing state
|
||||
bool depthWrite;
|
||||
bool depthWrite = true;
|
||||
/// Material
|
||||
glm::u8vec4 colour{};
|
||||
/// Material
|
||||
float ambient;
|
||||
float ambient{1.f};
|
||||
/// Material
|
||||
float diffuse;
|
||||
float diffuse{1.f};
|
||||
/// Material
|
||||
float visibility;
|
||||
float visibility{1.f};
|
||||
|
||||
// Default state -- should be moved to materials
|
||||
DrawParameters()
|
||||
: blendMode(BlendMode::BLEND_NONE)
|
||||
, depthWrite(true)
|
||||
, ambient(1.f)
|
||||
, diffuse(1.f)
|
||||
, visibility(1.f) {
|
||||
}
|
||||
DrawParameters() = default;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -129,9 +123,9 @@ public:
|
||||
struct ObjectUniformData {
|
||||
glm::mat4 model{1.0f};
|
||||
glm::vec4 colour{1.0f};
|
||||
float diffuse;
|
||||
float ambient;
|
||||
float visibility;
|
||||
float diffuse{};
|
||||
float ambient{};
|
||||
float visibility{};
|
||||
};
|
||||
|
||||
struct SceneUniformData {
|
||||
@ -141,8 +135,8 @@ public:
|
||||
glm::vec4 dynamic{};
|
||||
glm::vec4 fogColour{};
|
||||
glm::vec4 campos{};
|
||||
float fogStart;
|
||||
float fogEnd;
|
||||
float fogStart{};
|
||||
float fogEnd{};
|
||||
};
|
||||
|
||||
class ShaderProgram {
|
||||
@ -220,13 +214,13 @@ public:
|
||||
* USING(RENDER_PROFILER)
|
||||
*/
|
||||
struct ProfileInfo {
|
||||
GLuint64 timerStart;
|
||||
GLuint64 duration;
|
||||
unsigned int primitives;
|
||||
unsigned int draws;
|
||||
unsigned int textures;
|
||||
unsigned int buffers;
|
||||
unsigned int uploads;
|
||||
GLuint64 timerStart{};
|
||||
GLuint64 duration{};
|
||||
unsigned int primitives{};
|
||||
unsigned int draws{};
|
||||
unsigned int textures{};
|
||||
unsigned int buffers{};
|
||||
unsigned int uploads{};
|
||||
};
|
||||
|
||||
/**
|
||||
@ -245,10 +239,10 @@ private:
|
||||
glm::mat4 projection2D{1.0f};
|
||||
|
||||
protected:
|
||||
int drawCounter;
|
||||
int textureCounter;
|
||||
int bufferCounter;
|
||||
SceneUniformData lastSceneData;
|
||||
int drawCounter{};
|
||||
int textureCounter{};
|
||||
int bufferCounter{};
|
||||
SceneUniformData lastSceneData{};
|
||||
};
|
||||
|
||||
class OpenGLRenderer : public Renderer {
|
||||
@ -329,12 +323,12 @@ public:
|
||||
|
||||
private:
|
||||
struct Buffer {
|
||||
GLuint name;
|
||||
GLuint currentEntry;
|
||||
GLuint name{};
|
||||
GLuint currentEntry{};
|
||||
|
||||
GLuint entryCount;
|
||||
GLuint entrySize;
|
||||
GLsizei bufferSize;
|
||||
GLuint entryCount{};
|
||||
GLuint entrySize{};
|
||||
GLsizei bufferSize{};
|
||||
};
|
||||
|
||||
void useDrawBuffer(DrawBuffer* dbuff);
|
||||
|
@ -82,10 +82,6 @@ struct TextVertex {
|
||||
}
|
||||
};
|
||||
|
||||
TextRenderer::TextInfo::TextInfo()
|
||||
: font(0), size(1.f), baseColour({1.f, 1.f, 1.f}), align(Left), wrapX(0) {
|
||||
}
|
||||
|
||||
TextRenderer::TextRenderer(GameRenderer* renderer) : renderer(renderer) {
|
||||
textShader = renderer->getRenderer()->createShader(TextVertexShader,
|
||||
TextFragmentShader);
|
||||
@ -131,8 +127,6 @@ TextRenderer::TextRenderer(GameRenderer* renderer) : renderer(renderer) {
|
||||
}
|
||||
}
|
||||
|
||||
TextRenderer::~TextRenderer() = default;
|
||||
|
||||
void TextRenderer::setFontTexture(int index, const std::string& texture) {
|
||||
if (index < GAME_FONTS) {
|
||||
fonts[index] = texture;
|
||||
|
@ -33,23 +33,23 @@ public:
|
||||
enum TextAlignemnt { Left = 0, Right = 1, Center = 2 };
|
||||
|
||||
/// Font index @see TextRenderer::setFontTexture
|
||||
int font;
|
||||
int font{0};
|
||||
/// Message to be displayed (including markup)
|
||||
GameString text;
|
||||
/// On screen position
|
||||
glm::vec2 screenPosition{};
|
||||
/// font size
|
||||
float size;
|
||||
float size{1.f};
|
||||
/// Base colour
|
||||
glm::u8vec3 baseColour{};
|
||||
glm::u8vec3 baseColour{1.f, 1.f, 1.f};
|
||||
/// Background colour
|
||||
glm::u8vec4 backgroundColour{};
|
||||
/// Horizontal Alignment
|
||||
TextAlignemnt align;
|
||||
TextAlignemnt align = Left;
|
||||
/// Wrap width
|
||||
int wrapX;
|
||||
int wrapX{0};
|
||||
|
||||
TextInfo();
|
||||
TextInfo() = default;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@ public:
|
||||
};
|
||||
|
||||
TextRenderer(GameRenderer* renderer);
|
||||
~TextRenderer();
|
||||
~TextRenderer() = default;
|
||||
|
||||
void setFontTexture(int index, const std::string& font);
|
||||
|
||||
|
@ -16,12 +16,12 @@ public:
|
||||
float distance{};
|
||||
};
|
||||
|
||||
float near;
|
||||
float far;
|
||||
float fov;
|
||||
float aspectRatio;
|
||||
float near{};
|
||||
float far{};
|
||||
float fov{};
|
||||
float aspectRatio{};
|
||||
|
||||
ViewPlane planes[6];
|
||||
ViewPlane planes[6]{};
|
||||
|
||||
ViewFrustum(float near, float far, float fov, float aspect)
|
||||
: near(near), far(far), fov(fov), aspectRatio(aspect) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "render/GameShaders.hpp"
|
||||
#include "render/OpenGLRenderer.hpp"
|
||||
|
||||
WaterRenderer::WaterRenderer(GameRenderer* renderer) : waterProg(nullptr) {
|
||||
WaterRenderer::WaterRenderer(GameRenderer* renderer) {
|
||||
maskDraw.setFaceType(GL_TRIANGLES);
|
||||
gridDraw.setFaceType(GL_TRIANGLES);
|
||||
|
||||
@ -55,8 +55,6 @@ WaterRenderer::WaterRenderer(GameRenderer* renderer) : waterProg(nullptr) {
|
||||
gridDraw.addGeometry(&gridGeom);
|
||||
}
|
||||
|
||||
WaterRenderer::~WaterRenderer() = default;
|
||||
|
||||
void WaterRenderer::setWaterTable(const float* waterHeights, const unsigned int nHeights,
|
||||
const uint8_t* tiles, const unsigned int nTiles) {
|
||||
// Determine the dimensions of the input tiles
|
||||
|
@ -20,7 +20,7 @@ class GameWorld;
|
||||
class WaterRenderer {
|
||||
public:
|
||||
WaterRenderer(GameRenderer* renderer);
|
||||
~WaterRenderer();
|
||||
~WaterRenderer() = default;
|
||||
|
||||
/**
|
||||
* Creates the required data for rendering the water. Accepts
|
||||
@ -41,19 +41,19 @@ public:
|
||||
void render(GameRenderer* renderer, GameWorld* world);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Renderer::ShaderProgram> waterProg;
|
||||
std::unique_ptr<Renderer::ShaderProgram> maskProg;
|
||||
std::unique_ptr<Renderer::ShaderProgram> waterProg = nullptr;
|
||||
std::unique_ptr<Renderer::ShaderProgram> maskProg = nullptr;
|
||||
|
||||
DrawBuffer maskDraw;
|
||||
GeometryBuffer maskGeom;
|
||||
DrawBuffer maskDraw{};
|
||||
GeometryBuffer maskGeom{};
|
||||
|
||||
std::vector<int> maskSizes;
|
||||
|
||||
DrawBuffer gridDraw;
|
||||
GeometryBuffer gridGeom;
|
||||
DrawBuffer gridDraw{};
|
||||
GeometryBuffer gridGeom{};
|
||||
|
||||
GLuint fbOutput;
|
||||
GLuint dataTexture;
|
||||
GLuint fbOutput{};
|
||||
GLuint dataTexture{};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -15,12 +15,7 @@ class SCMFile {
|
||||
public:
|
||||
enum SCMTarget { NoTarget = 0, GTAIII = 0xC6, GTAVC = 0x6D, GTASA = 0x73 };
|
||||
|
||||
SCMFile()
|
||||
: _data(nullptr)
|
||||
, _target(NoTarget)
|
||||
, mainSize(0)
|
||||
, missionLargestSize(0) {
|
||||
}
|
||||
SCMFile() = default;
|
||||
|
||||
~SCMFile() {
|
||||
delete[] _data;
|
||||
@ -70,21 +65,21 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
SCMByte* _data;
|
||||
SCMByte* _data = nullptr;
|
||||
|
||||
SCMTarget _target;
|
||||
SCMTarget _target{NoTarget};
|
||||
|
||||
std::vector<std::string> models;
|
||||
|
||||
std::vector<unsigned int> missionOffsets;
|
||||
|
||||
uint32_t mainSize;
|
||||
uint32_t missionLargestSize;
|
||||
uint32_t mainSize{0};
|
||||
uint32_t missionLargestSize{0};
|
||||
|
||||
uint32_t globalSectionOffset;
|
||||
uint32_t modelSectionOffset;
|
||||
uint32_t missionSectionOffset;
|
||||
uint32_t codeSectionOffset;
|
||||
uint32_t globalSectionOffset{0};
|
||||
uint32_t modelSectionOffset{0};
|
||||
uint32_t missionSectionOffset{0};
|
||||
uint32_t codeSectionOffset{0};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -34,8 +34,8 @@ struct SCMException {
|
||||
};
|
||||
|
||||
struct IllegalInstruction : SCMException {
|
||||
SCMOpcode opcode;
|
||||
unsigned int offset;
|
||||
SCMOpcode opcode{};
|
||||
unsigned int offset{0};
|
||||
std::string thread;
|
||||
|
||||
template <class String>
|
||||
@ -57,8 +57,8 @@ struct IllegalInstruction : SCMException {
|
||||
};
|
||||
|
||||
struct UnknownType : SCMException {
|
||||
SCMByte type;
|
||||
unsigned int offset;
|
||||
SCMByte type{};
|
||||
unsigned int offset{0};
|
||||
std::string thread;
|
||||
|
||||
template <class String>
|
||||
@ -184,9 +184,9 @@ public:
|
||||
void execute(float dt);
|
||||
|
||||
private:
|
||||
SCMFile* file;
|
||||
ScriptModule* module;
|
||||
GameState* state;
|
||||
SCMFile* file = nullptr;
|
||||
ScriptModule* module = nullptr;
|
||||
GameState* state = nullptr;
|
||||
bool debugFlag;
|
||||
|
||||
std::list<SCMThread> _activeThreads;
|
||||
|
@ -57,11 +57,11 @@ struct ScriptObjectType {
|
||||
/**
|
||||
* @brief m_id VM Memory containing the object handler
|
||||
*/
|
||||
ScriptInt* m_id;
|
||||
ScriptInt* m_id = nullptr;
|
||||
/**
|
||||
* @brief m_object Real object instance
|
||||
*/
|
||||
T* m_object;
|
||||
T* m_object = nullptr;
|
||||
|
||||
ScriptObjectType(ScriptInt* var, GameObject* object)
|
||||
: m_id(var), m_object(static_cast<T*>(object)) {
|
||||
@ -236,8 +236,8 @@ typedef std::vector<SCMOpcodeParameter> SCMParams;
|
||||
|
||||
class ScriptArguments {
|
||||
const SCMParams* parameters;
|
||||
SCMThread* thread;
|
||||
ScriptMachine* machine;
|
||||
SCMThread* thread = nullptr;
|
||||
ScriptMachine* machine = nullptr;
|
||||
|
||||
public:
|
||||
ScriptArguments(const SCMParams* p, SCMThread* t, ScriptMachine* m)
|
||||
|
@ -20,10 +20,7 @@ constexpr int kWindowWidth = 800;
|
||||
constexpr int kWindowHeight = 600;
|
||||
|
||||
GameBase::GameBase(Logger &inlog, int argc, char *argv[]) :
|
||||
log(inlog),
|
||||
config(),
|
||||
window(),
|
||||
options() {
|
||||
log(inlog) {
|
||||
log.info("Game", "Build: " + kBuildStr);
|
||||
|
||||
size_t w = kWindowWidth, h = kWindowHeight;
|
||||
|
@ -26,9 +26,9 @@ public:
|
||||
|
||||
protected:
|
||||
Logger& log;
|
||||
GameConfig config;
|
||||
GameWindow window;
|
||||
boost::program_options::variables_map options;
|
||||
GameConfig config{};
|
||||
GameWindow window{};
|
||||
boost::program_options::variables_map options{};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -10,12 +10,6 @@ namespace pt = boost::property_tree;
|
||||
|
||||
const std::string kConfigDirectoryName("OpenRW");
|
||||
|
||||
GameConfig::GameConfig()
|
||||
: m_configPath()
|
||||
, m_parseResult()
|
||||
, m_inputInvertY(false) {
|
||||
}
|
||||
|
||||
void GameConfig::loadFile(const rwfs::path &path) {
|
||||
m_configPath = path;
|
||||
std::string dummy;
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
/**
|
||||
* @brief GameConfig Create a game configuration (initially invalid)
|
||||
*/
|
||||
GameConfig();
|
||||
GameConfig() = default;
|
||||
|
||||
/**
|
||||
* @brief Initialize this object using the config file at path
|
||||
@ -252,8 +252,8 @@ private:
|
||||
ParseType destType, std::string &destination);
|
||||
|
||||
/* Config State */
|
||||
rwfs::path m_configPath;
|
||||
ParseResult m_parseResult;
|
||||
rwfs::path m_configPath{};
|
||||
ParseResult m_parseResult{};
|
||||
|
||||
/* Actual Configuration */
|
||||
|
||||
@ -264,14 +264,14 @@ private:
|
||||
std::string m_gameLanguage = "american";
|
||||
|
||||
/// Invert the y axis for camera control.
|
||||
bool m_inputInvertY;
|
||||
bool m_inputInvertY = false;
|
||||
|
||||
/// Size of the window
|
||||
int m_windowWidth;
|
||||
int m_windowHeight;
|
||||
int m_windowWidth{800};
|
||||
int m_windowHeight{600};
|
||||
|
||||
/// Set the window to fullscreen
|
||||
bool m_windowFullscreen;
|
||||
bool m_windowFullscreen = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,9 +1,6 @@
|
||||
#include "GameWindow.hpp"
|
||||
#include <core/Logger.hpp>
|
||||
|
||||
GameWindow::GameWindow() : window(nullptr), glcontext(nullptr) {
|
||||
}
|
||||
|
||||
void GameWindow::create(const std::string& title, size_t w, size_t h,
|
||||
bool fullscreen) {
|
||||
Uint32 style = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN;
|
||||
|
@ -8,12 +8,11 @@
|
||||
#include <render/GameRenderer.hpp>
|
||||
|
||||
class GameWindow {
|
||||
SDL_Window* window;
|
||||
SDL_Surface* icon;
|
||||
SDL_GLContext glcontext;
|
||||
|
||||
SDL_Window* window = nullptr;
|
||||
SDL_Surface* icon = nullptr;
|
||||
SDL_GLContext glcontext{nullptr};
|
||||
public:
|
||||
GameWindow();
|
||||
GameWindow() = default;
|
||||
|
||||
void create(const std::string& title, size_t w, size_t h, bool fullscreen);
|
||||
void close();
|
||||
|
@ -44,8 +44,7 @@ constexpr float kMaxPhysicsSubSteps = 2;
|
||||
RWGame::RWGame(Logger& log, int argc, char* argv[])
|
||||
: GameBase(log, argc, argv)
|
||||
, data(&log, config.getGameDataPath())
|
||||
, renderer(&log, &data)
|
||||
, lastDraws(0) {
|
||||
, renderer(&log, &data) {
|
||||
bool newgame = options.count("newgame");
|
||||
bool test = options.count("test");
|
||||
std::string startSave(
|
||||
|
@ -43,7 +43,7 @@ class RWGame : public GameBase {
|
||||
};
|
||||
|
||||
DebugViewMode debugview_ = DebugViewMode::Disabled;
|
||||
int lastDraws{}; /// Number of draws issued for the last frame.
|
||||
int lastDraws{0}; /// Number of draws issued for the last frame.
|
||||
|
||||
std::string cheatInputWindow = std::string(32, ' ');
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <iostream>
|
||||
|
||||
BenchmarkState::BenchmarkState(RWGame* game, const std::string& benchfile)
|
||||
: State(game), benchfile(benchfile), benchmarkTime(0.f), duration(0.f), frameCounter(0) {
|
||||
: State(game), benchfile(benchfile) {
|
||||
}
|
||||
|
||||
void BenchmarkState::enter() {
|
||||
|
@ -15,9 +15,9 @@ class BenchmarkState : public State {
|
||||
|
||||
std::string benchfile;
|
||||
|
||||
float benchmarkTime;
|
||||
float duration;
|
||||
uint32_t frameCounter;
|
||||
float benchmarkTime{0.f};
|
||||
float duration{0.f};
|
||||
uint32_t frameCounter{0};
|
||||
|
||||
public:
|
||||
BenchmarkState(RWGame* game, const std::string& benchfile);
|
||||
|
@ -33,13 +33,9 @@ constexpr float kVehicleCameraPitch =
|
||||
|
||||
IngameState::IngameState(RWGame* game, bool newgame, const std::string& save)
|
||||
: State(game)
|
||||
, started(false)
|
||||
, save(save)
|
||||
, newgame(newgame)
|
||||
, autolookTimer(0.f)
|
||||
, camMode(IngameState::CAMERA_NORMAL)
|
||||
, m_invertedY(game->getConfig().getInputInvertY())
|
||||
, m_vehicleFreeLook(true) {
|
||||
, m_invertedY(game->getConfig().getInputInvertY()) {
|
||||
}
|
||||
|
||||
void IngameState::startTest() {
|
||||
|
@ -16,21 +16,21 @@ class IngameState : public State {
|
||||
CAMERA_MAX
|
||||
};
|
||||
|
||||
bool started;
|
||||
bool started = false;
|
||||
std::string save;
|
||||
bool newgame;
|
||||
ViewCamera _look;
|
||||
ViewCamera _look{};
|
||||
glm::vec3 cameraPosition{};
|
||||
/** Timer to hold user camera position */
|
||||
float autolookTimer;
|
||||
CameraMode camMode;
|
||||
float autolookTimer{0.f};
|
||||
CameraMode camMode{IngameState::CAMERA_NORMAL};
|
||||
|
||||
/// Player camera input since the last update
|
||||
glm::vec2 cameradelta_{};
|
||||
/// Invert Y axis movement
|
||||
bool m_invertedY;
|
||||
/// Free look in vehicles.
|
||||
bool m_vehicleFreeLook;
|
||||
bool m_vehicleFreeLook = true;
|
||||
|
||||
float moneyTimer = 0.f; // Timer used to updated displayed money value
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user