1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-26 18:21:04 +00:00

Add clouds API

This commit is contained in:
Ben Deutsch 2017-03-17 10:39:47 +01:00 committed by paramat
parent 95409da87d
commit f1d7a26b7c
17 changed files with 357 additions and 50 deletions

View file

@ -108,7 +108,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
{ "TOCLIENT_LOCAL_PLAYER_ANIMATIONS", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_LocalPlayerAnimations }, // 0x51
{ "TOCLIENT_EYE_OFFSET", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_EyeOffset }, // 0x52
{ "TOCLIENT_DELETE_PARTICLESPAWNER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_DeleteParticleSpawner }, // 0x53
null_command_handler,
{ "TOCLIENT_CLOUD_PARAMS", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_CloudParams }, // 0x54
null_command_handler,
null_command_handler,
null_command_handler,

View file

@ -1168,6 +1168,34 @@ void Client::handleCommand_HudSetSky(NetworkPacket* pkt)
m_client_event_queue.push(event);
}
void Client::handleCommand_CloudParams(NetworkPacket* pkt)
{
f32 density;
video::SColor color_bright;
video::SColor color_ambient;
f32 height;
f32 thickness;
v2f speed;
*pkt >> density >> color_bright >> color_ambient
>> height >> thickness >> speed;
ClientEvent event;
event.type = CE_CLOUD_PARAMS;
event.cloud_params.density = density;
// use the underlying u32 representation, because we can't
// use struct members with constructors here, and this way
// we avoid using new() and delete() for no good reason
event.cloud_params.color_bright = color_bright.color;
event.cloud_params.color_ambient = color_ambient.color;
event.cloud_params.height = height;
event.cloud_params.thickness = thickness;
// same here: deconstruct to skip constructor
event.cloud_params.speed_x = speed.X;
event.cloud_params.speed_y = speed.Y;
m_client_event_queue.push(event);
}
void Client::handleCommand_OverrideDayNightRatio(NetworkPacket* pkt)
{
bool do_override;

View file

@ -610,6 +610,16 @@ enum ToClientCommand
u32 id
*/
TOCLIENT_CLOUD_PARAMS = 0x54,
/*
f1000 density
u8[4] color_diffuse (ARGB)
u8[4] color_ambient (ARGB)
f1000 height
f1000 thickness
v2f1000 speed
*/
TOCLIENT_SRP_BYTES_S_B = 0x60,
/*
Belonging to AUTH_MECHANISM_LEGACY_PASSWORD and AUTH_MECHANISM_SRP.

View file

@ -197,7 +197,7 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
{ "TOCLIENT_LOCAL_PLAYER_ANIMATIONS", 0, true }, // 0x51
{ "TOCLIENT_EYE_OFFSET", 0, true }, // 0x52
{ "TOCLIENT_DELETE_PARTICLESPAWNER", 0, true }, // 0x53
null_command_factory,
{ "TOCLIENT_CLOUD_PARAMS", 0, true }, // 0x54
null_command_factory,
null_command_factory,
null_command_factory,