diff --git a/src/game/game_19aa80.c b/src/game/game_19aa80.c index 82e2aba14..82cc3e1c6 100644 --- a/src/game/game_19aa80.c +++ b/src/game/game_19aa80.c @@ -905,7 +905,7 @@ void mpPerformSanityChecks(void) g_MpSetup.chrslots &= 0x000f; for (i = 0; i != MAX_SIMULANTS; i++) { - g_BotConfigsArray[i].difficulty = g_MpSimulantDifficultiesPerNumPlayers[i * 4 + numplayers - 1]; + g_BotConfigsArray[i].difficulty = g_MpSimulantDifficultiesPerNumPlayers[i][numplayers - 1]; if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) { g_MpSetup.chrslots |= 1 << (i + 4); diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index a9b7472ca..bf16a5358 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -34,7 +34,7 @@ struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS]; s32 g_MpNumChrs; u32 var800ac534; struct mpbotconfig g_BotConfigsArray[MAX_SIMULANTS]; -u8 g_MpSimulantDifficultiesPerNumPlayers[32]; +u8 g_MpSimulantDifficultiesPerNumPlayers[8][4]; struct mpplayerconfig g_PlayerConfigsArray[6]; u8 g_AmBotCommands[16]; struct mpsetup g_MpSetup; @@ -8484,32 +8484,16 @@ glabel func0f18c984 /* f18cb5c: 27bd0060 */ addiu $sp,$sp,0x60 ); -GLOBAL_ASM( -glabel func0f18cb60 -/* f18cb60: 00047080 */ sll $t6,$a0,0x2 -/* f18cb64: 01c47021 */ addu $t6,$t6,$a0 -/* f18cb68: 000e7080 */ sll $t6,$t6,0x2 -/* f18cb6c: 01c47023 */ subu $t6,$t6,$a0 -/* f18cb70: 3c0f800b */ lui $t7,%hi(g_BotConfigsArray) -/* f18cb74: 25efc538 */ addiu $t7,$t7,%lo(g_BotConfigsArray) -/* f18cb78: 000e7080 */ sll $t6,$t6,0x2 -/* f18cb7c: 01cf1021 */ addu $v0,$t6,$t7 -/* f18cb80: 3c19800b */ lui $t9,%hi(g_MpSimulantDifficultiesPerNumPlayers) -/* f18cb84: a0450048 */ sb $a1,0x48($v0) -/* f18cb88: 2739c798 */ addiu $t9,$t9,%lo(g_MpSimulantDifficultiesPerNumPlayers) -/* f18cb8c: 0004c080 */ sll $t8,$a0,0x2 -/* f18cb90: 03193021 */ addu $a2,$t8,$t9 -/* f18cb94: 24020004 */ addiu $v0,$zero,0x4 -/* f18cb98: 00001825 */ or $v1,$zero,$zero -/* f18cb9c: 30a700ff */ andi $a3,$a1,0xff -.L0f18cba0: -/* f18cba0: 24630001 */ addiu $v1,$v1,0x1 -/* f18cba4: 24c60001 */ addiu $a2,$a2,0x1 -/* f18cba8: 1462fffd */ bne $v1,$v0,.L0f18cba0 -/* f18cbac: a0c7ffff */ sb $a3,-0x1($a2) -/* f18cbb0: 03e00008 */ jr $ra -/* f18cbb4: 00000000 */ nop -); +void mpSetBotDifficulty(s32 botnum, s32 difficulty) +{ + s32 i; + + g_BotConfigsArray[botnum].difficulty = difficulty; + + for (i = 0; i < 4; i++) { + g_MpSimulantDifficultiesPerNumPlayers[botnum][i] = g_BotConfigsArray[botnum].difficulty; + } +} s32 mpGetNumSimulants(void) { @@ -9671,7 +9655,7 @@ void mpsetupfileLoadWad(struct savebuffer *buffer) g_BotConfigsArray[i].difficulty = savebufferReadBits(buffer, 3); for (j = 0; j < 4; j++) { - g_MpSimulantDifficultiesPerNumPlayers[i * 4 + j] = g_BotConfigsArray[i].difficulty; + g_MpSimulantDifficultiesPerNumPlayers[i][j] = g_BotConfigsArray[i].difficulty; } if (g_BotConfigsArray[i].difficulty != BOTDIFF_DISABLED) { diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index b3b9153bb..f1dd0191c 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -4869,7 +4869,7 @@ glabel var7f1b81e8 /* f17c8a0: 17000004 */ bnez $t8,.L0f17c8b4 /* f17c8a4: a04e0047 */ sb $t6,0x47($v0) /* f17c8a8: 8fa4003c */ lw $a0,0x3c($sp) -/* f17c8ac: 0fc632d8 */ jal func0f18cb60 +/* f17c8ac: 0fc632d8 */ jal mpSetBotDifficulty /* f17c8b0: 92050001 */ lbu $a1,0x1($s0) .L0f17c8b4: /* f17c8b4: 0fc63377 */ jal func0f18cddc @@ -5158,7 +5158,7 @@ glabel var7f1b81e8 /* f176fc0: 17000004 */ bnez $t8,.NB0f176fd4 /* f176fc4: a04e0047 */ sb $t6,0x47($v0) /* f176fc8: 8fa4003c */ lw $a0,0x3c($sp) -/* f176fcc: 0fc61b59 */ jal func0f18cb60 +/* f176fcc: 0fc61b59 */ jal mpSetBotDifficulty /* f176fd0: 92050001 */ lbu $a1,0x1($s0) .NB0f176fd4: /* f176fd4: 0fc61bf8 */ jal func0f18cddc @@ -5369,7 +5369,7 @@ glabel menuhandlerMpSimulantDifficulty /* f17ce1c: 01ee7823 */ subu $t7,$t7,$t6 /* f17ce20: 000f7900 */ sll $t7,$t7,0x4 /* f17ce24: 008f2021 */ addu $a0,$a0,$t7 -/* f17ce28: 0fc632d8 */ jal func0f18cb60 +/* f17ce28: 0fc632d8 */ jal mpSetBotDifficulty /* f17ce2c: 8c84ee1c */ lw $a0,%lo(g_Menus+0xe1c)($a0) /* f17ce30: 0fc63377 */ jal func0f18cddc /* f17ce34: 00000000 */ nop @@ -5496,7 +5496,7 @@ glabel menuhandlerMpSimulantDifficulty /* f17ce1c: 01ee7823 */ subu $t7,$t7,$t6 /* f17ce20: 000f7900 */ sll $t7,$t7,0x4 /* f17ce24: 008f2021 */ addu $a0,$a0,$t7 -/* f17ce28: 0fc632d8 */ jal func0f18cb60 +/* f17ce28: 0fc632d8 */ jal mpSetBotDifficulty /* f17ce2c: 8c84ee1c */ lw $a0,%lo(g_Menus+0xe1c)($a0) /* f17ce30: 0fc63377 */ jal func0f18cddc /* f17ce34: 00000000 */ nop @@ -5623,7 +5623,7 @@ glabel menuhandlerMpSimulantDifficulty /* f17753c: 01ee7823 */ subu $t7,$t7,$t6 /* f177540: 000f7880 */ sll $t7,$t7,0x2 /* f177544: 008f2021 */ addu $a0,$a0,$t7 -/* f177548: 0fc61b59 */ jal func0f18cb60 +/* f177548: 0fc61b59 */ jal mpSetBotDifficulty /* f17754c: 8c843538 */ lw $a0,0x3538($a0) /* f177550: 0fc61bf8 */ jal func0f18cddc /* f177554: 00000000 */ sll $zero,$zero,0x0 diff --git a/src/include/bss.h b/src/include/bss.h index 7c611cdf5..69272deee 100644 --- a/src/include/bss.h +++ b/src/include/bss.h @@ -285,7 +285,7 @@ extern struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS]; extern struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS]; extern s32 g_MpNumChrs; extern struct mpbotconfig g_BotConfigsArray[MAX_SIMULANTS]; -extern u8 g_MpSimulantDifficultiesPerNumPlayers[32]; +extern u8 g_MpSimulantDifficultiesPerNumPlayers[8][4]; extern struct mpplayerconfig g_PlayerConfigsArray[6]; extern u8 g_AmBotCommands[16]; extern struct mpsetup g_MpSetup; diff --git a/src/include/game/mplayer/mplayer.h b/src/include/game/mplayer/mplayer.h index a44b0d028..e8aeed40a 100644 --- a/src/include/game/mplayer/mplayer.h +++ b/src/include/game/mplayer/mplayer.h @@ -85,7 +85,7 @@ u32 func0f18c828(void); s32 mpGetNumChrs(void); u32 func0f18c8b8(void); void func0f18c984(s32 numsims, u8 difficulty); -u32 func0f18cb60(void); +void mpSetBotDifficulty(s32 botnum, s32 difficulty); s32 mpGetNumSimulants(void); void mpRemoveSimulant(s32 index); bool mpHasSimulants(void);