Refactor OverworldEntity to use uint16_t for map_id and improve code organization
This commit is contained in:
@@ -132,7 +132,7 @@ bool DrawOverworldEntrancePopup(
|
||||
}
|
||||
if (ImGui::BeginPopupModal("Entrance editor", NULL,
|
||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
gui::InputHex("Map ID", &entrance.map_id_);
|
||||
gui::InputHexWord("Map ID", &entrance.map_id_);
|
||||
gui::InputHexByte("Entrance ID", &entrance.entrance_id_,
|
||||
kInputFieldSize + 20);
|
||||
gui::InputHex("X", &entrance.x_);
|
||||
@@ -209,7 +209,7 @@ bool DrawExitEditorPopup(zelda3::overworld::OverworldExit &exit) {
|
||||
gui::InputHexWord("Room", &exit.room_id_);
|
||||
SameLine();
|
||||
gui::InputHex("Entity ID", &exit.entity_id_, 4);
|
||||
gui::InputHex("Map", &exit.map_id_);
|
||||
gui::InputHexWord("Map", &exit.map_id_);
|
||||
SameLine();
|
||||
Checkbox("Automatic", &exit.is_automatic_);
|
||||
|
||||
@@ -350,8 +350,8 @@ bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) {
|
||||
ImGui::BeginGroup();
|
||||
for (int i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
|
||||
if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
|
||||
item.id == i)) {
|
||||
item.id = i;
|
||||
item.id_ == i)) {
|
||||
item.id_ = i;
|
||||
}
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
@@ -843,8 +843,8 @@ void OverworldEditor::DrawOverworldItems() {
|
||||
int i = 0;
|
||||
for (auto &item : *overworld_.mutable_all_items()) {
|
||||
// Get the item's bitmap and real X and Y positions
|
||||
if (item.room_map_id < 0x40 + (current_world_ * 0x40) &&
|
||||
item.room_map_id >= (current_world_ * 0x40) && !item.deleted) {
|
||||
if (item.room_map_id_ < 0x40 + (current_world_ * 0x40) &&
|
||||
item.room_map_id_ >= (current_world_ * 0x40) && !item.deleted) {
|
||||
ow_map_canvas_.DrawRect(item.x_, item.y_, 16, 16, ImVec4(255, 0, 0, 150));
|
||||
|
||||
if (current_mode == EditingMode::ITEMS) {
|
||||
@@ -862,10 +862,10 @@ void OverworldEditor::DrawOverworldItems() {
|
||||
}
|
||||
}
|
||||
std::string item_name = "";
|
||||
if (item.id < zelda3::overworld::kSecretItemNames.size()) {
|
||||
item_name = zelda3::overworld::kSecretItemNames[item.id];
|
||||
if (item.id_ < zelda3::overworld::kSecretItemNames.size()) {
|
||||
item_name = zelda3::overworld::kSecretItemNames[item.id_];
|
||||
} else {
|
||||
item_name = absl::StrFormat("0x%02X", item.id);
|
||||
item_name = absl::StrFormat("0x%02X", item.id_);
|
||||
}
|
||||
ow_map_canvas_.DrawText(item_name, item.x_, item.y_);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user