2021-12-04 21:15:26 +00:00
|
|
|
#include "frameworkandsol.h"
|
2021-07-28 18:44:24 +01:00
|
|
|
#include "GameScriptSkyLayer.h"
|
2021-11-25 23:34:02 +00:00
|
|
|
|
2021-08-23 19:16:24 +01:00
|
|
|
/*** Describes a layer of moving clouds.
|
|
|
|
As seen in TR4's City of the Dead.
|
2021-08-07 19:06:22 +01:00
|
|
|
|
2021-08-23 19:16:24 +01:00
|
|
|
@pregameclass SkyLayer
|
2021-08-07 19:06:22 +01:00
|
|
|
@pragma nostrip
|
|
|
|
*/
|
2021-07-28 18:44:24 +01:00
|
|
|
|
|
|
|
void GameScriptSkyLayer::Register(sol::state* lua)
|
|
|
|
{
|
|
|
|
lua->new_usertype<GameScriptSkyLayer>("SkyLayer",
|
2021-08-07 19:06:22 +01:00
|
|
|
sol::constructors<GameScriptSkyLayer(GameScriptColor const &, short)>(),
|
2021-08-09 00:54:09 +01:00
|
|
|
|
2021-08-07 19:06:22 +01:00
|
|
|
/// (@{Color}) RGB sky color
|
|
|
|
//@mem color
|
|
|
|
"color", sol::property(&GameScriptSkyLayer::SetColor),
|
|
|
|
|
|
|
|
/*** (int) cloud speed.
|
|
|
|
|
|
|
|
Values can be between [-32768, 32767], with positive numbers resulting in a sky that scrolls from
|
|
|
|
west to east, and negative numbers resulting in one that travels east to west.
|
|
|
|
|
|
|
|
Please note that speeds outside of the range of about [-1000, 1000] will cause the
|
|
|
|
sky to scroll so fast that it will no longer appear as a coherent stream of clouds.
|
|
|
|
Less is more. City of The Dead, for example, uses a speed value of 16.
|
|
|
|
|
|
|
|
@mem speed*/
|
2021-07-28 18:44:24 +01:00
|
|
|
"speed", &GameScriptSkyLayer::CloudSpeed
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-08-07 19:06:22 +01:00
|
|
|
/***
|
|
|
|
@tparam Color color RGB color
|
|
|
|
@tparam int speed cloud speed
|
|
|
|
@return A SkyLayer object.
|
|
|
|
@function SkyLayer.new
|
|
|
|
*/
|
|
|
|
GameScriptSkyLayer::GameScriptSkyLayer(GameScriptColor const& col, short speed)
|
|
|
|
{
|
2021-08-09 00:54:09 +01:00
|
|
|
SetColor(col);
|
2021-08-07 19:06:22 +01:00
|
|
|
CloudSpeed = speed;
|
|
|
|
Enabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameScriptSkyLayer::SetColor(GameScriptColor const & col)
|
|
|
|
{
|
|
|
|
R = col.GetR();
|
|
|
|
G = col.GetG();
|
|
|
|
B = col.GetB();
|
|
|
|
}
|
|
|
|
|