From 59bcfcef89397f3e61d4832f4eaee1de253dc53e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 30 Aug 2020 00:53:13 +1000 Subject: [PATCH] Decompile mpGetSimTypeIndex --- src/game/data/data_02da90.c | 2 +- src/game/game_179060.c | 52 ++++++------ src/game/game_190260.c | 24 +++--- src/game/game_19aa80.c | 16 ++-- src/game/mplayer.c | 123 ++++++++++++---------------- src/include/constants.h | 8 ++ src/include/game/data/data_02a0e0.h | 3 +- src/include/game/data/data_02da90.h | 2 +- src/include/game/mplayer.h | 2 +- src/include/types.h | 6 +- 10 files changed, 114 insertions(+), 124 deletions(-) diff --git a/src/game/data/data_02da90.c b/src/game/data/data_02da90.c index 30957560f..c67870033 100644 --- a/src/game/data/data_02da90.c +++ b/src/game/data/data_02da90.c @@ -114,7 +114,7 @@ u16 var80087ce4[] = { u8 g_NumMpSimulantChrs = 0; -struct var80087d14 var80087d14[] = { +struct simskill g_SimSkills[] = { { 90, 0.26175770163536, 0.52351540327072, 600, 10, 0.69802051782608, 0.34901025891304, 1000 }, { 60, 0.12215359508991, 0.24430719017982, 360, 10, 0.49733963608742, 0.13960410654545, 1000 }, { 30, 0.069802053272724, 0.13960410654545, 180, 4, 0.34901025891304, 0.08725256472826, 1500 }, diff --git a/src/game/game_179060.c b/src/game/game_179060.c index dcabd12ec..4779bd436 100644 --- a/src/game/game_179060.c +++ b/src/game/game_179060.c @@ -3624,10 +3624,10 @@ glabel var7f1b81e8 /* f17c710: 8c2881ac */ lw $t0,%lo(var7f1b81ac)($at) /* f17c714: 01000008 */ jr $t0 /* f17c718: 00000000 */ nop -/* f17c71c: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) +/* f17c71c: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) /* f17c720: 3c118008 */ lui $s1,%hi(g_MpBodies) /* f17c724: 263177bc */ addiu $s1,$s1,%lo(g_MpBodies) -/* f17c728: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17c728: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) .L0f17c72c: /* f17c72c: 0fc67244 */ jal mpIsChallengeComplete /* f17c730: 92040006 */ lbu $a0,0x6($s0) @@ -3639,10 +3639,10 @@ glabel var7f1b81e8 /* f17c744: 00000000 */ nop /* f17c748: 100000b4 */ b .L0f17ca1c /* f17c74c: ae920000 */ sw $s2,0x0($s4) -/* f17c750: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) +/* f17c750: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) /* f17c754: 3c118008 */ lui $s1,%hi(g_MpBodies) /* f17c758: 263177bc */ addiu $s1,$s1,%lo(g_MpBodies) -/* f17c75c: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17c75c: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) .L0f17c760: /* f17c760: 0fc67244 */ jal mpIsChallengeComplete /* f17c764: 92040006 */ lbu $a0,0x6($s0) @@ -3696,8 +3696,8 @@ glabel var7f1b81e8 /* f17c818: 240a0001 */ addiu $t2,$zero,0x1 /* f17c81c: afaa0038 */ sw $t2,0x38($sp) .L0f17c820: -/* f17c820: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) -/* f17c824: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17c820: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) +/* f17c824: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) /* f17c828: 00008825 */ or $s1,$zero,$zero /* f17c82c: 24130012 */ addiu $s3,$zero,0x12 .L0f17c830: @@ -3754,8 +3754,8 @@ glabel var7f1b81e8 /* f17c8e8: 002a0821 */ addu $at,$at,$t2 /* f17c8ec: 1000004b */ b .L0f17ca1c /* f17c8f0: ac28ee20 */ sw $t0,%lo(g_Menus+0xe20)($at) -/* f17c8f4: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) -/* f17c8f8: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17c8f4: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) +/* f17c8f8: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) /* f17c8fc: 00008825 */ or $s1,$zero,$zero /* f17c900: 24130012 */ addiu $s3,$zero,0x12 .L0f17c904: @@ -3808,8 +3808,8 @@ glabel var7f1b81e8 /* f17c9b4: 1000001b */ b .L0f17ca24 /* f17c9b8: 8fbf002c */ lw $ra,0x2c($sp) /* f17c9bc: 8e8b0000 */ lw $t3,0x0($s4) -/* f17c9c0: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) -/* f17c9c4: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17c9c0: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) +/* f17c9c4: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) /* f17c9c8: 000b60c0 */ sll $t4,$t3,0x3 /* f17c9cc: 026c6821 */ addu $t5,$s3,$t4 /* f17c9d0: 8daf0000 */ lw $t7,0x0($t5) @@ -4010,10 +4010,10 @@ glabel menuhandlerMpSimulantDifficulty /* f17cea4: 10000023 */ b .L0f17cf34 /* f17cea8: ae800000 */ sw $zero,0x0($s4) .L0f17ceac: -/* f17ceac: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) -/* f17ceb0: 3c118008 */ lui $s1,%hi(mpspecialsimulants) -/* f17ceb4: 2631775c */ addiu $s1,$s1,%lo(mpspecialsimulants) -/* f17ceb8: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17ceac: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) +/* f17ceb0: 3c118008 */ lui $s1,%hi(g_MpSimulantTypes+0x30) +/* f17ceb4: 2631775c */ addiu $s1,$s1,%lo(g_MpSimulantTypes+0x30) +/* f17ceb8: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) .L0f17cebc: /* f17cebc: 0fc67244 */ jal mpIsChallengeComplete /* f17cec0: 92040006 */ lbu $a0,0x6($s0) @@ -4026,8 +4026,8 @@ glabel menuhandlerMpSimulantDifficulty /* f17ced8: 10000016 */ b .L0f17cf34 /* f17cedc: ae920000 */ sw $s2,0x0($s4) .L0f17cee0: -/* f17cee0: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) -/* f17cee4: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17cee0: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) +/* f17cee4: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) /* f17cee8: 24130006 */ addiu $s3,$zero,0x6 .L0f17ceec: /* f17ceec: 0fc67244 */ jal mpIsChallengeComplete @@ -4116,12 +4116,12 @@ s32 menuhandlerMpChangeSimulantType(u32 operation, struct menuitem *item, s32 *v if (operation == MENUOP_SET) { s32 i; s32 count = 0; - s32 maxunlocked = func0f18cd68( + s32 simtypeindex = mpGetSimTypeIndex( g_MpSimulants[g_Menus[g_MpPlayerNum].data.mpsetup.slotindex].base.simtype, - g_MpSimulants[g_Menus[g_MpPlayerNum].data.mpsetup.slotindex].unk48); + g_MpSimulants[g_Menus[g_MpPlayerNum].data.mpsetup.slotindex].skill); - for (i = 0; i < maxunlocked; i++) { - if (mpIsChallengeComplete(g_MpGeneralSimulants[i].unlockvalue)) { + for (i = 0; i < simtypeindex; i++) { + if (mpIsChallengeComplete(g_MpSimulantTypes[i].unlockvalue)) { count++; } } @@ -6461,10 +6461,10 @@ glabel var7f1b8430 /* f17f78c: 8c2e83d4 */ lw $t6,%lo(var7f1b83d4)($at) /* f17f790: 01c00008 */ jr $t6 /* f17f794: 00000000 */ nop -/* f17f798: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) -/* f17f79c: 3c118008 */ lui $s1,%hi(mpspecialsimulants) -/* f17f7a0: 2631775c */ addiu $s1,$s1,%lo(mpspecialsimulants) -/* f17f7a4: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17f798: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) +/* f17f79c: 3c118008 */ lui $s1,%hi(g_MpSimulantTypes+0x30) +/* f17f7a0: 2631775c */ addiu $s1,$s1,%lo(g_MpSimulantTypes+0x30) +/* f17f7a4: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) .L0f17f7a8: /* f17f7a8: 0fc67244 */ jal mpIsChallengeComplete /* f17f7ac: 92040006 */ lbu $a0,0x6($s0) @@ -6476,8 +6476,8 @@ glabel var7f1b8430 /* f17f7c0: 00000000 */ nop /* f17f7c4: 10000029 */ b .L0f17f86c /* f17f7c8: ae920000 */ sw $s2,0x0($s4) -/* f17f7cc: 3c108008 */ lui $s0,%hi(g_MpGeneralSimulants) -/* f17f7d0: 2610772c */ addiu $s0,$s0,%lo(g_MpGeneralSimulants) +/* f17f7cc: 3c108008 */ lui $s0,%hi(g_MpSimulantTypes) +/* f17f7d0: 2610772c */ addiu $s0,$s0,%lo(g_MpSimulantTypes) /* f17f7d4: 00008825 */ or $s1,$zero,$zero /* f17f7d8: 24130006 */ addiu $s3,$zero,0x6 .L0f17f7dc: diff --git a/src/game/game_190260.c b/src/game/game_190260.c index 9292b47dc..e3218df55 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -40,7 +40,7 @@ bool func0f190260(struct chrdata *chr) { - return chr->blurdrugamount >= var80087d14[chr->aibot->simulant->unk48].blurdrugamount; + return chr->blurdrugamount >= g_SimSkills[chr->aibot->simulant->skill].blurdrugamount; } GLOBAL_ASM( @@ -400,7 +400,7 @@ glabel mpChrReset // chr->cshield = 8; // } // -// if (aibot->simulant->unk48 == 5) { +// if (aibot->simulant->skill == SIMSKILL_DARK) { // aibot->unk064 &= ~1; // // if (func0f198278()) { @@ -2842,10 +2842,10 @@ glabel var7f1b8f44 /* f192b3c: c46400ac */ lwc1 $f4,0xac($v1) /* f192b40: c4a60044 */ lwc1 $f6,0x44($a1) /* f192b44: 00077940 */ sll $t7,$a3,0x5 -/* f192b48: 3c018008 */ lui $at,%hi(var80087d14+0x10) +/* f192b48: 3c018008 */ lui $at,%hi(g_SimSkills+0x10) /* f192b4c: 46062202 */ mul.s $f8,$f4,$f6 /* f192b50: 002f0821 */ addu $at,$at,$t7 -/* f192b54: c42a7d24 */ lwc1 $f10,%lo(var80087d14+0x10)($at) +/* f192b54: c42a7d24 */ lwc1 $f10,%lo(g_SimSkills+0x10)($at) /* f192b58: 44809000 */ mtc1 $zero,$f18 /* f192b5c: 46085002 */ mul.s $f0,$f10,$f8 /* f192b60: 4612003c */ c.lt.s $f0,$f18 @@ -2860,10 +2860,10 @@ glabel var7f1b8f44 /* f192b80: 8c78011c */ lw $t8,0x11c($v1) .L0f192b84: /* f192b84: c46c01d4 */ lwc1 $f12,0x1d4($v1) -/* f192b88: 3c088008 */ lui $t0,%hi(var80087d14) +/* f192b88: 3c088008 */ lui $t0,%hi(g_SimSkills) /* f192b8c: 44985000 */ mtc1 $t8,$f10 /* f192b90: 44809000 */ mtc1 $zero,$f18 -/* f192b94: 25087d14 */ addiu $t0,$t0,%lo(var80087d14) +/* f192b94: 25087d14 */ addiu $t0,$t0,%lo(g_SimSkills) /* f192b98: 46805020 */ cvt.s.w $f0,$f10 /* f192b9c: 0007c940 */ sll $t9,$a3,0x5 /* f192ba0: 03283021 */ addu $a2,$t9,$t0 @@ -7356,13 +7356,13 @@ glabel var7f1b8fc8 /* f196d54: 51c0003f */ beqzl $t6,.L0f196e54 /* f196d58: a460003c */ sh $zero,0x3c($v1) /* f196d5c: 8e4f0004 */ lw $t7,0x4($s2) -/* f196d60: 3c0d8008 */ lui $t5,%hi(var80087d14) +/* f196d60: 3c0d8008 */ lui $t5,%hi(g_SimSkills) /* f196d64: 8e58011c */ lw $t8,0x11c($s2) /* f196d68: 91f90048 */ lbu $t9,0x48($t7) /* f196d6c: 02802025 */ or $a0,$s4,$zero /* f196d70: 00194940 */ sll $t1,$t9,0x5 /* f196d74: 01a96821 */ addu $t5,$t5,$t1 -/* f196d78: 91ad7d14 */ lbu $t5,%lo(var80087d14)($t5) +/* f196d78: 91ad7d14 */ lbu $t5,%lo(g_SimSkills)($t5) /* f196d7c: 030d082a */ slt $at,$t8,$t5 /* f196d80: 54200034 */ bnezl $at,.L0f196e54 /* f196d84: a460003c */ sh $zero,0x3c($v1) @@ -7580,12 +7580,12 @@ glabel var7f1b8fc8 /* f19708c: 11800015 */ beqz $t4,.L0f1970e4 /* f197090: 00000000 */ nop /* f197094: 8e4f0004 */ lw $t7,0x4($s2) -/* f197098: 3c188008 */ lui $t8,%hi(var80087d14) +/* f197098: 3c188008 */ lui $t8,%hi(g_SimSkills) /* f19709c: 8e4e011c */ lw $t6,0x11c($s2) /* f1970a0: 91f90048 */ lbu $t9,0x48($t7) /* f1970a4: 00194940 */ sll $t1,$t9,0x5 /* f1970a8: 0309c021 */ addu $t8,$t8,$t1 -/* f1970ac: 93187d14 */ lbu $t8,%lo(var80087d14)($t8) +/* f1970ac: 93187d14 */ lbu $t8,%lo(g_SimSkills)($t8) /* f1970b0: 01d8082a */ slt $at,$t6,$t8 /* f1970b4: 1420000b */ bnez $at,.L0f1970e4 /* f1970b8: 00000000 */ nop @@ -7726,12 +7726,12 @@ glabel var7f1b8fc8 /* f1972ac: 11a00034 */ beqz $t5,.L0f197380 /* f1972b0: 00000000 */ nop /* f1972b4: 8e4b0004 */ lw $t3,0x4($s2) -/* f1972b8: 3c198008 */ lui $t9,%hi(var80087d14) +/* f1972b8: 3c198008 */ lui $t9,%hi(g_SimSkills) /* f1972bc: 8e4a011c */ lw $t2,0x11c($s2) /* f1972c0: 916c0048 */ lbu $t4,0x48($t3) /* f1972c4: 000c7940 */ sll $t7,$t4,0x5 /* f1972c8: 032fc821 */ addu $t9,$t9,$t7 -/* f1972cc: 93397d14 */ lbu $t9,%lo(var80087d14)($t9) +/* f1972cc: 93397d14 */ lbu $t9,%lo(g_SimSkills)($t9) /* f1972d0: 0159082a */ slt $at,$t2,$t9 /* f1972d4: 1420002a */ bnez $at,.L0f197380 /* f1972d8: 00000000 */ nop diff --git a/src/game/game_19aa80.c b/src/game/game_19aa80.c index 9d6677f43..143b8f2fc 100644 --- a/src/game/game_19aa80.c +++ b/src/game/game_19aa80.c @@ -1402,16 +1402,16 @@ glabel func0f19bd4c /* f19bd80: afb1001c */ sw $s1,0x1c($sp) /* f19bd84: 0fc66ee6 */ jal func0f19bb98 /* f19bd88: afa7006c */ sw $a3,0x6c($sp) -/* f19bd8c: 3c158008 */ lui $s5,%hi(g_MpGeneralSimulants) +/* f19bd8c: 3c158008 */ lui $s5,%hi(g_MpSimulantTypes) /* f19bd90: 00409025 */ or $s2,$v0,$zero -/* f19bd94: 26b5772c */ addiu $s5,$s5,%lo(g_MpGeneralSimulants) +/* f19bd94: 26b5772c */ addiu $s5,$s5,%lo(g_MpSimulantTypes) /* f19bd98: 0000f025 */ or $s8,$zero,$zero /* f19bd9c: 0200b825 */ or $s7,$s0,$zero /* f19bda0: afb00040 */ sw $s0,0x40($sp) /* f19bda4: 24160004 */ addiu $s6,$zero,0x4 .L0f19bda8: /* f19bda8: 92e40028 */ lbu $a0,0x28($s7) -/* f19bdac: 0fc6335a */ jal func0f18cd68 +/* f19bdac: 0fc6335a */ jal mpGetSimTypeIndex /* f19bdb0: 24050002 */ addiu $a1,$zero,0x2 /* f19bdb4: 0440000a */ bltz $v0,.L0f19bde0 /* f19bdb8: 000270c0 */ sll $t6,$v0,0x3 @@ -1430,7 +1430,7 @@ glabel func0f19bd4c /* f19bde4: 8fb10040 */ lw $s1,0x40($sp) .L0f19bde8: /* f19bde8: 00002025 */ or $a0,$zero,$zero -/* f19bdec: 0fc6335a */ jal func0f18cd68 +/* f19bdec: 0fc6335a */ jal mpGetSimTypeIndex /* f19bdf0: 9225002c */ lbu $a1,0x2c($s1) /* f19bdf4: 0440000a */ bltz $v0,.L0f19be20 /* f19bdf8: 0002c0c0 */ sll $t8,$v0,0x3 @@ -1578,16 +1578,16 @@ glabel func0f19bfa0 /* f19bff0: 3c1e800b */ lui $s8,%hi(var800ac798) /* f19bff4: 3c178008 */ lui $s7,%hi(g_MpHeads) /* f19bff8: 3c168008 */ lui $s6,%hi(g_MpBodies) -/* f19bffc: 3c148008 */ lui $s4,%hi(g_MpGeneralSimulants) +/* f19bffc: 3c148008 */ lui $s4,%hi(g_MpSimulantTypes) /* f19c000: 00408025 */ or $s0,$v0,$zero -/* f19c004: 2694772c */ addiu $s4,$s4,%lo(g_MpGeneralSimulants) +/* f19c004: 2694772c */ addiu $s4,$s4,%lo(g_MpSimulantTypes) /* f19c008: 26d677bc */ addiu $s6,$s6,%lo(g_MpBodies) /* f19c00c: 26f7752c */ addiu $s7,$s7,%lo(g_MpHeads) /* f19c010: 27dec798 */ addiu $s8,$s8,%lo(var800ac798) /* f19c014: 2631c538 */ addiu $s1,$s1,%lo(g_MpSimulants) /* f19c018: 92240047 */ lbu $a0,0x47($s1) .L0f19c01c: -/* f19c01c: 0fc6335a */ jal func0f18cd68 +/* f19c01c: 0fc6335a */ jal mpGetSimTypeIndex /* f19c020: 24050002 */ addiu $a1,$zero,0x2 /* f19c024: 0440000a */ bltz $v0,.L0f19c050 /* f19c028: 000270c0 */ sll $t6,$v0,0x3 @@ -1603,7 +1603,7 @@ glabel func0f19bfa0 .L0f19c050: /* f19c050: 00002025 */ or $a0,$zero,$zero .L0f19c054: -/* f19c054: 0fc6335a */ jal func0f18cd68 +/* f19c054: 0fc6335a */ jal mpGetSimTypeIndex /* f19c058: 92250048 */ lbu $a1,0x48($s1) /* f19c05c: 0440000b */ bltz $v0,.L0f19c08c /* f19c060: 00409025 */ or $s2,$v0,$zero diff --git a/src/game/mplayer.c b/src/game/mplayer.c index a6a9b5825..1b1bf18a6 100644 --- a/src/game/mplayer.c +++ b/src/game/mplayer.c @@ -747,7 +747,7 @@ void func0f1881d4(s32 index) g_MpSimulants[index].base.headnum = 0; g_MpSimulants[index].base.bodynum = 0; g_MpSimulants[index].base.simtype = SIMTYPE_GENERAL; - g_MpSimulants[index].unk48 = 6; + g_MpSimulants[index].skill = SIMSKILL_6; } GLOBAL_ASM( @@ -3151,30 +3151,26 @@ u32 table_0x2d678[] = { }; // 2d74c -struct mpsimulant g_MpGeneralSimulants[] = { +struct mpsimulanttype g_MpSimulantTypes[] = { // type, skill, name, body, unlock value - { SIMTYPE_GENERAL, 0, L_MISC(88), 0x001a, 0x00 }, - { SIMTYPE_GENERAL, 1, L_MISC(89), 0x0019, 0x00 }, - { SIMTYPE_GENERAL, 2, L_MISC(90), 0x001b, 0x00 }, - { SIMTYPE_GENERAL, 3, L_MISC(91), 0x0017, 0x19 }, - { SIMTYPE_GENERAL, 4, L_MISC(92), 0x0029, 0x1a }, - { SIMTYPE_GENERAL, 5, L_MISC(93), 0x003a, 0x1c }, -}; - -// 2d77c -struct mpsimulant mpspecialsimulants[] = { - { SIMTYPE_PEACE, 2, L_MISC(94), 0x002c, 0x00 }, - { SIMTYPE_SHIELD, 2, L_MISC(95), 0x0022, 0x00 }, - { SIMTYPE_ROCKET, 2, L_MISC(96), 0x0021, 0x00 }, - { SIMTYPE_KAZE, 2, L_MISC(97), 0x0035, 0x00 }, - { SIMTYPE_FIST, 2, L_MISC(98), 0x0037, 0x00 }, - { SIMTYPE_PREY, 2, L_MISC(99), 0x0017, 0x00 }, - { SIMTYPE_COWARD, 2, L_MISC(100), 0x0033, 0x00 }, - { SIMTYPE_JUDGE, 2, L_MISC(101), 0x0030, 0x00 }, - { SIMTYPE_FEUD, 2, L_MISC(102), 0x0034, 0x00 }, - { SIMTYPE_SPEED, 2, L_MISC(103), 0x0010, 0x00 }, - { SIMTYPE_TURTLE, 2, L_MISC(104), 0x000e, 0x00 }, - { SIMTYPE_VENGE, 2, L_MISC(105), 0x002e, 0x00 }, + { SIMTYPE_GENERAL, SIMSKILL_MEAT, L_MISC(88), MPBODY_DD_GUARD, 0x00 }, + { SIMTYPE_GENERAL, SIMSKILL_EASY, L_MISC(89), MPBODY_DD_SECGUARD, 0x00 }, + { SIMTYPE_GENERAL, SIMSKILL_NORMAL, L_MISC(90), MPBODY_DD_SHOCK_INF, 0x00 }, + { SIMTYPE_GENERAL, SIMSKILL_HARD, L_MISC(91), MPBODY_DDSHOCK, 0x19 }, + { SIMTYPE_GENERAL, SIMSKILL_PERFECT, L_MISC(92), MPBODY_STRIPES, 0x1a }, + { SIMTYPE_GENERAL, SIMSKILL_DARK, L_MISC(93), MPBODY_MOORE, 0x1c }, + { SIMTYPE_PEACE, SIMSKILL_NORMAL, L_MISC(94), MPBODY_DD_LABTECH, 0x00 }, + { SIMTYPE_SHIELD, SIMSKILL_NORMAL, L_MISC(95), MPBODY_G5_SWAT_GUARD, 0x00 }, + { SIMTYPE_ROCKET, SIMSKILL_NORMAL, L_MISC(96), MPBODY_G5_GUARD, 0x00 }, + { SIMTYPE_KAZE, SIMSKILL_NORMAL, L_MISC(97), MPBODY_PRES_SECURITY, 0x00 }, + { SIMTYPE_FIST, SIMSKILL_NORMAL, L_MISC(98), MPBODY_PELAGIC_GUARD, 0x00 }, + { SIMTYPE_PREY, SIMSKILL_NORMAL, L_MISC(99), MPBODY_DDSHOCK, 0x00 }, + { SIMTYPE_COWARD, SIMSKILL_NORMAL, L_MISC(100), MPBODY_PRESIDENT, 0x00 }, + { SIMTYPE_JUDGE, SIMSKILL_NORMAL, L_MISC(101), MPBODY_STEWARD, 0x00 }, + { SIMTYPE_FEUD, SIMSKILL_NORMAL, L_MISC(102), MPBODY_NSA_LACKEY, 0x00 }, + { SIMTYPE_SPEED, SIMSKILL_NORMAL, L_MISC(103), MPBODY_MRBLONDE, 0x00 }, + { SIMTYPE_TURTLE, SIMSKILL_NORMAL, L_MISC(104), MPBODY_CARRINGTON, 0x00 }, + { SIMTYPE_VENGE, SIMSKILL_NORMAL, L_MISC(105), MPBODY_ALASKAN_GUARD, 0x00 }, }; // 2d7dc @@ -5692,8 +5688,8 @@ glabel func0f18c984 /* f18c9c0: afa0005c */ sw $zero,0x5c($sp) /* f18c9c4: 2415004c */ addiu $s5,$zero,0x4c /* f18c9c8: 02150019 */ multu $s0,$s5 -/* f18c9cc: 3c188008 */ lui $t8,%hi(g_MpGeneralSimulants) -/* f18c9d0: 2718772c */ addiu $t8,$t8,%lo(g_MpGeneralSimulants) +/* f18c9cc: 3c188008 */ lui $t8,%hi(g_MpSimulantTypes) +/* f18c9d0: 2718772c */ addiu $t8,$t8,%lo(g_MpSimulantTypes) /* f18c9d4: 001278c0 */ sll $t7,$s2,0x3 /* f18c9d8: 01f83821 */ addu $a3,$t7,$t8 /* f18c9dc: 90e80001 */ lbu $t0,0x1($a3) @@ -5918,43 +5914,30 @@ bool mpIsSimSlotEnabled(s32 slot) return true; } -GLOBAL_ASM( -glabel func0f18cd68 -/* f18cd68: 1480000d */ bnez $a0,.L0f18cda0 -/* f18cd6c: 00001825 */ or $v1,$zero,$zero -/* f18cd70: 3c028008 */ lui $v0,%hi(g_MpGeneralSimulants) -/* f18cd74: 2442772c */ addiu $v0,$v0,%lo(g_MpGeneralSimulants) -/* f18cd78: 00001825 */ or $v1,$zero,$zero -/* f18cd7c: 24060012 */ addiu $a2,$zero,0x12 -.L0f18cd80: -/* f18cd80: 904e0001 */ lbu $t6,0x1($v0) -/* f18cd84: 50ae0010 */ beql $a1,$t6,.L0f18cdc8 -/* f18cd88: 28610012 */ slti $at,$v1,0x12 -/* f18cd8c: 24630001 */ addiu $v1,$v1,0x1 -/* f18cd90: 1466fffb */ bne $v1,$a2,.L0f18cd80 -/* f18cd94: 24420008 */ addiu $v0,$v0,0x8 -/* f18cd98: 1000000b */ b .L0f18cdc8 -/* f18cd9c: 28610012 */ slti $at,$v1,0x12 -.L0f18cda0: -/* f18cda0: 3c028008 */ lui $v0,%hi(g_MpGeneralSimulants) -/* f18cda4: 2442772c */ addiu $v0,$v0,%lo(g_MpGeneralSimulants) -/* f18cda8: 24060012 */ addiu $a2,$zero,0x12 -.L0f18cdac: -/* f18cdac: 904f0000 */ lbu $t7,0x0($v0) -/* f18cdb0: 508f0005 */ beql $a0,$t7,.L0f18cdc8 -/* f18cdb4: 28610012 */ slti $at,$v1,0x12 -/* f18cdb8: 24630001 */ addiu $v1,$v1,0x1 -/* f18cdbc: 1466fffb */ bne $v1,$a2,.L0f18cdac -/* f18cdc0: 24420008 */ addiu $v0,$v0,0x8 -/* f18cdc4: 28610012 */ slti $at,$v1,0x12 -.L0f18cdc8: -/* f18cdc8: 14200002 */ bnez $at,.L0f18cdd4 -/* f18cdcc: 00000000 */ nop -/* f18cdd0: 2403ffff */ addiu $v1,$zero,-1 -.L0f18cdd4: -/* f18cdd4: 03e00008 */ jr $ra -/* f18cdd8: 00601025 */ or $v0,$v1,$zero -); +s32 mpGetSimTypeIndex(s32 type, s32 skill) +{ + s32 i; + + if (type == SIMTYPE_GENERAL) { + for (i = 0; i < ARRAYCOUNT(g_MpSimulantTypes); i++) { + if (g_MpSimulantTypes[i].skill == skill) { + break; + } + } + } else { + for (i = 0; i < ARRAYCOUNT(g_MpSimulantTypes); i++) { + if (g_MpSimulantTypes[i].type == type) { + break; + } + } + } + + if (i >= ARRAYCOUNT(g_MpSimulantTypes)) { + i = -1; + } + + return i; +} GLOBAL_ASM( glabel func0f18cddc @@ -5994,7 +5977,7 @@ glabel func0f18cddc /* f18ce58: 00004012 */ mflo $t0 /* f18ce5c: 02e88021 */ addu $s0,$s7,$t0 /* f18ce60: 9204ff17 */ lbu $a0,-0xe9($s0) -/* f18ce64: 0fc6335a */ jal func0f18cd68 +/* f18ce64: 0fc6335a */ jal mpGetSimTypeIndex /* f18ce68: 9205ff18 */ lbu $a1,-0xe8($s0) /* f18ce6c: 04400007 */ bltz $v0,.L0f18ce8c /* f18ce70: 28410012 */ slti $at,$v0,0x12 @@ -6026,8 +6009,8 @@ glabel func0f18cddc /* f18cec8: 0044082b */ sltu $at,$v0,$a0 /* f18cecc: 5420fff7 */ bnezl $at,.L0f18ceac /* f18ced0: 8c4c0000 */ lw $t4,0x0($v0) -/* f18ced4: 3c148008 */ lui $s4,%hi(g_MpGeneralSimulants) -/* f18ced8: 2694772c */ addiu $s4,$s4,%lo(g_MpGeneralSimulants) +/* f18ced4: 3c148008 */ lui $s4,%hi(g_MpSimulantTypes) +/* f18ced8: 2694772c */ addiu $s4,$s4,%lo(g_MpSimulantTypes) /* f18cedc: 24110004 */ addiu $s1,$zero,0x4 /* f18cee0: 27b30050 */ addiu $s3,$sp,0x50 /* f18cee4: 96cd0016 */ lhu $t5,0x16($s6) @@ -6041,7 +6024,7 @@ glabel func0f18cddc /* f18cf00: 0000c812 */ mflo $t9 /* f18cf04: 02f98021 */ addu $s0,$s7,$t9 /* f18cf08: 9204ff17 */ lbu $a0,-0xe9($s0) -/* f18cf0c: 0fc6335a */ jal func0f18cd68 +/* f18cf0c: 0fc6335a */ jal mpGetSimTypeIndex /* f18cf10: 9205ff18 */ lbu $a1,-0xe8($s0) /* f18cf14: 04400028 */ bltz $v0,.L0f18cfb8 /* f18cf18: 00401825 */ or $v1,$v0,$zero @@ -7357,7 +7340,7 @@ glabel func0f18e16c /* f18e288: 1441000f */ bne $v0,$at,.L0f18e2c8 /* f18e28c: 00402825 */ or $a1,$v0,$zero /* f18e290: 92040047 */ lbu $a0,0x47($s0) -/* f18e294: 0fc6335a */ jal func0f18cd68 +/* f18e294: 0fc6335a */ jal mpGetSimTypeIndex /* f18e298: 92050048 */ lbu $a1,0x48($s0) /* f18e29c: 04400004 */ bltz $v0,.L0f18e2b0 /* f18e2a0: 00401825 */ or $v1,$v0,$zero @@ -7368,10 +7351,10 @@ glabel func0f18e16c /* f18e2b0: 00001825 */ or $v1,$zero,$zero /* f18e2b4: 000368c0 */ sll $t5,$v1,0x3 .L0f18e2b8: -/* f18e2b8: 3c058008 */ lui $a1,%hi(g_MpGeneralSimulants+0x4) +/* f18e2b8: 3c058008 */ lui $a1,%hi(g_MpSimulantTypes+0x4) /* f18e2bc: 00ad2821 */ addu $a1,$a1,$t5 /* f18e2c0: 10000001 */ b .L0f18e2c8 -/* f18e2c4: 84a57730 */ lh $a1,%lo(g_MpGeneralSimulants+0x4)($a1) +/* f18e2c4: 84a57730 */ lh $a1,%lo(g_MpSimulantTypes+0x4)($a1) .L0f18e2c8: /* f18e2c8: 02402025 */ or $a0,$s2,$zero /* f18e2cc: 0fc354be */ jal scenarioDefaultCallback44 diff --git a/src/include/constants.h b/src/include/constants.h index d04ad494a..176f7dc0a 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -2488,6 +2488,14 @@ #define SIGHT_MAIAN 6 #define SIGHT_NONE 7 +#define SIMSKILL_MEAT 0 +#define SIMSKILL_EASY 1 +#define SIMSKILL_NORMAL 2 +#define SIMSKILL_HARD 3 +#define SIMSKILL_PERFECT 4 +#define SIMSKILL_DARK 5 +#define SIMSKILL_6 6 + #define SIMTYPE_GENERAL 0 #define SIMTYPE_PEACE 1 #define SIMTYPE_SHIELD 2 diff --git a/src/include/game/data/data_02a0e0.h b/src/include/game/data/data_02a0e0.h index 2321d114e..f10f9dc4a 100644 --- a/src/include/game/data/data_02a0e0.h +++ b/src/include/game/data/data_02a0e0.h @@ -89,8 +89,7 @@ extern u32 var800874f0; extern struct mphead g_MpBeauHeads[NUM_MPBEAUHEADS]; extern struct mphead g_MpHeads[75]; extern u32 table_0x2d678[]; -extern struct mpsimulant g_MpGeneralSimulants[]; -extern struct mpsimulant mpspecialsimulants[]; +extern struct mpsimulanttype g_MpSimulantTypes[]; extern struct mpbody g_MpBodies[NUM_MPBODIES]; extern u32 g_MpMaleHeads[44]; extern u32 g_MpFemaleHeads[7]; diff --git a/src/include/game/data/data_02da90.h b/src/include/game/data/data_02da90.h index a54213c70..afc4ef523 100644 --- a/src/include/game/data/data_02da90.h +++ b/src/include/game/data/data_02da90.h @@ -7,7 +7,7 @@ extern struct mptrack g_MpTracks[NUM_MPTRACKS]; extern struct mppreset g_MpPresets[NUM_MPPRESETS]; extern u32 g_TeamColours[MAX_TEAMS]; extern u8 g_NumMpSimulantChrs; -extern struct var80087d14 var80087d14[]; +extern struct simskill g_SimSkills[]; extern u32 g_MpBotCommands[NUM_MPBOTCOMMANDS]; extern u32 var80087e2c; extern u32 var80087e50; diff --git a/src/include/game/mplayer.h b/src/include/game/mplayer.h index d79bbac8b..6a9eddf21 100644 --- a/src/include/game/mplayer.h +++ b/src/include/game/mplayer.h @@ -90,7 +90,7 @@ void mpRemoveSimulant(s32 index); bool mpHasSimulants(void); u32 func0f18cc8c(void); bool mpIsSimSlotEnabled(s32 slot); -s32 func0f18cd68(s32 arg0, s32 arg1); +s32 mpGetSimTypeIndex(s32 arg0, s32 arg1); u32 func0f18cddc(void); s32 mpPlayerGetIndex(struct chrdata *chr); struct chrdata *mpGetChrFromPlayerIndex(s32 index); diff --git a/src/include/types.h b/src/include/types.h index ec7c30694..0c47bf7a0 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3126,7 +3126,7 @@ struct mphead { u8 unlockvalue; }; -struct mpsimulant { +struct mpsimulanttype { u8 type; u8 skill; u16 name; @@ -4259,7 +4259,7 @@ struct mpplayer { struct mpsim { /*0x00*/ struct mpchr base; - /*0x48*/ u8 unk48; + /*0x48*/ u8 skill; }; struct missionconfig { @@ -5165,7 +5165,7 @@ struct propdefinition { u16 scale; }; -struct var80087d14 { +struct simskill { u8 unk00; f32 unk04; f32 unk08;