Height Number Display Setup

From Final Fantasy Hacktics Wiki
Revision as of 01:53, 24 November 2016 by Glain (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: HEIGHT NUMBER DISPLAY SETUP
#   This routine updates the height number (and depth?) that is (later) displayed in the top-right of the battle screen.
#   Parameters:
#       r4 = Height number (with depth?) (For image to load)
#       r5 = Destination pointer for image data
#           (Examples: 0x80173e00, 0x80173cbc)
#   Returns:
#       r2 = Number of images to display (One for each digit, one for .5, one for "h") 

001346f4: 27bdfff8 addiu r29,r29,-0x0008
001346f8: 3c018017 lui r1,0x8017
001346fc: 00240821 addu r1,r1,r4
00134700: 90268324 lbu r6,-0x7cdc(r1)           #   *(0x80168324 + Number)
00134704: 3c038016 lui r3,0x8016
00134708: 24637994 addiu r3,r3,0x7994           #   0x80167994
0013470c: 00061040 sll r2,r6,0x01               #   *(0x80168324 + Number) * 2
00134710: 00461021 addu r2,r2,r6                #   *(0x80168324 + Number) * 3
00134714: 00021080 sll r2,r2,0x02               #   *(0x80168324 + Number) * 12
00134718: 00434021 addu r8,r2,r3                #   r8 = *(0x80168324 + Number) * 12 + 0x80167994
0013471c: 3c018017 lui r1,0x8017
00134720: 00240821 addu r1,r1,r4
00134724: 90228325 lbu r2,-0x7cdb(r1)           #   *(0x80168325 + Number)
00134728: 3c078017 lui r7,0x8017
0013472c: 24e78368 addiu r7,r7,-0x7c98          #   0x80168368
00134730: 00465823 subu r11,r2,r6               #   result = *(0x80168325 + Number) - *(0x80168324 + Number)
00134734: 1960007e blez r11,0x00134930          #   if (result <= 0), return result
00134738: 00005021 addu r10,r0,r0               #   count = 0
0013473c: 3c098017 lui r9,0x8017
00134740: 2529837c addiu r9,r9,-0x7c84          #   0x8016837c
00134744: 25060006 addiu r6,r8,0x0006           #   ptr = *(0x80168324 + Number) * 12 + 0x80167994 + 6
00134748: 24a5002a addiu r5,r5,0x002a           #   destPtr = r5 + 0x2a (42) 

                                                #   do {
0013474c: 95220000 lhu r2,0x0000(r9)            #       *0x8016837c
00134750: 94c30002 lhu r3,0x0002(r6)            #       *(ptr + 2)     
00134754: 00000000 nop
00134758: 00431021 addu r2,r2,r3                #       *0x8016837c + *(ptr + 2)                                        // Dest offset 0x08: X Screen Location Offset + Base X?
0013475c: a4a2ffde sh r2,-0x0022(r5)            #       *(destPtr - 0x22) = *0x8016837c + *(ptr + 2)                    // Height number display stretches left weirdly if this line is removed
00134760: 95220002 lhu r2,0x0002(r9)            #       *0x8016837e            
00134764: 94c30004 lhu r3,0x0004(r6)            #       *(ptr + 4)
00134768: 00000000 nop
0013476c: 00431021 addu r2,r2,r3                #       *0x8016837e + *(ptr + 4)                                        // Dest offset 0x0a: Y Screen Location Offset + Base Y?
00134770: a4a2ffe0 sh r2,-0x0020(r5)            #       *(destPtr - 0x20) = *0x8016837e + *(ptr + 4)                    // ? (No discernable effect if removed)
00134774: 95220000 lhu r2,0x0000(r9)            #       *0x8016837c
00134778: 94c30002 lhu r3,0x0002(r6)            #       *(ptr + 2)
0013477c: 94c4fffe lhu r4,-0x0002(r6)           #       *(ptr - 2)
00134780: 00431021 addu r2,r2,r3                #       *0x8016837c + *(ptr + 2)
00134784: 00441021 addu r2,r2,r4                #       *0x8016837c + *(ptr + 2) + *(ptr - 2)                           // Dest offset 0x14: X Screen Location Offset + Base X? + Width
00134788: a4a2ffea sh r2,-0x0016(r5)            #       *(destPtr - 0x16) = *0x8016837c + *(ptr + 2) + *(ptr - 2)       // Really bizarre display if removed (for certain numbers)
0013478c: 95220002 lhu r2,0x0002(r9)            #       *0x8016837e
00134790: 94c30004 lhu r3,0x0004(r6)            #       *(ptr + 4)       
00134794: 00000000 nop
00134798: 00431021 addu r2,r2,r3                #       *0x8016837e + *(ptr + 4)                                        // Dest offset 0x16: Y Screen Location Offset + Base Y?
0013479c: a4a2ffec sh r2,-0x0014(r5)            #       *(destPtr - 0x14) = *0x8016837e + *(ptr + 4)                    //  .5 display weirdly rotated if removed
001347a0: 95220000 lhu r2,0x0000(r9)            #       *0x8016837c
001347a4: 94c30002 lhu r3,0x0002(r6)            #       *(ptr + 2)
001347a8: 00000000 nop
001347ac: 00431021 addu r2,r2,r3                #       *0x8016837c + *(ptr + 2)                                        // Dest offset 0x20: X Screen Location Offset + Base X?
001347b0: a4a2fff6 sh r2,-0x000a(r5)            #       *(destPtr - 0x0a) = *0x8016837c + *(ptr + 2)                    // Weird bottom-left stretch if removed
001347b4: 95220002 lhu r2,0x0002(r9)            #       *0x8016837e
001347b8: 94c30004 lhu r3,0x0004(r6)            #       *(ptr + 4)
001347bc: 00000000 nop
001347c0: 00431021 addu r2,r2,r3                #       *0x8016837e + *(ptr + 4)
001347c4: 94c30000 lhu r3,0x0000(r6)            #       *ptr
001347c8: 2442ffff addiu r2,r2,-0x0001          #       *0x8016837e + *(ptr + 4) - 1
001347cc: 00431021 addu r2,r2,r3                #       *0x8016837e + *(ptr + 4) - 1 + *ptr                             // Dest offset 0x22: Y Screen Location Offset + Base Y? - 1 + Height
001347d0: a4a2fff8 sh r2,-0x0008(r5)            #       *(destPtr - 8) = *0x8016837e + *(ptr + 4) - 1 + *ptr            // Bizarre .5 display if removed
001347d4: 95220000 lhu r2,0x0000(r9)            #       *0x8016837c
001347d8: 94c30002 lhu r3,0x0002(r6)            #       *(ptr + 2)
001347dc: 94c4fffe lhu r4,-0x0002(r6)           #       *(ptr - 2)
001347e0: 00431021 addu r2,r2,r3                #       *0x8016837c + *(ptr + 2)
001347e4: 00441021 addu r2,r2,r4                #       *0x8016837c + *(ptr + 2) + *(ptr - 2)                           // Dest offset 0x2c: X Screen Location Offset + Base X? + Width
001347e8: a4a20002 sh r2,0x0002(r5)             #       *(destPtr + 2) = *0x8016837c + *(ptr + 2) + *(ptr - 2)          // Bizarre left stretch if removed        
001347ec: 95220002 lhu r2,0x0002(r9)            #       *0x8016837e
001347f0: 94c30004 lhu r3,0x0004(r6)            #       *(ptr + 4)
001347f4: 00000000 nop
001347f8: 00431021 addu r2,r2,r3                #       *0x8016837e + *(ptr + 4)
001347fc: 94c30000 lhu r3,0x0000(r6)            #       *ptr
00134800: 2442ffff addiu r2,r2,-0x0001          #       *0x8016837e + *(ptr + 4) - 1
00134804: 00431021 addu r2,r2,r3                #       *0x8016837e + *(ptr + 4) - 1 + *ptr                             // Dest offset 0x2e: Y Screen Location Offset + Base Y? - 1 + Height
00134808: a4a20004 sh r2,0x0004(r5)             #       *(destPtr + 4) = *0x8016837e + *(ptr + 4) - 1 + *ptr            // Slight distortion of .5 display if removed
0013480c: 91020000 lbu r2,0x0000(r8)            #       *r8   
00134810: 00000000 nop                                                                                                  // Dest offset 0x0c: X Load Location
00134814: a0a2ffe2 sb r2,-0x001e(r5)            #       *(destPtr - 0x1e) = *r8                                         // Digits distorted if removed
00134818: 90c2fffc lbu r2,-0x0004(r6)           #       *(ptr - 4)
0013481c: 00000000 nop
00134820: 2442ff88 addiu r2,r2,-0x0078          #       *(ptr - 4) - 0x78                                               // Dest offset 0x0d: Y Load Location - 0x78 (120)
00134824: a0a2ffe3 sb r2,-0x001d(r5)            #       *(destPtr - 0x1d) = *(ptr - 4) - 0x78                           // .5 display sometimes distorted if removed                           
00134828: 91020000 lbu r2,0x0000(r8)            #       *r8
0013482c: 90c3fffe lbu r3,-0x0002(r6)           #       *(ptr - 2)
00134830: 00000000 nop
00134834: 00431021 addu r2,r2,r3                #       *r8 + *(ptr - 2)                                                // Dest offset 0x18: X Load Location + Width
00134838: a0a2ffee sb r2,-0x0012(r5)            #       *(destPtr - 0x12) = *r8 + *(ptr - 2)                            // Strange digit display if removed, sometimes affects .5 display
0013483c: 90c2fffc lbu r2,-0x0004(r6)           #       *(ptr - 4)
00134840: 00000000 nop
00134844: 2442ff88 addiu r2,r2,-0x0078          #       *(ptr - 4) - 0x78                                               // Dest offset 0x19: Y Load Location - 0x78 (120)
00134848: a0a2ffef sb r2,-0x0011(r5)            #       *(destPtr - 0x11) = *(ptr - 4) - 0x78                           // ? (No discernable effect if removed)
0013484c: 91020000 lbu r2,0x0000(r8)            #       *r8
00134850: 00000000 nop                                                                                                  // Dest offset 0x24: X Load Locatio n
00134854: a0a2fffa sb r2,-0x0006(r5)            #       *(destPtr - 6) = *r8                                            // Digit X1 load location doesn't change if removed?
                                                #                                                                       //     Displays multiple digits, distorted, from left.
00134858: 90c2fffc lbu r2,-0x0004(r6)           #       *(ptr - 4)
0013485c: 90c30000 lbu r3,0x0000(r6)            #       *ptr
00134860: 2442ff87 addiu r2,r2,-0x0079          #       *(ptr - 4) - 0x79
00134864: 00431021 addu r2,r2,r3                #       *(ptr - 4) - 0x79 + *ptr                                        // Dest offset 0x25: Y Load Location + Height - 0x79 (121)
00134868: a0a2fffb sb r2,-0x0005(r5)            #       *(destPtr - 5) = *(ptr - 4) - 0x79 + *ptr                       // Sometimes, weird bottom-left stretch if removed
0013486c: 91020000 lbu r2,0x0000(r8)            #       *r8
00134870: 90c3fffe lbu r3,-0x0002(r6)           #       *(ptr - 2)
00134874: 00000000 nop
00134878: 00431021 addu r2,r2,r3                #       *r8 + *(ptr - 2)                                                // Dest offset 0x30: X Load Location + Widt h
0013487c: a0a20006 sb r2,0x0006(r5)             #       *(destPtr + 6) = *r8 + *(ptr - 2)                               // Digit X2 load location doesn't change if removed?  
                                                #                                                                       //    Displays multiple digits, distorted, from right.
00134880: 90c2fffc lbu r2,-0x0004(r6)           #       *(ptr - 4)
00134884: 90c30000 lbu r3,0x0000(r6)            #       *ptr
00134888: 2442ff87 addiu r2,r2,-0x0079          #       *(ptr - 4) - 0x79
0013488c: 00431021 addu r2,r2,r3                #       *(ptr - 4) - 0x79 + *ptr                                        // Dest offset 0x31: Y Load Location + Height - 0x79 (121)
00134890: a0a20007 sb r2,0x0007(r5)             #       *(destPtr + 7) = *(ptr - 4) - 0x79 + *ptr                       // Slightly strange .5 display if removed
00134894: 90e20004 lbu r2,0x0004(r7)            #       *0x8016836c
00134898: 00000000 nop
0013489c: a0a2ffda sb r2,-0x0026(r5)            #       *(destPtr - 0x26) = *0x8016836c                                 // Dest offset 0x04: Red shading value for top-left corner
001348a0: 90e20005 lbu r2,0x0005(r7)            #       *0x8016836d
001348a4: 00000000 nop
001348a8: a0a2ffdb sb r2,-0x0025(r5)            #       *(destPtr - 0x25) = *0x8016836d                                 // Dest offset 0x05: Green shading value for top-left corner
001348ac: 90e20006 lbu r2,0x0006(r7)            #       *0x8016836e
001348b0: 00000000 nop
001348b4: a0a2ffdc sb r2,-0x0024(r5)            #       *(destPtr - 0x24) = *0x8016836e                                 // Dest offset 0x06: Blue shading value for top-left corner
001348b8: 90e20008 lbu r2,0x0008(r7)            #       *0x80168370
001348bc: 00000000 nop
001348c0: a0a2ffe6 sb r2,-0x001a(r5)            #       *(destPtr - 0x1a) = *0x80168370                                 // Dest offset 0x10: Red shading value for top-right corner
001348c4: 90e20009 lbu r2,0x0009(r7)            #       *0x80168371
001348c8: 00000000 nop
001348cc: a0a2ffe7 sb r2,-0x0019(r5)            #       *(destPtr - 0x19) = *0x80168371                                 // Dest offset 0x11: Green shading value for top-right corner
001348d0: 90e2000a lbu r2,0x000a(r7)            #       *0x80168372
001348d4: 00000000 nop
001348d8: a0a2ffe8 sb r2,-0x0018(r5)            #       *(destPtr - 0x18) = *0x80168372                                 // Dest offset 0x12: Blue shading value for top-right corner
001348dc: 90e2000c lbu r2,0x000c(r7)            #       *0x80168374
001348e0: 00000000 nop
001348e4: a0a2fff2 sb r2,-0x000e(r5)            #       *(destPtr - 0x0e) = *0x80168374                                 // Dest offset 0x1c: Red shading value for bottom-left corner
001348e8: 90e2000d lbu r2,0x000d(r7)            #       *0x80168375
001348ec: 00000000 nop
001348f0: a0a2fff3 sb r2,-0x000d(r5)            #       *(destPtr - 0x0d) = *0x80168375                                 // Dest offset 0x1d: Green shading value for bottom-left corner
001348f4: 90e2000e lbu r2,0x000e(r7)            #       *0x80168376
001348f8: 00000000 nop
001348fc: a0a2fff4 sb r2,-0x000c(r5)            #       *(destPtr - 0x0c) = *0x80168376                                 // Dest offset 0x1e: Blue shading value for bottom-left corner
00134900: 90e20010 lbu r2,0x0010(r7)            #       *0x80168378
00134904: 254a0001 addiu r10,r10,0x0001         #       count = count + 1
00134908: a0a2fffe sb r2,-0x0002(r5)            #       *(destPtr - 2) = *0x80168378                                    // Dest offset 0x28: Red shading value for bottom-right corner
0013490c: 90e20011 lbu r2,0x0011(r7)            #       *0x80168379
00134910: 2508000c addiu r8,r8,0x000c           #       r8 = r8 + 12
00134914: a0a2ffff sb r2,-0x0001(r5)            #       *(destPtr - 1) = *0x80168379                                    // Dest offset 0x29: Green shading value for bottom-right corner
00134918: 90e20012 lbu r2,0x0012(r7)            #       *0x8016837a
0013491c: 24c6000c addiu r6,r6,0x000c           #       ptr = ptr + 12
00134920: a0a20000 sb r2,0x0000(r5)             #       *destPtr = *0x8016837a                                          // Dest offset 0x2a: Blue shading value for bottom-right corner
00134924: 014b102a slt r2,r10,r11
00134928: 1440ff88 bne r2,r0,0x0013474c
0013492c: 24a50034 addiu r5,r5,0x0034           #       destPtr = destPtr + 0x34 (52)                                   // Example ending values for destPtr at return: 0x80173d82, 0x80173ec6
                                                #   } while (count < result)
00134930: 01601021 addu r2,r11,r0               #   return result
00134934: 27bd0008 addiu r29,r29,0x0008
00134938: 03e00008 jr r31
0013493c: 00000000 nop