Add loading screen, fix tree/foliage collision, jump buffering, and fence rotation

- Loading screen stays visible until all terrain tiles finish streaming;
  character spawns only after terrain is loaded and Z-snapped to ground
- Reduce tree trunk collision bounds (5% of canopy, capped at 5.0) and
  make all small/medium trees, bushes, lily pads, and foliage walkthrough
- Add jump input buffering (150ms) and coyote time (100ms) for responsive jumps
- Fix fence orientation by adding +180° heading rotation
- Increase terrain load radius from 1 to 2 (5x5 tile grid)
- Add hearthstone callback for single-player camera reset
This commit is contained in:
Kelsi 2026-02-04 13:29:27 -08:00
parent f7cd871895
commit 6ca9e9024a
9 changed files with 188 additions and 222 deletions

View file

@ -35,6 +35,7 @@ public:
void reset();
float getMovementSpeed() const { return movementSpeed; }
const glm::vec3& getDefaultPosition() const { return defaultPosition; }
bool isMoving() const;
float getYaw() const { return yaw; }
float getFacingYaw() const { return facingYaw; }
@ -116,6 +117,10 @@ private:
float lastGroundZ = 0.0f; // Last known ground height (fallback when no terrain)
static constexpr float GRAVITY = -30.0f;
static constexpr float JUMP_VELOCITY = 15.0f;
float jumpBufferTimer = 0.0f; // Time since space was pressed
float coyoteTimer = 0.0f; // Time since last grounded
static constexpr float JUMP_BUFFER_TIME = 0.15f; // 150ms input buffer
static constexpr float COYOTE_TIME = 0.10f; // 100ms grace after leaving ground
// Swimming
bool swimming = false;
@ -160,9 +165,9 @@ private:
static constexpr float WOW_GRAVITY = -19.29f;
static constexpr float WOW_JUMP_VELOCITY = 7.96f;
// Default spawn position (Stormwind Trade District)
glm::vec3 defaultPosition = glm::vec3(-8830.0f, 640.0f, 200.0f);
float defaultYaw = 0.0f; // Look north toward canals
// Default spawn position (Goldshire Inn)
glm::vec3 defaultPosition = glm::vec3(-9464.0f, 62.0f, 200.0f);
float defaultYaw = 0.0f;
float defaultPitch = -5.0f;
};

View file

@ -47,6 +47,7 @@ struct M2ModelGPU {
bool collisionPlanter = false;
bool collisionSmallSolidProp = false;
bool collisionNarrowVerticalProp = false;
bool collisionTreeTrunk = false;
bool collisionNoBlock = false;
bool collisionStatue = false;

View file

@ -183,6 +183,7 @@ public:
* Get statistics
*/
int getLoadedTileCount() const { return static_cast<int>(loadedTiles.size()); }
int getPendingTileCount() const { return static_cast<int>(pendingTiles.size()); }
TileCoord getCurrentTile() const { return currentTile; }
private:
@ -247,8 +248,8 @@ private:
// Streaming parameters
bool streamingEnabled = true;
int loadRadius = 1; // Load tiles within this radius (3x3 grid for better CPU/GPU perf)
int unloadRadius = 2; // Unload tiles beyond this radius
int loadRadius = 2; // Load tiles within this radius (5x5 grid)
int unloadRadius = 3; // Unload tiles beyond this radius
float updateInterval = 0.1f; // Check streaming every 0.1 seconds
float timeSinceLastUpdate = 0.0f;