### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_802A11B0_7A8B50
/* 415F40 802A11B0 27BDFFB8 */  addiu     $sp, $sp, -0x48
/* 415F44 802A11B4 3C06800E */  lui       $a2, %hi(gBattleStatus)
/* 415F48 802A11B8 24C6C070 */  addiu     $a2, $a2, %lo(gBattleStatus)
/* 415F4C 802A11BC AFB00018 */  sw        $s0, 0x18($sp)
glabel func_802A11C0_7A8B60
/* 415F50 802A11C0 3C10802B */  lui       $s0, %hi(BattleMenuState)
/* 415F54 802A11C4 2610D000 */  addiu     $s0, $s0, %lo(BattleMenuState)
/* 415F58 802A11C8 AFBF0030 */  sw        $ra, 0x30($sp)
glabel func_802A11CC_7A8B6C
/* 415F5C 802A11CC AFB5002C */  sw        $s5, 0x2C($sp)
.L802A11D0_7A8B70:
/* 415F60 802A11D0 AFB40028 */  sw        $s4, 0x28($sp)
glabel func_802A11D4_7A8B74
/* 415F64 802A11D4 AFB30024 */  sw        $s3, 0x24($sp)
/* 415F68 802A11D8 AFB20020 */  sw        $s2, 0x20($sp)
/* 415F6C 802A11DC AFB1001C */  sw        $s1, 0x1C($sp)
/* 415F70 802A11E0 F7B60040 */  sdc1      $f22, 0x40($sp)
/* 415F74 802A11E4 F7B40038 */  sdc1      $f20, 0x38($sp)
glabel func_802A11E8_7A8B88
/* 415F78 802A11E8 82030000 */  lb        $v1, 0x0($s0)
.L802A11EC_7A8B8C:
/* 415F7C 802A11EC 2402000A */  addiu     $v0, $zero, 0xA
.L802A11F0_7A8B90:
/* 415F80 802A11F0 10620257 */  beq       $v1, $v0, D_802A1B50_7A94F0
/* 415F84 802A11F4 00000000 */   nop
/* 415F88 802A11F8 2862000B */  slti      $v0, $v1, 0xB
D_802A11FC_7A8B9C:
/* 415F8C 802A11FC 50400010 */  beql      $v0, $zero, D_802A1240_7A8BE0
/* 415F90 802A1200 2402001E */   addiu    $v0, $zero, 0x1E
D_802A1204_7A8BA4:
/* 415F94 802A1204 10600021 */  beqz      $v1, .L802A128C_7A8C2C
/* 415F98 802A1208 24020036 */   addiu    $v0, $zero, 0x36
glabel func_802A120C_7A8BAC
/* 415F9C 802A120C 1C600006 */  bgtz      $v1, func_802A1228_7A8BC8
/* 415FA0 802A1210 24050001 */   addiu    $a1, $zero, 0x1
/* 415FA4 802A1214 2402FFFF */  addiu     $v0, $zero, -0x1
glabel func_802A1218_7A8BB8
/* 415FA8 802A1218 10620245 */  beq       $v1, $v0, .L802A1B30_7A94D0
/* 415FAC 802A121C 24030064 */   addiu    $v1, $zero, 0x64
/* 415FB0 802A1220 080A870A */  j         .L802A1C28_7A95C8
/* 415FB4 802A1224 0000102D */   daddu    $v0, $zero, $zero
glabel func_802A1228_7A8BC8
/* 415FB8 802A1228 10650159 */  beq       $v1, $a1, D_802A1790_7A9130
/* 415FBC 802A122C 24020002 */   addiu    $v0, $zero, 0x2
/* 415FC0 802A1230 106201EC */  beq       $v1, $v0, D_802A19E4_7A9384
/* 415FC4 802A1234 0000102D */   daddu    $v0, $zero, $zero
/* 415FC8 802A1238 080A870A */  j         .L802A1C28_7A95C8
glabel func_802A123C_7A8BDC
/* 415FCC 802A123C 00000000 */   nop
D_802A1240_7A8BE0:
/* 415FD0 802A1240 10620262 */  beq       $v1, $v0, .L802A1BCC_7A956C
/* 415FD4 802A1244 24020003 */   addiu    $v0, $zero, 0x3
/* 415FD8 802A1248 2862001F */  slti      $v0, $v1, 0x1F
/* 415FDC 802A124C 10400008 */  beqz      $v0, func_802A1270_7A8C10
/* 415FE0 802A1250 2402000B */   addiu    $v0, $zero, 0xB
/* 415FE4 802A1254 10620248 */  beq       $v1, $v0, .L802A1B78_7A9518
/* 415FE8 802A1258 00000000 */   nop
/* 415FEC 802A125C 24020014 */  addiu     $v0, $zero, 0x14
/* 415FF0 802A1260 1062024C */  beq       $v1, $v0, .L802A1B94_7A9534
/* 415FF4 802A1264 24020003 */   addiu    $v0, $zero, 0x3
/* 415FF8 802A1268 080A870A */  j         .L802A1C28_7A95C8
.L802A126C_7A8C0C:
/* 415FFC 802A126C 0000102D */   daddu    $v0, $zero, $zero
glabel func_802A1270_7A8C10
/* 416000 802A1270 24020064 */  addiu     $v0, $zero, 0x64
/* 416004 802A1274 1062025C */  beq       $v1, $v0, .L802A1BE8_7A9588
/* 416008 802A1278 24020065 */   addiu    $v0, $zero, 0x65
glabel func_802A127C_7A8C1C
/* 41600C 802A127C 10620260 */  beq       $v1, $v0, D_802A1C00_7A95A0
glabel func_802A1280_7A8C20
/* 416010 802A1280 0000102D */   daddu    $v0, $zero, $zero
.L802A1284_7A8C24:
/* 416014 802A1284 080A870A */  j         .L802A1C28_7A95C8
.L802A1288_7A8C28:
/* 416018 802A1288 00000000 */   nop
.L802A128C_7A8C2C:
/* 41601C 802A128C 3C01802B */  lui       $at, %hi(BattleMenu_BasePosX)
/* 416020 802A1290 AC22D060 */  sw        $v0, %lo(BattleMenu_BasePosX)($at)
.L802A1294_7A8C34:
/* 416024 802A1294 240200AD */  addiu     $v0, $zero, 0xAD
.L802A1298_7A8C38:
/* 416028 802A1298 3C013E99 */  lui       $at, (0x3E99999A >> 16)
D_802A129C_7A8C3C:
/* 41602C 802A129C 3421999A */  ori       $at, $at, (0x3E99999A & 0xFFFF)
D_802A12A0_7A8C40:
/* 416030 802A12A0 44810000 */  mtc1      $at, $f0
/* 416034 802A12A4 3C04802B */  lui       $a0, %hi(D_802AD0B3)
/* 416038 802A12A8 9084D0B3 */  lbu       $a0, %lo(D_802AD0B3)($a0)
/* 41603C 802A12AC 3C05802B */  lui       $a1, %hi(BattleMenu_NumOptions)
.L802A12B0_7A8C50:
/* 416040 802A12B0 24A5D0AC */  addiu     $a1, $a1, %lo(BattleMenu_NumOptions)
/* 416044 802A12B4 3C01802B */  lui       $at, %hi(BattleMenu_BasePosY)
.L802A12B8_7A8C58:
/* 416048 802A12B8 AC22D064 */  sw        $v0, %lo(BattleMenu_BasePosY)($at)
.L802A12BC_7A8C5C:
/* 41604C 802A12BC 3C01802B */  lui       $at, %hi(D_802AD004)
.L802A12C0_7A8C60:
/* 416050 802A12C0 A020D004 */  sb        $zero, %lo(D_802AD004)($at)
glabel func_802A12C4_7A8C64
/* 416054 802A12C4 3C01802B */  lui       $at, %hi(D_802AD070)
.L802A12C8_7A8C68:
/* 416058 802A12C8 E420D070 */  swc1      $f0, %lo(D_802AD070)($at)
.L802A12CC_7A8C6C:
/* 41605C 802A12CC 3C01802B */  lui       $at, %hi(BattleMenu_HomePos)
/* 416060 802A12D0 A024D06B */  sb        $a0, %lo(BattleMenu_HomePos)($at)
glabel func_802A12D4_7A8C74
/* 416064 802A12D4 90A20003 */  lbu       $v0, 0x3($a1)
glabel func_802A12D8_7A8C78
/* 416068 802A12D8 00041823 */  negu      $v1, $a0
/* 41606C 802A12DC 3C01802B */  lui       $at, %hi(BattleMenu_MinIdx)
glabel func_802A12E0_7A8C80
/* 416070 802A12E0 A023D069 */  sb        $v1, %lo(BattleMenu_MinIdx)($at)
glabel func_802A12E4_7A8C84
/* 416074 802A12E4 8CA30000 */  lw        $v1, 0x0($a1)
/* 416078 802A12E8 2442FFFF */  addiu     $v0, $v0, -0x1
glabel func_802A12EC_7A8C8C
/* 41607C 802A12EC 00441023 */  subu      $v0, $v0, $a0
.L802A12F0_7A8C90:
/* 416080 802A12F0 3C01802B */  lui       $at, %hi(BattleMenu_MaxIdx)
/* 416084 802A12F4 A022D06A */  sb        $v0, %lo(BattleMenu_MaxIdx)($at)
/* 416088 802A12F8 18600036 */  blez      $v1, .L802A13D4_7A8D74
glabel func_802A12FC_7A8C9C
/* 41608C 802A12FC 0000982D */   daddu    $s3, $zero, $zero
/* 416090 802A1300 3C14802B */  lui       $s4, %hi(D_802AD028)
/* 416094 802A1304 2694D028 */  addiu     $s4, $s4, %lo(D_802AD028)
/* 416098 802A1308 3C12802B */  lui       $s2, %hi(D_802AD010)
.L802A130C_7A8CAC:
/* 41609C 802A130C 2652D010 */  addiu     $s2, $s2, %lo(D_802AD010)
D_802A1310_7A8CB0:
/* 4160A0 802A1310 3C10802B */  lui       $s0, %hi(BattleMenu_HudScripts)
D_802A1314_7A8CB4:
/* 4160A4 802A1314 2610D078 */  addiu     $s0, $s0, %lo(BattleMenu_HudScripts)
glabel func_802A1318_7A8CB8
/* 4160A8 802A1318 8E040000 */  lw        $a0, 0x0($s0)
/* 4160AC 802A131C 26100004 */  addiu     $s0, $s0, 0x4
D_802A1320_7A8CC0:
/* 4160B0 802A1320 0C050529 */  jal       hud_element_create
.L802A1324_7A8CC4:
/* 4160B4 802A1324 26730001 */   addiu    $s3, $s3, 0x1
.L802A1328_7A8CC8:
/* 4160B8 802A1328 0040882D */  daddu     $s1, $v0, $zero
.L802A132C_7A8CCC:
/* 4160BC 802A132C 0220202D */  daddu     $a0, $s1, $zero
/* 4160C0 802A1330 24050005 */  addiu     $a1, $zero, 0x5
.L802A1334_7A8CD4:
/* 4160C4 802A1334 0C051277 */  jal       hud_element_set_render_depth
/* 4160C8 802A1338 AE510000 */   sw       $s1, 0x0($s2)
glabel func_802A133C_7A8CDC
/* 4160CC 802A133C 0220202D */  daddu     $a0, $s1, $zero
D_802A1340_7A8CE0:
/* 4160D0 802A1340 0C051280 */  jal       hud_element_set_flags
.L802A1344_7A8CE4:
/* 4160D4 802A1344 34058000 */   ori      $a1, $zero, 0x8000
/* 4160D8 802A1348 0220202D */  daddu     $a0, $s1, $zero
/* 4160DC 802A134C 0C051280 */  jal       hud_element_set_flags
.L802A1350_7A8CF0:
/* 4160E0 802A1350 24050080 */   addiu    $a1, $zero, 0x80
glabel func_802A1354_7A8CF4
/* 4160E4 802A1354 0220202D */  daddu     $a0, $s1, $zero
/* 4160E8 802A1358 0C051280 */  jal       hud_element_set_flags
/* 4160EC 802A135C 24050002 */   addiu    $a1, $zero, 0x2
D_802A1360_7A8D00:
/* 4160F0 802A1360 0220202D */  daddu     $a0, $s1, $zero
.L802A1364_7A8D04:
/* 4160F4 802A1364 3C053F40 */  lui       $a1, (0x3F400000 >> 16)
.L802A1368_7A8D08:
/* 4160F8 802A1368 0C051308 */  jal       hud_element_set_scale
/* 4160FC 802A136C 26520004 */   addiu    $s2, $s2, 0x4
D_802A1370_7A8D10:
/* 416100 802A1370 3C048029 */  lui       $a0, %hi(HES_ProjectorSpot)
/* 416104 802A1374 24842C00 */  addiu     $a0, $a0, %lo(HES_ProjectorSpot)
glabel func_802A1378_7A8D18
/* 416108 802A1378 0C050529 */  jal       hud_element_create
glabel func_802A137C_7A8D1C
/* 41610C 802A137C 00000000 */   nop
/* 416110 802A1380 0040882D */  daddu     $s1, $v0, $zero
/* 416114 802A1384 0220202D */  daddu     $a0, $s1, $zero
D_802A1388_7A8D28:
/* 416118 802A1388 0C0513F6 */  jal       hud_element_create_transform_B
.L802A138C_7A8D2C:
/* 41611C 802A138C AE910000 */   sw       $s1, 0x0($s4)
/* 416120 802A1390 0220202D */  daddu     $a0, $s1, $zero
.L802A1394_7A8D34:
/* 416124 802A1394 0C051277 */  jal       hud_element_set_render_depth
D_802A1398_7A8D38:
/* 416128 802A1398 2405000A */   addiu    $a1, $zero, 0xA
.L802A139C_7A8D3C:
/* 41612C 802A139C 0220202D */  daddu     $a0, $s1, $zero
D_802A13A0_7A8D40:
/* 416130 802A13A0 0C051280 */  jal       hud_element_set_flags
.L802A13A4_7A8D44:
/* 416134 802A13A4 24050080 */   addiu    $a1, $zero, 0x80
/* 416138 802A13A8 0220202D */  daddu     $a0, $s1, $zero
/* 41613C 802A13AC 0C051280 */  jal       hud_element_set_flags
/* 416140 802A13B0 34058000 */   ori      $a1, $zero, 0x8000
/* 416144 802A13B4 0220202D */  daddu     $a0, $s1, $zero
glabel func_802A13B8_7A8D58
/* 416148 802A13B8 0C051280 */  jal       hud_element_set_flags
.L802A13BC_7A8D5C:
/* 41614C 802A13BC 24050002 */   addiu    $a1, $zero, 0x2
.L802A13C0_7A8D60:
/* 416150 802A13C0 3C02802B */  lui       $v0, %hi(BattleMenu_NumOptions)
.L802A13C4_7A8D64:
/* 416154 802A13C4 8C42D0AC */  lw        $v0, %lo(BattleMenu_NumOptions)($v0)
/* 416158 802A13C8 0262102A */  slt       $v0, $s3, $v0
/* 41615C 802A13CC 1440FFD2 */  bnez      $v0, func_802A1318_7A8CB8
D_802A13D0_7A8D70:
/* 416160 802A13D0 26940004 */   addiu    $s4, $s4, 0x4
.L802A13D4_7A8D74:
/* 416164 802A13D4 3C048029 */  lui       $a0, %hi(HES_ProjectorSpot)
/* 416168 802A13D8 24842C00 */  addiu     $a0, $a0, %lo(HES_ProjectorSpot)
/* 41616C 802A13DC 0C050529 */  jal       hud_element_create
/* 416170 802A13E0 00000000 */   nop
glabel func_802A13E4_7A8D84
/* 416174 802A13E4 0040882D */  daddu     $s1, $v0, $zero
.L802A13E8_7A8D88:
/* 416178 802A13E8 3C01802B */  lui       $at, %hi(D_802AD040)
.L802A13EC_7A8D8C:
/* 41617C 802A13EC AC31D040 */  sw        $s1, %lo(D_802AD040)($at)
/* 416180 802A13F0 0C0513F6 */  jal       hud_element_create_transform_B
/* 416184 802A13F4 0220202D */   daddu    $a0, $s1, $zero
.L802A13F8_7A8D98:
/* 416188 802A13F8 0220202D */  daddu     $a0, $s1, $zero
glabel func_802A13FC_7A8D9C
/* 41618C 802A13FC 0C051277 */  jal       hud_element_set_render_depth
D_802A1400_7A8DA0:
/* 416190 802A1400 24050007 */   addiu    $a1, $zero, 0x7
.L802A1404_7A8DA4:
/* 416194 802A1404 0220202D */  daddu     $a0, $s1, $zero
D_802A1408_7A8DA8:
/* 416198 802A1408 0C051280 */  jal       hud_element_set_flags
.L802A140C_7A8DAC:
/* 41619C 802A140C 24050080 */   addiu    $a1, $zero, 0x80
.L802A1410_7A8DB0:
/* 4161A0 802A1410 0220202D */  daddu     $a0, $s1, $zero
glabel func_802A1414_7A8DB4
/* 4161A4 802A1414 0C051280 */  jal       hud_element_set_flags
glabel func_802A1418_7A8DB8
/* 4161A8 802A1418 34058000 */   ori      $a1, $zero, 0x8000
/* 4161AC 802A141C 0220202D */  daddu     $a0, $s1, $zero
D_802A1420_7A8DC0:
/* 4161B0 802A1420 0C051280 */  jal       hud_element_set_flags
/* 4161B4 802A1424 24050002 */   addiu    $a1, $zero, 0x2
.L802A1428_7A8DC8:
/* 4161B8 802A1428 3C108029 */  lui       $s0, %hi(HES_ProjectorReel)
/* 4161BC 802A142C 26102BD8 */  addiu     $s0, $s0, %lo(HES_ProjectorReel)
.L802A1430_7A8DD0:
/* 4161C0 802A1430 0C050529 */  jal       hud_element_create
glabel .L802A1434_7A8DD4
/* 4161C4 802A1434 0200202D */   daddu    $a0, $s0, $zero
glabel func_802A1438_7A8DD8
/* 4161C8 802A1438 0040882D */  daddu     $s1, $v0, $zero
.L802A143C_7A8DDC:
/* 4161CC 802A143C 3C01802B */  lui       $at, %hi(D_802AD044)
D_802A1440_7A8DE0:
/* 4161D0 802A1440 AC31D044 */  sw        $s1, %lo(D_802AD044)($at)
glabel func_802A1444_7A8DE4
/* 4161D4 802A1444 0C0513F6 */  jal       hud_element_create_transform_B
/* 4161D8 802A1448 0220202D */   daddu    $a0, $s1, $zero
/* 4161DC 802A144C 0220202D */  daddu     $a0, $s1, $zero
glabel func_802A1450_7A8DF0
/* 4161E0 802A1450 0C051277 */  jal       hud_element_set_render_depth
/* 4161E4 802A1454 0000282D */   daddu    $a1, $zero, $zero
D_802A1458_7A8DF8:
/* 4161E8 802A1458 0220202D */  daddu     $a0, $s1, $zero
/* 4161EC 802A145C 24050028 */  addiu     $a1, $zero, 0x28
/* 4161F0 802A1460 0C051261 */  jal       hud_element_set_render_pos
/* 4161F4 802A1464 240600D4 */   addiu    $a2, $zero, 0xD4
/* 4161F8 802A1468 0220202D */  daddu     $a0, $s1, $zero
.L802A146C_7A8E0C:
/* 4161FC 802A146C 0000282D */  daddu     $a1, $zero, $zero
.L802A1470_7A8E10:
/* 416200 802A1470 2406005B */  addiu     $a2, $zero, 0x5B
/* 416204 802A1474 0C0513BF */  jal       hud_element_set_tint
.L802A1478_7A8E18:
/* 416208 802A1478 2407007F */   addiu    $a3, $zero, 0x7F
.L802A147C_7A8E1C:
/* 41620C 802A147C 0220202D */  daddu     $a0, $s1, $zero
/* 416210 802A1480 24050010 */  addiu     $a1, $zero, 0x10
glabel func_802A1484_7A8E24
/* 416214 802A1484 0C05149D */  jal       hud_element_set_transform_rotation_pivot
.L802A1488_7A8E28:
/* 416218 802A1488 2406FFF0 */   addiu    $a2, $zero, -0x10
.L802A148C_7A8E2C:
/* 41621C 802A148C 0220202D */  daddu     $a0, $s1, $zero
.L802A1490_7A8E30:
/* 416220 802A1490 0C051280 */  jal       hud_element_set_flags
glabel func_802A1494_7A8E34
/* 416224 802A1494 24050080 */   addiu    $a1, $zero, 0x80
D_802A1498_7A8E38:
/* 416228 802A1498 0220202D */  daddu     $a0, $s1, $zero
glabel func_802A149C_7A8E3C
/* 41622C 802A149C 0C05128B */  jal       hud_element_clear_flags
D_802A14A0_7A8E40:
/* 416230 802A14A0 34058000 */   ori      $a1, $zero, 0x8000
/* 416234 802A14A4 0220202D */  daddu     $a0, $s1, $zero
/* 416238 802A14A8 0C0513AC */  jal       hud_element_set_alpha
/* 41623C 802A14AC 240500F0 */   addiu    $a1, $zero, 0xF0
/* 416240 802A14B0 0C050529 */  jal       hud_element_create
/* 416244 802A14B4 0200202D */   daddu    $a0, $s0, $zero
/* 416248 802A14B8 0040882D */  daddu     $s1, $v0, $zero
.L802A14BC_7A8E5C:
/* 41624C 802A14BC 3C01802B */  lui       $at, %hi(D_802AD048)
/* 416250 802A14C0 AC31D048 */  sw        $s1, %lo(D_802AD048)($at)
/* 416254 802A14C4 0C0513F6 */  jal       hud_element_create_transform_B
.L802A14C8_7A8E68:
/* 416258 802A14C8 0220202D */   daddu    $a0, $s1, $zero
.L802A14CC_7A8E6C:
/* 41625C 802A14CC 0220202D */  daddu     $a0, $s1, $zero
glabel .L802A14D0_7A8E70
/* 416260 802A14D0 0C051277 */  jal       hud_element_set_render_depth
glabel func_802A14D4_7A8E74
/* 416264 802A14D4 24050002 */   addiu    $a1, $zero, 0x2
glabel func_802A14D8_7A8E78
/* 416268 802A14D8 0220202D */  daddu     $a0, $s1, $zero
/* 41626C 802A14DC 24050027 */  addiu     $a1, $zero, 0x27
.L802A14E0_7A8E80:
/* 416270 802A14E0 0C051261 */  jal       hud_element_set_render_pos
.L802A14E4_7A8E84:
/* 416274 802A14E4 240600D4 */   addiu    $a2, $zero, 0xD4
glabel func_802A14E8_7A8E88
/* 416278 802A14E8 0220202D */  daddu     $a0, $s1, $zero
/* 41627C 802A14EC 0000282D */  daddu     $a1, $zero, $zero
D_802A14F0_7A8E90:
/* 416280 802A14F0 2406005B */  addiu     $a2, $zero, 0x5B
/* 416284 802A14F4 0C0513BF */  jal       hud_element_set_tint
glabel func_802A14F8_7A8E98
/* 416288 802A14F8 2407007F */   addiu    $a3, $zero, 0x7F
/* 41628C 802A14FC 0220202D */  daddu     $a0, $s1, $zero
D_802A1500_7A8EA0:
/* 416290 802A1500 24050010 */  addiu     $a1, $zero, 0x10
/* 416294 802A1504 0C05149D */  jal       hud_element_set_transform_rotation_pivot
/* 416298 802A1508 2406FFF0 */   addiu    $a2, $zero, -0x10
D_802A150C_7A8EAC:
/* 41629C 802A150C 0220202D */  daddu     $a0, $s1, $zero
/* 4162A0 802A1510 0C051280 */  jal       hud_element_set_flags
.L802A1514_7A8EB4:
/* 4162A4 802A1514 24050080 */   addiu    $a1, $zero, 0x80
glabel func_802A1518_7A8EB8
/* 4162A8 802A1518 0220202D */  daddu     $a0, $s1, $zero
.L802A151C_7A8EBC:
/* 4162AC 802A151C 0C05128B */  jal       hud_element_clear_flags
D_802A1520_7A8EC0:
/* 4162B0 802A1520 34058000 */   ori      $a1, $zero, 0x8000
.L802A1524_7A8EC4:
/* 4162B4 802A1524 0220202D */  daddu     $a0, $s1, $zero
glabel func_802A1528_7A8EC8
/* 4162B8 802A1528 0C0513AC */  jal       hud_element_set_alpha
.L802A152C_7A8ECC:
/* 4162BC 802A152C 240500F0 */   addiu    $a1, $zero, 0xF0
D_802A1530_7A8ED0:
/* 4162C0 802A1530 3C048029 */  lui       $a0, %hi(HES_ProjectorBeam)
.L802A1534_7A8ED4:
/* 4162C4 802A1534 24842C28 */  addiu     $a0, $a0, %lo(HES_ProjectorBeam)
/* 4162C8 802A1538 0C050529 */  jal       hud_element_create
glabel func_802A153C_7A8EDC
/* 4162CC 802A153C 00000000 */   nop
D_802A1540_7A8EE0:
/* 4162D0 802A1540 0040882D */  daddu     $s1, $v0, $zero
D_802A1544_7A8EE4:
/* 4162D4 802A1544 3C01802B */  lui       $at, %hi(D_802AD04C)
D_802A1548_7A8EE8:
/* 4162D8 802A1548 AC31D04C */  sw        $s1, %lo(D_802AD04C)($at)
glabel func_802A154C_7A8EEC
/* 4162DC 802A154C 0C0513F6 */  jal       hud_element_create_transform_B
D_802A1550_7A8EF0:
/* 4162E0 802A1550 0220202D */   daddu    $a0, $s1, $zero
.L802A1554_7A8EF4:
/* 4162E4 802A1554 0220202D */  daddu     $a0, $s1, $zero
/* 4162E8 802A1558 0C051277 */  jal       hud_element_set_render_depth
/* 4162EC 802A155C 24050014 */   addiu    $a1, $zero, 0x14
.L802A1560_7A8F00:
/* 4162F0 802A1560 0220202D */  daddu     $a0, $s1, $zero
.L802A1564_7A8F04:
/* 4162F4 802A1564 2405004E */  addiu     $a1, $zero, 0x4E
.L802A1568_7A8F08:
/* 4162F8 802A1568 0C051261 */  jal       hud_element_set_render_pos
glabel func_802A156C_7A8F0C
/* 4162FC 802A156C 240600B2 */   addiu    $a2, $zero, 0xB2
/* 416300 802A1570 0220202D */  daddu     $a0, $s1, $zero
/* 416304 802A1574 240500FF */  addiu     $a1, $zero, 0xFF
.L802A1578_7A8F18:
/* 416308 802A1578 00A0302D */  daddu     $a2, $a1, $zero
/* 41630C 802A157C 0C0513BF */  jal       hud_element_set_tint
/* 416310 802A1580 00A0382D */   daddu    $a3, $a1, $zero
D_802A1584_7A8F24:
/* 416314 802A1584 0220202D */  daddu     $a0, $s1, $zero
.L802A1588_7A8F28:
/* 416318 802A1588 0000282D */  daddu     $a1, $zero, $zero
.L802A158C_7A8F2C:
/* 41631C 802A158C 0C05149D */  jal       hud_element_set_transform_rotation_pivot
.L802A1590_7A8F30:
/* 416320 802A1590 00A0302D */   daddu    $a2, $a1, $zero
.L802A1594_7A8F34:
/* 416324 802A1594 44800000 */  mtc1      $zero, $f0
.L802A1598_7A8F38:
/* 416328 802A1598 0220202D */  daddu     $a0, $s1, $zero
/* 41632C 802A159C 44050000 */  mfc1      $a1, $f0
glabel func_802A15A0_7A8F40
/* 416330 802A15A0 3C07C234 */  lui       $a3, (0xC2340000 >> 16)
D_802A15A4_7A8F44:
/* 416334 802A15A4 0C051489 */  jal       hud_element_set_transform_rotation
/* 416338 802A15A8 00A0302D */   daddu    $a2, $a1, $zero
glabel func_802A15AC_7A8F4C
/* 41633C 802A15AC 0220202D */  daddu     $a0, $s1, $zero
D_802A15B0_7A8F50:
/* 416340 802A15B0 0C0513AC */  jal       hud_element_set_alpha
glabel func_802A15B4_7A8F54
/* 416344 802A15B4 240500C8 */   addiu    $a1, $zero, 0xC8
.L802A15B8_7A8F58:
/* 416348 802A15B8 0220202D */  daddu     $a0, $s1, $zero
/* 41634C 802A15BC 0C051280 */  jal       hud_element_set_flags
.L802A15C0_7A8F60:
/* 416350 802A15C0 24050080 */   addiu    $a1, $zero, 0x80
/* 416354 802A15C4 0220202D */  daddu     $a0, $s1, $zero
/* 416358 802A15C8 0C051280 */  jal       hud_element_set_flags
/* 41635C 802A15CC 34058000 */   ori      $a1, $zero, 0x8000
.L802A15D0_7A8F70:
/* 416360 802A15D0 0220202D */  daddu     $a0, $s1, $zero
/* 416364 802A15D4 0C051280 */  jal       hud_element_set_flags
D_802A15D8_7A8F78:
/* 416368 802A15D8 24050002 */   addiu    $a1, $zero, 0x2
.L802A15DC_7A8F7C:
/* 41636C 802A15DC 3C048029 */  lui       $a0, %hi(HES_SwapBackground)
/* 416370 802A15E0 24842CF4 */  addiu     $a0, $a0, %lo(HES_SwapBackground)
D_802A15E4_7A8F84:
/* 416374 802A15E4 0C050529 */  jal       hud_element_create
.L802A15E8_7A8F88:
/* 416378 802A15E8 00000000 */   nop
/* 41637C 802A15EC 0040882D */  daddu     $s1, $v0, $zero
.L802A15F0_7A8F90:
/* 416380 802A15F0 0220202D */  daddu     $a0, $s1, $zero
.L802A15F4_7A8F94:
/* 416384 802A15F4 3C01802B */  lui       $at, %hi(D_802AD05C)
/* 416388 802A15F8 AC31D05C */  sw        $s1, %lo(D_802AD05C)($at)
/* 41638C 802A15FC 0C051277 */  jal       hud_element_set_render_depth
D_802A1600_7A8FA0:
/* 416390 802A1600 0000282D */   daddu    $a1, $zero, $zero
.L802A1604_7A8FA4:
/* 416394 802A1604 0220202D */  daddu     $a0, $s1, $zero
.L802A1608_7A8FA8:
/* 416398 802A1608 24050061 */  addiu     $a1, $zero, 0x61
/* 41639C 802A160C 0C051261 */  jal       hud_element_set_render_pos
.L802A1610_7A8FB0:
/* 4163A0 802A1610 240600D0 */   addiu    $a2, $zero, 0xD0
D_802A1614_7A8FB4:
/* 4163A4 802A1614 0220202D */  daddu     $a0, $s1, $zero
.L802A1618_7A8FB8:
/* 4163A8 802A1618 240500FF */  addiu     $a1, $zero, 0xFF
D_802A161C_7A8FBC:
/* 4163AC 802A161C 00A0302D */  daddu     $a2, $a1, $zero
D_802A1620_7A8FC0:
/* 4163B0 802A1620 0C0513BF */  jal       hud_element_set_tint
/* 4163B4 802A1624 00A0382D */   daddu    $a3, $a1, $zero
glabel func_802A1628_7A8FC8
/* 4163B8 802A1628 0220202D */  daddu     $a0, $s1, $zero
/* 4163BC 802A162C 0C051280 */  jal       hud_element_set_flags
D_802A1630_7A8FD0:
/* 4163C0 802A1630 24050080 */   addiu    $a1, $zero, 0x80
.L802A1634_7A8FD4:
/* 4163C4 802A1634 0220202D */  daddu     $a0, $s1, $zero
/* 4163C8 802A1638 0C05128B */  jal       hud_element_clear_flags
glabel func_802A163C_7A8FDC
/* 4163CC 802A163C 34058000 */   ori      $a1, $zero, 0x8000
/* 4163D0 802A1640 0220202D */  daddu     $a0, $s1, $zero
D_802A1644_7A8FE4:
/* 4163D4 802A1644 0C0513AC */  jal       hud_element_set_alpha
/* 4163D8 802A1648 240500E6 */   addiu    $a1, $zero, 0xE6
.L802A164C_7A8FEC:
/* 4163DC 802A164C 3C048029 */  lui       $a0, %hi(HES_SwapZ)
/* 4163E0 802A1650 24842C50 */  addiu     $a0, $a0, %lo(HES_SwapZ)
.L802A1654_7A8FF4:
/* 4163E4 802A1654 0C050529 */  jal       hud_element_create
/* 4163E8 802A1658 00000000 */   nop
/* 4163EC 802A165C 0040882D */  daddu     $s1, $v0, $zero
.L802A1660_7A9000:
/* 4163F0 802A1660 0220202D */  daddu     $a0, $s1, $zero
D_802A1664_7A9004:
/* 4163F4 802A1664 3C01802B */  lui       $at, %hi(D_802AD050)
.L802A1668_7A9008:
/* 4163F8 802A1668 AC31D050 */  sw        $s1, %lo(D_802AD050)($at)
/* 4163FC 802A166C 0C051277 */  jal       hud_element_set_render_depth
D_802A1670_7A9010:
/* 416400 802A1670 24050005 */   addiu    $a1, $zero, 0x5
/* 416404 802A1674 0220202D */  daddu     $a0, $s1, $zero
.L802A1678_7A9018:
/* 416408 802A1678 0C05128B */  jal       hud_element_clear_flags
.L802A167C_7A901C:
/* 41640C 802A167C 34058000 */   ori      $a1, $zero, 0x8000
/* 416410 802A1680 0220202D */  daddu     $a0, $s1, $zero
/* 416414 802A1684 0C051280 */  jal       hud_element_set_flags
/* 416418 802A1688 24050080 */   addiu    $a1, $zero, 0x80
D_802A168C_7A902C:
/* 41641C 802A168C 0220202D */  daddu     $a0, $s1, $zero
D_802A1690_7A9030:
/* 416420 802A1690 2405005E */  addiu     $a1, $zero, 0x5E
/* 416424 802A1694 0C051261 */  jal       hud_element_set_render_pos
glabel .L802A1698_7A9038
/* 416428 802A1698 240600D1 */   addiu    $a2, $zero, 0xD1
/* 41642C 802A169C 3C048029 */  lui       $a0, %hi(HES_SwapArrowLeft)
.L802A16A0_7A9040:
/* 416430 802A16A0 24842C7C */  addiu     $a0, $a0, %lo(HES_SwapArrowLeft)
D_802A16A4_7A9044:
/* 416434 802A16A4 0C050529 */  jal       hud_element_create
/* 416438 802A16A8 00000000 */   nop
.L802A16AC_7A904C:
/* 41643C 802A16AC 0040882D */  daddu     $s1, $v0, $zero
D_802A16B0_7A9050:
/* 416440 802A16B0 0220202D */  daddu     $a0, $s1, $zero
/* 416444 802A16B4 3C01802B */  lui       $at, %hi(D_802AD054)
.L802A16B8_7A9058:
/* 416448 802A16B8 AC31D054 */  sw        $s1, %lo(D_802AD054)($at)
/* 41644C 802A16BC 0C051277 */  jal       hud_element_set_render_depth
/* 416450 802A16C0 24050005 */   addiu    $a1, $zero, 0x5
/* 416454 802A16C4 0220202D */  daddu     $a0, $s1, $zero
/* 416458 802A16C8 0C05128B */  jal       hud_element_clear_flags
glabel func_802A16CC_7A906C
/* 41645C 802A16CC 34058000 */   ori      $a1, $zero, 0x8000
D_802A16D0_7A9070:
/* 416460 802A16D0 0220202D */  daddu     $a0, $s1, $zero
D_802A16D4_7A9074:
/* 416464 802A16D4 0C051280 */  jal       hud_element_set_flags
.L802A16D8_7A9078:
/* 416468 802A16D8 24050080 */   addiu    $a1, $zero, 0x80
.L802A16DC_7A907C:
/* 41646C 802A16DC 0220202D */  daddu     $a0, $s1, $zero
/* 416470 802A16E0 24050051 */  addiu     $a1, $zero, 0x51
glabel func_802A16E4_7A9084
/* 416474 802A16E4 0C051261 */  jal       hud_element_set_render_pos
/* 416478 802A16E8 240600D2 */   addiu    $a2, $zero, 0xD2
/* 41647C 802A16EC 3C048029 */  lui       $a0, %hi(HES_SwapArrowRight)
D_802A16F0_7A9090:
/* 416480 802A16F0 24842CB8 */  addiu     $a0, $a0, %lo(HES_SwapArrowRight)
glabel func_802A16F4_7A9094
/* 416484 802A16F4 0C050529 */  jal       hud_element_create
/* 416488 802A16F8 00000000 */   nop
.L802A16FC_7A909C:
/* 41648C 802A16FC 0040882D */  daddu     $s1, $v0, $zero
.L802A1700_7A90A0:
/* 416490 802A1700 0220202D */  daddu     $a0, $s1, $zero
D_802A1704_7A90A4:
/* 416494 802A1704 3C01802B */  lui       $at, %hi(D_802AD058)
.L802A1708_7A90A8:
/* 416498 802A1708 AC31D058 */  sw        $s1, %lo(D_802AD058)($at)
D_802A170C_7A90AC:
/* 41649C 802A170C 0C051277 */  jal       hud_element_set_render_depth
D_802A1710_7A90B0:
/* 4164A0 802A1710 24050005 */   addiu    $a1, $zero, 0x5
/* 4164A4 802A1714 0220202D */  daddu     $a0, $s1, $zero
/* 4164A8 802A1718 0C05128B */  jal       hud_element_clear_flags
.L802A171C_7A90BC:
/* 4164AC 802A171C 34058000 */   ori      $a1, $zero, 0x8000
/* 4164B0 802A1720 0220202D */  daddu     $a0, $s1, $zero
D_802A1724_7A90C4:
/* 4164B4 802A1724 0C051280 */  jal       hud_element_set_flags
/* 4164B8 802A1728 24050080 */   addiu    $a1, $zero, 0x80
/* 4164BC 802A172C 0220202D */  daddu     $a0, $s1, $zero
/* 4164C0 802A1730 24050066 */  addiu     $a1, $zero, 0x66
glabel .L802A1734_7A90D4
/* 4164C4 802A1734 0C051261 */  jal       hud_element_set_render_pos
.L802A1738_7A90D8:
/* 4164C8 802A1738 240600D2 */   addiu    $a2, $zero, 0xD2
/* 4164CC 802A173C 3C03802B */  lui       $v1, %hi(D_802AD100)
D_802A1740_7A90E0:
/* 4164D0 802A1740 8C63D100 */  lw        $v1, %lo(D_802AD100)($v1)
D_802A1744_7A90E4:
/* 4164D4 802A1744 24020064 */  addiu     $v0, $zero, 0x64
/* 4164D8 802A1748 3C01802B */  lui       $at, %hi(D_802AD00A)
D_802A174C_7A90EC:
/* 4164DC 802A174C A422D00A */  sh        $v0, %lo(D_802AD00A)($at)
.L802A1750_7A90F0:
/* 4164E0 802A1750 24020003 */  addiu     $v0, $zero, 0x3
glabel .L802A1754_7A90F4
/* 4164E4 802A1754 3C01802B */  lui       $at, %hi(D_802AD001)
.L802A1758_7A90F8:
/* 4164E8 802A1758 A022D001 */  sb        $v0, %lo(D_802AD001)($at)
.L802A175C_7A90FC:
/* 4164EC 802A175C 24020001 */  addiu     $v0, $zero, 0x1
/* 4164F0 802A1760 3C01802B */  lui       $at, %hi(BattleMenuState)
/* 4164F4 802A1764 A022D000 */  sb        $v0, %lo(BattleMenuState)($at)
/* 4164F8 802A1768 000310C0 */  sll       $v0, $v1, 3
D_802A176C_7A910C:
/* 4164FC 802A176C 00431023 */  subu      $v0, $v0, $v1
D_802A1770_7A9110:
/* 416500 802A1770 00021080 */  sll       $v0, $v0, 2
.L802A1774_7A9114:
/* 416504 802A1774 4482A000 */  mtc1      $v0, $f20
/* 416508 802A1778 00000000 */  nop
.L802A177C_7A911C:
/* 41650C 802A177C 4680A520 */  cvt.s.w   $f20, $f20
/* 416510 802A1780 3C01802B */  lui       $at, %hi(BattleMenu_WheelAngle)
D_802A1784_7A9124:
/* 416514 802A1784 E434D06C */  swc1      $f20, %lo(BattleMenu_WheelAngle)($at)
.L802A1788_7A9128:
/* 416518 802A1788 080A870A */  j         .L802A1C28_7A95C8
/* 41651C 802A178C 0000102D */   daddu    $v0, $zero, $zero
D_802A1790_7A9130:
/* 416520 802A1790 3C035555 */  lui       $v1, (0x55555556 >> 16)
.L802A1794_7A9134:
/* 416524 802A1794 3C10802B */  lui       $s0, %hi(D_802AD001)
.L802A1798_7A9138:
/* 416528 802A1798 2610D001 */  addiu     $s0, $s0, %lo(D_802AD001)
.L802A179C_7A913C:
/* 41652C 802A179C 82040000 */  lb        $a0, 0x0($s0)
D_802A17A0_7A9140:
/* 416530 802A17A0 34635556 */  ori       $v1, $v1, (0x55555556 & 0xFFFF)
D_802A17A4_7A9144:
/* 416534 802A17A4 00041040 */  sll       $v0, $a0, 1
/* 416538 802A17A8 00441021 */  addu      $v0, $v0, $a0
D_802A17AC_7A914C:
/* 41653C 802A17AC 000210C0 */  sll       $v0, $v0, 3
.L802A17B0_7A9150:
/* 416540 802A17B0 00441021 */  addu      $v0, $v0, $a0
.L802A17B4_7A9154:
/* 416544 802A17B4 00021080 */  sll       $v0, $v0, 2
.L802A17B8_7A9158:
/* 416548 802A17B8 00430018 */  mult      $v0, $v1
.L802A17BC_7A915C:
/* 41654C 802A17BC 000217C3 */  sra       $v0, $v0, 31
/* 416550 802A17C0 00004010 */  mfhi      $t0
D_802A17C4_7A9164:
/* 416554 802A17C4 01021023 */  subu      $v0, $t0, $v0
/* 416558 802A17C8 3C01802B */  lui       $at, %hi(D_802AD00A)
D_802A17CC_7A916C:
/* 41655C 802A17CC A422D00A */  sh        $v0, %lo(D_802AD00A)($at)
D_802A17D0_7A9170:
/* 416560 802A17D0 1080000A */  beqz      $a0, D_802A17FC_7A919C
glabel func_802A17D4_7A9174
/* 416564 802A17D4 00000000 */   nop
/* 416568 802A17D8 14850005 */  bne       $a0, $a1, .L802A17F0_7A9190
D_802A17DC_7A917C:
/* 41656C 802A17DC 00000000 */   nop
/* 416570 802A17E0 3C04802B */  lui       $a0, %hi(D_802AD04C)
D_802A17E4_7A9184:
/* 416574 802A17E4 8C84D04C */  lw        $a0, %lo(D_802AD04C)($a0)
.L802A17E8_7A9188:
/* 416578 802A17E8 0C05128B */  jal       hud_element_clear_flags
/* 41657C 802A17EC 24050002 */   addiu    $a1, $zero, 0x2
.L802A17F0_7A9190:
/* 416580 802A17F0 92020000 */  lbu       $v0, 0x0($s0)
.L802A17F4_7A9194:
/* 416584 802A17F4 080A8708 */  j         .L802A1C20_7A95C0
.L802A17F8_7A9198:
/* 416588 802A17F8 2442FFFF */   addiu    $v0, $v0, -0x1
D_802A17FC_7A919C:
/* 41658C 802A17FC 3C02802B */  lui       $v0, %hi(D_802AD100)
D_802A1800_7A91A0:
/* 416590 802A1800 8C42D100 */  lw        $v0, %lo(D_802AD100)($v0)
D_802A1804_7A91A4:
/* 416594 802A1804 3C01802B */  lui       $at, %hi(BattleMenu_CurPos)
.L802A1808_7A91A8:
/* 416598 802A1808 A020D002 */  sb        $zero, %lo(BattleMenu_CurPos)($at)
D_802A180C_7A91AC:
/* 41659C 802A180C 3C01802B */  lui       $at, %hi(BattleMenu_PrevPos)
/* 4165A0 802A1810 A020D003 */  sb        $zero, %lo(BattleMenu_PrevPos)($at)
D_802A1814_7A91B4:
/* 4165A4 802A1814 000218C0 */  sll       $v1, $v0, 3
glabel func_802A1818_7A91B8
/* 4165A8 802A1818 00621823 */  subu      $v1, $v1, $v0
.L802A181C_7A91BC:
/* 4165AC 802A181C 00031880 */  sll       $v1, $v1, 2
/* 4165B0 802A1820 3C02802B */  lui       $v0, %hi(BattleMenu_NumOptions)
D_802A1824_7A91C4:
/* 4165B4 802A1824 8C42D0AC */  lw        $v0, %lo(BattleMenu_NumOptions)($v0)
/* 4165B8 802A1828 4483A000 */  mtc1      $v1, $f20
D_802A182C_7A91CC:
/* 4165BC 802A182C 00000000 */  nop
D_802A1830_7A91D0:
/* 4165C0 802A1830 4680A520 */  cvt.s.w   $f20, $f20
D_802A1834_7A91D4:
/* 4165C4 802A1834 3C01802B */  lui       $at, %hi(BattleMenu_WheelAngle)
/* 4165C8 802A1838 E434D06C */  swc1      $f20, %lo(BattleMenu_WheelAngle)($at)
D_802A183C_7A91DC:
/* 4165CC 802A183C 18400039 */  blez      $v0, .L802A1924_7A92C4
glabel func_802A1840_7A91E0
/* 4165D0 802A1840 0000982D */   daddu    $s3, $zero, $zero
D_802A1844_7A91E4:
/* 4165D4 802A1844 4480B000 */  mtc1      $zero, $f22
glabel func_802A1848_7A91E8
/* 4165D8 802A1848 3C15802B */  lui       $s5, %hi(D_802AD028)
/* 4165DC 802A184C 26B5D028 */  addiu     $s5, $s5, %lo(D_802AD028)
D_802A1850_7A91F0:
/* 4165E0 802A1850 3C14802B */  lui       $s4, %hi(D_802AD010)
D_802A1854_7A91F4:
/* 4165E4 802A1854 2694D010 */  addiu     $s4, $s4, %lo(D_802AD010)
.L802A1858_7A91F8:
/* 4165E8 802A1858 27A40010 */  addiu     $a0, $sp, 0x10
D_802A185C_7A91FC:
/* 4165EC 802A185C 27A50014 */  addiu     $a1, $sp, 0x14
/* 4165F0 802A1860 3C0642AE */  lui       $a2, (0x42AE0000 >> 16)
/* 4165F4 802A1864 4407A000 */  mfc1      $a3, $f20
/* 4165F8 802A1868 26730001 */  addiu     $s3, $s3, 0x1
D_802A186C_7A920C:
/* 4165FC 802A186C E7B60010 */  swc1      $f22, 0x10($sp)
D_802A1870_7A9210:
/* 416600 802A1870 0C00A7E7 */  jal       add_vec2D_polar
.L802A1874_7A9214:
/* 416604 802A1874 E7B60014 */   swc1     $f22, 0x14($sp)
.L802A1878_7A9218:
/* 416608 802A1878 8E910000 */  lw        $s1, 0x0($s4)
.L802A187C_7A921C:
/* 41660C 802A187C 26940004 */  addiu     $s4, $s4, 0x4
/* 416610 802A1880 3C01802B */  lui       $at, %hi(BattleMenu_BasePosX)
D_802A1884_7A9224:
/* 416614 802A1884 C422D060 */  lwc1      $f2, %lo(BattleMenu_BasePosX)($at)
/* 416618 802A1888 468010A0 */  cvt.s.w   $f2, $f2
glabel func_802A188C_7A922C
/* 41661C 802A188C C7A00010 */  lwc1      $f0, 0x10($sp)
.L802A1890_7A9230:
/* 416620 802A1890 C7A40014 */  lwc1      $f4, 0x14($sp)
glabel func_802A1894_7A9234
/* 416624 802A1894 46001080 */  add.s     $f2, $f2, $f0
/* 416628 802A1898 0220202D */  daddu     $a0, $s1, $zero
D_802A189C_7A923C:
/* 41662C 802A189C 3C01802B */  lui       $at, %hi(BattleMenu_BasePosY)
.L802A18A0_7A9240:
/* 416630 802A18A0 C420D064 */  lwc1      $f0, %lo(BattleMenu_BasePosY)($at)
D_802A18A4_7A9244:
/* 416634 802A18A4 46800020 */  cvt.s.w   $f0, $f0
/* 416638 802A18A8 46040000 */  add.s     $f0, $f0, $f4
D_802A18AC_7A924C:
/* 41663C 802A18AC 4600118D */  trunc.w.s $f6, $f2
glabel .L802A18B0_7A9250
/* 416640 802A18B0 44123000 */  mfc1      $s2, $f6
/* 416644 802A18B4 00000000 */  nop
D_802A18B8_7A9258:
/* 416648 802A18B8 0240282D */  daddu     $a1, $s2, $zero
/* 41664C 802A18BC 4600018D */  trunc.w.s $f6, $f0
/* 416650 802A18C0 44103000 */  mfc1      $s0, $f6
/* 416654 802A18C4 0C051261 */  jal       hud_element_set_render_pos
D_802A18C8_7A9268:
/* 416658 802A18C8 0200302D */   daddu    $a2, $s0, $zero
D_802A18CC_7A926C:
/* 41665C 802A18CC 0220202D */  daddu     $a0, $s1, $zero
D_802A18D0_7A9270:
/* 416660 802A18D0 0C05128B */  jal       hud_element_clear_flags
/* 416664 802A18D4 24050002 */   addiu    $a1, $zero, 0x2
glabel func_802A18D8_7A9278
/* 416668 802A18D8 0240282D */  daddu     $a1, $s2, $zero
/* 41666C 802A18DC 0200302D */  daddu     $a2, $s0, $zero
D_802A18E0_7A9280:
/* 416670 802A18E0 8EB10000 */  lw        $s1, 0x0($s5)
D_802A18E4_7A9284:
/* 416674 802A18E4 26B50004 */  addiu     $s5, $s5, 0x4
glabel func_802A18E8_7A9288
/* 416678 802A18E8 0C051261 */  jal       hud_element_set_render_pos
D_802A18EC_7A928C:
/* 41667C 802A18EC 0220202D */   daddu    $a0, $s1, $zero
D_802A18F0_7A9290:
/* 416680 802A18F0 0220202D */  daddu     $a0, $s1, $zero
/* 416684 802A18F4 0C0513AC */  jal       hud_element_set_alpha
/* 416688 802A18F8 24050064 */   addiu    $a1, $zero, 0x64
D_802A18FC_7A929C:
/* 41668C 802A18FC 0220202D */  daddu     $a0, $s1, $zero
/* 416690 802A1900 0C05128B */  jal       hud_element_clear_flags
D_802A1904_7A92A4:
/* 416694 802A1904 24050002 */   addiu    $a1, $zero, 0x2
/* 416698 802A1908 3C02802B */  lui       $v0, %hi(BattleMenu_NumOptions)
D_802A190C_7A92AC:
/* 41669C 802A190C 8C42D0AC */  lw        $v0, %lo(BattleMenu_NumOptions)($v0)
/* 4166A0 802A1910 3C0141E0 */  lui       $at, (0x41E00000 >> 16)
D_802A1914_7A92B4:
/* 4166A4 802A1914 44810000 */  mtc1      $at, $f0
/* 4166A8 802A1918 0262102A */  slt       $v0, $s3, $v0
D_802A191C_7A92BC:
/* 4166AC 802A191C 1440FFCE */  bnez      $v0, .L802A1858_7A91F8
.L802A1920_7A92C0:
/* 4166B0 802A1920 4600A500 */   add.s    $f20, $f20, $f0
.L802A1924_7A92C4:
/* 4166B4 802A1924 27A40010 */  addiu     $a0, $sp, 0x10
.L802A1928_7A92C8:
/* 4166B8 802A1928 3C03802B */  lui       $v1, %hi(D_802AD100)
/* 4166BC 802A192C 8C63D100 */  lw        $v1, %lo(D_802AD100)($v1)
D_802A1930_7A92D0:
/* 4166C0 802A1930 3C0642AE */  lui       $a2, (0x42AE0000 >> 16)
D_802A1934_7A92D4:
/* 4166C4 802A1934 000310C0 */  sll       $v0, $v1, 3
.L802A1938_7A92D8:
/* 4166C8 802A1938 00431023 */  subu      $v0, $v0, $v1
.L802A193C_7A92DC:
/* 4166CC 802A193C 00021080 */  sll       $v0, $v0, 2
/* 4166D0 802A1940 44823000 */  mtc1      $v0, $f6
D_802A1944_7A92E4:
/* 4166D4 802A1944 00000000 */  nop
D_802A1948_7A92E8:
/* 4166D8 802A1948 468031A0 */  cvt.s.w   $f6, $f6
/* 4166DC 802A194C 44073000 */  mfc1      $a3, $f6
D_802A1950_7A92F0:
/* 4166E0 802A1950 27A50014 */  addiu     $a1, $sp, 0x14
/* 4166E4 802A1954 AFA00010 */  sw        $zero, 0x10($sp)
/* 4166E8 802A1958 0C00A7E7 */  jal       add_vec2D_polar
D_802A195C_7A92FC:
/* 4166EC 802A195C AFA00014 */   sw       $zero, 0x14($sp)
D_802A1960_7A9300:
/* 4166F0 802A1960 3C01802B */  lui       $at, %hi(BattleMenu_BasePosX)
D_802A1964_7A9304:
/* 4166F4 802A1964 C422D060 */  lwc1      $f2, %lo(BattleMenu_BasePosX)($at)
/* 4166F8 802A1968 468010A0 */  cvt.s.w   $f2, $f2
D_802A196C_7A930C:
/* 4166FC 802A196C C7A00010 */  lwc1      $f0, 0x10($sp)
D_802A1970_7A9310:
/* 416700 802A1970 3C11802B */  lui       $s1, %hi(D_802AD040)
/* 416704 802A1974 8E31D040 */  lw        $s1, %lo(D_802AD040)($s1)
/* 416708 802A1978 46001080 */  add.s     $f2, $f2, $f0
/* 41670C 802A197C C7A40014 */  lwc1      $f4, 0x14($sp)
D_802A1980_7A9320:
/* 416710 802A1980 3C01802B */  lui       $at, %hi(BattleMenu_BasePosY)
D_802A1984_7A9324:
/* 416714 802A1984 C420D064 */  lwc1      $f0, %lo(BattleMenu_BasePosY)($at)
/* 416718 802A1988 46800020 */  cvt.s.w   $f0, $f0
D_802A198C_7A932C:
/* 41671C 802A198C 46040000 */  add.s     $f0, $f0, $f4
/* 416720 802A1990 4600118D */  trunc.w.s $f6, $f2
/* 416724 802A1994 44053000 */  mfc1      $a1, $f6
D_802A1998_7A9338:
/* 416728 802A1998 4600018D */  trunc.w.s $f6, $f0
/* 41672C 802A199C 44063000 */  mfc1      $a2, $f6
/* 416730 802A19A0 0C051261 */  jal       hud_element_set_render_pos
/* 416734 802A19A4 0220202D */   daddu    $a0, $s1, $zero
glabel func_802A19A8_7A9348
/* 416738 802A19A8 0220202D */  daddu     $a0, $s1, $zero
.L802A19AC_7A934C:
/* 41673C 802A19AC 0C0513AC */  jal       hud_element_set_alpha
D_802A19B0:
/* 416740 802A19B0 240500B4 */   addiu    $a1, $zero, 0xB4
/* 416744 802A19B4 3C053F59 */  lui       $a1, (0x3F59999A >> 16)
D_802A19B8_7A9358:
/* 416748 802A19B8 34A5999A */  ori       $a1, $a1, (0x3F59999A & 0xFFFF)
D_802A19BC_7A935C:
/* 41674C 802A19BC 0C051308 */  jal       hud_element_set_scale
D_802A19C0_7A9360:
/* 416750 802A19C0 0220202D */   daddu    $a0, $s1, $zero
/* 416754 802A19C4 0220202D */  daddu     $a0, $s1, $zero
D_802A19C8_7A9368:
/* 416758 802A19C8 0C05128B */  jal       hud_element_clear_flags
D_802A19CC_7A936C:
/* 41675C 802A19CC 24050002 */   addiu    $a1, $zero, 0x2
/* 416760 802A19D0 24020002 */  addiu     $v0, $zero, 0x2
.L802A19D4_7A9374:
/* 416764 802A19D4 3C01802B */  lui       $at, %hi(BattleMenuState)
/* 416768 802A19D8 A022D000 */  sb        $v0, %lo(BattleMenuState)($at)
/* 41676C 802A19DC 080A870A */  j         .L802A1C28_7A95C8
D_802A19E0_7A9380:
/* 416770 802A19E0 0000102D */   daddu    $v0, $zero, $zero
D_802A19E4_7A9384:
/* 416774 802A19E4 8CC20214 */  lw        $v0, 0x214($a2)
/* 416778 802A19E8 30428000 */  andi      $v0, $v0, 0x8000
glabel func_802A19EC_7A938C
/* 41677C 802A19EC 10400021 */  beqz      $v0, D_802A1A74_7A9414
/* 416780 802A19F0 00000000 */   nop
/* 416784 802A19F4 3C11802B */  lui       $s1, %hi(BattleMenu_CurPos)
/* 416788 802A19F8 2631D002 */  addiu     $s1, $s1, %lo(BattleMenu_CurPos)
D_802A19FC_7A939C:
/* 41678C 802A19FC 3C12802B */  lui       $s2, %hi(BattleMenu_HomePos)
D_802A1A00_7A93A0:
/* 416790 802A1A00 2652D06B */  addiu     $s2, $s2, %lo(BattleMenu_HomePos)
/* 416794 802A1A04 82220000 */  lb        $v0, 0x0($s1)
/* 416798 802A1A08 82430000 */  lb        $v1, 0x0($s2)
D_802A1A0C_7A93AC:
/* 41679C 802A1A0C 00431021 */  addu      $v0, $v0, $v1
/* 4167A0 802A1A10 00021080 */  sll       $v0, $v0, 2
/* 4167A4 802A1A14 3C01802B */  lui       $at, %hi(BattleMenu_OptionEnabled)
/* 4167A8 802A1A18 00220821 */  addu      $at, $at, $v0
D_802A1A1C_7A93BC:
/* 4167AC 802A1A1C 8C22D0D0 */  lw        $v0, %lo(BattleMenu_OptionEnabled)($at)
D_802A1A20_7A93C0:
/* 4167B0 802A1A20 14450005 */  bne       $v0, $a1, .L802A1A38_7A93D8
/* 4167B4 802A1A24 00000000 */   nop
.L802A1A28_7A93C8:
/* 4167B8 802A1A28 0C05272D */  jal       sfx_play_sound
/* 4167BC 802A1A2C 240400C9 */   addiu    $a0, $zero, 0xC9
D_802A1A30_7A93D0:
/* 4167C0 802A1A30 080A8708 */  j         .L802A1C20_7A95C0
/* 4167C4 802A1A34 2402FFFF */   addiu    $v0, $zero, -0x1
.L802A1A38_7A93D8:
/* 4167C8 802A1A38 0C05272D */  jal       sfx_play_sound
/* 4167CC 802A1A3C 2404021D */   addiu    $a0, $zero, 0x21D
glabel func_802A1A40_7A93E0
/* 4167D0 802A1A40 82220000 */  lb        $v0, 0x0($s1)
D_802A1A44_7A93E4:
/* 4167D4 802A1A44 82430000 */  lb        $v1, 0x0($s2)
/* 4167D8 802A1A48 00431021 */  addu      $v0, $v0, $v1
/* 4167DC 802A1A4C 00021080 */  sll       $v0, $v0, 2
/* 4167E0 802A1A50 3C03802B */  lui       $v1, %hi(D_802AD0EB)
/* 4167E4 802A1A54 00621821 */  addu      $v1, $v1, $v0
/* 4167E8 802A1A58 9063D0EB */  lbu       $v1, %lo(D_802AD0EB)($v1)
D_802A1A5C_7A93FC:
/* 4167EC 802A1A5C 24020064 */  addiu     $v0, $zero, 0x64
D_802A1A60:
/* 4167F0 802A1A60 A2020000 */  sb        $v0, 0x0($s0)
D_802A1A64_7A9404:
/* 4167F4 802A1A64 3C01802B */  lui       $at, %hi(BattleMenuDisableMsg)
D_802A1A68_7A9408:
/* 4167F8 802A1A68 A023D068 */  sb        $v1, %lo(BattleMenuDisableMsg)($at)
/* 4167FC 802A1A6C 080A870A */  j         .L802A1C28_7A95C8
D_802A1A70_7A9410:
/* 416800 802A1A70 0000102D */   daddu    $v0, $zero, $zero
D_802A1A74_7A9414:
/* 416804 802A1A74 3C05802B */  lui       $a1, %hi(BattleMenu_CurPos)
.L802A1A78_7A9418:
/* 416808 802A1A78 24A5D002 */  addiu     $a1, $a1, %lo(BattleMenu_CurPos)
/* 41680C 802A1A7C 90A40000 */  lbu       $a0, 0x0($a1)
/* 416810 802A1A80 3C02802B */  lui       $v0, %hi(D_802AD004)
D_802A1A84_7A9424:
/* 416814 802A1A84 8042D004 */  lb        $v0, %lo(D_802AD004)($v0)
D_802A1A88_7A9428:
/* 416818 802A1A88 3C01802B */  lui       $at, %hi(BattleMenu_PrevPos)
glabel func_802A1A8C_7A942C
/* 41681C 802A1A8C A024D003 */  sb        $a0, %lo(BattleMenu_PrevPos)($at)
D_802A1A90_7A9430:
/* 416820 802A1A90 1440001B */  bnez      $v0, .L802A1B00_7A94A0
D_802A1A94_7A9434:
/* 416824 802A1A94 3C030005 */   lui      $v1, (0x50000 >> 16)
/* 416828 802A1A98 8CC20218 */  lw        $v0, 0x218($a2)
/* 41682C 802A1A9C 00431024 */  and       $v0, $v0, $v1
D_802A1AA0_7A9440:
/* 416830 802A1AA0 10400008 */  beqz      $v0, .L802A1AC4_7A9464
/* 416834 802A1AA4 00041600 */   sll      $v0, $a0, 24
D_802A1AA8_7A9448:
/* 416838 802A1AA8 3C03802B */  lui       $v1, %hi(BattleMenu_MinIdx)
/* 41683C 802A1AAC 8063D069 */  lb        $v1, %lo(BattleMenu_MinIdx)($v1)
/* 416840 802A1AB0 00021603 */  sra       $v0, $v0, 24
/* 416844 802A1AB4 0062182A */  slt       $v1, $v1, $v0
glabel .L802A1AB8_7A9458
/* 416848 802A1AB8 10600002 */  beqz      $v1, .L802A1AC4_7A9464
D_802A1ABC_7A945C:
/* 41684C 802A1ABC 2482FFFF */   addiu    $v0, $a0, -0x1
D_802A1AC0_7A9460:
/* 416850 802A1AC0 A0A20000 */  sb        $v0, 0x0($a1)
.L802A1AC4_7A9464:
/* 416854 802A1AC4 8CC20218 */  lw        $v0, 0x218($a2)
/* 416858 802A1AC8 3C03000A */  lui       $v1, (0xA0000 >> 16)
D_802A1ACC_7A946C:
/* 41685C 802A1ACC 00431024 */  and       $v0, $v0, $v1
D_802A1AD0_7A9470:
/* 416860 802A1AD0 1040000B */  beqz      $v0, .L802A1B00_7A94A0
/* 416864 802A1AD4 00000000 */   nop
glabel func_802A1AD8_7A9478
/* 416868 802A1AD8 3C04802B */  lui       $a0, %hi(BattleMenu_CurPos)
/* 41686C 802A1ADC 2484D002 */  addiu     $a0, $a0, %lo(BattleMenu_CurPos)
/* 416870 802A1AE0 80820000 */  lb        $v0, 0x0($a0)
/* 416874 802A1AE4 3C03802B */  lui       $v1, %hi(BattleMenu_MaxIdx)
/* 416878 802A1AE8 8063D06A */  lb        $v1, %lo(BattleMenu_MaxIdx)($v1)
D_802A1AEC_7A948C:
/* 41687C 802A1AEC 0043102A */  slt       $v0, $v0, $v1
D_802A1AF0_7A9490:
/* 416880 802A1AF0 90830000 */  lbu       $v1, 0x0($a0)
/* 416884 802A1AF4 10400002 */  beqz      $v0, .L802A1B00_7A94A0
/* 416888 802A1AF8 24620001 */   addiu    $v0, $v1, 0x1
D_802A1AFC_7A949C:
/* 41688C 802A1AFC A0820000 */  sb        $v0, 0x0($a0)
.L802A1B00_7A94A0:
/* 416890 802A1B00 3C03802B */  lui       $v1, %hi(BattleMenu_PrevPos)
/* 416894 802A1B04 8063D003 */  lb        $v1, %lo(BattleMenu_PrevPos)($v1)
/* 416898 802A1B08 3C02802B */  lui       $v0, %hi(BattleMenu_CurPos)
D_802A1B0C_7A94AC:
/* 41689C 802A1B0C 8042D002 */  lb        $v0, %lo(BattleMenu_CurPos)($v0)
/* 4168A0 802A1B10 10620044 */  beq       $v1, $v0, .L802A1C24_7A95C4
glabel func_802A1B14_7A94B4
/* 4168A4 802A1B14 24020001 */   addiu    $v0, $zero, 0x1
/* 4168A8 802A1B18 3C01802B */  lui       $at, %hi(D_802AD004)
/* 4168AC 802A1B1C A022D004 */  sb        $v0, %lo(D_802AD004)($at)
.L802A1B20_7A94C0:
/* 4168B0 802A1B20 0C05272D */  jal       sfx_play_sound
/* 4168B4 802A1B24 240400C8 */   addiu    $a0, $zero, 0xC8
/* 4168B8 802A1B28 080A870A */  j         .L802A1C28_7A95C8
/* 4168BC 802A1B2C 0000102D */   daddu    $v0, $zero, $zero
.L802A1B30_7A94D0:
/* 4168C0 802A1B30 3C02802B */  lui       $v0, %hi(BattleMenu_CurPos)
/* 4168C4 802A1B34 8042D002 */  lb        $v0, %lo(BattleMenu_CurPos)($v0)
/* 4168C8 802A1B38 3C04802B */  lui       $a0, %hi(BattleMenu_HomePos)
/* 4168CC 802A1B3C 8084D06B */  lb        $a0, %lo(BattleMenu_HomePos)($a0)
D_802A1B40_7A94E0:
/* 4168D0 802A1B40 3C01802B */  lui       $at, %hi(BattleMenuAlpha)
D_802A1B44_7A94E4:
/* 4168D4 802A1B44 A423D008 */  sh        $v1, %lo(BattleMenuAlpha)($at)
/* 4168D8 802A1B48 080A86F1 */  j         .L802A1BC4_7A9564
/* 4168DC 802A1B4C 00441021 */   addu     $v0, $v0, $a0
D_802A1B50_7A94F0:
/* 4168E0 802A1B50 3C02802B */  lui       $v0, %hi(BattleMenu_CurPos)
glabel .L802A1B54_7A94F4
/* 4168E4 802A1B54 8042D002 */  lb        $v0, %lo(BattleMenu_CurPos)($v0)
/* 4168E8 802A1B58 3C04802B */  lui       $a0, %hi(BattleMenu_HomePos)
/* 4168EC 802A1B5C 8084D06B */  lb        $a0, %lo(BattleMenu_HomePos)($a0)
/* 4168F0 802A1B60 3C01802B */  lui       $at, %hi(D_802AD001)
/* 4168F4 802A1B64 A020D001 */  sb        $zero, %lo(D_802AD001)($at)
glabel func_802A1B68_7A9508
/* 4168F8 802A1B68 3C01802B */  lui       $at, %hi(D_802AD006)
D_802A1B6C_7A950C:
/* 4168FC 802A1B6C A420D006 */  sh        $zero, %lo(D_802AD006)($at)
/* 416900 802A1B70 080A86EF */  j         D_802A1BBC_7A955C
D_802A1B74_7A9514:
/* 416904 802A1B74 2403000B */   addiu    $v1, $zero, 0xB
.L802A1B78_7A9518:
/* 416908 802A1B78 3C02802B */  lui       $v0, %hi(BattleMenu_CurPos)
/* 41690C 802A1B7C 8042D002 */  lb        $v0, %lo(BattleMenu_CurPos)($v0)
/* 416910 802A1B80 3C03802B */  lui       $v1, %hi(BattleMenu_HomePos)
/* 416914 802A1B84 8063D06B */  lb        $v1, %lo(BattleMenu_HomePos)($v1)
/* 416918 802A1B88 00431021 */  addu      $v0, $v0, $v1
/* 41691C 802A1B8C 080A870A */  j         .L802A1C28_7A95C8
/* 416920 802A1B90 24420001 */   addiu    $v0, $v0, 0x1
.L802A1B94_7A9534:
/* 416924 802A1B94 3C01802B */  lui       $at, %hi(D_802AD001)
/* 416928 802A1B98 A022D001 */  sb        $v0, %lo(D_802AD001)($at)
D_802A1B9C_7A953C:
/* 41692C 802A1B9C 240200FF */  addiu     $v0, $zero, 0xFF
D_802A1BA0_7A9540:
/* 416930 802A1BA0 3C01802B */  lui       $at, %hi(D_802AD006)
/* 416934 802A1BA4 A422D006 */  sh        $v0, %lo(D_802AD006)($at)
/* 416938 802A1BA8 3C02802B */  lui       $v0, %hi(BattleMenu_CurPos)
/* 41693C 802A1BAC 8042D002 */  lb        $v0, %lo(BattleMenu_CurPos)($v0)
D_802A1BB0_7A9550:
/* 416940 802A1BB0 3C04802B */  lui       $a0, %hi(BattleMenu_HomePos)
.L802A1BB4_7A9554:
/* 416944 802A1BB4 8084D06B */  lb        $a0, %lo(BattleMenu_HomePos)($a0)
/* 416948 802A1BB8 24030002 */  addiu     $v1, $zero, 0x2
D_802A1BBC_7A955C:
/* 41694C 802A1BBC A2030000 */  sb        $v1, 0x0($s0)
/* 416950 802A1BC0 00441021 */  addu      $v0, $v0, $a0
.L802A1BC4_7A9564:
/* 416954 802A1BC4 080A870A */  j         .L802A1C28_7A95C8
/* 416958 802A1BC8 24420001 */   addiu    $v0, $v0, 0x1
.L802A1BCC_7A956C:
/* 41695C 802A1BCC 3C01802B */  lui       $at, %hi(D_802AD001)
/* 416960 802A1BD0 A022D001 */  sb        $v0, %lo(D_802AD001)($at)
/* 416964 802A1BD4 240200FF */  addiu     $v0, $zero, 0xFF
/* 416968 802A1BD8 3C01802B */  lui       $at, %hi(D_802AD006)
/* 41696C 802A1BDC A422D006 */  sh        $v0, %lo(D_802AD006)($at)
D_802A1BE0_7A9580:
/* 416970 802A1BE0 080A8708 */  j         .L802A1C20_7A95C0
/* 416974 802A1BE4 2402FFFF */   addiu    $v0, $zero, -0x1
.L802A1BE8_7A9588:
/* 416978 802A1BE8 3C04802B */  lui       $a0, %hi(BattleMenuDisableMsg)
D_802A1BEC_7A958C:
/* 41697C 802A1BEC 8084D068 */  lb        $a0, %lo(BattleMenuDisableMsg)($a0)
/* 416980 802A1BF0 0C093E58 */  jal       func_8024F960
/* 416984 802A1BF4 2405005A */   addiu    $a1, $zero, 0x5A
/* 416988 802A1BF8 080A8708 */  j         .L802A1C20_7A95C0
/* 41698C 802A1BFC 24020065 */   addiu    $v0, $zero, 0x65
D_802A1C00_7A95A0:
/* 416990 802A1C00 0C093EAD */  jal       func_8024FAB4
/* 416994 802A1C04 00000000 */   nop
/* 416998 802A1C08 14400007 */  bnez      $v0, .L802A1C28_7A95C8
/* 41699C 802A1C0C 0000102D */   daddu    $v0, $zero, $zero
.L802A1C10_7A95B0:
/* 4169A0 802A1C10 2402FFFF */  addiu     $v0, $zero, -0x1
/* 4169A4 802A1C14 3C01802B */  lui       $at, %hi(BattleMenuDisableMsg)
/* 4169A8 802A1C18 A022D068 */  sb        $v0, %lo(BattleMenuDisableMsg)($at)
/* 4169AC 802A1C1C 24020002 */  addiu     $v0, $zero, 0x2
.L802A1C20_7A95C0:
/* 4169B0 802A1C20 A2020000 */  sb        $v0, 0x0($s0)
.L802A1C24_7A95C4:
/* 4169B4 802A1C24 0000102D */  daddu     $v0, $zero, $zero
.L802A1C28_7A95C8:
/* 4169B8 802A1C28 8FBF0030 */  lw        $ra, 0x30($sp)
/* 4169BC 802A1C2C 8FB5002C */  lw        $s5, 0x2C($sp)
/* 4169C0 802A1C30 8FB40028 */  lw        $s4, 0x28($sp)
/* 4169C4 802A1C34 8FB30024 */  lw        $s3, 0x24($sp)
/* 4169C8 802A1C38 8FB20020 */  lw        $s2, 0x20($sp)
/* 4169CC 802A1C3C 8FB1001C */  lw        $s1, 0x1C($sp)
D_802A1C40_7A95E0:
/* 4169D0 802A1C40 8FB00018 */  lw        $s0, 0x18($sp)
/* 4169D4 802A1C44 D7B60040 */  ldc1      $f22, 0x40($sp)
/* 4169D8 802A1C48 D7B40038 */  ldc1      $f20, 0x38($sp)
/* 4169DC 802A1C4C 03E00008 */  jr        $ra
D_802A1C50_7A95F0:
/* 4169E0 802A1C50 27BD0048 */   addiu    $sp, $sp, 0x48

### DECOMPILED C INSTRUCTIONS:

s32 btl_main_menu_update(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    f32 theta;
    s32 id;
    s32 i;
    f32 x, y;
    s32 l, t;

    switch (BattleMenuState) {
        case BTL_MENU_STATE_CREATE:
            BattleMenu_BasePosX = 54;
            BattleMenu_BasePosY = 173;
            D_802AD070 = 0.3f;
            D_802AD004 = 0;
            BattleMenu_HomePos = D_802AD0B0;
            BattleMenu_MinIdx = 0;
            BattleMenu_MinIdx -= D_802AD0B0;
            BattleMenu_MaxIdx = BattleMenu_NumOptions - 1;
            BattleMenu_MaxIdx -= D_802AD0B0;

            for (i = 0; i < BattleMenu_NumOptions; i++) {
                D_802AD010[i] = id = hud_element_create(BattleMenu_HudScripts[i]);
                hud_element_set_render_depth(id, 5);
                hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
                hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
                hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED);
                hud_element_set_scale(id, 0.75f);

                D_802AD028[i] = id = hud_element_create(&HES_ProjectorSpot);
                hud_element_create_transform_B(id);
                hud_element_set_render_depth(id, 10);
                hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
                hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
                hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED);
            }

            D_802AD040 = id = hud_element_create(&HES_ProjectorSpot);
            hud_element_create_transform_B(id);
            hud_element_set_render_depth(id, 7);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED);

            D_802AD044 = id = hud_element_create(&HES_ProjectorReel);
            hud_element_create_transform_B(id);
            hud_element_set_render_depth(id, 0);
            hud_element_set_render_pos(id, 40, 212);
            hud_element_set_tint(id, 0, 91, 127);
            hud_element_set_transform_rotation_pivot(id, 16, -16);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_alpha(id, 240);

            D_802AD048 = id = hud_element_create(&HES_ProjectorReel);
            hud_element_create_transform_B(id);
            hud_element_set_render_depth(id, 2);
            hud_element_set_render_pos(id, 39, 212);
            hud_element_set_tint(id, 0, 91, 127);
            hud_element_set_transform_rotation_pivot(id, 16, -16);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_alpha(id, 240);

            D_802AD04C = id = hud_element_create(&HES_ProjectorBeam);
            hud_element_create_transform_B(id);
            hud_element_set_render_depth(id, 20);
            hud_element_set_render_pos(id, 78, 178);
            hud_element_set_tint(id, 255, 255, 255);
            hud_element_set_transform_rotation_pivot(id, 0, 0);
            hud_element_set_transform_rotation(id, 0.0f, 0.0f, -45.0f);
            hud_element_set_alpha(id, 200);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_DISABLED);

            D_802AD05C = id = hud_element_create(&HES_SwapBackground);
            hud_element_set_render_depth(id, 0);
            hud_element_set_render_pos(id, 97, 208);
            hud_element_set_tint(id, 255, 255, 255);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_alpha(id, 230);

            D_802AD050 = id = hud_element_create(&HES_SwapZ);
            hud_element_set_render_depth(id, 5);
            hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_set_render_pos(id, 94, 209);

            D_802AD054 = id = hud_element_create(&HES_SwapArrowLeft);
            hud_element_set_render_depth(id, 5);
            hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_set_render_pos(id, 81, 210);

            D_802AD058 = id = hud_element_create(&HES_SwapArrowRight);
            hud_element_set_render_depth(id, 5);
            hud_element_clear_flags(id, HUD_ELEMENT_FLAG_FILTER_TEX);
            hud_element_set_flags(id, HUD_ELEMENT_FLAG_80);
            hud_element_set_render_pos(id, 102, 210);
            D_802AD00A = 100;
            D_802AD001 = 3;
            BattleMenuState = BTL_MENU_STATE_UNK_1;
            BattleMenu_WheelAngle = theta = D_802AD100 * 28;
            break;
        case BTL_MENU_STATE_UNK_1:
            D_802AD00A = (D_802AD001 * 100) / 3;

            switch (D_802AD001) {
                case 1:
                    if (D_802AD001 == 1) {
                        id = D_802AD04C;
                        hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED);
                    }
                default:
                    D_802AD001--;
                    break;
                case 0:
                    BattleMenu_CurPos = 0;
                    BattleMenu_PrevPos = 0;
                    BattleMenu_WheelAngle = theta = D_802AD100 * 28;
                    for (i = 0; i < BattleMenu_NumOptions; i++, theta += 28.0f) {
                        x = 0.0f;
                        y = 0.0f;
                        add_vec2D_polar(&x, &y, 87.0f, theta);

                        l = BattleMenu_BasePosX + x;
                        t = BattleMenu_BasePosY + y;
                        id = D_802AD010[i];
                        hud_element_set_render_pos(id, l, t);
                        hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED);

                        id = D_802AD028[i];
                        hud_element_set_render_pos(id, l, t);
                        hud_element_set_alpha(id, 100);
                        hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED);
                    }

                    x = 0.0f;
                    y = 0.0f;
                    theta = D_802AD100 * 28;
                    add_vec2D_polar(&x, &y, 87.0f, theta);

                    l = BattleMenu_BasePosX + x;
                    t = BattleMenu_BasePosY + y;
                    id = D_802AD040;
                    hud_element_set_render_pos(id, l, t);
                    hud_element_set_alpha(id, 180);
                    hud_element_set_scale(id, 0.85f);
                    hud_element_clear_flags(id, HUD_ELEMENT_FLAG_DISABLED);
                    BattleMenuState = BTL_MENU_STATE_ACCEPT_INPUT;
                    break;
            }
            break;
        case BTL_MENU_STATE_ACCEPT_INPUT:
            if (battleStatus->currentButtonsPressed & BUTTON_A) {
                if (BattleMenu_OptionEnabled[BattleMenu_CurPos + BattleMenu_HomePos] == TRUE) {
                    sfx_play_sound(SOUND_MENU_NEXT);
                    BattleMenuState = BTL_MENU_STATE_OPENED_SUBMENU;
                } else {
                    sfx_play_sound(SOUND_MENU_ERROR);
                    BattleMenuDisableMsg = battle_menu_isMessageDisabled[BattleMenu_CurPos + BattleMenu_HomePos];
                    BattleMenuState = BTL_MENU_STATE_SHOW_DISABLED_POPUP;
                }
            } else {
                BattleMenu_PrevPos = BattleMenu_CurPos;
                if (D_802AD004 == 0) {
                    if ((battleStatus->currentButtonsHeld & (BUTTON_STICK_LEFT | BUTTON_STICK_UP)) &&
                        BattleMenu_MinIdx < BattleMenu_CurPos)
                    {
                        BattleMenu_CurPos--;
                    }
                    if ((battleStatus->currentButtonsHeld & (BUTTON_STICK_RIGHT | BUTTON_STICK_DOWN)) &&
                        BattleMenu_CurPos < BattleMenu_MaxIdx)
                    {
                        BattleMenu_CurPos++;
                    }
                }

                if (BattleMenu_PrevPos != BattleMenu_CurPos) {
                    D_802AD004 = 1;
                    sfx_play_sound(SOUND_MENU_CHANGE_TAB);
                }
            }
            break;
        case BTL_MENU_STATE_OPENED_SUBMENU:
            BattleMenuAlpha = 100;
            return BattleMenu_CurPos + BattleMenu_HomePos + 1;
        case BTL_MENU_STATE_UNK_A:
            D_802AD001 = 0;
            D_802AD006 = 0;
            BattleMenuState = BTL_MENU_STATE_UNK_B;
            return BattleMenu_CurPos + BattleMenu_HomePos + 1;
        case BTL_MENU_STATE_UNK_B:
            return BattleMenu_CurPos + BattleMenu_HomePos + 1;
        case BTL_MENU_STATE_UNK_14:
            D_802AD001 = 3;
            D_802AD006 = 255;
            BattleMenuState = BTL_MENU_STATE_ACCEPT_INPUT;
            return BattleMenu_CurPos + BattleMenu_HomePos + 1;
        case BTL_MENU_STATE_UNK_1E:
            D_802AD001 = 3;
            D_802AD006 = 255;
            BattleMenuState = BTL_MENU_STATE_OPENED_SUBMENU;
            break;
        case BTL_MENU_STATE_SHOW_DISABLED_POPUP:
            btl_show_battle_message(BattleMenuDisableMsg, 90);
            BattleMenuState = BTL_MENU_STATE_AWAIT_DISABLED_POPUP;
            break;
        case BTL_MENU_STATE_AWAIT_DISABLED_POPUP:
            if (btl_is_popup_displayed()) {
                break;
            }
            BattleMenuDisableMsg = -1;
            BattleMenuState = BTL_MENU_STATE_ACCEPT_INPUT;
            break;
    }
    return 0;
}