Difference between revisions of "Sprite Move"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " # ROUTINE: SpriteMove? # Parameters: # r4 = (params) Parameter array for this event instruction # r5 = (0 if SpriteMove, 1 if SpriteMoveBeta)? ...")
 
 
Line 19: Line 19:
 
  80146974: afb10094 sw r17,0x0094(r29)
 
  80146974: afb10094 sw r17,0x0094(r29)
 
  80146978: 00021400 sll r2,r2,0x10
 
  80146978: 00021400 sll r2,r2,0x10
  8014697c: 0c04cc56 jal 0x80133158              #  MiscID = [[Get Misc ID]] (ENTDUnitID);
+
  8014697c: 0c04cc56 jal 0x80133158              #  MiscID = [[Get misc ID]] (ENTDUnitID);
 
  80146980: 00022403 sra r4,r2,0x10
 
  80146980: 00022403 sra r4,r2,0x10
 
  80146984: afa20058 sw r2,0x0058(r29)            #  MiscID
 
  80146984: afa20058 sw r2,0x0058(r29)            #  MiscID

Latest revision as of 23:16, 7 January 2017

#   ROUTINE: SpriteMove?
#       Parameters:
#           r4 = (params) Parameter array for this event instruction
#           r5 = (0 if SpriteMove, 1 if SpriteMoveBeta)?

80146940: 27bdff48 addiu r29,r29,-0x00b8
80146944: afb00090 sw r16,0x0090(r29)
80146948: 00808021 addu r16,r4,r0
8014694c: afb20098 sw r18,0x0098(r29)
80146950: 00a09021 addu r18,r5,r0
80146954: afbf00b4 sw r31,0x00b4(r29)
80146958: afbe00b0 sw r30,0x00b0(r29)
8014695c: afb700ac sw r23,0x00ac(r29)
80146960: afb600a8 sw r22,0x00a8(r29)
80146964: afb500a4 sw r21,0x00a4(r29)
80146968: afb400a0 sw r20,0x00a0(r29)
8014696c: afb3009c sw r19,0x009c(r29)
80146970: 0c05181e jal 0x80146078               #   ENTDUnitID = Load Halfword (params.UnitID);
80146974: afb10094 sw r17,0x0094(r29)
80146978: 00021400 sll r2,r2,0x10
8014697c: 0c04cc56 jal 0x80133158               #   MiscID = Get misc ID (ENTDUnitID);
80146980: 00022403 sra r4,r2,0x10
80146984: afa20058 sw r2,0x0058(r29)            #   MiscID
80146988: 8fa70058 lw r7,0x0058(r29)            #   MiscID
8014698c: 340207d0 ori r2,r0,0x07d0             #   0x07d0
80146990: 10e20147 beq r7,r2,0x80146eb0
80146994: 00000000 nop
80146998: 3c028017 lui r2,0x8017
8014699c: 8c424038 lw r2,0x4038(r2)
801469a0: 8fa40058 lw r4,0x0058(r29)
801469a4: 00021280 sll r2,r2,0x0a
801469a8: 3c018017 lui r1,0x8017
801469ac: 00220821 addu r1,r1,r2
801469b0: ac2798bc sw r7,-0x6744(r1)
801469b4: 0c023292 jal 0x8008ca48
801469b8: 26100002 addiu r16,r16,0x0002         #   paramPtr = params + 2
801469bc: 84430000 lh r3,0x0000(r2)
801469c0: 00000000 nop
801469c4: afa30010 sw r3,0x0010(r29)
801469c8: 84430002 lh r3,0x0002(r2)
801469cc: 00000000 nop
801469d0: afa30014 sw r3,0x0014(r29)
801469d4: 84430004 lh r3,0x0004(r2)
801469d8: 00000000 nop
801469dc: afa30018 sw r3,0x0018(r29)
801469e0: 84430000 lh r3,0x0000(r2)
801469e4: 00000000 nop
801469e8: 00031823 subu r3,r0,r3
801469ec: afa30040 sw r3,0x0040(r29)
801469f0: 84430002 lh r3,0x0002(r2)
801469f4: 0000a821 addu r21,r0,r0               #   count = 0
801469f8: 00031823 subu r3,r0,r3
801469fc: afa30044 sw r3,0x0044(r29)
80146a00: 84420004 lh r2,0x0004(r2)
80146a04: 27b10010 addiu r17,r29,0x0010         #   destPtr = &structData
80146a08: 00021023 subu r2,r0,r2
80146a0c: afa20048 sw r2,0x0048(r29)
                                                #   Load (X, Higher Elevation, Y)
                                                #   do {
80146a10: 0c05181e jal 0x80146078               #       param = Load Halfword (paramPtr)
80146a14: 02002021 addu r4,r16,r0
80146a18: 00021400 sll r2,r2,0x10
80146a1c: 00021403 sra r2,r2,0x10
80146a20: ae220010 sw r2,0x0010(r17)            #       *destPtr = param
80146a24: 26100002 addiu r16,r16,0x0002         #       paramPtr = paramPtr + 2     // (2 bytes; corresponds to 1 parameter)
80146a28: 26b50001 addiu r21,r21,0x0001         #       count = count + 1
80146a2c: 2aa20003 slti r2,r21,0x0003
80146a30: 1440fff7 bne r2,r0,0x80146a10
80146a34: 26310004 addiu r17,r17,0x0004         #       destPtr = destPtr + 4       // (4 bytes; corresponds to 1 parameter)
                                                #   } while (count < 3)
80146a38: 92070000 lbu r7,0x0000(r16)           #   MovementType = *paramPtr
80146a3c: 26100001 addiu r16,r16,0x0001         #   paramPtr = paramPtr + 1
80146a40: 26040001 addiu r4,r16,0x0001          #   paramPtr + 1
80146a44: afa70068 sw r7,0x0068(r29)            #   MovementType
80146a48: 92100000 lbu r16,0x0000(r16)          #   UnknownParam = *paramPtr
80146a4c: 0c05181e jal 0x80146078               #   SpeedOrNumFrames = Load Halfword (paramPtr + 1)
80146a50: afb00060 sw r16,0x0060(r29)           #   UnknownParam
80146a54: 00021400 sll r2,r2,0x10
80146a58: 0002f403 sra r30,r2,0x10              #   SpeedOrNumFrames
80146a5c: 34020001 ori r2,r0,0x0001             #   1 (SpriteMoveBeta)
80146a60: 16420017 bne r18,r2,0x80146ac0        #   if (SpriteMoveBeta) {       // (not SpriteMove)
80146a64: 00000000 nop
80146a68: 0000b821 addu r23,r0,r0               #       count = 0
80146a6c: 27a40010 addiu r4,r29,0x0010
                                                #       do {
80146a70: 8c820010 lw r2,0x0010(r4)
80146a74: 8c830000 lw r3,0x0000(r4)
80146a78: 00000000 nop
80146a7c: 00431023 subu r2,r2,r3
80146a80: 00420018 mult r2,r2
80146a84: 26f70001 addiu r23,r23,0x0001         #           count = count + 1
80146a88: 00001012 mflo r2
80146a8c: 00021100 sll r2,r2,0x04
80146a90: ac820020 sw r2,0x0020(r4)
80146a94: 2ae20003 slti r2,r23,0x0003
80146a98: 1440fff5 bne r2,r0,0x80146a70
80146a9c: 24840004 addiu r4,r4,0x0004
                                                #       } while (count < 3)
80146aa0: 8fa40030 lw r4,0x0030(r29)
80146aa4: 8fa20034 lw r2,0x0034(r29)
80146aa8: 8fa30038 lw r3,0x0038(r29)
80146aac: 00822021 addu r4,r4,r2
80146ab0: 0c006fce jal 0x8001bf38               #       result_0x1bf38 = func_0x1bf38($a0);
80146ab4: 00832021 addu r4,r4,r3
80146ab8: 005e001a div r2,r30
80146abc: 0000f012 mflo r30                     #       NumFrames = (result_0x1bf38) / SpeedOrNumFrames     // (Convert Speed into NumFrames)
                                                #   }
80146ac0: 0000a821 addu r21,r0,r0               #   count = 0
80146ac4: 27a40010 addiu r4,r29,0x0010          #   &structData
                                                #   do {
80146ac8: 26b50001 addiu r21,r21,0x0001         #       count = count + 1
80146acc: 8c820000 lw r2,0x0000(r4)
80146ad0: 8c830010 lw r3,0x0010(r4)
80146ad4: 00021200 sll r2,r2,0x08
80146ad8: 00031a00 sll r3,r3,0x08
80146adc: ac820000 sw r2,0x0000(r4)
80146ae0: ac830010 sw r3,0x0010(r4)
80146ae4: 2aa20003 slti r2,r21,0x0003
80146ae8: 1440fff7 bne r2,r0,0x80146ac8
80146aec: 24840004 addiu r4,r4,0x0004
                                                #   } while (count < 3)
80146af0: 34150001 ori r21,r0,0x0001            #   frame = 1
80146af4: 02be102a slt r2,r21,r30               
80146af8: 104000c3 beq r2,r0,0x80146e08
80146afc: 34020010 ori r2,r0,0x0010             #   16
                                                #   if (NumFrames > 1) {
80146b00: 8fa70060 lw r7,0x0060(r29)
80146b04: 00000000 nop
80146b08: 00471023 subu r2,r2,r7
80146b0c: 001e3940 sll r7,r30,0x05
80146b10: afa20070 sw r2,0x0070(r29)
80146b14: afa70078 sw r7,0x0078(r29)
                                                #       do {
80146b18: 0c0532a0 jal 0x8014ca80               #           Switch To Next Thread ();
80146b1c: 0000b821 addu r23,r0,r0
80146b20: 03d51023 subu r2,r30,r21
80146b24: 00550018 mult r2,r21
80146b28: 00003812 mflo r7
80146b2c: afa70080 sw r7,0x0080(r29)
80146b30: 8fa70078 lw r7,0x0078(r29)
80146b34: 00000000 nop
80146b38: 03c70018 mult r30,r7
80146b3c: 00003812 mflo r7
80146b40: afa70088 sw r7,0x0088(r29)
80146b44: 00171880 sll r3,r23,0x02
80146b48: 27a20010 addiu r2,r29,0x0010
80146b4c: 0062a021 addu r20,r3,r2
80146b50: 8e830010 lw r3,0x0010(r20)
80146b54: 8e820000 lw r2,0x0000(r20)
80146b58: 8fa70068 lw r7,0x0068(r29)
80146b5c: 00000000 nop
80146b60: 14e00007 bne r7,r0,0x80146b80
80146b64: 00622023 subu r4,r3,r2
80146b68: 02a02821 addu r5,r21,r0
80146b6c: 0c05332e jal 0x8014ccb8
80146b70: 03c03021 addu r6,r30,r0
80146b74: 8e830000 lw r3,0x0000(r20)
80146b78: 08051b4b j 0x80146d2c
80146b7c: 00431021 addu r2,r2,r3
80146b80: 34020001 ori r2,r0,0x0001
80146b84: 14e20019 bne r7,r2,0x80146bec
80146b88: 34020003 ori r2,r0,0x0003
80146b8c: 8fa70070 lw r7,0x0070(r29)
80146b90: 00000000 nop
80146b94: 00870018 mult r4,r7
80146b98: 00009012 mflo r18
80146b9c: 8fa70060 lw r7,0x0060(r29)
80146ba0: 00000000 nop
80146ba4: 00870018 mult r4,r7
80146ba8: 02a02821 addu r5,r21,r0
80146bac: 8fa60078 lw r6,0x0078(r29)
80146bb0: 00001012 mflo r2
80146bb4: 00028840 sll r17,r2,0x01
80146bb8: 02322021 addu r4,r17,r18
80146bbc: 0c05332e jal 0x8014ccb8
80146bc0: 00922021 addu r4,r4,r18
80146bc4: 00408021 addu r16,r2,r0
80146bc8: 8fa50080 lw r5,0x0080(r29)
80146bcc: 8fa60088 lw r6,0x0088(r29)
80146bd0: 0c05332e jal 0x8014ccb8
80146bd4: 02202021 addu r4,r17,r0
80146bd8: 8e830000 lw r3,0x0000(r20)
80146bdc: 02028021 addu r16,r16,r2
80146be0: 02031821 addu r3,r16,r3
80146be4: 08051b4c j 0x80146d30
80146be8: ae830020 sw r3,0x0020(r20)
80146bec: 14e20015 bne r7,r2,0x80146c44
80146bf0: 34020002 ori r2,r0,0x0002
80146bf4: 8fa70070 lw r7,0x0070(r29)
80146bf8: 00000000 nop
80146bfc: 00870018 mult r4,r7
80146c00: 00009012 mflo r18
80146c04: 8fa70060 lw r7,0x0060(r29)
80146c08: 00000000 nop
80146c0c: 00870018 mult r4,r7
80146c10: 02a02821 addu r5,r21,r0
80146c14: 03c03021 addu r6,r30,r0
80146c18: 00002012 mflo r4
80146c1c: 0c05332e jal 0x8014ccb8
80146c20: 00042040 sll r4,r4,0x01
80146c24: 00521021 addu r2,r2,r18
80146c28: 00522021 addu r4,r2,r18
80146c2c: 02a02821 addu r5,r21,r0
80146c30: 0c05332e jal 0x8014ccb8
80146c34: 001e3140 sll r6,r30,0x05
80146c38: 8e830000 lw r3,0x0000(r20)
80146c3c: 08051b4b j 0x80146d2c
80146c40: 00431021 addu r2,r2,r3
80146c44: 8fa70068 lw r7,0x0068(r29)
80146c48: 00000000 nop
80146c4c: 14e20038 bne r7,r2,0x80146d30
80146c50: 001e17c2 srl r2,r30,0x1f
80146c54: 03c21021 addu r2,r30,r2
80146c58: 00029843 sra r19,r2,0x01
80146c5c: 000417c2 srl r2,r4,0x1f
80146c60: 16600002 bne r19,r0,0x80146c6c
80146c64: 0082b021 addu r22,r4,r2
80146c68: 34130001 ori r19,r0,0x0001
80146c6c: 00151040 sll r2,r21,0x01
80146c70: 005e102a slt r2,r2,r30
80146c74: 10400014 beq r2,r0,0x80146cc8
80146c78: 02a02821 addu r5,r21,r0
80146c7c: 8fa70070 lw r7,0x0070(r29)
80146c80: 00000000 nop
80146c84: 00870018 mult r4,r7
80146c88: 00009012 mflo r18
80146c8c: 8fa70060 lw r7,0x0060(r29)
80146c90: 00000000 nop
80146c94: 00870018 mult r4,r7
80146c98: 02603021 addu r6,r19,r0
80146c9c: 00002012 mflo r4
80146ca0: 0c05332e jal 0x8014ccb8
80146ca4: 00042040 sll r4,r4,0x01
80146ca8: 00521021 addu r2,r2,r18
80146cac: 00522021 addu r4,r2,r18
80146cb0: 02a02821 addu r5,r21,r0
80146cb4: 0c05332e jal 0x8014ccb8
80146cb8: 00133180 sll r6,r19,0x06
80146cbc: 8e830000 lw r3,0x0000(r20)
80146cc0: 08051b4b j 0x80146d2c
80146cc4: 00431021 addu r2,r2,r3
80146cc8: 8fa70070 lw r7,0x0070(r29)
80146ccc: 00000000 nop
80146cd0: 00870018 mult r4,r7
80146cd4: 00009012 mflo r18
80146cd8: 8fa70060 lw r7,0x0060(r29)
80146cdc: 00000000 nop
80146ce0: 00870018 mult r4,r7
80146ce4: 02b38023 subu r16,r21,r19
80146ce8: 02702823 subu r5,r19,r16
80146cec: 02603021 addu r6,r19,r0
80146cf0: 00001012 mflo r2
80146cf4: 00028840 sll r17,r2,0x01
80146cf8: 0c05332e jal 0x8014ccb8
80146cfc: 02202021 addu r4,r17,r0
80146d00: 02221021 addu r2,r17,r2
80146d04: 00521021 addu r2,r2,r18
80146d08: 00522021 addu r4,r2,r18
80146d0c: 02002821 addu r5,r16,r0
80146d10: 0c05332e jal 0x8014ccb8
80146d14: 00133180 sll r6,r19,0x06
80146d18: 8e830000 lw r3,0x0000(r20)
80146d1c: 00000000 nop
80146d20: 00431021 addu r2,r2,r3
80146d24: 00161843 sra r3,r22,0x01
80146d28: 00431021 addu r2,r2,r3
80146d2c: ae820020 sw r2,0x0020(r20)
80146d30: 26f70001 addiu r23,r23,0x0001
80146d34: 2ae20003 slti r2,r23,0x0003
80146d38: 1440ff83 bne r2,r0,0x80146b48
80146d3c: 00171880 sll r3,r23,0x02
80146d40: 8fa40058 lw r4,0x0058(r29)
80146d44: 0c0232ed jal 0x8008cbb4
80146d48: 00000000 nop
80146d4c: 14400004 bne r2,r0,0x80146d60
80146d50: 27b00050 addiu r16,r29,0x0050
80146d54: 0c053256 jal 0x8014c958
80146d58: 00000000 nop
80146d5c: 27b00050 addiu r16,r29,0x0050
80146d60: 8fa40058 lw r4,0x0058(r29)
80146d64: 97a20040 lhu r2,0x0040(r29)
80146d68: 97a30044 lhu r3,0x0044(r29)
80146d6c: 97a60048 lhu r6,0x0048(r29)
80146d70: 02002821 addu r5,r16,r0
80146d74: a7a20050 sh r2,0x0050(r29)
80146d78: a7a30052 sh r3,0x0052(r29)
80146d7c: 0c023271 jal 0x8008c9c4
80146d80: a7a60054 sh r6,0x0054(r29)
80146d84: 8fa20030 lw r2,0x0030(r29)
80146d88: 00000000 nop
80146d8c: 04410002 bgez r2,0x80146d98
80146d90: 00000000 nop
80146d94: 244200ff addiu r2,r2,0x00ff
80146d98: 8fa30034 lw r3,0x0034(r29)
80146d9c: 00021203 sra r2,r2,0x08
80146da0: 04610002 bgez r3,0x80146dac
80146da4: a7a20050 sh r2,0x0050(r29)
80146da8: 246300ff addiu r3,r3,0x00ff
80146dac: 8fa60038 lw r6,0x0038(r29)
80146db0: 00031203 sra r2,r3,0x08
80146db4: 04c10002 bgez r6,0x80146dc0
80146db8: a7a20052 sh r2,0x0052(r29)
80146dbc: 24c600ff addiu r6,r6,0x00ff
80146dc0: 02002821 addu r5,r16,r0
80146dc4: 8fa40058 lw r4,0x0058(r29)
80146dc8: 00061203 sra r2,r6,0x08
80146dcc: 0c023271 jal 0x8008c9c4
80146dd0: a7a20054 sh r2,0x0054(r29)
80146dd4: 26b50001 addiu r21,r21,0x0001         #           frame = frame + 1
80146dd8: 87a20050 lh r2,0x0050(r29)
80146ddc: 87a30054 lh r3,0x0054(r29)
80146de0: 00021023 subu r2,r0,r2
80146de4: afa20040 sw r2,0x0040(r29)
80146de8: 87a20052 lh r2,0x0052(r29)
80146dec: 00031823 subu r3,r0,r3
80146df0: afa30048 sw r3,0x0048(r29)
80146df4: 00021023 subu r2,r0,r2
80146df8: afa20044 sw r2,0x0044(r29)
80146dfc: 02be102a slt r2,r21,r30
80146e00: 1440ff45 bne r2,r0,0x80146b18         #       } while (frame < NumFrames)
80146e04: 00000000 nop
                                                #   }
80146e08: 8fa40058 lw r4,0x0058(r29)
80146e0c: 0c0232ed jal 0x8008cbb4               #   result_0x8cbb4 = ? 0x8cbb4 ($a0); (Returns 1 if a misc data pointer exists for this unit misc ID, 0 otherwise?)
80146e10: 00000000 nop
80146e14: 14400004 bne r2,r0,0x80146e28         
80146e18: 27b00050 addiu r16,r29,0x0050
                                                #   if (result_0x8cbb4 == 0) {
80146e1c: 0c053256 jal 0x8014c958               #       Stop Current Thread ();
80146e20: 00000000 nop
80146e24: 27b00050 addiu r16,r29,0x0050
                                                #   }
80146e28: 8fa40058 lw r4,0x0058(r29)
80146e2c: 97a20040 lhu r2,0x0040(r29)
80146e30: 97a30044 lhu r3,0x0044(r29)
80146e34: 97a60048 lhu r6,0x0048(r29)
80146e38: 02002821 addu r5,r16,r0
80146e3c: a7a20050 sh r2,0x0050(r29)
80146e40: a7a30052 sh r3,0x0052(r29)
80146e44: 0c023271 jal 0x8008c9c4
80146e48: a7a60054 sh r6,0x0054(r29)
80146e4c: 8fa20020 lw r2,0x0020(r29)
80146e50: 00000000 nop
80146e54: 04410002 bgez r2,0x80146e60
80146e58: 00000000 nop
80146e5c: 244200ff addiu r2,r2,0x00ff
80146e60: 8fa40024 lw r4,0x0024(r29)
80146e64: 00021203 sra r2,r2,0x08
80146e68: 04810002 bgez r4,0x80146e74
80146e6c: a7a20050 sh r2,0x0050(r29)
80146e70: 248400ff addiu r4,r4,0x00ff
80146e74: 8fa30028 lw r3,0x0028(r29)
80146e78: 00041203 sra r2,r4,0x08
80146e7c: 04610002 bgez r3,0x80146e88
80146e80: a7a20052 sh r2,0x0052(r29)
80146e84: 246300ff addiu r3,r3,0x00ff
80146e88: 00031203 sra r2,r3,0x08
80146e8c: 8fa40058 lw r4,0x0058(r29)
80146e90: 02002821 addu r5,r16,r0
80146e94: 0c023271 jal 0x8008c9c4
80146e98: a7a20054 sh r2,0x0054(r29)
80146e9c: 34020001 ori r2,r0,0x0001
80146ea0: 17c20003 bne r30,r2,0x80146eb0
80146ea4: 00000000 nop
80146ea8: 0c0532a0 jal 0x8014ca80
80146eac: 00000000 nop
80146eb0: 8fbf00b4 lw r31,0x00b4(r29)
80146eb4: 8fbe00b0 lw r30,0x00b0(r29)
80146eb8: 8fb700ac lw r23,0x00ac(r29)
80146ebc: 8fb600a8 lw r22,0x00a8(r29)
80146ec0: 8fb500a4 lw r21,0x00a4(r29)
80146ec4: 8fb400a0 lw r20,0x00a0(r29)
80146ec8: 8fb3009c lw r19,0x009c(r29)
80146ecc: 8fb20098 lw r18,0x0098(r29)
80146ed0: 8fb10094 lw r17,0x0094(r29)
80146ed4: 8fb00090 lw r16,0x0090(r29)
80146ed8: 27bd00b8 addiu r29,r29,0x00b8
80146edc: 03e00008 jr r31
80146ee0: 00000000 nop