Calculate Height Difference Between Units
Jump to navigation
Jump to search
0019b6b0: 90a20048 lbu r2,0x0048(r5) Load Target's Y 0019b6b4: 3c06801a lui r6,0x801a 0019b6b8: 90c601fe lbu r6,0x01fe(r6) Load Map Max X 0019b6bc: 00000000 nop 0019b6c0: 00460018 mult r2,r6 TY * Max X 0019b6c4: 00003812 mflo r7 0019b6c8: 90830002 lbu r3,0x0002(r4) Load Acting Unit's Y 0019b6cc: 94a20048 lhu r2,0x0048(r5) Load Target's Y + Map Level 0019b6d0: 00660018 mult r3,r6 AY * Max X 0019b6d4: 000213c2 srl r2,r2,0x0f r2 = Map Level 0019b6d8: 00021200 sll r2,r2,0x08 Map Level * 256 0019b6dc: 00471021 addu r2,r2,r7 TY * Max X + Map Level * 256 0019b6e0: 90a30047 lbu r3,0x0047(r5) Load Target's X 0019b6e4: 3c058019 lui r5,0x8019 0019b6e8: 24a5f8cc addiu r5,r5,0xf8cc 0019b6ec: 00431021 addu r2,r2,r3 Tile ID = TY * Max X + Map Level * 256 + TX 0019b6f0: 000210c0 sll r2,r2,0x03 ID * 8 0019b6f4: 00453021 addu r6,r2,r5 r6 = Target's Tile ID 0019b6f8: 90830001 lbu r3,0x0001(r4) Load Acting Unit's Map Level 0019b6fc: 90840000 lbu r4,0x0000(r4) Load Acting Unit's X 0019b700: 00031a00 sll r3,r3,0x08 Map Level * 256 0019b704: 00001012 mflo r2 0019b708: 00621821 addu r3,r3,r2 AY * Max X + Map Level * 256 0019b70c: 00641821 addu r3,r3,r4 Tile ID = AY * Max X + Map Level * 256 + AX 0019b710: 000318c0 sll r3,r3,0x03 ID * 8 0019b714: 90c20002 lbu r2,0x0002(r6) Load Target's Tile Height 0019b718: 90c40003 lbu r4,0x0003(r6) Load Target's Tile Halves + Depth 0019b71c: 00653021 addu r6,r3,r5 r6 = Acting Unit's Tile ID 0019b720: 90c30003 lbu r3,0x0003(r6) Load Acting Unit's Tile Halves + Depth 0019b724: 00021040 sll r2,r2,0x01 THeight * 2 0019b728: 3084001f andi r4,r4,0x001f r4 = THalves 0019b72c: 00441021 addu r2,r2,r4 TTotal Height = THeight * 2 + THalves 0019b730: 90c40002 lbu r4,0x0002(r6) Load Acting Unit's Tile Height 0019b734: 3063001f andi r3,r3,0x001f r3 = AHalves 0019b738: 00042040 sll r4,r4,0x01 AHeight * 2 0019b73c: 00832021 addu r4,r4,r3 ATotal Height = AHeight * 2 + AHalves 0019b740: 00441023 subu r2,r2,r4 Height Difference = TTotal Height - ATotal Height 0019b744: 00021fc2 srl r3,r2,0x1f 0019b748: 00431021 addu r2,r2,r3 0019b74c: 03e00008 jr r31 0019b750: 00021043 sra r2,r2,0x01 Height Difference / 2