mirror of
https://github.com/minetest/minetest.git
synced 2025-07-04 08:50:22 +02:00
Basic camera control API (#15796)
This commit is contained in:
@ -83,7 +83,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
|
||||
{ "TOCLIENT_MOVEMENT", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Movement }, // 0x45
|
||||
{ "TOCLIENT_SPAWN_PARTICLE", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_SpawnParticle }, // 0x46
|
||||
{ "TOCLIENT_ADD_PARTICLESPAWNER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_AddParticleSpawner }, // 0x47
|
||||
null_command_handler,
|
||||
{ "TOCLIENT_CAMERA", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Camera }, // 0x48
|
||||
{ "TOCLIENT_HUDADD", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HudAdd }, // 0x49
|
||||
{ "TOCLIENT_HUDRM", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HudRemove }, // 0x4a
|
||||
{ "TOCLIENT_HUDCHANGE", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HudChange }, // 0x4b
|
||||
|
@ -1530,7 +1530,19 @@ void Client::handleCommand_EyeOffset(NetworkPacket* pkt)
|
||||
*pkt >> player->eye_offset_third_front;
|
||||
} catch (PacketError &e) {
|
||||
player->eye_offset_third_front = player->eye_offset_third;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void Client::handleCommand_Camera(NetworkPacket* pkt)
|
||||
{
|
||||
LocalPlayer *player = m_env.getLocalPlayer();
|
||||
assert(player);
|
||||
|
||||
u8 tmp;
|
||||
*pkt >> tmp;
|
||||
player->allowed_camera_mode = static_cast<CameraMode>(tmp);
|
||||
|
||||
m_client_event_queue.push(new ClientEvent(CE_UPDATE_CAMERA));
|
||||
}
|
||||
|
||||
void Client::handleCommand_UpdatePlayerList(NetworkPacket* pkt)
|
||||
|
@ -442,6 +442,11 @@ enum ToClientCommand : u16
|
||||
|
||||
*/
|
||||
|
||||
TOCLIENT_CAMERA = 0x48,
|
||||
/*
|
||||
u8 allowed_camera_mode
|
||||
*/
|
||||
|
||||
TOCLIENT_HUDADD = 0x49,
|
||||
/*
|
||||
u32 id
|
||||
|
@ -183,7 +183,7 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
|
||||
{ "TOCLIENT_MOVEMENT", 0, true }, // 0x45
|
||||
{ "TOCLIENT_SPAWN_PARTICLE", 0, true }, // 0x46
|
||||
{ "TOCLIENT_ADD_PARTICLESPAWNER", 0, true }, // 0x47
|
||||
null_command_factory, // 0x48
|
||||
{ "TOCLIENT_CAMERA", 0, true }, // 0x48
|
||||
{ "TOCLIENT_HUDADD", 1, true }, // 0x49
|
||||
{ "TOCLIENT_HUDRM", 1, true }, // 0x4a
|
||||
{ "TOCLIENT_HUDCHANGE", 1, true }, // 0x4b
|
||||
|
Reference in New Issue
Block a user