Difference between revisions of "Determine Fieldable Units"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Documentation of the code for the roster unit nickname C&P to the text storage)
m (0x801C3188: Changed description to match the bne rather than my incorrect misread that it was beq)
 
Line 51: Line 51:
 
  801c313c: 34020001 ori r2,r0,0x0001                 
 
  801c313c: 34020001 ori r2,r0,0x0001                 
 
  801c3140: a2400000 sb r0,0x0000(r18)                #              unitFieldableArray[unitIndex] = 0;
 
  801c3140: a2400000 sb r0,0x0000(r18)                #              unitFieldableArray[unitIndex] = 0;
  801c3144: a2130000 sb r19,0x0000(r16)
+
  801c3144: a2130000 sb r19,0x0000(r16)               # Store 0xFE (end of name) to the text storage and move past the Roster Nickname setting
 
  801c3148: 08070c6a j 0x801c31a8                     
 
  801c3148: 08070c6a j 0x801c31a8                     
 
  801c314c: 26100001 addiu r16,r16,0x0001            # Text storage pointer ++
 
  801c314c: 26100001 addiu r16,r16,0x0001            # Text storage pointer ++
Line 70: Line 70:
 
  801c3180: 1053fff1 beq r2,r19,0x801c3148            # Branch back if nickname byte without 0x01 flag equals r19 (0xFE).  
 
  801c3180: 1053fff1 beq r2,r19,0x801c3148            # Branch back if nickname byte without 0x01 flag equals r19 (0xFE).  
 
  801c3184: 00000000 nop
 
  801c3184: 00000000 nop
  801c3188: 14740003 bne r3,r20,0x801c3198            # Branch ahead if number of nickname bytes = 0x0F (end of nickname bytes)
+
  801c3188: 14740003 bne r3,r20,0x801c3198            # Branch ahead if the max number of nickname bytes hasn't been hit yet
 
  801c318c: 26100001 addiu r16,r16,0x0001            # r16 = Text storage pointer ++
 
  801c318c: 26100001 addiu r16,r16,0x0001            # r16 = Text storage pointer ++
 
  801c3190: a2130000 sb r19,0x0000(r16)              # Save 0xFE (end name) to the text storage.  
 
  801c3190: a2130000 sb r19,0x0000(r16)              # Save 0xFE (end name) to the text storage.  

Latest revision as of 00:59, 11 August 2024

801c3078: 27bdffd8 addiu r29,r29,-0x0028
801c307c: afb10014 sw r17,0x0014(r29)
801c3080: 00008821 addu r17,r0,r0                   #   unitIndex = 0;
801c3084: afb3001c sw r19,0x001c(r29)
801c3088: 341300fe ori r19,r0,0x00fe
801c308c: afb40020 sw r20,0x0020(r29)
801c3090: 3414000f ori r20,r0,0x000f
801c3094: afb00010 sw r16,0x0010(r29)
801c3098: 3c108017 lui r16,0x8017
801c309c: 8e103fb8 lw r16,0x3fb8(r16)               #   Text pointer?
801c30a0: 3c02801d lui r2,0x801d
801c30a4: 8c42d2b4 lw r2,-0x2d4c(r2)
801c30a8: 3c038017 lui r3,0x8017
801c30ac: 8c633fe4 lw r3,0x3fe4(r3)
801c30b0: 3c04801d lui r4,0x801d
801c30b4: 2484d330 addiu r4,r4,-0x2cd0
801c30b8: afb20018 sw r18,0x0018(r29)
801c30bc: 00441021 addu r2,r2,r4
801c30c0: 3c018017 lui r1,0x8017
801c30c4: ac223fac sw r2,0x3fac(r1)
801c30c8: 3c02801d lui r2,0x801d
801c30cc: 8c42d2b8 lw r2,-0x2d48(r2)
801c30d0: 3c12801d lui r18,0x801d
801c30d4: 2652d25c addiu r18,r18,-0x2da4            #   unitFieldableArray (0x801d2da4)
801c30d8: afbf0024 sw r31,0x0024(r29)
801c30dc: 3c01801d lui r1,0x801d
801c30e0: ac20d05c sw r0,-0x2fa4(r1)
801c30e4: 3c018017 lui r1,0x8017
801c30e8: ac233f94 sw r3,0x3f94(r1)
801c30ec: 00441021 addu r2,r2,r4
801c30f0: 3c018017 lui r1,0x8017
801c30f4: ac223fa4 sw r2,0x3fa4(r1)
                                                    #   for (; unitIndex < 20; unitIndex++) {
801c30f8: 0c0166bc jal 0x80059af0                   #       partyUnit = Get Party Data Pointer (unitIndex);
801c30fc: 02202021 addu r4,r17,r0                   
801c3100: 00402021 addu r4,r2,r0                    #       partyUnit
801c3104: 90830001 lbu r3,0x0001(r4)                #       partyUnit.PartyID
801c3108: 340200ff ori r2,r0,0x00ff
801c310c: 1062000c beq r3,r2,0x801c3140             #       if (!((partyUnit.PartyID != 0xFF)                               // Unit exists
801c3110: 2a220010 slti r2,r17,0x0010
801c3114: 1040000a beq r2,r0,0x801c3140             #           and (unitIndex < 16)                                        // Unit is not a Guest
801c3118: 00000000 nop
801c311c: 908200d0 lbu r2,0x00d0(r4)            
801c3120: 00000000 nop
801c3124: 14400006 bne r2,r0,0x801c3140             #           and (partyUnit.PropositionStatus == 0)                      // Unit is not on a proposition
801c3128: 00000000 nop
801c312c: 90820004 lbu r2,0x0004(r4)
801c3130: 00000000 nop
801c3134: 30420004 andi r2,r2,0x0004
801c3138: 10400005 beq r2,r0,0x801c3150             #           and (partyUnit.Flags04 & FLAGS04_HAS_SHROUDED_STATS))) {    // Unit doesn't have ??? Stats
801c313c: 34020001 ori r2,r0,0x0001                
801c3140: a2400000 sb r0,0x0000(r18)                #               unitFieldableArray[unitIndex] = 0;
801c3144: a2130000 sb r19,0x0000(r16)               # Store 0xFE (end of name) to the text storage and move past the Roster Nickname setting
801c3148: 08070c6a j 0x801c31a8                     
801c314c: 26100001 addiu r16,r16,0x0001             # Text storage pointer ++
                                                    #               continue;
                                                    #       }
801c3150: a2420000 sb r2,0x0000(r18)                #       unitFieldableArray[unitIndex] = 1;
801c3154: 3c02801d lui r2,0x801d
801c3158: 8c42d05c lw r2,-0x2fa4(r2)                # Load the word stored at 0x801CD05C
801c315c: 00001821 addu r3,r0,r0                    # r3 = 0
801c3160: 24420001 addiu r2,r2,0x0001               # Add 1 to whatever word was loaded
801c3164: 3c01801d lui r1,0x801d
801c3168: ac22d05c sw r2,-0x2fa4(r1)                # Save the word back now
801c316c: 00831021 addu r2,r4,r3                    # r2 = World Stats pointer + r3
801c3170: 904200be lbu r2,0x00be(r2)                # r2 = One byte from the Roster Unit Nickname
801c3174: 00000000 nop
801c3178: a2020000 sb r2,0x0000(r16)                # Save nickname byte to text storage
801c317c: 304200fe andi r2,r2,0x00fe                # r2 = Rule out 0x01 from the nickname byte?
801c3180: 1053fff1 beq r2,r19,0x801c3148            # Branch back if nickname byte without 0x01 flag equals r19 (0xFE). 
801c3184: 00000000 nop
801c3188: 14740003 bne r3,r20,0x801c3198            # Branch ahead if the max number of nickname bytes hasn't been hit yet
801c318c: 26100001 addiu r16,r16,0x0001             # r16 = Text storage pointer ++
801c3190: a2130000 sb r19,0x0000(r16)               # Save 0xFE (end name) to the text storage. 
801c3194: 26100001 addiu r16,r16,0x0001             # r16 = Text storage pointer ++
801c3198: 24630001 addiu r3,r3,0x0001               # r3 = Number of nickname bytes so far ++
801c319c: 28620010 slti r2,r3,0x0010                # r2 = 0x01 if less than 0x10 nickname bytes (not at the end yet)
801c31a0: 1440fff3 bne r2,r0,0x801c3170             # If not at the end yet, loop back and check the next byte
801c31a4: 00831021 addu r2,r4,r3                    # r2 = World Stats pointer + r3 (why not just nop and go to 6c instead of 70?)
801c31a8: 26310001 addiu r17,r17,0x0001             #       (unitIndex = unitIndex + 1)
801c31ac: 2a220014 slti r2,r17,0x0014               #       (unitIndex < 20)
801c31b0: 1440ffd1 bne r2,r0,0x801c30f8
801c31b4: 26520001 addiu r18,r18,0x0001             #       (unitFieldableArray[unitIndex])
                                                    #   }
801c31b8: 3c028017 lui r2,0x8017
801c31bc: 84423cb0 lh r2,0x3cb0(r2)
801c31c0: 00000000 nop
801c31c4: 1440006f bne r2,r0,0x801c3384
801c31c8: 00000000 nop
801c31cc: 3c03801e lui r3,0x801e
801c31d0: 8c63cc78 lw r3,-0x3388(r3)
801c31d4: 00000000 nop
801c31d8: 00031040 sll r2,r3,0x01
801c31dc: 00431021 addu r2,r2,r3
801c31e0: 3c03801d lui r3,0x801d
801c31e4: 8c63d270 lw r3,-0x2d90(r3)
801c31e8: 00021080 sll r2,r2,0x02
801c31ec: 00431021 addu r2,r2,r3
801c31f0: 8c420000 lw r2,0x0000(r2)
801c31f4: 00000000 nop
801c31f8: 14400003 bne r2,r0,0x801c3208
801c31fc: 00000000 nop
801c3200: 3c01801e lui r1,0x801e
801c3204: ac20cc78 sw r0,-0x3388(r1)
801c3208: 0c04ed64 jal 0x8013b590
801c320c: 340401fe ori r4,r0,0x01fe
801c3210: 1040004d beq r2,r0,0x801c3348
801c3214: 00000000 nop
801c3218: 0c04ed64 jal 0x8013b590
801c321c: 34040033 ori r4,r0,0x0033
801c3220: 00402021 addu r4,r2,r0
801c3224: 3c03801d lui r3,0x801d
801c3228: 8c63d270 lw r3,-0x2d90(r3)
801c322c: 00008821 addu r17,r0,r0
801c3230: 3c01801e lui r1,0x801e
801c3234: ac20cc78 sw r0,-0x3388(r1)
801c3238: 90620009 lbu r2,0x0009(r3)
801c323c: 00000000 nop
801c3240: 10440022 beq r2,r4,0x801c32cc
801c3244: 00000000 nop
801c3248: 26310001 addiu r17,r17,0x0001
801c324c: 2a220300 slti r2,r17,0x0300
801c3250: 1440fff9 bne r2,r0,0x801c3238
801c3254: 2463000c addiu r3,r3,0x000c
801c3258: 3c03801e lui r3,0x801e
801c325c: 8c63cc78 lw r3,-0x3388(r3)
801c3260: 00000000 nop
801c3264: 00031040 sll r2,r3,0x01
801c3268: 00431021 addu r2,r2,r3
801c326c: 3c03801d lui r3,0x801d
801c3270: 8c63d270 lw r3,-0x2d90(r3)
801c3274: 00021080 sll r2,r2,0x02
801c3278: 00431021 addu r2,r2,r3
801c327c: 8c420000 lw r2,0x0000(r2)
801c3280: 00000000 nop
801c3284: 14400003 bne r2,r0,0x801c3294
801c3288: 34040034 ori r4,r0,0x0034
801c328c: 3c01801e lui r1,0x801e
801c3290: ac20cc78 sw r0,-0x3388(r1)
801c3294: 0c04ed91 jal 0x8013b644
801c3298: 34050002 ori r5,r0,0x0002
801c329c: 3c05801e lui r5,0x801e
801c32a0: 8ca5cc78 lw r5,-0x3388(r5)
801c32a4: 0c04ed91 jal 0x8013b644
801c32a8: 34040035 ori r4,r0,0x0035
801c32ac: 3c05801e lui r5,0x801e
801c32b0: 8ca5cc78 lw r5,-0x3388(r5)
801c32b4: 00000000 nop
801c32b8: 14a00008 bne r5,r0,0x801c32dc
801c32bc: 24a50001 addiu r5,r5,0x0001
801c32c0: 34040036 ori r4,r0,0x0036
801c32c4: 08070cb8 j 0x801c32e0
801c32c8: 00002821 addu r5,r0,r0
801c32cc: 3c01801e lui r1,0x801e
801c32d0: ac31cc78 sw r17,-0x3388(r1)
801c32d4: 08070c96 j 0x801c3258
801c32d8: 00000000 nop
801c32dc: 34040036 ori r4,r0,0x0036
801c32e0: 0c04ed91 jal 0x8013b644
801c32e4: 00000000 nop
801c32e8: 3c03801e lui r3,0x801e
801c32ec: 8c63cc78 lw r3,-0x3388(r3)
801c32f0: 00000000 nop
801c32f4: 00031040 sll r2,r3,0x01
801c32f8: 00431021 addu r2,r2,r3
801c32fc: 3c03801d lui r3,0x801d
801c3300: 8c63d270 lw r3,-0x2d90(r3)
801c3304: 00021080 sll r2,r2,0x02
801c3308: 00431021 addu r2,r2,r3
801c330c: 90450008 lbu r5,0x0008(r2)
801c3310: 0c04ed91 jal 0x8013b644
801c3314: 34040039 ori r4,r0,0x0039
801c3318: 3c03801e lui r3,0x801e
801c331c: 8c63cc78 lw r3,-0x3388(r3)
801c3320: 00000000 nop
801c3324: 00031040 sll r2,r3,0x01
801c3328: 00431021 addu r2,r2,r3
801c332c: 3c03801d lui r3,0x801d
801c3330: 8c63d270 lw r3,-0x2d90(r3)
801c3334: 00021080 sll r2,r2,0x02
801c3338: 00431021 addu r2,r2,r3
801c333c: 34030004 ori r3,r0,0x0004
801c3340: 08070ce1 j 0x801c3384
801c3344: a0430008 sb r3,0x0008(r2)
801c3348: 3c018004 lui r1,0x8004
801c334c: ac2059dc sw r0,0x59dc(r1)
801c3350: 0c04ed64 jal 0x8013b590
801c3354: 34040035 ori r4,r0,0x0035
801c3358: 00021840 sll r3,r2,0x01
801c335c: 00621821 addu r3,r3,r2
801c3360: 3c01801e lui r1,0x801e
801c3364: ac22cc78 sw r2,-0x3388(r1)
801c3368: 3c02801d lui r2,0x801d
801c336c: 8c42d270 lw r2,-0x2d90(r2)
801c3370: 00031880 sll r3,r3,0x02
801c3374: 00621821 addu r3,r3,r2
801c3378: 90650008 lbu r5,0x0008(r3)
801c337c: 0c04ed91 jal 0x8013b644
801c3380: 34040039 ori r4,r0,0x0039
801c3384: 8fbf0024 lw r31,0x0024(r29)
801c3388: 8fb40020 lw r20,0x0020(r29)
801c338c: 8fb3001c lw r19,0x001c(r29)
801c3390: 8fb20018 lw r18,0x0018(r29)
801c3394: 8fb10014 lw r17,0x0014(r29)
801c3398: 8fb00010 lw r16,0x0010(r29)
801c339c: 27bd0028 addiu r29,r29,0x0028
801c33a0: 03e00008 jr r31
801c33a4: 00000000 nop