mirror of
https://github.com/libretro/devilutionX.git
synced 2026-11-11 02:41:35 -10:00
Convert CEL files to CL2 at load time. CL2 format is more efficient and is about as fast to render. CEL vs CL2 sizes, on dLvl 5: https://gist.github.com/glebm/9bbdd76962abcd4fd2405ecd3379af97 Memory: * Peak memory (while loading): -300 KiB * Memory in-game (dLvl5): -700 KiB * RG99 binary size: -15 KiB (1333096 -> 1317192) Performance on rg99: * On average, -1 FPS in town. * Same FPS in dungeon (20 FPS on dLvl 1).
44 lines
783 B
C++
44 lines
783 B
C++
/**
|
|
* @file doom.cpp
|
|
*
|
|
* Implementation of the map of the stars quest.
|
|
*/
|
|
#include "doom.h"
|
|
|
|
#include "control.h"
|
|
#include "engine.h"
|
|
#include "engine/cel_sprite.hpp"
|
|
#include "engine/load_cel.hpp"
|
|
#include "engine/render/cl2_render.hpp"
|
|
#include "utils/stdcompat/optional.hpp"
|
|
|
|
namespace devilution {
|
|
namespace {
|
|
OptionalOwnedCelSprite DoomCel;
|
|
} // namespace
|
|
|
|
bool DoomFlag;
|
|
|
|
void doom_init()
|
|
{
|
|
DoomCel = LoadCelAsCl2("Items\\Map\\MapZtown.CEL", 640);
|
|
DoomFlag = true;
|
|
}
|
|
|
|
void doom_close()
|
|
{
|
|
DoomFlag = false;
|
|
DoomCel = std::nullopt;
|
|
}
|
|
|
|
void doom_draw(const Surface &out)
|
|
{
|
|
if (!DoomFlag) {
|
|
return;
|
|
}
|
|
|
|
Cl2Draw(out, GetUIRectangle().position + Displacement { 0, 352 }, CelSprite { *DoomCel }, 0);
|
|
}
|
|
|
|
} // namespace devilution
|