Associated compile fixes. Some of these are dirty and temporary-ish.

This commit is contained in:
hispidence 2022-01-27 23:38:47 +00:00
parent 0834bf805f
commit cd9c3e7544
11 changed files with 104 additions and 39 deletions

View file

@ -14,15 +14,6 @@ static const std::unordered_map<std::string, WeatherType> kWeatherTypes
{"Snow", WeatherType::Snow}
};
enum LaraType
{
Normal = 1,
Young = 2,
Bunhead = 3,
Catsuit = 4,
Divesuit = 5,
Invisible = 7
};
static const std::unordered_map<std::string, LaraType> kLaraTypes
{
@ -50,15 +41,20 @@ struct GameScriptLevel : public ScriptInterfaceLevel
WeatherType Weather{ WeatherType::None };
float WeatherStrength{ 1.0f };
bool Rumble{ false };
LaraType LaraType{ LaraType::Normal };
LaraType Type{ LaraType::Normal };
GameScriptMirror Mirror;
int LevelFarView{ 0 };
bool UnlimitedAir{ false };
std::vector<GameScriptInventoryObject> InventoryObjects;
bool GetSkyLayerEnabled(int index) override;
short GetSkyLayerSpeed(int index) override;
float GetWeatherStrength() const override;
bool GetSkyLayerEnabled(int index) const override;
bool HasStorm() const override;
short GetSkyLayerSpeed(int index) const override;
RGBAColor8Byte GetSkyLayerColor(int index) const override;
LaraType GetLaraType() const override;
void SetWeatherStrength(float val);
void SetLevelFarView(byte val);
static void Register(sol::state* state);
WeatherType GetWeatherType() const override;
};

View file

@ -17,6 +17,7 @@ struct GameScriptSkyLayer
GameScriptSkyLayer() = default;
GameScriptSkyLayer(GameScriptColor const & col, short speed);
void SetColor(GameScriptColor const & col);
GameScriptColor GetColor() const;
static void Register(sol::state *);
};

View file

@ -1,4 +1,7 @@
#pragma once
class ScriptInterfaceLevel;
class ScriptInterfaceFlow {
public:
virtual ~ScriptInterfaceFlow() = default;
@ -13,5 +16,6 @@ public:
virtual bool HasMonkeyAutoJump() const = 0;
virtual bool HasOscillateHang() const = 0;
virtual bool HasAFKPose() const = 0;
virtual ScriptInterfaceLevel * GetLevel(int level) = 0;
};

View file

@ -1,5 +1,7 @@
#pragma once
#include "Specific/RGBAColor8Byte.h"
enum class WeatherType
{
None,
@ -7,10 +9,26 @@ enum class WeatherType
Snow
};
// todo make this a scoped enum
enum LaraType
{
Normal = 1,
Young = 2,
Bunhead = 3,
Catsuit = 4,
Divesuit = 5,
Invisible = 7
};
class ScriptInterfaceLevel {
public:
virtual ~ScriptInterfaceLevel() = default;
virtual bool GetSkyLayerEnabled(int index) = 0;
virtual short GetSkyLayerSpeed(int index) = 0;
virtual bool GetSkyLayerEnabled(int index) const = 0;
virtual short GetSkyLayerSpeed(int index) const = 0;
virtual LaraType GetLaraType() const = 0;
virtual bool HasStorm() const = 0;
virtual float GetWeatherStrength() const = 0;
virtual WeatherType GetWeatherType() const = 0;
virtual RGBAColor8Byte GetSkyLayerColor(int index) const = 0;
};

View file

@ -104,7 +104,7 @@ e.g. `myLevel.laraType = LaraType.Divesuit`
__(not yet fully implemented)__
@mem laraType*/
"laraType", &GameScriptLevel::LaraType,
"laraType", &GameScriptLevel::Type,
/// (bool) Enable occasional screen shake effect.
// As seen in TRC's Sinking Submarine.
@ -142,7 +142,7 @@ __(not yet implemented)__
}
//todo add bindings and documents for this
bool GameScriptLevel::GetSkyLayerEnabled(int index)
bool GameScriptLevel::GetSkyLayerEnabled(int index) const
{
bool cond = index == 0 || index == 1;
std::string msg{ "Index must be 0 or 1." };
@ -164,7 +164,7 @@ bool GameScriptLevel::GetSkyLayerEnabled(int index)
}
//todo add bindings and documents for this
short GameScriptLevel::GetSkyLayerSpeed(int index)
short GameScriptLevel::GetSkyLayerSpeed(int index) const
{
bool cond = index == 0 || index == 1;
std::string msg{ "Index must be 0 or 1." };
@ -214,3 +214,45 @@ void GameScriptLevel::SetLevelFarView(byte val)
LevelFarView = val;
}
}
// todo test this
RGBAColor8Byte GameScriptLevel::GetSkyLayerColor(int index) const
{
bool cond = index == 0 || index == 1;
std::string msg{ "Index must be 0 or 1." };
if (index == 0)
{
return Layer1.GetColor();
}
else if (index == 1)
{
return Layer2.GetColor();
}
else
{
ScriptAssert(false, msg);
ScriptWarn("Returning 0, 0, 0, 0.");
return RGBAColor8Byte{ 0 };
}
}
LaraType GameScriptLevel::GetLaraType() const
{
return Type;
}
bool GameScriptLevel::HasStorm() const
{
return Storm;
}
float GameScriptLevel::GetWeatherStrength() const
{
return WeatherStrength;
}
WeatherType GameScriptLevel::GetWeatherType() const
{
return Weather;
}

View file

@ -51,3 +51,7 @@ void GameScriptSkyLayer::SetColor(GameScriptColor const & col)
B = col.GetB();
}
//todo can this return an RGBAColor8Byte instead?
GameScriptColor GameScriptSkyLayer::GetColor() const {
return GameScriptColor{ R, G, B };
}