Handle Dismiss Unit Menu
Jump to navigation
Jump to search
# ROUTINE: Handle Dismiss Unit Menu 80120344: 3c028019 lui r2,0x8019 80120348: 8442d768 lh r2,-0x2898(r2) # *0x8018d768 8012034c: 27bdffd0 addiu r29,r29,-0x0030 80120350: afbf002c sw r31,0x002c(r29) 80120354: afb20028 sw r18,0x0028(r29) 80120358: afb10024 sw r17,0x0024(r29) 8012035c: afb00020 sw r16,0x0020(r29) 80120360: 1040002c beq r2,r0,0x80120414 80120364: 00401821 addu r3,r2,r0 # if (*0x8018d768 != 0) { 80120368: 24620001 addiu r2,r3,0x0001 8012036c: 3c018019 lui r1,0x8019 80120370: a422d768 sh r2,-0x2898(r1) # *0x8018d768 = *0x8018d768 + 1 80120374: 304200ff andi r2,r2,0x00ff # *0x8018d768 & 0xff 80120378: 28420011 slti r2,r2,0x0011 8012037c: 14400108 bne r2,r0,0x801207a0 # if ((*0x8018d768 & 0xff) < 17) return; 80120380: 2402ffff addiu r2,r0,-0x0001 80120384: 3c038019 lui r3,0x8019 80120388: 8463d76c lh r3,-0x2894(r3) # *0x8018d76c 8012038c: 00000000 nop 80120390: 1062001a beq r3,r2,0x801203fc # if (*0x8018d76c == -1) { 80120394: 00008821 addu r17,r0,r0 # ptrOffset = 0 80120398: 3c12801d lui r18,0x801d 8012039c: 2652d5ec addiu r18,r18,-0x2a14 # formationUnitReferenceArray 801203a0: 3c108019 lui r16,0x8019 801203a4: 2610d76c addiu r16,r16,-0x2894 # loadPtr = 0x8018d76c # do { 801203a8: 3c028019 lui r2,0x8019 801203ac: 8442ba20 lh r2,-0x45e0(r2) # selectedFormationUnitIndex 801203b0: 00000000 nop 801203b4: 00021080 sll r2,r2,0x02 801203b8: 00521021 addu r2,r2,r18 801203bc: 8c420000 lw r2,0x0000(r2) # formationUnitReferenceArray[selectedFormationUnitIndex] 801203c0: 00000000 nop 801203c4: 90430072 lbu r3,0x0072(r2) # formationUnitReferenceArray[selectedFormationUnitIndex].BaseClass 801203c8: 86020000 lh r2,0x0000(r16) # *loadPtr 801203cc: 00000000 nop 801203d0: 14620006 bne r3,r2,0x801203ec 801203d4: 26100004 addiu r16,r16,0x0004 # loadPtr += 4 801203d8: 3c018019 lui r1,0x8019 801203dc: 00310821 addu r1,r1,r17 801203e0: 8424d76e lh r4,-0x2892(r1) 801203e4: 0c03bc97 jal 0x800ef25c # Set Script Variable (WORLD.BIN) (*(0x8018d76e + ptrOffset), 12); 801203e8: 3405000c ori r5,r0,0x000c 801203ec: 86030000 lh r3,0x0000(r16) 801203f0: 2402ffff addiu r2,r0,-0x0001 801203f4: 1462ffec bne r3,r2,0x801203a8 801203f8: 26310004 addiu r17,r17,0x0004 # ptrOffset += 4 # } while (*loadPtr != -1); # } 801203fc: 3c048019 lui r4,0x8019 80120400: 8484ba20 lh r4,-0x45e0(r4) 80120404: 0c04824c jal 0x80120930 # Dismiss unit (by formation index) (with checks) (selectedFormationUnitIndex); 80120408: 00000000 nop 8012040c: 080481e4 j 0x80120790 # 80120410: 00000000 nop # } else { 80120414: 3c028019 lui r2,0x8019 80120418: 8042bae7 lb r2,-0x4519(r2) # *0x8018bae7 8012041c: 00000000 nop 80120420: 14400091 bne r2,r0,0x80120668 # if (*0x8018bae7 == 0) { 80120424: 00000000 nop 80120428: 3c048019 lui r4,0x8019 8012042c: 8484ba20 lh r4,-0x45e0(r4) # selectedFormationUnitIndex 80120430: 00000000 nop 80120434: 00041080 sll r2,r4,0x02 80120438: 3c01801d lui r1,0x801d 8012043c: 00220821 addu r1,r1,r2 80120440: 8c22d5ec lw r2,-0x2a14(r1) # formationUnitReferenceArray[selectedFormationUnitIndex] 80120444: 00000000 nop 80120448: 9042011f lbu r2,0x011f(r2) # formationUnitReferenceArray[selectedFormationUnitIndex].PropositionValue 8012044c: 3c10801d lui r16,0x801d 80120450: 2610d5ec addiu r16,r16,-0x2a14 # formationUnitReferenceArray 80120454: 10400009 beq r2,r0,0x8012047c # if (formationUnitReferenceArray[selectedFormationUnitIndex].PropositionValue != 0) { 80120458: 00000000 nop 8012045c: 3404c012 ori r4,r0,0xc012 80120460: 0c044d3a jal 0x801134e8 # 0x1134e8 (0xc012, 0x30); 80120464: 34050030 ori r5,r0,0x0030 80120468: 34020002 ori r2,r0,0x0002 8012046c: 3c01801d lui r1,0x801d 80120470: a0228600 sb r2,-0x7a00(r1) # *0x801c8600 = 2 80120474: 08048195 j 0x80120654 80120478: 34020001 ori r2,r0,0x0001 # } else { 8012047c: 0c04823e jal 0x801208f8 # isDismissable = Dismiss-able check (); 80120480: 00000000 nop 80120484: 3c01801d lui r1,0x801d 80120488: a0228600 sb r2,-0x7a00(r1) # *0x801c8600 = isDismissable 8012048c: 0c04b5ed jal 0x8012d7b4 # 0x12d7b4 (4); // Stores pointer at specific location based on input parameter. (Example: *0x801cd918 = 0x80190578) 80120490: 34040004 ori r4,r0,0x0004 80120494: 3c028019 lui r2,0x8019 80120498: 9042ba27 lbu r2,-0x45d9(r2) # *0x8018ba27 8012049c: 00000000 nop 801204a0: 10400003 beq r2,r0,0x801204b0 # if (*0x8018ba27 != 0) { 801204a4: 34020001 ori r2,r0,0x0001 801204a8: 3c018019 lui r1,0x8019 801204ac: a022ba24 sb r2,-0x45dc(r1) # *0x8018ba24 = 1 # } 801204b0: 3c028019 lui r2,0x8019 801204b4: 8442ba20 lh r2,-0x45e0(r2) # selectedFormationUnitIndex 801204b8: 00000000 nop 801204bc: 00021080 sll r2,r2,0x02 801204c0: 00501021 addu r2,r2,r16 801204c4: 8c430000 lw r3,0x0000(r2) # formationUnitReferenceArray[selectedFormationUnitIndex] 801204c8: 00000000 nop 801204cc: 8463002c lh r3,0x002c(r3) # formationUnitReferenceArray[selectedFormationUnitIndex].partyIndex 801204d0: 3c018015 lui r1,0x8015 801204d4: ac2331d8 sw r3,0x31d8(r1) # *0x801531d8 = formationUnitReferenceArray[selectedFormationUnitIndex].partyIndex 801204d8: 8c430000 lw r3,0x0000(r2) # formationUnitReferenceArray[selectedFormationUnitIndex] 801204dc: 00000000 nop 801204e0: 90640072 lbu r4,0x0072(r3) # formationUnitReferenceArray[selectedFormationUnitIndex].BaseClass 801204e4: 00000000 nop 801204e8: 2882004b slti r2,r4,0x004b 801204ec: 14400028 bne r2,r0,0x80120590 801204f0: 34020048 ori r2,r0,0x0048 # if (formationUnitReferenceArray[selectedFormationUnitIndex].BaseClass >= 0x4b) { 801204f4: 90630070 lbu r3,0x0070(r3) # formationUnitReferenceArray[selectedFormationUnitIndex].Flags 801204f8: 00000000 nop 801204fc: 30620080 andi r2,r3,0x0080 # formationUnitReferenceArray[selectedFormationUnitIndex].Flags & FLAGS_MALE 80120500: 1040000b beq r2,r0,0x80120530 80120504: 30620040 andi r2,r3,0x0040 # if (formationUnitReferenceArray[selectedFormationUnitIndex].Flags & FLAGS_MALE) { 80120508: 0c0088c3 jal 0x8002230c # randomValue = rand(); 8012050c: 00000000 nop 80120510: 00401821 addu r3,r2,r0 80120514: 04610002 bgez r3,0x80120520 # if (randomValue < 0) { 80120518: 00000000 nop 8012051c: 24620007 addiu r2,r3,0x0007 # randomValue += 7 # } 80120520: 000220c3 sra r4,r2,0x03 80120524: 000410c0 sll r2,r4,0x03 80120528: 0804816f j 0x801205bc 8012052c: 00622023 subu r4,r3,r2 # value = randomValue % 8 80120530: 1040000c beq r2,r0,0x80120564 # } else if (formationUnitReferenceArray[selectedFormationUnitIndex].Flags & FLAGS_FEMALE) { 80120534: 00000000 nop 80120538: 0c0088c3 jal 0x8002230c # randomValue = rand(); 8012053c: 00000000 nop 80120540: 00401821 addu r3,r2,r0 80120544: 04610003 bgez r3,0x80120554 # if (randomValue < 0) { 80120548: 000210c3 sra r2,r2,0x03 8012054c: 24620007 addiu r2,r3,0x0007 # randomValue += 7 80120550: 000210c3 sra r2,r2,0x03 # } 80120554: 000210c0 sll r2,r2,0x03 80120558: 00621023 subu r2,r3,r2 # randomValue % 8 8012055c: 0804816f j 0x801205bc 80120560: 24440008 addiu r4,r2,0x0008 # value = (randomValue % 8) + 8 # } else { 80120564: 0c0088c3 jal 0x8002230c # randomValue = rand(); 80120568: 00000000 nop 8012056c: 00401821 addu r3,r2,r0 80120570: 04610003 bgez r3,0x80120580 # if (randomValue < 0) { 80120574: 000210c3 sra r2,r2,0x03 80120578: 24620007 addiu r2,r3,0x0007 # randomValue += 7 8012057c: 000210c3 sra r2,r2,0x03 # } 80120580: 000210c0 sll r2,r2,0x03 80120584: 00621023 subu r2,r3,r2 # randomValue % 8 80120588: 0804816f j 0x801205bc 8012058c: 24440010 addiu r4,r2,0x0010 # value = (randomValue % 8) + 16 # } # } else { 80120590: 14820002 bne r4,r2,0x8012059c # if (formationUnitReferenceArray[selectedFormationUnitIndex].BaseClass == 0x48) { // Holy Dragon 80120594: 00000000 nop 80120598: 34040049 ori r4,r0,0x0049 # value = 0x49 # } 8012059c: 3c02801d lui r2,0x801d 801205a0: 90428600 lbu r2,-0x7a00(r2) # *0x801c8600 801205a4: 00000000 nop 801205a8: 10400003 beq r2,r0,0x801205b8 # if (*0x801c8600 != 0) { 801205ac: 00000000 nop 801205b0: 0804816f j 0x801205bc 801205b4: 24840017 addiu r4,r4,0x0017 # value = value + 0x17 # } else { 801205b8: 24840061 addiu r4,r4,0x0061 # value = value + 0x61 # } # } 801205bc: 3402e800 ori r2,r0,0xe800 # 0xe800 801205c0: 3c03801d lui r3,0x801d 801205c4: 90638600 lbu r3,-0x7a00(r3) # *0x801c8600 801205c8: 00000000 nop 801205cc: 14600013 bne r3,r0,0x8012061c 801205d0: 00822821 addu r5,r4,r2 # value = value + 0xe800 # if (*0x801c8600 == 0) { 801205d4: 3c03801d lui r3,0x801d 801205d8: 9063d80c lbu r3,-0x27f4(r3) # *0x801cd80c 801205dc: 34020001 ori r2,r0,0x0001 801205e0: 3c018015 lui r1,0x8015 801205e4: ac2232a0 sw r2,0x32a0(r1) # *0x801532a0 = 1 801205e8: 3c028019 lui r2,0x8019 801205ec: 2442d72c addiu r2,r2,-0x28d4 # 0x8018d72c 801205f0: 3c01801d lui r1,0x801d 801205f4: ac228604 sw r2,-0x79fc(r1) # *0x801c8604 = 0x8018d72c 801205f8: 10600002 beq r3,r0,0x80120604 801205fc: 3404001a ori r4,r0,0x001a # storeValue = 0x1a # if (*0x801cd80c != 0) { 80120600: 34040019 ori r4,r0,0x0019 # storeValue = 0x19 # } 80120604: 3c018019 lui r1,0x8019 80120608: a424d758 sh r4,-0x28a8(r1) # *0x8018d758 = storeValue 8012060c: 3c018019 lui r1,0x8019 80120610: a425d748 sh r5,-0x28b8(r1) # *0x8018d748 = value 80120614: 08048195 j 0x80120654 80120618: 34020001 ori r2,r0,0x0001 # } else { 8012061c: 3c02801d lui r2,0x801d 80120620: 9042d80c lbu r2,-0x27f4(r2) # *0x801cd80c 80120624: 3c038019 lui r3,0x8019 80120628: 2463d548 addiu r3,r3,-0x2ab8 # storePtr = 0x8018d548 8012062c: 10400003 beq r2,r0,0x8012063c # if (*0x801cd80c != 0) { 80120630: 00000000 nop 80120634: 3c038019 lui r3,0x8019 80120638: 2463d638 addiu r3,r3,-0x29c8 # storePtr = 0x8018d638 # } 8012063c: 3c01801d lui r1,0x801d 80120640: ac238604 sw r3,-0x79fc(r1) # *0x801c8604 = storePtr 80120644: a4600074 sh r0,0x0074(r3) # storePtr.0x74 = 0 80120648: a46000ec sh r0,0x00ec(r3) # storePtr.0xec = 0 8012064c: a4650094 sh r5,0x0094(r3) # storePtr.0x94 = value 80120650: 34020001 ori r2,r0,0x0001 # } # } 80120654: 3c018019 lui r1,0x8019 80120658: a022bae7 sb r2,-0x4519(r1) # *0x8018bae7 = 1 8012065c: 2402ffff addiu r2,r0,-0x0001 80120660: 3c01801d lui r1,0x801d 80120664: ac22d754 sw r2,-0x28ac(r1) # *0x801cd754 = -1 # } 80120668: 3c03801d lui r3,0x801d 8012066c: 90638600 lbu r3,-0x7a00(r3) # *0x801c8600 80120670: 34020002 ori r2,r0,0x0002 80120674: 1462000a bne r3,r2,0x801206a0 # if (*0x801c8600 == 2) { 80120678: 00000000 nop 8012067c: 0c03ffbb jal 0x800ffeec # isRunning = Check Thread Running Status (WORLD.BIN) (1); 80120680: 34040001 ori r4,r0,0x0001 80120684: 3c018019 lui r1,0x8019 80120688: a022bae7 sb r2,-0x4519(r1) # *0x8018bae7 = isRunning 8012068c: 00021600 sll r2,r2,0x18 80120690: 10400041 beq r2,r0,0x80120798 # if (isRunning == 0) { *0x8018ba1c = 0; return; } 80120694: 00000000 nop 80120698: 080481e8 j 0x801207a0 # return; 8012069c: 00000000 nop # } 801206a0: 3c05801d lui r5,0x801d 801206a4: 8ca58604 lw r5,-0x79fc(r5) 801206a8: 0c04aade jal 0x8012ab78 # Run Menu Thread (WORLD.BIN) (6, *0x801c8604); 801206ac: 34040006 ori r4,r0,0x0006 801206b0: 3c03801d lui r3,0x801d 801206b4: 90638600 lbu r3,-0x7a00(r3) # *0x801c8600 801206b8: 3c018019 lui r1,0x8019 801206bc: a022bae7 sb r2,-0x4519(r1) # *0x8018bae7 = isRunning 801206c0: 10600031 beq r3,r0,0x80120788 801206c4: 00021600 sll r2,r2,0x18 # if (*0x801c8600 != 0) { 801206c8: 0c03ffbb jal 0x800ffeec # isRunning3 = Check Thread Running Status (WORLD.BIN) (3); 801206cc: 34040003 ori r4,r0,0x0003 801206d0: 1040001a beq r2,r0,0x8012073c 801206d4: 34020001 ori r2,r0,0x0001 # if (isRunning3) { 801206d8: 3c03801d lui r3,0x801d 801206dc: 90638600 lbu r3,-0x7a00(r3) # *0x801c8600 801206e0: 00000000 nop 801206e4: 14620015 bne r3,r2,0x8012073c # if (*0x801c8600 == 1) { 801206e8: 00000000 nop 801206ec: 3c02801d lui r2,0x801d 801206f0: 8442d73c lh r2,-0x28c4(r2) # *0x801cd73c 801206f4: 3c018015 lui r1,0x8015 801206f8: ac2332a0 sw r3,0x32a0(r1) # *0x801532a0 = *0x801c8600 801206fc: 14400003 bne r2,r0,0x8012070c # if (*0x801cd73c == 0) { 80120700: 00000000 nop 80120704: 080481c5 j 0x80120714 80120708: 34020009 ori r2,r0,0x0009 # storeSoundEffectID = 9 # } else { 8012070c: 14430003 bne r2,r3,0x8012071c # if (*0x801cd73c == *0x801c8600) { 80120710: 34020001 ori r2,r0,0x0001 # storeSoundEffectID = 1 # } else { doNotStoreSoundEffectID = true } # } # if (!doNotStoreSoundEffectID) { 80120714: 3c018019 lui r1,0x8019 80120718: a022bacc sb r2,-0x4534(r1) # soundEffectID = storeSoundEffectID # } 8012071c: 3c028019 lui r2,0x8019 80120720: 9042bacc lbu r2,-0x4534(r2) # soundEffectID 80120724: 00000000 nop 80120728: 10400002 beq r2,r0,0x80120734 8012072c: 34030001 ori r3,r0,0x0001 # storeValue = 1 # if (soundEffectID != 0) { 80120730: 34030064 ori r3,r0,0x0064 # storeValue = 100 # } 80120734: 3c01801d lui r1,0x801d 80120738: a0238600 sb r3,-0x7a00(r1) # *0x801c8600 = storeValue # } # } 8012073c: 3c028019 lui r2,0x8019 80120740: 8042bae7 lb r2,-0x4519(r2) # *0x8019bae7 80120744: 00000000 nop 80120748: 14400015 bne r2,r0,0x801207a0 # if (*0x8019bae7 != 0) return; 8012074c: 00000000 nop 80120750: 3c02801d lui r2,0x801d 80120754: 8442d73c lh r2,-0x28c4(r2) # *0x801cd73c 80120758: 00000000 nop 8012075c: 1440000c bne r2,r0,0x80120790 # if (*0x801cd73c != 0) { *0x801532a0 = 0; *0x8018ba1c = 0; return; } 80120760: 00000000 nop 80120764: 3c028019 lui r2,0x8019 80120768: 9442ba20 lhu r2,-0x45e0(r2) # selectedFormationUnitIndex 8012076c: 00000000 nop 80120770: 00021200 sll r2,r2,0x08 # selectedFormationUnitIndex * 256 80120774: 24420001 addiu r2,r2,0x0001 # (selectedFormationUnitIndex * 256) + 1 80120778: 3c018019 lui r1,0x8019 8012077c: a422d768 sh r2,-0x2898(r1) # *0x8018d768 = (selectedFormationUnitIndex * 256) + 1 80120780: 080481e8 j 0x801207a0 # return; 80120784: 00000000 nop # } 80120788: 14400005 bne r2,r0,0x801207a0 # if (isRunning) return; 8012078c: 00000000 nop # } 80120790: 3c018015 lui r1,0x8015 80120794: ac2032a0 sw r0,0x32a0(r1) # *0x801532a0 = 0 80120798: 3c018019 lui r1,0x8019 8012079c: ac20ba1c sw r0,-0x45e4(r1) # *0x8018ba1c = 0 801207a0: 8fbf002c lw r31,0x002c(r29) 801207a4: 8fb20028 lw r18,0x0028(r29) 801207a8: 8fb10024 lw r17,0x0024(r29) 801207ac: 8fb00020 lw r16,0x0020(r29) 801207b0: 27bd0030 addiu r29,r29,0x0030 801207b4: 03e00008 jr r31 801207b8: 00000000 nop