mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Add support for per-player FOV overrides and multipliers
This commit is contained in:
parent
5c9983400f
commit
47da640d77
13 changed files with 168 additions and 62 deletions
|
@ -78,7 +78,7 @@ const ToClientCommandHandler toClientCommandTable[TOCLIENT_NUM_MSG_TYPES] =
|
|||
{ "TOCLIENT_HP", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_HP }, // 0x33
|
||||
{ "TOCLIENT_MOVE_PLAYER", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_MovePlayer }, // 0x34
|
||||
{ "TOCLIENT_ACCESS_DENIED_LEGACY", TOCLIENT_STATE_NOT_CONNECTED, &Client::handleCommand_AccessDenied }, // 0x35
|
||||
null_command_handler,
|
||||
{ "TOCLIENT_FOV", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Fov }, // 0x36
|
||||
{ "TOCLIENT_DEATHSCREEN", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_DeathScreen }, // 0x37
|
||||
{ "TOCLIENT_MEDIA", TOCLIENT_STATE_CONNECTED, &Client::handleCommand_Media }, // 0x38
|
||||
null_command_handler,
|
||||
|
@ -151,9 +151,9 @@ const ServerCommandFactory serverCommandFactoryTable[TOSERVER_NUM_MSG_TYPES] =
|
|||
null_command_factory, // 0x14
|
||||
null_command_factory, // 0x15
|
||||
null_command_factory, // 0x16
|
||||
{ "TOSERVER_MODCHANNEL_JOIN", 0, true }, // 0x17
|
||||
{ "TOSERVER_MODCHANNEL_LEAVE", 0, true }, // 0x18
|
||||
{ "TOSERVER_MODCHANNEL_MSG", 0, true }, // 0x19
|
||||
{ "TOSERVER_MODCHANNEL_JOIN", 0, true }, // 0x17
|
||||
{ "TOSERVER_MODCHANNEL_LEAVE", 0, true }, // 0x18
|
||||
{ "TOSERVER_MODCHANNEL_MSG", 0, true }, // 0x19
|
||||
null_command_factory, // 0x1a
|
||||
null_command_factory, // 0x1b
|
||||
null_command_factory, // 0x1c
|
||||
|
|
|
@ -523,13 +523,22 @@ void Client::handleCommand_Movement(NetworkPacket* pkt)
|
|||
player->movement_gravity = g * BS;
|
||||
}
|
||||
|
||||
void Client::handleCommand_HP(NetworkPacket* pkt)
|
||||
void Client::handleCommand_Fov(NetworkPacket *pkt)
|
||||
{
|
||||
f32 fov;
|
||||
bool is_multiplier;
|
||||
*pkt >> fov >> is_multiplier;
|
||||
|
||||
LocalPlayer *player = m_env.getLocalPlayer();
|
||||
player->setFov({ fov, is_multiplier });
|
||||
}
|
||||
|
||||
void Client::handleCommand_HP(NetworkPacket *pkt)
|
||||
{
|
||||
LocalPlayer *player = m_env.getLocalPlayer();
|
||||
assert(player != NULL);
|
||||
|
||||
u16 oldhp = player->hp;
|
||||
u16 oldhp = player->hp;
|
||||
|
||||
u16 hp;
|
||||
*pkt >> hp;
|
||||
|
|
|
@ -199,6 +199,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
Incremental inventory sending mode
|
||||
Unknown inventory serialization fields no longer throw an error
|
||||
Mod-specific formspec version
|
||||
Player FOV override API
|
||||
*/
|
||||
|
||||
#define LATEST_PROTOCOL_VERSION 38
|
||||
|
@ -370,7 +371,13 @@ enum ToClientCommand
|
|||
wstring reason
|
||||
*/
|
||||
|
||||
TOCLIENT_PLAYERITEM = 0x36, // Obsolete
|
||||
TOCLIENT_FOV = 0x36,
|
||||
/*
|
||||
Sends an FOV override/multiplier to client.
|
||||
|
||||
float fov
|
||||
bool is_multiplier
|
||||
*/
|
||||
|
||||
TOCLIENT_DEATHSCREEN = 0x37,
|
||||
/*
|
||||
|
|
|
@ -104,9 +104,9 @@ const ToServerCommandHandler toServerCommandTable[TOSERVER_NUM_MSG_TYPES] =
|
|||
null_command_handler, // 0x4d
|
||||
null_command_handler, // 0x4e
|
||||
null_command_handler, // 0x4f
|
||||
{ "TOSERVER_FIRST_SRP", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_FirstSrp }, // 0x50
|
||||
{ "TOSERVER_SRP_BYTES_A", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_SrpBytesA }, // 0x51
|
||||
{ "TOSERVER_SRP_BYTES_M", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_SrpBytesM }, // 0x52
|
||||
{ "TOSERVER_FIRST_SRP", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_FirstSrp }, // 0x50
|
||||
{ "TOSERVER_SRP_BYTES_A", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_SrpBytesA }, // 0x51
|
||||
{ "TOSERVER_SRP_BYTES_M", TOSERVER_STATE_NOT_CONNECTED, &Server::handleCommand_SrpBytesM }, // 0x52
|
||||
};
|
||||
|
||||
const static ClientCommandFactory null_command_factory = { "TOCLIENT_NULL", 0, false };
|
||||
|
@ -115,51 +115,51 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
|
|||
{
|
||||
null_command_factory, // 0x00
|
||||
null_command_factory, // 0x01
|
||||
{ "TOCLIENT_HELLO", 0, true }, // 0x02
|
||||
{ "TOCLIENT_AUTH_ACCEPT", 0, true }, // 0x03
|
||||
{ "TOCLIENT_ACCEPT_SUDO_MODE", 0, true }, // 0x04
|
||||
{ "TOCLIENT_DENY_SUDO_MODE", 0, true }, // 0x05
|
||||
{ "TOCLIENT_HELLO", 0, true }, // 0x02
|
||||
{ "TOCLIENT_AUTH_ACCEPT", 0, true }, // 0x03
|
||||
{ "TOCLIENT_ACCEPT_SUDO_MODE", 0, true }, // 0x04
|
||||
{ "TOCLIENT_DENY_SUDO_MODE", 0, true }, // 0x05
|
||||
null_command_factory, // 0x06
|
||||
null_command_factory, // 0x07
|
||||
null_command_factory, // 0x08
|
||||
null_command_factory, // 0x09
|
||||
{ "TOCLIENT_ACCESS_DENIED", 0, true }, // 0x0A
|
||||
{ "TOCLIENT_ACCESS_DENIED", 0, true }, // 0x0A
|
||||
null_command_factory, // 0x0B
|
||||
null_command_factory, // 0x0C
|
||||
null_command_factory, // 0x0D
|
||||
null_command_factory, // 0x0E
|
||||
null_command_factory, // 0x0F
|
||||
{ "TOCLIENT_INIT", 0, true }, // 0x10
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
{ "TOCLIENT_INIT", 0, true }, // 0x10
|
||||
null_command_factory, // 0x11
|
||||
null_command_factory, // 0x12
|
||||
null_command_factory, // 0x13
|
||||
null_command_factory, // 0x14
|
||||
null_command_factory, // 0x15
|
||||
null_command_factory, // 0x16
|
||||
null_command_factory, // 0x17
|
||||
null_command_factory, // 0x18
|
||||
null_command_factory, // 0x19
|
||||
null_command_factory, // 0x1A
|
||||
null_command_factory, // 0x1B
|
||||
null_command_factory, // 0x1C
|
||||
null_command_factory, // 0x1D
|
||||
null_command_factory, // 0x1E
|
||||
null_command_factory, // 0x1F
|
||||
{ "TOCLIENT_BLOCKDATA", 2, true }, // 0x20
|
||||
{ "TOCLIENT_ADDNODE", 0, true }, // 0x21
|
||||
{ "TOCLIENT_REMOVENODE", 0, true }, // 0x22
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory, // 0x23
|
||||
null_command_factory, // 0x24
|
||||
null_command_factory, // 0x25
|
||||
null_command_factory, // 0x26
|
||||
{ "TOCLIENT_INVENTORY", 0, true }, // 0x27
|
||||
null_command_factory,
|
||||
null_command_factory, // 0x28
|
||||
{ "TOCLIENT_TIME_OF_DAY", 0, true }, // 0x29
|
||||
{ "TOCLIENT_CSM_RESTRICTION_FLAGS", 0, true }, // 0x2A
|
||||
{ "TOCLIENT_PLAYER_SPEED", 0, true }, // 0x2B
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory, // 0x2C
|
||||
null_command_factory, // 0x2D
|
||||
null_command_factory, // 0x2E
|
||||
{ "TOCLIENT_CHAT_MESSAGE", 0, true }, // 0x2F
|
||||
null_command_factory, // 0x30
|
||||
{ "TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD", 0, true }, // 0x31
|
||||
|
@ -167,15 +167,15 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
|
|||
{ "TOCLIENT_HP", 0, true }, // 0x33
|
||||
{ "TOCLIENT_MOVE_PLAYER", 0, true }, // 0x34
|
||||
{ "TOCLIENT_ACCESS_DENIED_LEGACY", 0, true }, // 0x35
|
||||
null_command_factory, // 0x36
|
||||
{ "TOCLIENT_FOV", 0, true }, // 0x36
|
||||
{ "TOCLIENT_DEATHSCREEN", 0, true }, // 0x37
|
||||
{ "TOCLIENT_MEDIA", 2, true }, // 0x38
|
||||
null_command_factory, // 0x39
|
||||
{ "TOCLIENT_NODEDEF", 0, true }, // 0x3a
|
||||
null_command_factory, // 0x3b
|
||||
{ "TOCLIENT_ANNOUNCE_MEDIA", 0, true }, // 0x3c
|
||||
{ "TOCLIENT_ITEMDEF", 0, true }, // 0x3d
|
||||
null_command_factory,
|
||||
{ "TOCLIENT_NODEDEF", 0, true }, // 0x3A
|
||||
null_command_factory, // 0x3B
|
||||
{ "TOCLIENT_ANNOUNCE_MEDIA", 0, true }, // 0x3C
|
||||
{ "TOCLIENT_ITEMDEF", 0, true }, // 0x3D
|
||||
null_command_factory, // 0x3E
|
||||
{ "TOCLIENT_PLAY_SOUND", 0, true }, // 0x3f
|
||||
{ "TOCLIENT_STOP_SOUND", 0, true }, // 0x40
|
||||
{ "TOCLIENT_PRIVILEGES", 0, true }, // 0x41
|
||||
|
@ -203,12 +203,12 @@ const ClientCommandFactory clientCommandFactoryTable[TOCLIENT_NUM_MSG_TYPES] =
|
|||
{ "TOCLIENT_MODCHANNEL_MSG", 0, true }, // 0x57
|
||||
{ "TOCLIENT_MODCHANNEL_SIGNAL", 0, true }, // 0x58
|
||||
{ "TOCLIENT_NODEMETA_CHANGED", 0, true }, // 0x59
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory,
|
||||
null_command_factory, // 0x5A
|
||||
null_command_factory, // 0x5B
|
||||
null_command_factory, // 0x5C
|
||||
null_command_factory, // 0x5D
|
||||
null_command_factory, // 0x5E
|
||||
null_command_factory, // 0x5F
|
||||
{ "TOSERVER_SRP_BYTES_S_B", 0, true }, // 0x60
|
||||
{ "TOCLIENT_FORMSPEC_PREPEND", 0, true }, // 0x61
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue