#include "engine/load_cel.hpp" #include #include #include #ifdef DEBUG_CEL_TO_CL2_SIZE #include #endif #include #include "appfat.h" #include "mpq/mpq_common.hpp" #include "utils/status_macros.hpp" #include "utils/str_cat.hpp" #ifdef UNPACKED_MPQS #include "engine/load_clx.hpp" #else #include "engine/load_file.hpp" #include "utils/cel_to_clx.hpp" #endif namespace devilution { tl::expected LoadCelListOrSheetWithStatus(const char *pszName, PointerOrValue widthOrWidths) { char path[MaxMpqPathSize]; *BufCopy(path, pszName, DEVILUTIONX_CEL_EXT) = '\0'; #ifdef UNPACKED_MPQS return LoadClxListOrSheetWithStatus(path); #else size_t size; ASSIGN_OR_RETURN(std::unique_ptr data, LoadFileInMemWithStatus(path, &size)); #ifdef DEBUG_CEL_TO_CL2_SIZE std::cout << path; #endif return CelToClx(data.get(), size, widthOrWidths); #endif } OwnedClxSpriteListOrSheet LoadCelListOrSheet(const char *pszName, PointerOrValue widthOrWidths) { tl::expected result = LoadCelListOrSheetWithStatus(pszName, widthOrWidths); if (DVL_PREDICT_FALSE(!result.has_value())) app_fatal(result.error()); return std::move(result).value(); } } // namespace devilution