yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::GeometryBounds Struct Reference

Bounding box result for a draw routine execution. More...

#include <object_geometry.h>

Public Member Functions

int max_x_tiles () const
 
int max_y_tiles () const
 
int width_pixels () const
 
int height_pixels () const
 
int min_x_pixels () const
 
int min_y_pixels () const
 
bool RequiresBG1Mask () const
 Check if this object requires BG1 masking.
 
bool HasTighterSelectionBounds () const
 Check if this object has a tighter selection hitbox.
 
SelectionRect GetSelectionBounds () const
 Get the selection bounds for hit testing.
 
std::tuple< int, int, int, int > GetBG1MaskRect (int obj_x, int obj_y) const
 Get the BG1 mask rectangle in pixel coordinates.
 

Public Attributes

int min_x_tiles = 0
 
int min_y_tiles = 0
 
int width_tiles = 0
 
int height_tiles = 0
 
bool is_bg2_overlay = false
 
std::optional< SelectionRectselection_bounds
 

Detailed Description

Bounding box result for a draw routine execution.

All values are in tile units. Convenience helpers expose pixel sizes for callers that need screen-space values.

For BG2 overlay objects (Layer 1 objects), the bounds also serve as the BG1 mask rectangle - the area where BG1 pixels should be transparent to allow BG2 content to show through during compositing.

For triangular shapes (diagonal ceilings 0xA0-0xA3), the selection_bounds provides a tighter hitbox than the full render_bounds bounding box.

Definition at line 42 of file object_geometry.h.

Member Function Documentation

◆ max_x_tiles()

int yaze::zelda3::GeometryBounds::max_x_tiles ( ) const
inline

Definition at line 56 of file object_geometry.h.

References min_x_tiles, and width_tiles.

◆ max_y_tiles()

int yaze::zelda3::GeometryBounds::max_y_tiles ( ) const
inline

Definition at line 57 of file object_geometry.h.

References height_tiles, and min_y_tiles.

◆ width_pixels()

int yaze::zelda3::GeometryBounds::width_pixels ( ) const
inline

Definition at line 58 of file object_geometry.h.

References width_tiles.

Referenced by GetBG1MaskRect().

◆ height_pixels()

int yaze::zelda3::GeometryBounds::height_pixels ( ) const
inline

Definition at line 59 of file object_geometry.h.

References height_tiles.

Referenced by GetBG1MaskRect().

◆ min_x_pixels()

int yaze::zelda3::GeometryBounds::min_x_pixels ( ) const
inline

Definition at line 62 of file object_geometry.h.

References min_x_tiles.

◆ min_y_pixels()

int yaze::zelda3::GeometryBounds::min_y_pixels ( ) const
inline

Definition at line 63 of file object_geometry.h.

References min_y_tiles.

◆ RequiresBG1Mask()

bool yaze::zelda3::GeometryBounds::RequiresBG1Mask ( ) const
inline

Check if this object requires BG1 masking.

BG2 overlay objects need corresponding pixels in BG1 marked as transparent so the BG2 content shows through during layer compositing. 94 rooms in vanilla ALTTP have such objects.

Definition at line 72 of file object_geometry.h.

References is_bg2_overlay, and width_tiles.

◆ HasTighterSelectionBounds()

bool yaze::zelda3::GeometryBounds::HasTighterSelectionBounds ( ) const
inline

Check if this object has a tighter selection hitbox.

For non-rectangular shapes like diagonal ceilings, the selection_bounds provides a more accurate hitbox for mouse interaction.

Definition at line 80 of file object_geometry.h.

References selection_bounds.

◆ GetSelectionBounds()

SelectionRect yaze::zelda3::GeometryBounds::GetSelectionBounds ( ) const
inline

Get the selection bounds for hit testing.

Returns selection_bounds if set, otherwise returns the full render bounds.

Definition at line 87 of file object_geometry.h.

References height_tiles, min_x_tiles, min_y_tiles, selection_bounds, and width_tiles.

◆ GetBG1MaskRect()

std::tuple< int, int, int, int > yaze::zelda3::GeometryBounds::GetBG1MaskRect ( int obj_x,
int obj_y ) const
inline

Get the BG1 mask rectangle in pixel coordinates.

Parameters
obj_xObject's base X position in tiles
obj_yObject's base Y position in tiles
Returns
Tuple of (start_x, start_y, width, height) in pixels

Definition at line 101 of file object_geometry.h.

References height_pixels(), min_x_tiles, min_y_tiles, and width_pixels().

Here is the call graph for this function:

Member Data Documentation

◆ min_x_tiles

◆ min_y_tiles

◆ width_tiles

◆ height_tiles

int yaze::zelda3::GeometryBounds::height_tiles = 0

◆ is_bg2_overlay

bool yaze::zelda3::GeometryBounds::is_bg2_overlay = false

◆ selection_bounds

std::optional<SelectionRect> yaze::zelda3::GeometryBounds::selection_bounds

The documentation for this struct was generated from the following file: