Display Inner Character Window

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: DISPLAY INNER CHARACTER WINDOW
#       Handles displaying the window that appears when the O button is pressed on the in-battle character window.
#           For units with at least one status effect, this is the status window.
#           For allies without a status effect, this is the screen that shows the Job information for the unit.
#       No parameters.

00133cec: 27bdffe0 addiu r29,r29,-0x0020
00133cf0: 00002821 addu r5,r0,r0                #   counter = 0
00133cf4: 3c098015 lui r9,0x8015
00133cf8: 2529d0ae addiu r9,r9,-0x2f52          #   (0x8014d0ae) Pointer to Billboard data: Primary Skillset?
00133cfc: 3c088015 lui r8,0x8015
00133d00: 2508d03a addiu r8,r8,-0x2fc6          #   (0x8014d03a)
00133d04: 34070001 ori r7,r0,0x0001             #   1
00133d08: 3c038016 lui r3,0x8016
00133d0c: 24636a60 addiu r3,r3,0x6a60           #   (0x80166a60)
00133d10: 340607d0 ori r6,r0,0x07d0             #   0x7d0
00133d14: 34041015 ori r4,r0,0x1015             #   0x1015
00133d18: afbf0018 sw r31,0x0018(r29)
00133d1c: afb10014 sw r17,0x0014(r29)
00133d20: afb00010 sw r16,0x0010(r29)
                                                #   do {
00133d24: 85220000 lh r2,0x0000(r9)             #       Primary skillset?
00133d28: 00000000 nop
00133d2c: 14400005 bne r2,r0,0x00133d44         #       if (([Primary skillset?] == 0)
00133d30: 30a2ffff andi r2,r5,0xffff
00133d34: 85020000 lh r2,0x0000(r8)             #           RAM_HALFWORD[0x8014d03a]    
00133d38: 00000000 nop
00133d3c: 14470005 bne r2,r7,0x00133d54
00133d40: 30a2ffff andi r2,r5,0xffff
                                                #           OR (RAM_HALFWORD[0x8014d03a] == 1) {
00133d44: 00021040 sll r2,r2,0x01               #           counter * 2
00133d48: 00431021 addu r2,r2,r3                #           counter * 2 + 0x80166a60
00133d4c: 0804cf58 j 0x00133d60
00133d50: a4460000 sh r6,0x0000(r2)             #           RAM_HALFWORD[counter * 2 + 0x80166a60] = 0x7d0
                                                #       } else {
00133d54: 00021040 sll r2,r2,0x01               #           counter * 2
00133d58: 00431021 addu r2,r2,r3                #           counter * 2 + 0x80166a60
00133d5c: a4440000 sh r4,0x0000(r2)             #           RAM_HALFWORD[counter * 2 + 0x80166a60] = 0x1015
                                                #       }
00133d60: 24a50001 addiu r5,r5,0x0001           #       counter = counter + 1
00133d64: 30a2ffff andi r2,r5,0xffff
00133d68: 2c420008 sltiu r2,r2,0x0008
00133d6c: 1440ffed bne r2,r0,0x00133d24
00133d70: 00000000 nop
                                                #   } while (counter < 8)

#   Empty the status column arrays
00133d74: 3c048015 lui r4,0x8015
00133d78: 8484d08a lh r4,-0x2f76(r4)            #   Unit index (RAM_HALFWORD[0x8014d08a])
00133d7c: 0c0602bf jal 0x00180afc               #   ROUTINE: Get Unit's Data Pointer
00133d80: 00000000 nop                          #       (Parameter: [Unit index])
00133d84: 00406021 addu r12,r2,r0               #   Unit
00133d88: 00002821 addu r5,r0,r0                #   counter = 0
00133d8c: 3c088017 lui r8,0x8017
00133d90: 250897d8 addiu r8,r8,-0x6828          #   0x801697d8
00133d94: 34047000 ori r4,r0,0x7000             #   (0x7000) Empty text?
00133d98: 3c078017 lui r7,0x8017
00133d9c: 24e79800 addiu r7,r7,-0x6800          #   0x80169800
00133da0: 3c068015 lui r6,0x8015
00133da4: 24c6d264 addiu r6,r6,-0x2d9c          #   (0x8014d264) Pointer to unit abilities display
00133da8: 30a2ffff andi r2,r5,0xffff            #   (old counter) = counter
                                                #   do {
00133dac: 24a50001 addiu r5,r5,0x0001           #       counter = counter + 1
00133db0: 00021040 sll r2,r2,0x01               #       (old counter) * 2
00133db4: 00481821 addu r3,r2,r8                #       (old counter) * 2 + 0x801697d8
00133db8: a4640000 sh r4,0x0000(r3)             #       RAM_HALFWORD[(old counter) * 2 + 0x801697d8] = 0x7000
00133dbc: 00471821 addu r3,r2,r7                #       (old counter) * 2 + 0x80169800
00133dc0: 00461021 addu r2,r2,r6                #       (old counter) * 2 + 0x8014d264
00133dc4: a4640000 sh r4,0x0000(r3)             #       RAM_HALFWORD[(old counter) * 2 + 0x80169800] = 0x7000
00133dc8: a4400000 sh r0,0x0000(r2)             #       Set ability display = normal display (RAM_HALFWORD[(old counter) * 2 + 0x8014d264] = 0)
00133dcc: 30a2ffff andi r2,r5,0xffff            
00133dd0: 2c420014 sltiu r2,r2,0x0014
00133dd4: 1440fff5 bne r2,r0,0x00133dac
00133dd8: 30a2ffff andi r2,r5,0xffff            #       (old counter) = counter
                                                #   } while (counter < 20)

#   Fill the status column arrays                                                
00133ddc: 00008021 addu r16,r0,r0               #   [Unit status count] = 0
00133de0: 00002821 addu r5,r0,r0                #   [Status byte index] = 0
00133de4: 3c0b8017 lui r11,0x8017
00133de8: 256b9800 addiu r11,r11,-0x6800        #   0x80169800
00133dec: 34098800 ori r9,r0,0x8800             #   0x8800
00133df0: 3c0a8017 lui r10,0x8017
00133df4: 254a97d8 addiu r10,r10,-0x6828        #   0x801697d8
00133df8: 34060080 ori r6,r0,0x0080             #   [Current status flag] = 0x80
                                                #   do {
00133dfc: 00002021 addu r4,r0,r0                #       [Inner counter] = 0
00133e00: 30a2ffff andi r2,r5,0xffff            #       [Status byte index]
00133e04: 01824021 addu r8,r12,r2               #       (Pointer to current status byte of Unit)     
00133e08: 000238c0 sll r7,r2,0x03               #       [Status byte index] * 8
                                                #       do {
00133e0c: 91020058 lbu r2,0x0058(r8)            #           [Current status byte]
00133e10: 00000000 nop
00133e14: 00c21024 and r2,r6,r2                 #           Check for [Current status flag] in [Current status byte] (i.e. does unit have this status?)
00133e18: 1040000b beq r2,r0,0x00133e48
00133e1c: 32020001 andi r2,r16,0x0001
                                                #           if (Unit has status) {
00133e20: 10400004 beq r2,r0,0x00133e34
00133e24: 00871821 addu r3,r4,r7                #               [Inner counter] + [Status byte index] * 8
                                                #               if ([Unit status count] is odd) {
00133e28: 3202fffe andi r2,r16,0xfffe           #                   [Unit status count] - 1
00133e2c: 0804cf8f j 0x00133e3c
00133e30: 004b1021 addu r2,r2,r11               #                   savePointer = ([Unit status count] - 1) + 0x80169800    // (For right side of window?)
                                                #               } else {
00133e34: 3202fffe andi r2,r16,0xfffe           
00133e38: 004a1021 addu r2,r2,r10               #                   savePointer = [Unit status count] + 0x801697d8          // (For left side of window?)
                                                #               }
00133e3c: 00691821 addu r3,r3,r9                #               ([Inner counter] + [Status byte index] * 8) + 0x8800
00133e40: a4430000 sh r3,0x0000(r2)             #               RAM_HALFWORD[savePointer] = ([Inner counter] + [Status byte index] * 8) + 0x8800
00133e44: 26100001 addiu r16,r16,0x0001         #               [Unit status count] = [Unit status count] + 1
                                                #           }
00133e48: 24840001 addiu r4,r4,0x0001           #           [Inner counter] = [Inner counter] + 1
00133e4c: 3082ffff andi r2,r4,0xffff
00133e50: 2c420008 sltiu r2,r2,0x0008
00133e54: 1440ffed bne r2,r0,0x00133e0c
00133e58: 00063042 srl r6,r6,0x01               #           [Current status flag] = [Current status flag] >> 1
                                                #       } while ([Inner counter] < 8)
00133e5c: 24a50001 addiu r5,r5,0x0001           #       [Status byte index] = [Status byte index] + 1
00133e60: 30a2ffff andi r2,r5,0xffff
00133e64: 2c420005 sltiu r2,r2,0x0005
00133e68: 1440ffe4 bne r2,r0,0x00133dfc
00133e6c: 34060080 ori r6,r0,0x0080             #       [Current status flag] = 0x80
                                                #   } while ([Status byte index] < 5)
00133e70: 0c04b747 jal 0x0012dd1c               #   ROUTINE: Set RAM_WORD[0x80165fb4] = 1
00133e74: 3211ffff andi r17,r16,0xffff
00133e78: 16200004 bne r17,r0,0x00133e8c
00133e7c: 32020001 andi r2,r16,0x0001
                                                #   if ([Unit status count] == 0) {
00133e80: 0c04f0b7 jal 0x0013c2dc               #       ROUTINE: ? 0x13c2dc (Conditionally display job information window?)
00133e84: 00000000 nop
00133e88: 32020001 andi r2,r16,0x0001
                                                #   }
00133e8c: 00111842 srl r3,r17,0x01              #   [Unit status count] / 2
00133e90: 00621821 addu r3,r3,r2                #   numRows = ([Unit status count] / 2) + ([Unit status count] % 2)
00133e94: 00608021 addu r16,r3,r0
00133e98: 2e020008 sltiu r2,r16,0x0008
00133e9c: 14400008 bne r2,r0,0x00133ec0
00133ea0: 34020007 ori r2,r0,0x0007
                                                #   if (numRows >= 8) {
00133ea4: 3c018016 lui r1,0x8016
00133ea8: a42269c0 sh r2,0x69c0(r1)             #       RAM_HALFWORD[0x801669c0] = 7                // Number of rows shown at once
00133eac: 2462fff9 addiu r2,r3,-0x0007          #       numRows - 7
00133eb0: 3c018016 lui r1,0x8016
00133eb4: a42269c2 sh r2,0x69c2(r1)             #       RAM_HALFWORD[0x801669c2] = numRows - 7      // Number of additional rows (scroll)
00133eb8: 0804cfb4 j 0x00133ed0
00133ebc: 00000000 nop
                                                #   } else {
00133ec0: 3c018016 lui r1,0x8016
00133ec4: a43069c0 sh r16,0x69c0(r1)            #       RAM_HALFWORD[0x801669c0] = numRows          // Number of rows shown at once
00133ec8: 3c018016 lui r1,0x8016
00133ecc: a42069c2 sh r0,0x69c2(r1)             #       RAM_HALFWORD[0x801669c2] = 0                // Number of additional rows (scroll)
                                                #   }
00133ed0: 0c04e6fb jal 0x00139bec               #   ROUTINE: 00139bec - 0013aed8
00133ed4: 00000000 nop
00133ed8: 8fbf0018 lw r31,0x0018(r29)
00133edc: 8fb10014 lw r17,0x0014(r29)
00133ee0: 8fb00010 lw r16,0x0010(r29)
00133ee4: 27bd0020 addiu r29,r29,0x0020
00133ee8: 03e00008 jr r31
00133eec: 00000000 nop