Fix Harder CPU Items (#421)

* Fix crash

* Poorly document camera

* Fix harder cpu items

---------

Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
This commit is contained in:
MegaMech
2025-07-05 19:05:46 -06:00
committed by GitHub
parent 248e8fd542
commit 94ad7879ca
4 changed files with 24 additions and 18 deletions
+3 -3
View File
@@ -1126,10 +1126,10 @@ void func_8001EE98(Player* player, Camera* camera, s8 index) {
}
if (gIsGamePaused == 0) {
switch (D_80152300[cameraIndex]) {
case 3:
case 3: // end of race
func_8001A588(&D_80152300[cameraIndex], camera, player, index, cameraIndex);
break;
case 1:
case 1: // player camera
if (((player->unk_0CA & 1) == 1) || ((player->unk_0CA & 2) == 2)) {
func_8001E8E8(camera, player, index);
break;
@@ -1137,7 +1137,7 @@ void func_8001EE98(Player* player, Camera* camera, s8 index) {
freecam(camera, player, index); // Runs func_8001E45C when freecam is disabled
//func_8001E45C(camera, player, index);
break;
case 8:
case 8: // Transition start
func_8001E0C4(camera, player, index);
func_8001F87C(cameraIndex);
break;
+6
View File
@@ -6993,6 +6993,9 @@ void func_8001AB00(void) {
void cpu_decisions_branch_item(UNUSED s32 playerId, s16* branch, s32 itemId) {
s32 value = -1;
switch (itemId) {
case ITEM_NONE:
value = -1;
break;
case ITEM_FAKE_ITEM_BOX:
value = CPU_STRATEGY_ITEM_FAKE_ITEM_BOX;
break;
@@ -7021,6 +7024,9 @@ void cpu_decisions_branch_item(UNUSED s32 playerId, s16* branch, s32 itemId) {
if (CVarGetInteger("gHarderCPU", 0) == 1) {
switch (itemId) {
case ITEM_NONE:
value = -1;
break;
case ITEM_BANANA_BUNCH:
value = CPU_STRATEGY_ITEM_BANANA_BUNCH;
break;
+1 -1
View File
@@ -878,7 +878,7 @@ void use_thunder_item(Player* player) {
}
}
// Handles item use?
// Handles item use
void player_use_item(Player* player) {
s32 playerId = player - gPlayerOne;
+14 -14
View File
@@ -2962,9 +2962,9 @@ ItemProbabilities grandPrixHardCPUProbabilityTable[] = {
.doubleMushroom = 0,
.tripleMushroom = 15,
.superMushroom = 5 },
{ .none = 3,
.banana = 3,
.bananaBunch = 2,
{ .none = 0,
.banana = 5,
.bananaBunch = 3,
.greenShell = 0,
.tripleGreenShell = 10,
.redShell = 20,
@@ -3006,17 +3006,17 @@ ItemProbabilities grandPrixHardCPUProbabilityTable[] = {
.fakeItemBox = 5,
.star = 15,
.boo = 0,
.mushroom = 5,
.doubleMushroom = 5,
.mushroom = 10,
.doubleMushroom = 0,
.tripleMushroom = 25,
.superMushroom = 10 },
{ .none = 5,
{ .none = 0,
.banana = 0,
.bananaBunch = 0,
.greenShell = 0,
.tripleGreenShell = 0,
.redShell = 5,
.tripleRedShell = 20,
.tripleRedShell = 25,
.blueSpinyShell = 10,
.thunderbolt = 0,
.fakeItemBox = 0,
@@ -3026,13 +3026,13 @@ ItemProbabilities grandPrixHardCPUProbabilityTable[] = {
.doubleMushroom = 0,
.tripleMushroom = 25,
.superMushroom = 10 },
{ .none = 5,
{ .none = 0,
.banana = 0,
.bananaBunch = 0,
.greenShell = 5,
.tripleGreenShell = 0,
.redShell = 5,
.tripleRedShell = 20,
.tripleRedShell = 25,
.blueSpinyShell = 10,
.thunderbolt = 0,
.fakeItemBox = 0,
@@ -3355,15 +3355,15 @@ u8 hard_cpu_gen_random_item(UNUSED s32 arg0, s16 rank) {
return gen_random_item(rank, HARD_CPU_TABLE);
}
s16 func_8007AFB0(s32 objectIndex, s32 arg1) {
s16 func_8007AFB0(s32 objectIndex, s32 playerId) {
UNUSED s32 pad[3];
s16 randomItem;
randomItem = gen_random_item_human(gLapCountByPlayerId[arg1], gGPCurrentRaceRankByPlayerId[arg1]);
randomItem = gen_random_item_human(gLapCountByPlayerId[playerId], gGPCurrentRaceRankByPlayerId[playerId]);
if (playerHUD[arg1].itemOverride != 0) {
randomItem = (s16) playerHUD[arg1].itemOverride;
playerHUD[arg1].itemOverride = 0;
if (playerHUD[playerId].itemOverride != 0) {
randomItem = (s16) playerHUD[playerId].itemOverride;
playerHUD[playerId].itemOverride = 0;
}
func_800729B4(objectIndex, (s32) randomItem);