diff --git a/src/game/game_00b820.c b/src/game/game_00b820.c index 48d54a16e..4ef22b9fb 100644 --- a/src/game/game_00b820.c +++ b/src/game/game_00b820.c @@ -696,6 +696,10 @@ glabel func0f00bbc8 /* f00c070: 27bd0710 */ addiu $sp,$sp,0x710 /* f00c074: 03e00008 */ jr $ra /* f00c078: 00000000 */ nop +); + +GLOBAL_ASM( +glabel debugLoadAllAilistModels /* f00c07c: 27bdffc8 */ addiu $sp,$sp,-56 /* f00c080: 3c0e800a */ lui $t6,%hi(g_StageSetup+0x18) /* f00c084: 8dced048 */ lw $t6,%lo(g_StageSetup+0x18)($t6) @@ -780,7 +784,7 @@ glabel func0f00bbc8 /* f00c1a4: 000a5a00 */ sll $t3,$t2,0x8 /* f00c1a8: 0fc2486d */ jal propLoad /* f00c1ac: 016c2025 */ or $a0,$t3,$t4 -/* f00c1b0: 0fc04558 */ jal func0f011560 +/* f00c1b0: 0fc04558 */ jal weaponLoadProjectileModels /* f00c1b4: 92040004 */ lbu $a0,0x4($s0) /* f00c1b8: 50400009 */ beqzl $v0,.L0f00c1e0 /* f00c1bc: 02002025 */ or $a0,$s0,$zero @@ -816,6 +820,74 @@ glabel func0f00bbc8 /* f00c224: 8fb70030 */ lw $s7,0x30($sp) /* f00c228: 03e00008 */ jr $ra /* f00c22c: 27bd0038 */ addiu $sp,$sp,0x38 +); + +// Mismatch: regalloc near 19c +//void debugLoadAllAilistModels(void) +//{ +// u8 *cmd = g_StageSetup.ailists[0].list; +// s32 i = 0; +// s32 id; +// +// if (!cmd) { +// return; +// } +// +// do { +// while (true) { +// if (cmd[0] == AICMD_END) { +// break; +// } +// +// switch (cmd[0]) { +// case AICMD_DROPITEM: // 120 +// id = cmd[3] | (cmd[2] << 8); +// +// if (propLoad(id & 0xffff)) { +// // empty +// } +// break; +// case AICMD_SPAWNCHRATPAD: // 144 +// if (bodyLoad(cmd[2])) { +// // empty +// } +// if ((s8)cmd[3] >= 0 && bodyLoad((s8)cmd[3])) { +// // empty +// } +// break; +// case AICMD_SPAWNCHRATCHR: // 170 +// if (bodyLoad(cmd[2])) { +// // empty +// } +// if ((s8)cmd[3] >= 0 && bodyLoad((s8)cmd[3])) { +// // empty +// } +// break; +// case AICMD_EQUIPWEAPON: // 19c +// if (propLoad(cmd[3] | (cmd[2] << 8))) { +// // empty +// } +// if (weaponLoadProjectileModels(cmd[4])) { +// // empty +// } +// break; +// case AICMD_EQUIPHAT: // 1c8 +// if (propLoad(cmd[3] | (cmd[2] << 8))) { +// // empty +// } +// break; +// } +// +// cmd += chraiGetCommandLength(cmd, 0); +// } +// +// i++; +// cmd = g_StageSetup.ailists[i].list; +// } while (cmd); +//} + +GLOBAL_ASM( +glabel func0f00c230 /* f00c230: 03e00008 */ jr $ra /* f00c234: 00000000 */ nop /* f00c238: 00000000 */ nop diff --git a/src/game/game_00c490.c b/src/game/game_00c490.c index 1fa164822..b0ec6294b 100644 --- a/src/game/game_00c490.c +++ b/src/game/game_00c490.c @@ -1192,7 +1192,7 @@ void weaponAssignToHome(struct weaponobj *weapon, s32 cmdindex) if (cheatIsActive(CHEAT_MARQUIS)) { weapon->base.flags &= ~OBJFLAG_DEACTIVATED; weapon->base.flags |= OBJFLAG_20000000; - func0f011560(weapon->weaponnum); + weaponLoadProjectileModels(weapon->weaponnum); func0f08b25c(weapon, chr); } else { if (cheatIsActive(CHEAT_ENEMYROCKETS)) { @@ -1244,7 +1244,7 @@ void weaponAssignToHome(struct weaponobj *weapon, s32 cmdindex) } } - func0f011560(weapon->weaponnum); + weaponLoadProjectileModels(weapon->weaponnum); func0f08b25c(weapon, chr); } } @@ -1299,7 +1299,7 @@ void weaponAssignToHome(struct weaponobj *weapon, s32 cmdindex) } if (weapon->weaponnum != WEAPON_NONE && giveweapon) { - func0f011560(weapon->weaponnum); + weaponLoadProjectileModels(weapon->weaponnum); setupGenericObject(&weapon->base, cmdindex); } } diff --git a/src/game/game_011110.c b/src/game/game_011110.c index e0b684ed1..e0d02ef67 100644 --- a/src/game/game_011110.c +++ b/src/game/game_011110.c @@ -357,9 +357,9 @@ glabel func0f011130 /* f01155c: 27bd0040 */ addiu $sp,$sp,0x40 ); -u32 func0f011560(s32 weaponnum) +bool weaponLoadProjectileModels(s32 weaponnum) { - u32 flags = 0; + bool result = false; struct weapon *weapon = g_Weapons[weaponnum]; s32 i; @@ -371,19 +371,19 @@ u32 func0f011560(s32 weaponnum) struct weaponfunc_shootprojectile *func = (struct weaponfunc_shootprojectile *)genericfunc; if (func->projectilemodelnum >= 0) { - flags |= propLoad(func->projectilemodelnum); + result |= propLoad(func->projectilemodelnum); } } else if (genericfunc->type == INVENTORYFUNCTYPE_THROW) { struct weaponfunc_throw *func = (struct weaponfunc_throw *)genericfunc; if (func->projectilemodelnum >= 0) { - flags |= propLoad(func->projectilemodelnum); + result |= propLoad(func->projectilemodelnum); } } } } - return flags; + return result; } void currentPlayerInitEyespy(void) @@ -612,12 +612,12 @@ glabel var7f1a827c /* f011aa0: 8e390284 */ lw $t9,0x284($s1) /* f011aa4: 11b90022 */ beq $t5,$t9,.L0f011b30 /* f011aa8: 00000000 */ nop -/* f011aac: 0fc04558 */ jal func0f011560 +/* f011aac: 0fc04558 */ jal weaponLoadProjectileModels /* f011ab0: 8e040004 */ lw $a0,0x4($s0) /* f011ab4: 8e040008 */ lw $a0,0x8($s0) /* f011ab8: 04800008 */ bltz $a0,.L0f011adc /* f011abc: 00000000 */ nop -/* f011ac0: 0fc04558 */ jal func0f011560 +/* f011ac0: 0fc04558 */ jal weaponLoadProjectileModels /* f011ac4: 00000000 */ nop /* f011ac8: 8e040004 */ lw $a0,0x4($s0) /* f011acc: 0fc4478a */ jal currentPlayerGiveWeaponWithArgument @@ -1349,10 +1349,10 @@ glabel var7f1a827c // break; // case INTROCMD_WEAPON: // if (cmd[3] == 0 && g_Vars.currentplayer != g_Vars.anti) { -// func0f011560(cmd[1]); +// weaponLoadProjectileModels(cmd[1]); // // if (cmd[2] >= 0) { -// func0f011560(cmd[2]); +// weaponLoadProjectileModels(cmd[2]); // currentPlayerGiveWeaponWithArgument(cmd[1], cmd[2]); // } else { // currentPlayerGiveWeapon(cmd[1]); diff --git a/src/include/constants.h b/src/include/constants.h index 2062e5eef..2405f5749 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -90,6 +90,13 @@ #define AIBOTCMD_POPCAP 12 #define AIBOTCMD_PROTECT 13 +#define AICMD_END 0x0004 +#define AICMD_DROPITEM 0x001c +#define AICMD_SPAWNCHRATPAD 0x00c6 +#define AICMD_SPAWNCHRATCHR 0x00c7 +#define AICMD_EQUIPWEAPON 0x00c8 +#define AICMD_EQUIPHAT 0x00c9 + // AI environment commands #define AIENVCMD_00 0x00 #define AIENVCMD_01 0x01 diff --git a/src/include/game/game_011110.h b/src/include/game/game_011110.h index 152d0cf5d..1b820f22a 100644 --- a/src/include/game/game_011110.h +++ b/src/include/game/game_011110.h @@ -6,7 +6,7 @@ void func0f011110(void); void func0f011124(bool value); u32 func0f011130(void); -u32 func0f011560(s32 weaponnum); +bool weaponLoadProjectileModels(s32 weaponnum); void currentPlayerInitEyespy(void); void currentPlayerInit(void); diff --git a/src/include/game/game_02cde0.h b/src/include/game/game_02cde0.h index 768510bf3..a39e77c67 100644 --- a/src/include/game/game_02cde0.h +++ b/src/include/game/game_02cde0.h @@ -4,7 +4,7 @@ #include "types.h" u32 bodyGetRace(s32 bodynum); -bool bodyLoad(u32 bodynum); +bool bodyLoad(s32 bodynum); u32 func0f02ce8c(void); struct model *func0f02d338(u32 bodynum, u32 headnum, u32 arg2, u32 arg3, bool arg4, u32 arg5); struct model *modelAllocateChr(u32 bodynum, u32 headnum, u32 flags);