#pragma once #include #include #include #include #include #include "external/nlohmann/json.hpp" #include "TextModel.h" #include "InteractiveObject.h" #include "InteractiveObjectState.h" #include "../CharacterState.h" #include "../content/LocationDefinition.h" namespace FRG { class IGameServer; class Character; // Result of loading a static object list: unique objects keep their own mesh, // repeated ones are merged into instanced batches. struct StaticObjectSet { std::unordered_map single; std::vector batches; }; class GameObjectLoader { public: static StaticObjectSet createGameObjects( const std::vector& definitions, Renderer& renderer, const std::string& zipPath = ""); static std::vector createInteractiveObjects( const std::vector& definitions, Renderer& renderer, std::unordered_map>& states, const std::string& zipPath = ""); static std::vector> createNpcs( const std::vector& definitions, Renderer& renderer, const std::unordered_map>& states, IGameServer& server, const std::string& locationId, const std::string& zipPath); static StaticObjectSet loadAndCreateGameObjects( const std::string& jsonPath, Renderer& renderer, const std::string& zipPath = "" ); static std::vector loadAndCreateInteractiveObjects( const std::string& jsonPath, Renderer& renderer, std::unordered_map>& states, const std::string& zipPath = "" ); static std::vector> loadAndCreate_Npcs( const std::string& jsonPath, Renderer& renderer, std::unordered_map>& states, IGameServer& server, const std::string& locationId, const std::string& zipPath ); static std::vector loadNpcsFromJson(const std::string& jsonPath, const std::string& zipPath = ""); static LoadedGameObject buildLoadedObject(const GameObjectData& data, Renderer& renderer, const std::string& zipPath); private: static nlohmann::json loadJson(const std::string& jsonPath, const std::string& zipPath); static std::vector loadFromJson(const std::string& jsonPath, const std::string& zipPath); static std::vector loadInteractiveFromJson(const std::string& jsonPath, const std::string& zipPath); }; } // namespace FRG