Get Effect Screen Location Data From Unit Data
Jump to navigation
Jump to search
# ROUTINE: GET EFFECT SCREEN LOCATION DATA FROM UNIT DATA # Parameters: # r4 = (p1) Sometimes 0 : Either 0 or 8? # r5 = (p2) Sometimes 0, sometimes -1 # r6 = (effectMiscData) 0x801bad0c data # r7 = (destPtr) Destination struct pointer 801a90d0: 27bdffe0 addiu r29,r29,-0x0020 801a90d4: afb20018 sw r18,0x0018(r29) 801a90d8: 00809021 addu r18,r4,r0 # p1 801a90dc: afb00010 sw r16,0x0010(r29) 801a90e0: 00c08021 addu r16,r6,r0 # effectMiscData 801a90e4: afb10014 sw r17,0x0014(r29) 801a90e8: 00e08821 addu r17,r7,r0 # destPtr 801a90ec: 2402ffff addiu r2,r0,-0x0001 # -1 801a90f0: 14a2003c bne r5,r2,0x801a91e4 801a90f4: afbf001c sw r31,0x001c(r29) # if (p2 == -1) { 801a90f8: 960200a4 lhu r2,0x00a4(r16) # effectMiscData.0xa4 801a90fc: 00000000 nop 801a9100: 1440001f bne r2,r0,0x801a9180 # if (effectMiscData.0xa4 == 0) { 801a9104: 00000000 nop 801a9108: 920400a6 lbu r4,0x00a6(r16) # effectMiscData.unitMiscID 801a910c: 0c023104 jal 0x8008c410 # screenLocationPtr = Get Unit Screen Location Data Pointer (effectMiscData.unitMiscID); 801a9110: 00000000 nop 801a9114: 88430003 lwl r3,0x0003(r2) 801a9118: 98430000 lwr r3,0x0000(r2) # *screenLocationPtr 801a911c: 88440007 lwl r4,0x0007(r2) 801a9120: 98440004 lwr r4,0x0004(r2) # *(screenLocationPtr + 4) 801a9124: aa230003 swl r3,0x0003(r17) 801a9128: ba230000 swr r3,0x0000(r17) # *destPtr = *screenLocationPtr 801a912c: aa240007 swl r4,0x0007(r17) 801a9130: 12400072 beq r18,r0,0x801a92fc 801a9134: ba240004 swr r4,0x0004(r17) # *(destPtr + 4) = *(screenLocationPtr + 4) # if (p1 == 0) return; 801a9138: 920400a6 lbu r4,0x00a6(r16) # effectMiscData.unitMiscID 801a913c: 0c0237de jal 0x8008df78 # tile = Get Tile Data Pointer From Unit Misc ID (effectMiscData.unitMiscID); 801a9140: 00000000 nop 801a9144: 00402021 addu r4,r2,r0 # tile 801a9148: 90820003 lbu r2,0x0003(r4) # tile.0x03 801a914c: 90830002 lbu r3,0x0002(r4) # tile.height 801a9150: 00021142 srl r2,r2,0x05 # tileDepth = tile.0x03 >> 5 801a9154: 00621821 addu r3,r3,r2 # tileValue = tile.height + tileDepth 801a9158: 00031040 sll r2,r3,0x01 # tileValue * 2 801a915c: 00431021 addu r2,r2,r3 # tileValue * 3 801a9160: 00021080 sll r2,r2,0x02 # tileValue * 12 801a9164: 86230002 lh r3,0x0002(r17) # *(destPtr + 2) 801a9168: 00021023 subu r2,r0,r2 # negativeTileValue = -(tileValue * 12) 801a916c: 0043182a slt r3,r2,r3 801a9170: 10600062 beq r3,r0,0x801a92fc 801a9174: 00000000 nop 801a9178: 0806a4bf j 0x801a92fc # if (negativeTileValue < *(destPtr + 2)) { 801a917c: a6220002 sh r2,0x0002(r17) # *(destPtr + 2) = negativeTileValue # } # return; # } else { 801a9180: 860400a6 lh r4,0x00a6(r16) # effectMiscData.0xa6 801a9184: 860500aa lh r5,0x00aa(r16) # effectMiscData.0xaa 801a9188: 860600a8 lh r6,0x00a8(r16) # effectMiscData.0xab 801a918c: 0c060fed jal 0x80183fb4 # tile = Get Tile Data Pointer (effectMiscData.0xa6, effectMiscData.0xaa, effectMiscData.0xab); 801a9190: 00000000 nop 801a9194: 860400a6 lh r4,0x00a6(r16) # effectMiscData.0xa6 801a9198: 00000000 nop 801a919c: 000418c0 sll r3,r4,0x03 # effectMiscData.0xa6 * 8 801a91a0: 00641823 subu r3,r3,r4 # effectMiscData.0xa6 * 7 801a91a4: 00031880 sll r3,r3,0x02 # effectMiscData.0xa6 * 28 801a91a8: 2463000e addiu r3,r3,0x000e # (effectMiscData.0xa6 * 28) + 14 801a91ac: a6230000 sh r3,0x0000(r17) # *destPtr = ((effectMiscData.0xa6 * 28) + 14) 801a91b0: 860300aa lh r3,0x00aa(r16) # effectMiscData.0xaa 801a91b4: 00402021 addu r4,r2,r0 # tile 801a91b8: 000310c0 sll r2,r3,0x03 # effectMiscData.0xaa * 8 801a91bc: 00431023 subu r2,r2,r3 # effectMiscData.0xaa * 7 801a91c0: 00021080 sll r2,r2,0x02 # effectMiscData.0xaa * 28 801a91c4: 2442000e addiu r2,r2,0x000e # (effectMiscData.0xaa * 28) + 14 801a91c8: 12400045 beq r18,r0,0x801a92e0 801a91cc: a6220004 sh r2,0x0004(r17) # *(destPtr + 4) = (effectMiscData.0xaa * 28) + 14 # if (p1 != 0) { 801a91d0: 90820003 lbu r2,0x0003(r4) # tile.0x03 801a91d4: 90830002 lbu r3,0x0002(r4) # tile.height 801a91d8: 00021142 srl r2,r2,0x05 # tileDepth = tile.0x03 >> 5 801a91dc: 0806a4b9 j 0x801a92e4 801a91e0: 00621821 addu r3,r3,r2 # tileValue = tile.height + tileDepth # } else { tileValue = *(destPtr + 2) } # } # } else { 801a91e4: 00051080 sll r2,r5,0x02 # p2 * 4 801a91e8: 00451021 addu r2,r2,r5 # p2 * 5 801a91ec: 00021040 sll r2,r2,0x01 # p2 * 10 801a91f0: 02028021 addu r16,r16,r2 # effectMiscData + (p2 * 10) 801a91f4: 96020004 lhu r2,0x0004(r16) # *(effectMiscData + (p2 * 10) + 4) 801a91f8: 00000000 nop 801a91fc: 1440001f bne r2,r0,0x801a927c # if (*(effectMiscData + (p2 * 10) + 4) == 0) { 801a9200: 00000000 nop 801a9204: 92040006 lbu r4,0x0006(r16) # effectMiscData.0x06 801a9208: 0c023104 jal 0x8008c410 # screenLocationPtr = Get Unit Screen Location Data Pointer (effectMiscData.0x06); 801a920c: 00000000 nop 801a9210: 88430003 lwl r3,0x0003(r2) 801a9214: 98430000 lwr r3,0x0000(r2) # *screenLocationPtr 801a9218: 88440007 lwl r4,0x0007(r2) 801a921c: 98440004 lwr r4,0x0004(r2) # *(screenLocationPtr + 4) 801a9220: aa230003 swl r3,0x0003(r17) 801a9224: ba230000 swr r3,0x0000(r17) # *destPtr = *screenLocationPtr 801a9228: aa240007 swl r4,0x0007(r17) 801a922c: 12400033 beq r18,r0,0x801a92fc 801a9230: ba240004 swr r4,0x0004(r17) # *(destPtr + 4) = *(screenLocationPtr + 4) # if (p1 == 0) return; 801a9234: 92040006 lbu r4,0x0006(r16) # effectMiscData.0x06 801a9238: 0c0237de jal 0x8008df78 # tile = Get Tile Data Pointer From Unit Misc ID (effectMiscData.0x06); 801a923c: 00000000 nop 801a9240: 00402021 addu r4,r2,r0 # tile 801a9244: 90820003 lbu r2,0x0003(r4) # tile.0x03 801a9248: 90830002 lbu r3,0x0002(r4) # tile.height 801a924c: 00021142 srl r2,r2,0x05 # tileDepth = tile.0x03 >> 5 801a9250: 00621821 addu r3,r3,r2 # tileValue = tile.height + tileDepth 801a9254: 00031040 sll r2,r3,0x01 # tileValue * 2 801a9258: 00431021 addu r2,r2,r3 # tileValue * 3 801a925c: 00021080 sll r2,r2,0x02 # tileValue * 12 801a9260: 86230002 lh r3,0x0002(r17) # *(destPtr + 2) 801a9264: 00021023 subu r2,r0,r2 # negativeTileValue = -(tileValue * 12) 801a9268: 0043182a slt r3,r2,r3 801a926c: 10600023 beq r3,r0,0x801a92fc 801a9270: 00000000 nop 801a9274: 0806a4bf j 0x801a92fc # if (negativeTileValue < *(destPtr + 2)) { 801a9278: a6220002 sh r2,0x0002(r17) # *(destPtr + 2) = negativeTileValue # } # return; # } else { 801a927c: 86040006 lh r4,0x0006(r16) # effectMiscData.0x06 801a9280: 8605000a lh r5,0x000a(r16) # effectMiscData.0x0a 801a9284: 86060008 lh r6,0x0008(r16) # effectMiscData.0x08 801a9288: 0c060fed jal 0x80183fb4 # tile = Get Tile Data Pointer (effectMiscData.0x06, effectMiscData.0x0a, effectMiscData.0x0b); 801a928c: 00000000 nop 801a9290: 86040006 lh r4,0x0006(r16) # effectMiscData.0x06 801a9294: 00000000 nop 801a9298: 000418c0 sll r3,r4,0x03 # effectMiscData.0x06 * 8 801a929c: 00641823 subu r3,r3,r4 # effectMiscData.0x06 * 7 801a92a0: 00031880 sll r3,r3,0x02 # effectMiscData.0x06 * 28 801a92a4: 2463000e addiu r3,r3,0x000e # (effectMiscData.0x06 * 28) + 14 801a92a8: a6230000 sh r3,0x0000(r17) # *destPtr = (effectMiscData.0x06 * 28) + 14 801a92ac: 8603000a lh r3,0x000a(r16) # effectMiscData.0x0a 801a92b0: 00402021 addu r4,r2,r0 # tile 801a92b4: 000310c0 sll r2,r3,0x03 # effectMiscData.0x0a * 8 801a92b8: 00431023 subu r2,r2,r3 # effectMiscData.0x0a * 7 801a92bc: 00021080 sll r2,r2,0x02 # effectMiscData.0x0a * 28 801a92c0: 2442000e addiu r2,r2,0x000e # (effectMiscData.0x0a * 28) + 14 801a92c4: 12400006 beq r18,r0,0x801a92e0 801a92c8: a6220004 sh r2,0x0004(r17) # *(destPtr + 4) = (effectMiscData.0x0a * 28) + 14 # if (p1 != 0) { 801a92cc: 90820003 lbu r2,0x0003(r4) # tile.0x03 801a92d0: 90830002 lbu r3,0x0002(r4) # tile.height 801a92d4: 00021142 srl r2,r2,0x05 # tileDepth = tile.0x03 >> 5 801a92d8: 0806a4b9 j 0x801a92e4 801a92dc: 00621821 addu r3,r3,r2 # tileValue = tile.height + tileDepth # } else { 801a92e0: 90830002 lbu r3,0x0002(r4) # tileValue = *(destPtr + 2) # } # } 801a92e4: 00000000 nop # } 801a92e8: 00031040 sll r2,r3,0x01 # tileValue * 2 801a92ec: 00431021 addu r2,r2,r3 # tileValue * 3 801a92f0: 00021080 sll r2,r2,0x02 # tileValue * 12 801a92f4: 00021023 subu r2,r0,r2 # -(tileValue * 12) 801a92f8: a6220002 sh r2,0x0002(r17) # *(destPtr + 2) = -(tileValue * 12) 801a92fc: 8fbf001c lw r31,0x001c(r29) 801a9300: 8fb20018 lw r18,0x0018(r29) 801a9304: 8fb10014 lw r17,0x0014(r29) 801a9308: 8fb00010 lw r16,0x0010(r29) 801a930c: 27bd0020 addiu r29,r29,0x0020 801a9310: 03e00008 jr r31 801a9314: 00000000 nop