Difference between revisions of "Check Sprite Set"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Redirected page to Check Base Class)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
+
#REDIRECT [[Check Base Class]]
# FUNCTION : CHECK SPRITE SET
 
 
 
# Parameters:
 
#    r4    :    Sprite set to check
 
     
 
# Returns:
 
#    r2    =    -1          :    If the sprite set is not unique (Sprite set > 0x80);
 
#                Unit index  :    If a unit with the specified sprite set is found without crystal or treasure status;
 
#                -2          :    If the sprite set refers to a unit that doesn't exist / is disabled
 
#                                        (Unit flags at 0x183 = 0x00);
 
#                -3          :    If a unit with the specified sprite set (r4) was found with status crystal or treasure,
 
#                                        or was disabled;
 
#                -4          :    If no unit was found with the specified sprite set in battle, but was in the party;   
 
#                -5          :    Otherwise
 
 
 
# int check_sprite_set (int p_spriteSet)
 
# {
 
 
 
00180b2c: 27bdffe0 addiu r29,r29,0xffe0
 
00180b30: 2c820080 sltiu r2,r4,0x0080
 
00180b34: afbf001c sw r31,0x001c(r29)
 
00180b38: afb20018 sw r18,0x0018(r29)
 
00180b3c: afb10014 sw r17,0x0014(r29)
 
00180b40: 14400005 bne r2,r0,0x00180b58
 
00180b44: afb00010 sw r16,0x0010(r29)
 
00180b48: 0806031d j 0x00180c74         #    if (p_spriteSet >= 0x80)      // Sprite set refers to non-unique unit
 
00180b4c: 2402ffff addiu r2,r0,0xffff            #          return -1;
 
00180b50: 0806031d j 0x00180c74
 
00180b54: 2402fffe addiu r2,r0,0xfffe
 
00180b58: 00008021 addu r16,r0,r0
 
00180b5c: 340600ff ori r6,r0,0x00ff      
 
00180b60: 308500ff andi r5,r4,0x00ff
 
00180b64: 3c038019 lui r3,0x8019
 
00180b68: 246308cc addiu r3,r3,0x08cc
 
 
 
# // Check units for the parameter sprite set
 
                                               
 
00180b6c: 90620001 lbu r2,0x0001(r3)         #    for (int index = 0; index < 21; index++)
 
00180b70: 00000000 nop         #    {
 
00180b74: 10460011 beq r2,r6,0x00180bbc          #          if (units[index].unitID == 0xFF)    // Unit doesn't exist
 
00180b78: 00000000 nop #                continue;
 
00180b7c: 90620000 lbu r2,0x0000(r3)
 
00180b80: 00000000 nop
 
00180b84: 1445000d bne r2,r5,0x00180bbc #          if (units[index].spriteSet != p_spriteSet)
 
00180b88: 00000000 nop         #                continue;
 
00180b8c: 90620058 lbu r2,0x0058(r3)
 
00180b90: 00000000 nop
 
00180b94: 30420040 andi r2,r2,0x0040 #          if (units[index].statusFlags1 & STATUS_CRYSTAL)
 
00180b98: 14400006 bne r2,r0,0x00180bb4 #                return -3;
 
00180b9c: 00000000 nop
 
00180ba0: 90630059 lbu r3,0x0059(r3)
 
00180ba4: 00000000 nop
 
00180ba8: 30630001 andi r3,r3,0x0001 #          if (units[index].statusFlags2 & STATUS_TREASURE)
 
00180bac: 10600031 beq r3,r0,0x00180c74 #                return -3;
 
00180bb0: 02001021 addu r2,r16,r0 #          else
 
00180bb4: 0806031d j 0x00180c74 #                return index;
 
00180bb8: 2402fffd addiu r2,r0,0xfffd      
 
00180bbc: 26100001 addiu r16,r16,0x0001
 
00180bc0: 2a020015 slti r2,r16,0x0015
 
00180bc4: 1440ffe9 bne r2,r0,0x00180b6c
 
00180bc8: 246301c0 addiu r3,r3,0x01c0         #    }
 
 
 
00180bcc: 00008021 addu r16,r0,r0
 
00180bd0: 340800ff ori r8,r0,0x00ff
 
00180bd4: 308600ff andi r6,r4,0x00ff
 
00180bd8: 34070080 ori r7,r0,0x0080
 
00180bdc: 3c038019 lui r3,0x8019
 
00180be0: 246308cc addiu r3,r3,0x08cc    
 
 
 
# // Check non-existent units (?)
 
00180be4: 90650001 lbu r5,0x0001(r3) #    for (int index = 0; index < 21; index++)
 
00180be8: 00000000 nop #    {
 
00180bec: 14a8000d bne r5,r8,0x00180c24         #          if (units[index].unitID != UNITID_DOES_NOT_EXIST)
 
00180bf0: 26100001 addiu r16,r16,0x0001        #                continue;
 
00180bf4: 90620000 lbu r2,0x0000(r3)
 
00180bf8: 00000000 nop
 
00180bfc: 1446000a bne r2,r6,0x00180c28         #          if (units[index].spriteSet != p_spriteSet)
 
00180c00: 2a020015 slti r2,r16,0x0015 #                continue;
 
00180c04: 90620183 lbu r2,0x0183(r3)
 
00180c08: 00000000 nop
 
00180c0c: 10450005 beq r2,r5,0x00180c24         #          if (units[index].unitID == units[index].flags_0x183)
 
00180c10: 00000000 nop         #                continue;
 
00180c14: 1040ffce beq r2,r0,0x00180b50         #          if (units[index].flags_0x183 == 0)
 
00180c18: 00000000 nop #                return -2;
 
00180c1c: 10470015 beq r2,r7,0x00180c74         #          if (units[index].flags_0x183 == 0x80) // (was active, now disabled?)
 
00180c20: 2402fffd addiu r2,r0,0xfffd #                return -3;
 
00180c24: 2a020015 slti r2,r16,0x0015
 
00180c28: 1440ffee bne r2,r0,0x00180be4
 
00180c2c: 246301c0 addiu r3,r3,0x01c0         #    }
 
 
 
# // Check if a unit with the parameter sprite set is in the party
 
00180c30: 00008021 addu r16,r0,r0
 
00180c34: 341200ff ori r18,r0,0x00ff
 
00180c38: 309100ff andi r17,r4,0x00ff
 
00180c3c: 0c0166bc jal 0x00059af0 #    for (int index = 0; index < 20; index++)
 
00180c40: 02002021 addu r4,r16,r0 #    {
 
00180c44: 00401821 addu r3,r2,r0      
 
00180c48: 90620001 lbu r2,0x0001(r3) #         
 
00180c4c: 00000000 nop
 
00180c50: 10520005 beq r2,r18,0x00180c68 #          if (party_units[index].unitID == UNITID_DOES_NOT_EXIST)
 
00180c54: 26100001 addiu r16,r16,0x0001        #                continue;
 
00180c58: 90620000 lbu r2,0x0000(r3) #         
 
00180c5c: 00000000 nop
 
00180c60: 10510004 beq r2,r17,0x00180c74 #          if (party_units[index].spriteSet == p_spriteSet)
 
00180c64: 2402fffc addiu r2,r0,0xfffc #                return -4;
 
00180c68: 2a020014 slti r2,r16,0x0014
 
00180c6c: 1440fff3 bne r2,r0,0x00180c3c        #    }
 
 
00180c70: 2402fffb addiu r2,r0,0xfffb #    return -5;
 
00180c74: 8fbf001c lw r31,0x001c(r29)
 
00180c78: 8fb20018 lw r18,0x0018(r29)
 
00180c7c: 8fb10014 lw r17,0x0014(r29)
 
00180c80: 8fb00010 lw r16,0x0010(r29)
 
00180c84: 27bd0020 addiu r29,r29,0x0020
 
00180c88: 03e00008 jr r31
 
00180c8c: 00000000 nop                         
 
 
 
# }
 

Latest revision as of 02:14, 24 September 2016

Redirect to: