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