Files
devilutionX/Source/engine/load_pcx.hpp
T
Gleb Mazovetskiy 41f43ea3f5 Support unpacked MPQs from devilutionx-mpq-tools
https://github.com/diasurgical/devilutionx-mpq-tools produces an unpacked MPQ
with all the graphics converted to CLX and the unused files removed.
This is primarily useful on RAM-constrained platforms, such as PS2,
because it eliminates the MPQ overhead.

Adds a build option to load from such unpacked directories instead of the MPQ.

These directories are searched for in the same locations
where the MPQs would be searched for otherwise.

Example directory layout:

* /usr/local/share/diasurgical/devilutionx/diabdat/ -- unpacked and converted diabdat.mpq
* /usr/local/share/diasurgical/devilutionx/hellfire/ -- unpacked and converted hellfire MPQs (all of them merged into 1 directory)
* /usr/local/share/diasurgical/devilutionx/fonts/ -- unpacked fonts.mpq
* /usr/local/share/diasurgical/devilutionx/pl/ -- unpacked pl.mpq

These directory structure is produced by calling `unpack_and_minify_mpq`
2022-10-11 18:00:57 +01:00

43 lines
1.2 KiB
C++

#pragma once
#include <cstdint>
#include <SDL.h>
#include "engine/clx_sprite.hpp"
#include "utils/stdcompat/optional.hpp"
#ifdef UNPACKED_MPQS
#define DEVILUTIONX_PCX_EXT ".clx"
#else
#define DEVILUTIONX_PCX_EXT ".pcx"
#endif
namespace devilution {
/**
* @brief Loads a PCX file as a CLX sprite list.
*
* @param filename
* @param numFramesOrFrameHeight Pass a positive value with the number of frames, or the frame height as a negative value.
* @param transparentColor
* @param outPalette
* @return OptionalOwnedClxSpriteList
*/
OptionalOwnedClxSpriteList LoadPcxSpriteList(const char *filename, int numFramesOrFrameHeight, std::optional<uint8_t> transparentColor = std::nullopt, SDL_Color *outPalette = nullptr, bool logError = true);
/**
* @brief Loads a PCX file as a CLX sprite list with a single sprite.
*
* @param filename
* @param transparentColor
* @param outPalette
* @return OptionalOwnedClxSpriteList
*/
inline OptionalOwnedClxSpriteList LoadPcx(const char *filename, std::optional<uint8_t> transparentColor = std::nullopt, SDL_Color *outPalette = nullptr, bool logError = true)
{
return LoadPcxSpriteList(filename, 1, transparentColor, outPalette, logError);
}
} // namespace devilution