A class for managing sprites in the overworld and underworld. More...
#include <sprite.h>
Public Member Functions | |
| Sprite ()=default | |
| Sprite (const std::vector< uint8_t > &src, uint8_t overworld_map_id, uint8_t id, uint8_t x, uint8_t y, int map_x, int map_y) | |
| Sprite (uint8_t id, uint8_t x, uint8_t y, uint8_t subtype, uint8_t layer) | |
| void | InitSprite (const std::vector< uint8_t > &src, uint8_t overworld_map_id, uint8_t id, uint8_t x, uint8_t y, int map_x, int map_y) |
| void | Draw () |
| void | RenderPreviewGraphics (std::span< const uint8_t > graphics) |
| void | ClearPreviewGraphics () |
| void | DrawSpriteTile (int x, int y, int srcx, int srcy, int pal, bool mirror_x=false, bool mirror_y=false, int sizex=2, int sizey=2) |
| void | UpdateMapProperties (uint16_t map_id, const void *context=nullptr) override |
| Update entity properties based on map position. | |
| void | UpdateCoordinates (int map_x, int map_y) |
| auto | preview_graphics () const |
| auto | id () const |
| auto | set_id (uint8_t id) |
| auto | x () const |
| auto | y () const |
| auto | nx () const |
| auto | ny () const |
| auto | map_id () const |
| auto | map_x () const |
| auto | map_y () const |
| auto | game_state () const |
| auto | layer () const |
| auto | subtype () const |
| auto | width () const |
| auto | height () const |
| auto | name () |
| auto | deleted () const |
| auto | set_deleted (bool deleted) |
| auto | set_key_drop (int key) |
| auto | key_drop () const |
| bool | IsOverlord () const |
| void | set_subtype (int subtype) |
| void | set_layer (int layer) |
Public Member Functions inherited from yaze::zelda3::GameEntity | |
| auto | set_x (int x) |
| auto | set_y (int y) |
| GameEntity ()=default | |
| virtual | ~GameEntity () |
Private Attributes | |
| uint8_t | map_id_ |
| uint8_t | game_state_ |
| uint8_t | id_ |
| uint8_t | nx_ |
| uint8_t | ny_ |
| uint8_t | overlord_ = 0 |
| uint8_t | lower_x_ = 32 |
| uint8_t | lower_y_ = 32 |
| uint8_t | higher_x_ = 0 |
| uint8_t | higher_y_ = 0 |
| int | width_ = 16 |
| int | height_ = 16 |
| int | map_x_ = 0 |
| int | map_y_ = 0 |
| int | layer_ = 0 |
| int | subtype_ = 0 |
| int | key_drop_ = 0 |
| bool | deleted_ = false |
| bool | overworld_ |
| std::string | name_ |
| std::vector< uint8_t > | preview_gfx_ |
| std::vector< uint8_t > | current_gfx_ |
| const uint8_t * | external_gfx_ = nullptr |
| size_t | external_gfx_size_ = 0 |
| SDL_Rect | bounding_box_ |
Additional Inherited Members | |
Public Types inherited from yaze::zelda3::GameEntity | |
| enum | EntityType { kEntrance = 0 , kExit = 1 , kItem = 2 , kSprite = 3 , kTransport = 4 , kMusic = 5 , kTilemap = 6 , kProperties = 7 , kDungeonSprite = 8 } |
Public Attributes inherited from yaze::zelda3::GameEntity | |
| enum yaze::zelda3::GameEntity::EntityType | entity_type_ |
| int | x_ = 0 |
| int | y_ = 0 |
| int | game_x_ = 0 |
| int | game_y_ = 0 |
| int | entity_id_ = 0 |
| uint16_t | map_id_ = 0 |
A class for managing sprites in the overworld and underworld.
|
default |
|
inline |
Definition at line 40 of file sprite.h.
References yaze::zelda3::GameEntity::entity_id_, yaze::zelda3::GameEntity::entity_type_, id(), yaze::zelda3::GameEntity::kSprite, map_x_, map_y_, name_, overworld_, yaze::zelda3::ResolveSpriteName(), yaze::zelda3::GameEntity::x_, and yaze::zelda3::GameEntity::y_.
|
inline |
Definition at line 58 of file sprite.h.
References yaze::zelda3::kOverlordNames, name_, overlord_, yaze::zelda3::ResolveSpriteName(), subtype(), x(), yaze::zelda3::GameEntity::x_, y(), and yaze::zelda3::GameEntity::y_.
|
inline |
Definition at line 69 of file sprite.h.
References current_gfx_, yaze::zelda3::GameEntity::entity_id_, yaze::zelda3::GameEntity::entity_type_, id(), id_, yaze::zelda3::GameEntity::kSprite, map_id_, map_x(), map_x_, map_y(), map_y_, name_, nx_, ny_, overworld_, yaze::zelda3::ResolveSpriteName(), x(), yaze::zelda3::GameEntity::x_, y(), and yaze::zelda3::GameEntity::y_.
| void yaze::zelda3::Sprite::Draw | ( | ) |
| void yaze::zelda3::Sprite::RenderPreviewGraphics | ( | std::span< const uint8_t > | graphics | ) |
Definition at line 1185 of file sprite.cc.
References bounding_box_, Draw(), external_gfx_, external_gfx_size_, nx_, ny_, preview_gfx_, yaze::zelda3::GameEntity::x_, and yaze::zelda3::GameEntity::y_.
Referenced by yaze::editor::DungeonCanvasViewer::RenderSprites().
| void yaze::zelda3::Sprite::ClearPreviewGraphics | ( | ) |
Definition at line 1221 of file sprite.cc.
References preview_gfx_.
| void yaze::zelda3::Sprite::DrawSpriteTile | ( | int | x, |
| int | y, | ||
| int | srcx, | ||
| int | srcy, | ||
| int | pal, | ||
| bool | mirror_x = false, | ||
| bool | mirror_y = false, | ||
| int | sizex = 2, | ||
| int | sizey = 2 ) |
Definition at line 1225 of file sprite.cc.
References current_gfx_, external_gfx_, external_gfx_size_, height(), preview_gfx_, width(), x(), and y().
Referenced by Draw().
|
overridevirtual |
Update entity properties based on map position.
| map_id | Parent map ID to update to |
| context | Optional context (typically const Overworld* for coordinate calculations) |
ZScream equivalent: UpdateMapStuff() / UpdateMapProperties()
This method recalculates derived properties like:
Implements yaze::zelda3::GameEntity.
Definition at line 325 of file sprite.cc.
References id_, map_x_, map_y_, name_, yaze::zelda3::ResolveSpriteName(), yaze::zelda3::GameEntity::x_, and yaze::zelda3::GameEntity::y_.
Referenced by yaze::editor::DrawSpriteEditorPopup().
| void yaze::zelda3::Sprite::UpdateCoordinates | ( | int | map_x, |
| int | map_y ) |
|
inline |
Definition at line 98 of file sprite.h.
References preview_gfx_.
Referenced by yaze::editor::DungeonCanvasViewer::RenderSprites().
|
inline |
Definition at line 99 of file sprite.h.
References id_.
Referenced by yaze::editor::DrawSpriteEditorPopup(), InitSprite(), yaze::zelda3::Room::LoadSprites(), set_id(), and Sprite().
|
inline |
Definition at line 100 of file sprite.h.
Referenced by yaze::editor::DrawSpriteEditorPopup(), and yaze::test::OverworldEditorTestSuite::RunEntityManipulationTest().
|
inline |
Definition at line 101 of file sprite.h.
References yaze::zelda3::GameEntity::x_.
Referenced by Draw(), DrawSpriteTile(), InitSprite(), yaze::zelda3::Room::LoadSprites(), and Sprite().
|
inline |
Definition at line 102 of file sprite.h.
References yaze::zelda3::GameEntity::y_.
Referenced by Draw(), DrawSpriteTile(), InitSprite(), yaze::zelda3::Room::LoadSprites(), and Sprite().
|
inline |
|
inline |
|
inline |
Definition at line 105 of file sprite.h.
References map_id_.
Referenced by yaze::editor::DrawSpriteEditorPopup().
|
inline |
Definition at line 106 of file sprite.h.
References map_x_.
Referenced by InitSprite(), and UpdateCoordinates().
|
inline |
Definition at line 107 of file sprite.h.
References map_y_.
Referenced by InitSprite(), and UpdateCoordinates().
|
inline |
Definition at line 108 of file sprite.h.
References game_state_.
|
inline |
Definition at line 110 of file sprite.h.
References layer_.
Referenced by yaze::zelda3::Room::LoadSprites(), and set_layer().
|
inline |
Definition at line 111 of file sprite.h.
References subtype_.
Referenced by yaze::zelda3::Room::LoadSprites(), set_subtype(), and Sprite().
|
inline |
|
inline |
|
inline |
Definition at line 115 of file sprite.h.
References name_.
Referenced by yaze::editor::DrawSpriteEditorPopup().
|
inline |
|
inline |
Definition at line 117 of file sprite.h.
References deleted(), and deleted_.
Referenced by yaze::editor::DrawSpriteEditorPopup().
|
inline |
Definition at line 118 of file sprite.h.
References key_drop_.
Referenced by yaze::editor::ObjectEditorContent::DrawSelectedSpriteInfo(), and yaze::zelda3::Room::LoadSprites().
|
inline |
|
inline |
|
inline |
Definition at line 125 of file sprite.h.
References subtype(), and subtype_.
Referenced by yaze::editor::ObjectEditorContent::DrawSelectedSpriteInfo().
|
inline |
Definition at line 126 of file sprite.h.
References layer(), and layer_.
Referenced by yaze::editor::ObjectEditorContent::DrawSelectedSpriteInfo().
|
private |
Definition at line 129 of file sprite.h.
Referenced by InitSprite(), and map_id().
|
private |
Definition at line 130 of file sprite.h.
Referenced by game_state().
|
private |
Definition at line 131 of file sprite.h.
Referenced by Draw(), id(), InitSprite(), set_id(), and UpdateMapProperties().
|
private |
Definition at line 132 of file sprite.h.
Referenced by Draw(), InitSprite(), nx(), and RenderPreviewGraphics().
|
private |
Definition at line 133 of file sprite.h.
Referenced by Draw(), InitSprite(), ny(), and RenderPreviewGraphics().
|
private |
Definition at line 134 of file sprite.h.
Referenced by Draw(), IsOverlord(), and Sprite().
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 142 of file sprite.h.
Referenced by InitSprite(), map_x(), Sprite(), UpdateCoordinates(), and UpdateMapProperties().
|
private |
Definition at line 143 of file sprite.h.
Referenced by InitSprite(), map_y(), Sprite(), UpdateCoordinates(), and UpdateMapProperties().
|
private |
Definition at line 144 of file sprite.h.
Referenced by layer(), and set_layer().
|
private |
Definition at line 145 of file sprite.h.
Referenced by set_subtype(), and subtype().
|
private |
Definition at line 146 of file sprite.h.
Referenced by key_drop(), and set_key_drop().
|
private |
Definition at line 148 of file sprite.h.
Referenced by deleted(), and set_deleted().
|
private |
Definition at line 149 of file sprite.h.
Referenced by InitSprite(), and Sprite().
|
private |
Definition at line 151 of file sprite.h.
Referenced by InitSprite(), name(), Sprite(), Sprite(), and UpdateMapProperties().
|
private |
Definition at line 152 of file sprite.h.
Referenced by ClearPreviewGraphics(), DrawSpriteTile(), preview_graphics(), and RenderPreviewGraphics().
|
private |
Definition at line 153 of file sprite.h.
Referenced by DrawSpriteTile(), and InitSprite().
|
private |
Definition at line 154 of file sprite.h.
Referenced by DrawSpriteTile(), and RenderPreviewGraphics().
|
private |
Definition at line 155 of file sprite.h.
Referenced by DrawSpriteTile(), and RenderPreviewGraphics().
|
private |
Definition at line 157 of file sprite.h.
Referenced by Draw(), and RenderPreviewGraphics().