yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
usage_preview.h File Reference

Renders a graphics sheet the way the game uses it, from unsaved sheet pixels, without writing the ROM or GameData. More...

#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include "absl/status/status.h"
#include "app/editor/graphics/graphics_edit_context.h"
#include "app/editor/graphics/graphics_preview_image.h"
#include "app/editor/sprite/zsprite.h"
#include "app/gfx/core/bitmap.h"
#include "app/gfx/types/snes_tile.h"
#include "rom/rom.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/game_data.h"
#include "zelda3/gfx_sheet_inventory.h"
#include "zelda3/overworld/overworld_map.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  yaze::editor::usage_preview::LiveRoomContext
 
struct  yaze::editor::usage_preview::RoomTileReference
 
struct  yaze::editor::usage_preview::SourceObjectUse
 
class  yaze::editor::usage_preview::RoomUsagePreview
 
struct  yaze::editor::usage_preview::LoadedRoomSourceUses
 
class  yaze::editor::usage_preview::SpriteUsagePreview
 
class  yaze::editor::usage_preview::Tile16UsagePreview
 

Namespaces

namespace  yaze
 
namespace  yaze::editor
 Editors are the view controllers for the application.
 
namespace  yaze::editor::usage_preview
 

Typedefs

using yaze::editor::usage_preview::SheetPixels = std::map<uint16_t, std::vector<uint8_t>>
 Sheet id -> 4096 8bpp pixels (the GameData::graphics_buffer layout).
 
using yaze::editor::usage_preview::LiveRoomContexts = std::map<int, LiveRoomContext>
 
using yaze::editor::usage_preview::LiveRoomProvider = std::function<LiveRoomContexts()>
 

Functions

SheetPixels yaze::editor::usage_preview::SnapshotArenaSheets (const std::set< uint16_t > &ids, const zelda3::GameData *game_data)
 
SheetPixels yaze::editor::usage_preview::SnapshotSessionSheets (const std::set< uint16_t > &ids, const zelda3::GameData *game_data)
 
PreviewImage yaze::editor::usage_preview::SnapshotBitmap (const gfx::Bitmap &bitmap)
 Copies a palettized Bitmap (for example a room composite).
 
std::map< int, std::array< uint8_t, 16 > > yaze::editor::usage_preview::CollectRoomSheetBlocks (Rom *rom, zelda3::GameData *game_data, const std::map< int, zelda3::RoomGfxInfo > &rooms)
 
std::vector< int > yaze::editor::usage_preview::RoomsUsingSheet (const std::map< int, std::array< uint8_t, 16 > > &room_blocks, uint16_t sheet, bool include_sprites)
 
std::string yaze::editor::usage_preview::RoomContextLabel (const LiveRoomContext *live)
 
std::vector< SourceObjectUse > yaze::editor::usage_preview::FindSourceObjectUses (const std::vector< RoomTileReference > &references, const std::vector< GraphicsEditTarget > &targets, const zelda3::GameData *owner)
 
std::vector< LoadedRoomSourceUses > yaze::editor::usage_preview::FindLoadedRoomSourceUses (Rom *rom, zelda3::GameData *game_data, const LiveRoomContexts &rooms, const std::vector< GraphicsEditTarget > &targets)
 

Variables

constexpr size_t yaze::editor::usage_preview::kSheetBytes = 4096
 

Detailed Description

Renders a graphics sheet the way the game uses it, from unsaved sheet pixels, without writing the ROM or GameData.

Every context reuses an existing renderer: rooms go through Room's RenderRoomGraphics/RenderComposite, vanilla sprites through Sprite::RenderPreviewGraphics, .zsm frames through SpriteDrawer, and tile16s through OverworldMap::BuildTileset/BuildTiles16Gfx. Edited sheets reach them through the renderers' SetGraphicsSheetOverrides() hooks.

No ImGui here, so tests and offscreen captures drive the same code the Usage Preview panel draws.

Definition in file usage_preview.h.