0x8bf1c

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   Parameters:
#       r4 = (unitMiscID) Unit Misc ID

8008bf1c: 27bdffe8 addiu r29,r29,-0x0018
8008bf20: afbf0010 sw r31,0x0010(r29)
8008bf24: 0c01e9b9 jal 0x8007a6e4                   #   miscData = Get Unit Misc Data Pointer (unitMiscID);
8008bf28: 3084ffff andi r4,r4,0xffff                #   unitMiscID
8008bf2c: 10400010 beq r2,r0,0x8008bf70             #   if (unitMiscID != 0) {
8008bf30: 00000000 nop
8008bf34: 84420070 lh r2,0x0070(r2)                 #       miscData.facing
8008bf38: 00000000 nop
8008bf3c: 04410003 bgez r2,0x8008bf4c               
8008bf40: 00021a83 sra r3,r2,0x0a                   #       v3 = miscData.facing >> 10
                                                    #       if (miscData.facing < 0) {
8008bf44: 244203ff addiu r2,r2,0x03ff               #           miscData.facing + 0x3ff
8008bf48: 00021a83 sra r3,r2,0x0a                   #           v3 = (miscData.facing + 0x3ff) >> 10
                                                    #       }
8008bf4c: 04610002 bgez r3,0x8008bf58
8008bf50: 00601021 addu r2,r3,r0                    #       v2 = v3
                                                    #       if (v3 < 0) {
8008bf54: 24620003 addiu r2,r3,0x0003               #           v2 = v3 + 3
                                                    #       }
8008bf58: 00021083 sra r2,r2,0x02
8008bf5c: 00021080 sll r2,r2,0x02                   #       v2 >> 2 << 2
8008bf60: 00621023 subu r2,r3,r2                    #       result = v3 - (v2 >> 2 << 2)
8008bf64: 00021400 sll r2,r2,0x10                   
8008bf68: 08022fdd j 0x8008bf74                     #       return result;
8008bf6c: 00021403 sra r2,r2,0x10
                                                    #   } else {
8008bf70: 2402ffff addiu r2,r0,-0x0001              #       return -1;
                                                    #   }
8008bf74: 8fbf0010 lw r31,0x0010(r29)
8008bf78: 27bd0018 addiu r29,r29,0x0018
8008bf7c: 03e00008 jr r31
8008bf80: 00000000 nop