summary refs log tree commit diff stats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Main.cpp26
-rw-r--r--Source/Panels.h65
-rw-r--r--Source/Randomizer.cpp13
-rw-r--r--Source/Randomizer.h1
-rw-r--r--Source/RandomizerCore.cpp14
-rw-r--r--Source/RandomizerCore.h7
-rw-r--r--Source/Source.vcxproj4
7 files changed, 111 insertions, 19 deletions
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 @@
15 15
16HINSTANCE hInst; 16HINSTANCE hInst;
17WCHAR szWindowClass[MAX_LOADSTRING]; 17WCHAR szWindowClass[MAX_LOADSTRING];
18HWND hwndSeed; 18HWND hwndSeed, hwndRandomize;
19 19
20// Forward declares 20// Forward declares
21ATOM MyRegisterClass(HINSTANCE hInstance); 21ATOM MyRegisterClass(HINSTANCE hInstance);
@@ -67,26 +67,23 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
67 67
68 WCHAR szTitle[MAX_LOADSTRING]; 68 WCHAR szTitle[MAX_LOADSTRING];
69 LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 69 LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
70 HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, 70 HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
71 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); 71 400, 200, 500, 500, nullptr, nullptr, hInstance, nullptr);
72 72
73 if (!hWnd) 73 if (!hWnd) return FALSE;
74 {
75 return FALSE;
76 }
77 74
78 LoadLibrary(L"Msftedit.dll"); 75 LoadLibrary(L"Msftedit.dll");
79 HWND label = CreateWindow(L"BUTTON", L"Enter a seed:", 76 HWND label = CreateWindow(L"STATIC", L"Enter a seed:",
80 WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 77 WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT,
81 10, 10, 100, 26, hWnd, NULL, hInst, NULL); 78 10, 15, 90, 16, hWnd, NULL, hInst, NULL);
82 79
83 hwndSeed = CreateWindowEx(0, MSFTEDIT_CLASS, L"", 80 hwndSeed = CreateWindowEx(0, MSFTEDIT_CLASS, L"",
84 ES_MULTILINE | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP, 81 WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER,
85 120, 10, 50, 26, hWnd, NULL, hInst, NULL); 82 100, 10, 50, 26, hWnd, NULL, hInst, NULL);
86 83
87 HWND hwndRandomize = CreateWindow(L"BUTTON", L"Randomize", 84 hwndRandomize = CreateWindow(L"BUTTON", L"Randomize",
88 WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 85 WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
89 180, 10, 100, 26, hWnd, (HMENU)IDC_RANDOMIZE, hInst, NULL); 86 160, 10, 100, 26, hWnd, (HMENU)IDC_RANDOMIZE, hInst, NULL);
90 87
91 HDC hdc = GetDC(hWnd); 88 HDC hdc = GetDC(hWnd);
92 RECT rect; 89 RECT rect;
@@ -122,6 +119,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
122 } 119 }
123 srand(seed); 120 srand(seed);
124 Randomizer().Randomize(); 121 Randomizer().Randomize();
122 SetWindowText(hwndRandomize, L"Randomized!");
125 } 123 }
126 } 124 }
127 return DefWindowProc(hWnd, message, wParam, lParam); 125 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<int> nothingPanels = {
685 0x17C31, // Desert Final Transparent 685 0x17C31, // Desert Final Transparent
686 0x19650, // Shadows Laser 686 0x19650, // Shadows Laser
687}; 687};
688
689std::vector<int> audiologs = {
690 0x3C0F7, // Boat Treehouse Rock
691 0x3C0FD, // Boat Broken Boat
692 0x32A00, // Bunker Green Room
693 0x3C0FE, // Desert Broken Wall
694// 0x338B0, // Easter Egg Ending Briefcase (?)
695// 0x338B7, // Easter Egg Ending Briefcase (?)
696// 0x338AD, // Easter Egg Ending Briefcase (iOS)
697// 0x338A5, // Easter Egg Ending Wine Table
698// 0x338AE, // Easter Egg Ending Briefcase
699// 0x338AF, // Easter Egg Ending Briefcase (?)
700// 0x338A7, // Easter Egg Ending Record
701// 0x338A3, // Easter Egg Ending Countertop
702// 0x338A4, // Easter Egg Ending Sunbathing
703// 0x3C108, // Easter Egg Ending Pool
704// 0x338EF, // Easter Egg Ending Pillow
705// 0x336E5, // Easter Egg Ending Apple
706// 0x338A6, // Easter Egg Ending Purple Flowers
707 0x3C100, // Jungle Entrance Right
708 0x3C0F4, // Jungle Entrance Left
709 0x3C102, // Jungle Laser
710 0x3C10D, // Jungle Beach
711 0x3C10E, // Keep Corridor
712 0x3C10B, // Keep Guitar Amp
713 0x0074F, // Keep Front Wall
714 0x012C7, // Keep Throne
715 0x329FF, // Mill Stairs
716 0x3C106, // Monastery Left Shutters
717 0x33AFF, // Mountain 1 Purple Path Panel
718 0x011F9, // Mountain 1 Junk Column
719 0x00763, // Mountain 1 Blue Panels
720 0x32A08, // Mountain 2 Blue Path Panel
721 0x3C101, // Mountain 3 Giant Floor
722 0x3C0FF, // Mountain 3 Peekaboo
723 0x3C103, // Mountainside Cloud Cycle
724 0x00A0F, // Mountaintop
725 0x339A9, // Outside Tutorial Discard
726 0x015C0, // Outside Tutorial Stones
727 0x33B36, // Peninsula
728 0x3C10C, // Shadows Laser
729 0x32A0E, // Shadows Orange Crate
730 0x329FE, // Shipwreck Bridge
731 0x32A07, // Swamp Purple Underwater
732 0x00761, // Swamp Shortcut
733 0x3C109, // Symmetry Island Behind Laser
734 0x33B37, // Symmetry Island Fading Lines
735 0x3C107, // Town Laser Redirect
736 0x3C0F3, // Town Bell Tower
737 0x015B7, // Town Obelisk
738 0x3C10A, // Town Lattice Panel Right
739 0x32A0A, // Town Lattice Panel Left
740 0x015C1, // Treehouse Green Bridge
741 0x3C12A, // Treehouse Shipwreck Shore
742 0x3C104, // Treehouse Docks
743// 0x3C105, // Tunnels Box
744 0x339A8, // Tutorial Patio Roof
745 0x0050A, // Tutorial Gate
746// 0x338BD, // UTM Town Shortcut
747// 0x3C135, // UTM Cave In
748// 0x338C9, // UTM Mountainside Shortcut
749// 0x338D7, // UTM Stairwell
750// 0x338C1, // UTM Challenge Water
751// 0x338CA, // UTM Invisible Dots
752};
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 @@
3 * Shipwreck vault is solved reversed? 3 * Shipwreck vault is solved reversed?
4 * Verify UTM perspective? 4 * Verify UTM perspective?
5 * FEATURES: 5 * FEATURES:
6 * Challenge randomization 6 * Randomize audio logs -- Hard, seem to be unloaded some times?
7 * Randomize audio logs
8 * Swap sounds in jungle (along with panels) -- maybe impossible 7 * Swap sounds in jungle (along with panels) -- maybe impossible
9 * Make orange 7 (all of oranges?) hard. Like big = hard. 8 * Make orange 7 (all of oranges?) hard. Like big = hard.
10 * Start the game if it isn't running? 9 * Start the game if it isn't running?
@@ -51,6 +50,7 @@ void Randomizer::Randomize()
51 RandomizeSwamp(); 50 RandomizeSwamp();
52 RandomizeMountain(); 51 RandomizeMountain();
53 // RandomizeChallenge(); 52 // RandomizeChallenge();
53 // RandomizeAudioLogs();
54} 54}
55 55
56void Randomizer::RandomizeTutorial() { 56void Randomizer::RandomizeTutorial() {
@@ -163,7 +163,7 @@ void Randomizer::RandomizeMountain() {
163void Randomizer::RandomizeChallenge() { 163void Randomizer::RandomizeChallenge() {
164 std::vector<int> randomOrder(challengePanels.size(), 0); 164 std::vector<int> randomOrder(challengePanels.size(), 0);
165 std::iota(randomOrder.begin(), randomOrder.end(), 0); 165 std::iota(randomOrder.begin(), randomOrder.end(), 0);
166 _core.RandomizeRange(randomOrder, SWAP_NONE, 1, 11); // Easy maze - Triple 2 166 _core.RandomizeRange(randomOrder, SWAP_NONE, 1, 9); // Easy maze - Triple 2
167 std::vector<int> triple1Target = _core.ReadPanelData<int>(0x00C80, TARGET, 1); 167 std::vector<int> triple1Target = _core.ReadPanelData<int>(0x00C80, TARGET, 1);
168 _core.WritePanelData<int>(0x00CA1, TARGET, triple1Target); 168 _core.WritePanelData<int>(0x00CA1, TARGET, triple1Target);
169 _core.WritePanelData<int>(0x00CB9, TARGET, triple1Target); 169 _core.WritePanelData<int>(0x00CB9, TARGET, triple1Target);
@@ -171,4 +171,11 @@ void Randomizer::RandomizeChallenge() {
171 _core.WritePanelData<int>(0x00C59, TARGET, triple2Target); 171 _core.WritePanelData<int>(0x00C59, TARGET, triple2Target);
172 _core.WritePanelData<int>(0x00C68, TARGET, triple2Target); 172 _core.WritePanelData<int>(0x00C68, TARGET, triple2Target);
173 _core.ReassignTargets(challengePanels, randomOrder); 173 _core.ReassignTargets(challengePanels, randomOrder);
174}
175
176void Randomizer::RandomizeAudioLogs() {
177 std::vector<int> randomOrder(audiologs.size(), 0);
178 std::iota(randomOrder.begin(), randomOrder.end(), 0);
179 _core.Randomize(randomOrder, SWAP_NONE);
180 _core.ReassignNames(audiologs, randomOrder);
174} \ No newline at end of file 181} \ 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:
20 void RandomizeSwamp(); 20 void RandomizeSwamp();
21 void RandomizeMountain(); 21 void RandomizeMountain();
22 void RandomizeChallenge(); 22 void RandomizeChallenge();
23 void RandomizeAudioLogs();
23 24
24 RandomizerCore _core; 25 RandomizerCore _core;
25}; 26};
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) {
27 if (flags & SWAP_TARGETS) { 27 if (flags & SWAP_TARGETS) {
28 offsets[TARGET] = sizeof(int); 28 offsets[TARGET] = sizeof(int);
29 } 29 }
30 if (flags & SWAP_AUDIO_NAMES) {
31 offsets[AUDIO_LOG_NAME] = sizeof(void*);
32 }
30 if (flags & SWAP_LINES) { 33 if (flags & SWAP_LINES) {
31 offsets[PATH_COLOR] = 16; 34 offsets[PATH_COLOR] = 16;
32 offsets[REFLECTION_PATH_COLOR] = 16; 35 offsets[REFLECTION_PATH_COLOR] = 16;
@@ -109,3 +112,14 @@ void RandomizerCore::ReassignTargets(const std::vector<int>& panels, const std::
109 WritePanelData<int>(panels[order[i]], TARGET, {panelTarget}); 112 WritePanelData<int>(panels[order[i]], TARGET, {panelTarget});
110 } 113 }
111} 114}
115
116void RandomizerCore::ReassignNames(const std::vector<int>& panels, const std::vector<int>& order) {
117 std::vector<int64_t> names;
118 for (const int panel : panels) {
119 names.push_back(ReadPanelData<int64_t>(panel, AUDIO_LOG_NAME, 1)[0]);
120 }
121
122 for (int i=0; i<panels.size(); i++) {
123 WritePanelData<int64_t>(panels[i], AUDIO_LOG_NAME, {names[order[i]]});
124 }
125}
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 @@
1#pragma once 1#pragma once
2#include "Memory.h" 2#include "Memory.h"
3 3
4// #define GLOBALS 0x5B28C0 4#define GLOBALS 0x5B28C0
5#define GLOBALS 0x62A080 5// #define GLOBALS 0x62A080
6 6
7__declspec(selectany) int SWAP_NONE = 0x0; 7__declspec(selectany) int SWAP_NONE = 0x0;
8__declspec(selectany) int SWAP_TARGETS = 0x1; 8__declspec(selectany) int SWAP_TARGETS = 0x1;
9__declspec(selectany) int SWAP_LINES = 0x2; 9__declspec(selectany) int SWAP_LINES = 0x2;
10__declspec(selectany) int SWAP_AUDIO_NAMES = 0x4;
10 11
11class RandomizerCore 12class RandomizerCore
12{ 13{
@@ -15,6 +16,7 @@ public:
15 void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex); 16 void RandomizeRange(std::vector<int> &panels, int flags, size_t startIndex, size_t endIndex);
16 void SwapPanels(int panel1, int panel2, int flags); 17 void SwapPanels(int panel1, int panel2, int flags);
17 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order); 18 void ReassignTargets(const std::vector<int>& panels, const std::vector<int>& order);
19 void ReassignNames(const std::vector<int>& panels, const std::vector<int>& order);
18 20
19 template <class T> 21 template <class T>
20 std::vector<T> ReadPanelData(int panel, int offset, size_t size) { 22 std::vector<T> ReadPanelData(int panel, int offset, size_t size) {
@@ -92,6 +94,7 @@ private:
92#define PANEL_TARGET 0x4B0 94#define PANEL_TARGET 0x4B0
93#define SPECULAR_TEXTURE 0x4D8 95#define SPECULAR_TEXTURE 0x4D8
94#define CABLE_TARGET_2 0xD8 96#define CABLE_TARGET_2 0xD8
97#define AUDIO_LOG_NAME 0xC8
95#elif GLOBALS == 0x62A080 98#elif GLOBALS == 0x62A080
96#define PATH_COLOR 0xC0 99#define PATH_COLOR 0xC0
97#define REFLECTION_PATH_COLOR 0xD0 100#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 @@
92 <ConformanceMode>true</ConformanceMode> 92 <ConformanceMode>true</ConformanceMode>
93 <TreatWarningAsError>true</TreatWarningAsError> 93 <TreatWarningAsError>true</TreatWarningAsError>
94 <LanguageStandard>stdcpp17</LanguageStandard> 94 <LanguageStandard>stdcpp17</LanguageStandard>
95 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
95 </ClCompile> 96 </ClCompile>
96 <Link> 97 <Link>
97 <SubSystem>Windows</SubSystem> 98 <SubSystem>Windows</SubSystem>
@@ -108,6 +109,7 @@
108 <ConformanceMode>true</ConformanceMode> 109 <ConformanceMode>true</ConformanceMode>
109 <TreatWarningAsError>true</TreatWarningAsError> 110 <TreatWarningAsError>true</TreatWarningAsError>
110 <LanguageStandard>stdcpp17</LanguageStandard> 111 <LanguageStandard>stdcpp17</LanguageStandard>
112 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
111 </ClCompile> 113 </ClCompile>
112 <Link> 114 <Link>
113 <SubSystem>Windows</SubSystem> 115 <SubSystem>Windows</SubSystem>
@@ -127,6 +129,7 @@
127 <TreatWarningAsError>true</TreatWarningAsError> 129 <TreatWarningAsError>true</TreatWarningAsError>
128 <DebugInformationFormat>EditAndContinue</DebugInformationFormat> 130 <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
129 <LanguageStandard>stdcpp17</LanguageStandard> 131 <LanguageStandard>stdcpp17</LanguageStandard>
132 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
130 </ClCompile> 133 </ClCompile>
131 <Link> 134 <Link>
132 <SubSystem>Windows</SubSystem> 135 <SubSystem>Windows</SubSystem>
@@ -148,6 +151,7 @@
148 <TreatWarningAsError>true</TreatWarningAsError> 151 <TreatWarningAsError>true</TreatWarningAsError>
149 <LanguageStandard>stdcpp17</LanguageStandard> 152 <LanguageStandard>stdcpp17</LanguageStandard>
150 <DebugInformationFormat>EditAndContinue</DebugInformationFormat> 153 <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
154 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
151 </ClCompile> 155 </ClCompile>
152 <Link> 156 <Link>
153 <SubSystem>Windows</SubSystem> 157 <SubSystem>Windows</SubSystem>