From 5f99f9e87ef23f342e89bab029cc4fc8c5ad6663 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sun, 28 Oct 2018 20:51:35 -0700 Subject: Better UI + tried audio logs --- Source/Main.cpp | 26 +++++++++---------- Source/Panels.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++ Source/Randomizer.cpp | 13 +++++++--- Source/Randomizer.h | 1 + Source/RandomizerCore.cpp | 14 ++++++++++ Source/RandomizerCore.h | 7 +++-- Source/Source.vcxproj | 4 +++ 7 files changed, 111 insertions(+), 19 deletions(-) (limited to 'Source') diff --git a/Source/Main.cpp b/Source/Main.cpp index 8a7a5bb..0081808 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -15,7 +15,7 @@ HINSTANCE hInst; WCHAR szWindowClass[MAX_LOADSTRING]; -HWND hwndSeed; +HWND hwndSeed, hwndRandomize; // Forward declares ATOM MyRegisterClass(HINSTANCE hInstance); @@ -67,26 +67,23 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) WCHAR szTitle[MAX_LOADSTRING]; LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); + HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + 400, 200, 500, 500, nullptr, nullptr, hInstance, nullptr); - if (!hWnd) - { - return FALSE; - } + if (!hWnd) return FALSE; LoadLibrary(L"Msftedit.dll"); - HWND label = CreateWindow(L"BUTTON", L"Enter a seed:", - WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 10, 10, 100, 26, hWnd, NULL, hInst, NULL); + HWND label = CreateWindow(L"STATIC", L"Enter a seed:", + WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, + 10, 15, 90, 16, hWnd, NULL, hInst, NULL); hwndSeed = CreateWindowEx(0, MSFTEDIT_CLASS, L"", - ES_MULTILINE | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP, - 120, 10, 50, 26, hWnd, NULL, hInst, NULL); + WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER, + 100, 10, 50, 26, hWnd, NULL, hInst, NULL); - HWND hwndRandomize = CreateWindow(L"BUTTON", L"Randomize", + hwndRandomize = CreateWindow(L"BUTTON", L"Randomize", WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 180, 10, 100, 26, hWnd, (HMENU)IDC_RANDOMIZE, hInst, NULL); + 160, 10, 100, 26, hWnd, (HMENU)IDC_RANDOMIZE, hInst, NULL); HDC hdc = GetDC(hWnd); RECT rect; @@ -122,6 +119,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } srand(seed); Randomizer().Randomize(); + SetWindowText(hwndRandomize, L"Randomized!"); } } return DefWindowProc(hWnd, message, wParam, lParam); diff --git a/Source/Panels.h b/Source/Panels.h index 2187d57..d7690b8 100644 --- a/Source/Panels.h +++ b/Source/Panels.h @@ -685,3 +685,68 @@ std::vector nothingPanels = { 0x17C31, // Desert Final Transparent 0x19650, // Shadows Laser }; + +std::vector audiologs = { + 0x3C0F7, // Boat Treehouse Rock + 0x3C0FD, // Boat Broken Boat + 0x32A00, // Bunker Green Room + 0x3C0FE, // Desert Broken Wall +// 0x338B0, // Easter Egg Ending Briefcase (?) +// 0x338B7, // Easter Egg Ending Briefcase (?) +// 0x338AD, // Easter Egg Ending Briefcase (iOS) +// 0x338A5, // Easter Egg Ending Wine Table +// 0x338AE, // Easter Egg Ending Briefcase +// 0x338AF, // Easter Egg Ending Briefcase (?) +// 0x338A7, // Easter Egg Ending Record +// 0x338A3, // Easter Egg Ending Countertop +// 0x338A4, // Easter Egg Ending Sunbathing +// 0x3C108, // Easter Egg Ending Pool +// 0x338EF, // Easter Egg Ending Pillow +// 0x336E5, // Easter Egg Ending Apple +// 0x338A6, // Easter Egg Ending Purple Flowers + 0x3C100, // Jungle Entrance Right + 0x3C0F4, // Jungle Entrance Left + 0x3C102, // Jungle Laser + 0x3C10D, // Jungle Beach + 0x3C10E, // Keep Corridor + 0x3C10B, // Keep Guitar Amp + 0x0074F, // Keep Front Wall + 0x012C7, // Keep Throne + 0x329FF, // Mill Stairs + 0x3C106, // Monastery Left Shutters + 0x33AFF, // Mountain 1 Purple Path Panel + 0x011F9, // Mountain 1 Junk Column + 0x00763, // Mountain 1 Blue Panels + 0x32A08, // Mountain 2 Blue Path Panel + 0x3C101, // Mountain 3 Giant Floor + 0x3C0FF, // Mountain 3 Peekaboo + 0x3C103, // Mountainside Cloud Cycle + 0x00A0F, // Mountaintop + 0x339A9, // Outside Tutorial Discard + 0x015C0, // Outside Tutorial Stones + 0x33B36, // Peninsula + 0x3C10C, // Shadows Laser + 0x32A0E, // Shadows Orange Crate + 0x329FE, // Shipwreck Bridge + 0x32A07, // Swamp Purple Underwater + 0x00761, // Swamp Shortcut + 0x3C109, // Symmetry Island Behind Laser + 0x33B37, // Symmetry Island Fading Lines + 0x3C107, // Town Laser Redirect + 0x3C0F3, // Town Bell Tower + 0x015B7, // Town Obelisk + 0x3C10A, // Town Lattice Panel Right + 0x32A0A, // Town Lattice Panel Left + 0x015C1, // Treehouse Green Bridge + 0x3C12A, // Treehouse Shipwreck Shore + 0x3C104, // Treehouse Docks +// 0x3C105, // Tunnels Box + 0x339A8, // Tutorial Patio Roof + 0x0050A, // Tutorial Gate +// 0x338BD, // UTM Town Shortcut +// 0x3C135, // UTM Cave In +// 0x338C9, // UTM Mountainside Shortcut +// 0x338D7, // UTM Stairwell +// 0x338C1, // UTM Challenge Water +// 0x338CA, // UTM Invisible Dots +}; diff --git a/Source/Randomizer.cpp b/Source/Randomizer.cpp index f7f176a..c4b3a13 100644 --- a/Source/Randomizer.cpp +++ b/Source/Randomizer.cpp @@ -3,8 +3,7 @@ * Shipwreck vault is solved reversed? * Verify UTM perspective? * FEATURES: - * Challenge randomization - * Randomize audio logs + * Randomize audio logs -- Hard, seem to be unloaded some times? * Swap sounds in jungle (along with panels) -- maybe impossible * Make orange 7 (all of oranges?) hard. Like big = hard. * Start the game if it isn't running? @@ -51,6 +50,7 @@ void Randomizer::Randomize() RandomizeSwamp(); RandomizeMountain(); // RandomizeChallenge(); + // RandomizeAudioLogs(); } void Randomizer::RandomizeTutorial() { @@ -163,7 +163,7 @@ void Randomizer::RandomizeMountain() { void Randomizer::RandomizeChallenge() { std::vector randomOrder(challengePanels.size(), 0); std::iota(randomOrder.begin(), randomOrder.end(), 0); - _core.RandomizeRange(randomOrder, SWAP_NONE, 1, 11); // Easy maze - Triple 2 + _core.RandomizeRange(randomOrder, SWAP_NONE, 1, 9); // Easy maze - Triple 2 std::vector triple1Target = _core.ReadPanelData(0x00C80, TARGET, 1); _core.WritePanelData(0x00CA1, TARGET, triple1Target); _core.WritePanelData(0x00CB9, TARGET, triple1Target); @@ -171,4 +171,11 @@ void Randomizer::RandomizeChallenge() { _core.WritePanelData(0x00C59, TARGET, triple2Target); _core.WritePanelData(0x00C68, TARGET, triple2Target); _core.ReassignTargets(challengePanels, randomOrder); +} + +void Randomizer::RandomizeAudioLogs() { + std::vector randomOrder(audiologs.size(), 0); + std::iota(randomOrder.begin(), randomOrder.end(), 0); + _core.Randomize(randomOrder, SWAP_NONE); + _core.ReassignNames(audiologs, randomOrder); } \ No newline at end of file diff --git a/Source/Randomizer.h b/Source/Randomizer.h index 82ea924..552e33d 100644 --- a/Source/Randomizer.h +++ b/Source/Randomizer.h @@ -20,6 +20,7 @@ private: void RandomizeSwamp(); void RandomizeMountain(); void RandomizeChallenge(); + void RandomizeAudioLogs(); RandomizerCore _core; }; diff --git a/Source/RandomizerCore.cpp b/Source/RandomizerCore.cpp index 04bdd11..11802f5 100644 --- a/Source/RandomizerCore.cpp +++ b/Source/RandomizerCore.cpp @@ -27,6 +27,9 @@ void RandomizerCore::SwapPanels(int panel1, int panel2, int flags) { if (flags & SWAP_TARGETS) { offsets[TARGET] = sizeof(int); } + if (flags & SWAP_AUDIO_NAMES) { + offsets[AUDIO_LOG_NAME] = sizeof(void*); + } if (flags & SWAP_LINES) { offsets[PATH_COLOR] = 16; offsets[REFLECTION_PATH_COLOR] = 16; @@ -109,3 +112,14 @@ void RandomizerCore::ReassignTargets(const std::vector& panels, const std:: WritePanelData(panels[order[i]], TARGET, {panelTarget}); } } + +void RandomizerCore::ReassignNames(const std::vector& panels, const std::vector& order) { + std::vector names; + for (const int panel : panels) { + names.push_back(ReadPanelData(panel, AUDIO_LOG_NAME, 1)[0]); + } + + for (int i=0; i(panels[i], AUDIO_LOG_NAME, {names[order[i]]}); + } +} diff --git a/Source/RandomizerCore.h b/Source/RandomizerCore.h index 746306b..da88e92 100644 --- a/Source/RandomizerCore.h +++ b/Source/RandomizerCore.h @@ -1,12 +1,13 @@ #pragma once #include "Memory.h" -// #define GLOBALS 0x5B28C0 -#define GLOBALS 0x62A080 +#define GLOBALS 0x5B28C0 +// #define GLOBALS 0x62A080 __declspec(selectany) int SWAP_NONE = 0x0; __declspec(selectany) int SWAP_TARGETS = 0x1; __declspec(selectany) int SWAP_LINES = 0x2; +__declspec(selectany) int SWAP_AUDIO_NAMES = 0x4; class RandomizerCore { @@ -15,6 +16,7 @@ public: void RandomizeRange(std::vector &panels, int flags, size_t startIndex, size_t endIndex); void SwapPanels(int panel1, int panel2, int flags); void ReassignTargets(const std::vector& panels, const std::vector& order); + void ReassignNames(const std::vector& panels, const std::vector& order); template std::vector ReadPanelData(int panel, int offset, size_t size) { @@ -92,6 +94,7 @@ private: #define PANEL_TARGET 0x4B0 #define SPECULAR_TEXTURE 0x4D8 #define CABLE_TARGET_2 0xD8 +#define AUDIO_LOG_NAME 0xC8 #elif GLOBALS == 0x62A080 #define PATH_COLOR 0xC0 #define REFLECTION_PATH_COLOR 0xD0 diff --git a/Source/Source.vcxproj b/Source/Source.vcxproj index 12d0270..fbd6810 100644 --- a/Source/Source.vcxproj +++ b/Source/Source.vcxproj @@ -92,6 +92,7 @@ true true stdcpp17 + MultiThreadedDebug Windows @@ -108,6 +109,7 @@ true true stdcpp17 + MultiThreadedDebug Windows @@ -127,6 +129,7 @@ true EditAndContinue stdcpp17 + MultiThreaded Windows @@ -148,6 +151,7 @@ true stdcpp17 EditAndContinue + MultiThreaded Windows -- cgit 1.4.1