mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-01 01:08:01 +03:00

Inherit from LuaHandler. Remove the SCRIPT.DAT-related code. Add m_translationsMap which stores strings by key and holds a vector with their translations. The index of a translation corresponds with the index of the language in m_languageNames; e.g. if Italian is at index 2 in m_languageNames, then the Italian translation of a string will be at index 2 in the vector. See GameFlow:SetStrings in English.lua. Add m_languageNames which stores a vector of language names. See GameFlow:SetLanguageNames in English.lua. Add WriteDefaults and AddTracks, which is there for data which isn't in Lua scripts yet. It will be removed in the future. Add AddLevel, which corresponds with GameFlow:AddLevel in Gameflow.lua. Add LoadGameFlowScript, which loads (for now) Gameflow.lua and English.lua. Add GetLang, which is to load the old-style strings and which will be removed when the switch to new strings is complete.
200 lines
No EOL
3.8 KiB
C++
200 lines
No EOL
3.8 KiB
C++
#pragma once
|
|
#include "LanguageScript.h"
|
|
#include "LuaHandler.h"
|
|
|
|
#define TITLE_FLYBY 0
|
|
#define TITLE_BACKGROUND 1
|
|
|
|
typedef enum WEATHER_TYPES
|
|
{
|
|
WEATHER_NORMAL,
|
|
WEATHER_RAIN,
|
|
WEATHER_SNOW
|
|
};
|
|
|
|
typedef enum LARA_DRAW_TYPE
|
|
{
|
|
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;
|
|
};
|
|
|
|
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 GameScriptFog
|
|
{
|
|
byte R;
|
|
byte G;
|
|
byte B;
|
|
|
|
GameScriptFog()
|
|
{
|
|
|
|
}
|
|
|
|
GameScriptFog(byte r, byte g, byte b)
|
|
{
|
|
R = r;
|
|
G = g;
|
|
B = b;
|
|
}
|
|
};
|
|
|
|
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
|
|
{
|
|
int NameStringIndex;
|
|
std::string FileName;
|
|
std::string ScriptFileName;
|
|
std::string LoadScreenFileName;
|
|
std::string Background;
|
|
int Name;
|
|
int Soundtrack;
|
|
GameScriptSkyLayer Layer1;
|
|
GameScriptSkyLayer Layer2;
|
|
bool Horizon;
|
|
bool Sky;
|
|
bool ColAddHorizon;
|
|
GameScriptFog Fog;
|
|
bool Storm;
|
|
WEATHER_TYPES Weather;
|
|
bool ResetHub;
|
|
bool Rumble;
|
|
LARA_DRAW_TYPE LaraType;
|
|
GameScriptMirror Mirror;
|
|
byte UVRotate;
|
|
int LevelFarView;
|
|
bool UnlimitedAir;
|
|
|
|
GameScriptLevel()
|
|
{
|
|
Storm = false;
|
|
Horizon = false;
|
|
ColAddHorizon = false;
|
|
ResetHub = false;
|
|
Rumble = false;
|
|
Weather = WEATHER_NORMAL;
|
|
LaraType = LARA_NORMAL;
|
|
UnlimitedAir = false;
|
|
}
|
|
};
|
|
|
|
bool __cdecl LoadScript();
|
|
|
|
class GameFlow : public LuaHandler
|
|
{
|
|
private:
|
|
GameScriptSettings m_settings;
|
|
|
|
std::unordered_map < std::string, std::vector<std::string > > m_translationsMap;
|
|
std::vector<std::string> m_languageNames;
|
|
|
|
std::map<short, short> m_itemsMap;
|
|
|
|
public:
|
|
Vector3 SkyColorLayer1;
|
|
int SkySpeedLayer1;
|
|
Vector3 SkyColorLayer2;
|
|
int SkySpeedLayer2;
|
|
Vector3 FogColor;
|
|
int FogInDistance;
|
|
int FogOutDistance;
|
|
bool DrawHorizon;
|
|
bool ColAddHorizon;
|
|
int SelectedLevelForNewGame;
|
|
int SelectedSaveGame;
|
|
bool EnableLoadSave;
|
|
bool PlayAnyLevel;
|
|
bool FlyCheat;
|
|
bool DebugMode;
|
|
int LevelFarView;
|
|
int TitleType;
|
|
char* Intro;
|
|
|
|
// Selected language set
|
|
LanguageScript* CurrentStrings;
|
|
std::vector<LanguageScript*> Strings;
|
|
std::vector<GameScriptLevel*> Levels;
|
|
|
|
GameFlow(sol::state* lua);
|
|
~GameFlow();
|
|
|
|
void WriteDefaults();
|
|
void AddLevel(GameScriptLevel const& level);
|
|
void AddTracks();
|
|
bool LoadGameFlowScript();
|
|
char* GetString(int id);
|
|
auto GetLang() -> decltype(std::ref(Strings[0]->Strings));
|
|
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);
|
|
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);
|
|
int GetNumLevels();
|
|
bool DoGameflow();
|
|
}; |