MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / replayDialog

Function replayDialog

TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp:2032–2369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2030 }
2031
2032 void replayDialog()
2033 {
2034 if (s_replaySetupRequired)
2035 {
2036 setupReplay();
2037 }
2038
2039 // Create the current display info to adjust menu sizes.
2040 DisplayInfo displayInfo;
2041 TFE_RenderBackend::getDisplayInfo(&displayInfo);
2042
2043 f32 leftColumn = displayInfo.width < 1200 ? 196.0f * s_uiScale : 256.0f * s_uiScale;
2044 f32 rightColumn = leftColumn + ((f32)TFE_SaveSystem::SAVE_IMAGE_WIDTH + 32.0f) * s_uiScale;
2045 const s32 listOffset = 0;
2046
2047 // Left Column
2048 ImGui::SetNextWindowPos(ImVec2(leftColumn, floorf(displayInfo.height * 0.07f)));
2049
2050 ImGui::BeginChild("##ImageAndInfo");
2051 {
2052 // Image
2053 ImVec2 size((f32)TFE_SaveSystem::SAVE_IMAGE_WIDTH, (f32)TFE_SaveSystem::SAVE_IMAGE_HEIGHT);
2054 size.x *= s_uiScale;
2055 size.y *= s_uiScale;
2056
2057 ImGui::Image(TFE_RenderBackend::getGpuPtr(s_replayImageView), size,
2058 ImVec2(0, 0), ImVec2(1, 1), ImVec4(1, 1, 1, 1), ImVec4(0.5f, 0.5f, 0.5f, 1.0f));
2059
2060 // Replay Info
2061 size.y = 200 * s_uiScale;
2062 ImGui::BeginChild("##InfoWithBorder", size, true, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
2063 {
2064 if (!s_replayDirContents.empty())
2065 {
2066 ImGui::PushFont(s_dialogFont);
2067 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.0f, 0.0f, 0.0f, 0.0f));
2068
2069 char textBuffer[TFE_MAX_PATH];
2070 bool modExist = modLoader_exist(s_replayDirContents[s_selectedReplay - listOffset].modNames);
2071 char modExistStr[256];
2072
2073 string versionStr = std::to_string(s_replayDirContents[s_selectedReplay - listOffset].saveVersion);
2074 if (!TFE_SaveSystem::versionValid(s_replayDirContents[s_selectedReplay - listOffset].saveVersion))
2075 {
2076 versionStr = versionStr + " ( INCOMPATIBLE! )";
2077 }
2078 sprintf(modExistStr, modExist ? "" : "Missing %s", s_replayDirContents[s_selectedReplay - listOffset].modNames);
2079 sprintf(textBuffer, "Game: Dark Forces\nTime: %s\nLevel: %s\nLevel Id: %s\nMods: %s\n%s\nDuration: %d\nVersion: %s", s_replayDirContents[s_selectedReplay - listOffset].dateTime,
2080 s_replayDirContents[s_selectedReplay - listOffset].levelName, s_replayDirContents[s_selectedReplay - listOffset].levelId, s_replayDirContents[s_selectedReplay - listOffset].modNames, modExistStr, s_replayDirContents[s_selectedReplay - listOffset].replayCounter, versionStr.c_str());
2081 ImGui::InputTextMultiline("##Info", textBuffer, strlen(textBuffer) + 1, size, ImGuiInputTextFlags_ReadOnly);
2082
2083 ImGui::PopFont();
2084 ImGui::PopStyleColor();
2085 }
2086 else
2087 {
2088 ImGui::PushFont(s_dialogFont);
2089 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.0f, 0.0f, 0.0f, 0.0f));

Callers 1

configReplayFunction · 0.85

Calls 15

setupReplayFunction · 0.85
getDisplayInfoFunction · 0.85
ImVec2Function · 0.85
ImageClass · 0.85
getGpuPtrFunction · 0.85
modLoader_existFunction · 0.85
versionValidFunction · 0.85
getGameSettingsFunction · 0.85
enableCutscenesFunction · 0.85
ButtonEnum · 0.85
logWriteFunction · 0.85
populateReplayDirectoryFunction · 0.85

Tested by

no test coverage detected