Skip to content

Commit 201d572

Browse files
committed
CourseEdit: add 2SP stagenames, fix notif settings window reposition
1 parent 58c336d commit 201d572

File tree

5 files changed

+54
-46
lines changed

5 files changed

+54
-46
lines changed

src/game.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ enum GameStage : int
188188
STAGE_PALM_BEACH_BT,
189189
STAGE_BEACH_BT,
190190
STAGE_PALM_BEACH_BR,
191-
STAGE_BEACH_BR
191+
STAGE_BEACH_BR,
192+
193+
STAGE_COUNT
192194
};
193195
static_assert(sizeof(GameStage) == 4);
194196

src/game_addrs.hpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,43 @@ namespace Game
159159
(*Game::current_mode == GameState::STATE_START && *Game::game_start_progress_code == 65);
160160
}
161161

162+
inline const char* StageNames[] = {
163+
"Palm Beach",
164+
"Deep Lake", "Industrial Complex",
165+
"Alpine", "Snowy Mountain", "Cloudy Highland",
166+
"Castle Wall", "Ghost Forest", "Coniferous Forest", "Desert",
167+
"Tulip Garden", "Metropolis", "Ancient Ruins", "Cape Way", "Imperial Avenue",
168+
169+
"Sunny Beach",
170+
"Big Forest", "Waterfalls",
171+
"Casino Town", "Ice Scape", "Canyon",
172+
"Bay Area", "Jungle", "Lost City", "National Park",
173+
"Legend", "Skyscrapers", "Floral Village", "Milky Way", "Giant Statues",
174+
175+
"(R) Palm Beach",
176+
"(R) Deep Lake", "(R) Industrial Complex",
177+
"(R) Alpine", "(R) Snowy Mountain", "(R) Cloudy Highland",
178+
"(R) Castle Wall", "(R) Ghost Forest", "(R) Coniferous Forest", "(R) Desert",
179+
"(R) Tulip Garden", "(R) Metropolis", "(R) Ancient Ruins", "(R) Cape Way", "(R) Imperial Avenue",
180+
181+
"(R) Sunny Beach",
182+
"(R) Big Forest", "(R) Waterfalls",
183+
"(R) Casino Town", "(R) Ice Scape", "(R) Canyon",
184+
"(R) Bay Area", "(R) Jungle", "(R) Lost City", "(R) National Park",
185+
"(R) Legend", "(R) Skyscrapers", "(R) Floral Village", "(R) Milky Way", "(R) Giant Statues",
186+
187+
"(T) Palm Beach", "(T) Sunny Beach",
188+
"(Night) Palm Beach", "(Night) Sunny Beach",
189+
"(R-Night) Palm Beach", "(R-Night) Sunny Beach"
190+
};
191+
192+
inline const char* GetStageFriendlyName(GameStage stage)
193+
{
194+
if (int(stage) < 0x42)
195+
return StageNames[int(stage)];
196+
return StageNames[0];
197+
}
198+
162199
inline void init()
163200
{
164201
current_mode = Module::exe_ptr<GameState>(0x38026C);

src/hooks_drawdistance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ void DrawDist_DrawOverlay()
5757
}
5858

5959
GameStage cur_stage_num = *Game::stg_stage_num;
60-
const char* cur_stage_name = Game::GetStageUniqueName(cur_stage_num);
60+
const char* cur_stage_name = Game::GetStageFriendlyName(cur_stage_num);
6161
auto& objectExclusions = ObjectExclusionsPerStage[cur_stage_num];
6262

63-
ImGui::Text("Stage: %d (%s)", cur_stage_num, cur_stage_name);
63+
ImGui::Text("Stage: %d (%s / %s)", cur_stage_num, cur_stage_name, Game::GetStageUniqueName(cur_stage_num));
6464
ImGui::SliderInt("Draw Distance", &Settings::DrawDistanceIncrease, 0, 1024);
6565

6666
if (ImGui::Button("<<<"))

src/overlay/course_editor.cpp

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,37 +91,6 @@ const std::vector<GameStage> stages_or2sp_reverse = {
9191
STAGE_EASTER_ISLAND_R,
9292
};
9393

94-
// TODO: fill out 2SP names
95-
const char* stageNames[] = {
96-
"Palm Beach",
97-
"Deep Lake", "Industrial Complex",
98-
"Alpine", "Snowy Mountain", "Cloudy Highland",
99-
"Castle Wall", "Ghost Forest", "Coniferous Forest", "Desert",
100-
"Tulip Garden", "Metropolis", "Ancient Ruins", "Cape Way", "Imperial Avenue",
101-
102-
"Sunny Beach",
103-
"SEQUOIA", "NIAGARA",
104-
"LAS_VEGAS", "ALASKA", "Canyon",
105-
"SAN_FRANCISCO", "AMAZON", "MACHU_PICCHU", "YOSEMITE",
106-
"MAYA", "NEW_YORK", "PRINCE_EDWARD", "FLORIDA", "EASTER_ISLAND",
107-
108-
"(R) Palm Beach",
109-
"(R) Deep Lake", "(R) Industrial Complex",
110-
"(R) Alpine", "(R) Snowy Mountain", "(R) Cloudy Highland",
111-
"(R) Castle Wall", "(R) Ghost Forest", "(R) Coniferous Forest", "(R) Desert",
112-
"(R) Tulip Garden", "(R) Metropolis", "(R) Ancient Ruins", "(R) Cape Way", "(R) Imperial Avenue",
113-
114-
"(R) Sunny Beach",
115-
"(R) SEQUOIA", "(R) NIAGARA",
116-
"(R) LAS_VEGAS", "(R) ALASKA", "(R) Canyon",
117-
"(R) SAN_FRANCISCO", "(R) AMAZON", "(R) MACHU_PICCHU", "(R) YOSEMITE",
118-
"(R) MAYA", "(R) NEW_YORK", "(R) PRINCE_EDWARD", "(R) FLORIDA", "(R) EASTER_ISLAND",
119-
120-
"(T) Palm Beach", "(T) Sunny Beach",
121-
"(Night) Palm Beach", "(Night) Sunny Beach",
122-
"(R-Night) Palm Beach", "(R-Night) Sunny Beach"
123-
};
124-
12594
class CourseReplacement : public Hook
12695
{
12796
inline static SafetyHookMid midhook{};
@@ -339,7 +308,7 @@ void Overlay_CourseEditor()
339308
int selected = curStage->StageUniqueName_0;
340309

341310
std::string name = std::format("{}.{}", (col + 1), (row + 1));
342-
if (ImGui::Combo(name.c_str(), &selected, stageNames, 0x42))
311+
if (ImGui::Combo(name.c_str(), &selected, Game::StageNames, int(STAGE_COUNT)))
343312
has_updated |= update_stage(num, GameStage(selected));
344313

345314
curStage++;

src/overlay/overlay.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ void Overlay_GlobalsWindow()
5757
car->OnRoadPlace_5C.roadSectionNum_8);
5858

5959
GameStage cur_stage_num = *Game::stg_stage_num;
60-
const char* cur_stage_name = Game::GetStageUniqueName(cur_stage_num);
61-
ImGui::Text("Loaded Stage: %d (%s)", cur_stage_num, cur_stage_name);
60+
ImGui::Text("Loaded Stage: %d (%s / %s)", cur_stage_num, Game::GetStageFriendlyName(cur_stage_num), Game::GetStageUniqueName(cur_stage_num));
6261

6362
if (Settings::DrawDistanceIncrease > 0)
6463
if (ImGui::Button("Open Draw Distance Debugger"))
@@ -103,19 +102,20 @@ void Overlay_NotificationSettings()
103102
float startX = screenSize.x - notificationSize.x - borderWidth - 10.f; // 10px padding from the right
104103
float curY = (screenSize.y / 4.0f);
105104

106-
ImGui::SetNextWindowPos(ImVec2(startX, curY));
107-
108-
ImGui::Begin("Notification Settings", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
105+
{
106+
ImGui::Begin("Notification Settings", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
107+
ImGui::SetWindowPos(ImVec2(startX, curY), ImGuiCond_FirstUseEver);
109108

110-
ImGui::SliderInt("Display Time", &Settings::OverlayNotifyDisplayTime, 0, 60);
109+
ImGui::SliderInt("Display Time", &Settings::OverlayNotifyDisplayTime, 0, 60);
111110

112-
ImGui::Checkbox("Enable Online Lobby Notifications", &Settings::OverlayNotifyOnlineEnable);
113-
ImGui::SliderInt("Online Update Time", &Settings::OverlayNotifyOnlineUpdateTime, 10, 60);
111+
ImGui::Checkbox("Enable Online Lobby Notifications", &Settings::OverlayNotifyOnlineEnable);
112+
ImGui::SliderInt("Online Update Time", &Settings::OverlayNotifyOnlineUpdateTime, 10, 60);
114113

115-
static const char* items[]{ "Never Hide", "Online Race", "Any Race" };
116-
ImGui::Combo("Hide During", &Settings::OverlayNotifyHideMode, items, IM_ARRAYSIZE(items));
114+
static const char* items[]{ "Never Hide", "Online Race", "Any Race" };
115+
ImGui::Combo("Hide During", &Settings::OverlayNotifyHideMode, items, IM_ARRAYSIZE(items));
117116

118-
ImGui::End();
117+
ImGui::End();
118+
}
119119
}
120120

121121
void Overlay_Init()

0 commit comments

Comments
 (0)