From 8daefc4f1fa5ffb02dc7a7c8ab34d328703f10cd Mon Sep 17 00:00:00 2001 From: p2r3 Date: Tue, 12 Aug 2025 16:51:59 +0300 Subject: [PATCH] fix wrong angle encoding --- main.c | 2 +- src/globals.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index a730e6f..280214f 100644 --- a/main.c +++ b/main.c @@ -170,7 +170,7 @@ void handlePacket (int client_fd, int length, int packet_id) { player->y = cy; player->z = cz; if (packet_id == 0x1E) { - player->yaw = yaw / 180.0f * 127.0f; + player->yaw = (short)yaw % 180 * 127 / 180; player->pitch = pitch / 90.0f * 127.0f; } diff --git a/src/globals.h b/src/globals.h index b88b1dc..bf47278 100644 --- a/src/globals.h +++ b/src/globals.h @@ -37,8 +37,8 @@ typedef struct { short x; short y; short z; - uint8_t yaw; - uint8_t pitch; + int8_t yaw; + int8_t pitch; uint8_t hotbar; uint16_t inventory_items[41]; uint8_t inventory_count[41];