yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
crumble_floor_model.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_UI_CRUMBLE_CRUMBLE_FLOOR_MODEL_H_
2#define YAZE_APP_EDITOR_DUNGEON_UI_CRUMBLE_CRUMBLE_FLOOR_MODEL_H_
3
4#include <array>
5#include <cstdint>
6#include <optional>
7#include <vector>
8
9#include "absl/status/status.h"
10
11namespace yaze::editor {
12
13// Oracle's CrumbleFloorTag_Main compares the complete BG1 top-left word of
14// each 16px foot cell. Palette/flip bits must not be masked off. This model
15// starts with an explicitly chosen previous cell; it does not emulate room
16// entry RAM, collision, elevation, jumping, Minish, or other room tags.
19
21 public:
22 static constexpr int kWidth = 32;
23 static constexpr int kCellCount = kWidth * kWidth;
24 static constexpr int kMaxSteps = 512;
25 using Words = std::array<uint16_t, kCellCount>;
26
27 void Reset(const Words& words);
28 absl::Status Step(int x, int y);
29 void Back();
30 CrumbleFloorCell cell(int index) const { return cells_.at(index); }
31 const std::vector<int>& route() const { return route_; }
32 std::optional<int> current() const {
33 return route_.empty() ? std::nullopt : std::optional<int>(route_.back());
34 }
35
36 private:
37 void Rebuild();
39 std::array<CrumbleFloorCell, kCellCount> cells_{};
40 std::vector<int> route_;
41};
42
43} // namespace yaze::editor
44#endif
std::array< CrumbleFloorCell, kCellCount > cells_
CrumbleFloorCell cell(int index) const
absl::Status Step(int x, int y)
std::optional< int > current() const
std::array< uint16_t, kCellCount > Words
const std::vector< int > & route() const
Editors are the view controllers for the application.
CrumbleFloorCell ClassifyCrumbleFloorWord(uint16_t word)