Decompile aiSetObjImage

This commit is contained in:
Ryan Dwyer 2019-10-19 17:54:20 +10:00
parent a9b8a6fffc
commit 39dc5409c3
5 changed files with 67 additions and 57 deletions

View File

@ -8867,60 +8867,28 @@ glabel ai00d9
/**
* @cmd 00da
*/
GLOBAL_ASM(
glabel ai00da
/* f056ba4: 3c02800a */ lui $v0,0x800a
/* f056ba8: 24429fc0 */ addiu $v0,$v0,-24640
/* f056bac: 8c4e0434 */ lw $t6,0x434($v0)
/* f056bb0: 8c4f0438 */ lw $t7,0x438($v0)
/* f056bb4: 27bdffe0 */ addiu $sp,$sp,-32
/* f056bb8: afbf0014 */ sw $ra,0x14($sp)
/* f056bbc: 01cf1821 */ addu $v1,$t6,$t7
/* f056bc0: 90640002 */ lbu $a0,0x2($v1)
/* f056bc4: 0fc2556c */ jal objFindByTagId
/* f056bc8: afa3001c */ sw $v1,0x1c($sp)
/* f056bcc: 8fa3001c */ lw $v1,0x1c($sp)
/* f056bd0: 1040001c */ beqz $v0,.L0f056c44
/* f056bd4: 00403025 */ or $a2,$v0,$zero
/* f056bd8: 8c580014 */ lw $t8,0x14($v0)
/* f056bdc: 13000019 */ beqz $t8,.L0f056c44
/* f056be0: 00000000 */ sll $zero,$zero,0x0
/* f056be4: 90440003 */ lbu $a0,0x3($v0)
/* f056be8: 2401000a */ addiu $at,$zero,0xa
/* f056bec: 54810007 */ bnel $a0,$at,.L0f056c0c
/* f056bf0: 2401000b */ addiu $at,$zero,0xb
/* f056bf4: 2444005c */ addiu $a0,$v0,0x5c
/* f056bf8: 0fc1fe49 */ jal func0f07f924
/* f056bfc: 90650004 */ lbu $a1,0x4($v1)
/* f056c00: 10000010 */ beqz $zero,.L0f056c44
/* f056c04: 00000000 */ sll $zero,$zero,0x0
/* f056c08: 2401000b */ addiu $at,$zero,0xb
.L0f056c0c:
/* f056c0c: 1481000d */ bne $a0,$at,.L0f056c44
/* f056c10: 00000000 */ sll $zero,$zero,0x0
/* f056c14: 90620003 */ lbu $v0,0x3($v1)
/* f056c18: 28410004 */ slti $at,$v0,0x4
/* f056c1c: 10200009 */ beqz $at,.L0f056c44
/* f056c20: 0002c8c0 */ sll $t9,$v0,0x3
/* f056c24: 0322c823 */ subu $t9,$t9,$v0
/* f056c28: 0019c880 */ sll $t9,$t9,0x2
/* f056c2c: 0322c821 */ addu $t9,$t9,$v0
/* f056c30: 0019c880 */ sll $t9,$t9,0x2
/* f056c34: 00d92021 */ addu $a0,$a2,$t9
/* f056c38: 2484005c */ addiu $a0,$a0,0x5c
/* f056c3c: 0fc1fe49 */ jal func0f07f924
/* f056c40: 90650004 */ lbu $a1,0x4($v1)
.L0f056c44:
/* f056c44: 3c03800a */ lui $v1,0x800a
/* f056c48: 24639fc0 */ addiu $v1,$v1,-24640
/* f056c4c: 8c680438 */ lw $t0,0x438($v1)
/* f056c50: 8fbf0014 */ lw $ra,0x14($sp)
/* f056c54: 27bd0020 */ addiu $sp,$sp,0x20
/* f056c58: 25090005 */ addiu $t1,$t0,0x5
/* f056c5c: ac690438 */ sw $t1,0x438($v1)
/* f056c60: 03e00008 */ jr $ra
/* f056c64: 00001025 */ or $v0,$zero,$zero
);
bool aiSetObjImage(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
struct defaultobj *obj = objFindByTagId(cmd[2]);
if (obj && obj->pos) {
if (obj->type == OBJTYPE_SINGLEMONITOR) {
struct singlemonitorobj *sm = (struct singlemonitorobj *) obj;
func0f07f924(&sm->image, cmd[4], sm);
} else if (obj->type == OBJTYPE_MULTIMONITOR) {
u8 slot = cmd[3];
if (slot < 4) {
struct multimonitorobj *mm = (struct multimonitorobj *) obj;
func0f07f924(&mm->subobjs[slot].image, cmd[4], mm);
}
}
}
g_Vars.aioffset += 5;
return false;
}
/**
* @cmd 00db

View File

@ -445,7 +445,9 @@
#define OBJECTFLAG2_40000000 0x40000000 // Not used in scripts
#define OBJECTFLAG2_80000000 0x80000000 // Not used in scripts
#define OBJTYPE_DOOR 0x01
#define OBJTYPE_DOOR 0x01
#define OBJTYPE_SINGLEMONITOR 0x0a
#define OBJTYPE_MULTIMONITOR 0x0b
#define OPERATOR_LESS_THAN 0
#define OPERATOR_GREATER_THAN 1

View File

@ -220,7 +220,7 @@
/*0x00d7*/ bool ai00d7(void);
/*0x00d8*/ bool ai00d8(void);
/*0x00d9*/ bool ai00d9(void);
/*0x00da*/ bool ai00da(void);
/*0x00da*/ bool aiSetObjImage(void);
/*0x00db*/ bool ai00db(void);
/*0x00dc*/ bool ai00dc(void);
/*0x00dd*/ bool ai00dd(void);

View File

@ -265,6 +265,9 @@ struct defaultobj {
/*0x54*/ u32 nextcol;
/*0x58*/ u16 floorcol;
/*0x5a*/ u8 numtiles;
// These properties might not be part of defaultobj,
// but rather standard objs only
/*0x5c*/ u8 *ailist;
/*0x60*/ u16 aioffset;
/*0x62*/ u16 aireturnlist;
@ -283,6 +286,43 @@ struct doorobj {
/*0x84*/ s8 state;
};
struct image {
/*0x00*/ u32 unk00;
/*0x04*/ u32 unk04;
/*0x08*/ u32 unk08;
/*0x0c*/ u32 unk0c;
/*0x10*/ u32 unk10;
/*0x14*/ u32 unk14;
};
struct singlemonitorobj {
/*0x00*/ u16 extrascale;
/*0x02*/ u8 hidden2;
/*0x03*/ u8 type;
/*0x04*/ u16 obj;
/*0x06*/ u16 pad;
/*0x08*/ u32 flags;
/*0x0c*/ u32 flags2;
/*0x10*/ u32 flags3;
/*0x14*/ struct position *pos;
/*0x18*/ u32 unk18;
/*0x1c*/ float realrot[9];
/*0x40*/ u32 hidden;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x4c*/ s16 damage;
/*0x4e*/ u16 maxdamage;
/*0x50*/ u32 shadecol;
/*0x54*/ u32 nextcol;
/*0x58*/ u16 floorcol;
/*0x5a*/ u8 numtiles;
/*0x5c*/ struct image image;
};
struct multimonitorobj {
struct singlemonitorobj subobjs[4];
};
struct tag {
// These three words are possibly the same values as defined in the setup
// file, but this just a guess.

View File

@ -14171,7 +14171,7 @@ bool (*command_pointers[])(void) = {
/*0x00d7*/ ai00d7,
/*0x00d8*/ ai00d8,
/*0x00d9*/ ai00d9,
/*0x00da*/ ai00da,
/*0x00da*/ aiSetObjImage,
/*0x00db*/ ai00db,
/*0x00dc*/ ai00dc,
/*0x00dd*/ ai00dd,