|
7 | 7 | #include "UnifontSupport.h" |
8 | 8 | #include "Lang.h" |
9 | 9 | #include "../REPENTOGONOptions.h" |
| 10 | +#include "../Patches/VirtualRoomSets.h" |
10 | 11 |
|
11 | 12 | #include <sstream> |
12 | 13 | #include <cctype> |
@@ -626,61 +627,84 @@ struct ConsoleMega : ImGuiWindowObject { |
626 | 627 | } |
627 | 628 |
|
628 | 629 | case GOTO: { |
629 | | - unsigned int stbID = RoomConfig::GetStageID(g_Game->_stage, g_Game->_stageType, -1); |
630 | | - RoomConfig_Stage* stage = &g_Game->GetRoomConfig()->_stages[stbID]; |
631 | | - RoomSet* set = &stage->_rooms[g_Game->IsGreedMode()]; |
632 | | - RoomConfig_Room* config = set->_configs; |
633 | | - std::map<int, std::string> specialRoomTypes = { |
634 | | - std::pair<int, std::string>(1, "default"), |
635 | | - std::pair<int, std::string>(2, "shop"), |
636 | | - std::pair<int, std::string>(3, "error"), |
637 | | - std::pair<int, std::string>(4, "treasure"), |
638 | | - std::pair<int, std::string>(5, "boss"), |
639 | | - std::pair<int, std::string>(6, "miniboss"), |
640 | | - std::pair<int, std::string>(7, "secret"), |
641 | | - std::pair<int, std::string>(8, "supersecret"), |
642 | | - std::pair<int, std::string>(9, "arcade"), |
643 | | - std::pair<int, std::string>(10, "curse"), |
644 | | - std::pair<int, std::string>(11, "challenge"), |
645 | | - std::pair<int, std::string>(12, "library"), |
646 | | - std::pair<int, std::string>(13, "sacrifice"), |
647 | | - std::pair<int, std::string>(14, "devil"), |
648 | | - std::pair<int, std::string>(15, "angel"), |
649 | | - std::pair<int, std::string>(16, "itemdungeon"), |
650 | | - std::pair<int, std::string>(17, "bossrush"), |
651 | | - std::pair<int, std::string>(18, "isaacs"), |
652 | | - std::pair<int, std::string>(19, "barren"), |
653 | | - std::pair<int, std::string>(20, "chest"), |
654 | | - std::pair<int, std::string>(21, "dice"), |
655 | | - std::pair<int, std::string>(22, "blackmarket"), |
656 | | - std::pair<int, std::string>(23, "greedexit"), |
657 | | - std::pair<int, std::string>(24, "planetarium"), |
658 | | - std::pair<int, std::string>(25, "teleporter"), |
659 | | - std::pair<int, std::string>(26, "teleporterexit"), |
660 | | - std::pair<int, std::string>(27, "secretexit"), |
661 | | - std::pair<int, std::string>(28, "blue"), |
662 | | - std::pair<int, std::string>(29, "ultrasecret"), |
663 | | - std::pair<int, std::string>(30, "deathmatch"), |
| 630 | + const std::map<int, std::string> specialRoomTypes = { |
| 631 | + {1, "default"}, |
| 632 | + {2, "shop"}, |
| 633 | + {3, "error"}, |
| 634 | + {4, "treasure"}, |
| 635 | + {5, "boss"}, |
| 636 | + {6, "miniboss"}, |
| 637 | + {7, "secret"}, |
| 638 | + {8, "supersecret"}, |
| 639 | + {9, "arcade"}, |
| 640 | + {10, "curse"}, |
| 641 | + {11, "challenge"}, |
| 642 | + {12, "library"}, |
| 643 | + {13, "sacrifice"}, |
| 644 | + {14, "devil"}, |
| 645 | + {15, "angel"}, |
| 646 | + {16, "itemdungeon"}, |
| 647 | + {17, "bossrush"}, |
| 648 | + {18, "isaacs"}, |
| 649 | + {19, "barren"}, |
| 650 | + {20, "chest"}, |
| 651 | + {21, "dice"}, |
| 652 | + {22, "blackmarket"}, |
| 653 | + {23, "greedexit"}, |
| 654 | + {24, "planetarium"}, |
| 655 | + {25, "teleporter"}, |
| 656 | + {26, "teleporterexit"}, |
| 657 | + {27, "secretexit"}, |
| 658 | + {28, "blue"}, |
| 659 | + {29, "ultrasecret"}, |
| 660 | + {30, "deathmatch"}, |
664 | 661 | }; |
665 | 662 |
|
666 | | - for (unsigned int i = 1; i < set->_count; ++i) { |
667 | | - if (config->Type != 1) { |
668 | | - entries.insert(AutocompleteEntry(std::string("x.") + specialRoomTypes[config->Type] + "." + std::to_string(config->Variant), config->Name)); |
669 | | - config++; |
670 | | - continue; |
671 | | - }; |
672 | | - entries.insert(AutocompleteEntry(std::string("d.") + std::to_string(config->Variant), config->Name)); |
| 663 | + auto addEntry = [this, specialRoomTypes](const RoomConfig_Room& room) -> void { |
| 664 | + std::string text = "d."; |
| 665 | + if (room.StageId == STB_SPECIAL_ROOMS || room.Type != 1) { |
| 666 | + if (room.StageId == STB_SPECIAL_ROOMS) { |
| 667 | + text = "s."; |
| 668 | + } else { |
| 669 | + text = "x."; |
| 670 | + } |
| 671 | + if (specialRoomTypes.find(room.Type) != specialRoomTypes.end()) { |
| 672 | + text += specialRoomTypes.at(room.Type) + "."; |
| 673 | + } else { |
| 674 | + // IDK what to do here for now. SKIP. |
| 675 | + return; |
| 676 | + } |
| 677 | + } |
| 678 | + text += std::to_string(room.Variant); |
| 679 | + entries.insert(AutocompleteEntry(text, room.Name)); |
| 680 | + }; |
| 681 | + |
| 682 | + unsigned int stbID = RoomConfig::GetStageID(g_Game->_stage, g_Game->_stageType, -1); |
| 683 | + int mode = g_Game->IsGreedMode(); |
| 684 | + |
| 685 | + // Add stage rooms. |
| 686 | + RoomSet* stageSet = &g_Game->GetRoomConfig()->_stages[stbID]._rooms[mode]; |
| 687 | + RoomConfig_Room* config = stageSet->_configs; |
| 688 | + |
| 689 | + for (unsigned int i = 1; i < stageSet->_count; ++i) { |
| 690 | + addEntry(*config); |
673 | 691 | config++; |
674 | 692 | } |
| 693 | + for (const auto& room : VirtualRoomSetManager::Get().GetRoomSet(stbID, mode)) { |
| 694 | + addEntry(room); |
| 695 | + } |
675 | 696 |
|
676 | | - RoomConfig_Stage* special = &g_Game->GetRoomConfig()->_stages[0]; |
677 | | - RoomSet* specialSet = &special->_rooms[g_Game->IsGreedMode()]; |
| 697 | + // Add special rooms. |
| 698 | + RoomSet* specialSet = &g_Game->GetRoomConfig()->_stages[STB_SPECIAL_ROOMS]._rooms[mode]; |
678 | 699 | config = specialSet->_configs; |
679 | 700 |
|
680 | 701 | for (unsigned int i = 0; i < specialSet->_count; ++i) { |
681 | | - entries.insert(AutocompleteEntry(std::string("s.") + specialRoomTypes[config->Type] + "." + std::to_string(config->Variant), config->Name)); |
| 702 | + addEntry(*config); |
682 | 703 | config++; |
683 | 704 | } |
| 705 | + for (const auto& room : VirtualRoomSetManager::Get().GetRoomSet(STB_SPECIAL_ROOMS, mode)) { |
| 706 | + addEntry(room); |
| 707 | + } |
684 | 708 |
|
685 | 709 | break; |
686 | 710 | } |
|
0 commit comments