Decompile aiSetRotarySpeed

This commit is contained in:
Ryan Dwyer
2020-02-16 01:27:02 +10:00
parent 966ffa8552
commit b1fcc72979
6 changed files with 30 additions and 44 deletions
+1 -1
View File
@@ -906,7 +906,7 @@ u8 func0408_start_path07[] = {
};
u8 func0409_set_rotor_speed[] = {
set_rotor_speed(0x026c, 0x1c, 0x20)
set_rotor_speed(620, 7200)
beginloop(0x04)
endloop(0x04)
+15 -38
View File
@@ -98,7 +98,6 @@ const u32 var7f1a9ccc[] = {0x7f05592c};
const u32 var7f1a9cd0[] = {0x7f05592c};
const u32 var7f1a9cd4[] = {0x7f05592c};
const u32 var7f1a9cd8[] = {0x3d4ccccd};
const u32 var7f1a9cdc[] = {0x40c907a9};
/**
* @cmd 0000
@@ -6169,43 +6168,21 @@ bool aiSetVehicleSpeed(void)
/**
* @cmd 00d7
*/
GLOBAL_ASM(
glabel ai00d7
/* f056ae8: 3c05800a */ lui $a1,%hi(g_Vars)
/* f056aec: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars)
/* f056af0: 8ca30438 */ lw $v1,0x438($a1)
/* f056af4: 8cae0434 */ lw $t6,0x434($a1)
/* f056af8: 3c017f1b */ lui $at,%hi(var7f1a9cdc)
/* f056afc: c42a9cdc */ lwc1 $f10,%lo(var7f1a9cdc)($at)
/* f056b00: 01c31021 */ addu $v0,$t6,$v1
/* f056b04: 90490002 */ lbu $t1,0x2($v0)
/* f056b08: 904b0003 */ lbu $t3,0x3($v0)
/* f056b0c: 904f0004 */ lbu $t7,0x4($v0)
/* f056b10: 00095200 */ sll $t2,$t1,0x8
/* f056b14: 014b6025 */ or $t4,$t2,$t3
/* f056b18: 448c3000 */ mtc1 $t4,$f6
/* f056b1c: 90590005 */ lbu $t9,0x5($v0)
/* f056b20: 000fc200 */ sll $t8,$t7,0x8
/* f056b24: 46803220 */ cvt.s.w $f8,$f6
/* f056b28: 8ca4042c */ lw $a0,0x42c($a1)
/* f056b2c: 3c014561 */ lui $at,0x4561
/* f056b30: 03194025 */ or $t0,$t8,$t9
/* f056b34: 44882000 */ mtc1 $t0,$f4
/* f056b38: 44819000 */ mtc1 $at,$f18
/* f056b3c: 460a4402 */ mul.s $f16,$f8,$f10
/* f056b40: 00001025 */ or $v0,$zero,$zero
/* f056b44: 46802020 */ cvt.s.w $f0,$f4
/* f056b48: 10800005 */ beqz $a0,.L0f056b60
/* f056b4c: 46128083 */ div.s $f2,$f16,$f18
/* f056b50: e482006c */ swc1 $f2,0x6c($a0)
/* f056b54: 8cad042c */ lw $t5,0x42c($a1)
/* f056b58: e5a00070 */ swc1 $f0,0x70($t5)
/* f056b5c: 8ca30438 */ lw $v1,0x438($a1)
.L0f056b60:
/* f056b60: 246e0006 */ addiu $t6,$v1,0x6
/* f056b64: 03e00008 */ jr $ra
/* f056b68: acae0438 */ sw $t6,0x438($a1)
);
bool aiSetRotarySpeed(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
f32 speedtime = cmd[5] | (cmd[4] << 8);
f32 speedaim = (cmd[3] | (cmd[2] << 8)) * (M_PI * 2) / 3600;
if (g_Vars.heli) {
g_Vars.heli->rotaryspeedaim = speedaim;
g_Vars.heli->rotaryspeedtime = speedtime;
}
g_Vars.aioffset += 6;
return false;
}
/**
* @cmd 00d8
+1 -1
View File
@@ -6434,7 +6434,7 @@ bool (*g_CommandPointers[])(void) = {
/*0x00d4*/ ai00d4,
/*0x00d5*/ ai00d5,
/*0x00d6*/ aiSetVehicleSpeed,
/*0x00d7*/ ai00d7,
/*0x00d7*/ aiSetRotarySpeed,
/*0x00d8*/ aiNoOp00d8,
/*0x00d9*/ aiNoOp00d9,
/*0x00da*/ aiSetObjImage,
+5 -3
View File
@@ -1917,12 +1917,14 @@
/**
* Sets the speed of a component of the given vehicle, such as a rotor or wheel.
*
* Speed is the target speed. Time is the amount of time to reach that speed.
* The units for this aren't known.
*/
#define set_rotor_speed(speed, u1, u2) \
#define set_rotor_speed(speed, time) \
mkshort(0x00d7), \
mkshort(speed), \
u1, \
u2,
mkshort(time),
#define noop00d8(u1) \
mkshort(0x00d8), \
+1 -1
View File
@@ -217,7 +217,7 @@
/*0x00d4*/ bool ai00d4(void);
/*0x00d5*/ bool ai00d5(void);
/*0x00d6*/ bool aiSetVehicleSpeed(void);
/*0x00d7*/ bool ai00d7(void);
/*0x00d7*/ bool aiSetRotarySpeed(void);
/*0x00d8*/ bool aiNoOp00d8(void);
/*0x00d9*/ bool aiNoOp00d9(void);
/*0x00da*/ bool aiSetObjImage(void);
+7
View File
@@ -836,6 +836,13 @@ struct heliobj {
/*0x5c*/ u8 *ailist;
/*0x60*/ u16 aioffset;
/*0x62*/ s16 aireturnlist;
/*0x64*/ u32 unk64;
/*0x68*/ f32 rotaryspeed;
/*0x6c*/ f32 rotaryspeedaim;
/*0x70*/ f32 rotaryspeedtime;
/*0x74*/ f32 speed;
/*0x78*/ f32 speedaim;
/*0x7c*/ f32 speedtime60;
};
struct liftobj { // objtype 30