mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Fix playerclick pressed/released being switched (thanks sirvoid)
This commit is contained in:
parent
579264be6c
commit
9f233b4197
@ -741,13 +741,13 @@ const char* cpe_clientExtensions[30] = {
|
||||
static void CPE_SetMapEnvUrl(uint8_t* data);
|
||||
|
||||
#define Ext_Deg2Packed(x) ((int16_t)((x) * 65536.0f / 360.0f))
|
||||
void CPE_WritePlayerClick(MouseButton button, bool buttonDown, uint8_t targetId, struct PickedPos* pos) {
|
||||
void CPE_WritePlayerClick(MouseButton button, bool pressed, uint8_t targetId, struct PickedPos* pos) {
|
||||
struct Entity* p = &LocalPlayer_Instance.Base;
|
||||
uint8_t* data = ServerConnection_WriteBuffer;
|
||||
*data++ = OPCODE_PLAYER_CLICK;
|
||||
{
|
||||
*data++ = button;
|
||||
*data++ = buttonDown;
|
||||
*data++ = !pressed;
|
||||
Stream_SetU16_BE(data, Ext_Deg2Packed(p->HeadY)); data += 2;
|
||||
Stream_SetU16_BE(data, Ext_Deg2Packed(p->HeadX)); data += 2;
|
||||
|
||||
|
@ -18,5 +18,5 @@ void Classic_WriteChat(const String* text, bool partial);
|
||||
void Classic_WritePosition(Vector3 pos, float rotY, float headX);
|
||||
void Classic_WriteSetBlock(int x, int y, int z, bool place, BlockID block);
|
||||
void Classic_WriteLogin(const String* username, const String* verKey);
|
||||
void CPE_WritePlayerClick(MouseButton button, bool buttonDown, uint8_t targetId, struct PickedPos* pos);
|
||||
void CPE_WritePlayerClick(MouseButton button, bool pressed, uint8_t targetId, struct PickedPos* pos);
|
||||
#endif
|
||||
|
@ -221,7 +221,7 @@ static void SPConnection_SendChat(const String* text) {
|
||||
}
|
||||
|
||||
static void SPConnection_SendPosition(Vector3 pos, float rotY, float headX) { }
|
||||
static void SPConnection_SendPlayerClick(MouseButton button, bool isDown, EntityID targetId, struct PickedPos* pos) { }
|
||||
static void SPConnection_SendPlayerClick(MouseButton button, bool pressed, EntityID targetId, struct PickedPos* pos) { }
|
||||
|
||||
static void SPConnection_Tick(struct ScheduledTask* task) {
|
||||
if (ServerConnection_Disconnected) return;
|
||||
|
@ -71,7 +71,7 @@ struct ServerConnectionFuncs {
|
||||
/* Sends a position update to the server. */
|
||||
void (*SendPosition)(Vector3 pos, float rotY, float headX);
|
||||
/* Sends a PlayerClick packet to the server. */
|
||||
void (*SendPlayerClick)(MouseButton button, bool isDown, EntityID targetId, struct PickedPos* pos);
|
||||
void (*SendPlayerClick)(MouseButton button, bool pressed, EntityID targetId, struct PickedPos* pos);
|
||||
};
|
||||
|
||||
/* Currently active connection to a server. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user