TombEngine/Scripting/Source/GameScriptFog.cpp

57 lines
1.1 KiB
C++
Raw Normal View History

2021-11-22 16:16:58 +01:00
#include "framework.h"
#include "GameScriptFog.h"
2021-11-23 09:10:07 +01:00
/*** Describes a layer of moving clouds.
As seen in TR4's City of the Dead.
2021-11-22 16:16:58 +01:00
2021-11-23 09:10:07 +01:00
@pregameclass SkyLayer
2021-11-22 16:16:58 +01:00
@pragma nostrip
*/
2021-11-23 09:10:07 +01:00
void GameScriptFog::Register(sol::state* lua)
2021-11-22 16:16:58 +01:00
{
2021-11-23 09:10:07 +01:00
lua->new_usertype<GameScriptFog>("Fog",
sol::constructors<GameScriptFog(GameScriptColor const&, short, short)>(),
/// (@{Color}) RGB sky color
//@mem color
"color", sol::property(&GameScriptFog::SetColor),
/*** (int) min distance.
2021-11-22 16:16:58 +01:00
2021-11-23 09:10:07 +01:00
This is the distance at which the fog starts
2021-11-22 16:16:58 +01:00
2021-11-23 09:10:07 +01:00
@mem minDistance*/
"minDistance", &GameScriptFog::MinDistance,
2021-11-22 16:16:58 +01:00
2021-11-23 09:10:07 +01:00
/*** (int) max distance.
2021-11-22 16:16:58 +01:00
2021-11-23 09:10:07 +01:00
This is the distance at which the fog reaches the maximum strength
2021-11-22 16:16:58 +01:00
2021-11-23 09:10:07 +01:00
@mem maxDistance*/
"maxDistance", & GameScriptFog::MaxDistance
2021-11-22 16:16:58 +01:00
);
}
/***
2021-11-23 09:10:07 +01:00
@tparam Color color RGB color
@tparam int speed cloud speed
@return A SkyLayer object.
@function SkyLayer.new
2021-11-22 16:16:58 +01:00
*/
2021-11-23 09:10:07 +01:00
GameScriptFog::GameScriptFog(GameScriptColor const& col, short minDistance, short maxDistance)
2021-11-22 16:16:58 +01:00
{
2021-11-23 09:10:07 +01:00
SetColor(col);
MinDistance = minDistance;
MaxDistance = maxDistance;
Enabled = true;
2021-11-22 16:16:58 +01:00
}
2021-11-23 09:10:07 +01:00
void GameScriptFog::SetColor(GameScriptColor const& col)
2021-11-22 16:16:58 +01:00
{
2021-11-23 09:10:07 +01:00
R = col.GetR();
G = col.GetG();
B = col.GetB();
2021-11-22 16:16:58 +01:00
}