Linear Attack Tile Calculation
Jump to navigation
Jump to search
Linear Attack Tile Calculation
0017c044: 34020002 ori r2,r0,0x0002 0017c048: 10820010 beq r4,r2,0x0017c08c Branch if Direction = 2 0017c04c: 28820003 slti r2,r4,0x0003 0017c050: 10400005 beq r2,r0,0x0017c068 Branch if Direction >= 3 0017c054: 00000000 nop 0017c058: 1080000a beq r4,r0,0x0017c084 Branch if Direction = 0 0017c05c: 34090001 ori r9,r0,0x0001 X Mod = 1
- Direction = 1*
0017c060: 0805f054 j 0x0017c150 (quit) 0017c064: 00000000 nop 0017c068: 34020004 ori r2,r0,0x0004 0017c06c: 1082000c beq r4,r2,0x0017c0a0 Branch if Direction = 4 0017c070: 34020006 ori r2,r0,0x0006 0017c074: 10820008 beq r4,r2,0x0017c098 Branch if Direction = 6 0017c078: 00004821 addu r9,r0,r0 X Mod = 0
- Direction = 3 or 5*
0017c07c: 0805f054 j 0x0017c150 (quit) 0017c080: 00000000 nop
- Direction = 0*
0017c084: 0805f02a j 0x0017c0a8 0017c088: 00004021 addu r8,r0,r0 Y Mod = 0; X Mod = 1
- Direction = 2*
0017c08c: 2409ffff addiu r9,r0,0xffff X Mod = -1 0017c090: 0805f02a j 0x0017c0a8 0017c094: 00004021 addu r8,r0,r0 Y Mod = 0
- Direction = 6*
0017c098: 0805f02a j 0x0017c0a8 0017c09c: 34080001 ori r8,r0,0x0001 Y Mod = 1; X Mod = 0
- Direction = 4*
0017c0a0: 00004821 addu r9,r0,r0 X Mod = 0 0017c0a4: 2408ffff addiu r8,r0,0xffff Y Mod = -1 0017c0a8: 00003821 addu r7,r0,r0 Counter = 0 0017c0ac: 3c0b8019 lui r11,0x8019 0017c0b0: 256b2dd8 addiu r11,r11,0x2dd8 r11 = ? Tile Data Pointer 0017c0b4: 340a0001 ori r10,r0,0x0001 r10 = 1 0017c0b8: 04a00025 bltz r5,0x0017c150 Branch if X is negative 0017c0bc: 00000000 nop 0017c0c0: 3c03800e lui r3,0x800e 0017c0c4: 90634e9c lbu r3,0x4e9c(r3) Load Map Max X 0017c0c8: 00000000 nop 0017c0cc: 00a3102a slt r2,r5,r3 0017c0d0: 1040001f beq r2,r0,0x0017c150 Branch if X >= Max X 0017c0d4: 00000000 nop 0017c0d8: 04c0001d bltz r6,0x0017c150 Branch if Y is negative 0017c0dc: 00000000 nop 0017c0e0: 3c02800e lui r2,0x800e 0017c0e4: 90424ea0 lbu r2,0x4ea0(r2) Load Map Max Y 0017c0e8: 00000000 nop 0017c0ec: 00c2102a slt r2,r6,r2 0017c0f0: 10400017 beq r2,r0,0x0017c150 Branch if Y >= Max Y 0017c0f4: 00c30018 mult r6,r3 Y * Max X 0017c0f8: 00001012 mflo r2 0017c0fc: 00452021 addu r4,r2,r5 Tile ID = Y * Max X + X 0017c100: 00041080 sll r2,r4,0x02 ID * 4 0017c104: 00441021 addu r2,r2,r4 ID * 5 0017c108: 004b1821 addu r3,r2,r11 0017c10c: 90620000 lbu r2,0x0000(r3) Load Low Tile's AoE 0017c110: 00000000 nop 0017c114: 10400002 beq r2,r0,0x0017c120 Branch if Low AoE = 0 0017c118: 24840100 addiu r4,r4,0x0100 Tile ID + 0x100 0017c11c: a06a0001 sb r10,0x0001(r3) Store Tile Targeted? = True 0017c120: 00041080 sll r2,r4,0x02 ID * 4 0017c124: 00441021 addu r2,r2,r4 ID * 5 0017c128: 004b1821 addu r3,r2,r11 0017c12c: 90620000 lbu r2,0x0000(r3) Load High Tile's AoE 0017c130: 00000000 nop 0017c134: 10400002 beq r2,r0,0x0017c140 Branch if High AoE = 0 0017c138: 00c83021 addu r6,r6,r8 Y += Y Mod 0017c13c: a06a0001 sb r10,0x0001(r3) Store Tile Targeted? = True 0017c140: 24e70001 addiu r7,r7,0x0001 Counter ++ 0017c144: 28e20020 slti r2,r7,0x0020 0017c148: 1440ffdb bne r2,r0,0x0017c0b8 Branch if Counter < 0x20 0017c14c: 00a92821 addu r5,r5,r9 X += X Mod 0017c150: 03e00008 jr r31 0017c154: 00000000 nop