about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* Added the_perceptiveStar Rauchenberger2025-08-172-0/+8
* Added the_partialStar Rauchenberger2025-08-179-2/+435
* Added the_parthenonStar Rauchenberger2025-08-179-2/+254
* Added the_owlStar Rauchenberger2025-08-1713-1/+935
* Added the_orbStar Rauchenberger2025-08-178-1/+296
* Added the_nuancedStar Rauchenberger2025-08-167-0/+358
* Added the_livelyStar Rauchenberger2025-08-166-1/+148
* Added the_literateStar Rauchenberger2025-08-166-1/+152
* Added the_lionizedStar Rauchenberger2025-08-167-2/+155
* Minor changes for compiling on WindowsStar Rauchenberger2025-08-164-3/+5
* Started writing a data validatorStar Rauchenberger2025-08-1620-28/+1080
* Assigned IDs for the_jubilant, the_keen, and the_linearStar Rauchenberger2025-08-162-2/+243
* Added the_linearStar Rauchenberger2025-08-154-2/+93
* Added the_liberatedStar Rauchenberger2025-08-155-0/+107
* Added the_keenStar Rauchenberger2025-08-155-1/+147
* Added the_jubilantStar Rauchenberger2025-08-146-1/+210
* Assigned IDs for the_hive, the_impressive, and the_invisibleStar Rauchenberger2025-08-145-6/+311
* Added the_invisibleStar Rauchenberger2025-08-145-1/+87
* Added the_impressiveStar Rauchenberger2025-08-1412-6/+194
* Added the_hiveStar Rauchenberger2025-08-146-1/+412
* Added the_hinterlandsStar Rauchenberger2025-08-142-0/+32
* Assigned IDs for the_gold, the_graveyard, and the_greatStar Rauchenberger2025-08-144-5/+974
* Added the_greatStar Rauchenberger2025-08-1447-105/+2201
* Fixed some issues with door logicStar Rauchenberger2025-08-142-8/+28
* Added the_graveyardStar Rauchenberger2025-08-146-2/+91
* Added the_goldStar Rauchenberger2025-08-141-0/+10
* Assigned IDs for the_galleryStar Rauchenberger2025-08-135-2/+117
* Added the_galleryStar Rauchenberger2025-08-1310-41/+565
* Assigned IDs for the_extravagantStar Rauchenberger2025-08-121-0/+133
* Added the_extravagantStar Rauchenberger2025-08-1217-0/+435
* Converted to proto2Star Rauchenberger2025-08-1218-199/+192
* Items and connections in the apworldStar Rauchenberger2025-08-128-9/+254
* Add gravity to paintings/portsStar Rauchenberger2025-08-116-7/+25
* Assigned IDs for the_double_sidedStar Rauchenberger2025-08-112-1/+170
* Added the_double_sidedStar Rauchenberger2025-08-1124-1/+442
* Assigned IDs for the_doorStar Rauchenberger2025-08-111-0/+18
* Added the_doorStar Rauchenberger2025-08-114-0/+30
* Assigned IDs for the_digitalStar Rauchenberger2025-08-111-0/+96
* Added the_digitalStar Rauchenberger2025-08-119-0/+286
* Assigned IDs for the_darkroomStar Rauchenberger2025-08-111-0/+128
* Added the_darkroomStar Rauchenberger2025-08-118-2/+365
* Assigned IDs for the_congruentStar Rauchenberger2025-08-105-0/+314
* Added the_congruentStar Rauchenberger2025-08-1014-0/+475
* Assigned IDs for the_colorfulStar Rauchenberger2025-08-105-260/+469
* Added the_colorfulStar Rauchenberger2025-08-0918-0/+357
* Added support for masteriesStar Rauchenberger2025-08-0916-107/+362
* Added the_butterflyStar Rauchenberger2025-08-0913-14/+243
* Propagate complete_at to packed datafileStar Rauchenberger2025-08-092-2/+8
* Assigned IDs for the_betweenStar Rauchenberger2025-08-091-0/+179
* Added the_betweenStar Rauchenberger2025-08-0911-4/+490
">) { PostQuitMessage(0); } else if (message == WM_NOTIFY) { MSGFILTER* m = (MSGFILTER *)lParam; if (m->msg == WM_KEYDOWN && m->wParam == VK_RETURN) { if (IsWindowEnabled(g_randomizerStatus) == TRUE) { PostMessage(g_hwnd, WM_COMMAND, RANDOMIZING, NULL); return 1; // Non-zero to indicate that message was handled } } } else if (message == WM_COMMAND || message == WM_TIMER || message == WM_NOTIFY) { switch (LOWORD(wParam)) { case HEARTBEAT: switch ((ProcStatus)lParam) { case ProcStatus::NotRunning: // Shut down randomizer, wait for startup if (g_randomizer) { g_randomizer = nullptr; EnableWindow(g_randomizerStatus, FALSE); } break; case ProcStatus::Running: if (!g_randomizer) { g_randomizer = std::make_shared<Randomizer>(g_witnessProc); PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL); } break; case ProcStatus::NewGame: // This status will fire only once per new game SetWindowText(g_seed, L""); PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL); break; } break; case RANDOMIZE_READY: EnableWindow(g_randomizerStatus, TRUE); if (IsDlgButtonChecked(hwnd, CHALLENGE_ONLY)) { SetWindowText(g_randomizerStatus, L"Randomize Challenge"); } else { SetWindowText(g_randomizerStatus, L"Randomize"); } break; case RANDOMIZING: if (!g_randomizer) break; // E.g. an enter press at the wrong time EnableWindow(g_randomizerStatus, FALSE); SetRandomSeed(); std::thread([]{ if (IsDlgButtonChecked(g_hwnd, DISABLE_SNIPES)) { g_randomizer->PreventSnipes(); } if (IsDlgButtonChecked(g_hwnd, SPEED_UP_AUTOSCROLLERS)) { g_randomizer->AdjustSpeed(); } if (IsDlgButtonChecked(g_hwnd, CHALLENGE_ONLY)) { SetWindowText(g_randomizerStatus, L"Randomizing Challenge..."); g_randomizer->RandomizeChallenge(); PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_CHALLENGE_DONE, NULL); } else { SetWindowText(g_randomizerStatus, L"Randomizing..."); g_randomizer->Randomize(); PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_DONE, NULL); } }).detach(); break; case RANDOMIZE_DONE: EnableWindow(g_randomizerStatus, FALSE); SetWindowText(g_randomizerStatus, L"Randomized!"); break; case RANDOMIZE_CHALLENGE_DONE: EnableWindow(g_randomizerStatus, FALSE); SetWindowText(g_randomizerStatus, L"Randomized Challenge!"); std::thread([]{ // Allow re-randomization for challenge -- it doesn't break the rest of the game. std::this_thread::sleep_for(std::chrono::seconds(10)); PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL); }).detach(); break; case CHALLENGE_ONLY: CheckDlgButton(hwnd, CHALLENGE_ONLY, !IsDlgButtonChecked(hwnd, CHALLENGE_ONLY)); if (IsWindowEnabled(g_randomizerStatus)) { PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_READY, NULL); } break; case DISABLE_SNIPES: CheckDlgButton(hwnd, DISABLE_SNIPES, !IsDlgButtonChecked(hwnd, DISABLE_SNIPES)); break; case SPEED_UP_AUTOSCROLLERS: CheckDlgButton(hwnd, SPEED_UP_AUTOSCROLLERS, !IsDlgButtonChecked(hwnd, SPEED_UP_AUTOSCROLLERS)); break; case TMP1: { std::wstring text(128, L'\0'); int length = GetWindowText(g_panelId, text.data(), static_cast<int>(text.size())); text.resize(length); std::wstringstream s; int panelId; s << text; s >> std::hex >> panelId; g_puzzle = PuzzleSerializer(g_witnessProc).ReadPuzzle(panelId); } break; case TMP2: { std::wstring text(128, L'\0'); int length = GetWindowText(g_panelId, text.data(), static_cast<int>(text.size())); text.resize(length); std::wstringstream s; int panelId; s << text; s >> std::hex >> panelId; PuzzleSerializer(g_witnessProc).WritePuzzle(g_puzzle, panelId); } break; case TMP3: Solver::Solve(g_puzzle); break; } } return DefWindowProc(hwnd, message, wParam, lParam); } void SetRandomSeed() { std::wstring text(128, L'\0'); int length = GetWindowText(g_seed, text.data(), static_cast<int>(text.size())); if (length > 0) { // Set seed text.resize(length); Random::SetSeed(_wtoi(text.c_str())); } else { // Random seed int seed = Random::RandInt(0, 999999); SetWindowText(g_seed, std::to_wstring(seed).c_str()); RedrawWindow(g_seed, NULL, NULL, RDW_UPDATENOW); Random::SetSeed(seed); } } HWND CreateLabel(int x, int y, int width, LPCWSTR text) { return CreateWindow(L"STATIC", text, WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, x, y, width, 16, g_hwnd, NULL, g_hInstance, NULL); } HWND CreateText(int x, int y, int width, LPCWSTR defaultText = L"") { return CreateWindow(MSFTEDIT_CLASS, defaultText, WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER, x, y, width, 26, g_hwnd, NULL, g_hInstance, NULL); } #pragma warning(push) #pragma warning(disable: 4312) HWND CreateButton(int x, int y, int width, LPCWSTR text, int message) { return CreateWindow(L"BUTTON", text, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, x, y, width, 26, g_hwnd, (HMENU)message, g_hInstance, NULL); } HWND CreateCheckbox(int x, int y, int message) { return CreateWindow(L"BUTTON", L"", WS_VISIBLE | WS_CHILD | BS_CHECKBOX, x, y, 12, 12, g_hwnd, (HMENU)message, g_hInstance, NULL); } #pragma warning(pop) int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { LoadLibrary(L"Msftedit.dll"); WNDCLASSW wndClass = { CS_HREDRAW | CS_VREDRAW, WndProc, 0, 0, hInstance, NULL, LoadCursor(nullptr, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1), WINDOW_CLASS, WINDOW_CLASS, }; RegisterClassW(&wndClass); g_hInstance = hInstance; RECT rect; GetClientRect(GetDesktopWindow(), &rect); g_hwnd = CreateWindow(WINDOW_CLASS, PRODUCT_NAME, WS_OVERLAPPEDWINDOW, rect.right - 550, 200, 500, 500, nullptr, nullptr, hInstance, nullptr); CreateLabel(390, 15, 90, L"Version: " VERSION_STR); g_seed = CreateText(10, 10, 100); PostMessage(g_seed, EM_SETEVENTMASK, 0, ENM_KEYEVENTS); g_randomizerStatus = CreateButton(120, 10, 180, L"Randomize", RANDOMIZING); EnableWindow(g_randomizerStatus, FALSE); CreateCheckbox(10, 300, CHALLENGE_ONLY); CreateLabel(30, 300, 200, L"Randomize the challenge only"); CreateCheckbox(10, 320, DISABLE_SNIPES); CheckDlgButton(g_hwnd, DISABLE_SNIPES, TRUE); CreateLabel(30, 320, 240, L"Disable Swamp and Shadows snipes"); CreateCheckbox(10, 340, SPEED_UP_AUTOSCROLLERS); CreateLabel(30, 340, 205, L"Speed up various autoscrollers"); g_panelId = CreateText(200, 100, 100, L"A3B2"); CreateButton(200, 130, 100, L"Read", TMP1); CreateButton(200, 160, 100, L"Write", TMP2); CreateButton(200, 190, 100, L"Validate", TMP3); g_witnessProc->StartHeartbeat(g_hwnd); ShowWindow(g_hwnd, nCmdShow); UpdateWindow(g_hwnd); MSG msg; while (GetMessage(&msg, nullptr, 0, 0) == TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wParam; }