Attempt to decompile aiIfWeaponThrownOnObject

This commit is contained in:
Ryan Dwyer 2019-11-09 00:19:32 +10:00
parent 94c41195ff
commit 09df5b7025
5 changed files with 48 additions and 4 deletions

View File

@ -2805,7 +2805,7 @@ bool aiIfWeaponThrown(void)
* @cmd 005f
*/
GLOBAL_ASM(
glabel ai005f
glabel aiIfWeaponThrownOnObject
/* f05167c: 3c08800a */ lui $t0,0x800a
/* f051680: 25089fc0 */ addiu $t0,$t0,-24640
/* f051684: 8d0e0434 */ lw $t6,0x434($t0)
@ -2865,6 +2865,34 @@ glabel ai005f
/* f051748: 00000000 */ sll $zero,$zero,0x0
);
// Mismatch due to different registers
//bool aiIfWeaponThrownOnObject(void)
//{
// u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
// struct defaultobj *obj = objFindByTagId(cmd[3]);
// bool pass = false;
//
// if (obj && obj->pos) {
// struct attachment *attachment = obj->pos->attachments;
//
// while (attachment) {
// if (attachment->type == ATTACHMENTTYPE_WEAPON && attachment->weapon->weapon_id == cmd[2]) {
// pass = true;
// }
//
// attachment = attachment->next;
// }
// }
//
// if (pass) {
// g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]);
// } else {
// g_Vars.aioffset += 5;
// }
//
// return false;
//}
/**
* @cmd 0060
*/

View File

@ -57,6 +57,8 @@
// 0x19
#define AMMOTYPE_ECM_MINE 0x20
#define ATTACHMENTTYPE_WEAPON 0x04
#define BANK_0 0
#define BANK_1 1
#define BANK_2 2

View File

@ -98,7 +98,7 @@
/*0x005c*/ bool aiIfTargetInRoom(void);
/*0x005d*/ bool aiIfChrHasObject(void);
/*0x005e*/ bool aiIfWeaponThrown(void);
/*0x005f*/ bool ai005f(void);
/*0x005f*/ bool aiIfWeaponThrownOnObject(void);
/*0x0060*/ bool ai0060(void);
/*0x0061*/ bool ai0061(void);
/*0x0062*/ bool aiIfObjectHealthy(void);

View File

@ -11,6 +11,20 @@ struct coord {
float z;
};
struct weaponobj;
struct attachment {
u8 type;
struct weaponobj *weapon;
u32 unk08;
u32 unk0c;
u32 unk10;
u32 unk14;
u32 unk18;
u32 unk1c;
struct attachment *next;
};
// This might be a pad, but given that chrs have a gunground pointer to this
// struct, I think it's more likely an ad hoc coordinate that can be created as
// needed during gameplay.
@ -22,7 +36,7 @@ struct position {
struct coord coord;
u32 unk14;
u32 unk18; // related to gun recovery
u32 unk1c;
struct attachment *attachments;
u32 unk20;
u32 unk24;
s16 room;

View File

@ -14048,7 +14048,7 @@ bool (*g_CommandPointers[])(void) = {
/*0x005c*/ aiIfTargetInRoom,
/*0x005d*/ aiIfChrHasObject,
/*0x005e*/ aiIfWeaponThrown,
/*0x005f*/ ai005f,
/*0x005f*/ aiIfWeaponThrownOnObject,
/*0x0060*/ ai0060,
/*0x0061*/ ai0061,
/*0x0062*/ aiIfObjectHealthy,