Clean up GameFlow and GameScriptLevel by adding default member initialisers. Replace GameScriptFog with GameScriptColor. Rename some enums for consistency. Make TITLE_TYPE and enum for consistency.

This commit is contained in:
hispidence 2021-07-26 18:23:29 +01:00
parent 831a0f7e8e
commit b94cc960a2
2 changed files with 33 additions and 74 deletions

View file

@ -54,14 +54,6 @@ GameFlow::GameFlow(sol::state* lua) : LuaHandler{ lua }
"endZ", &GameScriptMirror::EndZ "endZ", &GameScriptMirror::EndZ
); );
// Fog type
m_lua->new_usertype<GameScriptFog>("Fog",
sol::constructors<GameScriptFog(byte, byte, byte)>(),
"r", &GameScriptFog::R,
"g", &GameScriptFog::G,
"b", &GameScriptFog::B
);
// Inventory object type // Inventory object type
m_lua->new_usertype<GameScriptInventoryObject>("InventoryObject", m_lua->new_usertype<GameScriptInventoryObject>("InventoryObject",
sol::constructors<GameScriptInventoryObject(std::string, short, float, float, float, float, float, short, int, __int64)>(), sol::constructors<GameScriptInventoryObject(std::string, short, float, float, float, float, float, short, int, __int64)>(),
@ -140,11 +132,6 @@ void GameFlow::SetStrings(sol::nested<std::unordered_map<std::string, std::vecto
void GameFlow::WriteDefaults() void GameFlow::WriteDefaults()
{ {
Intro = "SCREENS\\MAIN.PNG"; Intro = "SCREENS\\MAIN.PNG";
EnableLoadSave = true;
PlayAnyLevel = true;
FlyCheat = true;
DebugMode = false;
LevelFarView = 0;
} }
void GameFlow::AddLevel(GameScriptLevel const& level) void GameFlow::AddLevel(GameScriptLevel const& level)

View file

@ -2,10 +2,13 @@
#include "LanguageScript.h" #include "LanguageScript.h"
#include "LuaHandler.h" #include "LuaHandler.h"
#define TITLE_FLYBY 0 enum TITLE_TYPE
#define TITLE_BACKGROUND 1 {
TITLE_FLYBY,
TITLE_BACKGROUND
};
enum WEATHER_TYPES enum WEATHER_TYPE
{ {
WEATHER_NORMAL, WEATHER_NORMAL,
WEATHER_RAIN, WEATHER_RAIN,
@ -88,25 +91,6 @@ struct GameScriptSkyLayer
} }
}; };
struct GameScriptFog
{
byte R;
byte G;
byte B;
GameScriptFog()
{
}
GameScriptFog(byte r, byte g, byte b)
{
R = r;
G = g;
B = b;
}
};
struct GameScriptMirror struct GameScriptMirror
{ {
short Room; short Room;
@ -142,32 +126,20 @@ struct GameScriptLevel
std::string AmbientTrack; std::string AmbientTrack;
GameScriptSkyLayer Layer1; GameScriptSkyLayer Layer1;
GameScriptSkyLayer Layer2; GameScriptSkyLayer Layer2;
bool Horizon; bool Horizon{ false };
bool Sky; bool Sky;
bool ColAddHorizon; bool ColAddHorizon{ false };
GameScriptFog Fog; GameScriptColor Fog{ 0,0,0 };
bool Storm; bool Storm{ false };
WEATHER_TYPES Weather; WEATHER_TYPE Weather{ WEATHER_NORMAL };
bool ResetHub; bool ResetHub{ false };
bool Rumble; bool Rumble{ false };
LARA_DRAW_TYPE LaraType; LARA_DRAW_TYPE LaraType{ LARA_NORMAL };
GameScriptMirror Mirror; GameScriptMirror Mirror;
byte UVRotate; byte UVRotate;
int LevelFarView; int LevelFarView;
bool UnlimitedAir; bool UnlimitedAir{ false };
std::vector<GameScriptInventoryObject> InventoryObjects; std::vector<GameScriptInventoryObject> InventoryObjects;
GameScriptLevel()
{
Storm = false;
Horizon = false;
ColAddHorizon = false;
ResetHub = false;
Rumble = false;
Weather = WEATHER_NORMAL;
LaraType = LARA_NORMAL;
UnlimitedAir = false;
}
}; };
struct GameScriptAudioTrack struct GameScriptAudioTrack
@ -195,24 +167,24 @@ private:
std::map<short, short> m_itemsMap; std::map<short, short> m_itemsMap;
public: public:
Vector3 SkyColorLayer1; Vector3 SkyColorLayer1{};
int SkySpeedLayer1; Vector3 SkyColorLayer2{};
Vector3 SkyColorLayer2; Vector3 FogColor{};
int SkySpeedLayer2; int SkySpeedLayer1{ 0 };
Vector3 FogColor; int SkySpeedLayer2{ 0 };
int FogInDistance; int FogInDistance{ 0 };
int FogOutDistance; int FogOutDistance{ 0 };
bool DrawHorizon; bool DrawHorizon{ false };
bool ColAddHorizon; bool ColAddHorizon{ false };
int SelectedLevelForNewGame; int SelectedLevelForNewGame{ 0 };
int SelectedSaveGame; int SelectedSaveGame{ 0 };
bool EnableLoadSave; bool EnableLoadSave{ true };
bool PlayAnyLevel; bool PlayAnyLevel{ true };
bool FlyCheat; bool FlyCheat{ true };
bool DebugMode; bool DebugMode{ false };
int LevelFarView; int LevelFarView{ 0 };
int TitleType; TITLE_TYPE TitleType{ TITLE_BACKGROUND };
char const * Intro; char const* Intro{ nullptr };
// Selected language set // Selected language set
std::vector<GameScriptLevel*> Levels; std::vector<GameScriptLevel*> Levels;