|
9 | 9 | #include "IconsForkAwesome.h" |
10 | 10 | #include "modes/ActorMode.hpp" |
11 | 11 | #include "scene/ModelViewer.hpp" |
| 12 | +#include "io/BtiIO.hpp" |
| 13 | +#include "ResUtil.hpp" |
12 | 14 |
|
13 | 15 | namespace { |
14 | 16 | std::shared_ptr<Archive::Rarc> ActiveRoomArchive = nullptr; |
15 | 17 | std::shared_ptr<Archive::File> EditFileName = nullptr; |
16 | 18 | std::shared_ptr<Archive::File> SelectedFile = nullptr; |
17 | 19 | std::shared_ptr<Archive::File> SelectedAnimation = nullptr; |
18 | 20 | std::string FileName = "(null)"; |
| 21 | + uint32_t PreviousRoomID = 0xFFFFFFFF; |
| 22 | + uint32_t CurRoomNameImgID = 0x00000000; |
| 23 | + uint32_t CurRoomNameWidth = 0; |
19 | 24 | } |
20 | 25 |
|
21 | 26 | std::string const LRoomEntityTreeNodeNames[LRoomEntityType_Max] = { |
@@ -168,6 +173,25 @@ void LRoomDOMNode::RenderHierarchyUI(std::shared_ptr<LDOMNodeBase> self, LEditor |
168 | 173 |
|
169 | 174 | bool openRoomRes = false; |
170 | 175 | if(GetIsSelected()){ |
| 176 | + if(PreviousRoomID != mRoomNumber && GCResourceManager.mLoadedGameArchive){ |
| 177 | + PreviousRoomID = mRoomNumber; |
| 178 | + |
| 179 | + if(CurRoomNameImgID != 0){ |
| 180 | + glDeleteTextures(1, &CurRoomNameImgID); |
| 181 | + } |
| 182 | + std::cout << std::format("/kawano/roomname/{}", LResUtility::GetNameMap("MapTitlecards")["titlecards"][mRoomNumber].get<std::string>()) << std::endl; |
| 183 | + auto fileData = GCResourceManager.mGameArchive->GetFile(std::format("/kawano/roomname/{}", LResUtility::GetNameMap("MapTitlecards")["titlecards"][mRoomNumber].get<std::string>())); |
| 184 | + bStream::CMemoryStream file(fileData->GetData(), fileData->GetSize(), bStream::Endianess::Big, bStream::OpenMode::In); |
| 185 | + |
| 186 | + uint32_t h; |
| 187 | + uint8_t* roomImage = Bti::DecodeImage(&file, CurRoomNameWidth, h); |
| 188 | + |
| 189 | + glCreateTextures(GL_TEXTURE_2D, 1, &CurRoomNameImgID); |
| 190 | + glTextureStorage2D(CurRoomNameImgID, 1, GL_RGBA8, CurRoomNameWidth, h); |
| 191 | + glTextureSubImage2D(CurRoomNameImgID, 0, 0, 0, CurRoomNameWidth, h, GL_RGBA, GL_UNSIGNED_BYTE, roomImage); |
| 192 | + delete[] roomImage; |
| 193 | + |
| 194 | + } |
171 | 195 | ImVec2 center = ImGui::GetMainViewport()->GetCenter(); |
172 | 196 | ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2(0.5f, 0.5f)); |
173 | 197 | if(ImGui::BeginPopupModal("##roomResources", NULL, ImGuiWindowFlags_AlwaysAutoResize)){ |
@@ -619,6 +643,13 @@ void LRoomDOMNode::RenderDetailsUI(float dt) |
619 | 643 | { |
620 | 644 | std::shared_ptr<LRoomDataDOMNode> dataNode = GetChildrenOfType<LRoomDataDOMNode>(EDOMNodeType::RoomData)[0]; |
621 | 645 |
|
| 646 | + ImGui::Image(static_cast<uintptr_t>(CurRoomNameImgID), ImVec2(CurRoomNameWidth, 32)); |
| 647 | + ImGui::SameLine(); |
| 648 | + ImGui::Text(ICON_FK_FOLDER_OPEN); |
| 649 | + if(ImGui::IsItemClicked()){ |
| 650 | + // open file |
| 651 | + } |
| 652 | + |
622 | 653 | // Integers |
623 | 654 | ImGui::InputInt("Lightning Direction", &mThunder); |
624 | 655 | LUIUtility::RenderTooltip("How frequently thunder and lightning occurs while in this room."); |
|
0 commit comments