mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 20:46:47 +03:00
Clean up GameFlowScript.
Remove a lot of members which were unused and which represented level properties already accounted for in GameScriptLevel. Make TITLE_TYPE an enum class and relabel its values. Add TitleScreenImagePath and SetTitleScreenImagePath, which replaces GameScriptLevel's Background member. Register GameScriptColor in GameFlowScript since we will be using it for the fog and sky layer properties of levels.
This commit is contained in:
parent
d60a86b9b8
commit
f4ef0dc468
2 changed files with 21 additions and 57 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "AudioTracks.h"
|
#include "AudioTracks.h"
|
||||||
|
#include "GameScriptColor.h"
|
||||||
#include "ScriptAssert.h"
|
#include "ScriptAssert.h"
|
||||||
#include <Objects/objectslist.h>
|
#include <Objects/objectslist.h>
|
||||||
#include <Game/newinv2.h>
|
#include <Game/newinv2.h>
|
||||||
|
@ -35,6 +36,7 @@ GameFlow::GameFlow(sol::state* lua) : LuaHandler{ lua }
|
||||||
GameScriptInventoryObject::Register(m_lua);
|
GameScriptInventoryObject::Register(m_lua);
|
||||||
GameScriptSettings::Register(m_lua);
|
GameScriptSettings::Register(m_lua);
|
||||||
GameScriptAudioTrack::Register(m_lua);
|
GameScriptAudioTrack::Register(m_lua);
|
||||||
|
GameScriptColor::Register(m_lua);
|
||||||
|
|
||||||
/***
|
/***
|
||||||
Add a level to the gameflow.
|
Add a level to the gameflow.
|
||||||
|
@ -43,12 +45,19 @@ Add a level to the gameflow.
|
||||||
*/
|
*/
|
||||||
m_lua->set_function("AddLevel", &GameFlow::AddLevel, this);
|
m_lua->set_function("AddLevel", &GameFlow::AddLevel, this);
|
||||||
|
|
||||||
/***
|
/*** The path of the .jpg or .png image to show when loading the game.
|
||||||
@function SetIntroImagePath
|
@function SetIntroImagePath
|
||||||
@tparam string path the path to the image, relative to the TombEngine exe
|
@tparam string path the path to the image, relative to the TombEngine exe
|
||||||
*/
|
*/
|
||||||
m_lua->set_function("SetIntroImagePath", &GameFlow::SetIntroImagePath, this);
|
m_lua->set_function("SetIntroImagePath", &GameFlow::SetIntroImagePath, this);
|
||||||
|
|
||||||
|
/*** The path of the .jpg or .png image to show in the background of the title screen.
|
||||||
|
__(not yet implemented)__
|
||||||
|
@function SetTitleScreenImagePath
|
||||||
|
@tparam string path the path to the image, relative to the TombEngine exe
|
||||||
|
*/
|
||||||
|
m_lua->set_function("SetTitleScreenImagePath", &GameFlow::SetTitleScreenImagePath, this);
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@function SetAudioTracks
|
@function SetAudioTracks
|
||||||
@tparam table table array-style table with @{AudioTrack} objects
|
@tparam table table array-style table with @{AudioTrack} objects
|
||||||
|
@ -107,6 +116,11 @@ void GameFlow::SetIntroImagePath(std::string const& path)
|
||||||
IntroImagePath = path;
|
IntroImagePath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameFlow::SetTitleScreenImagePath(std::string const& path)
|
||||||
|
{
|
||||||
|
TitleScreenImagePath = path;
|
||||||
|
}
|
||||||
|
|
||||||
void GameFlow::SetAudioTracks(sol::as_table_t<std::vector<GameScriptAudioTrack>>&& src)
|
void GameFlow::SetAudioTracks(sol::as_table_t<std::vector<GameScriptAudioTrack>>&& src)
|
||||||
{
|
{
|
||||||
std::vector<GameScriptAudioTrack> tracks = std::move(src);
|
std::vector<GameScriptAudioTrack> tracks = std::move(src);
|
||||||
|
@ -148,47 +162,6 @@ GameScriptLevel* GameFlow::GetLevel(int id)
|
||||||
return Levels[id];
|
return Levels[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameFlow::SetHorizon(bool horizon, bool colAddHorizon)
|
|
||||||
{
|
|
||||||
DrawHorizon = horizon;
|
|
||||||
ColAddHorizon = colAddHorizon;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameFlow::SetLayer1(byte r, byte g, byte b, short speed)
|
|
||||||
{
|
|
||||||
SkyColor1.r = r;
|
|
||||||
SkyColor1.g = g;
|
|
||||||
SkyColor1.b = b;
|
|
||||||
SkyVelocity1 = speed;
|
|
||||||
|
|
||||||
SkyColorLayer1.x = r / 255.0f;
|
|
||||||
SkyColorLayer1.y = g / 255.0f;
|
|
||||||
SkyColorLayer1.z = b / 255.0f;
|
|
||||||
SkySpeedLayer1 = speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameFlow::SetLayer2(byte r, byte g, byte b, short speed)
|
|
||||||
{
|
|
||||||
SkyColor2.r = r;
|
|
||||||
SkyColor2.g = g;
|
|
||||||
SkyColor2.b = b;
|
|
||||||
SkyVelocity2 = speed;
|
|
||||||
|
|
||||||
SkyColorLayer2.x = r / 255.0f;
|
|
||||||
SkyColorLayer2.y = g / 255.0f;
|
|
||||||
SkyColorLayer2.z = b / 255.0f;
|
|
||||||
SkySpeedLayer2 = speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameFlow::SetFog(byte r, byte g, byte b, short startDistance, short endDistance)
|
|
||||||
{
|
|
||||||
FogColor.x = r / 255.0f;
|
|
||||||
FogColor.y = g / 255.0f;
|
|
||||||
FogColor.z = b / 255.0f;
|
|
||||||
FogInDistance = startDistance;
|
|
||||||
FogOutDistance = endDistance;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GameFlow::GetNumLevels()
|
int GameFlow::GetNumLevels()
|
||||||
{
|
{
|
||||||
return Levels.size();
|
return Levels.size();
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
#include "GameScriptSettings.h"
|
#include "GameScriptSettings.h"
|
||||||
#include "GameScriptAudioTrack.h"
|
#include "GameScriptAudioTrack.h"
|
||||||
|
|
||||||
enum TITLE_TYPE
|
enum class TITLE_TYPE
|
||||||
{
|
{
|
||||||
TITLE_FLYBY,
|
FLYBY,
|
||||||
TITLE_BACKGROUND
|
BACKGROUND
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameFlow : public LuaHandler
|
class GameFlow : public LuaHandler
|
||||||
|
@ -23,15 +23,8 @@ private:
|
||||||
std::map<short, short> m_itemsMap;
|
std::map<short, short> m_itemsMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Vector3 SkyColorLayer1{};
|
|
||||||
Vector3 SkyColorLayer2{};
|
|
||||||
Vector3 FogColor{};
|
|
||||||
int SkySpeedLayer1{ 0 };
|
|
||||||
int SkySpeedLayer2{ 0 };
|
|
||||||
int FogInDistance{ 0 };
|
int FogInDistance{ 0 };
|
||||||
int FogOutDistance{ 0 };
|
int FogOutDistance{ 0 };
|
||||||
bool DrawHorizon{ false };
|
|
||||||
bool ColAddHorizon{ false };
|
|
||||||
int SelectedLevelForNewGame{ 0 };
|
int SelectedLevelForNewGame{ 0 };
|
||||||
int SelectedSaveGame{ 0 };
|
int SelectedSaveGame{ 0 };
|
||||||
bool EnableLoadSave{ true };
|
bool EnableLoadSave{ true };
|
||||||
|
@ -39,8 +32,9 @@ public:
|
||||||
bool FlyCheat{ true };
|
bool FlyCheat{ true };
|
||||||
bool DebugMode{ false };
|
bool DebugMode{ false };
|
||||||
int LevelFarView{ 0 };
|
int LevelFarView{ 0 };
|
||||||
TITLE_TYPE TitleType{ TITLE_FLYBY };
|
TITLE_TYPE TitleType{ TITLE_TYPE::FLYBY };
|
||||||
std::string IntroImagePath{};
|
std::string IntroImagePath{};
|
||||||
|
std::string TitleScreenImagePath{};
|
||||||
|
|
||||||
// Selected language set
|
// Selected language set
|
||||||
std::vector<GameScriptLevel*> Levels;
|
std::vector<GameScriptLevel*> Levels;
|
||||||
|
@ -57,11 +51,8 @@ public:
|
||||||
void SetSettings(GameScriptSettings const & src);
|
void SetSettings(GameScriptSettings const & src);
|
||||||
GameScriptSettings* GetSettings();
|
GameScriptSettings* GetSettings();
|
||||||
GameScriptLevel* GetLevel(int id);
|
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();
|
int GetNumLevels();
|
||||||
bool DoGameflow();
|
bool DoGameflow();
|
||||||
void SetIntroImagePath(std::string const& path);
|
void SetIntroImagePath(std::string const& path);
|
||||||
|
void SetTitleScreenImagePath(std::string const& path);
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue