Slope Calculations
Jump to navigation
Jump to search
Calculate Z Mod Current Stack: 0x10 - Unit's X 0x12 - Unit's Y Previous Stack: 0x00 - Mount/Unit's X Mod 0x02 - Mount/Unit's Map Level 0x03 - 0x04 - Mount/Unit's Y Mod
0007c80c: 27bdffd8 addiu r29,r29,0xffd8 (routine has a really bad setup - could be MUCH better) 0007c810: afb00018 sw r16,0x0018(r29) 0007c814: 00808021 addu r16,r4,r0 r16 = Stack Pointer 0007c818: afb1001c sw r17,0x001c(r29) 0007c81c: 3c119249 lui r17,0x9249 r17 = -0.42857143 (-3 / 7) 0007c820: afbf0020 sw r31,0x0020(r29) (is 4 / 7, but mult makes it negative) 0007c824: 96020000 lhu r2,0x0000(r16) Load X Mod 0007c828: 36312493 ori r17,r17,0x2493 0007c82c: 00021400 sll r2,r2,0x10 0007c830: 00021c03 sra r3,r2,0x10 r3 = X Mod 0007c834: 00710018 mult r3,r17 X Mod * -3 / 7 0007c838: 000217c3 sra r2,r2,0x1f (multu would do this without needing to 0007c83c: 00002010 mfhi r4 add the base back into it, afaik) 0007c840: 00832021 addu r4,r4,r3 X Mod * 4 / 7 (cancels the negative) 0007c844: 00042103 sra r4,r4,0x04 Unit's X = XMod / 28 0007c848: 00822023 subu r4,r4,r2 0007c84c: a7a40010 sh r4,0x0010(r29) Store Unit's X 0007c850: 96030004 lhu r3,0x0004(r16) Load Y Mod 0007c854: 00000000 nop 0007c858: 00031c00 sll r3,r3,0x10 0007c85c: 00033403 sra r6,r3,0x10 0007c860: 00d10018 mult r6,r17 Y Mod * -3 / 7 0007c864: 00042400 sll r4,r4,0x10 0007c868: 00042403 sra r4,r4,0x10 0007c86c: 00031fc3 sra r3,r3,0x1f 0007c870: 00001010 mfhi r2 0007c874: 00461021 addu r2,r2,r6 Y Mod * 4 / 7 0007c878: 00021103 sra r2,r2,0x04 Unit's Y = Y Mod / 28 0007c87c: 00431023 subu r2,r2,r3 0007c880: a7a20012 sh r2,0x0012(r29) Store Unit's Y 0007c884: 00021400 sll r2,r2,0x10 0007c888: 30a600ff andi r6,r5,0x00ff r6 = Unit's Map Level 0007c88c: 0c060fed jal 0x00183fb4 Get Tile's Data Pointer 0007c890: 00022c03 sra r5,r2,0x10 r5 = Unit's Y 0007c894: 00402821 addu r5,r2,r0 r5 = Tile Data Pointer 0007c898: 90a30002 lbu r3,0x0002(r5) Load Tile's Height 0007c89c: 00000000 nop 0007c8a0: 00031040 sll r2,r3,0x01 Height * 2 0007c8a4: 00431021 addu r2,r2,r3 Height * 3 0007c8a8: 00021080 sll r2,r2,0x02 Height * 12 0007c8ac: 00025023 subu r10,r0,r2 Z Mod = -Height * 12 0007c8b0: 90a20003 lbu r2,0x0003(r5) Load Halves + Depth 0007c8b4: 00000000 nop 0007c8b8: 3049001f andi r9,r2,0x001f r9 = Halves 0007c8bc: 112001c6 beq r9,r0,0x0007cfd8 Branch if Halves = 0 (skips ALL of the slope checks) 0007c8c0: 01402021 addu r4,r10,r0 r4 = Z Mod 0007c8c4: 90a30004 lbu r3,0x0004(r5) Load Slope Type 0007c8c8: 34020052 ori r2,r0,0x0052 0007c8cc: 1062002f beq r3,r2,0x0007c98c Branch if Slope Type = 0x52 0007c8d0: 28620053 slti r2,r3,0x0053 0007c8d4: 10400013 beq r2,r0,0x0007c924 Branch if Slope Type >= 0x53 0007c8d8: 34020025 ori r2,r0,0x0025 0007c8dc: 1062004f beq r3,r2,0x0007ca1c Branch if Slope Type = 0x25 0007c8e0: 00000000 nop 0007c8e4: 28620026 slti r2,r3,0x0026 0007c8e8: 10400007 beq r2,r0,0x0007c908 Branch if Slope Type >= 0x26 0007c8ec: 34020011 ori r2,r0,0x0011 0007c8f0: 10620084 beq r3,r2,0x0007cb04 Branch if Slope Type = 0x11 0007c8f4: 34020014 ori r2,r0,0x0014 0007c8f8: 106200ac beq r3,r2,0x0007cbac Branch if Slope Type = 0x14 0007c8fc: 00041400 sll r2,r4,0x10 0007c900: 0801f3f7 j 0x0007cfdc 0007c904: 00000000 nop 0007c908: 34020041 ori r2,r0,0x0041 0007c90c: 10620059 beq r3,r2,0x0007ca74 Branch if Slope Type = 0x41 0007c910: 34020044 ori r2,r0,0x0044 0007c914: 106200cd beq r3,r2,0x0007cc4c Branch if Slope Type = 0x44 0007c918: 00041400 sll r2,r4,0x10 0007c91c: 0801f3f7 j 0x0007cfdc 0007c920: 00000000 nop 0007c924: 34020069 ori r2,r0,0x0069 0007c928: 1062013d beq r3,r2,0x0007ce20 Branch if Slope Type = 0x69 0007c92c: 2862006a slti r2,r3,0x006a 0007c930: 10400008 beq r2,r0,0x0007c954 Branch if Slope Type >= 0x6a 0007c934: 34020058 ori r2,r0,0x0058 0007c938: 10620025 beq r3,r2,0x0007c9d0 Branch if Slope Type = 0x58 0007c93c: 00000000 nop 0007c940: 34020066 ori r2,r0,0x0066 0007c944: 1062010c beq r3,r2,0x0007cd78 Branch if Slope Type = 0x66 0007c948: 00041400 sll r2,r4,0x10 0007c94c: 0801f3f7 j 0x0007cfdc 0007c950: 00000000 nop 0007c954: 34020096 ori r2,r0,0x0096 0007c958: 106200e3 beq r3,r2,0x0007cce8 Branch if Slope Type = 0x96 0007c95c: 28620097 slti r2,r3,0x0097 0007c960: 10400005 beq r2,r0,0x0007c978 Branch if Slope Type >= 0x97 0007c964: 34020085 ori r2,r0,0x0085 0007c968: 1062003f beq r3,r2,0x0007ca68 Branch if Slope Type = 0x85 0007c96c: 00041400 sll r2,r4,0x10 0007c970: 0801f3f7 j 0x0007cfdc 0007c974: 00000000 nop 0007c978: 34020099 ori r2,r0,0x0099 0007c97c: 10620150 beq r3,r2,0x0007cec0 Branch if Slope Type = 0x99 0007c980: 00041400 sll r2,r4,0x10 0007c984: 0801f3f7 j 0x0007cfdc 0007c988: 00000000 nop
- Slope Type = 0x52*
0007c98c: 96030000 lhu r3,0x0000(r16) Load X Mod 0007c990: 00000000 nop 0007c994: 00031c00 sll r3,r3,0x10 0007c998: 00032403 sra r4,r3,0x10 0007c99c: 00910018 mult r4,r17 X Mod * -3 / 7 0007c9a0: 00031fc3 sra r3,r3,0x1f 0007c9a4: 00001010 mfhi r2 0007c9a8: 00441021 addu r2,r2,r4 X Mod * 4 / 7 0007c9ac: 00021103 sra r2,r2,0x04 X = X Mod / 28 0007c9b0: 00431023 subu r2,r2,r3 0007c9b4: 000218c0 sll r3,r2,0x03 X * 8 0007c9b8: 00621823 subu r3,r3,r2 X * 7 0007c9bc: 00031880 sll r3,r3,0x02 X * 28 0007c9c0: 00832023 subu r4,r4,r3 X Slope = X Mod - X * 28 0007c9c4: 00042400 sll r4,r4,0x10 0007c9c8: 0801f3e8 j 0x0007cfa0 (Slope Mod = X Slope * 12 * Halves / 28) 0007c9cc: 00042403 sra r4,r4,0x10
- Slope Type = 0x58*
0007c9d0: 96030000 lhu r3,0x0000(r16) Load X Mod 0007c9d4: 00000000 nop 0007c9d8: 00031c00 sll r3,r3,0x10 0007c9dc: 00032403 sra r4,r3,0x10 0007c9e0: 00910018 mult r4,r17 X Mod * -3 / 7 0007c9e4: 00031fc3 sra r3,r3,0x1f 0007c9e8: 00001010 mfhi r2 0007c9ec: 00441021 addu r2,r2,r4 X Mod * 4 / 7 0007c9f0: 00021103 sra r2,r2,0x04 X = X Mod / 28 0007c9f4: 00431023 subu r2,r2,r3 0007c9f8: 000218c0 sll r3,r2,0x03 X * 8 0007c9fc: 00621823 subu r3,r3,r2 X * 7 0007ca00: 00031880 sll r3,r3,0x02 X * 28 0007ca04: 00832023 subu r4,r4,r3 X Slope = X Mod - X * 28 0007ca08: 00042400 sll r4,r4,0x10 0007ca0c: 00042403 sra r4,r4,0x10 0007ca10: 00041040 sll r2,r4,0x01 X Slope * 2 0007ca14: 0801f3d7 j 0x0007cf5c (Slope Mod = Halves * 12 - (X Slope * 12 * Halves / 28)) 0007ca18: 00441021 addu r2,r2,r4 X Slope * 3
- Slope Type = 0x25*
0007ca1c: 96030004 lhu r3,0x0004(r16) Load Y Mod 0007ca20: 00000000 nop 0007ca24: 00031c00 sll r3,r3,0x10 0007ca28: 00032403 sra r4,r3,0x10 0007ca2c: 00910018 mult r4,r17 Y Mod * -3 / 7 0007ca30: 00031fc3 sra r3,r3,0x1f 0007ca34: 00001010 mfhi r2 0007ca38: 00441021 addu r2,r2,r4 Y Mod * 4 / 7 0007ca3c: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007ca40: 00431023 subu r2,r2,r3 0007ca44: 000218c0 sll r3,r2,0x03 Y * 8 0007ca48: 00621823 subu r3,r3,r2 Y * 7 0007ca4c: 00031880 sll r3,r3,0x02 Y * 28 0007ca50: 00832023 subu r4,r4,r3 Y Slope = Y Mod - Y * 28 0007ca54: 00042400 sll r4,r4,0x10 0007ca58: 00042403 sra r4,r4,0x10 0007ca5c: 00041040 sll r2,r4,0x01 Y Slope * 2 0007ca60: 0801f3d7 j 0x0007cf5c (Slope Mod = Halves * 12 - (Y Slope * 12 * Halves / 28)) 0007ca64: 00441021 addu r2,r2,r4 Y Slope * 3
- Slope Type = 0x85*
0007ca68: 96030004 lhu r3,0x0004(r16) Load Y Mod 0007ca6c: 0801f266 j 0x0007c998 (Y Slope = Y Mod - Y * 28) 0007ca70: 00031c00 sll r3,r3,0x10 (Slope Mod = Y Slope * 12 * Halves / 28)
- Slope Type = 0x41*
0007ca74: 96020000 lhu r2,0x0000(r16) Load X Mod 0007ca78: 00000000 nop 0007ca7c: 00021400 sll r2,r2,0x10 0007ca80: 00022403 sra r4,r2,0x10 0007ca84: 00910018 mult r4,r17 X Mod * -3 / 7 0007ca88: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007ca8c: 00001810 mfhi r3 0007ca90: 00063400 sll r6,r6,0x10 0007ca94: 00062c03 sra r5,r6,0x10 0007ca98: 00b10018 mult r5,r17 Y Mod * -3 / 7 0007ca9c: 000217c3 sra r2,r2,0x1f 0007caa0: 000637c3 sra r6,r6,0x1f 0007caa4: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007caa8: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007caac: 00621823 subu r3,r3,r2 0007cab0: 000310c0 sll r2,r3,0x03 X * 8 0007cab4: 00431023 subu r2,r2,r3 X * 7 0007cab8: 00021080 sll r2,r2,0x02 X * 28 0007cabc: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007cac0: 00042400 sll r4,r4,0x10 0007cac4: 00043c03 sra r7,r4,0x10 0007cac8: 00001010 mfhi r2 0007cacc: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007cad0: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007cad4: 00461023 subu r2,r2,r6 0007cad8: 000218c0 sll r3,r2,0x03 Y * 8 0007cadc: 00621823 subu r3,r3,r2 Y * 7 0007cae0: 00031880 sll r3,r3,0x02 Y * 28 0007cae4: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cae8: 00052c00 sll r5,r5,0x10 0007caec: 00052403 sra r4,r5,0x10 (Favors lowest Slope) 0007caf0: 00e4102a slt r2,r7,r4 (Branch -> Slope Mod = Y Slope * 12 * Halves / 28) 0007caf4: 1040012a beq r2,r0,0x0007cfa0 Branch if X Slope >= Y Slope 0007caf8: 00071040 sll r2,r7,0x01 (X Mod - X * 28) * 2 0007cafc: 0801f3ea j 0x0007cfa8 (Else -> Slope Mod = X Slope * 12 * Halves / 28) 0007cb00: 00471021 addu r2,r2,r7 (X Mod - X * 28) * 3
- Slope Type = 0x11*
0007cb04: 96020000 lhu r2,0x0000(r16) Load X Mod 0007cb08: 00000000 nop 0007cb0c: 00021400 sll r2,r2,0x10 0007cb10: 00022403 sra r4,r2,0x10 0007cb14: 00910018 mult r4,r17 X Mod * -3 / 7 0007cb18: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007cb1c: 00001810 mfhi r3 0007cb20: 00063400 sll r6,r6,0x10 0007cb24: 00062c03 sra r5,r6,0x10 0007cb28: 00b10018 mult r5,r17 Y Mod * -3 / 7 0007cb2c: 000217c3 sra r2,r2,0x1f 0007cb30: 000637c3 sra r6,r6,0x1f 0007cb34: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007cb38: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007cb3c: 00621823 subu r3,r3,r2 0007cb40: 000310c0 sll r2,r3,0x03 X * 8 0007cb44: 00431023 subu r2,r2,r3 X * 7 0007cb48: 00021080 sll r2,r2,0x02 X * 28 0007cb4c: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007cb50: 00042400 sll r4,r4,0x10 0007cb54: 00043c03 sra r7,r4,0x10 0007cb58: 00001010 mfhi r2 0007cb5c: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007cb60: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007cb64: 00461023 subu r2,r2,r6 0007cb68: 000218c0 sll r3,r2,0x03 Y * 8 0007cb6c: 00621823 subu r3,r3,r2 Y * 7 0007cb70: 00031880 sll r3,r3,0x02 Y * 28 0007cb74: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cb78: 00052c00 sll r5,r5,0x10 0007cb7c: 00052c03 sra r5,r5,0x10 0007cb80: 3402001c ori r2,r0,0x001c r2 = 28 0007cb84: 00452023 subu r4,r2,r5 28 - Y Slope 0007cb88: 00e4102a slt r2,r7,r4 (Favors higher Y Slope) 0007cb8c: 14400004 bne r2,r0,0x0007cba0 Branch if X Slope < (28 - Y Slope) 0007cb90: 00000000 nop 0007cb94: 00051040 sll r2,r5,0x01 Y Slope * 2 0007cb98: 0801f3d7 j 0x0007cf5c (Slope Mod = Halves * 12 - (Y Slope * 12 * Halves / 28)) 0007cb9c: 00451021 addu r2,r2,r5 Y Slope * 3 0007cba0: 00071040 sll r2,r7,0x01 X Slope * 2 0007cba4: 0801f3ea j 0x0007cfa8 (Slope Mod = X Slope * 12 * Halves / 28) 0007cba8: 00471021 addu r2,r2,r7 X Slope * 3
- Slope Type = 0x14*
0007cbac: 96020000 lhu r2,0x0000(r16) Load X Mod 0007cbb0: 00000000 nop 0007cbb4: 00021400 sll r2,r2,0x10 0007cbb8: 00022403 sra r4,r2,0x10 0007cbbc: 00910018 mult r4,r17 X Mod * -3 / 7 0007cbc0: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007cbc4: 00000000 nop 0007cbc8: 00063400 sll r6,r6,0x10 0007cbcc: 00062c03 sra r5,r6,0x10 0007cbd0: 00001810 mfhi r3 0007cbd4: 000217c3 sra r2,r2,0x1f 0007cbd8: 000637c3 sra r6,r6,0x1f 0007cbdc: 00b10018 mult r5,r17 Y Mod * -3 / 7 0007cbe0: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007cbe4: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007cbe8: 00621823 subu r3,r3,r2 0007cbec: 000310c0 sll r2,r3,0x03 X * 8 0007cbf0: 00431023 subu r2,r2,r3 X * 7 0007cbf4: 00021080 sll r2,r2,0x02 X * 28 0007cbf8: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007cbfc: 00042400 sll r4,r4,0x10 0007cc00: 00044403 sra r8,r4,0x10 0007cc04: 3404001c ori r4,r0,0x001c r4 = 28 0007cc08: 00883823 subu r7,r4,r8 28 - X Slope 0007cc0c: 00001010 mfhi r2 0007cc10: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007cc14: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007cc18: 00461023 subu r2,r2,r6 0007cc1c: 000218c0 sll r3,r2,0x03 Y * 8 0007cc20: 00621823 subu r3,r3,r2 Y * 7 0007cc24: 00031880 sll r3,r3,0x02 Y * 28 0007cc28: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cc2c: 00052c00 sll r5,r5,0x10 0007cc30: 00052c03 sra r5,r5,0x10 (Favors highest Slope) 0007cc34: 00852023 subu r4,r4,r5 28 - Y Slope 0007cc38: 00e4102a slt r2,r7,r4 (Branch -> Slope Mod = Halves * 12 - (X Slope * 12 * Halves / 28)) 0007cc3c: 144000c5 bne r2,r0,0x0007cf54 Branch if (28 - X Slope) < (28 - Y Slope) 0007cc40: 00051040 sll r2,r5,0x01 Y Slope * 2 0007cc44: 0801f3d7 j 0x0007cf5c (Else -> Slope Mod = Halves * 12 - (Y Slope * 12 * Halves / 28)) 0007cc48: 00451021 addu r2,r2,r5 Y Slope * 3
- Slope Type = 0x44*
0007cc4c: 96020000 lhu r2,0x0000(r16) Load X Mod 0007cc50: 00000000 nop 0007cc54: 00021400 sll r2,r2,0x10 0007cc58: 00022403 sra r4,r2,0x10 0007cc5c: 00910018 mult r4,r17 X Mod * -3 / 7 0007cc60: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007cc64: 00000000 nop 0007cc68: 00063400 sll r6,r6,0x10 0007cc6c: 00062c03 sra r5,r6,0x10 0007cc70: 00001810 mfhi r3 0007cc74: 000217c3 sra r2,r2,0x1f 0007cc78: 000637c3 sra r6,r6,0x1f 0007cc7c: 00b10018 mult r5,r17 Y Mod * -3 / 7 0007cc80: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007cc84: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007cc88: 00621823 subu r3,r3,r2 0007cc8c: 000310c0 sll r2,r3,0x03 X * 8 0007cc90: 00431023 subu r2,r2,r3 X * 7 0007cc94: 00021080 sll r2,r2,0x02 X * 28 0007cc98: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007cc9c: 00042400 sll r4,r4,0x10 0007cca0: 00044403 sra r8,r4,0x10 0007cca4: 3402001c ori r2,r0,0x001c r2 = 28 0007cca8: 00483823 subu r7,r2,r8 28 - X Slope 0007ccac: 00001010 mfhi r2 0007ccb0: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007ccb4: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007ccb8: 00461023 subu r2,r2,r6 0007ccbc: 000218c0 sll r3,r2,0x03 Y * 8 0007ccc0: 00621823 subu r3,r3,r2 Y * 7 0007ccc4: 00031880 sll r3,r3,0x02 Y * 28 0007ccc8: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cccc: 00052c00 sll r5,r5,0x10 0007ccd0: 00052403 sra r4,r5,0x10 (Favors higher X Result) 0007ccd4: 00e4102a slt r2,r7,r4 (Branch -> Slope Mod = Y Slope * 12 * Halves / 28) 0007ccd8: 104000b2 beq r2,r0,0x0007cfa4 Branch if (28 - X Slope) >= Y Slope 0007ccdc: 00041040 sll r2,r4,0x01 Y Slope * 2 0007cce0: 0801f3d6 j 0x0007cf58 (Else -> Slope Mod = Halves * 12 - (X Slope * 12 * Halves / 28)) 0007cce4: 00081040 sll r2,r8,0x01 X Slope * 2
- Slope Type = 0x96*
0007cce8: 96020000 lhu r2,0x0000(r16) Load X Mod 0007ccec: 00000000 nop 0007ccf0: 00021400 sll r2,r2,0x10 0007ccf4: 00022403 sra r4,r2,0x10 0007ccf8: 00910018 mult r4,r17 X Mod * -3 / 7 0007ccfc: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007cd00: 00001810 mfhi r3 0007cd04: 00063400 sll r6,r6,0x10 0007cd08: 00062c03 sra r5,r6,0x10 0007cd0c: 00b10018 mult r5,r17 Y Mod * -3 / 7 0007cd10: 000217c3 sra r2,r2,0x1f 0007cd14: 000637c3 sra r6,r6,0x1f 0007cd18: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007cd1c: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007cd20: 00621823 subu r3,r3,r2 0007cd24: 000310c0 sll r2,r3,0x03 X * 8 0007cd28: 00431023 subu r2,r2,r3 X * 7 0007cd2c: 00021080 sll r2,r2,0x02 X * 28 0007cd30: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007cd34: 00042400 sll r4,r4,0x10 0007cd38: 00043c03 sra r7,r4,0x10 0007cd3c: 00001010 mfhi r2 0007cd40: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007cd44: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007cd48: 00461023 subu r2,r2,r6 0007cd4c: 000218c0 sll r3,r2,0x03 Y * 8 0007cd50: 00621823 subu r3,r3,r2 Y * 7 0007cd54: 00031880 sll r3,r3,0x02 Y * 28 0007cd58: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cd5c: 00052c00 sll r5,r5,0x10 0007cd60: 00052403 sra r4,r5,0x10 (Favors highest Slope) 0007cd64: 00e4102a slt r2,r7,r4 (Branch -> Slope Mod = Y Slope * 12 * Halves / 28) 0007cd68: 1440008d bne r2,r0,0x0007cfa0 Branch if X Slope < Y Slope 0007cd6c: 00071040 sll r2,r7,0x01 X Slope * 2 0007cd70: 0801f3ea j 0x0007cfa8 (Else -> Slope Mod = X Slope * 12 * Halves / 28) 0007cd74: 00471021 addu r2,r2,r7 X Slope * 3
- Slope Type = 0x66*
0007cd78: 96020000 lhu r2,0x0000(r16) Load X Mod 0007cd7c: 00000000 nop 0007cd80: 00021400 sll r2,r2,0x10 0007cd84: 00022403 sra r4,r2,0x10 0007cd88: 00910018 mult r4,r17 X Mod * -3 / 7 0007cd8c: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007cd90: 00001810 mfhi r3 0007cd94: 00063400 sll r6,r6,0x10 0007cd98: 00062c03 sra r5,r6,0x10 0007cd9c: 00b10018 mult r5,r17 Load Y * -3 / 7 0007cda0: 000217c3 sra r2,r2,0x1f 0007cda4: 000637c3 sra r6,r6,0x1f 0007cda8: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007cdac: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007cdb0: 00621823 subu r3,r3,r2 0007cdb4: 000310c0 sll r2,r3,0x03 X * 8 0007cdb8: 00431023 subu r2,r2,r3 X * 7 0007cdbc: 00021080 sll r2,r2,0x02 X * 28 0007cdc0: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007cdc4: 00042400 sll r4,r4,0x10 0007cdc8: 00043c03 sra r7,r4,0x10 0007cdcc: 00001010 mfhi r2 0007cdd0: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007cdd4: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007cdd8: 00461023 subu r2,r2,r6 0007cddc: 000218c0 sll r3,r2,0x03 Y * 8 0007cde0: 00621823 subu r3,r3,r2 Y * 7 0007cde4: 00031880 sll r3,r3,0x02 Y * 28 0007cde8: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cdec: 00052c00 sll r5,r5,0x10 0007cdf0: 00052c03 sra r5,r5,0x10 0007cdf4: 3402001c ori r2,r0,0x001c r2 = 28 0007cdf8: 00452023 subu r4,r2,r5 28 - Y Slope 0007cdfc: 00e4102a slt r2,r7,r4 (Favors lower X Slope) 0007ce00: 14400004 bne r2,r0,0x0007ce14 Branch if X Slope < (28 - Y Slope) 0007ce04: 00000000 nop 0007ce08: 00071040 sll r2,r7,0x01 X Slope * 2 0007ce0c: 0801f3ea j 0x0007cfa8 (Slope Mod = X Slope * 12 * Halves / 28) 0007ce10: 00471021 addu r2,r2,r7 X Slope * 3 0007ce14: 00051040 sll r2,r5,0x01 Y Slope * 2 0007ce18: 0801f3d7 j 0x0007cf5c (Slope Mod = Halves * 12 - (Y Slope * 12 * Halves / 28)) 0007ce1c: 00451021 addu r2,r2,r5 Y Slope * 3
- Slope Type = 0x69*
0007ce20: 96020000 lhu r2,0x0000(r16) Load X Mod 0007ce24: 00000000 nop 0007ce28: 00021400 sll r2,r2,0x10 0007ce2c: 00022403 sra r4,r2,0x10 0007ce30: 00910018 mult r4,r17 X Mod * -3 / 7 0007ce34: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007ce38: 00000000 nop 0007ce3c: 00063400 sll r6,r6,0x10 0007ce40: 00062c03 sra r5,r6,0x10 0007ce44: 00001810 mfhi r3 0007ce48: 000217c3 sra r2,r2,0x1f 0007ce4c: 000637c3 sra r6,r6,0x1f 0007ce50: 00b10018 mult r5,r17 Y Mod * -3 / 7 0007ce54: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007ce58: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007ce5c: 00621823 subu r3,r3,r2 0007ce60: 000310c0 sll r2,r3,0x03 X * 8 0007ce64: 00431023 subu r2,r2,r3 X * 7 0007ce68: 00021080 sll r2,r2,0x02 X * 28 0007ce6c: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007ce70: 00042400 sll r4,r4,0x10 0007ce74: 00044403 sra r8,r4,0x10 0007ce78: 3404001c ori r4,r0,0x001c r4 = 28 0007ce7c: 00883823 subu r7,r4,r8 28 - X Slope 0007ce80: 00001010 mfhi r2 0007ce84: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007ce88: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007ce8c: 00461023 subu r2,r2,r6 0007ce90: 000218c0 sll r3,r2,0x03 Y * 8 0007ce94: 00621823 subu r3,r3,r2 Y * 7 0007ce98: 00031880 sll r3,r3,0x02 Y * 28 0007ce9c: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cea0: 00052c00 sll r5,r5,0x10 0007cea4: 00052c03 sra r5,r5,0x10 (Favors lowest Slope) 0007cea8: 00852023 subu r4,r4,r5 28 - Y Slope 0007ceac: 00e4102a slt r2,r7,r4 (Branch -> Slope Mod = Halves * 12 - (X Slope * 12 * Halves / 28)) 0007ceb0: 10400028 beq r2,r0,0x0007cf54 Branch if (28 - X Slope) >= (28 - Y Slope) 0007ceb4: 00051040 sll r2,r5,0x01 Y Slope * 2 0007ceb8: 0801f3d7 j 0x0007cf5c (Else -> Slope Mod = Halves * 12 - (Y Slope * 12 * Halves / 28)) 0007cebc: 00451021 addu r2,r2,r5 Y Slope * 3
- Slope Type = 0x99*
0007cec0: 96020000 lhu r2,0x0000(r16) Load X Mod 0007cec4: 00000000 nop 0007cec8: 00021400 sll r2,r2,0x10 0007cecc: 00022403 sra r4,r2,0x10 0007ced0: 00910018 mult r4,r17 X Mod * -3 / 7 0007ced4: 96060004 lhu r6,0x0004(r16) Load Y Mod 0007ced8: 00000000 nop 0007cedc: 00063400 sll r6,r6,0x10 0007cee0: 00062c03 sra r5,r6,0x10 0007cee4: 00001810 mfhi r3 0007cee8: 000217c3 sra r2,r2,0x1f 0007ceec: 000637c3 sra r6,r6,0x1f 0007cef0: 00b10018 mult r5,r17 Y Mod * -3 / 7 0007cef4: 00641821 addu r3,r3,r4 X Mod * 4 / 7 0007cef8: 00031903 sra r3,r3,0x04 X = X Mod / 28 0007cefc: 00621823 subu r3,r3,r2 0007cf00: 000310c0 sll r2,r3,0x03 X * 8 0007cf04: 00431023 subu r2,r2,r3 X * 7 0007cf08: 00021080 sll r2,r2,0x02 X * 28 0007cf0c: 00822023 subu r4,r4,r2 X Slope = X Mod - X * 28 0007cf10: 00042400 sll r4,r4,0x10 0007cf14: 00044403 sra r8,r4,0x10 0007cf18: 3402001c ori r2,r0,0x001c r2 = 28 0007cf1c: 00483823 subu r7,r2,r8 28 - X Slope 0007cf20: 00001010 mfhi r2 0007cf24: 00451021 addu r2,r2,r5 Y Mod * 4 / 7 0007cf28: 00021103 sra r2,r2,0x04 Y = Y Mod / 28 0007cf2c: 00461023 subu r2,r2,r6 0007cf30: 000218c0 sll r3,r2,0x03 Y * 8 0007cf34: 00621823 subu r3,r3,r2 Y * 7 0007cf38: 00031880 sll r3,r3,0x02 Y * 28 0007cf3c: 00a32823 subu r5,r5,r3 Y Slope = Y Mod - Y * 28 0007cf40: 00052c00 sll r5,r5,0x10 0007cf44: 00052403 sra r4,r5,0x10 (Favors lower Y Slope) 0007cf48: 00e4102a slt r2,r7,r4 (Branch -> Slope Mod = Y Slope * 12 * Halves / 28) 0007cf4c: 14400015 bne r2,r0,0x0007cfa4 Branch if (28 - X Slope) < Y Slope 0007cf50: 00041040 sll r2,r4,0x01 Y Slope * 2 0007cf54: 00081040 sll r2,r8,0x01 X Slope * 2 0007cf58: 00481021 addu r2,r2,r8 X Slope * 3 0007cf5c: 00021080 sll r2,r2,0x02 X Slope * 12 0007cf60: 00490018 mult r2,r9 X Slope * 12 * Halves 0007cf64: 00002012 mflo r4 0007cf68: 00000000 nop 0007cf6c: 00000000 nop 0007cf70: 00910018 mult r4,r17 X Slope * 12 * Halves * -3 / 7 0007cf74: 00091840 sll r3,r9,0x01 Halves * 2 0007cf78: 00691821 addu r3,r3,r9 Halves * 3 0007cf7c: 00031880 sll r3,r3,0x02 Halves * 12 0007cf80: 00001010 mfhi r2 0007cf84: 00441021 addu r2,r2,r4 X Slope * 12 * Halves * 4 / 7 0007cf88: 00021103 sra r2,r2,0x04 X Slope * 12 * Halves / 28 0007cf8c: 000427c3 sra r4,r4,0x1f 0007cf90: 00441023 subu r2,r2,r4 0007cf94: 00621823 subu r3,r3,r2 Slope Mod = Halves * 12 - X Slope * 12 * Halves / 28 0007cf98: 0801f3f6 j 0x0007cfd8 0007cf9c: 01432023 subu r4,r10,r3 Z Mod - Slope Mod 0007cfa0: 00041040 sll r2,r4,0x01 Y Slope * 2 0007cfa4: 00441021 addu r2,r2,r4 Y Slope * 3 0007cfa8: 00021080 sll r2,r2,0x02 Y Slope * 12 0007cfac: 00490018 mult r2,r9 Y Slope * 12 * Halves 0007cfb0: 00001812 mflo r3 0007cfb4: 00000000 nop 0007cfb8: 00000000 nop 0007cfbc: 00710018 mult r3,r17 Y Slope * 12 * Halves * -3 / 7 0007cfc0: 00001010 mfhi r2 0007cfc4: 00431021 addu r2,r2,r3 Y Slope * 12 * Halves * 4 / 7 0007cfc8: 00021103 sra r2,r2,0x04 Slope Mod = Y Slope * 12 * Halves / 28 0007cfcc: 00031fc3 sra r3,r3,0x1f 0007cfd0: 00431023 subu r2,r2,r3 0007cfd4: 01422023 subu r4,r10,r2 Z Mod -= Slope Mod 0007cfd8: 00041400 sll r2,r4,0x10 0007cfdc: 00021403 sra r2,r2,0x10 r2 = Z Mod 0007cfe0: 8fbf0020 lw r31,0x0020(r29) 0007cfe4: 8fb1001c lw r17,0x001c(r29) 0007cfe8: 8fb00018 lw r16,0x0018(r29) 0007cfec: 27bd0028 addiu r29,r29,0x0028 0007cff0: 03e00008 jr r31 0007cff4: 00000000 nop