Display Birthday Menu Text

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: DISPLAY BIRTHDAY MENU TEXT
#       Parameters:
#           r4 = (input) (Struct pointer) (Entries are 4-byte words)
#               0x00: ?
#               0x0c: ?
#               0x20: (Month) Currently selected month (1 to 12)
#               0x24: (Day) Currently selected day
#               0x28: (Selection) Which selection is being made
#                   0 = Day
#                   1 = Month

8006b990: 27bdffa8 addiu r29,r29,-0x0058
8006b994: afb5004c sw r21,0x004c(r29)
8006b998: 0080a821 addu r21,r4,r0                   #   input
8006b99c: 3c048008 lui r4,0x8008
8006b9a0: 24845f44 addiu r4,r4,0x5f44               #   0x80085f44
8006b9a4: 3c058008 lui r5,0x8008
8006b9a8: 24a55fc4 addiu r5,r5,0x5fc4               #   0x80085fc4
8006b9ac: afbf0050 sw r31,0x0050(r29)
8006b9b0: afb40048 sw r20,0x0048(r29)
8006b9b4: afb30044 sw r19,0x0044(r29)
8006b9b8: afb20040 sw r18,0x0040(r29)
8006b9bc: afb1003c sw r17,0x003c(r29)
8006b9c0: 0c01a5ec jal 0x800697b0                   #   result_0x697b0 = ? 0x697b0 (0x80085f44, 0x80085fc4);        // (Seems to always return 1)
8006b9c4: afb00038 sw r16,0x0038(r29)
8006b9c8: 00408821 addu r17,r2,r0                   #   result_0x697b0
8006b9cc: 02202021 addu r4,r17,r0                   #   result_0x697b0
8006b9d0: 00003821 addu r7,r0,r0                    #   0
8006b9d4: 34020040 ori r2,r0,0x0040                 #   0x40
8006b9d8: aeb1000c sw r17,0x000c(r21)               #   input.0x0c = result_0x697b0
8006b9dc: a7a2001a sh r2,0x001a(r29)                #   0x40
8006b9e0: 34020050 ori r2,r0,0x0050                 #   0x50        // Window width (bottom window)
8006b9e4: a7a2001c sh r2,0x001c(r29)                #   0x50
8006b9e8: 34020020 ori r2,r0,0x0020                 #   0x20        // Window height (bottom window)
8006b9ec: 3c138008 lui r19,0x8008
8006b9f0: 26737030 addiu r19,r19,0x7030             #   0x80087030
8006b9f4: a7a00018 sh r0,0x0018(r29)                #   0
8006b9f8: a7a2001e sh r2,0x001e(r29)                #   0x20
8006b9fc: afb30010 sw r19,0x0010(r29)               #   0x80087030
8006ba00: 97a30018 lhu r3,0x0018(r29)               #   0
8006ba04: 97a5001a lhu r5,0x001a(r29)               #   0x40
8006ba08: 97a8001c lhu r8,0x001c(r29)               #   0x50
8006ba0c: 97a6001e lhu r6,0x001e(r29)               #   0x20
8006ba10: 00052c00 sll r5,r5,0x10                   #   0x400000
8006ba14: 00652825 or r5,r3,r5                      #   0x400000
8006ba18: 00063400 sll r6,r6,0x10                   #   0x200000
8006ba1c: 0c01b1d4 jal 0x8006c750                   #   ? 0x6c750 (result_0x697b0, 0x400000, 0x200050, 0, 0x80087030);      // Set up windows?
8006ba20: 01063025 or r6,r8,r6                      #   0x200050
8006ba24: 8eb00020 lw r16,0x0020(r21)               #   input.Month
8006ba28: 3402b802 ori r2,r0,0xb802                 #   0xb802
8006ba2c: 02028021 addu r16,r16,r2                  #   textIndex = input.Month + 0xb802
8006ba30: 0c039bb7 jal 0x800e6edc                   #   textEntry = Find Text Entry (WORLD.BIN) (input.Month + 0xb802);
8006ba34: 02002021 addu r4,r16,r0
8006ba38: 27a40028 addiu r4,r29,0x0028              #   localX
8006ba3c: 27a5002a addiu r5,r29,0x002a              #   localY
8006ba40: 0c03919a jal 0x800e4668                   #   Find Text Coordinates (WORLD.BIN) (&localX, &localY, textEntry);
8006ba44: 00403021 addu r6,r2,r0
8006ba48: 02202021 addu r4,r17,r0                   #   result_0x697b0
8006ba4c: 3405b801 ori r5,r0,0xb801                 #   0xb801
8006ba50: 97a20028 lhu r2,0x0028(r29)               #   localX
8006ba54: 34140008 ori r20,r0,0x0008                #   8
8006ba58: afb40024 sw r20,0x0024(r29)               #   8
8006ba5c: 00021400 sll r2,r2,0x10
8006ba60: 00021c03 sra r3,r2,0x10                   #   localX (sign extended - why not use lh??)
8006ba64: 000217c2 srl r2,r2,0x1f
8006ba68: 00621821 addu r3,r3,r2                    
8006ba6c: 00031843 sra r3,r3,0x01                   #   localX = localX / 2 (rounded up if negative)
8006ba70: 3402001c ori r2,r0,0x001c                 #   28
8006ba74: 00431023 subu r2,r2,r3                    #   xCoord = 28 - localX
8006ba78: afa20020 sw r2,0x0020(r29)                #   xCoord
8006ba7c: afb30010 sw r19,0x0010(r29)               #   0x80087030
8006ba80: 8fa60020 lw r6,0x0020(r29)                #   xCoord
8006ba84: 8fa70024 lw r7,0x0024(r29)                #   8
8006ba88: 3c128015 lui r18,0x8015
8006ba8c: 265231d8 addiu r18,r18,0x31d8             #   &displayTextIndex (0x801531d8)
8006ba90: 0c01b25b jal 0x8006c96c                   #   Display Birthday Menu Text Entry (result_0x697b0, 0xb801, xCoord, 8, 0x80087030);
8006ba94: ae500000 sw r16,0x0000(r18)               #   displayTextIndex = textIndex
8006ba98: 34020030 ori r2,r0,0x0030                 #   0x30
8006ba9c: afa20020 sw r2,0x0020(r29)                #   xCoord = 0x30 = 48
8006baa0: afb40024 sw r20,0x0024(r29)               #   8
8006baa4: 8ea20024 lw r2,0x0024(r21)                #   input.Day
8006baa8: 02202021 addu r4,r17,r0                   #   result_0x697b0
8006baac: afb30010 sw r19,0x0010(r29)               #   0x80087030
8006bab0: 8fa60020 lw r6,0x0020(r29)                #   xCoord
8006bab4: 8fa70024 lw r7,0x0024(r29)                #   8
8006bab8: 3405b802 ori r5,r0,0xb802                 #   0xb802
8006babc: 0c01b25b jal 0x8006c96c                   #   Display Birthday Menu Text Entry (result_0x697b0, 0xb802, xCoord, 8, 0x80087030);
8006bac0: ae420000 sw r2,0x0000(r18)                #   displayTextIndex = input.Day
8006bac4: 02202021 addu r4,r17,r0                   #   result_0x697b0
8006bac8: 0c01b22a jal 0x8006c8a8                   #   ? 0x6c8a8 (result_0x697b0, 0x80087030);
8006bacc: 02602821 addu r5,r19,r0                   #   0x80087030
8006bad0: 3c058008 lui r5,0x8008
8006bad4: 24a560b4 addiu r5,r5,0x60b4               #   0x800860b4
8006bad8: 001120c0 sll r4,r17,0x03                  #   result_0x697b0 * 8
8006badc: 00912023 subu r4,r4,r17                   #   result_0x697b0 * 7
8006bae0: 000420c0 sll r4,r4,0x03                   #   result_0x697b0 * 56
8006bae4: 00852821 addu r5,r4,r5                    #   0x800860b4 + (result_0x697b0 * 56)
8006bae8: 97a3001c lhu r3,0x001c(r29)               #   0x50
8006baec: 2402fff0 addiu r2,r0,-0x0010              #   0xfffffff0
8006baf0: aca20004 sw r2,0x0004(r5)                 #   *(0x800860b8 + (result_0x697b0 * 56)) = 0xfffffff0
8006baf4: 00031c00 sll r3,r3,0x10                   
8006baf8: 00031403 sra r2,r3,0x10                   #   0x50
8006bafc: 00031fc2 srl r3,r3,0x1f
8006bb00: 00431021 addu r2,r2,r3                    #   0x50
8006bb04: 00021043 sra r2,r2,0x01                   #   0x28
8006bb08: 00021023 subu r2,r0,r2                    #   -0x28
8006bb0c: aca20000 sw r2,0x0000(r5)                 #   *(0x800860b4 + (result_0x697b0 * 56)) = -0x28
8006bb10: 34020004 ori r2,r0,0x0004                 #   4
8006bb14: 3c018008 lui r1,0x8008
8006bb18: 242160a4 addiu r1,r1,0x60a4               #   0x800860a4
8006bb1c: 00240821 addu r1,r1,r4                    #   0x800860a4 + (result_0x697b0 * 56)
8006bb20: ac220000 sw r2,0x0000(r1)                 #   *(0x800860a4 + (result_0x697b0 * 56)) = 4
8006bb24: 3c018008 lui r1,0x8008
8006bb28: 24216098 addiu r1,r1,0x6098               #   0x80086098
8006bb2c: 00240821 addu r1,r1,r4                    #   0x80086098 + (result_0x697b0 * 56)
8006bb30: 8c220000 lw r2,0x0000(r1)                 #   *(0x80086098 + (result_0x697b0 * 56))
8006bb34: 2403feff addiu r3,r0,-0x0101              #   0xfffffeff
8006bb38: 00431024 and r2,r2,r3                     #   *(0x80086098 + (result_0x697b0 * 56)) & 0xfffffeff      // Remove 0x0100 flag
8006bb3c: 3c018008 lui r1,0x8008
8006bb40: 24216098 addiu r1,r1,0x6098               #   0x80086098
8006bb44: 00240821 addu r1,r1,r4                    #   0x80086098 + (0x800860b4 + (result_0x697b0 * 56))
8006bb48: ac220000 sw r2,0x0000(r1)                 #   *(0x80086098 + (0x800860b4 + (result_0x697b0 * 56))) = *(0x80086098 + (result_0x697b0 * 56)) & 0xfffffeff
8006bb4c: 8fbf0050 lw r31,0x0050(r29)
8006bb50: 8fb5004c lw r21,0x004c(r29)
8006bb54: 8fb40048 lw r20,0x0048(r29)
8006bb58: 8fb30044 lw r19,0x0044(r29)
8006bb5c: 8fb20040 lw r18,0x0040(r29)
8006bb60: 8fb1003c lw r17,0x003c(r29)
8006bb64: 8fb00038 lw r16,0x0038(r29)
8006bb68: 27bd0058 addiu r29,r29,0x0058
8006bb6c: 03e00008 jr r31
8006bb70: 00000000 nop