#pragma once // Client view of a safari zone: builds the HD-2D diorama from the shared // Zone layout, predicts the local player, interpolates every networked // entity, and turns server events into effects (grass bursts, splashes, // capsule throws, fishing bobbers). #include "CharacterSprite.h" #include "Common.h" #include "Movement.h" #include "NetClient.h" #include "Roster.h" #include "Zone.h" #include "hd2d/Billboard.h" #include "hd2d/Camera.h" #include "hd2d/DayCycle.h" #include "hd2d/GroundOcclusion.h" #include "hd2d/Model.h" #include "hd2d/Particles.h" #include "hd2d/Scene.h" #include "hd2d/SpriteAtlas.h" #include "hd2d/Terrain.h" #include "hd2d/Water.h" #include "hd2d/Weather.h" #include #include #include #include #include namespace bs { struct FrameInput { glm::vec2 move{0.0f}; // camera-relative: x = screen right, y = screen up bool run = false; }; class World { public: bool init(); // static assets (models, textures, character art, roster); once per process bool buildZone(const std::string& id, uint32_t seed); const Zone& zone() const { return zone_; } bool zoneBuilt() const { return built_; } // Online: consume snapshots/events and predict the local player. void update(float dt, float time, const FrameInput& in, NetClient& net, const hd2d::Camera& cam); // Offline backdrop (title screen): just animate the scene at a fixed hour. void updateBackdrop(float dt, float time, float hour, Weather w); void reset(); // forget all entities (on disconnect) // Gameplay queries for the HUD / input handling. glm::vec3 localPos() const { return localRender_; } float localYaw() const { return predicted_.yaw; } bool localSpawned() const { return localSpawned_; } uint32_t targetCreature() const { return target_; } uint32_t nearbyNpc() const; // Henry when in talking range, else 0 bool canFish(glm::vec2& bobber) const; bool lineOut() const; // the local player's fishing line is in the water bool biting() const { return biteTimer_ > 0.0f; } float hour() const { return hour_; } Weather weatherState() const { return weatherState_; } // Character preview / creator. const CharacterArt& characterArt() const { return charArt_; } const CharacterManifest& manifest() const { return manifest_; } const Roster& roster() const { return roster_; } // Screen-space labels (players, Henry, the targeted creature). struct Label { glm::vec3 world; std::string text; uint32_t accent; bool chat = false; uint32_t entity = 0; // players: App fills the name from NetClient::players }; std::vector