Renders dungeon objects from Link to the Past. More...
#include <object_renderer.h>
Public Member Functions | |
DungeonObjectRenderer ()=default | |
void | LoadObject (uint32_t routine_ptr, std::array< uint8_t, 16 > &sheet_ids) |
Loads and renders a dungeon object. | |
void | ConfigureObject () |
Configures the CPU state for object rendering. | |
void | RenderObject (uint32_t routine_ptr) |
Executes the object drawing routine. | |
void | UpdateObjectBitmap () |
Updates the bitmap with the rendered object. | |
auto | mutable_memory () |
auto | rom () |
auto | mutable_rom () |
Private Attributes | |
std::vector< uint8_t > | tilemap_ |
std::vector< uint8_t > | rom_data_ |
PseudoVram | vram_ |
Rom * | rom_ |
emu::Snes | snes_ |
gfx::Bitmap | bitmap_ |
Renders dungeon objects from Link to the Past.
This class uses the emulator subsystem to simulate the SNES CPU drawing routines for dungeon objects. It captures the tile data written to memory and renders it to a bitmap.
Definition at line 32 of file object_renderer.h.
|
default |
void yaze::zelda3::DungeonObjectRenderer::LoadObject | ( | uint32_t | routine_ptr, |
std::array< uint8_t, 16 > & | sheet_ids ) |
Loads and renders a dungeon object.
routine_ptr | Pointer to the drawing routine in ROM |
sheet_ids | Array of graphics sheet IDs used by the object |
Definition at line 8 of file object_renderer.cc.
References ConfigureObject(), RenderObject(), rom(), rom_data_, snes_, and vram_.
void yaze::zelda3::DungeonObjectRenderer::ConfigureObject | ( | ) |
Configures the CPU state for object rendering.
Definition at line 22 of file object_renderer.cc.
References snes_.
Referenced by LoadObject().
void yaze::zelda3::DungeonObjectRenderer::RenderObject | ( | uint32_t | routine_ptr | ) |
Executes the object drawing routine.
routine_ptr | Pointer to the drawing routine in ROM |
Example: the STA $BF, $CD, $C2, $CE are the location of the object in the room $B2 is used for size loop so if object size is setted on 07 that draw code will be repeated 7 times and since Y is increasing by 4 it makes the object draw from left to right
RoomDraw_Rightwards2x2_1to15or32: #_018B89: JSR RoomDraw_GetSize_1to15or32 .next #_018B8C: JSR RoomDraw_Rightwards2x2 #_018B8F: DEC.b $B2 #_018B91: BNE .next #_018B93: RTS
RoomDraw_Rightwards2x2: #_019895: LDA.w RoomDrawObjectData+0,X #_019898: STA.b [$BF],Y #_01989A: LDA.w RoomDrawObjectData+2,X #_01989D: STA.b [$CB],Y #_01989F: LDA.w RoomDrawObjectData+4,X #_0198A2: STA.b [$C2],Y #_0198A4: LDA.w RoomDrawObjectData+6,X #_0198A7: STA.b [$CE],Y #_0198A9: INY #4 #_0198AD: RTS
Definition at line 62 of file object_renderer.cc.
References snes_, and UpdateObjectBitmap().
Referenced by LoadObject().
void yaze::zelda3::DungeonObjectRenderer::UpdateObjectBitmap | ( | ) |
Updates the bitmap with the rendered object.
Definition at line 106 of file object_renderer.cc.
References yaze::gfx::Arena::Get(), yaze::gfx::Arena::mutable_gfx_sheets(), snes_, tilemap_, and vram_.
Referenced by RenderObject().
|
inline |
Definition at line 61 of file object_renderer.h.
References tilemap_.
|
inline |
|
inline |
Definition at line 63 of file object_renderer.h.
References rom_.
|
private |
Definition at line 66 of file object_renderer.h.
Referenced by mutable_memory(), and UpdateObjectBitmap().
|
private |
Definition at line 67 of file object_renderer.h.
Referenced by LoadObject().
|
private |
Definition at line 69 of file object_renderer.h.
Referenced by LoadObject(), and UpdateObjectBitmap().
|
private |
Definition at line 71 of file object_renderer.h.
Referenced by mutable_rom(), and rom().
|
private |
Definition at line 72 of file object_renderer.h.
Referenced by ConfigureObject(), LoadObject(), RenderObject(), and UpdateObjectBitmap().
|
private |
Definition at line 73 of file object_renderer.h.