Targeting validation (weapon flags)
Jump to navigation
Jump to search
0017ac90: 27bdffb0 addiu r29,r29,0xffb0 0017ac94: 27a50018 addiu r5,r29,0x0018 0017ac98: afbf004c sw r31,0x004c(r29) 0017ac9c: afb60048 sw r22,0x0048(r29) 0017aca0: afb50044 sw r21,0x0044(r29) 0017aca4: afb40040 sw r20,0x0040(r29) 0017aca8: afb3003c sw r19,0x003c(r29) 0017acac: afb20038 sw r18,0x0038(r29) 0017acb0: afb10034 sw r17,0x0034(r29) 0017acb4: 0c01788b jal 0x0005e22c Transfer Target ID? Through Mount Data 0017acb8: afb00030 sw r16,0x0030(r29) 0017acbc: 93b50018 lbu r21,0x0018(r29) load attacker ID 0017acc0: 00000000 nop 0017acc4: 32a300ff andi r3,r21,0x00ff 0017acc8: 2c620015 sltiu r2,r3,0x0015 0017accc: 10400050 beq r2,r0,0x0017ae10 branch if target out of bounds 0017acd0: 000310c0 sll r2,r3,0x03 ID * 8 0017acd4: 00431023 subu r2,r2,r3 ID * 7 0017acd8: 00021180 sll r2,r2,0x06 ID * 448 0017acdc: 3c038019 lui r3,0x8019 0017ace0: 246308cc addiu r3,r3,0x08cc 0017ace4: 00439021 addu r18,r2,r3 r18 = attacker data 0017ace8: 92430001 lbu r3,0x0001(r18) 0017acec: 340200ff ori r2,r0,0x00ff 0017acf0: 106200a8 beq r3,r2,0x0017af94 unit doesn't exist check 0017acf4: 2402ffff addiu r2,r0,0xffff 0017acf8: 93a20019 lbu r2,0x0019(r29) load skillset of last used attack? 0017acfc: 3c018006 lui r1,0x8006 0017ad00: 00220821 addu r1,r1,r2 0017ad04: 90365cb4 lbu r22,0x5cb4(r1) load action menu byte 0017ad08: 00000000 nop 0017ad0c: 32c300ff andi r3,r22,0x00ff 0017ad10: 10600004 beq r3,r0,0x0017ad24 branch if action menu = default 0017ad14: 00002021 addu r4,r0,r0 0017ad18: 34020006 ori r2,r0,0x0006 0017ad1c: 1462000b bne r3,r2,0x0017ad4c branch if not monster 0017ad20: 34020008 ori r2,r0,0x0008 Default, Monster 0017ad24: 93a3001a lbu r3,0x001a(r29) load ability ID? 0017ad28: 00000000 nop 0017ad2c: 000310c0 sll r2,r3,0x03 0017ad30: 00431023 subu r2,r2,r3 0017ad34: 00021040 sll r2,r2,0x01 0017ad38: 3c018006 lui r1,0x8006 0017ad3c: 00220821 addu r1,r1,r2 0017ad40: 9024fbf3 lbu r4,-0x040d(r1) load ability flags 3 0017ad44: 32c300ff andi r3,r22,0x00ff 0017ad48: 34020008 ori r2,r0,0x0008 0017ad4c: 10620006 beq r3,r2,0x0017ad68 branch if attack 0017ad50: 340500ff ori r5,r0,0x00ff 0017ad54: 3402000a ori r2,r0,0x000a 0017ad58: 10620003 beq r3,r2,0x0017ad68 branch if charge 0017ad5c: 30820020 andi r2,r4,0x0020 0017ad60: 10400022 beq r2,r0,0x0017adec branch if weapon range = false 0017ad64: 34020006 ori r2,r0,0x0006 0017ad68: 9243001f lbu r3,0x001f(r18) load left hand weapon 0017ad6c: 00000000 nop 0017ad70: 386200ff xori r2,r3,0x00ff 0017ad74: 0002102b sltu r2,r0,r2 set if weapon exists? 0017ad78: 00021023 subu r2,r0,r2 0017ad7c: 00622024 and r4,r3,r2 r4 = left hand weapon? 0017ad80: 9243001d lbu r3,0x001d(r18) load right hand weapon 0017ad84: 00000000 nop 0017ad88: 10650002 beq r3,r5,0x0017ad94 branch if right hand weapon doesn't exist 0017ad8c: 00000000 nop 0017ad90: 00602021 addu r4,r3,r0 r4 = right hand weapon 0017ad94: 9242005a lbu r2,0x005a(r18) load status 0017ad98: 00000000 nop 0017ad9c: 30420002 andi r2,r2,0x0002 0017ada0: 14400008 bne r2,r0,0x0017adc4 branch if frog 0017ada4: 00000000 nop 0017ada8: 92420006 lbu r2,0x0006(r18) load gender 0017adac: 00000000 nop 0017adb0: 30420020 andi r2,r2,0x0020 0017adb4: 14400003 bne r2,r0,0x0017adc4 branch if monster 0017adb8: 00000000 nop 0017adbc: 14850003 bne r4,r5,0x0017adcc branch if not unarmed 0017adc0: 308300ff andi r3,r4,0x00ff r3 = weapon 0017adc4: 00002021 addu r4,r0,r0 clear r4 0017adc8: 308300ff andi r3,r4,0x00ff 0017adcc: 2c620080 sltiu r2,r3,0x0080 set if r4 is a weapon 0017add0: 1040000f beq r2,r0,0x0017ae10 branch if not, return r2 = 0xffff 0017add4: 000310c0 sll r2,r3,0x03 0017add8: 3c018006 lui r1,0x8006 0017addc: 00220821 addu r1,r1,r2 0017ade0: 90303ab9 lbu r16,0x3ab9(r1) load item attack flags 0017ade4: 0805eb96 j 0x0017ae58 0017ade8: 00000000 nop 0017adec: 93a30022 lbu r3,0x0022(r29) 0017adf0: 00000000 nop 0017adf4: 14620018 bne r3,r2,0x0017ae58 0017adf8: 34100020 ori r16,r0,0x0020 0017adfc: 93a30023 lbu r3,0x0023(r29) 0017ae00: 00000000 nop 0017ae04: 2c620015 sltiu r2,r3,0x0015 0017ae08: 14400003 bne r2,r0,0x0017ae18 0017ae0c: 000310c0 sll r2,r3,0x03 0017ae10: 0805ebe5 j 0x0017af94 0017ae14: 2402ffff addiu r2,r0,0xffff 0017ae18: 00431023 subu r2,r2,r3 0017ae1c: 00021180 sll r2,r2,0x06 0017ae20: 3c038019 lui r3,0x8019 0017ae24: 246308cc addiu r3,r3,0x08cc get unit data 0017ae28: 00431821 addu r3,r2,r3 0017ae2c: 90620047 lbu r2,0x0047(r3) load x coordinate 0017ae30: 00000000 nop 0017ae34: a7a20024 sh r2,0x0024(r29) 0017ae38: 90620048 lbu r2,0x0048(r3) load y coordinate 0017ae3c: 00000000 nop 0017ae40: a7a20028 sh r2,0x0028(r29) 0017ae44: 94620048 lhu r2,0x0048(r3) load map level 0017ae48: 00000000 nop 0017ae4c: 000213c2 srl r2,r2,0x0f 0017ae50: a7a20026 sh r2,0x0026(r29) 0017ae54: 34100020 ori r16,r0,0x0020 0017ae58: 8651017a lh r17,0x017a(r18) laod X target coordinate 0017ae5c: 8653017e lh r19,0x017e(r18) load Y coordinate 0017ae60: 8654017c lh r20,0x017c(r18) load map level 0017ae64: 02202021 addu r4,r17,r0 0017ae68: 02602821 addu r5,r19,r0 0017ae6c: 0c05f722 jal 0x0017dc88 Get ID of unit if tile is targetable 0017ae70: 02803021 addu r6,r20,r0 0017ae74: 00403021 addu r6,r2,r0 r6 = target ID 0017ae78: 04c10002 bgez r6,0x0017ae84 branch if target found 0017ae7c: 32020010 andi r2,r16,0x0010 r2 = weapon arc check 0017ae80: 2406ffff addiu r6,r0,0xffff 0017ae84: 10400005 beq r2,r0,0x0017ae9c branch if not arcing 0017ae88: 02a02021 addu r4,r21,r0 r4 = attacker ID 0017ae8c: 0c06bfc6 jal 0x001aff18 giant effects routine 0017ae90: 2645017a addiu r5,r18,0x017a r5 = attacker unit data + 0x17a (target coordinates) 0017ae94: 0805ebd0 j 0x0017af40 Attack Validation? 0017ae98: 00408021 addu r16,r2,r0 0017ae9c: 32020020 andi r2,r16,0x0020 Direct check 0017aea0: 10400018 beq r2,r0,0x0017af04 branch if not direct 0017aea4: 32020040 andi r2,r16,0x0040 Lunging check 0017aea8: 92420047 lbu r2,0x0047(r18) load attacker X 0017aeac: 00000000 nop 0017aeb0: 02222023 subu r4,r17,r2 target X - attacker X 0017aeb4: 04810002 bgez r4,0x0017aec0 0017aeb8: 00000000 nop 0017aebc: 00042023 subu r4,r0,r4 0017aec0: 92420048 lbu r2,0x0048(r18) Load attacker Y 0017aec4: 00000000 nop 0017aec8: 02621023 subu r2,r19,r2 Target Y - attacker Y 0017aecc: 04410002 bgez r2,0x0017aed8 0017aed0: 32c300ff andi r3,r22,0x00ff r3 = skillset? 0017aed4: 00021023 subu r2,r0,r2 0017aed8: 00822021 addu r4,r4,r2 0017aedc: 34020001 ori r2,r0,0x0001 0017aee0: 14620003 bne r3,r2,0x0017aef0 branch if not attack 0017aee4: 28820002 slti r2,r4,0x0002 set if distance difference < 2 ? 0017aee8: 14400015 bne r2,r0,0x0017af40 branch if so 0017aeec: 00c08021 addu r16,r6,r0 0017aef0: 02a02021 addu r4,r21,r0 r4 = attacker ID 0017aef4: 0c06c206 jal 0x001b0818 001b0818_-_001b0a8c 0017aef8: 2645017a addiu r5,r18,0x017a r5 = 0x17a in attacker data 0017aefc: 0805ebd0 j 0x0017af40 attack validation? 0017af00: 00408021 addu r16,r2,r0 return result 0017af04: 10400008 beq r2,r0,0x0017af28 branch if not lunging 0017af08: 02a02021 addu r4,r21,r0 0017af0c: afa60010 sw r6,0x0010(r29) 0017af10: 02202821 addu r5,r17,r0 Target X 0017af14: 02603021 addu r6,r19,r0 Y 0017af18: 0c05ebf0 jal 0x0017afc0 0017af1c: 02803821 addu r7,r20,r0 Map 0017af20: 0805ebd0 j 0x0017af40 0017af24: 00408021 addu r16,r2,r0 0017af28: afa60010 sw r6,0x0010(r29) store target ID 0017af2c: 02202821 addu r5,r17,r0 target X 0017af30: 02603021 addu r6,r19,r0 Y 0017af34: 0c05ecfd jal 0x0017b3f4 Height difference validation? 0017af38: 02803821 addu r7,r20,r0 Map level 0017af3c: 00408021 addu r16,r2,r0 r16 = target ID or 0xff(fail) 0017af40: 0c05ed28 jal 0x0017b4a0 Disable/initialize? green panel flags? 0017af44: 00000000 nop 0017af48: 2e020015 sltiu r2,r16,0x0015 set if target ID valid? 0017af4c: 10400011 beq r2,r0,0x0017af94 jump to end, return 0x00 0017af50: 00001021 addu r2,r0,r0 0017af54: 001020c0 sll r4,r16,0x03 0017af58: 00902023 subu r4,r4,r16 0017af5c: 00042180 sll r4,r4,0x06 0017af60: 3c028019 lui r2,0x8019 0017af64: 244208cc addiu r2,r2,0x08cc 0017af68: 0c060428 jal 0x001810a0 map location calculation 0017af6c: 00822021 addu r4,r4,r2 0017af70: 000210c0 sll r2,r2,0x03 0017af74: 3c038019 lui r3,0x8019 0017af78: 2463f8cc addiu r3,r3,0xf8cc 0017af7c: 00431021 addu r2,r2,r3 0017af80: 90430005 lbu r3,0x0005(r2) 0017af84: 00000000 nop 0017af88: 34630080 ori r3,r3,0x0080 0017af8c: a0430005 sb r3,0x0005(r2) set target panel green 0017af90: 00001021 addu r2,r0,r0 return 0x00? 0017af94: 8fbf004c lw r31,0x004c(r29) 0017af98: 8fb60048 lw r22,0x0048(r29) 0017af9c: 8fb50044 lw r21,0x0044(r29) 0017afa0: 8fb40040 lw r20,0x0040(r29) 0017afa4: 8fb3003c lw r19,0x003c(r29) 0017afa8: 8fb20038 lw r18,0x0038(r29) 0017afac: 8fb10034 lw r17,0x0034(r29) 0017afb0: 8fb00030 lw r16,0x0030(r29) 0017afb4: 27bd0050 addiu r29,r29,0x0050 0017afb8: 03e00008 jr r31 0017afbc: 00000000 nop