diff --git a/assets/images/swj.jpg b/assets/images/swj.jpg new file mode 100644 index 0000000..cdc659f Binary files /dev/null and b/assets/images/swj.jpg differ diff --git a/src/source/TetrisLogicInnovation.cpp b/src/source/TetrisLogicInnovation.cpp index d45be8d..852b3a6 100644 --- a/src/source/TetrisLogicInnovation.cpp +++ b/src/source/TetrisLogicInnovation.cpp @@ -590,6 +590,7 @@ void OpenCreditScreen() */ void ChangeCreditPage(int direction) { + constexpr int creditPageCount = 3; if (direction == 0) { return; @@ -609,9 +610,9 @@ void ChangeCreditPage(int direction) if (creditPageIndex < 0) { - creditPageIndex = 1; + creditPageIndex = creditPageCount - 1; } - if (creditPageIndex > 1) + if (creditPageIndex >= creditPageCount) { creditPageIndex = 0; } diff --git a/src/source/TetrisRender.cpp b/src/source/TetrisRender.cpp index cbef7a1..c92774c 100644 --- a/src/source/TetrisRender.cpp +++ b/src/source/TetrisRender.cpp @@ -131,11 +131,12 @@ static Bitmap* LoadBackgroundImage() */ static Bitmap* LoadCreditImage(int index) { + constexpr int creditPageCount = 3; static ULONG_PTR gdiplusToken = 0; - static Bitmap* creditImages[2] = {}; - static bool attempted[2] = {}; + static Bitmap* creditImages[creditPageCount] = {}; + static bool attempted[creditPageCount] = {}; - if (index < 0 || index >= 2) + if (index < 0 || index >= creditPageCount) { return nullptr; } @@ -147,10 +148,11 @@ static Bitmap* LoadCreditImage(int index) GdiplusStartupInput startupInput; if (GdiplusStartup(&gdiplusToken, &startupInput, nullptr) == Ok) { - const wchar_t* imageNames[2] = + const wchar_t* imageNames[creditPageCount] = { L"assets\\images\\qls.jpg", - L"assets\\images\\wyk.jpg" + L"assets\\images\\wyk.jpg", + L"assets\\images\\swj.jpg" }; const std::wstring candidates[] = { @@ -879,15 +881,18 @@ void TDrawScreen(HDC hdc, HWND hWnd) else if (helpState.currentPage == 4) { const int creditAnimationTotalTicks = 60; - const TCHAR* creditNames[2] = + constexpr int creditPageCount = 3; + const TCHAR* creditNames[creditPageCount] = { _T("qls"), - _T("wyk") + _T("wyk"), + _T("juju") }; - const TCHAR* creditTexts[2] = + const TCHAR* creditTexts[creditPageCount] = { _T("\u611f\u8c22\u6fc0\u60c5\u6295\u8eab\u4e8e\u6d4b\u8bd5\u4e4b\u4e2d\u7684Lisa"), - _T("\u611f\u8c22\u70ed\u5ff1coding\u7684\u5c0f\u86cb\u7cd5") + _T("\u611f\u8c22\u70ed\u5ff1coding\u7684\u5c0f\u86cb\u7cd5"), + _T("\u611f\u8c22\u8bfe\u524d\u95f2\u91cc\u5077\u5fd9\u7684juju") }; int currentCredit = creditPageIndex; @@ -895,17 +900,17 @@ void TDrawScreen(HDC hdc, HWND hWnd) { currentCredit = 0; } - if (currentCredit > 1) + if (currentCredit >= creditPageCount) { - currentCredit = 1; + currentCredit = creditPageCount - 1; } int previousCredit = currentCredit - creditAnimationDirection; if (previousCredit < 0) { - previousCredit = 1; + previousCredit = creditPageCount - 1; } - if (previousCredit > 1) + if (previousCredit >= creditPageCount) { previousCredit = 0; } @@ -941,6 +946,7 @@ void TDrawScreen(HDC hdc, HWND hWnd) Bitmap* preloadedCreditImageA = LoadCreditImage(0); Bitmap* preloadedCreditImageB = LoadCreditImage(1); + Bitmap* preloadedCreditImageC = LoadCreditImage(2); Graphics creditGraphics(hdc); creditGraphics.SetInterpolationMode(InterpolationModeHighQualityBilinear); @@ -951,7 +957,15 @@ void TDrawScreen(HDC hdc, HWND hWnd) OffsetRect(&shiftedImageArea, offset, 0); OffsetRect(&shiftedTextArea, offset, 0); - Bitmap* creditImage = (cardIndex == 0) ? preloadedCreditImageA : preloadedCreditImageB; + Bitmap* creditImage = preloadedCreditImageA; + if (cardIndex == 1) + { + creditImage = preloadedCreditImageB; + } + else if (cardIndex == 2) + { + creditImage = preloadedCreditImageC; + } if (creditImage != nullptr) { int imageWidth = static_cast(creditImage->GetWidth());