[Cheat] custom cc (#71)

* custom cc

* Update ImguiUI.cpp

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
coco875
2024-09-11 00:35:46 +02:00
committed by GitHub
parent b7bc19cf9d
commit abde6714be
2 changed files with 21 additions and 1 deletions
+2 -1
View File
@@ -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,
+19
View File
@@ -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;