summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/port/ui/ImguiUI.cpp3
-rw-r--r--src/spawn_players.c19
2 files changed, 21 insertions, 1 deletions
diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp
index a6c65259e..13beba93b 100644
--- a/src/port/ui/ImguiUI.cpp
+++ b/src/port/ui/ImguiUI.cpp
@@ -501,7 +501,8 @@ void DrawEnhancementsMenu() {
void DrawCheatsMenu() {
if (UIWidgets::BeginMenu("Cheats")) {
- UIWidgets::CVarCheckbox("Infinite Health", "gInfiniteHealth");
+ UIWidgets::CVarCheckbox("Enable Custom CC", "gEnableCustomCC");
+ UIWidgets::CVarSliderFloat("Custom CC", "gCustomCC", 0.0, 1000.0, 150.0, { .step = 10.0 });
UIWidgets::CVarCheckbox("Disable Wall Collision", "gNoWallColision", { .tooltip = "Disable wall collision." });
UIWidgets::CVarSliderFloat(
"Min Height", "gMinHeight", -50.0f, 50.0f, 0.0f,
diff --git a/src/spawn_players.c b/src/spawn_players.c
index aceb9e157..af103b653 100644
--- a/src/spawn_players.c
+++ b/src/spawn_players.c
@@ -111,6 +111,25 @@ void spawn_player(Player* player, s8 playerIndex, f32 startingRow, f32 startingC
player->topSpeed = gTopSpeedTable[CC_BATTLE][player->characterId];
break;
}
+ if (CVarGetInteger("gEnableCustomCC", 0) == 1) {
+#define calc_a(x, y, x2, y2) (y2 - y) / (x2 - x)
+#define calc_b(x, y, b) y - (b * x)
+ f32 a;
+ f32 b;
+
+#define calc(table, field) \
+ a = calc_a(50, table[CC_50][player->characterId], 150, table[CC_150][player->characterId]); \
+ b = calc_b(50, table[CC_50][player->characterId], a); \
+ player->field = a * CVarGetFloat("gCustomCC", 150.0f) + b;
+
+ calc(gTopSpeedTable, topSpeed);
+ calc(D_800E2400, unk_084);
+ calc(D_800E24B4, unk_088);
+ calc(D_800E2568, unk_210);
+#undef calc_a
+#undef calc_b
+#undef calc
+ }
player->pos[0] = startingRow;
ret = spawn_actor_on_surface(startingRow, arg4 + 50.0f, startingColumn) + player->boundingBoxSize;