2020-12-21 13:16:29 -03:00
|
|
|
#pragma once
|
|
|
|
#include "LanguageScript.h"
|
2021-06-16 14:51:58 +01:00
|
|
|
#include "LuaHandler.h"
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-07-26 18:23:29 +01:00
|
|
|
enum TITLE_TYPE
|
|
|
|
{
|
|
|
|
TITLE_FLYBY,
|
|
|
|
TITLE_BACKGROUND
|
|
|
|
};
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-07-26 18:23:29 +01:00
|
|
|
enum WEATHER_TYPE
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
WEATHER_NORMAL,
|
|
|
|
WEATHER_RAIN,
|
|
|
|
WEATHER_SNOW
|
|
|
|
};
|
|
|
|
|
2021-07-18 15:22:15 +01:00
|
|
|
enum LARA_DRAW_TYPE
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
LARA_NORMAL = 1,
|
|
|
|
LARA_YOUNG = 2,
|
|
|
|
LARA_BUNHEAD = 3,
|
|
|
|
LARA_CATSUIT = 4,
|
|
|
|
LARA_DIVESUIT = 5,
|
|
|
|
LARA_INVISIBLE = 7
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GameScriptSettings
|
|
|
|
{
|
|
|
|
int ScreenWidth;
|
|
|
|
int ScreenHeight;
|
|
|
|
bool EnableLoadSave;
|
|
|
|
bool EnableDynamicShadows;
|
|
|
|
bool EnableWaterCaustics;
|
|
|
|
bool Windowed;
|
|
|
|
std::string WindowTitle;
|
|
|
|
int DrawingDistance;
|
|
|
|
bool ShowRendererSteps;
|
|
|
|
bool ShowDebugInfo;
|
|
|
|
};
|
|
|
|
|
2021-06-23 05:58:24 +02:00
|
|
|
struct GameScriptInventoryObject
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
short slot;
|
|
|
|
float yOffset;
|
|
|
|
float scale;
|
|
|
|
float xRot;
|
|
|
|
float yRot;
|
|
|
|
float zRot;
|
|
|
|
short rotationFlags;
|
|
|
|
int meshBits;
|
|
|
|
__int64 operation;
|
|
|
|
|
|
|
|
GameScriptInventoryObject(std::string name, short slot, float yOffset, float scale, float xRot, float yRot, float zRot, short rotationFlags, int meshBits, __int64 operation)
|
|
|
|
{
|
|
|
|
this->name = name;
|
|
|
|
this->slot = slot;
|
|
|
|
this->yOffset = yOffset;
|
|
|
|
this->scale = scale;
|
|
|
|
this->xRot = xRot;
|
|
|
|
this->yRot = yRot;
|
|
|
|
this->zRot = zRot;
|
|
|
|
this->rotationFlags = rotationFlags;
|
|
|
|
this->meshBits = meshBits;
|
|
|
|
this->operation = operation;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
struct GameScriptSkyLayer
|
|
|
|
{
|
|
|
|
bool Enabled;
|
|
|
|
byte R;
|
|
|
|
byte G;
|
|
|
|
byte B;
|
|
|
|
short CloudSpeed;
|
|
|
|
|
|
|
|
GameScriptSkyLayer()
|
|
|
|
{
|
|
|
|
Enabled = false;
|
|
|
|
R = G = B = CloudSpeed = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
GameScriptSkyLayer(byte r, byte g, byte b, short speed)
|
|
|
|
{
|
|
|
|
R = r;
|
|
|
|
G = g;
|
|
|
|
B = b;
|
|
|
|
CloudSpeed = speed;
|
|
|
|
Enabled = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GameScriptMirror
|
|
|
|
{
|
|
|
|
short Room;
|
|
|
|
int StartX;
|
|
|
|
int EndX;
|
|
|
|
int StartZ;
|
|
|
|
int EndZ;
|
|
|
|
|
|
|
|
GameScriptMirror()
|
|
|
|
{
|
|
|
|
Room = -1;
|
|
|
|
StartX = EndX = StartZ = EndZ = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
GameScriptMirror(short room, int startX, int endX, int startZ, int endZ)
|
|
|
|
{
|
|
|
|
Room = room;
|
|
|
|
StartX = startX;
|
|
|
|
EndX = endX;
|
|
|
|
StartZ = startZ;
|
|
|
|
EndZ = endZ;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GameScriptLevel
|
|
|
|
{
|
2021-06-19 07:11:22 +02:00
|
|
|
std::string NameStringKey;
|
2020-12-21 13:16:29 -03:00
|
|
|
std::string FileName;
|
|
|
|
std::string ScriptFileName;
|
|
|
|
std::string LoadScreenFileName;
|
|
|
|
std::string Background;
|
|
|
|
int Name;
|
2021-06-26 07:36:54 +02:00
|
|
|
std::string AmbientTrack;
|
2020-12-21 13:16:29 -03:00
|
|
|
GameScriptSkyLayer Layer1;
|
|
|
|
GameScriptSkyLayer Layer2;
|
2021-07-26 18:23:29 +01:00
|
|
|
bool Horizon{ false };
|
2020-12-21 13:16:29 -03:00
|
|
|
bool Sky;
|
2021-07-26 18:23:29 +01:00
|
|
|
bool ColAddHorizon{ false };
|
|
|
|
GameScriptColor Fog{ 0,0,0 };
|
|
|
|
bool Storm{ false };
|
|
|
|
WEATHER_TYPE Weather{ WEATHER_NORMAL };
|
|
|
|
bool ResetHub{ false };
|
|
|
|
bool Rumble{ false };
|
|
|
|
LARA_DRAW_TYPE LaraType{ LARA_NORMAL };
|
2020-12-21 13:16:29 -03:00
|
|
|
GameScriptMirror Mirror;
|
|
|
|
byte UVRotate;
|
|
|
|
int LevelFarView;
|
2021-07-26 18:23:29 +01:00
|
|
|
bool UnlimitedAir{ false };
|
2021-06-23 05:58:24 +02:00
|
|
|
std::vector<GameScriptInventoryObject> InventoryObjects;
|
2020-12-21 13:16:29 -03:00
|
|
|
};
|
|
|
|
|
2021-06-26 07:36:54 +02:00
|
|
|
struct GameScriptAudioTrack
|
|
|
|
{
|
|
|
|
std::string trackName;
|
|
|
|
bool looped;
|
|
|
|
|
|
|
|
GameScriptAudioTrack(std::string trackName, bool looped)
|
|
|
|
{
|
|
|
|
this->trackName = trackName;
|
|
|
|
this->looped = looped;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
bool __cdecl LoadScript();
|
|
|
|
|
2021-06-16 14:51:58 +01:00
|
|
|
class GameFlow : public LuaHandler
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
GameScriptSettings m_settings;
|
2021-06-16 14:51:58 +01:00
|
|
|
|
|
|
|
std::unordered_map < std::string, std::vector<std::string > > m_translationsMap;
|
|
|
|
std::vector<std::string> m_languageNames;
|
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
std::map<short, short> m_itemsMap;
|
|
|
|
|
|
|
|
public:
|
2021-07-26 18:23:29 +01:00
|
|
|
Vector3 SkyColorLayer1{};
|
|
|
|
Vector3 SkyColorLayer2{};
|
|
|
|
Vector3 FogColor{};
|
|
|
|
int SkySpeedLayer1{ 0 };
|
|
|
|
int SkySpeedLayer2{ 0 };
|
|
|
|
int FogInDistance{ 0 };
|
|
|
|
int FogOutDistance{ 0 };
|
|
|
|
bool DrawHorizon{ false };
|
|
|
|
bool ColAddHorizon{ false };
|
|
|
|
int SelectedLevelForNewGame{ 0 };
|
|
|
|
int SelectedSaveGame{ 0 };
|
|
|
|
bool EnableLoadSave{ true };
|
|
|
|
bool PlayAnyLevel{ true };
|
|
|
|
bool FlyCheat{ true };
|
|
|
|
bool DebugMode{ false };
|
|
|
|
int LevelFarView{ 0 };
|
|
|
|
TITLE_TYPE TitleType{ TITLE_BACKGROUND };
|
|
|
|
char const* Intro{ nullptr };
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
// Selected language set
|
|
|
|
std::vector<GameScriptLevel*> Levels;
|
|
|
|
|
|
|
|
GameFlow(sol::state* lua);
|
|
|
|
~GameFlow();
|
|
|
|
|
2021-06-16 14:51:58 +01:00
|
|
|
void WriteDefaults();
|
|
|
|
void AddLevel(GameScriptLevel const& level);
|
2021-06-26 07:36:54 +02:00
|
|
|
void SetAudioTracks(sol::as_table_t<std::vector<GameScriptAudioTrack>>&& src);
|
2021-06-16 14:51:58 +01:00
|
|
|
bool LoadGameFlowScript();
|
2021-07-23 21:48:49 +01:00
|
|
|
char const * GetString(const char* id);
|
2021-06-16 14:51:58 +01:00
|
|
|
void SetStrings(sol::nested<std::unordered_map<std::string, std::vector<std::string>>> && src);
|
|
|
|
void SetLanguageNames(sol::as_table_t<std::vector<std::string>> && src);
|
2020-12-21 13:16:29 -03:00
|
|
|
GameScriptSettings* GetSettings();
|
|
|
|
GameScriptLevel* GetLevel(int id);
|
|
|
|
void SetHorizon(bool horizon, bool colAddHorizon);
|
|
|
|
void SetLayer1(byte r, byte g, byte b, short speed);
|
|
|
|
void SetLayer2(byte r, byte g, byte b, short speed);
|
|
|
|
void SetFog(byte r, byte g, byte b, short startDistance, short endDistance);
|
2021-06-16 14:51:58 +01:00
|
|
|
int GetNumLevels();
|
2020-12-21 13:16:29 -03:00
|
|
|
bool DoGameflow();
|
2018-09-02 09:29:36 +02:00
|
|
|
};
|