Generate Formation Unit Name String

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: GENERATE FORMATION UNIT NAME STRING
#   Generates the name string used by the formation screen to display unit names.
#   No parameters.

80108920: 27bdffd8 addiu r29,r29,-0x0028
80108924: afb00010 sw r16,0x0010(r29)
80108928: 3c10801d lui r16,0x801d
8010892c: 8e10d8c4 lw r16,-0x273c(r16)              #   formationScreenUnitNameStringPtr = formationScreenUnitNameString (*0x801cd8c4)      // Start of string
80108930: afb10014 sw r17,0x0014(r29)
80108934: 00008821 addu r17,r0,r0                   #   partyUnitIndex = 0
80108938: afb20018 sw r18,0x0018(r29)
8010893c: 341200fe ori r18,r0,0x00fe                #   0xfe
80108940: afb3001c sw r19,0x001c(r29)
80108944: 3413000f ori r19,r0,0x000f                #   15
80108948: afbf0020 sw r31,0x0020(r29)
                                                    #   do {
8010894c: 0c0166bc jal 0x80059af0                   #       partyUnit = Get Party Data Pointer (partyUnitIndex);
80108950: 02202021 addu r4,r17,r0
80108954: 00402021 addu r4,r2,r0                    #       partyUnit
80108958: 90830001 lbu r3,0x0001(r4)                #       partyUnit.UnitIndex
8010895c: 340200ff ori r2,r0,0x00ff                 #       0xff
80108960: 14620004 bne r3,r2,0x80108974             
80108964: 00001821 addu r3,r0,r0                    #       offset = 0
                                                    #       if (partyUnit.UnitIndex == 0xff) {
80108968: a2120000 sb r18,0x0000(r16)               #           *formationScreenUnitNameStringPtr = 0xfe
8010896c: 0804226c j 0x801089b0
80108970: 26100001 addiu r16,r16,0x0001             #           formationScreenUnitNameStringPtr = formationScreenUnitNameStringPtr + 1
                                                    #       } else {
80108974: 00831021 addu r2,r4,r3                    #           partyUnit + offset
                                                    #           do {
80108978: 904200be lbu r2,0x00be(r2)                #               partyUnitNameCurrentCharacter = *(partyUnit + offset + 0xbe)
8010897c: 00000000 nop
80108980: a2020000 sb r2,0x0000(r16)                #               *formationScreenUnitNameStringPtr = partyUnitNameCurrentCharacter
80108984: 304200fe andi r2,r2,0x00fe                #               partyUnitNameCurrentCharacter & 0xfe
80108988: 1052fff8 beq r2,r18,0x8010896c            #               if ((partyUnitNameCurrentCharacter & 0xfe) == 0xfe) {    // If this is a sentinel value
8010898c: 00000000 nop                              #                   formationScreenUnitNameStringPtr = formationScreenUnitNameStringPtr + 1; break;
                                                    #               }
80108990: 14730003 bne r3,r19,0x801089a0            
80108994: 26100001 addiu r16,r16,0x0001             #               formationScreenUnitNameStringPtr = formationScreenUnitNameStringPtr + 1
                                                    #               if (offset == 15) {
80108998: a2120000 sb r18,0x0000(r16)               #                   *formationScreenUnitNameStringPtr = 0xfe 
8010899c: 26100001 addiu r16,r16,0x0001             #                   formationScreenUnitNameStringPtr = formationScreenUnitNameStringPtr + 1
                                                    #               }
801089a0: 24630001 addiu r3,r3,0x0001               #               index = index + 1
801089a4: 28620010 slti r2,r3,0x0010
801089a8: 1440fff3 bne r2,r0,0x80108978                                              
801089ac: 00831021 addu r2,r4,r3                    #               partyUnit + offset
                                                    #           } while (index < 16);
                                                    #       }
801089b0: 26310001 addiu r17,r17,0x0001             #       partyUnitIndex = partyUnitIndex + 1
801089b4: 2a220014 slti r2,r17,0x0014
801089b8: 1440ffe4 bne r2,r0,0x8010894c             #   } while (partyUnitIndex < 20);
801089bc: 00000000 nop
801089c0: 3c028019 lui r2,0x8019
801089c4: 8c429f6c lw r2,-0x6094(r2)                #   *0x80189f6c
801089c8: 00000000 nop
801089cc: 24420001 addiu r2,r2,0x0001               #   *0x80189f6c + 1
801089d0: 3c018019 lui r1,0x8019
801089d4: ac229f6c sw r2,-0x6094(r1)                #   *0x80189f6c = *0x80189f6c + 1
801089d8: 8fbf0020 lw r31,0x0020(r29)
801089dc: 8fb3001c lw r19,0x001c(r29)
801089e0: 8fb20018 lw r18,0x0018(r29)
801089e4: 8fb10014 lw r17,0x0014(r29)
801089e8: 8fb00010 lw r16,0x0010(r29)
801089ec: 27bd0028 addiu r29,r29,0x0028
801089f0: 03e00008 jr r31
801089f4: 00000000 nop