1#ifndef YAZE_APP_EDITOR_GRAPHICS_USAGE_PREVIEW_H
2#define YAZE_APP_EDITOR_GRAPHICS_USAGE_PREVIEW_H
14#include "absl/status/status.h"
52[[deprecated(
"Use SnapshotSessionSheets; Arena is a display cache")]]
73 const std::map<int, zelda3::RoomGfxInfo>& rooms);
78 const std::map<
int, std::array<uint8_t, 16>>& room_blocks, uint16_t sheet,
79 bool include_sprites);
114 const std::vector<RoomTileReference>& references,
115 const std::vector<GraphicsEditTarget>& targets,
137 std::array<uint8_t, 16>
blocks()
const;
151 std::unique_ptr<zelda3::Room>
room_;
169 const std::vector<GraphicsEditTarget>& targets);
182 int palette_room, std::string hack_name = {});
206 uint16_t sheet)
const;
214 std::optional<zsprite::ZSprite>
zsm_;
237 const std::vector<int>& tile16s, uint16_t sheet,
239 std::vector<SDL_Rect>* highlights =
nullptr);
244 std::vector<int>
TileIdsFor(uint16_t sheet,
int tile_index)
const;
249 std::unique_ptr<zelda3::OverworldMap>
map_;
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
size_t unknown_objects() const
std::map< size_t, SDL_Rect > object_rects_
std::vector< RoomTileReference > tile_references_
absl::Status TraceLoadedRoom(Rom *rom, zelda3::GameData *game_data, zelda3::Room *room)
std::array< uint8_t, 16 > blocks_
std::unique_ptr< zelda3::Room > room_
absl::Status Render(Rom *rom, zelda3::GameData *game_data, int room_id, const SheetPixels &sheets, bool objects_only, zelda3::Room *live_room=nullptr)
void CaptureUsage(const zelda3::Room &room)
std::array< uint8_t, 16 > blocks() const
Room graphics blocks (0-7 background, 8-15 sprites) of the loaded room.
std::vector< SDL_Rect > ObjectRectsUsingSheet(uint16_t sheet) const
PreviewImage Snapshot() const
const std::vector< RoomTileReference > & tile_references() const
gfx::Bitmap & mutable_bitmap()
void Reset()
Clears the loaded room so the next Render() reloads it from the ROM.
std::vector< SDL_Rect > ObjectRectsForObject(size_t index) const
const gfx::Bitmap & bitmap() const
std::array< SDL_Color, 256 > colors_
zelda3::GameData * game_data_
absl::Status Configure(Rom *rom, zelda3::GameData *game_data, int spriteset, int palette_room, std::string hack_name={})
std::optional< zsprite::ZSprite > zsm_
void SetVanillaSprite(uint8_t sprite_id)
Plays a vanilla sprite (single pose from the sprite catalog).
PreviewImage RenderFrame(const SheetPixels &sheets) const
Draws the current frame with sheets (edited pixels) over the ROM's.
bool UsesSheet(uint16_t sheet) const
std::vector< uint8_t > SheetOrRom(const SheetPixels &sheets, uint16_t sheet) const
std::array< uint8_t, 8 > slots_
void SetZsm(const zsprite::ZSprite &zsm, int animation)
Plays animation animation of a .zsm (the preview keeps a copy).
bool Advance(float seconds)
int frame_count() const
Frames in the current animation (1 for vanilla sprites).
const std::array< uint8_t, 8 > & slots() const
PreviewImage Render(const SheetPixels &sheets, const std::vector< int > &tile16s, uint16_t sheet, int tile_index, std::vector< SDL_Rect > *highlights=nullptr)
std::vector< int > TileIdsFor(uint16_t sheet, int tile_index) const
std::vector< gfx::Tile16 > tiles16_
absl::Status Configure(Rom *rom, zelda3::GameData *game_data, int area)
Loads overworld area area (graphics and palette) and the tile16 table.
std::unique_ptr< zelda3::OverworldMap > map_
zelda3::GameData * game_data_
std::vector< int > Tile16sUsingTile(uint16_t sheet, int tile_index) const
Represents a bitmap image optimized for SNES ROM hacking.
Which graphics sheets exist, which tables use them, and which 16x16 blocks are free.
SheetPixels SnapshotSessionSheets(const std::set< uint16_t > &ids, const zelda3::GameData *game_data)
std::vector< LoadedRoomSourceUses > FindLoadedRoomSourceUses(Rom *rom, zelda3::GameData *game_data, const LiveRoomContexts &rooms, const std::vector< GraphicsEditTarget > &targets)
std::string RoomContextLabel(const LiveRoomContext *live)
SheetPixels SnapshotArenaSheets(const std::set< uint16_t > &ids, const zelda3::GameData *game_data)
std::map< uint16_t, std::vector< uint8_t > > SheetPixels
Sheet id -> 4096 8bpp pixels (the GameData::graphics_buffer layout).
constexpr size_t kSheetBytes
std::function< LiveRoomContexts()> LiveRoomProvider
std::map< int, LiveRoomContext > LiveRoomContexts
PreviewImage SnapshotBitmap(const gfx::Bitmap &bitmap)
Copies a palettized Bitmap (for example a room composite).
std::vector< int > RoomsUsingSheet(const std::map< int, std::array< uint8_t, 16 > > &room_blocks, uint16_t sheet, bool include_sprites)
std::map< int, std::array< uint8_t, 16 > > CollectRoomSheetBlocks(Rom *rom, zelda3::GameData *game_data, const std::map< int, zelda3::RoomGfxInfo > &rooms)
std::vector< SourceObjectUse > FindSourceObjectUses(const std::vector< RoomTileReference > &references, const std::vector< GraphicsEditTarget > &targets, const zelda3::GameData *owner)
std::vector< SourceObjectUse > objects
std::array< std::optional< zelda3::PaletteColorAddress >, 8 > palette_colors
std::vector< RoomTileReference > references