mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Support floating-point animation frame numbers
This commit is contained in:
parent
323fc0a798
commit
06907aa99b
22 changed files with 111 additions and 105 deletions
|
@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <algorithm>
|
||||
#include "irr_v2d.h"
|
||||
#include "network/connection.h"
|
||||
#include "network/networkprotocol.h"
|
||||
#include "network/serveropcodes.h"
|
||||
|
@ -1987,14 +1988,21 @@ void Server::SendPlayerFov(session_t peer_id)
|
|||
Send(&pkt);
|
||||
}
|
||||
|
||||
void Server::SendLocalPlayerAnimations(session_t peer_id, v2s32 animation_frames[4],
|
||||
void Server::SendLocalPlayerAnimations(session_t peer_id, v2f animation_frames[4],
|
||||
f32 animation_speed)
|
||||
{
|
||||
NetworkPacket pkt(TOCLIENT_LOCAL_PLAYER_ANIMATIONS, 0,
|
||||
peer_id);
|
||||
|
||||
pkt << animation_frames[0] << animation_frames[1] << animation_frames[2]
|
||||
<< animation_frames[3] << animation_speed;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (m_clients.getProtocolVersion(peer_id) >= 46) {
|
||||
pkt << animation_frames[i];
|
||||
} else {
|
||||
pkt << v2s32::from(animation_frames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
pkt << animation_speed;
|
||||
|
||||
Send(&pkt);
|
||||
}
|
||||
|
@ -3424,7 +3432,7 @@ Address Server::getPeerAddress(session_t peer_id)
|
|||
}
|
||||
|
||||
void Server::setLocalPlayerAnimations(RemotePlayer *player,
|
||||
v2s32 animation_frames[4], f32 frame_speed)
|
||||
v2f animation_frames[4], f32 frame_speed)
|
||||
{
|
||||
sanity_check(player);
|
||||
player->setLocalAnimations(animation_frames, frame_speed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue