yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::GameEntity Class Referenceabstract

Base class for all overworld and dungeon entities. More...

#include <common.h>

Inheritance diagram for yaze::zelda3::GameEntity:

Public Types

enum  EntityType {
  kEntrance = 0 , kExit = 1 , kItem = 2 , kSprite = 3 ,
  kTransport = 4 , kMusic = 5 , kTilemap = 6 , kProperties = 7 ,
  kDungeonSprite = 8
}
 

Public Member Functions

auto set_x (int x)
 
auto set_y (int y)
 
 GameEntity ()=default
 
virtual ~GameEntity ()
 
virtual void UpdateMapProperties (uint16_t map_id, const void *context=nullptr)=0
 Update entity properties based on map position.
 

Public Attributes

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
 

Detailed Description

Base class for all overworld and dungeon entities.

Coordinate System (matches ZScream naming conventions):

  • x_, y_: World coordinates in pixels (0-4095 for overworld) ZScream equivalent: PlayerX/PlayerY (ExitOW.cs), GlobalX/GlobalY (EntranceOW.cs)
  • game_x_, game_y_: Map-local tile coordinates (0-63 for normal, 0-31 for small areas) ZScream equivalent: AreaX/AreaY (ExitOW.cs), GameX/GameY (items/sprites)
  • map_id_: Parent map ID accounting for large/wide/tall multi-area maps ZScream equivalent: MapID property
  • entity_id_: Index in entity array (for display/debugging)

Definition at line 31 of file common.h.

Member Enumeration Documentation

◆ EntityType

Enumerator
kEntrance 
kExit 
kItem 
kSprite 
kTransport 
kMusic 
kTilemap 
kProperties 
kDungeonSprite 

Definition at line 33 of file common.h.

Constructor & Destructor Documentation

◆ GameEntity()

yaze::zelda3::GameEntity::GameEntity ( )
default

◆ ~GameEntity()

virtual yaze::zelda3::GameEntity::~GameEntity ( )
inlinevirtual

Definition at line 66 of file common.h.

Member Function Documentation

◆ set_x()

auto yaze::zelda3::GameEntity::set_x ( int x)
inline

Definition at line 62 of file common.h.

References x_.

Referenced by yaze::editor::MoveEntityOnGrid().

◆ set_y()

auto yaze::zelda3::GameEntity::set_y ( int y)
inline

Definition at line 63 of file common.h.

References y_.

Referenced by yaze::editor::MoveEntityOnGrid().

◆ UpdateMapProperties()

virtual void yaze::zelda3::GameEntity::UpdateMapProperties ( uint16_t map_id,
const void * context = nullptr )
pure virtual

Update entity properties based on map position.

Parameters
map_idParent map ID to update to
contextOptional context (typically const Overworld* for coordinate calculations)

ZScream equivalent: UpdateMapStuff() / UpdateMapProperties()

This method recalculates derived properties like:

  • game_x_/game_y_ from world x_/y_ coordinates
  • Scroll/camera values for exits (if is_automatic_ = true)
  • Map position encoding for saving

Implemented in yaze::zelda3::OverworldExit, yaze::zelda3::OverworldEntrance, yaze::zelda3::Sprite, and yaze::zelda3::OverworldItem.

Referenced by yaze::editor::OverworldEditor::DrawOverworldCanvas().

Member Data Documentation

◆ entity_type_

◆ x_

◆ y_

◆ game_x_

◆ game_y_

◆ entity_id_

◆ map_id_


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