about summary refs log tree commit diff stats
path: root/data/maps/the_double_sided/doors.txtpb
blob: 02b113a95e59e6f47dfc658a62ff018694a91758 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
doors {
  name: "Obverse White/Orange Door"
  type: EVENT
  panels { room: "Flipped Orange Area" name: "HEAVEN" }
}
doors {
  name: "Obverse White/Blue Door"
  type: EVENT
  panels { room: "Flipped Blue Area" name: "HEAD" }
}
doors {
  name: "Obverse White/Black Door"
  type: EVENT
  panels { room: "Start" name: "FULL" }
}
doors {
  name: "Obverse White/Green Door"
  type: EVENT
  panels { room: "Flipped Green Area" name: "HIGH" }
}
doors {
  name: "Obverse White/Purple Door"
  type: EVENT
  panels { room: "Flipped Purple Area" name: "CEILING" }
}
doors {
  name: "Flipped White/Orange Door"
  type: EVENT
  panels { room: "Obverse Orange Isolated Section" name: "TOP" }
}
doors {
  name: "Flipped White/Purple Door"
  type: EVENT
  panels { room: "Obverse Orange Isolated Section" name: "TOP" }
  # Is this a mistake? It seems like it should be Obverse Purple Area / ABOVE.
}
doors {
  name: "Flipped White/Yellow Door"
  type: EVENT
  panels { room: "Start" name: "ATTIC" }
}
doors {
  name: "Obverse Black/Green Panel"
  type: EVENT
  # The panel blocks your way; there's no door.
  panels { room: "Obverse Black Area" name: "TRAIN" }
}
doors {
  name: "Obverse Black/Yellow Panel"
  type: EVENT
  # The panel blocks your way; there's no door.
  panels { room: "Obverse Black Area" name: "MOUNTAIN" }
}
doors {
  name: "Obverse Black/Pink Door"
  type: EVENT
  panels { room: "Flipped Black Area" name: "SEAPLANE" }
}
doors {
  name: "Flipped Green/Black Door"
  type: EVENT
  panels { room: "Obverse Black Area" name: "TRAIN" }
}
doors {
  name: "Flipped Green/Purple Door"
  type: EVENT
  panels { room: "Obverse Green Area" name: "UPSIDE" }
}
doors {
  name: "Flipped Orange/Brown Door"
  type: EVENT
  panels { room: "Obverse Orange Front Area" name: "UP" }
  panels { room: "Obverse Orange Back Area" name: "OVER" }
}
doors {
  name: "Obverse Blue/Orange Door"
  type: EVENT
  panels { room: "Flipped Blue Area" name: "SKY" }
}
doors {
  name: "Obverse Red/Orange Door"
  type: EVENT
  panels { room: "Flipped Red Area" name: "RAISED" }
}
doors {
  name: "Obverse Purple/Red Door"
  type: EVENT
  panels { room: "Flipped Purple Area" name: "LEAVES" }
}
doors {
  name: "Obverse Yellow/Blue Door"
  type: EVENT
  panels { room: "Flipped Yellow Back Area" name: "ANGELS" }
}
doors {
  name: "Flipped Pink/Yellow Door"
  type: EVENT
  panels { room: "Obverse Pink Area" name: "CLOUD" }
}
doors {
  name: "Flipped Yellow/Black Door"
  type: EVENT
  panels { room: "Obverse Black Area" name: "MOUNTAIN" }
}
doors {
  name: "Flipped Purple/Red Door"
  type: EVENT
  panels { room: "Obverse Purple Area" name: "DRAGON" }
}
doors {
  name: "Flipped Black/Pink Panel"
  type: EVENT
  # The panel blocks your way; there's no door.
  panels { room: "Flipped Black Area" name: "SEAPLANE" }
}
am) { if (message == WM_DESTROY) { 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); SetWindowText(g_randomizerStatus, L"Randomize Challenge"); break; case RANDOMIZING: if (!g_randomizer) break; // E.g. an enter press at the wrong time EnableWindow(g_randomizerStatus, FALSE); SetRandomSeed(); std::thread([]{ SetWindowText(g_randomizerStatus, L"Randomizing Challenge..."); MEMORY_CATCH(g_randomizer->RandomizeChallenge()); PostMessage(g_hwnd, WM_COMMAND, RANDOMIZE_CHALLENGE_DONE, NULL); }).detach(); 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; } } 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); text = std::to_wstring(seed); SetWindowText(g_seed, text.c_str()); CHARRANGE range = {0, static_cast<long>(text.length())}; PostMessage(g_seed, EM_EXSETSEL, NULL, (LPARAM)&range); SetFocus(g_seed); 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, L"21581"); PostMessage(g_seed, EM_SETEVENTMASK, 0, ENM_KEYEVENTS); g_randomizerStatus = CreateButton(120, 10, 180, L"Randomize", RANDOMIZING); EnableWindow(g_randomizerStatus, FALSE); g_witnessProc->StartHeartbeat(g_hwnd, HEARTBEAT); ShowWindow(g_hwnd, nCmdShow); UpdateWindow(g_hwnd); MSG msg; while (GetMessage(&msg, nullptr, 0, 0) == TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wParam; }