### RAW ASSEMBLY INSTRUCTIONS:

dlabel func_80242024
/* 170904 80242024 27BDFFB0 */  addiu     $sp, $sp, -0x50
glabel func_80242028
/* 170908 80242028 AFB30024 */  sw        $s3, 0x24($sp)
D_8024202C:
/* 17090C 8024202C 3C13800E */  lui       $s3, %hi(gBattleStatus)
D_80242030:
/* 170910 80242030 2673C070 */  addiu     $s3, $s3, %lo(gBattleStatus)
glabel dead_flo_14_GetNpcCollisionHeight
/* 170914 80242034 AFB60030 */  sw        $s6, 0x30($sp)
glabel dead_flo_16_FlyingAI_Init
/* 170918 80242038 3C168011 */  lui       $s6, %hi(gPlayerData)
glabel func_8024203C
/* 17091C 8024203C 26D6F290 */  addiu     $s6, $s6, %lo(gPlayerData)
D_80242040:
/* 170920 80242040 AFB20020 */  sw        $s2, 0x20($sp)
D_80242044:
/* 170924 80242044 3C12800E */  lui       $s2, %hi(gBattleSubState)
glabel func_80242048
/* 170928 80242048 2652C4DC */  addiu     $s2, $s2, %lo(gBattleSubState)
glabel func_8024204C
/* 17092C 8024204C AFBF0034 */  sw        $ra, 0x34($sp)
glabel func_80242050
/* 170930 80242050 AFB5002C */  sw        $s5, 0x2C($sp)
D_80242054:
/* 170934 80242054 AFB40028 */  sw        $s4, 0x28($sp)
D_80242058:
/* 170938 80242058 AFB1001C */  sw        $s1, 0x1C($sp)
D_8024205C:
/* 17093C 8024205C AFB00018 */  sw        $s0, 0x18($sp)
glabel func_80242060
/* 170940 80242060 F7B80048 */  sdc1      $f24, 0x48($sp)
glabel func_80242064
/* 170944 80242064 F7B60040 */  sdc1      $f22, 0x40($sp)
.L80242068:
/* 170948 80242068 F7B40038 */  sdc1      $f20, 0x38($sp)
D_8024206C:
/* 17094C 8024206C 8E7100D8 */  lw        $s1, 0xD8($s3)
glabel func_80242070
/* 170950 80242070 8E7000DC */  lw        $s0, 0xDC($s3)
glabel func_80242074
/* 170954 80242074 8E420000 */  lw        $v0, 0x0($s2)
glabel func_80242078
/* 170958 80242078 14400007 */  bnez      $v0, D_80242098
glabel dead_kzn_17_set_script_owner_npc_col_height
/* 17095C 8024207C 8E3401F4 */   lw       $s4, 0x1F4($s1)
glabel func_80242080
/* 170960 80242080 0C093903 */  jal       func_8024E40C
glabel func_80242084
/* 170964 80242084 24040002 */   addiu    $a0, $zero, 0x2
D_80242088:
/* 170968 80242088 0C093936 */  jal       D_8024E4D8_C0BD58
.L8024208C:
/* 17096C 8024208C 24040005 */   addiu    $a0, $zero, 0x5
glabel func_80242090
/* 170970 80242090 24020064 */  addiu     $v0, $zero, 0x64
glabel func_80242094
/* 170974 80242094 AE420000 */  sw        $v0, 0x0($s2)
D_80242098:
/* 170978 80242098 8E430000 */  lw        $v1, 0x0($s2)
glabel func_8024209C
/* 17097C 8024209C 24150014 */  addiu     $s5, $zero, 0x14
D_802420A0:
/* 170980 802420A0 10750039 */  beq       $v1, $s5, D_80242188
glabel .L802420A4
/* 170984 802420A4 24020064 */   addiu    $v0, $zero, 0x64
.L802420A8:
/* 170988 802420A8 14620041 */  bne       $v1, $v0, D_802421B0
glabel .L802420AC
/* 17098C 802420AC 00000000 */   nop
D_802420B0:
/* 170990 802420B0 0C093961 */  jal       func_8024E584
glabel func_802420B4
/* 170994 802420B4 00000000 */   nop
.L802420B8:
/* 170998 802420B8 1040003D */  beqz      $v0, D_802421B0
D_802420BC:
/* 17099C 802420BC 3C03FFF7 */   lui      $v1, (0xFFF7FFFF >> 16)
.L802420C0:
/* 1709A0 802420C0 8E620000 */  lw        $v0, 0x0($s3)
glabel func_802420C4
/* 1709A4 802420C4 3463FFFF */  ori       $v1, $v1, (0xFFF7FFFF & 0xFFFF)
D_802420C8:
/* 1709A8 802420C8 00431024 */  and       $v0, $v0, $v1
glabel .L802420CC
/* 1709AC 802420CC 0C098F18 */  jal       reset_actor_turn_info
jtbl_802420D0:
/* 1709B0 802420D0 AE620000 */   sw       $v0, 0x0($s3)
glabel func_802420D4
/* 1709B4 802420D4 3C04FEFF */  lui       $a0, (0xFEFFFFFF >> 16)
glabel .L802420D8
/* 1709B8 802420D8 2402007F */  addiu     $v0, $zero, 0x7F
.L802420DC:
/* 1709BC 802420DC A2620086 */  sb        $v0, 0x86($s3)
.L802420E0:
/* 1709C0 802420E0 A2620087 */  sb        $v0, 0x87($s3)
glabel func_802420E4
/* 1709C4 802420E4 8E620000 */  lw        $v0, 0x0($s3)
glabel func_802420E8
/* 1709C8 802420E8 8E630004 */  lw        $v1, 0x4($s3)
glabel func_802420EC
/* 1709CC 802420EC 3484FFFF */  ori       $a0, $a0, (0xFEFFFFFF & 0xFFFF)
glabel func_802420F0
/* 1709D0 802420F0 A660017C */  sh        $zero, 0x17C($s3)
glabel .L802420F4
/* 1709D4 802420F4 34420008 */  ori       $v0, $v0, 0x8
/* 1709D8 802420F8 00641824 */  and       $v1, $v1, $a0
glabel dead_kzn_17_TackleAI_Main
/* 1709DC 802420FC AE620000 */  sw        $v0, 0x0($s3)
glabel func_80242100
/* 1709E0 80242100 AE630004 */  sw        $v1, 0x4($s3)
glabel func_80242104
/* 1709E4 80242104 8E220000 */  lw        $v0, 0x0($s1)
.L80242108:
/* 1709E8 80242108 3C030C00 */  lui       $v1, (0xC000000 >> 16)
glabel .L8024210C
/* 1709EC 8024210C A220021D */  sb        $zero, 0x21D($s1)
D_80242110:
/* 1709F0 80242110 00431025 */  or        $v0, $v0, $v1
glabel func_80242114
/* 1709F4 80242114 12000004 */  beqz      $s0, .L80242128
D_80242118:
/* 1709F8 80242118 AE220000 */   sw       $v0, 0x0($s1)
glabel func_8024211C
/* 1709FC 8024211C 00431025 */  or        $v0, $v0, $v1
.L80242120:
/* 170A00 80242120 AE220000 */  sw        $v0, 0x0($s1)
glabel func_80242124
/* 170A04 80242124 A200021D */  sb        $zero, 0x21D($s0)
glabel .L80242128
/* 170A08 80242128 8262009A */  lb        $v0, 0x9A($s3)
D_8024212C:
/* 170A0C 8024212C A260008C */  sb        $zero, 0x8C($s3)
.L80242130:
/* 170A10 80242130 3C01802A */  lui       $at, %hi(D_8029F254)
D_80242134:
/* 170A14 80242134 AC20F254 */  sw        $zero, %lo(D_8029F254)($at)
D_80242138:
/* 170A18 80242138 3C01802A */  lui       $at, %hi(D_8029F258)
glabel func_8024213C
/* 170A1C 8024213C AC20F258 */  sw        $zero, %lo(D_8029F258)($at)
glabel func_80242140
/* 170A20 80242140 14400004 */  bnez      $v0, func_80242154
glabel func_80242144
/* 170A24 80242144 2405000A */   addiu    $a1, $zero, 0xA
D_80242148:
/* 170A28 80242148 2402000A */  addiu     $v0, $zero, 0xA
.L8024214C:
/* 170A2C 8024214C 0809086C */  j         D_802421B0
glabel func_80242150
/* 170A30 80242150 AE420000 */   sw       $v0, 0x0($s2)
glabel func_80242154
/* 170A34 80242154 2402000C */  addiu     $v0, $zero, 0xC
D_80242158:
/* 170A38 80242158 A26201A7 */  sb        $v0, 0x1A7($s3)
glabel dead_flo_16_FlyingAI_Main
/* 170A3C 8024215C 8E0401CC */  lw        $a0, 0x1CC($s0)
D_80242160:
/* 170A40 80242160 0C0B0CF8 */  jal       start_script
glabel func_80242164
/* 170A44 80242164 0000302D */   daddu    $a2, $zero, $zero
.L80242168:
/* 170A48 80242168 0040182D */  daddu     $v1, $v0, $zero
glabel func_8024216C
/* 170A4C 8024216C AE0301DC */  sw        $v1, 0x1DC($s0)
glabel .L80242170
/* 170A50 80242170 8C620144 */  lw        $v0, 0x144($v1)
D_80242174:
/* 170A54 80242174 AE550000 */  sw        $s5, 0x0($s2)
glabel func_80242178
/* 170A58 80242178 AE0201EC */  sw        $v0, 0x1EC($s0)
D_8024217C:
/* 170A5C 8024217C 24020100 */  addiu     $v0, $zero, 0x100
glabel D_80242180
/* 170A60 80242180 0809086C */  j         D_802421B0
D_80242184:
/* 170A64 80242184 AC620148 */   sw       $v0, 0x148($v1)
D_80242188:
/* 170A68 80242188 8E0401EC */  lw        $a0, 0x1EC($s0)
D_8024218C:
/* 170A6C 8024218C 0C0B1059 */  jal       does_script_exist
glabel func_80242190
/* 170A70 80242190 00000000 */   nop
glabel .L80242194
/* 170A74 80242194 14400006 */  bnez      $v0, D_802421B0
glabel func_80242198
/* 170A78 80242198 2403000A */   addiu    $v1, $zero, 0xA
glabel dead_11_set_script_owner_npc_anim
/* 170A7C 8024219C 8E620004 */  lw        $v0, 0x4($s3)
D_802421A0:
/* 170A80 802421A0 A260009A */  sb        $zero, 0x9A($s3)
flo_24_pad_21A4:
/* 170A84 802421A4 AE430000 */  sw        $v1, 0x0($s2)
glabel func_802421A8
/* 170A88 802421A8 34420004 */  ori       $v0, $v0, 0x4
glabel .L802421AC
/* 170A8C 802421AC AE620004 */  sw        $v0, 0x4($s3)
D_802421B0:
/* 170A90 802421B0 3C12800E */  lui       $s2, %hi(gBattleSubState)
.L802421B4:
/* 170A94 802421B4 2652C4DC */  addiu     $s2, $s2, %lo(gBattleSubState)
.L802421B8:
/* 170A98 802421B8 8E440000 */  lw        $a0, 0x0($s2)
glabel .L802421BC
/* 170A9C 802421BC 24150002 */  addiu     $s5, $zero, 0x2
glabel func_802421C0
/* 170AA0 802421C0 10950066 */  beq       $a0, $s5, func_8024235C
glabel .L802421C4
/* 170AA4 802421C4 2402000A */   addiu    $v0, $zero, 0xA
glabel func_802421C8
/* 170AA8 802421C8 1482006A */  bne       $a0, $v0, dead_flo_16_FlyingNoAttackAI_12
glabel func_802421CC
/* 170AAC 802421CC 00000000 */   nop
D_802421D0:
/* 170AB0 802421D0 8262008C */  lb        $v0, 0x8C($s3)
D_802421D4:
/* 170AB4 802421D4 14400067 */  bnez      $v0, dead_flo_16_FlyingNoAttackAI_12
glabel func_802421D8
/* 170AB8 802421D8 00000000 */   nop
.L802421DC:
/* 170ABC 802421DC 8262009D */  lb        $v0, 0x9D($s3)
glabel func_802421E0
/* 170AC0 802421E0 9263009D */  lbu       $v1, 0x9D($s3)
glabel func_802421E4
/* 170AC4 802421E4 10400061 */  beqz      $v0, dead_flo_13_UnkDistFunc
glabel func_802421E8
/* 170AC8 802421E8 2462FFFF */   addiu    $v0, $v1, -0x1
D_802421EC:
/* 170ACC 802421EC 8E63043C */  lw        $v1, 0x43C($s3)
glabel func_802421F0
/* 170AD0 802421F0 A262009D */  sb        $v0, 0x9D($s3)
glabel func_802421F4
/* 170AD4 802421F4 00021600 */  sll       $v0, $v0, 24
D_802421F8:
/* 170AD8 802421F8 8C63000C */  lw        $v1, 0xC($v1)
glabel func_802421FC
/* 170ADC 802421FC 00021603 */  sra       $v0, $v0, 24
glabel func_80242200
/* 170AE0 80242200 A4620010 */  sh        $v0, 0x10($v1)
glabel func_80242204
/* 170AE4 80242204 8262009D */  lb        $v0, 0x9D($s3)
glabel D_80242208
/* 170AE8 80242208 1C400059 */  bgtz      $v0, D_80242370
D_8024220C:
/* 170AEC 8024220C 2402000B */   addiu    $v0, $zero, 0xB
glabel func_80242210
/* 170AF0 80242210 8E6300A0 */  lw        $v1, 0xA0($s3)
glabel func_80242214
/* 170AF4 80242214 3C014190 */  lui       $at, (0x41900000 >> 16)
glabel dead_11_UnkDistFunc
/* 170AF8 80242218 44811000 */  mtc1      $at, $f2
.L8024221C:
/* 170AFC 8024221C 3C0140A0 */  lui       $at, (0x40A00000 >> 16)
D_80242220:
/* 170B00 80242220 4481B000 */  mtc1      $at, $f22
glabel func_80242224
/* 170B04 80242224 8C620000 */  lw        $v0, 0x0($v1)
.L80242228:
/* 170B08 80242228 3C013FC0 */  lui       $at, (0x3FC00000 >> 16)
glabel func_8024222C
/* 170B0C 8024222C 44810000 */  mtc1      $at, $f0
D_80242230:
/* 170B10 80242230 34420010 */  ori       $v0, $v0, 0x10
glabel func_80242234
/* 170B14 80242234 AC620000 */  sw        $v0, 0x0($v1)
D_80242238:
/* 170B18 80242238 C6240148 */  lwc1      $f4, 0x148($s1)
D_8024223C:
/* 170B1C 8024223C C626014C */  lwc1      $f6, 0x14C($s1)
D_80242240:
/* 170B20 80242240 46022100 */  add.s     $f4, $f4, $f2
glabel func_80242244
/* 170B24 80242244 E7A00010 */  swc1      $f0, 0x10($sp)
D_80242248:
/* 170B28 80242248 AFA40014 */  sw        $a0, 0x14($sp)
glabel func_8024224C
/* 170B2C 8024224C 46163180 */  add.s     $f6, $f6, $f22
glabel func_80242250
/* 170B30 80242250 8E250144 */  lw        $a1, 0x144($s1)
.L80242254:
/* 170B34 80242254 44062000 */  mfc1      $a2, $f4
.L80242258:
/* 170B38 80242258 44073000 */  mfc1      $a3, $f6
/* 170B3C 8024225C 0C01C694 */  jal       fx_water_block
glabel func_80242260_EE8810
/* 170B40 80242260 24040001 */   addiu    $a0, $zero, 0x1
glabel .L80242264
/* 170B44 80242264 C6220144 */  lwc1      $f2, 0x144($s1)
glabel .L80242268
/* 170B48 80242268 3C014120 */  lui       $at, (0x41200000 >> 16)
glabel func_8024226C
/* 170B4C 8024226C 44810000 */  mtc1      $at, $f0
glabel func_80242270
/* 170B50 80242270 00000000 */  nop
glabel mgm_02_CreateMinigame
/* 170B54 80242274 46001081 */  sub.s     $f2, $f2, $f0
.L80242278:
/* 170B58 80242278 C6200148 */  lwc1      $f0, 0x148($s1)
glabel func_8024227C
/* 170B5C 8024227C 46160000 */  add.s     $f0, $f0, $f22
D_80242280:
/* 170B60 80242280 44060000 */  mfc1      $a2, $f0
.L80242284:
/* 170B64 80242284 C620014C */  lwc1      $f0, 0x14C($s1)
glabel func_80242288
/* 170B68 80242288 0000202D */  daddu     $a0, $zero, $zero
glabel func_8024228C
/* 170B6C 8024228C 46160000 */  add.s     $f0, $f0, $f22
D_80242290:
/* 170B70 80242290 3C013F80 */  lui       $at, (0x3F800000 >> 16)
glabel func_80242294
/* 170B74 80242294 4481A000 */  mtc1      $at, $f20
D_80242298:
/* 170B78 80242298 44051000 */  mfc1      $a1, $f2
.L8024229C:
/* 170B7C 8024229C 44070000 */  mfc1      $a3, $f0
glabel func_802422A0
/* 170B80 802422A0 24100018 */  addiu     $s0, $zero, 0x18
.L802422A4:
/* 170B84 802422A4 E7B40010 */  swc1      $f20, 0x10($sp)
glabel func_802422A8
/* 170B88 802422A8 0C01C70C */  jal       fx_water_splash
glabel func_802422AC
/* 170B8C 802422AC AFB00014 */   sw       $s0, 0x14($sp)
glabel func_802422B0
/* 170B90 802422B0 C6200144 */  lwc1      $f0, 0x144($s1)
glabel dead_flo_14_ItemChoice_SaveSelected
/* 170B94 802422B4 3C014170 */  lui       $at, (0x41700000 >> 16)
glabel func_802422B8
/* 170B98 802422B8 4481C000 */  mtc1      $at, $f24
D_802422BC:
/* 170B9C 802422BC 00000000 */  nop
glabel func_802422C0
/* 170BA0 802422C0 46180001 */  sub.s     $f0, $f0, $f24
glabel func_802422C4
/* 170BA4 802422C4 C6220148 */  lwc1      $f2, 0x148($s1)
glabel func_802422C8
/* 170BA8 802422C8 44050000 */  mfc1      $a1, $f0
D_802422CC:
/* 170BAC 802422CC 3C014200 */  lui       $at, (0x42000000 >> 16)
glabel mgm_02_DestroyMinigame
/* 170BB0 802422D0 44810000 */  mtc1      $at, $f0
D_802422D4:
/* 170BB4 802422D4 00000000 */  nop
glabel func_802422D8
/* 170BB8 802422D8 46001080 */  add.s     $f2, $f2, $f0
glabel func_802422DC
/* 170BBC 802422DC C620014C */  lwc1      $f0, 0x14C($s1)
glabel .L802422E0
/* 170BC0 802422E0 46160000 */  add.s     $f0, $f0, $f22
glabel func_802422E4
/* 170BC4 802422E4 44061000 */  mfc1      $a2, $f2
glabel .L802422E8
/* 170BC8 802422E8 44070000 */  mfc1      $a3, $f0
glabel func_802422EC_EE889C
/* 170BCC 802422EC 0000202D */  daddu     $a0, $zero, $zero
glabel dead_flo_13_set_script_owner_npc_anim
/* 170BD0 802422F0 E7B40010 */  swc1      $f20, 0x10($sp)
glabel func_802422F4
/* 170BD4 802422F4 0C01C70C */  jal       fx_water_splash
glabel func_802422F8
/* 170BD8 802422F8 AFB00014 */   sw       $s0, 0x14($sp)
glabel func_802422FC
/* 170BDC 802422FC C6200144 */  lwc1      $f0, 0x144($s1)
D_80242300:
/* 170BE0 80242300 46180000 */  add.s     $f0, $f0, $f24
.L80242304:
/* 170BE4 80242304 C6220148 */  lwc1      $f2, 0x148($s1)
glabel .L80242308
/* 170BE8 80242308 44050000 */  mfc1      $a1, $f0
D_8024230C:
/* 170BEC 8024230C 3C0141B0 */  lui       $at, (0x41B00000 >> 16)
glabel func_80242310
/* 170BF0 80242310 44810000 */  mtc1      $at, $f0
glabel func_80242314
/* 170BF4 80242314 00000000 */  nop
glabel func_80242318
/* 170BF8 80242318 46001080 */  add.s     $f2, $f2, $f0
D_8024231C:
/* 170BFC 8024231C C620014C */  lwc1      $f0, 0x14C($s1)
glabel .L80242320
/* 170C00 80242320 46160000 */  add.s     $f0, $f0, $f22
glabel .L80242324
/* 170C04 80242324 44061000 */  mfc1      $a2, $f2
glabel func_80242328
/* 170C08 80242328 44070000 */  mfc1      $a3, $f0
glabel func_8024232C
/* 170C0C 8024232C 24040001 */  addiu     $a0, $zero, 0x1
glabel D_80242330
/* 170C10 80242330 E7B40010 */  swc1      $f20, 0x10($sp)
glabel .L80242334
/* 170C14 80242334 0C01C70C */  jal       fx_water_splash
glabel .L80242338
/* 170C18 80242338 AFB00014 */   sw       $s0, 0x14($sp)
glabel func_8024233C
/* 170C1C 8024233C 24040299 */  addiu     $a0, $zero, 0x299
glabel mgm_02_TakeCoinCost
/* 170C20 80242340 0C05272D */  jal       sfx_play_sound
glabel D_80242344
/* 170C24 80242344 AE6000A0 */   sw       $zero, 0xA0($s3)
glabel func_80242348
/* 170C28 80242348 24040027 */  addiu     $a0, $zero, 0x27
glabel dead_11_UnkNpcAIFunc12
/* 170C2C 8024234C 0C093E58 */  jal       func_8024F960
glabel D_80242350
/* 170C30 80242350 2405003C */   addiu    $a1, $zero, 0x3C
glabel func_80242354
/* 170C34 80242354 080908DD */  j         dead_flo_16_FlyingNoAttackAI_12
glabel func_80242358
/* 170C38 80242358 AE550000 */   sw       $s5, 0x0($s2)
glabel func_8024235C
/* 170C3C 8024235C 0C093EAD */  jal       func_8024FAB4
glabel func_80242360
/* 170C40 80242360 00000000 */   nop
glabel func_80242364
/* 170C44 80242364 14400003 */  bnez      $v0, dead_flo_16_FlyingNoAttackAI_12
glabel func_80242368
/* 170C48 80242368 00000000 */   nop
glabel dead_flo_13_UnkDistFunc
/* 170C4C 8024236C 2402000B */  addiu     $v0, $zero, 0xB
glabel D_80242370
/* 170C50 80242370 AE420000 */  sw        $v0, 0x0($s2)
glabel dead_flo_16_FlyingNoAttackAI_12
/* 170C54 80242374 3C10800E */  lui       $s0, %hi(gBattleSubState)
D_80242378:
/* 170C58 80242378 2610C4DC */  addiu     $s0, $s0, %lo(gBattleSubState)
glabel .L8024237C
/* 170C5C 8024237C 8E030000 */  lw        $v1, 0x0($s0)
glabel func_80242380
/* 170C60 80242380 2402000B */  addiu     $v0, $zero, 0xB
glabel func_80242384
/* 170C64 80242384 10620005 */  beq       $v1, $v0, func_8024239C
glabel func_80242388
/* 170C68 80242388 2402000C */   addiu    $v0, $zero, 0xC
glabel .L8024238C
/* 170C6C 8024238C 10620019 */  beq       $v1, $v0, .L802423F4
glabel dead_flo_14_func_80242390_EE8940
/* 170C70 80242390 2402000F */   addiu    $v0, $zero, 0xF
glabel func_80242394
/* 170C74 80242394 08090907 */  j         .L8024241C
glabel .L80242398
/* 170C78 80242398 00000000 */   nop
glabel func_8024239C
/* 170C7C 8024239C 826200A4 */  lb        $v0, 0xA4($s3)
D_802423A0:
/* 170C80 802423A0 926300A4 */  lbu       $v1, 0xA4($s3)
glabel mgm_02_HideCoinCounter
/* 170C84 802423A4 10400017 */  beqz      $v0, .L80242404
glabel .L802423A8
/* 170C88 802423A8 2462FFFF */   addiu    $v0, $v1, -0x1
.L802423AC:
/* 170C8C 802423AC 8E63043C */  lw        $v1, 0x43C($s3)
D_802423B0:
/* 170C90 802423B0 A26200A4 */  sb        $v0, 0xA4($s3)
glabel func_802423B4
/* 170C94 802423B4 00021600 */  sll       $v0, $v0, 24
.L802423B8:
/* 170C98 802423B8 8C63000C */  lw        $v1, 0xC($v1)
glabel func_802423BC
/* 170C9C 802423BC 00021603 */  sra       $v0, $v0, 24
glabel .L802423C0
/* 170CA0 802423C0 A462001A */  sh        $v0, 0x1A($v1)
D_802423C4:
/* 170CA4 802423C4 826200A4 */  lb        $v0, 0xA4($s3)
glabel func_802423C8
/* 170CA8 802423C8 1C40000F */  bgtz      $v0, D_80242408
glabel func_802423CC
/* 170CAC 802423CC 2402000F */   addiu    $v0, $zero, 0xF
glabel func_802423D0
/* 170CB0 802423D0 8E6400A8 */  lw        $a0, 0xA8($s3)
glabel func_802423D4
/* 170CB4 802423D4 0C016914 */  jal       remove_effect
glabel .L802423D8
/* 170CB8 802423D8 00000000 */   nop
D_802423DC:
/* 170CBC 802423DC 24040029 */  addiu     $a0, $zero, 0x29
glabel func_802423E0
/* 170CC0 802423E0 2405003C */  addiu     $a1, $zero, 0x3C
D_802423E4:
/* 170CC4 802423E4 0C093E58 */  jal       func_8024F960
glabel .L802423E8
/* 170CC8 802423E8 AE6000A8 */   sw       $zero, 0xA8($s3)
glabel func_802423EC
/* 170CCC 802423EC 08090902 */  j         D_80242408
D_802423F0:
/* 170CD0 802423F0 2402000C */   addiu    $v0, $zero, 0xC
glabel .L802423F4
/* 170CD4 802423F4 0C093EAD */  jal       func_8024FAB4
D_802423F8:
/* 170CD8 802423F8 00000000 */   nop
glabel func_802423FC
/* 170CDC 802423FC 14400003 */  bnez      $v0, func_8024240C
glabel func_80242400
/* 170CE0 80242400 00000000 */   nop
glabel .L80242404
/* 170CE4 80242404 2402000F */  addiu     $v0, $zero, 0xF
D_80242408:
/* 170CE8 80242408 AE020000 */  sw        $v0, 0x0($s0)
glabel func_8024240C
/* 170CEC 8024240C 3C10800E */  lui       $s0, %hi(gBattleSubState)
glabel D_80242410
/* 170CF0 80242410 2610C4DC */  addiu     $s0, $s0, %lo(gBattleSubState)
glabel .L80242414
/* 170CF4 80242414 8E030000 */  lw        $v1, 0x0($s0)
glabel func_80242418
/* 170CF8 80242418 2402000F */  addiu     $v0, $zero, 0xF
glabel .L8024241C
/* 170CFC 8024241C 10620005 */  beq       $v1, $v0, func_80242434
glabel func_80242420
/* 170D00 80242420 24020010 */   addiu    $v0, $zero, 0x10
glabel func_80242424
/* 170D04 80242424 10620025 */  beq       $v1, $v0, .L802424BC
D_80242428:
/* 170D08 80242428 00000000 */   nop
D_8024242C:
/* 170D0C 8024242C 08090935 */  j         func_802424D4
glabel D_80242430
/* 170D10 80242430 00000000 */   nop
glabel func_80242434
/* 170D14 80242434 8262009B */  lb        $v0, 0x9B($s3)
glabel func_80242438
/* 170D18 80242438 9264009B */  lbu       $a0, 0x9B($s3)
glabel func_8024243C
/* 170D1C 8024243C 10400024 */  beqz      $v0, func_802424D0
glabel func_80242440
/* 170D20 80242440 24020015 */   addiu    $v0, $zero, 0x15
glabel .L80242444
/* 170D24 80242444 3C05800E */  lui       $a1, %hi(gBattleStatus)
glabel func_80242448
/* 170D28 80242448 24A5C070 */  addiu     $a1, $a1, %lo(gBattleStatus)
D_8024244C:
/* 170D2C 8024244C 8CA30004 */  lw        $v1, 0x4($a1)
D_80242450:
/* 170D30 80242450 30620100 */  andi      $v0, $v1, 0x100
glabel .L80242454
/* 170D34 80242454 10400004 */  beqz      $v0, func_80242468
glabel func_80242458
/* 170D38 80242458 2402FEFF */   addiu    $v0, $zero, -0x101
glabel .L8024245C
/* 170D3C 8024245C 00621024 */  and       $v0, $v1, $v0
D_80242460:
/* 170D40 80242460 08090933 */  j         func_802424CC
glabel .L80242464
/* 170D44 80242464 ACA20004 */   sw       $v0, 0x4($a1)
glabel func_80242468
/* 170D48 80242468 8E63043C */  lw        $v1, 0x43C($s3)
glabel func_8024246C
/* 170D4C 8024246C 2482FFFF */  addiu     $v0, $a0, -0x1
D_80242470:
/* 170D50 80242470 A262009B */  sb        $v0, 0x9B($s3)
D_80242474:
/* 170D54 80242474 00021600 */  sll       $v0, $v0, 24
glabel func_80242478
/* 170D58 80242478 8C63000C */  lw        $v1, 0xC($v1)
glabel func_8024247C
/* 170D5C 8024247C 00021603 */  sra       $v0, $v0, 24
glabel func_80242480
/* 170D60 80242480 A4620024 */  sh        $v0, 0x24($v1)
glabel .L80242484
/* 170D64 80242484 8262009B */  lb        $v0, 0x9B($s3)
glabel func_80242488
/* 170D68 80242488 1C400011 */  bgtz      $v0, func_802424D0
D_8024248C:
/* 170D6C 8024248C 24020015 */   addiu    $v0, $zero, 0x15
glabel .L80242490
/* 170D70 80242490 2404002B */  addiu     $a0, $zero, 0x2B
D_80242494:
/* 170D74 80242494 0C093E58 */  jal       func_8024F960
glabel func_80242498
/* 170D78 80242498 2405003C */   addiu    $a1, $zero, 0x3C
D_8024249C:
/* 170D7C 8024249C 08090934 */  j         func_802424D0
glabel dead_flo_13_UnkNpcAIFunc12
/* 170D80 802424A0 24020010 */   addiu    $v0, $zero, 0x10
glabel dead_flo_16_FlyingNoAttackAI_13
/* 170D84 802424A4 8E230440 */  lw        $v1, 0x440($s1)
glabel .L802424A8
/* 170D88 802424A8 A2220216 */  sb        $v0, 0x216($s1)
glabel func_802424AC
/* 170D8C 802424AC 82220217 */  lb        $v0, 0x217($s1)
glabel dead_11_set_script_owner_npc_col_height
/* 170D90 802424B0 8C63000C */  lw        $v1, 0xC($v1)
glabel .L802424B4
/* 170D94 802424B4 08090A05 */  j         .L80242814
D_802424B8:
/* 170D98 802424B8 AC62003C */   sw       $v0, 0x3C($v1)
.L802424BC:
/* 170D9C 802424BC 0C093EAD */  jal       func_8024FAB4
D_802424C0:
/* 170DA0 802424C0 00000000 */   nop
glabel .L802424C4
/* 170DA4 802424C4 14400003 */  bnez      $v0, func_802424D4
glabel func_802424C8
/* 170DA8 802424C8 00000000 */   nop
glabel func_802424CC
/* 170DAC 802424CC 24020015 */  addiu     $v0, $zero, 0x15
glabel func_802424D0
/* 170DB0 802424D0 AE020000 */  sw        $v0, 0x0($s0)
glabel func_802424D4
/* 170DB4 802424D4 3C03800E */  lui       $v1, %hi(gBattleSubState)
glabel func_802424D8
/* 170DB8 802424D8 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
D_802424DC:
/* 170DBC 802424DC 24020015 */  addiu     $v0, $zero, 0x15
D_802424E0:
/* 170DC0 802424E0 14620042 */  bne       $v1, $v0, D_802425EC
D_802424E4:
/* 170DC4 802424E4 24020016 */   addiu    $v0, $zero, 0x16
D_802424E8:
/* 170DC8 802424E8 82230210 */  lb        $v1, 0x210($s1)
glabel .L802424EC
/* 170DCC 802424EC 24020009 */  addiu     $v0, $zero, 0x9
D_802424F0:
/* 170DD0 802424F0 1462000C */  bne       $v1, $v0, func_80242524
D_802424F4:
/* 170DD4 802424F4 3C03F7FF */   lui      $v1, (0xF7FFFFFF >> 16)
glabel .L802424F8
/* 170DD8 802424F8 82220214 */  lb        $v0, 0x214($s1)
D_802424FC:
/* 170DDC 802424FC 14400009 */  bnez      $v0, func_80242524
glabel func_80242500
/* 170DE0 80242500 24040001 */   addiu    $a0, $zero, 0x1
glabel func_80242504
/* 170DE4 80242504 3C03800E */  lui       $v1, %hi(gBattleStatus)
.L80242508:
/* 170DE8 80242508 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
glabel func_8024250C
/* 170DEC 8024250C 8C620000 */  lw        $v0, 0x0($v1)
glabel func_80242510
/* 170DF0 80242510 2405000A */  addiu     $a1, $zero, 0xA
D_80242514:
/* 170DF4 80242514 34420020 */  ori       $v0, $v0, 0x20
jtbl_80242518:
/* 170DF8 80242518 0C09CCDF */  jal       dispatch_damage_event_player_0
.L8024251C:
/* 170DFC 8024251C AC620000 */   sw       $v0, 0x0($v1)
D_80242520:
/* 170E00 80242520 3C03F7FF */  lui       $v1, (0xF7FFFFFF >> 16)
glabel func_80242524
/* 170E04 80242524 3C10800E */  lui       $s0, %hi(gBattleStatus)
glabel func_80242528
/* 170E08 80242528 2610C070 */  addiu     $s0, $s0, %lo(gBattleStatus)
glabel func_8024252C
/* 170E0C 8024252C 8E020004 */  lw        $v0, 0x4($s0)
glabel dead_11_TackleAI_Main
/* 170E10 80242530 3463FFFF */  ori       $v1, $v1, (0xF7FFFFFF & 0xFFFF)
glabel func_80242534
/* 170E14 80242534 A2600099 */  sb        $zero, 0x99($s3)
D_80242538:
/* 170E18 80242538 00431824 */  and       $v1, $v0, $v1
glabel func_8024253C
/* 170E1C 8024253C 30420040 */  andi      $v0, $v0, 0x40
glabel .L80242540
/* 170E20 80242540 14400024 */  bnez      $v0, D_802425D4
glabel .L80242544
/* 170E24 80242544 AE030004 */   sw       $v1, 0x4($s0)
glabel func_80242548
/* 170E28 80242548 82C20002 */  lb        $v0, 0x2($s6)
D_8024254C:
/* 170E2C 8024254C 28420002 */  slti      $v0, $v0, 0x2
/* 170E30 80242550 1040000B */  beqz      $v0, func_80242580
glabel func_80242554
/* 170E34 80242554 00000000 */   nop
glabel func_80242558
/* 170E38 80242558 0C03A752 */  jal       is_ability_active
glabel func_8024255C
/* 170E3C 8024255C 24040014 */   addiu    $a0, $zero, 0x14
D_80242560:
/* 170E40 80242560 10400007 */  beqz      $v0, func_80242580
.L80242564:
/* 170E44 80242564 3C020800 */   lui      $v0, (0x8000000 >> 16)
glabel dead_kzn_17_func_80240814_97BE44
/* 170E48 80242568 8E030004 */  lw        $v1, 0x4($s0)
glabel func_8024256C
/* 170E4C 8024256C 92640099 */  lbu       $a0, 0x99($s3)
glabel func_80242570
/* 170E50 80242570 00621825 */  or        $v1, $v1, $v0
.L80242574:
/* 170E54 80242574 34840001 */  ori       $a0, $a0, 0x1
.L80242578:
/* 170E58 80242578 AE030004 */  sw        $v1, 0x4($s0)
.L8024257C:
/* 170E5C 8024257C A2640099 */  sb        $a0, 0x99($s3)
glabel func_80242580
/* 170E60 80242580 82C20002 */  lb        $v0, 0x2($s6)
.L80242584:
/* 170E64 80242584 28420006 */  slti      $v0, $v0, 0x6
.L80242588:
/* 170E68 80242588 10400013 */  beqz      $v0, D_802425D8
D_8024258C:
/* 170E6C 8024258C 24020016 */   addiu    $v0, $zero, 0x16
glabel func_80242590
/* 170E70 80242590 0C03A752 */  jal       is_ability_active
D_80242594:
/* 170E74 80242594 2404001E */   addiu    $a0, $zero, 0x1E
flo_23_pad_2598:
/* 170E78 80242598 1040000F */  beqz      $v0, D_802425D8
glabel func_8024259C
/* 170E7C 8024259C 24020016 */   addiu    $v0, $zero, 0x16
D_802425A0:
/* 170E80 802425A0 92620099 */  lbu       $v0, 0x99($s3)
.L802425A4:
/* 170E84 802425A4 30420001 */  andi      $v0, $v0, 0x1
glabel func_802425A8
/* 170E88 802425A8 1440000B */  bnez      $v0, D_802425D8
glabel func_802425AC
/* 170E8C 802425AC 24020016 */   addiu    $v0, $zero, 0x16
glabel dead_kzn_17_AwaitPlayerNearNpc
/* 170E90 802425B0 3C05800E */  lui       $a1, %hi(gBattleStatus)
D_802425B4:
/* 170E94 802425B4 24A5C070 */  addiu     $a1, $a1, %lo(gBattleStatus)
glabel func_802425B8
/* 170E98 802425B8 3C040800 */  lui       $a0, (0x8000000 >> 16)
D_802425BC:
/* 170E9C 802425BC 8CA20004 */  lw        $v0, 0x4($a1)
D_802425C0:
/* 170EA0 802425C0 92630099 */  lbu       $v1, 0x99($s3)
.L802425C4:
/* 170EA4 802425C4 00441025 */  or        $v0, $v0, $a0
D_802425C8:
/* 170EA8 802425C8 34630002 */  ori       $v1, $v1, 0x2
glabel func_802425CC
/* 170EAC 802425CC ACA20004 */  sw        $v0, 0x4($a1)
glabel func_802425D0
/* 170EB0 802425D0 A2630099 */  sb        $v1, 0x99($s3)
D_802425D4:
/* 170EB4 802425D4 24020016 */  addiu     $v0, $zero, 0x16
D_802425D8:
/* 170EB8 802425D8 3C01800E */  lui       $at, %hi(gBattleSubState)
D_802425DC:
/* 170EBC 802425DC AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
D_802425E0:
/* 170EC0 802425E0 3C03800E */  lui       $v1, %hi(gBattleSubState)
D_802425E4:
/* 170EC4 802425E4 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
D_802425E8:
/* 170EC8 802425E8 24020016 */  addiu     $v0, $zero, 0x16
D_802425EC:
/* 170ECC 802425EC 146200A8 */  bne       $v1, $v0, .L80242890
glabel func_802425F0
/* 170ED0 802425F0 00000000 */   nop
glabel .L802425F4
/* 170ED4 802425F4 8E2201D8 */  lw        $v0, 0x1D8($s1)
D_802425F8:
/* 170ED8 802425F8 10400005 */  beqz      $v0, D_80242610
D_802425FC:
/* 170EDC 802425FC 00000000 */   nop
glabel func_80242600
/* 170EE0 80242600 0C0B1059 */  jal       does_script_exist
glabel dead_flo_13_set_script_owner_npc_col_height
/* 170EE4 80242604 8E2401E8 */   lw       $a0, 0x1E8($s1)
glabel dead_kzn_17_func_802408B4_97BEE4
/* 170EE8 80242608 144000A1 */  bnez      $v0, .L80242890
glabel func_8024260C
/* 170EEC 8024260C 00000000 */   nop
D_80242610:
/* 170EF0 80242610 0C098D19 */  jal       btl_check_player_defeated
D_80242614:
/* 170EF4 80242614 AE2001D8 */   sw       $zero, 0x1D8($s1)
D_80242618:
/* 170EF8 80242618 1440011C */  bnez      $v0, .L80242A8C
glabel func_8024261C
/* 170EFC 8024261C 3C030C00 */   lui      $v1, (0xC000000 >> 16)
D_80242620:
/* 170F00 80242620 2404000E */  addiu     $a0, $zero, 0xE
/* 170F04 80242624 8E220000 */  lw        $v0, 0x0($s1)
glabel func_80242628
/* 170F08 80242628 3C01802A */  lui       $at, %hi(D_8029F254)
D_8024262C:
/* 170F0C 8024262C AC20F254 */  sw        $zero, %lo(D_8029F254)($at)
D_80242630:
/* 170F10 80242630 A220021D */  sb        $zero, 0x21D($s1)
glabel func_80242634
/* 170F14 80242634 00431025 */  or        $v0, $v0, $v1
glabel func_80242638
/* 170F18 80242638 0C03A752 */  jal       is_ability_active
D_8024263C:
/* 170F1C 8024263C AE220000 */   sw       $v0, 0x0($s1)
glabel func_80242640
/* 170F20 80242640 10400015 */  beqz      $v0, func_80242698
D_80242644:
/* 170F24 80242644 00000000 */   nop
.L80242648:
/* 170F28 80242648 82220210 */  lb        $v0, 0x210($s1)
D_8024264C:
/* 170F2C 8024264C 10400002 */  beqz      $v0, .L80242658
glabel func_80242650
/* 170F30 80242650 24020001 */   addiu    $v0, $zero, 0x1
.L80242654:
/* 170F34 80242654 A2220211 */  sb        $v0, 0x211($s1)
.L80242658:
/* 170F38 80242658 82220212 */  lb        $v0, 0x212($s1)
glabel func_8024265C
/* 170F3C 8024265C 10400002 */  beqz      $v0, .L80242668
glabel .L80242660
/* 170F40 80242660 24020001 */   addiu    $v0, $zero, 0x1
glabel func_80242664
/* 170F44 80242664 A2220213 */  sb        $v0, 0x213($s1)
.L80242668:
/* 170F48 80242668 82220214 */  lb        $v0, 0x214($s1)
glabel func_8024266C
/* 170F4C 8024266C 10400002 */  beqz      $v0, func_80242678
D_80242670:
/* 170F50 80242670 24020001 */   addiu    $v0, $zero, 0x1
.L80242674:
/* 170F54 80242674 A2220215 */  sb        $v0, 0x215($s1)
glabel func_80242678
/* 170F58 80242678 82220216 */  lb        $v0, 0x216($s1)
glabel dead_kzn_17_StashVars
/* 170F5C 8024267C 10400002 */  beqz      $v0, func_80242688
glabel func_80242680
/* 170F60 80242680 24020001 */   addiu    $v0, $zero, 0x1
glabel dead_flo_13_TackleAI_Main
/* 170F64 80242684 A2220217 */  sb        $v0, 0x217($s1)
glabel func_80242688
/* 170F68 80242688 82220218 */  lb        $v0, 0x218($s1)
glabel func_8024268C
/* 170F6C 8024268C 10400002 */  beqz      $v0, func_80242698
glabel func_80242690
/* 170F70 80242690 24020001 */   addiu    $v0, $zero, 0x1
glabel func_80242694
/* 170F74 80242694 A2220219 */  sb        $v0, 0x219($s1)
glabel func_80242698
/* 170F78 80242698 82220214 */  lb        $v0, 0x214($s1)
glabel func_8024269C
/* 170F7C 8024269C 1040000C */  beqz      $v0, func_802426D0
glabel func_802426A0
/* 170F80 802426A0 00000000 */   nop
glabel func_802426A4
/* 170F84 802426A4 92220215 */  lbu       $v0, 0x215($s1)
D_802426A8:
/* 170F88 802426A8 2442FFFF */  addiu     $v0, $v0, -0x1
/* 170F8C 802426AC A2220215 */  sb        $v0, 0x215($s1)
D_802426B0:
/* 170F90 802426B0 00021600 */  sll       $v0, $v0, 24
glabel func_802426B4
/* 170F94 802426B4 1C400058 */  bgtz      $v0, func_80242818
D_802426B8:
/* 170F98 802426B8 0000902D */   daddu    $s2, $zero, $zero
D_802426BC:
/* 170F9C 802426BC A2200214 */  sb        $zero, 0x214($s1)
glabel func_802426C0
/* 170FA0 802426C0 0C09C596 */  jal       dispatch_event_player
.L802426C4:
/* 170FA4 802426C4 24040031 */   addiu    $a0, $zero, 0x31
D_802426C8:
/* 170FA8 802426C8 08090A06 */  j         func_80242818
D_802426CC:
/* 170FAC 802426CC 0000902D */   daddu    $s2, $zero, $zero
glabel func_802426D0
/* 170FB0 802426D0 0C03A752 */  jal       is_ability_active
glabel func_802426D4
/* 170FB4 802426D4 24040013 */   addiu    $a0, $zero, 0x13
glabel func_802426D8
/* 170FB8 802426D8 1440000D */  bnez      $v0, func_80242710
.L802426DC:
/* 170FBC 802426DC 00000000 */   nop
D_802426E0:
/* 170FC0 802426E0 82220212 */  lb        $v0, 0x212($s1)
glabel func_802426E4
/* 170FC4 802426E4 1040000A */  beqz      $v0, func_80242710
.L802426E8:
/* 170FC8 802426E8 00000000 */   nop
glabel func_802426EC
/* 170FCC 802426EC 92220213 */  lbu       $v0, 0x213($s1)
glabel func_802426F0
/* 170FD0 802426F0 2442FFFF */  addiu     $v0, $v0, -0x1
glabel .L802426F4
/* 170FD4 802426F4 A2220213 */  sb        $v0, 0x213($s1)
glabel func_802426F8
/* 170FD8 802426F8 00021600 */  sll       $v0, $v0, 24
glabel func_802426FC
/* 170FDC 802426FC 1C400004 */  bgtz      $v0, func_80242710
.L80242700:
/* 170FE0 80242700 00000000 */   nop
D_80242704:
/* 170FE4 80242704 86240436 */  lh        $a0, 0x436($s1)
glabel func_80242708
/* 170FE8 80242708 0C011E68 */  jal       remove_status_static
/* 170FEC 8024270C A2200212 */   sb       $zero, 0x212($s1)
glabel func_80242710
/* 170FF0 80242710 82220218 */  lb        $v0, 0x218($s1)
/* 170FF4 80242714 10400010 */  beqz      $v0, D_80242758
.L80242718:
/* 170FF8 80242718 00000000 */   nop
D_8024271C:
/* 170FFC 8024271C 92220219 */  lbu       $v0, 0x219($s1)
.L80242720:
/* 171000 80242720 2442FFFF */  addiu     $v0, $v0, -0x1
glabel dead_flo_16_FlyingNoAttackAI_20
/* 171004 80242724 A2220219 */  sb        $v0, 0x219($s1)
glabel func_80242728
/* 171008 80242728 8E820000 */  lw        $v0, 0x0($s4)
glabel func_8024272C
/* 17100C 8024272C 34420100 */  ori       $v0, $v0, 0x100
glabel dead_kzn_17_GetItemName
/* 171010 80242730 AE820000 */  sw        $v0, 0x0($s4)
glabel func_80242734
/* 171014 80242734 82220219 */  lb        $v0, 0x219($s1)
/* 171018 80242738 1C400007 */  bgtz      $v0, D_80242758
mgm_02_InitialConfigurations:
/* 17101C 8024273C 2403FEFF */   addiu    $v1, $zero, -0x101
.L80242740:
/* 171020 80242740 A2200218 */  sb        $zero, 0x218($s1)
glabel func_80242744
/* 171024 80242744 8E820000 */  lw        $v0, 0x0($s4)
.L80242748:
/* 171028 80242748 00431024 */  and       $v0, $v0, $v1
D_8024274C:
/* 17102C 8024274C AE820000 */  sw        $v0, 0x0($s4)
glabel func_80242750
/* 171030 80242750 0C011EAA */  jal       remove_status_transparent
glabel func_80242754
/* 171034 80242754 86240436 */   lh       $a0, 0x436($s1)
D_80242758:
/* 171038 80242758 82220210 */  lb        $v0, 0x210($s1)
/* 17103C 8024275C 1040001F */  beqz      $v0, .L802427DC
glabel func_80242760
/* 171040 80242760 28420009 */   slti     $v0, $v0, 0x9
.L80242764:
/* 171044 80242764 10400003 */  beqz      $v0, func_80242774
.L80242768:
/* 171048 80242768 24020001 */   addiu    $v0, $zero, 0x1
glabel func_8024276C
/* 17104C 8024276C 3C01802A */  lui       $at, %hi(D_8029F254)
glabel func_80242770
/* 171050 80242770 AC22F254 */  sw        $v0, %lo(D_8029F254)($at)
glabel func_80242774
/* 171054 80242774 24020014 */  addiu     $v0, $zero, 0x14
.L80242778:
/* 171058 80242778 3C01802A */  lui       $at, %hi(D_8029F258)
glabel func_8024277C
/* 17105C 8024277C AC22F258 */  sw        $v0, %lo(D_8029F258)($at)
glabel func_80242780
/* 171060 80242780 92220211 */  lbu       $v0, 0x211($s1)
glabel func_80242784
/* 171064 80242784 2442FFFF */  addiu     $v0, $v0, -0x1
glabel func_80242788
/* 171068 80242788 A2220211 */  sb        $v0, 0x211($s1)
glabel func_8024278C
/* 17106C 8024278C 00021600 */  sll       $v0, $v0, 24
glabel func_80242790
/* 171070 80242790 1C400012 */  bgtz      $v0, .L802427DC
glabel dead_kzn_17_GetNpcCollisionHeight
/* 171074 80242794 24020007 */   addiu    $v0, $zero, 0x7
.L80242798:
/* 171078 80242798 82230210 */  lb        $v1, 0x210($s1)
.L8024279C:
/* 17107C 8024279C 14620009 */  bne       $v1, $v0, .L802427C4
.L802427A0:
/* 171080 802427A0 24040031 */   addiu    $a0, $zero, 0x31
glabel func_802427A4
/* 171084 802427A4 0C05272D */  jal       sfx_play_sound
D_802427A8:
/* 171088 802427A8 240400E7 */   addiu    $a0, $zero, 0xE7
.L802427AC:
/* 17108C 802427AC 8E230228 */  lw        $v1, 0x228($s1)
D_802427B0:
/* 171090 802427B0 8C620000 */  lw        $v0, 0x0($v1)
glabel func_802427B4
/* 171094 802427B4 24040032 */  addiu     $a0, $zero, 0x32
glabel func_802427B8
/* 171098 802427B8 34420010 */  ori       $v0, $v0, 0x10
glabel func_802427BC
/* 17109C 802427BC AC620000 */  sw        $v0, 0x0($v1)
glabel func_802427C0
/* 1710A0 802427C0 AE200228 */  sw        $zero, 0x228($s1)
glabel .L802427C4
/* 1710A4 802427C4 0C09C596 */  jal       dispatch_event_player
D_802427C8:
/* 1710A8 802427C8 00000000 */   nop
glabel func_802427CC
/* 1710AC 802427CC 86240436 */  lh        $a0, 0x436($s1)
glabel func_802427D0
/* 1710B0 802427D0 A2200210 */  sb        $zero, 0x210($s1)
D_802427D4:
/* 1710B4 802427D4 0C011E26 */  jal       remove_status_debuff
glabel func_802427D8
/* 1710B8 802427D8 A2200211 */   sb       $zero, 0x211($s1)
.L802427DC:
/* 1710BC 802427DC 92220211 */  lbu       $v0, 0x211($s1)
glabel func_802427E0
/* 1710C0 802427E0 82300217 */  lb        $s0, 0x217($s1)
.L802427E4:
/* 1710C4 802427E4 A2220217 */  sb        $v0, 0x217($s1)
glabel func_802427E8
/* 1710C8 802427E8 00021600 */  sll       $v0, $v0, 24
D_802427EC:
/* 1710CC 802427EC 00021603 */  sra       $v0, $v0, 24
glabel dead_kzn_17_AddPlayerHandsOffset
/* 1710D0 802427F0 5C40FF2C */  bgtzl     $v0, dead_flo_16_FlyingNoAttackAI_13
.L802427F4:
/* 1710D4 802427F4 2402000D */   addiu    $v0, $zero, 0xD
.L802427F8:
/* 1710D8 802427F8 12020007 */  beq       $s0, $v0, func_80242818
glabel func_802427FC
/* 1710DC 802427FC 0000902D */   daddu    $s2, $zero, $zero
.L80242800:
/* 1710E0 80242800 8E220440 */  lw        $v0, 0x440($s1)
glabel func_80242804
/* 1710E4 80242804 A2200216 */  sb        $zero, 0x216($s1)
.L80242808:
/* 1710E8 80242808 A2200217 */  sb        $zero, 0x217($s1)
glabel func_8024280C
/* 1710EC 8024280C 8C42000C */  lw        $v0, 0xC($v0)
D_80242810:
/* 1710F0 80242810 AC40003C */  sw        $zero, 0x3C($v0)
.L80242814:
/* 1710F4 80242814 0000902D */  daddu     $s2, $zero, $zero
glabel func_80242818
/* 1710F8 80242818 3C150C00 */  lui       $s5, (0xC000000 >> 16)
glabel func_8024281C
/* 1710FC 8024281C 24140014 */  addiu     $s4, $zero, 0x14
glabel func_80242820
/* 171100 80242820 0260802D */  daddu     $s0, $s3, $zero
glabel func_80242824
/* 171104 80242824 8E0300E0 */  lw        $v1, 0xE0($s0)
.L80242828:
/* 171108 80242828 50600013 */  beql      $v1, $zero, .L80242878
glabel .L8024282C
/* 17110C 8024282C 26520001 */   addiu    $s2, $s2, 0x1
glabel func_80242830
/* 171110 80242830 8C620000 */  lw        $v0, 0x0($v1)
D_80242834:
/* 171114 80242834 00551025 */  or        $v0, $v0, $s5
.L80242838:
/* 171118 80242838 AC620000 */  sw        $v0, 0x0($v1)
glabel func_8024283C
/* 17111C 8024283C 80620224 */  lb        $v0, 0x224($v1)
glabel func_80242840
/* 171120 80242840 90640224 */  lbu       $a0, 0x224($v1)
glabel .L80242844
/* 171124 80242844 5040000C */  beql      $v0, $zero, .L80242878
.L80242848:
/* 171128 80242848 26520001 */   addiu    $s2, $s2, 0x1
flo_23_D_8024284C_pad:
/* 17112C 8024284C 2482FFFF */  addiu     $v0, $a0, -0x1
flo_23_FlowerGuard_ItemChoiceList:
/* 171130 80242850 A0620224 */  sb        $v0, 0x224($v1)
glabel func_80242854
/* 171134 80242854 00021600 */  sll       $v0, $v0, 24
glabel func_80242858
/* 171138 80242858 54400007 */  bnel      $v0, $zero, .L80242878
.L8024285C:
/* 17113C 8024285C 26520001 */   addiu    $s2, $s2, 0x1
D_80242860:
/* 171140 80242860 84640436 */  lh        $a0, 0x436($v1)
.L80242864:
/* 171144 80242864 0C011EE1 */  jal       remove_status_chill_out
.L80242868:
/* 171148 80242868 A0600223 */   sb       $zero, 0x223($v1)
D_8024286C:
/* 17114C 8024286C 3C01802A */  lui       $at, %hi(D_8029F258)
glabel func_80242870
/* 171150 80242870 AC34F258 */  sw        $s4, %lo(D_8029F258)($at)
flo_09_pad_2874:
/* 171154 80242874 26520001 */  addiu     $s2, $s2, 0x1
.L80242878:
/* 171158 80242878 2A420018 */  slti      $v0, $s2, 0x18
glabel .L8024287C
/* 17115C 8024287C 1440FFE9 */  bnez      $v0, func_80242824
D_80242880:
/* 171160 80242880 26100004 */   addiu    $s0, $s0, 0x4
.L80242884:
/* 171164 80242884 24020001 */  addiu     $v0, $zero, 0x1
D_80242888:
/* 171168 80242888 3C01800E */  lui       $at, %hi(gBattleSubState)
/* 17116C 8024288C AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
.L80242890:
/* 171170 80242890 3C12800E */  lui       $s2, %hi(gBattleSubState)
glabel func_80242894
/* 171174 80242894 8E52C4DC */  lw        $s2, %lo(gBattleSubState)($s2)
glabel func_80242898
/* 171178 80242898 24020001 */  addiu     $v0, $zero, 0x1
glabel func_8024289C
/* 17117C 8024289C 16420051 */  bne       $s2, $v0, D_802429E4
D_802428A0:
/* 171180 802428A0 00000000 */   nop
glabel .L802428A4
/* 171184 802428A4 0C098D0D */  jal       btl_check_enemies_defeated
D_802428A8:
/* 171188 802428A8 00000000 */   nop
.L802428AC:
/* 17118C 802428AC 14400077 */  bnez      $v0, .L80242A8C
glabel func_802428B0
/* 171190 802428B0 24100001 */   addiu    $s0, $zero, 0x1
glabel func_802428B4
/* 171194 802428B4 826200AE */  lb        $v0, 0xAE($s3)
D_802428B8:
/* 171198 802428B8 926300AE */  lbu       $v1, 0xAE($s3)
D_802428BC:
/* 17119C 802428BC 04400015 */  bltz      $v0, D_80242914
glabel func_802428C0
/* 1711A0 802428C0 A260008C */   sb       $zero, 0x8C($s3)
D_802428C4:
/* 1711A4 802428C4 2462FFFF */  addiu     $v0, $v1, -0x1
glabel func_802428C8
/* 1711A8 802428C8 A26200AE */  sb        $v0, 0xAE($s3)
D_802428CC:
/* 1711AC 802428CC 00021600 */  sll       $v0, $v0, 24
glabel func_802428D0
/* 1711B0 802428D0 00021603 */  sra       $v0, $v0, 24
D_802428D4:
/* 1711B4 802428D4 2403FFFF */  addiu     $v1, $zero, -0x1
glabel func_802428D8
/* 1711B8 802428D8 1443000E */  bne       $v0, $v1, D_80242914
glabel .L802428DC
/* 1711BC 802428DC 2405000A */   addiu    $a1, $zero, 0xA
mgm_02_BoxModelIDs:
/* 1711C0 802428E0 3C048029 */  lui       $a0, %hi(EVS_PlayerRegainAbility)
D_802428E4:
/* 1711C4 802428E4 24849110 */  addiu     $a0, $a0, %lo(EVS_PlayerRegainAbility)
D_802428E8:
/* 1711C8 802428E8 0C0B0CF8 */  jal       start_script
.L802428EC:
/* 1711CC 802428EC 0000302D */   daddu    $a2, $zero, $zero
D_802428F0:
/* 1711D0 802428F0 0040182D */  daddu     $v1, $v0, $zero
glabel func_802428F4
/* 1711D4 802428F4 AE2301D4 */  sw        $v1, 0x1D4($s1)
glabel func_802428F8
/* 1711D8 802428F8 8C620144 */  lw        $v0, 0x144($v1)
.L802428FC:
/* 1711DC 802428FC AE2201E4 */  sw        $v0, 0x1E4($s1)
glabel func_80242900
/* 1711E0 80242900 AC700084 */  sw        $s0, 0x84($v1)
.L80242904:
/* 1711E4 80242904 24100009 */  addiu     $s0, $zero, 0x9
dgb_03_pad_2908:
/* 1711E8 80242908 AC600148 */  sw        $zero, 0x148($v1)
D_8024290C:
/* 1711EC 8024290C AC7200AC */  sw        $s2, 0xAC($v1)
D_80242910:
/* 1711F0 80242910 A272008C */  sb        $s2, 0x8C($s3)
D_80242914:
/* 1711F4 80242914 826200AF */  lb        $v0, 0xAF($s3)
D_80242918:
/* 1711F8 80242918 926300AF */  lbu       $v1, 0xAF($s3)
D_8024291C:
/* 1711FC 8024291C 04400015 */  bltz      $v0, .L80242974
.L80242920:
/* 171200 80242920 2462FFFF */   addiu    $v0, $v1, -0x1
glabel func_80242924
/* 171204 80242924 A26200AF */  sb        $v0, 0xAF($s3)
glabel func_80242928
/* 171208 80242928 00021600 */  sll       $v0, $v0, 24
D_8024292C:
/* 17120C 8024292C 00021603 */  sra       $v0, $v0, 24
D_80242930:
/* 171210 80242930 2403FFFF */  addiu     $v1, $zero, -0x1
D_80242934:
/* 171214 80242934 1443000F */  bne       $v0, $v1, .L80242974
.L80242938:
/* 171218 80242938 2405000A */   addiu    $a1, $zero, 0xA
glabel func_8024293C
/* 17121C 8024293C 3C048029 */  lui       $a0, %hi(EVS_PlayerRegainAbility)
glabel func_80242940
/* 171220 80242940 24849110 */  addiu     $a0, $a0, %lo(EVS_PlayerRegainAbility)
.L80242944:
/* 171224 80242944 0C0B0CF8 */  jal       start_script
glabel func_80242948
/* 171228 80242948 0000302D */   daddu    $a2, $zero, $zero
glabel func_8024294C
/* 17122C 8024294C 0040182D */  daddu     $v1, $v0, $zero
glabel func_80242950
/* 171230 80242950 AE2301D4 */  sw        $v1, 0x1D4($s1)
.L80242954:
/* 171234 80242954 8C620144 */  lw        $v0, 0x144($v1)
glabel func_80242958
/* 171238 80242958 AE2201E4 */  sw        $v0, 0x1E4($s1)
glabel func_8024295C
/* 17123C 8024295C AC700084 */  sw        $s0, 0x84($v1)
/* 171240 80242960 26100008 */  addiu     $s0, $s0, 0x8
D_80242964:
/* 171244 80242964 24020001 */  addiu     $v0, $zero, 0x1
glabel .L80242968
/* 171248 80242968 AC600148 */  sw        $zero, 0x148($v1)
D_8024296C:
/* 17124C 8024296C AC6000AC */  sw        $zero, 0xAC($v1)
D_80242970:
/* 171250 80242970 A262008C */  sb        $v0, 0x8C($s3)
glabel .L80242974
/* 171254 80242974 826200B0 */  lb        $v0, 0xB0($s3)
glabel func_80242978
/* 171258 80242978 926300B0 */  lbu       $v1, 0xB0($s3)
glabel .L8024297C
/* 17125C 8024297C 04400016 */  bltz      $v0, .L802429D8
glabel func_80242980
/* 171260 80242980 2462FFFF */   addiu    $v0, $v1, -0x1
D_80242984:
/* 171264 80242984 A26200B0 */  sb        $v0, 0xB0($s3)
D_80242988:
/* 171268 80242988 00021600 */  sll       $v0, $v0, 24
.L8024298C:
/* 17126C 8024298C 00021603 */  sra       $v0, $v0, 24
D_80242990:
/* 171270 80242990 2403FFFF */  addiu     $v1, $zero, -0x1
D_80242994:
/* 171274 80242994 14430011 */  bne       $v0, $v1, .L802429DC
D_80242998:
/* 171278 80242998 2402001E */   addiu    $v0, $zero, 0x1E
glabel dead_11_SpinyAI_Main
/* 17127C 8024299C 3C048029 */  lui       $a0, %hi(EVS_PlayerRegainAbility)
glabel func_802429A0_EEFAA0
/* 171280 802429A0 24849110 */  addiu     $a0, $a0, %lo(EVS_PlayerRegainAbility)
D_802429A4:
/* 171284 802429A4 2405000A */  addiu     $a1, $zero, 0xA
.L802429A8:
/* 171288 802429A8 0C0B0CF8 */  jal       start_script
D_802429AC:
/* 17128C 802429AC 0000302D */   daddu    $a2, $zero, $zero
.L802429B0:
/* 171290 802429B0 0040182D */  daddu     $v1, $v0, $zero
/* 171294 802429B4 AE2301D4 */  sw        $v1, 0x1D4($s1)
D_802429B8:
/* 171298 802429B8 8C620144 */  lw        $v0, 0x144($v1)
D_802429BC:
/* 17129C 802429BC AE2201E4 */  sw        $v0, 0x1E4($s1)
glabel func_802429C0_EA32C0
/* 1712A0 802429C0 24020002 */  addiu     $v0, $zero, 0x2
glabel func_802429C4
/* 1712A4 802429C4 AC6200AC */  sw        $v0, 0xAC($v1)
glabel func_802429C8
/* 1712A8 802429C8 24020001 */  addiu     $v0, $zero, 0x1
D_802429CC:
/* 1712AC 802429CC AC600148 */  sw        $zero, 0x148($v1)
D_802429D0:
/* 1712B0 802429D0 AC700084 */  sw        $s0, 0x84($v1)
D_802429D4:
/* 1712B4 802429D4 A262008C */  sb        $v0, 0x8C($s3)
.L802429D8:
/* 1712B8 802429D8 2402001E */  addiu     $v0, $zero, 0x1E
.L802429DC:
/* 1712BC 802429DC 3C01800E */  lui       $at, %hi(gBattleSubState)
dead_flo_12_D_802429E0:
/* 1712C0 802429E0 AC22C4DC */  sw        $v0, %lo(gBattleSubState)($at)
D_802429E4:
/* 1712C4 802429E4 3C03800E */  lui       $v1, %hi(gBattleSubState)
D_802429E8:
/* 1712C8 802429E8 8C63C4DC */  lw        $v1, %lo(gBattleSubState)($v1)
glabel func_802429EC
/* 1712CC 802429EC 2402001E */  addiu     $v0, $zero, 0x1E
.L802429F0:
/* 1712D0 802429F0 14620026 */  bne       $v1, $v0, .L80242A8C
glabel func_802429F4
/* 1712D4 802429F4 00000000 */   nop
mgm_02_PanelModelIDs:
/* 1712D8 802429F8 8E2201D8 */  lw        $v0, 0x1D8($s1)
D_802429FC:
/* 1712DC 802429FC 10400005 */  beqz      $v0, func_80242A14
D_80242A00:
/* 1712E0 80242A00 00000000 */   nop
glabel func_80242A04
/* 1712E4 80242A04 0C0B1059 */  jal       does_script_exist
glabel func_80242A08
/* 1712E8 80242A08 8E2401E8 */   lw       $a0, 0x1E8($s1)
/* 1712EC 80242A0C 1440001F */  bnez      $v0, .L80242A8C
glabel func_80242A10
/* 1712F0 80242A10 00000000 */   nop
glabel func_80242A14
/* 1712F4 80242A14 0C098D19 */  jal       btl_check_player_defeated
glabel func_80242A18
/* 1712F8 80242A18 AE2001D8 */   sw       $zero, 0x1D8($s1)
glabel func_80242A1C
/* 1712FC 80242A1C 1440001B */  bnez      $v0, .L80242A8C
glabel func_80242A20
/* 171300 80242A20 00000000 */   nop
D_80242A24:
/* 171304 80242A24 0C098D0D */  jal       btl_check_enemies_defeated
.L80242A28:
/* 171308 80242A28 00000000 */   nop
D_80242A2C:
/* 17130C 80242A2C 14400017 */  bnez      $v0, .L80242A8C
glabel func_80242A30
/* 171310 80242A30 00000000 */   nop
glabel func_80242A34
/* 171314 80242A34 3C03802A */  lui       $v1, %hi(D_8029F258)
.L80242A38:
/* 171318 80242A38 2463F258 */  addiu     $v1, $v1, %lo(D_8029F258)
read_sign_instructions:
/* 17131C 80242A3C 8C620000 */  lw        $v0, 0x0($v1)
D_80242A40:
/* 171320 80242A40 10400003 */  beqz      $v0, .L80242A50
.L80242A44:
/* 171324 80242A44 2442FFFF */   addiu    $v0, $v0, -0x1
.L80242A48:
/* 171328 80242A48 08090AA3 */  j         .L80242A8C
glabel func_80242A4C_EA334C
/* 17132C 80242A4C AC620000 */   sw       $v0, 0x0($v1)
.L80242A50:
/* 171330 80242A50 3C02802A */  lui       $v0, %hi(D_8029F254)
glabel .L80242A54
/* 171334 80242A54 8C42F254 */  lw        $v0, %lo(D_8029F254)($v0)
.L80242A58:
/* 171338 80242A58 14400005 */  bnez      $v0, .L80242A70
glabel .L80242A5C
/* 17133C 80242A5C 00000000 */   nop
/* 171340 80242A60 0C090464 */  jal       func_80241190
glabel func_80242A64
/* 171344 80242A64 2404000A */   addiu    $a0, $zero, 0xA
glabel func_80242A68
/* 171348 80242A68 08090AA3 */  j         .L80242A8C
glabel func_80242A6C
/* 17134C 80242A6C 00000000 */   nop
.L80242A70:
/* 171350 80242A70 0C090464 */  jal       func_80241190
glabel func_80242A74
/* 171354 80242A74 24040008 */   addiu    $a0, $zero, 0x8
D_80242A78:
/* 171358 80242A78 3C03800E */  lui       $v1, %hi(gBattleStatus)
glabel func_80242A7C
/* 17135C 80242A7C 2463C070 */  addiu     $v1, $v1, %lo(gBattleStatus)
glabel func_80242A80
/* 171360 80242A80 8C620004 */  lw        $v0, 0x4($v1)
.L80242A84:
/* 171364 80242A84 34420002 */  ori       $v0, $v0, 0x2
.L80242A88:
/* 171368 80242A88 AC620004 */  sw        $v0, 0x4($v1)
glabel .L80242A8C
/* 17136C 80242A8C 8FBF0034 */  lw        $ra, 0x34($sp)
glabel func_80242A90
/* 171370 80242A90 8FB60030 */  lw        $s6, 0x30($sp)
D_80242A94:
/* 171374 80242A94 8FB5002C */  lw        $s5, 0x2C($sp)
.L80242A98:
/* 171378 80242A98 8FB40028 */  lw        $s4, 0x28($sp)
D_80242A9C:
/* 17137C 80242A9C 8FB30024 */  lw        $s3, 0x24($sp)
D_80242AA0:
/* 171380 80242AA0 8FB20020 */  lw        $s2, 0x20($sp)
glabel .L80242AA4
/* 171384 80242AA4 8FB1001C */  lw        $s1, 0x1C($sp)
.L80242AA8:
/* 171388 80242AA8 8FB00018 */  lw        $s0, 0x18($sp)
glabel func_80242AAC
/* 17138C 80242AAC D7B80048 */  ldc1      $f24, 0x48($sp)
D_80242AB0:
/* 171390 80242AB0 D7B60040 */  ldc1      $f22, 0x40($sp)
glabel .L80242AB4
/* 171394 80242AB4 D7B40038 */  ldc1      $f20, 0x38($sp)
.L80242AB8:
/* 171398 80242AB8 03E00008 */  jr        $ra
glabel func_80242ABC
/* 17139C 80242ABC 27BD0050 */   addiu    $sp, $sp, 0x50

### DECOMPILED C INSTRUCTIONS:

void btl_state_update_begin_player_turn(void) {
    BattleStatus* battleStatus = &gBattleStatus;
    PlayerData* playerData = &gPlayerData;
    Actor* player = battleStatus->playerActor;
    Actor* partner = battleStatus->partnerActor;
    ActorPart* part = &player->partsTable[0];
    Evt* script;
    s32 i;

    s8 debuffDuration;
    s32 koDuration;
    s32 temp;

    if (gBattleSubState == BTL_SUBSTATE_BEGIN_PLAYER_TURN_INIT) {
        btl_cam_use_preset(BTL_CAM_DEFAULT);
        btl_cam_move(5);
        gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_RESET_STATE;
    }

    switch (gBattleSubState) {
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_RESET_STATE:
            if (btl_cam_is_moving_done()) {
                gBattleStatus.flags1 &= ~BS_FLAGS1_PARTNER_ACTING;
                reset_actor_turn_info();
                battleStatus->unk_86 = 127;
                battleStatus->blockResult = 127;
                battleStatus->selectedMoveID = 0;
                gBattleStatus.flags1 |= BS_FLAGS1_SHOW_PLAYER_DECORATIONS;
                gBattleStatus.flags2 &= ~BS_FLAGS2_1000000;
                player->disableDismissTimer = 0;
                player->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;

                if (partner != NULL) {
                    player->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;
                    partner->disableDismissTimer = 0;
                }

                battleStatus->stateFreezeCount = 0;
                D_8029F254 = 0;
                D_8029F258 = 0;

                if (battleStatus->outtaSightActive == 0) {
                    gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_WATER_BLOCK;
                } else {
                    battleStatus->battlePhase = PHASE_ENEMY_BEGIN;
                    script = start_script(partner->handlePhaseSource, EVT_PRIORITY_A, 0);
                    partner->handlePhaseScript = script;
                    gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_OUTTA_SIGHT;
                    partner->handleBatttlePhaseScriptID = script->id;
                    script->owner1.actorID = ACTOR_PARTNER;
                }
            }
            break;
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_OUTTA_SIGHT:
            if (!does_script_exist(partner->handleBatttlePhaseScriptID)) {
                battleStatus->outtaSightActive = 0;
                gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_WATER_BLOCK;
                gBattleStatus.flags2 |= BS_FLAGS2_4;
            }
            break;
    }

    switch (gBattleSubState) {
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_WATER_BLOCK:
            if (battleStatus->stateFreezeCount == 0) {
                if (battleStatus->waterBlockTurnsLeft != 0) {
                    battleStatus->waterBlockTurnsLeft--;
                    battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_WATER_BLOCK].turnsLeft = battleStatus->waterBlockTurnsLeft;
                    if (battleStatus->waterBlockTurnsLeft <= 0) {
                        battleStatus->waterBlockEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
                        fx_water_block(1, player->currentPos.x, player->currentPos.y + 18.0f, player->currentPos.z + 5.0f, 1.5f, 10);
                        fx_water_splash(0, player->currentPos.x - 10.0f, player->currentPos.y + 5.0f, player->currentPos.z + 5.0f, 1.0f, 24);
                        fx_water_splash(0, player->currentPos.x - 15.0f, player->currentPos.y + 32.0f, player->currentPos.z + 5.0f, 1.0f, 24);
                        fx_water_splash(1, player->currentPos.x + 15.0f, player->currentPos.y + 22.0f, player->currentPos.z + 5.0f, 1.0f, 24);
                        battleStatus->waterBlockEffect = NULL;
                        sfx_play_sound(SOUND_299);
                        btl_show_battle_message(BTL_MSG_WATER_BLOCK_END, 60);
                        gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_WATER_BLOCK;
                    } else {
                        gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_CLOUD_NINE;
                    }
                } else {
                    gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_CLOUD_NINE;
                }
            }
            break;
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_WATER_BLOCK:
            if (!btl_is_popup_displayed()) {
                gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_CLOUD_NINE;
            }
            break;
    }

    switch (gBattleSubState) {
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_CLOUD_NINE:
            if (battleStatus->cloudNineTurnsLeft != 0) {
                battleStatus->cloudNineTurnsLeft--;
                battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_CLOUD_NINE].turnsLeft = battleStatus->cloudNineTurnsLeft;

                if (battleStatus->cloudNineTurnsLeft <= 0) {
                    remove_effect(battleStatus->cloudNineEffect);
                    battleStatus->cloudNineEffect = NULL;
                    btl_show_battle_message(BTL_MSG_CLOUD_NINE_END, 60);
                    gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_CLOUD_NINE;
                } else {
                    gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_TURBO_CHARGE;
                }
            } else {
                gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_TURBO_CHARGE;
            }
            break;
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_CLOUD_NINE:
            if (!btl_is_popup_displayed()) {
                gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_TURBO_CHARGE;
            }
            break;
    }

    switch (gBattleSubState) {
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_TURBO_CHARGE:
            if (battleStatus->turboChargeTurnsLeft != 0) {
                if (gBattleStatus.flags2 & BS_FLAGS2_100) {
                    gBattleStatus.flags2 &= ~BS_FLAGS2_100;
                    gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_DAMAGE;
                } else {
                    battleStatus->turboChargeTurnsLeft--;
                    battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_TURBO_CHARGE].turnsLeft = battleStatus->turboChargeTurnsLeft;
                    if (battleStatus->turboChargeTurnsLeft <= 0) {
                        btl_show_battle_message(BTL_MSG_TURBO_CHARGE_END, 60);
                        gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_TURBO_CHARGE;
                    } else {
                        gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_DAMAGE;
                    }
                }
            } else {
                gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_DAMAGE;
            }
            break;
        case BTL_SUBSTATE_BEGIN_PLAYER_TURN_AWAIT_TURBO_CHARGE:
            if (0) { // TODO relocated block - required to match
back:
                player->koStatus = STATUS_KEY_DAZE;
                player->disableEffect->data.disableX->koDuration = player->koDuration;
                goto later;
            }
            if (!btl_is_popup_displayed()) {
                gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_DAMAGE;
            }
            break;
    }

    if (gBattleSubState == BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_DAMAGE) {
        if (player->debuff == STATUS_KEY_POISON && player->stoneStatus == 0) {
            gBattleStatus.flags1 |= BS_FLAGS1_SP_EVT_ACTIVE;
            dispatch_damage_event_player_0(1, EVENT_HIT);
        }

        // clear rush flags to initialize
        battleStatus->rushFlags = RUSH_FLAG_NONE;
        gBattleStatus.flags2 &= ~BS_FLAGS2_HAS_RUSH;

        // set rush flags based on danger/peril status
        if (!(gBattleStatus.flags2 & BS_FLAGS2_PEACH_BATTLE)) {
            if (playerData->curHP <= PERIL_THRESHOLD && is_ability_active(ABILITY_MEGA_RUSH)) {
                gBattleStatus.flags2 |= BS_FLAGS2_HAS_RUSH;
                battleStatus->rushFlags |= RUSH_FLAG_MEGA;
            }
            if (playerData->curHP <= DANGER_THRESHOLD && is_ability_active(ABILITY_POWER_RUSH)) {
                if (!(battleStatus->rushFlags & RUSH_FLAG_MEGA)) {
                    gBattleStatus.flags2 |= BS_FLAGS2_HAS_RUSH;
                    battleStatus->rushFlags |= RUSH_FLAG_POWER;
                }
            }
        }
        gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_RECOVER;
    }

    if (gBattleSubState == BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_RECOVER) {
        if (player->handleEventScript == NULL || !does_script_exist(player->handleEventScriptID)) {
            player->handleEventScript = NULL;
            if (btl_check_player_defeated()) {
                return;
            }

            D_8029F254 = 0;
            player->disableDismissTimer = 0;
            player->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;

            if (is_ability_active(ABILITY_FEELING_FINE)) {
                if (player->debuff != 0) {
                    player->debuffDuration = 1;
                }
                if (player->staticStatus != 0) {
                    player->staticDuration = 1;
                }
                if (player->stoneStatus != 0) {
                    player->stoneDuration = 1;
                }
                if (player->koStatus != 0) {
                    player->koDuration = 1;
                }
                if (player->transparentStatus != 0) {
                    player->transparentDuration = 1;
                }
            }

            if (player->stoneStatus != 0) {
                player->stoneDuration--;
                if (player->stoneDuration <= 0) {
                    player->stoneStatus = 0;
                    dispatch_event_player(EVENT_RECOVER_STATUS);
                }
            } else {
                if (!is_ability_active(ABILITY_ZAP_TAP) && player->staticStatus != 0) {
                    player->staticDuration--;
                    if (player->staticDuration <= 0) {
                        player->staticStatus = 0;
                        remove_status_static(player->hudElementDataIndex);
                    }
                }
                if (player->transparentStatus != 0) {
                    player->transparentDuration--;
                    part->flags |= ACTOR_PART_FLAG_100;
                    do {
                        if (player->transparentDuration <= 0) {
                            player->transparentStatus = 0;
                            part->flags &= ~ACTOR_PART_FLAG_100;
                            remove_status_transparent(player->hudElementDataIndex);
                        }
                    } while (0); // TODO required to match
                }

                if (player->debuff != 0) {
                    if (player->debuff < 9) {
                        D_8029F254 = 1;
                    }
                    D_8029F258 = 20;
                    player->debuffDuration--;
                    if (player->debuffDuration <= 0) {
                        if (player->debuff == STATUS_KEY_FROZEN) {
                            sfx_play_sound(SOUND_FROZEN_SHATTER);
                            player->icePillarEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
                            player->icePillarEffect = NULL;
                            dispatch_event_player(EVENT_32);
                        } else {
                            dispatch_event_player(EVENT_RECOVER_STATUS);
                        }
                        player->debuff = 0;
                        player->debuffDuration = 0;
                        remove_status_debuff(player->hudElementDataIndex);
                    }
                }

                debuffDuration = player->debuffDuration;
                temp = player->koDuration;
                player->koDuration = debuffDuration;
                if (debuffDuration > 0) {
                    goto back;
                } else if (temp != debuffDuration) {
                    player->koStatus = 0;
                    player->koDuration = 0;
                    player->disableEffect->data.disableX->koDuration = 0;
                }
            }
    later:

            for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
                Actor* enemy = battleStatus->enemyActors[i];

                if (enemy != NULL) {
                    enemy->flags |= ACTOR_FLAG_8000000 | ACTOR_FLAG_4000000;
                    if (enemy->chillOutTurns != 0) {
                        enemy->chillOutTurns--;
                        if (enemy->chillOutTurns == 0) {
                            enemy->chillOutAmount = 0;
                            remove_status_chill_out(enemy->hudElementDataIndex);
                            D_8029F258 = 20;
                        }
                    }
                }
            }
            gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_COMMAND_RECOVER;
        }
    }

    if (gBattleSubState == BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_COMMAND_RECOVER) {
        if (btl_check_enemies_defeated()) {
            return;
        }
        temp = 1;
        battleStatus->stateFreezeCount = 0;
        if (battleStatus->hammerLossTurns >= 0) {
            battleStatus->hammerLossTurns--;
            if (battleStatus->hammerLossTurns == -1) {
                script = start_script(&EVS_PlayerRegainAbility, EVT_PRIORITY_A, 0);
                player->takeTurnScript = script;
                player->takeTurnScriptID = script->id;
                script->owner1.actorID = ACTOR_PLAYER;
                script->varTable[0] = temp;
                temp += 8;
                script->varTable[10] = 1; // hammer
                battleStatus->stateFreezeCount = 1;
            }
        }

        if (battleStatus->jumpLossTurns >= 0) {
            battleStatus->jumpLossTurns--;
            if (battleStatus->jumpLossTurns == -1) {
                script = start_script(&EVS_PlayerRegainAbility, EVT_PRIORITY_A, 0);
                player->takeTurnScript = script;
                player->takeTurnScriptID = script->id;
                script->owner1.actorID = ACTOR_PLAYER;
                script->varTable[0] = temp;
                temp += 8;
                script->varTable[10] = 0; // jump
                battleStatus->stateFreezeCount = 1;
            }
        }

        if (battleStatus->itemLossTurns >= 0) {
            battleStatus->itemLossTurns--;
            if (battleStatus->itemLossTurns == -1) {
                script = start_script(&EVS_PlayerRegainAbility, EVT_PRIORITY_A, 0);
                player->takeTurnScript = script;
                player->takeTurnScriptID = script->id;
                script->owner1.actorID = ACTOR_PLAYER;
                script->varTable[0] = temp;
                temp += 8;
                script->varTable[10] = 2; // item
                battleStatus->stateFreezeCount = 1;
            }
        }
        gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_END_DELAY;
    }

    if (gBattleSubState == BTL_SUBSTATE_BEGIN_PLAYER_TURN_END_DELAY) {
        if (player->handleEventScript == NULL || !does_script_exist(player->handleEventScriptID)) {
            player->handleEventScript = NULL;

            if (btl_check_player_defeated() || btl_check_enemies_defeated()) {
                return;
            }

            if (D_8029F258 != 0) {
                D_8029F258--;
                return;
            }

            if (D_8029F254 == 0) {
                btl_set_state(BATTLE_STATE_SWITCH_TO_PLAYER);
            } else{
                btl_set_state(BATTLE_STATE_BEGIN_PARTNER_TURN);
                gBattleStatus.flags2 |= BS_FLAGS2_2;
            }
        }
    }
}