refactor: enhance overworld entity properties and version handling
- Updated `UpdateMapProperties` methods across various entities (entrances, exits, items, sprites) to include an optional context parameter for improved area size detection. - Introduced `OverworldVersionHelper` for centralized ROM version detection and feature gating, replacing scattered inline checks. - Refactored coordinate calculations to utilize normalized map IDs, ensuring consistency and preventing data corruption. - Enhanced exit properties to sync player positions and calculate scroll/camera values based on the overworld context. Benefits: - Streamlines entity property updates and improves compatibility with different ROM versions. - Reduces code duplication and enhances maintainability by centralizing version checks. - Ensures accurate coordinate calculations for overworld entities, improving overall functionality.
This commit is contained in:
@@ -331,7 +331,7 @@ class Sprite : public GameEntity {
|
||||
bool mirror_x = false, bool mirror_y = false,
|
||||
int sizex = 2, int sizey = 2);
|
||||
|
||||
void UpdateMapProperties(uint16_t map_id) override;
|
||||
void UpdateMapProperties(uint16_t map_id, const void* context = nullptr) override;
|
||||
void UpdateCoordinates(int map_x, int map_y);
|
||||
|
||||
auto preview_graphics() const { return &preview_gfx_; }
|
||||
|
||||
Reference in New Issue
Block a user