Main Ability Loading Routine
Jump to navigation
Jump to search
Instructions
0017ce44 - 0017d34c : Note Attacks preview do not load this routine, only attack confirmation does Parameters : r4 = Attacker data pointer r5 = Attacker misc data 0x18c pointer (Stack pointer when coming from AI routines) Returns r2 = 0x00 if Unit's were targeted r2 = 0x01 if No targeted units r2 = -0x01 if Invalid targeting data ------------------------------------------------------------------------ 0017ce44: 27bdffb0 addiu r29,r29,0xffb0 | 0017ce48: afb40040 sw r20,0x0040(r29) | 0017ce4c: 0080a021 addu r20,r4,r0 |r20 = Attacker ID 0017ce50: afb10034 sw r17,0x0034(r29) | 0017ce54: 00a08821 addu r17,r5,r0 |r17 = misc unit data 0x18c Current action data ? 0017ce58: 340300ff ori r3,r0,0x00ff |r3 = 0x00ff 0017ce5c: afb20038 sw r18,0x0038(r29) | 0017ce60: 34120014 ori r18,r0,0x0014 |r18 = 0x14 0017ce64: 27a20024 addiu r2,r29,0x0024 |r2 = Inner Routine Stack 0017ce68: afbf0048 sw r31,0x0048(r29) | 0017ce6c: afb50044 sw r21,0x0044(r29) | 0017ce70: afb3003c sw r19,0x003c(r29) | 0017ce74: afb00030 sw r16,0x0030(r29) | 0017ce78: 3c018019 lui r1,0x8019 | 0017ce7c: ac20f4f8 sw r0,-0x0b08(r1) |clear 0x8018f4f8 ? 0017ce80: 3c018019 lui r1,0x8019 | 0017ce84: ac20f4f4 sw r0,-0x0b0c(r1) |clear 0x8018f4f4 Some panel targeting counter 0017ce88: 3c018019 lui r1,0x8019 | 0017ce8c: a020390f sb r0,0x390f(r1) |clear 0x8019390f 0017ce90: a0430000 sb r3,0x0000(r2) @ LOOP store 0xff on inner stack from r29 0x24 to r29 0x10 (r2 decrease) 0017ce94: 2652ffff addiu r18,r18,-0x0001 |r18 = r18 - 0x01 (start at 0x14) 0017ce98: 0641fffd bgez r18,0x0017ce90 Λ loop while r18 > =0x00 0017ce9c: 2442ffff addiu r2,r2,-0x0001 |r2 = Stack offset - 0x01 0017cea0: 2a820015 slti r2,r20,0x0015 |r2 = 1 if attacker ID < 0x15 0017cea4: 14400003 bne r2,r0,0x0017ceb4 #If Attacker ID >= 0x15 /Else branch, avoiding jump to end 0017cea8: 34120015 ori r18,r0,0x0015 |r18 = 0x15 (Math skillset ID see 0017cf6c) 0017ceac: 0805f4ca j 0x0017d328 >>jump to End (r2 = -0x01) 0017ceb0: 2402ffff addiu r2,r0,-0x0001 |r2 = -0x01 0017ceb4: 001410c0 sll r2,r20,0x03 #Else (Valid Attacker ID) r2 = Attacker ID * 8 0017ceb8: 00541023 subu r2,r2,r20 |r2 = Attacker ID * 7 0017cebc: 00021180 sll r2,r2,0x06 |r2 = Attacker ID * 448 (0x1c0) - Size of unit's data 0017cec0: 3c038019 lui r3,0x8019 | 0017cec4: 246308cc addiu r3,r3,0x08cc |r3 = Start of units data 0017cec8: 00439821 addu r19,r2,r3 |r19 = attacker unit data pointer 0017cecc: 0c062f5d jal 0x0018bd74 |-->Current Action Data Nulling Reset Attacker action data (preserve reaction ID ans last attack received) 0017ced0: 2664018c addiu r4,r19,0x018c |r4 = Start of attacker current action data pointer 0017ced4: 3c108019 lui r16,0x8019 | 0017ced8: 26102da0 addiu r16,r16,0x2da0 |r16 = 0x80192da0 0017cedc: 02002021 addu r4,r16,r0 |r4 = r16 0017cee0: 34020008 ori r2,r0,0x0008 |r2 = 0x08 0017cee4: a260018c sb r0,0x018c(r19) |Set attacker current action (ACA) hit flag to "miss" 0017cee8: 0c062f5d jal 0x0018bd74 |-->Current Action Data Nulling - Reset Attacker action data at 0x80192da0 0017ceec: a262018e sb r2,0x018e(r19) |Set ACA evade type to 0x08 (canceled) 0017cef0: a2000000 sb r0,0x0000(r16) |Set Copy of ACA flag to 'miss' 0017cef4: a2200022 sb r0,0x0022(r17) |clear Attacker misc 0x1ae (Post action - Fall related ?) 0017cef8: a2200016 sb r0,0x0016(r17) |clear Attacker misc 0x1a2 (post ability - poach ? Train ? - Filled with 0x8019390e value) 0017cefc: a2200013 sb r0,0x0013(r17) |clear Attacker misc 0x19f (Control value - Math skill related) 0017cf00: 3c028019 lui r2,0x8019 | 0017cf04: 8c42f5f0 lw r2,-0x0a10(r2) |r2 = type of action 8018f5f0 0017cf08: 00008021 addu r16,r0,r0 |r16 = 0x00 0017cf0c: 10400015 beq r2,r0,0x0017cf64 #If Action is a Reaction #branch if not reacting (default targeting section) 0017cf10: a6200020 sh r0,0x0020(r17) |clear Attacker misc 0x1ac misc 0x1ac 0017cf14: 02802021 addu r4,r20,r0 |r4 = attacker ID 0017cf18: 02202821 addu r5,r17,r0 |r5 = Attacker misc action data (misc 0x18c) 0017cf1c: 27a60028 addiu r6,r29,0x0028 |r6 = inner routine Stack 0017cf20: 3c028019 lui r2,0x8019 | 0017cf24: 94422d9c lhu r2,0x2d9c(r2) |r2 = reaction ID 0x80192d9c 0017cf28: 27a70010 addiu r7,r29,0x0010 |r7 = inner routine stack 0017cf2c: 0c05f2b3 jal 0x0017cacc |-->Reaction Target/Hit Calculation Returns r2 = 0x00 for reaction with reaction flag 0x08 enabled if not reflect-distribute-dmg split) 0017cf30: a6220020 sh r2,0x0020(r17) |Store reaction ID in attacker current action (misc data) 0x20 0017cf34: 10400010 beq r2,r0,0x0017cf78 #If Target list is set /Else branch to Targetting routines (reaction type not supported above) 0017cf38: 340201b8 ori r2,r0,0x01b8 |r2 = 0x1b8 (reflect ID) 0017cf3c: 3c038019 lui r3,0x8019 | 0017cf40: 84632d9c lh r3,0x2d9c(r3) |r3 = reaction ID 0017cf44: 00000000 nop | 0017cf48: 14620003 bne r3,r2,0x0017cf58 #If reaction ID is reflect # / Else branch (store 0x00 at r29 0x2c) 0017cf4c: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017cf50: 0805f3d7 j 0x0017cf5c >>jump to next jump setting r29 0x2c to 0x01 0017cf54: a3a2002c sb r2,0x002c(r29) |store 1 on the stack (animate on miss flag for later purpose) 0017cf58: a3a0002c sb r0,0x002c(r29) # Else store 0 on the stack 0017cf5c: 0805f3de j 0x0017cf78 >>jump to after not-reacting section with r16 = 0x01 0017cf60: 34100001 ori r16,r0,0x0001 |r16 = 0x01 0017cf64: 9262016f lbu r2,0x016f(r19) #Else (not reacting) r2 = Attacker skillset of last attack 0017cf68: 00000000 nop | 0017cf6c: 14520002 bne r2,r18,0x0017cf78 #If Attacker used skillset is math #branch if skillset isn't 0x15 - math skill 0017cf70: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017cf74: a2220013 sb r2,0x0013(r17) |Store 0x01 in misc attacker current action (0x13) 0017cf78: 16000041 bne r16,r0,0x0017d080 #If r16 = 0x00 /Branch if r16 = 0x01 - Target list done in Reaction Target/Hit Calculation routine 0017cf7c: 27a40010 addiu r4,r29,0x0010 |r4 = Stack 0x10 (will be used in jal at 0017d070) 0017cf80: 2664016e addiu r4,r19,0x016e |r4 = attackers target data offset self ID ? 0017cf84: 0c05f349 jal 0x0017cd24 |-->Map calculations for attack Return r2 (0x00,0x01,0x02 or -0x01) + Ability data 2 flag 3 on r5 0017cf88: 27a5002c addiu r5,r29,0x002c |r5 = Stack pointer r29 0x2c 0017cf8c: 2403ffff addiu r3,r0,-0x0001 |r3 = -0x0001 0017cf90: 14430004 bne r2,r3,0x0017cfa4 #If Targeting is invalid 0017cf94: 2402ffff addiu r2,r0,-0x0001 |r2 = -0x01 0017cf98: a2200001 sb r0,0x0001(r17) |Set Attacker misc 0x18d = 0x00 (no targets) 0017cf9c: 0805f4ca j 0x0017d328 >>jump to END (r2 = -0x01) 0017cfa0: a2200018 sb r0,0x0018(r17) |Set Attacker misc0x1a4 = 0x00 (ends attack) 0017cfa4: 3c108019 lui r16,0x8019 #Else (Targeting is ok) 0017cfa8: 261038ef addiu r16,r16,0x38ef |r16 = 0x801938ef 0x801938ef 0017cfac: 92020000 lbu r2,0x0000(r16) |r2 = [Post Action Target ID] 0017cfb0: 00000000 nop | 0017cfb4: 2c420015 sltiu r2,r2,0x0015 |r2 = 0x01 if [Post Action Target ID] < 0x15 0017cfb8: 1040002d beq r2,r0,0x0017d070 #if [Post Action Target ID] is valid /Else branch after post action section 0017cfbc: 27a40010 addiu r4,r29,0x0010 |r4 = Stack 0x10 0017cfc0: 3c028019 lui r2,0x8019 | 0017cfc4: 944238c8 lhu r2,0x38c8(r2) |r2 = [ 0x801938c8 ] 0017cfc8: 00000000 nop | 0017cfcc: 14400007 bne r2,r0,0x0017cfec #If [0x801938c8] = 0x00 (not reacting ?) /Else Branch to post action section avoiding fall related check 0017cfd0: 00000000 nop | 0017cfd4: 3c028019 lui r2,0x8019 | 0017cfd8: 904238ed lbu r2,0x38ed(r2) |r2 = [ 0x801938ed ] 0017cfdc: 00000000 nop | 0017cfe0: 30420080 andi r2,r2,0x0080 |r2 <> 0x00 if Fall damage not calculated 0017cfe4: 10400022 beq r2,r0,0x0017d070 #If Fall damage related /Else avoid post action section 0017cfe8: 00000000 nop | 0017cfec: 0c05ed28 jal 0x0017b4a0 #E -->Disable Green Panel Flags 0017cff0: 00000000 nop | 0017cff4: 340600ff ori r6,r0,0x00ff |r6 = 0x00ff 0017cff8: 27a40011 addiu r4,r29,0x0011 |r4 = Stack 0x11 0017cffc: 27a50020 addiu r5,r29,0x0020 |r5 = Stack 0x20 0017d000: 92030000 lbu r3,0x0000(r16) |r3 = [Post Action Target ID] 0017d004: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d008: afa20028 sw r2,0x0028(r29) |Store 0x01 at stack 0x28 0017d00c: a3a30010 sb r3,0x0010(r29) |Store [Post Action Target ID] at stack 0x10 0017d010: a0860000 sb r6,0x0000(r4) @LOOP store 0xff from stack 0x11 to stack 0x19 0017d014: 24840001 addiu r4,r4,0x0001 |r4 = Stack counter 0017d018: 0085102a slt r2,r4,r5 |r2 = 0x01 if r4 < stack 0x20 0017d01c: 1440fffc bne r2,r0,0x0017d010 Λ loop while Stack counter < stack 0x20 0017d020: 00000000 nop | 0017d024: 3c028019 lui r2,0x8019 |r2 = 0x80190000 0017d028: 904238ef lbu r2,0x38ef(r2) |r2 = [Post Action Target ID] 0017d02c: 00000000 nop | 0017d030: 000220c0 sll r4,r2,0x03 |r4 = [Post Action Target ID] *8 0017d034: 00822023 subu r4,r4,r2 |r4 = [Post Action Target ID] *7 0017d038: 00042180 sll r4,r4,0x06 |r4 = [Post Action Target ID] *448 0017d03c: 3c028019 lui r2,0x8019 | 0017d040: 244208cc addiu r2,r2,0x08cc |r2 = 0x801908cc (Start of units data) 0017d044: 0c060428 jal 0x001810a0 |-->Map Location Calculation return r2 = r4 Tile ID 0017d048: 00822021 addu r4,r4,r2 |r4 = [Post Action Target] data pointer 0017d04c: 000210c0 sll r2,r2,0x03 |r2 = [Post Action Target] Tile ID * 8 0017d050: 3c038019 lui r3,0x8019 | 0017d054: 2463f8cc addiu r3,r3,-0x0734 |r3 = 0x8018f8cc (Start of tiles data) 0017d058: 00431021 addu r2,r2,r3 |r2 = [Post Action Target's Tile] Data pointer 0017d05c: 90430005 lbu r3,0x0005(r2) |r3 = [Post Action Target's Tile] 0x05 byte 0017d060: 00000000 nop | 0017d064: 34630080 ori r3,r3,0x0080 |r3 = [Post Action Target's Tile] 0x05 byte with 0x80 (green panel) 0017d068: a0430005 sb r3,0x0005(r2) |Update [Post Action Target's Tile] 0x05 byte with green panel enabled 0017d06c: 27a40010 addiu r4,r29,0x0010 |r4 = Stack 0x10 0017d070: 0c05f614 jal 0x0017d850 |-->List_and_Sort_Targeted_Units Return a list of targeted units at r4 (r29 0x10 to r29 0x24) 0017d074: 02602821 addu r5,r19,r0 |r5 = Attacker data pointer 0017d078: afa20028 sw r2,0x0028(r29) |store Number of Targeted units at stack x028 0017d07c: 27a40010 addiu r4,r29,0x0010 |r4 = Stack 0x10 0017d080: 341500ff ori r21,r0,0x00ff |r21 = 0xff 0017d084: 27b00010 addiu r16,r29,0x0010 |r16 = Stack 0x10 0017d088: 93a20028 lbu r2,0x0028(r29) |r2 = Number of targeted units 0017d08c: 3c018019 lui r1,0x8019 | 0017d090: a02238ec sb r2,0x38ec(r1) |Store Number of targeted units at 0x801938ec ( 801938ec ) 0017d094: 0c063b7e jal 0x0018edf8 |-->Store_Ability_Targets Store the first 0x10 targeted units in current ability hitted units ( 0x80193868 ) 0017d098: 27b20025 addiu r18,r29,0x0025 |r18 = Stack 0x25 (end of targeted units list) 0017d09c: 0c062c9d jal 0x0018b274 |-->Store_used_weapon Store Attacker used weapon ID at 0x801938d8 0017d0a0: 2664016e addiu r4,r19,0x016e |r4 = Pointer to Attacker 0x16e 0017d0a4: 92050000 lbu r5,0x0000(r16) @LOOP r5 = This iteration Targeted unit 0017d0a8: 00000000 nop | 0017d0ac: 10b50005 beq r5,r21,0x0017d0c4 #If This targeted unit ID is valid (<>0xff) /Else branch to next iteration 0017d0b0: 26100001 addiu r16,r16,0x0001 |r16 = Targeted units list offset counter (+0x01 each iteration) 0017d0b4: 3c018019 lui r1,0x8019 | 0017d0b8: a02038e9 sb r0,0x38e9(r1) |Clear 0x801938e9 0017d0bc: 0c062cd3 jal 0x0018b34c |-->Pre Formula Setup (FDC) Do the magic 0017d0c0: 2664016e addiu r4,r19,0x016e |r4 = Attacker 0x16e pointer 0017d0c4: 0212102a slt r2,r16,r18 |r2 = 0x01 if Targeted list offset < End of list pointer 0017d0c8: 1440fff6 bne r2,r0,0x0017d0a4 Λ Loop while not at the end of the list 0017d0cc: 00000000 nop | 0017d0d0: 0c062b1d jal 0x0018ac74 |-->Remove transparent status if Jump is used? 0017d0d4: 02602021 addu r4,r19,r0 |r4 = Attacker data pointer 0017d0d8: 0c063b89 jal 0x0018ee24 |-->Count number of targets hit by ability return r2 = hit counter (store Target list from 0x80193868 on r4) 0017d0dc: 26240002 addiu r4,r17,0x0002 |r4 = Attacker misc data 0x18e (Target list) 0017d0e0: afa20028 sw r2,0x0028(r29) |store Number of Targeted units at stack x028 0017d0e4: 93a20028 lbu r2,0x0028(r29) |r2 = Number of Targeted units 0017d0e8: 00000000 nop | 0017d0ec: a2220001 sb r2,0x0001(r17) |Store number of targeted units at Attacker misc data 0x18d 0017d0f0: 93a20028 lbu r2,0x0028(r29) |r2 = Number of Targeted units 0017d0f4: 3c038019 lui r3,0x8019 | 0017d0f8: 8c63f5f0 lw r3,-0x0a10(r3) |r3 = Type of action 0x8018f5f0 0017d0fc: 3c018019 lui r1,0x8019 | 0017d100: a02238ec sb r2,0x38ec(r1) |Store number of targeted unit at 0x801938ec 0017d104: 14600004 bne r3,r0,0x0017d118 #If Action Type = 0x00 (pre-attack / attack) 0017d108: 02602021 addu r4,r19,r0 |r4 = Attacker data pointer 0017d10c: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d110: 3c018019 lui r1,0x8019 | 0017d114: a02238e8 sb r2,0x38e8(r1) |Store 0x01 at 0x801938e8 (can earn xp ?) 0017d118: a2200023 sb r0,0x0023(r17) |Store 0x00 in Attacker misc data 0x1af 0017d11c: 93a60028 lbu r6,0x0028(r29) |r6 = Number of targeted units 0017d120: 0c05f504 jal 0x0017d410 |-->Draw out routine dealing with experience gain Prepare attacker current action for katana not broken 0017d124: 02202821 addu r5,r17,r0 |r5 = Attacker misc data 0x18c pointer 0017d128: a2340000 sb r20,0x0000(r17) |Store Attacker ID in attacker's misc 0x18c 0017d12c: 3c028019 lui r2,0x8019 | 0017d130: 904238d8 lbu r2,0x38d8(r2) |r2 = Current ability used weapon ID 0017d134: 02602021 addu r4,r19,r0 |r4 = Attacker data pointer 0017d138: a2200017 sb r0,0x0017(r17) |Nullify Attacker misc data 0x1a3 (Post action event state ?) 0017d13c: a222001f sb r2,0x001f(r17) |Store current ability used weapon ID at Attacker misc 0x1ab 0017d140: 3c028019 lui r2,0x8019 | 0017d144: 904238c3 lbu r2,0x38c3(r2) |r2 = Current ability strike counter 0x801938c3 0017d148: 02202821 addu r5,r17,r0 |r5 = misc unit data 0x18c 0017d14c: 0c05f4d4 jal 0x0017d350 |-->Set target coordinates for ability? Store updated Targeted X,Y, elevation in Attacker misc data 0017d150: a2220019 sb r2,0x0019(r17) |Store strike counter at attacker misc 0x1a5 0017d154: 8fa20028 lw r2,0x0028(r29) |r2 = Number of targeted units 0017d158: 00000000 nop | 0017d15c: 1440001c bne r2,r0,0x0017d1d0 #If Number of targets = 0x00 0017d160: 00000000 nop | 0017d164: 3c028019 lui r2,0x8019 |r2 = 0x80190000 0017d168: 904238c3 lbu r2,0x38c3(r2) |r2 = Current ability strike counter 0017d16c: 00000000 nop | 0017d170: 24420001 addiu r2,r2,0x0001 |r2 = Strike counter + 0x01 0017d174: 3c018019 lui r1,0x8019 | 0017d178: a02238c3 sb r2,0x38c3(r1) |Store new strike counter 0017d17c: 96630170 lhu r3,0x0170(r19) |r3 = Attacker Used Ability ID 0017d180: 93a2002c lbu r2,0x002c(r29) |r2 = Ability data 2 flag 3 0017d184: a620001a sh r0,0x001a(r17) |Nullify Attacker Misc 0x1a6 (reaction ID ?) 0017d188: 30420001 andi r2,r2,0x0001 |r2 = 0x01 if animate on miss is enabled 0017d18c: 14400003 bne r2,r0,0x0017d19c #If no animation on miss 0017d190: a6230014 sh r3,0x0014(r17) |Store last used Attack in Attacker misc 0x1a0 0017d194: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d198: a2220012 sb r2,0x0012(r17) |Store 0x01 in Attacker misc 0x19e 0017d19c: 3c028019 lui r2,0x8019 |r2 = 0x80190000 0017d1a0: 904238c3 lbu r2,0x38c3(r2) |r2 = Ability strike counter 0017d1a4: 3c038019 lui r3,0x8019 | 0017d1a8: 906338c2 lbu r3,0x38c2(r3) |r3 = Ability number of hits 0017d1ac: 00000000 nop | 0017d1b0: 0043102b sltu r2,r2,r3 |r2 = 0x01 if Number of strikes < Number of hits 0017d1b4: 10400003 beq r2,r0,0x0017d1c4 #If There's still strikes to deal 0017d1b8: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d1bc: 0805f472 j 0x0017d1c8 >>Jump storing 0x01 instead of 0x00 0017d1c0: a2220018 sb r2,0x0018(r17) |Store 0x01 in Attacker misc 0x1a4 (Attack continues) 0017d1c4: a2200018 sb r0,0x0018(r17) #Else Store 0x00 in Attacker misc 0x1a4 (Attack will end) 0017d1c8: 0805f4ca j 0x0017d328 >>jump to END (with r2 = 0x01) 0017d1cc: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d1d0: 3c028019 lui r2,0x8019 #Else (At least one unit is Targeted) 0017d1d4: 9042390e lbu r2,0x390e(r2) |r2 = Post formula flag (poach ? Train ?) 0x8019390e / 8019390e 0017d1d8: a2200012 sb r0,0x0012(r17) |Nullify animate on miss (somebody is targeted) at attacker misc 0x19e 0017d1dc: a2220016 sb r2,0x0016(r17) |Store post formula flag at Attacker misc 0x1a2 0017d1e0: 3c038019 lui r3,0x8019 | 0017d1e4: 946338c6 lhu r3,0x38c6(r3) |r3 = Reaction ID 0x801938c6 / 801938c6 0017d1e8: 00000000 nop | 0017d1ec: 10600009 beq r3,r0,0x0017d214 #If Reaction ID <> 0x00 0017d1f0: 00000000 nop | 0017d1f4: 3c028019 lui r2,0x8019 |r2 = 0x80190000 0017d1f8: 944238c8 lhu r2,0x38c8(r2) |r2 = 0x801938c8 0017d1fc: 00000000 nop | 0017d200: 14400004 bne r2,r0,0x0017d214 #If [801938c8] = 0x00 0x801938c8 / 801938c8 0017d204: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d208: a6230014 sh r3,0x0014(r17) |Store Reaction ID in Attacker misc 0x1a0 (last used attack ID) 0017d20c: 0805f48f j 0x0017d23c >>Jump keeping Attacker misc 0x1a0 0017d210: a2220017 sb r2,0x0017(r17) |Store 0x01 in Attacker misc 0x1a3 (=Post action occured) 0017d214: 3c028019 lui r2,0x8019 |r2 = 0x80190000 0017d218: 904238e9 lbu r2,0x38e9(r2) |r2 = 0x80190000 0x801938e9 / 801938e9 0017d21c: 00000000 nop | 0017d220: 10400003 beq r2,r0,0x0017d230 #If [0x801938e9] <> 0x00 Default to weapon attack ? 0017d224: 00000000 nop | 0017d228: 0805f48f j 0x0017d23c >>jump nullifying Attacker misc 0x1a0 (last used Attack) 0017d22c: a6200014 sh r0,0x0014(r17) |Store last attack used = 0x00 (Attack ?) 0017d230: 96620170 lhu r2,0x0170(r19) # Else r2 = Attacker last used ability (0x170) 0017d234: 00000000 nop | 0017d238: a6220014 sh r2,0x0014(r17) |Store Attacker last used ability in Attacker misc 0x1a0 0017d23c: 3c028019 lui r2,0x8019 |r2 = 0x80190000 0017d240: 944238c6 lhu r2,0x38c6(r2) |r2 = Reaction ID 0x801938c6 / 801938c6 0017d244: 00000000 nop | 0017d248: a622001a sh r2,0x001a(r17) |Store reaction ID in Attacker misc 0x1a6 (Reaction ID) 0017d24c: 3c028019 lui r2,0x8019 | 0017d250: 904238ed lbu r2,0x38ed(r2) |r2 = [0x801938ed] Fall ? Poach ? 0017d254: 00000000 nop | 0017d258: 1040000e beq r2,r0,0x0017d294 #If [0x801938ed] <> 0x00 - Store Target new coordinates (Fall related) /Else skip coordinates update 0017d25c: 3042007f andi r2,r2,0x007f |r2 = Everything but 0x80 flag of [0x801938ed] 0017d260: a2220022 sb r2,0x0022(r17) |Store r2 on Attacker misc 0x1ae 0017d264: 3c028019 lui r2,0x8019 | 0017d268: 904238ca lbu r2,0x38ca(r2) |r2 = Current ability Target new X 0x801938ca / 801938ca 0017d26c: 00000000 nop | 0017d270: a222001c sb r2,0x001c(r17) |Store Ability Target new X in Attacker misc 0x1a8 0017d274: 3c028019 lui r2,0x8019 | 0017d278: 904238cb lbu r2,0x38cb(r2) |r2 = Current ability Target new Y 0x801938cb / 801938cb 0017d27c: 00000000 nop | 0017d280: a222001d sb r2,0x001d(r17) |Store Ability Target new Y in Attacker misc 0x1a9 0017d284: 3c028019 lui r2,0x8019 | 0017d288: 904238cc lbu r2,0x38cc(r2) |r2 = Current ability Target new elevation * 0x801938cc / 801938cc 0017d28c: 00000000 nop | 0017d290: a222001e sb r2,0x001e(r17) |Store Ability Target new elevation in Attacker misc 0x1aa 0017d294: 3c028019 lui r2,0x8019 |r2 = 0x80190000 0017d298: 944238c8 lhu r2,0x38c8(r2) |r2 = [0x80198c8] 0x801938c8 / 801938c8 0017d29c: 00000000 nop | 0017d2a0: 1440001d bne r2,r0,0x0017d318 #If [0x801938c8] = 0x00 0017d2a4: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d2a8: 3c028019 lui r2,0x8019 | 0017d2ac: 904238ed lbu r2,0x38ed(r2) |r2 = [0x801938ed] 0017d2b0: 00000000 nop | 0017d2b4: 30420080 andi r2,r2,0x0080 |r2 = Flag 0x80 of 0x801938ed 0x801938ed / 801938ed 0017d2b8: 14400017 bne r2,r0,0x0017d318 #If [0x801938ed] flag 0x80 is not enabled (if fall, it's resolved)) /If not Branch to END (Attack will continue) 0017d2bc: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d2c0: 3c028019 lui r2,0x8019 |r2 = 0x8019000 0017d2c4: 904238ed lbu r2,0x38ed(r2) |r2 = [0x801938ed] 0017d2c8: 00000000 nop | 0017d2cc: 10400005 beq r2,r0,0x0017d2e4 #If [0x801938ed] <> 0x00 /Else SkipFall related update ? 0017d2d0: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d2d4: a2220017 sb r2,0x0017(r17) |Store 0x01 in Attacker misc 0x1a3 (=post action occured) 0017d2d8: a2220012 sb r2,0x0012(r17) |Store 0x01 in Attacker misc 0x19e 0017d2dc: 34020200 ori r2,r0,0x0200 |r2 = 0x200 0017d2e0: a6220014 sh r2,0x0014(r17) |store 0x200 as Attacker misc 0x1a0 (Last used ability ID) 0017d2e4: 3c028019 lui r2,0x8019 | 0017d2e8: 904238c3 lbu r2,0x38c3(r2) |r2 = Attacks strike counter 0x801908c3 / 801938c3 0017d2ec: 3c038019 lui r3,0x8019 | 0017d2f0: 906338c2 lbu r3,0x38c2(r3) |r3 = Ability number of hits 0017d2f4: 24420001 addiu r2,r2,0x0001 |r2 = Strike counter + 1 0017d2f8: 3c018019 lui r1,0x8019 | 0017d2fc: a02238c3 sb r2,0x38c3(r1) |Store increased strike counter 0017d300: 3c028019 lui r2,0x8019 | 0017d304: 904238c3 lbu r2,0x38c3(r2) |r2 = Increased strike counter 0017d308: 00000000 nop | 0017d30c: 0043102b sltu r2,r2,r3 |r2 = 0x01 if Number of hits not reached 0017d310: 10400003 beq r2,r0,0x0017d320 #If There's still strikes to give 0017d314: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0017d318: 0805f4c9 j 0x0017d324 #E #E >>Jump to END (Attack not endend flag ON) 0017d31c: a2220018 sb r2,0x0018(r17) |Store 0x01 at Attacker misc 0x1a4 (Attack continues) 0017d320: a2200018 sb r0,0x0018(r17) |Store 0x00 at Attacker misc 0x1a4 (Attack ends) 0017d324: 00001021 addu r2,r0,r0 |r2 = 0x00 0017d328: 8fbf0048 lw r31,0x0048(r29) | 0017d32c: 8fb50044 lw r21,0x0044(r29) | 0017d330: 8fb40040 lw r20,0x0040(r29) | 0017d334: 8fb3003c lw r19,0x003c(r29) | 0017d338: 8fb20038 lw r18,0x0038(r29) | 0017d33c: 8fb10034 lw r17,0x0034(r29) | 0017d340: 8fb00030 lw r16,0x0030(r29) | 0017d344: 27bd0050 addiu r29,r29,0x0050 | 0017d348: 03e00008 jr r31 | 0017d34c: 00000000
Notes
--X PRE FORMULA SECTION X-- PREPARATION -Set 0x8018f4f4 to 0x00 -Set 0x8018f4f8 to 0x00 (Linear attack flag) -Set 0x8019390f to 0x00 (Random fire Attack flag) -Fill Stack 010 to 0x24 with 0xFF (will become Targeted units list) -Call Current_Action_Data_Nulling 2 times - 1st on Attacker's (by ID) Current action flags (0x18c to 0x1b5) - 2nd on 0x80192da0 (copy of Attacker's action data) -Reset 0x80193860 to 0x80193864 (Ability status to cancel) -Preserve last attack received (0x1b2) and reaction ID (0x19a) (both calls) -Set Hit% = 100% (both calls), Hit flag will be set to miss (after jal) -Set Attackers 0x18e (current action evade type) to 0x08 (canceled) -Clear some Attacker misc data - 0x19f (Math skill flag ?) - 0x1a2 - 0x1ae TARGETING -Check ACTION's TYPE ( 0x8018f5f0 ) If REACTION ( 0x8018f5f0 <> 0x00 ) --> Jal Reaction_Target/Hit_Calculation will set the targets list matching reaction ID (0x80192d9c) - If Reaction is reflect r29 0x2c to 0x01 (else 0x00), will serve animate on miss purpose - If Reaction is supported by above routine, it will skip default targeting section If DEFAULT ACTION ( 0x8018f5f0 = 0x00) - If Skillset is Maths (Attacker's 0x1 = 0x15) - Store 0x01 at Attacker misc 0x19f --> Jal Map calculations for attack - Lot of things happens here - Will set every kind of AoE / Seeks obstacles - Lot of Action menu/Skillset hardcoded shit too - Choose one tile for random fire abilities - If Targeting routines returns invalid data jump to END TARGETING Done and valid - If Post Action Target (from 0x801938ef )is valid (<0x15) - If 0x801938c8 <> 0x00 (Post action event ?) or 0x801938ed flag 0x80 is enabled (incoming fall) - Reset targeting Disable Green Panel Flags - Erase target list ? (0xff on stack 0x11 to 0x20) - Enable green panel flag on Post action Target Tile 0x05 - SET A LIST OF TARGETED UNITS - List_and_Sort_Targeted_Units List of all Units on a green panel flag - Units are stored on r29 0x10 to 0x14 - Unit number is stored at r29 0x28 --X FORMULA SECTION X-- Store number of targeted units at 0x801938ec (purpose ?) Store_Ability_Targets Only the first 0x10 ? Starts at 0x80193868 Store used weapon ID at 0x801938d8 Store_used_weapon action menu hardcoded LOOP Through all Targeted unit (r29 0x24 to r29 0x10) --> Pre Formula Setup (FDC) (yeah !!!) --X POST FORMULA SECTION X-- Store bunch of Attacker's misc data and determines if attack ends or not Remove transparent status if Jump is used? Count number of targets hit by ability - Remove some unit from Target list at 0x80193868 and store the list at Attacker misc 0x18e - Update Target number Store new Target number at Attacker misc If Action type is not a reaction ( 0x8018f5f0 = 0x00) - Set 0x801938e8 = 0x01 (can earn xp) - Set Attacker misc 0x1af to 0x00 (xp related ?) Draw out routine dealing with experience gain deal with katana broken state (not xp) may overrides some special flags data Store Attacker ID in Attacker's misc 0x18c Store 0x00 in Attacker misc 0x1a3 (current strike counter) Store Current ability used weapon ID (0x801938d8) in Attacker misc 0x1ab Store Strike counter (0x801938c3) at Attacker misc 0x1a5 Set target coordinates for ability? - Store (udpated) Targeted coordinates in Attacker misc 0x1a8,0x1a9,0x1aa If There is no targeted units - Increase strike counter on 0x801938c3 - Nullify Attacker misc 0x1a6 (reaction ID ?) - Store Attacker 0x170 (last used ability) in Attacker misc 0x1a0 - If no animation on miss (nor reflect reaction) set Attacker misc 0x19e to 0x01 - Check Strike count (0x801938c3) Vs hit number (0x801938c2) - If no more strikes : store 0x00 in Attacker misc 0x1a4 - If There's still strikes to deal : store 0x01 in Attacker misc 0x1a4 - Jump to end with r2 = 0x01 If There were targeted units - Set 0x00 in Attacker's misc 0x19e - Fill Attacker's misc 0x1a2 with 0x8019390e If Reaction ID (0x801938c6) <> 0x00 AND 0x801938c8 = 0x00 - Store Reaction ID in Attacker misc 0x1a0 - Set Attacker misc 0x1a3 to 0x01 Else : if 0x801938e9 <> 0x00 (weapon attack ?) : store 0x00 in Attacker misc 0x1a0 Else : Store Attacker last used ability (0x170) in Attacker's misc 0x1a0 Store Current ability Reaction ID (0x801938c6) in Attacker's misc 0x1a6 Check 0x801938ed (Fall related) - if <> 0x00 - Fill Attacker's misc 0x1ae with 0x801938ed without 0x80 flag (Fall dmg calculated) - Fill Attacker's misc 0x1a8,0x1a9,0x1aa with current ability "new" coordinates 0x801938ca, 0x801938cb, 0x801938cc If 0x801938c8 <> 0x00 : incoming post ability events ? - Store 0x01 in Attacker's misc 0x1a4 (Attack continues) Else If 0x801938ed 0x80 flag is enabled (Incoming fall) - Store 0x01 in Attacker's misc 0x1a4 (Attack continues) Else - If 0x801938ed <> 0x00 (Fall resolved) : Set Attacker's misc 0x1a3 = 0x01 Set Attacker's misc 0x19e = 0x01 Set Attacker's misc 0x1a0 (last used ability) = 0x200 (Fall ID ?) - Increases strike counter (0x801938c3) - Check Strike counter Vs Ability Hits numbers : - No more strikes : store 0x00 in Attacker's misc 0x1a4 (attack ends) - There's still strike to deal : set Attakcer misc 0x1a4 to 0x01 (Attack continues) Returns r2 = 0x00
(Very) Short Notes
Reset a bunch of action data (Unit data, Unit misc data, current ability data) Set Targeting data (depend of weapon / ability flag / action menu) - List of targets - AoE : targeted tile have their green panel flag enabled (byte 0x05 flag 0x80) LOOP through targeted unit and call Pre_Formula_Setup_(FDC) each times Do some Post action stuff (update data, store data on attacker misc flags) Increase strikes count, if = number of wanted hits - store "ends the attack flag"
Retun locations
00073f2c: Set_damage_display_type_based_on_ability 0019de38: AI_ability_processing