papermario/asm/nonmatchings/code_1b40_len_20b0/step_game_loop.s
2020-11-29 02:13:07 -05:00

188 lines
9.3 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel step_game_loop
/* 1B40 80026740 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 1B44 80026744 AFBF0018 */ sw $ra, 0x18($sp)
/* 1B48 80026748 AFB10014 */ sw $s1, 0x14($sp)
/* 1B4C 8002674C 0C00A21D */ jal update_input
/* 1B50 80026750 AFB00010 */ sw $s0, 0x10($sp)
/* 1B54 80026754 3C038007 */ lui $v1, %hi(gGameStatusPtr)
/* 1B58 80026758 8C63419C */ lw $v1, %lo(gGameStatusPtr)($v1)
/* 1B5C 8002675C 3C040CDF */ lui $a0, 0xcdf
/* 1B60 80026760 94620134 */ lhu $v0, 0x134($v1)
/* 1B64 80026764 3C108011 */ lui $s0, %hi(gPlayerData)
/* 1B68 80026768 2610F290 */ addiu $s0, $s0, %lo(gPlayerData)
/* 1B6C 8002676C 24420001 */ addiu $v0, $v0, 1
/* 1B70 80026770 A4620134 */ sh $v0, 0x134($v1)
/* 1B74 80026774 8E0202BC */ lw $v0, 0x2bc($s0)
/* 1B78 80026778 3484E5FF */ ori $a0, $a0, 0xe5ff
/* 1B7C 8002677C 24420002 */ addiu $v0, $v0, 2
/* 1B80 80026780 AE0202BC */ sw $v0, 0x2bc($s0)
/* 1B84 80026784 0082102B */ sltu $v0, $a0, $v0
/* 1B88 80026788 54400001 */ bnel $v0, $zero, .L80026790
/* 1B8C 8002678C AE0402BC */ sw $a0, 0x2bc($s0)
.L80026790:
/* 1B90 80026790 0C00A3E3 */ jal func_80028F8C
/* 1B94 80026794 00000000 */ nop
/* 1B98 80026798 3C048007 */ lui $a0, %hi(D_80074021)
/* 1B9C 8002679C 24844021 */ addiu $a0, $a0, %lo(D_80074021)
/* 1BA0 800267A0 80820000 */ lb $v0, ($a0)
/* 1BA4 800267A4 90830000 */ lbu $v1, ($a0)
/* 1BA8 800267A8 10400008 */ beqz $v0, .L800267CC
/* 1BAC 800267AC 2462FFFF */ addiu $v0, $v1, -1
/* 1BB0 800267B0 A0820000 */ sb $v0, ($a0)
/* 1BB4 800267B4 00021600 */ sll $v0, $v0, 0x18
/* 1BB8 800267B8 14400087 */ bnez $v0, .L800269D8
/* 1BBC 800267BC 00000000 */ nop
/* 1BC0 800267C0 3C028007 */ lui $v0, %hi(D_80074020)
/* 1BC4 800267C4 90424020 */ lbu $v0, %lo(D_80074020)($v0)
/* 1BC8 800267C8 A0820000 */ sb $v0, ($a0)
.L800267CC:
/* 1BCC 800267CC 0C046EBA */ jal func_8011BAE8
/* 1BD0 800267D0 00000000 */ nop
/* 1BD4 800267D4 0C00E15F */ jal func_8003857C
/* 1BD8 800267D8 00000000 */ nop
/* 1BDC 800267DC 0C048D01 */ jal update_dynamic_entities
/* 1BE0 800267E0 00000000 */ nop
/* 1BE4 800267E4 0C051618 */ jal update_triggers
/* 1BE8 800267E8 00000000 */ nop
/* 1BEC 800267EC 0C0B0F5D */ jal update_scripts
/* 1BF0 800267F0 00000000 */ nop
/* 1BF4 800267F4 0C048DF6 */ jal update_messages
/* 1BF8 800267F8 00000000 */ nop
/* 1BFC 800267FC 0C050584 */ jal update_menu_icons
/* 1C00 80026800 00000000 */ nop
/* 1C04 80026804 0C044B9E */ jal step_current_game_mode
/* 1C08 80026808 00000000 */ nop
/* 1C0C 8002680C 0C043DB4 */ jal update_entities
/* 1C10 80026810 00000000 */ nop
/* 1C14 80026814 0C04E066 */ jal func_80138198
/* 1C18 80026818 00000000 */ nop
/* 1C1C 8002681C 0C052952 */ jal func_8014A548
/* 1C20 80026820 00000000 */ nop
/* 1C24 80026824 0C051C99 */ jal func_80147264
/* 1C28 80026828 00000000 */ nop
/* 1C2C 8002682C 0C0525CD */ jal func_80149734
/* 1C30 80026830 00000000 */ nop
/* 1C34 80026834 0C051D05 */ jal func_80147414
/* 1C38 80026838 00000000 */ nop
/* 1C3C 8002683C 0C00AE9E */ jal update_curtains
/* 1C40 80026840 00000000 */ nop
/* 1C44 80026844 3C10800A */ lui $s0, %hi(D_8009A650)
/* 1C48 80026848 2610A650 */ addiu $s0, $s0, %lo(D_8009A650)
/* 1C4C 8002684C 8E040000 */ lw $a0, ($s0)
/* 1C50 80026850 30820020 */ andi $v0, $a0, 0x20
/* 1C54 80026854 10400035 */ beqz $v0, .L8002692C
/* 1C58 80026858 00000000 */ nop
/* 1C5C 8002685C 3C118007 */ lui $s1, %hi(D_800741A2)
/* 1C60 80026860 263141A2 */ addiu $s1, $s1, %lo(D_800741A2)
/* 1C64 80026864 86230000 */ lh $v1, ($s1)
/* 1C68 80026868 10600005 */ beqz $v1, .L80026880
/* 1C6C 8002686C 24020001 */ addiu $v0, $zero, 1
/* 1C70 80026870 1062001C */ beq $v1, $v0, .L800268E4
/* 1C74 80026874 34840008 */ ori $a0, $a0, 8
/* 1C78 80026878 08009A4F */ j .L8002693C
/* 1C7C 8002687C 00000000 */ nop
.L80026880:
/* 1C80 80026880 34820200 */ ori $v0, $a0, 0x200
/* 1C84 80026884 0C03805E */ jal disable_player_input
/* 1C88 80026888 AE020000 */ sw $v0, ($s0)
/* 1C8C 8002688C 3C048007 */ lui $a0, %hi(D_800741A0)
/* 1C90 80026890 248441A0 */ addiu $a0, $a0, %lo(D_800741A0)
/* 1C94 80026894 240500FF */ addiu $a1, $zero, 0xff
/* 1C98 80026898 84820000 */ lh $v0, ($a0)
/* 1C9C 8002689C 94830000 */ lhu $v1, ($a0)
/* 1CA0 800268A0 14450008 */ bne $v0, $a1, .L800268C4
/* 1CA4 800268A4 2462000A */ addiu $v0, $v1, 0xa
/* 1CA8 800268A8 24020001 */ addiu $v0, $zero, 1
/* 1CAC 800268AC A6220000 */ sh $v0, ($s1)
/* 1CB0 800268B0 24020003 */ addiu $v0, $zero, 3
/* 1CB4 800268B4 3C01800A */ lui $at, %hi(D_8009A690)
/* 1CB8 800268B8 A422A690 */ sh $v0, %lo(D_8009A690)($at)
/* 1CBC 800268BC 08009A4F */ j .L8002693C
/* 1CC0 800268C0 00000000 */ nop
.L800268C4:
/* 1CC4 800268C4 A4820000 */ sh $v0, ($a0)
/* 1CC8 800268C8 00021400 */ sll $v0, $v0, 0x10
/* 1CCC 800268CC 00021403 */ sra $v0, $v0, 0x10
/* 1CD0 800268D0 28420100 */ slti $v0, $v0, 0x100
/* 1CD4 800268D4 50400019 */ beql $v0, $zero, .L8002693C
/* 1CD8 800268D8 A4850000 */ sh $a1, ($a0)
/* 1CDC 800268DC 08009A4F */ j .L8002693C
/* 1CE0 800268E0 00000000 */ nop
.L800268E4:
/* 1CE4 800268E4 3C02800A */ lui $v0, %hi(D_8009A690)
/* 1CE8 800268E8 2442A690 */ addiu $v0, $v0, %lo(D_8009A690)
/* 1CEC 800268EC 94430000 */ lhu $v1, ($v0)
/* 1CF0 800268F0 AE040000 */ sw $a0, ($s0)
/* 1CF4 800268F4 2463FFFF */ addiu $v1, $v1, -1
/* 1CF8 800268F8 A4430000 */ sh $v1, ($v0)
/* 1CFC 800268FC 00031C00 */ sll $v1, $v1, 0x10
/* 1D00 80026900 1460000E */ bnez $v1, .L8002693C
/* 1D04 80026904 00000000 */ nop
/* 1D08 80026908 0C05260E */ jal func_80149838
/* 1D0C 8002690C 00000000 */ nop
/* 1D10 80026910 0C00CD3C */ jal set_game_mode
/* 1D14 80026914 0000202D */ daddu $a0, $zero, $zero
/* 1D18 80026918 8E020000 */ lw $v0, ($s0)
/* 1D1C 8002691C 2403FFDF */ addiu $v1, $zero, -0x21
/* 1D20 80026920 00431024 */ and $v0, $v0, $v1
/* 1D24 80026924 08009A4F */ j .L8002693C
/* 1D28 80026928 AE020000 */ sw $v0, ($s0)
.L8002692C:
/* 1D2C 8002692C 3C018007 */ lui $at, %hi(D_800741A0)
/* 1D30 80026930 A42041A0 */ sh $zero, %lo(D_800741A0)($at)
/* 1D34 80026934 3C018007 */ lui $at, %hi(D_800741A2)
/* 1D38 80026938 A42041A2 */ sh $zero, %lo(D_800741A2)($at)
.L8002693C:
/* 1D3C 8002693C 3C04800A */ lui $a0, %hi(D_8009A650)
/* 1D40 80026940 2484A650 */ addiu $a0, $a0, %lo(D_8009A650)
/* 1D44 80026944 8C830000 */ lw $v1, ($a0)
/* 1D48 80026948 30620100 */ andi $v0, $v1, 0x100
/* 1D4C 8002694C 14400003 */ bnez $v0, .L8002695C
/* 1D50 80026950 34621000 */ ori $v0, $v1, 0x1000
/* 1D54 80026954 2402EFFF */ addiu $v0, $zero, -0x1001
/* 1D58 80026958 00621024 */ and $v0, $v1, $v0
.L8002695C:
/* 1D5C 8002695C AC820000 */ sw $v0, ($a0)
/* 1D60 80026960 3C04800A */ lui $a0, %hi(D_8009A650)
/* 1D64 80026964 2484A650 */ addiu $a0, $a0, %lo(D_8009A650)
/* 1D68 80026968 8C830000 */ lw $v1, ($a0)
/* 1D6C 8002696C 30620200 */ andi $v0, $v1, 0x200
/* 1D70 80026970 14400003 */ bnez $v0, .L80026980
/* 1D74 80026974 34622000 */ ori $v0, $v1, 0x2000
/* 1D78 80026978 2402DFFF */ addiu $v0, $zero, -0x2001
/* 1D7C 8002697C 00621024 */ and $v0, $v1, $v0
.L80026980:
/* 1D80 80026980 AC820000 */ sw $v0, ($a0)
/* 1D84 80026984 3C04800A */ lui $a0, %hi(D_8009A650)
/* 1D88 80026988 2484A650 */ addiu $a0, $a0, %lo(D_8009A650)
/* 1D8C 8002698C 8C830000 */ lw $v1, ($a0)
/* 1D90 80026990 30620400 */ andi $v0, $v1, 0x400
/* 1D94 80026994 14400003 */ bnez $v0, .L800269A4
/* 1D98 80026998 34624000 */ ori $v0, $v1, 0x4000
/* 1D9C 8002699C 2402BFFF */ addiu $v0, $zero, -0x4001
/* 1DA0 800269A0 00621024 */ and $v0, $v1, $v0
.L800269A4:
/* 1DA4 800269A4 AC820000 */ sw $v0, ($a0)
/* 1DA8 800269A8 3C04800A */ lui $a0, %hi(D_8009A650)
/* 1DAC 800269AC 2484A650 */ addiu $a0, $a0, %lo(D_8009A650)
/* 1DB0 800269B0 8C830000 */ lw $v1, ($a0)
/* 1DB4 800269B4 30620800 */ andi $v0, $v1, 0x800
/* 1DB8 800269B8 14400004 */ bnez $v0, .L800269CC
/* 1DBC 800269BC 34628000 */ ori $v0, $v1, 0x8000
/* 1DC0 800269C0 3C02FFFF */ lui $v0, 0xffff
/* 1DC4 800269C4 34427FFF */ ori $v0, $v0, 0x7fff
/* 1DC8 800269C8 00621024 */ and $v0, $v1, $v0
.L800269CC:
/* 1DCC 800269CC AC820000 */ sw $v0, ($a0)
/* 1DD0 800269D0 0C00A67F */ jal rand_int
/* 1DD4 800269D4 24040001 */ addiu $a0, $zero, 1
.L800269D8:
/* 1DD8 800269D8 8FBF0018 */ lw $ra, 0x18($sp)
/* 1DDC 800269DC 8FB10014 */ lw $s1, 0x14($sp)
/* 1DE0 800269E0 8FB00010 */ lw $s0, 0x10($sp)
/* 1DE4 800269E4 03E00008 */ jr $ra
/* 1DE8 800269E8 27BD0020 */ addiu $sp, $sp, 0x20