diff --git a/asm/non_matchings/code/code_80110450/func_80110450.s b/asm/non_matchings/code/code_80110450/func_80110450.s deleted file mode 100644 index 54af9c6a50..0000000000 --- a/asm/non_matchings/code/code_80110450/func_80110450.s +++ /dev/null @@ -1,6 +0,0 @@ -glabel func_80110450 -/* B875F0 80110450 3C010001 */ lui $at, 1 -/* B875F4 80110454 00240821 */ addu $at, $at, $a0 -/* B875F8 80110458 03E00008 */ jr $ra -/* B875FC 8011045C A4200A20 */ sh $zero, 0xa20($at) - diff --git a/asm/non_matchings/code/code_80110450/func_80110460.s b/asm/non_matchings/code/code_80110450/func_80110460.s deleted file mode 100644 index d0054ff508..0000000000 --- a/asm/non_matchings/code/code_80110450/func_80110460.s +++ /dev/null @@ -1,32 +0,0 @@ -glabel func_80110460 -/* B87600 80110460 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* B87604 80110464 3C0E0001 */ lui $t6, 1 -/* B87608 80110468 AFBF0014 */ sw $ra, 0x14($sp) -/* B8760C 8011046C 01C47021 */ addu $t6, $t6, $a0 -/* B87610 80110470 95CE0A20 */ lhu $t6, 0xa20($t6) -/* B87614 80110474 3C0F0001 */ lui $t7, 1 -/* B87618 80110478 01E47821 */ addu $t7, $t7, $a0 -/* B8761C 8011047C 29C10002 */ slti $at, $t6, 2 -/* B87620 80110480 14200004 */ bnez $at, .L80110494 -/* B87624 80110484 3C020001 */ lui $v0, 1 -/* B87628 80110488 95EF0A20 */ lhu $t7, 0xa20($t7) -/* B8762C 8011048C 29E10014 */ slti $at, $t7, 0x14 -/* B87630 80110490 14200007 */ bnez $at, .L801104B0 -.L80110494: -/* B87634 80110494 00441021 */ addu $v0, $v0, $a0 -/* B87638 80110498 94420A20 */ lhu $v0, 0xa20($v0) -/* B8763C 8011049C 28410015 */ slti $at, $v0, 0x15 -/* B87640 801104A0 14200005 */ bnez $at, .L801104B8 -/* B87644 801104A4 28410018 */ slti $at, $v0, 0x18 -/* B87648 801104A8 50200004 */ beql $at, $zero, .L801104BC -/* B8764C 801104AC 8FBF0014 */ lw $ra, 0x14($sp) -.L801104B0: -/* B87650 801104B0 0C01D83D */ jal func_800760F4 -/* B87654 801104B4 00000000 */ nop -.L801104B8: -/* B87658 801104B8 8FBF0014 */ lw $ra, 0x14($sp) -.L801104BC: -/* B8765C 801104BC 27BD0018 */ addiu $sp, $sp, 0x18 -/* B87660 801104C0 03E00008 */ jr $ra -/* B87664 801104C4 00000000 */ nop - diff --git a/asm/non_matchings/code/code_80110450/func_801104C8.s b/asm/non_matchings/code/code_80110450/func_801104C8.s deleted file mode 100644 index 665b57b042..0000000000 --- a/asm/non_matchings/code/code_80110450/func_801104C8.s +++ /dev/null @@ -1,359 +0,0 @@ -.late_rodata -glabel jtbl_80154CF0 - .word L80110520 - .word L80110960 - .word L80110748 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L80110960 - .word L8011079C - .word L801107D8 - .word L801108A4 - .word L801108E8 - .word L8011092C - -.text -glabel func_801104C8 -/* B87668 801104C8 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* B8766C 801104CC 3C0E0001 */ lui $t6, 1 -/* B87670 801104D0 AFBF0034 */ sw $ra, 0x34($sp) -/* B87674 801104D4 AFB60030 */ sw $s6, 0x30($sp) -/* B87678 801104D8 AFB5002C */ sw $s5, 0x2c($sp) -/* B8767C 801104DC AFB40028 */ sw $s4, 0x28($sp) -/* B87680 801104E0 AFB30024 */ sw $s3, 0x24($sp) -/* B87684 801104E4 AFB20020 */ sw $s2, 0x20($sp) -/* B87688 801104E8 AFB1001C */ sw $s1, 0x1c($sp) -/* B8768C 801104EC AFB00018 */ sw $s0, 0x18($sp) -/* B87690 801104F0 01C47021 */ addu $t6, $t6, $a0 -/* B87694 801104F4 95CE0A20 */ lhu $t6, 0xa20($t6) -/* B87698 801104F8 0080A825 */ move $s5, $a0 -/* B8769C 801104FC 25CFFFFF */ addiu $t7, $t6, -1 -/* B876A0 80110500 2DE10018 */ sltiu $at, $t7, 0x18 -/* B876A4 80110504 10200116 */ beqz $at, .L80110960 -/* B876A8 80110508 000F7880 */ sll $t7, $t7, 2 -/* B876AC 8011050C 3C018015 */ lui $at, %hi(jtbl_80154CF0) -/* B876B0 80110510 002F0821 */ addu $at, $at, $t7 -/* B876B4 80110514 8C2F4CF0 */ lw $t7, %lo(jtbl_80154CF0)($at) -/* B876B8 80110518 01E00008 */ jr $t7 -/* B876BC 8011051C 00000000 */ nop -glabel L80110520 -/* B876C0 80110520 0C041B33 */ jal func_80106CCC -/* B876C4 80110524 02A02025 */ move $a0, $s5 -/* B876C8 80110528 3C138016 */ lui $s3, %hi(gSaveContext) # $s3, 0x8016 -/* B876CC 8011052C 2673E660 */ addiu $s3, %lo(gSaveContext) # addiu $s3, $s3, -0x19a0 -/* B876D0 80110530 967813FC */ lhu $t8, 0x13fc($s3) -/* B876D4 80110534 3C168012 */ lui $s6, %hi(gItemSlots) # $s6, 0x8012 -/* B876D8 80110538 A66013CE */ sh $zero, 0x13ce($s3) -/* B876DC 8011053C 3319FFFE */ andi $t9, $t8, 0xfffe -/* B876E0 80110540 A66013D2 */ sh $zero, 0x13d2($s3) -/* B876E4 80110544 A67913FC */ sh $t9, 0x13fc($s3) -/* B876E8 80110548 26D67464 */ addiu $s6, %lo(gItemSlots) # addiu $s6, $s6, 0x7464 -/* B876EC 8011054C 0000A025 */ move $s4, $zero -/* B876F0 80110550 92CA002D */ lbu $t2, 0x2d($s6) -.L80110554: -/* B876F4 80110554 3C098012 */ lui $t1, %hi(gSpoilingItems) # $t1, 0x8012 -/* B876F8 80110558 25295A18 */ addiu $t1, %lo(gSpoilingItems) # addiu $t1, $t1, 0x5a18 -/* B876FC 8011055C 00141840 */ sll $v1, $s4, 1 -/* B87700 80110560 00699021 */ addu $s2, $v1, $t1 -/* B87704 80110564 026A5821 */ addu $t3, $s3, $t2 -/* B87708 80110568 916C0074 */ lbu $t4, 0x74($t3) -/* B8770C 8011056C 864D0000 */ lh $t5, ($s2) -/* B87710 80110570 3C0E8012 */ lui $t6, %hi(gSpoilingItemReverts) # $t6, 0x8012 -/* B87714 80110574 25CE5A20 */ addiu $t6, %lo(gSpoilingItemReverts) # addiu $t6, $t6, 0x5a20 -/* B87718 80110578 158D0017 */ bne $t4, $t5, .L801105D8 -/* B8771C 8011057C 006E8821 */ addu $s1, $v1, $t6 -/* B87720 80110580 86220000 */ lh $v0, ($s1) -/* B87724 80110584 24100001 */ li $s0, 1 -/* B87728 80110588 02C27821 */ addu $t7, $s6, $v0 -/* B8772C 8011058C 91F80000 */ lbu $t8, ($t7) -/* B87730 80110590 0278C821 */ addu $t9, $s3, $t8 -/* B87734 80110594 A3220074 */ sb $v0, 0x74($t9) -/* B87738 80110598 02701021 */ addu $v0, $s3, $s0 -.L8011059C: -/* B8773C 8011059C 90490068 */ lbu $t1, 0x68($v0) -/* B87740 801105A0 864A0000 */ lh $t2, ($s2) -/* B87744 801105A4 02A02025 */ move $a0, $s5 -/* B87748 801105A8 552A0006 */ bnel $t1, $t2, .L801105C4 -/* B8774C 801105AC 26100001 */ addiu $s0, $s0, 1 -/* B87750 801105B0 862B0000 */ lh $t3, ($s1) -/* B87754 801105B4 3205FFFF */ andi $a1, $s0, 0xffff -/* B87758 801105B8 0C02129B */ jal Interface_LoadItemIcon1 -/* B8775C 801105BC A04B0068 */ sb $t3, 0x68($v0) -/* B87760 801105C0 26100001 */ addiu $s0, $s0, 1 -.L801105C4: -/* B87764 801105C4 00108400 */ sll $s0, $s0, 0x10 -/* B87768 801105C8 00108403 */ sra $s0, $s0, 0x10 -/* B8776C 801105CC 2A010004 */ slti $at, $s0, 4 -/* B87770 801105D0 5420FFF2 */ bnezl $at, .L8011059C -/* B87774 801105D4 02701021 */ addu $v0, $s3, $s0 -.L801105D8: -/* B87778 801105D8 26940001 */ addiu $s4, $s4, 1 -/* B8777C 801105DC 0014A400 */ sll $s4, $s4, 0x10 -/* B87780 801105E0 0014A403 */ sra $s4, $s4, 0x10 -/* B87784 801105E4 2A810003 */ slti $at, $s4, 3 -/* B87788 801105E8 5420FFDA */ bnezl $at, .L80110554 -/* B8778C 801105EC 92CA002D */ lbu $t2, 0x2d($s6) -/* B87790 801105F0 92620068 */ lbu $v0, 0x68($s3) -/* B87794 801105F4 2401003B */ li $at, 59 -/* B87798 801105F8 240C07D0 */ li $t4, 2000 -/* B8779C 801105FC 1041000F */ beq $v0, $at, .L8011063C -/* B877A0 80110600 02A02025 */ move $a0, $s5 -/* B877A4 80110604 2401003C */ li $at, 60 -/* B877A8 80110608 1041000C */ beq $v0, $at, .L8011063C -/* B877AC 8011060C 2401003D */ li $at, 61 -/* B877B0 80110610 1041000A */ beq $v0, $at, .L8011063C -/* B877B4 80110614 24010055 */ li $at, 85 -/* B877B8 80110618 50410009 */ beql $v0, $at, .L80110640 -/* B877BC 8011061C 240300FF */ li $v1, 255 -/* B877C0 80110620 926213E2 */ lbu $v0, 0x13e2($s3) -/* B877C4 80110624 240300FF */ li $v1, 255 -/* B877C8 80110628 50400004 */ beql $v0, $zero, .L8011063C -/* B877CC 8011062C A2630068 */ sb $v1, 0x68($s3) -/* B877D0 80110630 10000002 */ b .L8011063C -/* B877D4 80110634 A2620068 */ sb $v0, 0x68($s3) -/* B877D8 80110638 A2630068 */ sb $v1, 0x68($s3) -.L8011063C: -/* B877DC 8011063C 240300FF */ li $v1, 255 -.L80110640: -/* B877E0 80110640 A66C13C8 */ sh $t4, 0x13c8($s3) -/* B877E4 80110644 A6600038 */ sh $zero, 0x38($s3) -/* B877E8 80110648 A26313E0 */ sb $v1, 0x13e0($s3) -/* B877EC 8011064C A26313E1 */ sb $v1, 0x13e1($s3) -/* B877F0 80110650 A66013FA */ sh $zero, 0x13fa($s3) -/* B877F4 80110654 A66013FC */ sh $zero, 0x13fc($s3) -/* B877F8 80110658 A66013FE */ sh $zero, 0x13fe($s3) -/* B877FC 8011065C A6601400 */ sh $zero, 0x1400($s3) -/* B87800 80110660 A26013E6 */ sb $zero, 0x13e6($s3) -/* B87804 80110664 A26013E5 */ sb $zero, 0x13e5($s3) -/* B87808 80110668 A26013E4 */ sb $zero, 0x13e4($s3) -/* B8780C 8011066C A26013E3 */ sb $zero, 0x13e3($s3) -/* B87810 80110670 A26013E2 */ sb $zero, 0x13e2($s3) -/* B87814 80110674 A66013EC */ sh $zero, 0x13ec($s3) -/* B87818 80110678 A66013EA */ sh $zero, 0x13ea($s3) -/* B8781C 8011067C A66013E8 */ sh $zero, 0x13e8($s3) -/* B87820 80110680 0C01D7C5 */ jal func_80075F14 -/* B87824 80110684 A26013E7 */ sb $zero, 0x13e7($s3) -/* B87828 80110688 3C038015 */ lui $v1, %hi(D_80153D80) # $v1, 0x8015 -/* B8782C 8011068C 24633D80 */ addiu $v1, %lo(D_80153D80) # addiu $v1, $v1, 0x3d80 -/* B87830 80110690 24180014 */ li $t8, 20 -/* B87834 80110694 A4780000 */ sh $t8, ($v1) -/* B87838 80110698 3C028016 */ lui $v0, %hi(gGameInfo) -/* B8783C 8011069C 8C42FA90 */ lw $v0, %lo(gGameInfo)($v0) -/* B87840 801106A0 44806000 */ mtc1 $zero, $f12 -/* B87844 801106A4 84430FC8 */ lh $v1, 0xfc8($v0) -/* B87848 801106A8 84440FCA */ lh $a0, 0xfca($v0) -/* B8784C 801106AC 84450FCC */ lh $a1, 0xfcc($v0) -/* B87850 801106B0 28610065 */ slti $at, $v1, 0x65 -/* B87854 801106B4 14200003 */ bnez $at, .L801106C4 -/* B87858 801106B8 00041080 */ sll $v0, $a0, 2 -/* B8785C 801106BC 10000008 */ b .L801106E0 -/* B87860 801106C0 240800FF */ li $t0, 255 -.L801106C4: -/* B87864 801106C4 00034200 */ sll $t0, $v1, 8 -/* B87868 801106C8 01034023 */ subu $t0, $t0, $v1 -/* B8786C 801106CC 24010064 */ li $at, 100 -/* B87870 801106D0 0101001A */ div $zero, $t0, $at -/* B87874 801106D4 00004012 */ mflo $t0 -/* B87878 801106D8 00000000 */ nop -/* B8787C 801106DC 00000000 */ nop -.L801106E0: -/* B87880 801106E0 00441023 */ subu $v0, $v0, $a0 -/* B87884 801106E4 28410100 */ slti $at, $v0, 0x100 -/* B87888 801106E8 14200003 */ bnez $at, .L801106F8 -/* B8788C 801106EC 00401825 */ move $v1, $v0 -/* B87890 801106F0 10000001 */ b .L801106F8 -/* B87894 801106F4 240300FF */ li $v1, 255 -.L801106F8: -/* B87898 801106F8 28A10065 */ slti $at, $a1, 0x65 -/* B8789C 801106FC 14200003 */ bnez $at, .L8011070C -/* B878A0 80110700 306600FF */ andi $a2, $v1, 0xff -/* B878A4 80110704 10000008 */ b .L80110728 -/* B878A8 80110708 240200FF */ li $v0, 255 -.L8011070C: -/* B878AC 8011070C 00051200 */ sll $v0, $a1, 8 -/* B878B0 80110710 00451023 */ subu $v0, $v0, $a1 -/* B878B4 80110714 24010064 */ li $at, 100 -/* B878B8 80110718 0041001A */ div $zero, $v0, $at -/* B878BC 8011071C 00001012 */ mflo $v0 -/* B878C0 80110720 00000000 */ nop -/* B878C4 80110724 00000000 */ nop -.L80110728: -/* B878C8 80110728 310500FF */ andi $a1, $t0, 0xff -/* B878CC 8011072C 0C02A800 */ jal func_800AA000 -/* B878D0 80110730 304700FF */ andi $a3, $v0, 0xff -/* B878D4 80110734 3C010001 */ lui $at, 1 -/* B878D8 80110738 00350821 */ addu $at, $at, $s5 -/* B878DC 8011073C 24190002 */ li $t9, 2 -/* B878E0 80110740 10000087 */ b .L80110960 -/* B878E4 80110744 A4390A20 */ sh $t9, 0xa20($at) -glabel L80110748 -/* B878E8 80110748 3C038015 */ lui $v1, %hi(D_80153D80) # $v1, 0x8015 -/* B878EC 8011074C 24633D80 */ addiu $v1, %lo(D_80153D80) # addiu $v1, $v1, 0x3d80 -/* B878F0 80110750 84690000 */ lh $t1, ($v1) -/* B878F4 80110754 3C010001 */ lui $at, 1 -/* B878F8 80110758 00350821 */ addu $at, $at, $s5 -/* B878FC 8011075C 252AFFFF */ addiu $t2, $t1, -1 -/* B87900 80110760 A46A0000 */ sh $t2, ($v1) -/* B87904 80110764 846B0000 */ lh $t3, ($v1) -/* B87908 80110768 240C0008 */ li $t4, 8 -/* B8790C 8011076C 5560007D */ bnezl $t3, .L80110964 -/* B87910 80110770 8FBF0034 */ lw $ra, 0x34($sp) -/* B87914 80110774 A42C0934 */ sh $t4, 0x934($at) -/* B87918 80110778 3C010001 */ lui $at, (0x00010A20 >> 16) # lui $at, 1 -/* B8791C 8011077C 34210A20 */ ori $at, (0x00010A20 & 0xFFFF) # ori $at, $at, 0xa20 -/* B87920 80110780 02A11021 */ addu $v0, $s5, $at -/* B87924 80110784 944D0000 */ lhu $t5, ($v0) -/* B87928 80110788 25AE0001 */ addiu $t6, $t5, 1 -/* B8792C 8011078C 0C02A857 */ jal func_800AA15C -/* B87930 80110790 A44E0000 */ sh $t6, ($v0) -/* B87934 80110794 10000073 */ b .L80110964 -/* B87938 80110798 8FBF0034 */ lw $ra, 0x34($sp) -glabel L8011079C -/* B8793C 8011079C 3C010001 */ lui $at, (0x00010A20 >> 16) # lui $at, 1 -/* B87940 801107A0 34210A20 */ ori $at, (0x00010A20 & 0xFFFF) # ori $at, $at, 0xa20 -/* B87944 801107A4 02A11021 */ addu $v0, $s5, $at -/* B87948 801107A8 944F0000 */ lhu $t7, ($v0) -/* B8794C 801107AC 3C038015 */ lui $v1, %hi(D_80153D80) # $v1, 0x8015 -/* B87950 801107B0 24633D80 */ addiu $v1, %lo(D_80153D80) # addiu $v1, $v1, 0x3d80 -/* B87954 801107B4 25F80001 */ addiu $t8, $t7, 1 -/* B87958 801107B8 A4580000 */ sh $t8, ($v0) -/* B8795C 801107BC A4600000 */ sh $zero, ($v1) -/* B87960 801107C0 0C01D7C5 */ jal func_80075F14 -/* B87964 801107C4 02A02025 */ move $a0, $s5 -/* B87968 801107C8 0C02CE10 */ jal ShrinkWindow_SetVal -/* B8796C 801107CC 24040020 */ li $a0, 32 -/* B87970 801107D0 10000064 */ b .L80110964 -/* B87974 801107D4 8FBF0034 */ lw $ra, 0x34($sp) -glabel L801107D8 -/* B87978 801107D8 3C038015 */ lui $v1, %hi(D_80153D80) # $v1, 0x8015 -/* B8797C 801107DC 3C010001 */ li $at, 0x00010000 # 0.000000 -/* B87980 801107E0 24633D80 */ addiu $v1, %lo(D_80153D80) # addiu $v1, $v1, 0x3d80 -/* B87984 801107E4 24190032 */ li $t9, 50 -/* B87988 801107E8 34210A20 */ ori $at, (0x00010A20 & 0xFFFF) # ori $at, $at, 0xa20 -/* B8798C 801107EC A4790000 */ sh $t9, ($v1) -/* B87990 801107F0 02A11021 */ addu $v0, $s5, $at -/* B87994 801107F4 94490000 */ lhu $t1, ($v0) -/* B87998 801107F8 44806000 */ mtc1 $zero, $f12 -/* B8799C 801107FC 252A0001 */ addiu $t2, $t1, 1 -/* B879A0 80110800 A44A0000 */ sh $t2, ($v0) -/* B879A4 80110804 3C028016 */ lui $v0, %hi(gGameInfo) # $v0, 0x8016 -/* B879A8 80110808 8C42FA90 */ lw $v0, %lo(gGameInfo)($v0) -/* B879AC 8011080C 84430FC8 */ lh $v1, 0xfc8($v0) -/* B879B0 80110810 84440FCA */ lh $a0, 0xfca($v0) -/* B879B4 80110814 84450FCC */ lh $a1, 0xfcc($v0) -/* B879B8 80110818 28610065 */ slti $at, $v1, 0x65 -/* B879BC 8011081C 14200003 */ bnez $at, .L8011082C -/* B879C0 80110820 00041080 */ sll $v0, $a0, 2 -/* B879C4 80110824 10000008 */ b .L80110848 -/* B879C8 80110828 240800FF */ li $t0, 255 -.L8011082C: -/* B879CC 8011082C 00034200 */ sll $t0, $v1, 8 -/* B879D0 80110830 01034023 */ subu $t0, $t0, $v1 -/* B879D4 80110834 24010064 */ li $at, 100 -/* B879D8 80110838 0101001A */ div $zero, $t0, $at -/* B879DC 8011083C 00004012 */ mflo $t0 -/* B879E0 80110840 00000000 */ nop -/* B879E4 80110844 00000000 */ nop -.L80110848: -/* B879E8 80110848 00441023 */ subu $v0, $v0, $a0 -/* B879EC 8011084C 28410100 */ slti $at, $v0, 0x100 -/* B879F0 80110850 14200003 */ bnez $at, .L80110860 -/* B879F4 80110854 00401825 */ move $v1, $v0 -/* B879F8 80110858 10000001 */ b .L80110860 -/* B879FC 8011085C 240300FF */ li $v1, 255 -.L80110860: -/* B87A00 80110860 28A10065 */ slti $at, $a1, 0x65 -/* B87A04 80110864 14200003 */ bnez $at, .L80110874 -/* B87A08 80110868 306600FF */ andi $a2, $v1, 0xff -/* B87A0C 8011086C 10000008 */ b .L80110890 -/* B87A10 80110870 240200FF */ li $v0, 255 -.L80110874: -/* B87A14 80110874 00051200 */ sll $v0, $a1, 8 -/* B87A18 80110878 00451023 */ subu $v0, $v0, $a1 -/* B87A1C 8011087C 24010064 */ li $at, 100 -/* B87A20 80110880 0041001A */ div $zero, $v0, $at -/* B87A24 80110884 00001012 */ mflo $v0 -/* B87A28 80110888 00000000 */ nop -/* B87A2C 8011088C 00000000 */ nop -.L80110890: -/* B87A30 80110890 310500FF */ andi $a1, $t0, 0xff -/* B87A34 80110894 0C02A800 */ jal func_800AA000 -/* B87A38 80110898 304700FF */ andi $a3, $v0, 0xff -/* B87A3C 8011089C 10000031 */ b .L80110964 -/* B87A40 801108A0 8FBF0034 */ lw $ra, 0x34($sp) -glabel L801108A4 -/* B87A44 801108A4 3C038015 */ lui $v1, %hi(D_80153D80) # $v1, 0x8015 -/* B87A48 801108A8 24633D80 */ addiu $v1, %lo(D_80153D80) # addiu $v1, $v1, 0x3d80 -/* B87A4C 801108AC 846B0000 */ lh $t3, ($v1) -/* B87A50 801108B0 3C010001 */ lui $at, (0x00010A20 >> 16) # lui $at, 1 -/* B87A54 801108B4 34210A20 */ ori $at, (0x00010A20 & 0xFFFF) # ori $at, $at, 0xa20 -/* B87A58 801108B8 256CFFFF */ addiu $t4, $t3, -1 -/* B87A5C 801108BC A46C0000 */ sh $t4, ($v1) -/* B87A60 801108C0 846D0000 */ lh $t5, ($v1) -/* B87A64 801108C4 240E0040 */ li $t6, 64 -/* B87A68 801108C8 02A11021 */ addu $v0, $s5, $at -/* B87A6C 801108CC 55A00025 */ bnezl $t5, .L80110964 -/* B87A70 801108D0 8FBF0034 */ lw $ra, 0x34($sp) -/* B87A74 801108D4 A46E0000 */ sh $t6, ($v1) -/* B87A78 801108D8 944F0000 */ lhu $t7, ($v0) -/* B87A7C 801108DC 25F80001 */ addiu $t8, $t7, 1 -/* B87A80 801108E0 1000001F */ b .L80110960 -/* B87A84 801108E4 A4580000 */ sh $t8, ($v0) -glabel L801108E8 -/* B87A88 801108E8 3C038015 */ lui $v1, %hi(D_80153D80) # $v1, 0x8015 -/* B87A8C 801108EC 24633D80 */ addiu $v1, %lo(D_80153D80) # addiu $v1, $v1, 0x3d80 -/* B87A90 801108F0 84790000 */ lh $t9, ($v1) -/* B87A94 801108F4 3C010001 */ lui $at, (0x00010A20 >> 16) # lui $at, 1 -/* B87A98 801108F8 34210A20 */ ori $at, (0x00010A20 & 0xFFFF) # ori $at, $at, 0xa20 -/* B87A9C 801108FC 2729FFFF */ addiu $t1, $t9, -1 -/* B87AA0 80110900 A4690000 */ sh $t1, ($v1) -/* B87AA4 80110904 846A0000 */ lh $t2, ($v1) -/* B87AA8 80110908 240B0032 */ li $t3, 50 -/* B87AAC 8011090C 02A11021 */ addu $v0, $s5, $at -/* B87AB0 80110910 55400014 */ bnezl $t2, .L80110964 -/* B87AB4 80110914 8FBF0034 */ lw $ra, 0x34($sp) -/* B87AB8 80110918 A46B0000 */ sh $t3, ($v1) -/* B87ABC 8011091C 944C0000 */ lhu $t4, ($v0) -/* B87AC0 80110920 258D0001 */ addiu $t5, $t4, 1 -/* B87AC4 80110924 1000000E */ b .L80110960 -/* B87AC8 80110928 A44D0000 */ sh $t5, ($v0) -glabel L8011092C -/* B87ACC 8011092C 0C01D8EA */ jal func_800763A8 -/* B87AD0 80110930 02A02025 */ move $a0, $s5 -/* B87AD4 80110934 3C038015 */ lui $v1, %hi(D_80153D80) # $v1, 0x8015 -/* B87AD8 80110938 24633D80 */ addiu $v1, %lo(D_80153D80) # addiu $v1, $v1, 0x3d80 -/* B87ADC 8011093C 846E0000 */ lh $t6, ($v1) -/* B87AE0 80110940 3C010001 */ lui $at, 1 -/* B87AE4 80110944 00350821 */ addu $at, $at, $s5 -/* B87AE8 80110948 25CFFFFF */ addiu $t7, $t6, -1 -/* B87AEC 8011094C A46F0000 */ sh $t7, ($v1) -/* B87AF0 80110950 84780000 */ lh $t8, ($v1) -/* B87AF4 80110954 57000003 */ bnezl $t8, .L80110964 -/* B87AF8 80110958 8FBF0034 */ lw $ra, 0x34($sp) -/* B87AFC 8011095C A4200A20 */ sh $zero, 0xa20($at) -.L80110960: -glabel L80110960 -/* B87B00 80110960 8FBF0034 */ lw $ra, 0x34($sp) -.L80110964: -/* B87B04 80110964 8FB00018 */ lw $s0, 0x18($sp) -/* B87B08 80110968 8FB1001C */ lw $s1, 0x1c($sp) -/* B87B0C 8011096C 8FB20020 */ lw $s2, 0x20($sp) -/* B87B10 80110970 8FB30024 */ lw $s3, 0x24($sp) -/* B87B14 80110974 8FB40028 */ lw $s4, 0x28($sp) -/* B87B18 80110978 8FB5002C */ lw $s5, 0x2c($sp) -/* B87B1C 8011097C 8FB60030 */ lw $s6, 0x30($sp) -/* B87B20 80110980 03E00008 */ jr $ra -/* B87B24 80110984 27BD0038 */ addiu $sp, $sp, 0x38 \ No newline at end of file diff --git a/asm/non_matchings/code/z_kankyo/func_800760F4.s b/asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s similarity index 99% rename from asm/non_matchings/code/z_kankyo/func_800760F4.s rename to asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s index fd30200c87..1c44515305 100644 --- a/asm/non_matchings/code/z_kankyo/func_800760F4.s +++ b/asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s @@ -1,4 +1,4 @@ -glabel func_800760F4 +glabel Kankyo_FadeInGameOverLights /* AED294 800760F4 27BDFFC8 */ addiu $sp, $sp, -0x38 /* AED298 800760F8 AFBF002C */ sw $ra, 0x2c($sp) /* AED29C 800760FC AFB00028 */ sw $s0, 0x28($sp) diff --git a/asm/non_matchings/code/z_kankyo/func_800763A8.s b/asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s similarity index 99% rename from asm/non_matchings/code/z_kankyo/func_800763A8.s rename to asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s index e6bf518d19..be3a7630cf 100644 --- a/asm/non_matchings/code/z_kankyo/func_800763A8.s +++ b/asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s @@ -1,4 +1,4 @@ -glabel func_800763A8 +glabel Kankyo_FadeOutGameOverLights /* AED548 800763A8 27BDFFC0 */ addiu $sp, $sp, -0x40 /* AED54C 800763AC AFB2002C */ sw $s2, 0x2c($sp) /* AED550 800763B0 3C128016 */ lui $s2, %hi(D_8015FDAE) diff --git a/asm/non_matchings/code/z_kankyo/func_80075F14.s b/asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s similarity index 99% rename from asm/non_matchings/code/z_kankyo/func_80075F14.s rename to asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s index e56ad9803d..111039aee1 100644 --- a/asm/non_matchings/code/z_kankyo/func_80075F14.s +++ b/asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s @@ -1,4 +1,4 @@ -glabel func_80075F14 +glabel Kankyo_InitGameOverLights /* AED0B4 80075F14 27BDFFC8 */ addiu $sp, $sp, -0x38 /* AED0B8 80075F18 AFBF0024 */ sw $ra, 0x24($sp) /* AED0BC 80075F1C AFA40038 */ sw $a0, 0x38($sp) diff --git a/include/functions.h b/include/functions.h index 9139cd68f9..f3d41d6cf0 100644 --- a/include/functions.h +++ b/include/functions.h @@ -963,9 +963,9 @@ void func_8007542C(GlobalContext*, u8); void func_800758AC(GlobalContext* globalCtx); // ? func_80075B44(?); void func_80075E68(GlobalContext* globalCtx); -// ? func_80075F14(?); -// ? func_800760F4(?); -// ? func_800763A8(?); +void Kankyo_InitGameOverLights(GlobalContext* globalCtx); +void Kankyo_FadeInGameOverLights(GlobalContext* globalCtx); +void Kankyo_FadeOutGameOverLights(GlobalContext* globalCtx); // ? func_800766C4(?); void func_8007672C(GraphicsContext*, u8, u8, u8, u8, UNK_TYPE); void func_80076934(GlobalContext* globalCtx, u8); @@ -2631,9 +2631,9 @@ u8 func_8010BDBC(MessageContext* msgCtx); void func_8010F58C(GlobalContext* globalCtx); void func_8010F6F0(GlobalContext* globalCtx); void func_8011040C(void); -void func_80110450(GlobalContext* globalCtx); -void func_80110460(GlobalContext* globalCtx); -void func_801104C8(GlobalContext* globalCtx); +void GameOver_Init(GlobalContext* globalCtx); +void GameOver_FadeInLights(GlobalContext* globalCtx); +void GameOver_Update(GlobalContext* globalCtx); void func_80110990(GlobalContext* globalCtx); void func_801109B0(GlobalContext* globalCtx); void func_80110F68(GlobalContext* globalCtx); diff --git a/include/variables.h b/include/variables.h index b4f23c7fa4..b12906136e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3015,7 +3015,6 @@ extern s16 gTatumsPerBeat; //extern ? D_80153CFC; //extern ? D_80153D74; //extern ? D_80153D78; -//extern ? D_80153D80; //extern ? D_80153D90; //extern ? D_80153DEC; //extern ? D_80153E48; diff --git a/include/z64.h b/include/z64.h index b760e855a9..d0bdb41336 100644 --- a/include/z64.h +++ b/include/z64.h @@ -494,6 +494,23 @@ typedef struct { /* 0x0268 */ char unk_268[0x58]; } PauseContext; // size = 0x2C0 +typedef enum { + /* 00 */ GAMEOVER_INACTIVE, + /* 01 */ GAMEOVER_DEATH_START, + /* 02 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for link to fall and hit the ground + /* 03 */ GAMEOVER_DEATH_DELAY_MENU, // wait for 1 second before showing the game over menu + /* 04 */ GAMEOVER_DEATH_MENU, // do nothing while kaliedoscope handles the game over menu + /* 20 */ GAMEOVER_REVIVE_START = 20, + /* 21 */ GAMEOVER_REVIVE_RUMBLE, + /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for link to fall and hit the ground + /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of links body + /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as link is revived and gets back up +} GameOverState; + +typedef struct { + /* 0x00 */ u16 state; +} GameOverContext; + typedef struct { /* 0x00 */ char unk_00[0x02]; /* 0x02 */ u16 unk_02; @@ -880,7 +897,7 @@ typedef struct GlobalContext { /* 0x020D8 */ MessageContext msgCtx; // "message" /* 0x104F0 */ InterfaceContext interfaceCtx; // "parameter" /* 0x10760 */ PauseContext pauseCtx; - /* 0x10A20 */ u16 unk_10A20; + /* 0x10A20 */ GameOverContext gameOverCtx; /* 0x10A24 */ EnvironmentContext envCtx; /* 0x10B20 */ AnimationContext animationCtx; /* 0x117A4 */ ObjectContext objectCtx; diff --git a/spec b/spec index 70fa16fefa..1a2f4a1e9f 100644 --- a/spec +++ b/spec @@ -510,7 +510,7 @@ beginseg include "build/data/z_message_PAL.rodata.o" include "build/src/code/z_message_PAL.o" include "build/data/z_message_PAL.bss.o" - include "build/src/code/code_80110450.o" + include "build/src/code/z_game_over.o" include "build/src/code/z_construct.o" include "build/data/rsp.text.o" include "build/data/rsp.rodata.o" diff --git a/src/code/code_80110450.c b/src/code/code_80110450.c deleted file mode 100644 index 828d757a2e..0000000000 --- a/src/code/code_80110450.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80110450/func_80110450.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80110450/func_80110460.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80110450/func_801104C8.s") diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index c17f00b3f0..3a3c454271 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -519,7 +519,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } } - if (globalCtx->unk_10A20 != 0) { + if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) { return; } diff --git a/src/code/z_frame_advance.c b/src/code/z_frame_advance.c index caf33fafb9..c8a2c64ff2 100644 --- a/src/code/z_frame_advance.c +++ b/src/code/z_frame_advance.c @@ -24,6 +24,6 @@ s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) { frameAdvCtx->timer = 0; return true; } - + return false; } diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c new file mode 100644 index 0000000000..c978b69cfe --- /dev/null +++ b/src/code/z_game_over.c @@ -0,0 +1,150 @@ +#include "global.h" + +void GameOver_Init(GlobalContext* globalCtx) { + globalCtx->gameOverCtx.state = GAMEOVER_INACTIVE; +} + +void GameOver_FadeInLights(GlobalContext* globalCtx) { + GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; + + if ((gameOverCtx->state >= GAMEOVER_DEATH_WAIT_GROUND && gameOverCtx->state < GAMEOVER_REVIVE_START) || + (gameOverCtx->state >= GAMEOVER_REVIVE_RUMBLE && gameOverCtx->state < GAMEOVER_REVIVE_FADE_OUT)) { + Kankyo_FadeInGameOverLights(globalCtx); + } +} + +// This variable has the same problem as z_message's data going to rodata. +// A fix for this is planned, and will be taken care of with z_message. +// For now this variable is externed from z_message's rodata.s file. +extern s16 D_80153D80; // todo: rename to `timer` and make this in function static (after rodata issue is resolved) + +void GameOver_Update(GlobalContext* globalCtx) { + GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; + s16 i; + s16 j; + s32 v90; + s32 v91; + s32 v92; + + switch (gameOverCtx->state) { + case GAMEOVER_DEATH_START: + func_80106CCC(globalCtx); + + gSaveContext.timer1State = 0; + gSaveContext.timer2State = 0; + gSaveContext.eventInf[1] &= ~1; + + // search inventory for spoiling items and revert if necessary + for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) { + if (INV_CONTENT(ITEM_POCKET_EGG) == gSpoilingItems[i]) { + INV_CONTENT(gSpoilingItemReverts[i]) = gSpoilingItemReverts[i]; + + // search c buttons for the found spoiling item and revert if necessary + for (j = 1; j < ARRAY_COUNT(gSaveContext.equips.buttonItems); j++) { + if (gSaveContext.equips.buttonItems[j] == gSpoilingItems[i]) { + gSaveContext.equips.buttonItems[j] = gSpoilingItemReverts[i]; + Interface_LoadItemIcon1(globalCtx, j); + } + } + } + } + + // restore "temporary B" to the B Button if not a sword item + if (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI && + gSaveContext.equips.buttonItems[0] != ITEM_SWORD_MASTER && + gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BGS && + gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE) { + + if (gSaveContext.buttonStatus[0] != BTN_ENABLED) { + gSaveContext.equips.buttonItems[0] = gSaveContext.buttonStatus[0]; + } else { + gSaveContext.equips.buttonItems[0] = ITEM_NONE; + } + } + + gSaveContext.nayrusLoveTimer = 2000; + gSaveContext.naviTimer = 0; + gSaveContext.seqIndex = 0xFF; + gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.eventInf[0] = 0; + gSaveContext.eventInf[1] = 0; + gSaveContext.eventInf[2] = 0; + gSaveContext.eventInf[3] = 0; + gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] = + gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED; + gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0; + + Kankyo_InitGameOverLights(globalCtx); + D_80153D80 = 20; + if (1) {} + v90 = VREG(90); + v91 = VREG(91); + v92 = VREG(92); + + func_800AA000(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)), + ((v92 > 0x64) ? 0xFF : (v92 * 0xFF) / 0x64)); + + gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; + break; + + case GAMEOVER_DEATH_WAIT_GROUND: + break; + + case GAMEOVER_DEATH_DELAY_MENU: + D_80153D80--; + + if (D_80153D80 == 0) { + globalCtx->pauseCtx.state = 8; + gameOverCtx->state++; + func_800AA15C(); + } + break; + + case GAMEOVER_REVIVE_START: + gameOverCtx->state++; + D_80153D80 = 0; + Kankyo_InitGameOverLights(globalCtx); + ShrinkWindow_SetVal(0x20); + return; + + case GAMEOVER_REVIVE_RUMBLE: + D_80153D80 = 50; + gameOverCtx->state++; + if (1) {} + + v90 = VREG(90); + v91 = VREG(91); + v92 = VREG(92); + + func_800AA000(0.0f, ((v90 > 0x64) ? 0xFF : (v90 * 0xFF) / 0x64), (CLAMP_MAX(v91 * 3, 0xFF)), + ((v92 > 0x64) ? 0xFF : (v92 * 0xFF) / 0x64)); + break; + + case GAMEOVER_REVIVE_WAIT_GROUND: + D_80153D80--; + + if (D_80153D80 == 0) { + D_80153D80 = 64; + gameOverCtx->state++; + } + break; + + case GAMEOVER_REVIVE_WAIT_FAIRY: + D_80153D80--; + + if (D_80153D80 == 0) { + D_80153D80 = 50; + gameOverCtx->state++; + } + break; + + case GAMEOVER_REVIVE_FADE_OUT: + Kankyo_FadeOutGameOverLights(globalCtx); + D_80153D80--; + + if (D_80153D80 == 0) { + gameOverCtx->state = GAMEOVER_INACTIVE; + } + break; + } +} diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 779aa71eca..b63fc14413 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -42,8 +42,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) { PauseContext* pauseCtx = &globalCtx->pauseCtx; Input* input = &globalCtx->state.input[0]; - if (pauseCtx->state == 0 && pauseCtx->flag == 0 && globalCtx->unk_10A20 == 0 && globalCtx->sceneLoadFlag == 0 && - globalCtx->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 && + if (pauseCtx->state == 0 && pauseCtx->flag == 0 && globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE && + globalCtx->sceneLoadFlag == 0 && globalCtx->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Gameplay_InCsMode(globalCtx) && globalCtx->shootingGalleryStatus <= 1 && gSaveContext.unk_13F0 != 8 && gSaveContext.unk_13F0 != 9 && (globalCtx->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(globalCtx, 0x38))) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index eccb1a7998..baab19ec77 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -54,11 +54,11 @@ f32 func_800746DC() { #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80075E68.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80075F14.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800760F4.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_FadeInGameOverLights.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800763A8.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_FadeOutGameOverLights.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800766C4.s") diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 51039feb3c..c16001cf11 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2453,8 +2453,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { case 7: if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (msgCtx->msgMode == 0) && - (globalCtx->unk_10A20 == 0) && (globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) && - !Gameplay_InCsMode(globalCtx)) { + (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (globalCtx->sceneLoadFlag == 0) && + (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx)) { if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) || ((gSaveContext.equips.buttonItems[1] != ITEM_LENS) && (gSaveContext.equips.buttonItems[2] != ITEM_LENS) && @@ -3414,8 +3414,9 @@ void Interface_Draw(GlobalContext* globalCtx) { } } - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (globalCtx->unk_10A20 == 0) && - (msgCtx->msgMode == 0) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && + if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && + (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == 0) && + !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && (globalCtx->transitionMode == 0) && !Gameplay_InCsMode(globalCtx) && (gSaveContext.minigameState != 1) && (globalCtx->shootingGalleryStatus <= 1) && !((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { @@ -3836,7 +3837,7 @@ void Interface_Update(GlobalContext* globalCtx) { if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneSetupIndex < 4) || ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) { if ((msgCtx->msgMode == 0) || ((msgCtx->msgMode != 0) && (globalCtx->sceneNum == SCENE_BOWLING))) { - if (globalCtx->unk_10A20 == 0) { + if (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) { func_80083108(globalCtx); } } @@ -4056,8 +4057,8 @@ void Interface_Update(GlobalContext* globalCtx) { WREG(7) = interfaceCtx->unk_1F4; if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (msgCtx->msgMode == 0) && - (globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_10A20 == 0) && (globalCtx->transitionMode == 0) && - ((globalCtx->csCtx.state == 0) || !Player_InCsMode(globalCtx))) { + (globalCtx->sceneLoadFlag == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && + (globalCtx->transitionMode == 0) && ((globalCtx->csCtx.state == 0) || !Player_InCsMode(globalCtx))) { if ((gSaveContext.magicAcquired != 0) && (gSaveContext.magicLevel == 0)) { gSaveContext.magicLevel = gSaveContext.doubleMagic + 1; gSaveContext.unk_13F0 = 8; diff --git a/src/code/z_play.c b/src/code/z_play.c index 528e2e0b61..513f754bb9 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -229,7 +229,7 @@ void Gameplay_Init(GameState* thisx) { Sram_Init(globalCtx, &globalCtx->sramCtx); func_80112098(globalCtx); func_80110F68(globalCtx); - func_80110450(globalCtx); + GameOver_Init(globalCtx); func_8006BA00(globalCtx); Effect_InitContext(globalCtx); EffectSs_InitInfo(globalCtx, 0x55); @@ -771,7 +771,8 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1, "../z_play.c", 3542); } - if ((gSaveContext.gameMode == 0) && (globalCtx->msgCtx.msgMode == 0) && (globalCtx->unk_10A20 == 0)) { + if ((gSaveContext.gameMode == 0) && (globalCtx->msgCtx.msgMode == 0) && + (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE)) { KaleidoSetup_Update(globalCtx); } @@ -935,12 +936,12 @@ void Gameplay_Update(GlobalContext* globalCtx) { } KaleidoScopeCall_Update(globalCtx); - } else if (globalCtx->unk_10A20 != 0) { + } else if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) { if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3727); } - func_801104C8(globalCtx); + GameOver_Update(globalCtx); } else { if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3733); @@ -1028,7 +1029,7 @@ skip: } func_80070C24(globalCtx, &globalCtx->envCtx, &globalCtx->lightCtx, &globalCtx->pauseCtx, &globalCtx->msgCtx, - &globalCtx->unk_10A20, globalCtx->state.gfxCtx); + &globalCtx->gameOverCtx, globalCtx->state.gfxCtx); } void Gameplay_DrawOverlayElements(GlobalContext* globalCtx) { @@ -1042,8 +1043,8 @@ void Gameplay_DrawOverlayElements(GlobalContext* globalCtx) { func_8010F58C(globalCtx); - if (globalCtx->unk_10A20 != 0) { - func_80110460(globalCtx); + if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) { + GameOver_FadeInLights(globalCtx); } } diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index cee63cc349..8261911552 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -341,7 +341,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { Math_ApproachF(&this->dyna.actor.world.pos.y, this->unk_168 - 1000.0f, 1.0f, this->dyna.actor.velocity.y); //! Note to whoever tries to match this function: //! daytime commonly needs the (void)0 trick. - //! could help with the temp above and some of these other memes. + //! could help with the temp above and some of these other memes. //! -fig02 (https://github.com/zeldaret/oot/pull/713#discussion_r593921251) if (!gSaveContext.dayTime) { if (1) {} diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 27e0bad760..0aaefe8491 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -72,8 +72,9 @@ void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCt void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) { Flags_UnsetEnv(globalCtx, 5); // clear storms env flag - if (((globalCtx->pauseCtx.state == 0) && (globalCtx->unk_10A20 == 0) && (globalCtx->msgCtx.unk_E300 == 0) && - (!FrameAdvance_IsEnabled(globalCtx)) && ((globalCtx->transitionMode == 0) || (gSaveContext.gameMode != 0))) || + if (((globalCtx->pauseCtx.state == 0) && (globalCtx->gameOverCtx.state == GAMEOVER_INACTIVE) && + (globalCtx->msgCtx.unk_E300 == 0) && (!FrameAdvance_IsEnabled(globalCtx)) && + ((globalCtx->transitionMode == 0) || (gSaveContext.gameMode != 0))) || (this->timer >= 250)) { if (globalCtx->envCtx.unk_1E != 0 || globalCtx->envCtx.unk_1F != 1) { this->timer--; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index bf32134561..64513b48f4 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2768,10 +2768,10 @@ void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* func_800F47BC(); if (Inventory_ConsumeFairy(globalCtx)) { - globalCtx->unk_10A20 = 20; + globalCtx->gameOverCtx.state = GAMEOVER_REVIVE_START; this->unk_84F = 1; } else { - globalCtx->unk_10A20 = 1; + globalCtx->gameOverCtx.state = GAMEOVER_DEATH_START; func_800F6AB0(0); func_800F5C64(0x20); gSaveContext.seqIndex = 0xFF; @@ -7788,8 +7788,8 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) { Player_SpawnFairy(globalCtx, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); func_800800F8(globalCtx, 0x26B4, 125, &this->actor, 0); - } else if (globalCtx->unk_10A20 == 2) { - globalCtx->unk_10A20 = 3; + } else if (globalCtx->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { + globalCtx->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; } }