0008ab34 - 0008adf4
Jump to navigation
Jump to search
call if *0x87 misc data = 0xf. 0008ab34: 27bdffc8 addiu r29,r29,0xffc8 0008ab38: afb00028 sw r16,0x0028(r29) 0008ab3c: 00808021 addu r16,r4,r0 r16 = misc unit data pointer 0008ab40: afbf0030 sw r31,0x0030(r29) 0008ab44: afb1002c sw r17,0x002c(r29) 0008ab48: 8e11008c lw r17,0x008c(r16) input counter (counts down) 0008ab4c: 8e020028 lw r2,0x0028(r16) X mod diff 0008ab50: 8e03002c lw r3,0x002c(r16) height mod diff 0008ab54: 8e040030 lw r4,0x0030(r16) Y mod diff 0008ab58: 8e050034 lw r5,0x0034(r16) ? never referenced. 0008ab5c: afa20018 sw r2,0x0018(r29) 0008ab60: afa3001c sw r3,0x001c(r29) 0008ab64: afa40020 sw r4,0x0020(r29) 0008ab68: afa50024 sw r5,0x0024(r29) 0008ab6c: 8e030088 lw r3,0x0088(r16) 0008ab70: 00000000 nop 0008ab74: 10600005 beq r3,r0,0x0008ab8c branch if distort counter = 0 0008ab78: 34020001 ori r2,r0,0x0001 0008ab7c: 1062007e beq r3,r2,0x0008ad78 branch if counter = 1 0008ab80: 00000000 nop 0008ab84: 08022b6d j 0x0008adb4 otherwise 0008ab88: 00000000 nop if counter = 0 0008ab8c: 8e030134 lw r3,0x0134(r16) load unit data pointer 0008ab90: 00000000 nop 0008ab94: 10600076 beq r3,r0,0x0008ad70 branch if null 0008ab98: 00000000 nop 0008ab9c: 9202018d lbu r2,0x018d(r16) load hit counter 0008aba0: 00000000 nop 0008aba4: 10400028 beq r2,r0,0x0008ac48 branch if no hits 0008aba8: 00000000 nop 0008abac: 9204018e lbu r4,0x018e(r16) load target list 0008abb0: 0c01e9c9 jal 0x0007a724 Get unit misc data that matches r4 ID 0008abb4: 00000000 nop 0008abb8: 00402821 addu r5,r2,r0 r5 = target misc data pointer 0008abbc: 8e030018 lw r3,0x0018(r16) load X mod 0008abc0: 8ca20018 lw r2,0x0018(r5) load target X mod 0008abc4: 00000000 nop 0008abc8: 00621823 subu r3,r3,r2 find difference 0008abcc: 00602021 addu r4,r3,r0 move to r4 0008abd0: 04610002 bgez r3,0x0008abdc branch if difference is greater than 0 0008abd4: afa30018 sw r3,0x0018(r29) store difference in stack 0008abd8: 24640007 addiu r4,r3,0x0007 0008abdc: 3c069249 lui r6,0x9249 0008abe0: 34c62493 ori r6,r6,0x2493 r6 = 4/7 0008abe4: 000420c3 sra r4,r4,0x03 x Diff / 8 0008abe8: 00642023 subu r4,r3,r4 x diff * 7/8 0008abec: 00860018 mult r4,r6 x diff * 1/2 0008abf0: 00041fc3 sra r3,r4,0x1f just in case x diff was signed. 0008abf4: 00001010 mfhi r2 X mod diff * 1/2 0008abf8: 00441021 addu r2,r2,r4 dif * 11/8 0008abfc: 000213c3 sra r2,r2,0x0f 0008ac00: 00431023 subu r2,r2,r3 0008ac04: 000218c0 sll r3,r2,0x03 diff * 11/8 / 0x1000 rounded 0008ac08: 00621823 subu r3,r3,r2 diff * 11/8 / 0x1000 rounded, + some extra 0008ac0c: 00031b40 sll r3,r3,0x0d all this math is stupid and obtuse and confusing. probably still got it wrong. 0008ac10: 00832023 subu r4,r4,r3 X diff * 1/8 - diff * 11/4 (-21/8?) 0008ac14: afa40018 sw r4,0x0018(r29) 0008ac18: 8e030020 lw r3,0x0020(r16) load Y mod 0008ac1c: 8ca20020 lw r2,0x0020(r5) load target Y mod 0008ac20: 00000000 nop 0008ac24: 00621823 subu r3,r3,r2 find difference 0008ac28: 00602021 addu r4,r3,r0 0008ac2c: 04610002 bgez r3,0x0008ac38 branch if greater than 0 0008ac30: afa30020 sw r3,0x0020(r29) 0008ac34: 24640007 addiu r4,r3,0x0007 0008ac38: 000420c3 sra r4,r4,0x03 0008ac3c: 00642023 subu r4,r3,r4 dif * 7/8 0008ac40: 08022b3d j 0x0008acf4 0008ac44: 00860018 mult r4,r6 dif * 1/2 if no hits 0008ac48: 86020040 lh r2,0x0040(r16) load X mod 0008ac4c: 8464017a lh r4,0x017a(r3) load X target panel coord 0008ac50: 2442fff2 addiu r2,r2,0xfff2 X mod - 0xe 0008ac54: 000418c0 sll r3,r4,0x03 Panel * 8 0008ac58: 00641823 subu r3,r3,r4 Panel * 7 0008ac5c: 00031880 sll r3,r3,0x02 Panel * 0x1c 0008ac60: 00431023 subu r2,r2,r3 X mod - 0xe - Panel * 0x1c 0008ac64: 00021300 sll r2,r2,0x0c 0008ac68: 00402021 addu r4,r2,r0 0008ac6c: 04410002 bgez r2,0x0008ac78 Branch if difference between X mod and target panel is greater than or equal to 0 0008ac70: afa20018 sw r2,0x0018(r29) 0008ac74: 24440007 addiu r4,r2,0x0007 0008ac78: 3c059249 lui r5,0x9249 0008ac7c: 34a52493 ori r5,r5,0x2493 r5 = 4/7 0008ac80: 000420c3 sra r4,r4,0x03 dif / 8 0008ac84: 00442023 subu r4,r2,r4 dif * 7/8 0008ac88: 00850018 mult r4,r5 0008ac8c: 00041fc3 sra r3,r4,0x1f 0008ac90: 00001010 mfhi r2 dif * 1/2 0008ac94: 00441021 addu r2,r2,r4 dif * 11/8 0008ac98: 000213c3 sra r2,r2,0x0f 0008ac9c: 00431023 subu r2,r2,r3 0008aca0: 000218c0 sll r3,r2,0x03 0008aca4: 00621823 subu r3,r3,r2 0008aca8: 00031b40 sll r3,r3,0x0d 0008acac: 00832023 subu r4,r4,r3 0008acb0: afa40018 sw r4,0x0018(r29) 0008acb4: 8e020134 lw r2,0x0134(r16) 0008acb8: 86030044 lh r3,0x0044(r16) 0008acbc: 8444017e lh r4,0x017e(r2) 0008acc0: 2463fff2 addiu r3,r3,0xfff2 0008acc4: 000410c0 sll r2,r4,0x03 0008acc8: 00441023 subu r2,r2,r4 0008accc: 00021080 sll r2,r2,0x02 0008acd0: 00621823 subu r3,r3,r2 0008acd4: 00031b00 sll r3,r3,0x0c 0008acd8: 00602021 addu r4,r3,r0 0008acdc: 04610002 bgez r3,0x0008ace8 0008ace0: afa30020 sw r3,0x0020(r29) 0008ace4: 24640007 addiu r4,r3,0x0007 0008ace8: 000420c3 sra r4,r4,0x03 0008acec: 00642023 subu r4,r3,r4 0008acf0: 00850018 mult r4,r5 I don't want to type out all that math again. 0008acf4: 00041fc3 sra r3,r4,0x1f 0008acf8: afa0001c sw r0,0x001c(r29) store 0 0008acfc: 00001010 mfhi r2 dif * 1/2 0008ad00: 00441021 addu r2,r2,r4 0008ad04: 000213c3 sra r2,r2,0x0f 0008ad08: 00431023 subu r2,r2,r3 0008ad0c: 000218c0 sll r3,r2,0x03 0008ad10: 00621823 subu r3,r3,r2 0008ad14: 00031b40 sll r3,r3,0x0d 0008ad18: 00832023 subu r4,r4,r3 0008ad1c: afa40020 sw r4,0x0020(r29) 0008ad20: 8fa40018 lw r4,0x0018(r29) load final X dif number 0008ad24: 00000000 nop 0008ad28: 0091001a div r4,r17 0008ad2c: 00002012 mflo r4 divide by distort var 0008ad30: 8fa3001c lw r3,0x001c(r29) height diff 0008ad34: 00000000 nop 0008ad38: 0071001a div r3,r17 divide by distort var 0008ad3c: 00001812 mflo r3 0008ad40: 8fa20020 lw r2,0x0020(r29) 0008ad44: 00000000 nop 0008ad48: 0051001a div r2,r17 divide final Y dif by distort var 0008ad4c: 00001012 mflo r2 0008ad50: afa40018 sw r4,0x0018(r29) store final 0008ad54: afa3001c sw r3,0x001c(r29) 0008ad58: afa20020 sw r2,0x0020(r29) 0008ad5c: 8e020088 lw r2,0x0088(r16) load distort counter 0008ad60: 00000000 nop 0008ad64: 24420001 addiu r2,r2,0x0001 0008ad68: 08022b5e j 0x0008ad78 0008ad6c: ae020088 sw r2,0x0088(r16) store distort counter + 1 if no targets 0008ad70: 08022b6d j 0x0008adb4 0008ad74: a2000087 sb r0,0x0087(r16) clear, don't animate. if counter = 1 0008ad78: 1a20000c blez r17,0x0008adac branch if r17 <= 0 0008ad7c: 00000000 nop 0008ad80: 8e020018 lw r2,0x0018(r16) X-mod 0008ad84: 8fa30018 lw r3,0x0018(r29) X-dif 0008ad88: 00000000 nop 0008ad8c: 00431021 addu r2,r2,r3 add the two together 0008ad90: ae020018 sw r2,0x0018(r16) move unit towards new location 0008ad94: 8e020020 lw r2,0x0020(r16) 0008ad98: 8fa30020 lw r3,0x0020(r29) 0008ad9c: 00000000 nop 0008ada0: 00431021 addu r2,r2,r3 0008ada4: 08022b6c j 0x0008adb0 0008ada8: ae020020 sw r2,0x0020(r16) store new Y mod if is finished 0008adac: a2000087 sb r0,0x0087(r16) clear animation 0008adb0: 2631ffff addiu r17,r17,0xffff -1 0008adb4: 8fa20018 lw r2,0x0018(r29) 0008adb8: 8fa3001c lw r3,0x001c(r29) 0008adbc: 8fa40020 lw r4,0x0020(r29) 0008adc0: 8fa50024 lw r5,0x0024(r29) 0008adc4: ae020028 sw r2,0x0028(r16) 0008adc8: ae03002c sw r3,0x002c(r16) 0008adcc: ae040030 sw r4,0x0030(r16) 0008add0: ae050034 sw r5,0x0034(r16) store X, height, Y and ? differences into misc data 0008add4: 0c02255f jal 0x0008957c Store position mods to vector mods (for position on screen.) 0008add8: 02002021 addu r4,r16,r0 r4 = misc unit data pointer 0008addc: ae11008c sw r17,0x008c(r16) count r17 down 0008ade0: 8fbf0030 lw r31,0x0030(r29) 0008ade4: 8fb1002c lw r17,0x002c(r29) 0008ade8: 8fb00028 lw r16,0x0028(r29) 0008adec: 27bd0038 addiu r29,r29,0x0038 0008adf0: 03e00008 jr r31 0008adf4: 00000000 nop