From 77c68c4dbce01f193a3f8e31195072adfa09c9dd Mon Sep 17 00:00:00 2001 From: p2r3 Date: Sat, 23 Aug 2025 04:21:13 +0300 Subject: [PATCH] fix wrong respawn flag handling --- src/procedures.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/procedures.c b/src/procedures.c index 1a78cd9..874c62d 100644 --- a/src/procedures.c +++ b/src/procedures.c @@ -48,7 +48,7 @@ void resetPlayerData (PlayerData *player) { player->x = 8; player->z = 8; player->y = 0; - player->flags &= 0x02; + player->flags |= 0x02; player->grounded_y = 0; for (int i = 0; i < 41; i ++) { player->inventory_items[i] = 0; @@ -204,9 +204,10 @@ void spawnPlayer (PlayerData *player) { float spawn_x = 8.5f, spawn_y = 80.0f, spawn_z = 8.5f; float spawn_yaw = 0.0f, spawn_pitch = 0.0f; - if ((player->flags & 0x02) == 0) { // Is this a new player? + if (player->flags & 0x02) { // Is this a new player? // Determine spawning Y coordinate based on terrain height spawn_y = getHeightAt(8, 8) + 1; + player->flags &= ~0x02; } else { // Not a new player // Calculate spawn position from player data spawn_x = player->x > 0 ? (float)player->x + 0.5 : (float)player->x - 0.5;