Pre Formula Setup (FDC)
Jump to navigation
Jump to search
Instructions and notes
Pre Formula Setup (FDC) Short Summary // Long Summary ------------------------------------- r4 = Attacker data pointer / r5 Defender ID Returns r2 = 0x01 if ability missed before formula jump (reflect, blade graps arrow guard) r2 = 0x00 if it jump to formula routines ------------------------------------- 0018b34c: 27bdffc8 addiu r29,r29,0xffc8 | 0018b350: afb00028 sw r16,0x0028(r29) | 0018b354: 00a08021 addu r16,r5,r0 |r16 = Target ID 0018b358: 27a50010 addiu r5,r29,0x0010 | 0018b35c: afbf0034 sw r31,0x0034(r29) | 0018b360: afb20030 sw r18,0x0030(r29) | 0018b364: 0c01788b jal 0x0005e22c |--> Copy_Byte_Data_(20_Bytes) (from r4 to r5 : copy attacker action data on stack) 0018b368: afb1002c sw r17,0x002c(r29) | 0018b36c: 3c018019 lui r1,0x8019 | 0018b370: a03038c1 sb r16,0x38c1(r1) |Store ID of the defending unit (Current ability data 0x801938c1 ) 0018b374: 321000ff andi r16,r16,0x00ff |r16 = Last byte of Target ID 0018b378: 001010c0 sll r2,r16,0x03 |r2 = Defender ID * 0x8 0018b37c: 00501023 subu r2,r2,r16 |r2 = defender ID * 0x7 0018b380: 00021180 sll r2,r2,0x06 |r2 = defender ID * 0x1c0 0018b384: 3c048019 lui r4,0x8019 | 0018b388: 248408cc addiu r4,r4,0x08cc |r4 = Start of Unit Data 0018b38c: 00441821 addu r3,r2,r4 |r3 = Defender data location(start of unit data + Defender battle ID * 0x1c0) 0018b390: 3c018019 lui r1,0x8019 | 0018b394: ac232d98 sw r3,0x2d98(r1) |Store Defender's Data Location (Current action data 0x80192d98) 0018b398: 2483018c addiu r3,r4,0x018c |r3 = Start of unit data + 0x018c (current action data) 0018b39c: 00431021 addu r2,r2,r3 |r2 = Current action data + 0x01c0 (Defender current action data) 0018b3a0: 93a30010 lbu r3,0x0010(r29) |r3 = Load attackers unit ID from stack (from routine 0x0005e22c) 0018b3a4: 3c018019 lui r1,0x8019 | 0018b3a8: ac222d90 sw r2,0x2d90(r1) |Store Defender's Current Action Data (Current action data 0x80192d90 ) 0018b3ac: 3c028019 lui r2,0x8019 | 0018b3b0: 244238c0 addiu r2,r2,0x38c0 |r2 = Load Attacker's Unit ID location 0018b3b4: 3c018019 lui r1,0x8019 | 0018b3b8: a020390e sb r0,0x390e(r1) |set current ability formula (?) to 0x00 at 0x8019390e 0018b3bc: a0430000 sb r3,0x0000(r2) |Store ID of the attacking unit (Current Ability data 0x801938c0 ) 0018b3c0: 90430000 lbu r3,0x0000(r2) |r3 = Load ID of the attacking unit 0018b3c4: 3c028019 lui r2,0x8019 | 0018b3c8: 24422da0 addiu r2,r2,0x2da0 |r2 = 0x80192da0 (copy of attacker action data?) 0018b3cc: 3c018019 lui r1,0x8019 | 0018b3d0: ac222d8c sw r2,0x2d8c(r1) |Store "0x80192da0" into attacker current action data location (current action data 0x80192d8c) 0018b3d4: 000310c0 sll r2,r3,0x03 |r2 = Attacking unit ID * 8 0018b3d8: 00431023 subu r2,r2,r3 |r2 = Attacking unit ID * 7 0018b3dc: 00021180 sll r2,r2,0x06 |r2 = Attacking unit ID * 448 (0x1c0) 0018b3e0: 3c038019 lui r3,0x8019 | 0018b3e4: 8c63f5f0 lw r3,-0x0a10(r3) |r3 = Loads type of action (word / reacting - pre attack - attack) from 0x8018f5f0 8018F5F0 0018b3e8: 00441021 addu r2,r2,r4 |r2 = Attacker data location (r4 = start of units data + r2 Attacker ID * 448) 0018b3ec: 3c018019 lui r1,0x8019 | 0018b3f0: ac222d94 sw r2,0x2d94(r1) |Store Attacker's Data location (Current action data 0x80192d94) 0018b3f4: 10600009 beq r3,r0,0x0018b41c # If reacting /Branch if attack is initial or preview 0018b3f8: 00000000 nop | 0018b3fc: 0c062bcb jal 0x0018af2c |--> Perform_reaction_abilities r2 = 0x01 for non counter post action abilities ? / -0x01 for guard skills/ 0x00 for counter abilities, hamedo and auto-potion (?) 0018b400: 00000000 nop |Notes : if r2 = 0x01 Current action data are edited 0018b404: 10400005 beq r2,r0,0x0018b41c #If Reaction ability is not a counter one 0018b408: 00000000 nop | 0018b40c: 0c062c9d jal 0x0018b274 |--> Store_used_weapon (modified by action menu ID) 0018b410: 27a40010 addiu r4,r29,0x0010 |makes r4 a stack pointer for above jal 0018b414: 08062e77 j 0x0018b9dc >> Jump to End 0018b418: 00001021 addu r2,r0,r0 |r2 = 0x00 0018b41c: 3c028019 lui r2,0x8019 #E #E Not reacting or reaction is a counter ability 0018b420: 904238ed lbu r2,0x38ed(r2) |r2 = Can poach/post action byte // Fall damage ? 0018b424: 00000000 nop | 0018b428: 30420080 andi r2,r2,0x0080 |r2 = 0x0080 if attack is fall damage / Else = 0x000 (0x80 is flagged as fall dmg not calculated ?) 0018b42c: 10400005 beq r2,r0,0x0018b444 #If attack is fall Dmg /Else branch 0018b430: 00000000 nop | 0018b434: 0c062b8f jal 0x0018ae3c |--> Knockback%3F Set Fall Damage 0018b438: 00000000 nop | 0018b43c: 08062e77 j 0x0018b9dc >> Jump to End 0018b440: 00001021 addu r2,r0,r0 |r2 = 0x00 0018b444: 3c048019 lui r4,0x8019 #Else - Attack is not fall dmg 0018b448: 8c842d98 lw r4,0x2d98(r4) |r4 = Target Data Pointer 0018b44c: 0c060428 jal 0x001810a0 |--> Map_Location_Calculation Return r2 as Target tile ID 0018b450: 00000000 nop | 0018b454: 000210c0 sll r2,r2,0x03 |r2 = Target tile ID x 8 0018b458: 3c018019 lui r1,0x8019 | 0018b45c: 00220821 addu r1,r1,r2 |r1 = 8019 + Tile ID x 8 0018b460: 9022f8cc lbu r2,-0x0734(r1) |r2 = Target Tile Type (from 0x8018f8cc + tile ID offset) 0018b464: 3c038019 lui r3,0x8019 | 0018b468: 906338c3 lbu r3,0x38c3(r3) |r3 = Strike counter (previous info Weapon Hand (0 = R, 1 = L) ?) 0018b46c: 3042003f andi r2,r2,0x003f |r2 = Filter out Target tile terrain type 0018b470: 3c018019 lui r1,0x8019 | 0018b474: a02238cd sb r2,0x38cd(r1) |Store defender terrain type at current ability 0x801938cd (flagged as caster tile ID in data table ?) 0018b478: 14600005 bne r3,r0,0x0018b490 #If 1rst strike /Else branch 0018b47c: 00000000 nop | 0018b480: 3c078019 lui r7,0x8019 | 0018b484: 90e738c4 lbu r7,0x38c4(r7) |r7 = Current ability Primary weapon ID 0018b488: 08062d26 j 0x0018b498 >> Jump after not first strike section 0018b48c: 00000000 nop | 0018b490: 3c078019 lui r7,0x8019 #Else - Not first strike 0018b494: 90e738c5 lbu r7,0x38c5(r7) |r7 = Current ability secondary weapon ID 0018b498: 93a30011 lbu r3,0x0011(r29) |r3 = Attacker Last skillset used 0018b49c: 34020013 ori r2,r0,0x0013 |r2 = 0x13 (= Draw out ID) 0018b4a0: 14620004 bne r3,r2,0x0018b4b4 # If Draw Out 0018b4a4: 30e200ff andi r2,r7,0x00ff |r2 = r7 (primary or secondary weapon ID) 0018b4a8: 93a70018 lbu r7,0x0018(r29) |r7 = Attacker Used item/Equip ID (from Attacker 0x176) 0018b4ac: 00000000 nop | 0018b4b0: 30e200ff andi r2,r7,0x00ff |r2 = Used item 0018b4b4: 2c420080 sltiu r2,r2,0x0080 |r2 = 0x01 if the item is a weapon (ID < 0x80) - Else 0x00 (not a weapon) 0018b4b8: 14400002 bne r2,r0,0x0018b4c4 #If Equiped/used item is not a weapon 0018b4bc: 00000000 nop | 0018b4c0: 00003821 addu r7,r0,r0 |r7 = 0x00 0018b4c4: 97a30012 lhu r3,0x0012(r29) |r3 = Attacker Last attack/ability used (attacker 0x170) 0018b4c8: 3c108019 lui r16,0x8019 | 0018b4cc: 261038d8 addiu r16,r16,0x38d8 |r16 = 0x801938d8 - current ability weapon ID adress 0018b4d0: a2070000 sb r7,0x0000(r16) |Store Attacker used/equiped Weapon ID (0x00 if not a weapon) at current ability 0x801938d8 0018b4d4: 3c018019 lui r1,0x8019 | 0018b4d8: a42338d6 sh r3,0x38d6(r1) |Store Attacker used Ability/Attack ID at current ability 0x801938d6 0018b4dc: 3c028019 lui r2,0x8019 | 0018b4e0: 944238d6 lhu r2,0x38d6(r2) |Load current ability Used Ability ID 0018b4e4: 3c018019 lui r1,0x8019 | 0018b4e8: a02038d9 sb r0,0x38d9(r1) |Store Two Hands as inactive (?) 0018b4ec: 2c420171 sltiu r2,r2,0x0171 |r2 = 0x01 if used ability is before Hi-potion 0018b4f0: 14400002 bne r2,r0,0x0018b4fc # If Ability ID >= Hi-Potion 0018b4f4: 26050018 addiu r5,r16,0x0018 |r5 = 0x801938F0 - Current Ability Range data location 0018b4f8: 00001821 addu r3,r0,r0 |r3 = 0x00 (used ability ID = 0x00) 0018b4fc: 000320c0 sll r4,r3,0x03 |r4 = Used Ability ID * 8 0018b500: 00832023 subu r4,r4,r3 |r4 = Used Ability ID * 7 0018b504: 00042040 sll r4,r4,0x01 |r4 = Used Ability ID * 14 (if ability ID >= Hi potion, r4 = 0x00) 0018b508: 3c028006 lui r2,0x8006 | 0018b50c: 2442fbf0 addiu r2,r2,-0x410 |r2 = Start of Abilities data 2 0018b510: 00822021 addu r4,r4,r2 |r4 = Start of Used Ability (by ID) Data 2 0018b514: 3406000e ori r6,r0,0x000e |r6 = 0x0e (for next jal) 0018b518: 30e200ff andi r2,r7,0x00ff |r2 = Equiped/Used Weapon ID (0x00 if not a weapon) 0018b51c: 000210c0 sll r2,r2,0x03 |r2 = Weapon ID * 8 0018b520: 3c038006 lui r3,0x8006 | 0018b524: 24633ab8 addiu r3,r3,0x3ab8 |r3 = Start of weapons data 2 0018b528: 0c017895 jal 0x0005e254 |--> Store_X_Byte_into_Y - Store used ability data 2 into current ability data section (r5) from 0x801938f0 to 0x801938fd (If > Hi-potion all fields are set to 0x00) 0018b52c: 00438821 addu r17,r2,r3 |r17 = Start of Used weapon Data 2 0018b530: 02202021 addu r4,r17,r0 |r4 = r17 (preparing next jal) 0018b534: 26050026 addiu r5,r16,0x0026 |r5 = 0x801938FE (start of weapon section in current ability section) 0018b538: 0c017895 jal 0x0005e254 |--> Store_X_Byte_into_Y - Store equiped/used weapon data into weapon's current ability data section (from 0x801938fe to 0x80193905) (data from item 0x00 if not a weapon) 0018b53c: 34060008 ori r6,r0,0x0008 |r6 = 0x08 0018b540: 92240007 lbu r4,0x0007(r17) |r4 = Inflict Status/Cast Spell ID from used Weapon data 0018b544: 3c038019 lui r3,0x8019 | 0018b548: 8c632d94 lw r3,0x2d94(r3) |r3 = Attacker Data location 0018b54c: 34020001 ori r2,r0,0x0001 |r2 = 1 0018b550: 3c018019 lui r1,0x8019 | 0018b554: a02038e4 sb r0,0x38e4(r1) |Store current ability Charge Power to 0 at 0x801938e4 0018b558: 3c018019 lui r1,0x8019 | 0018b55c: a02238e5 sb r2,0x38e5(r1) |Store current ability Formula as 0x01 at 0x801938e5 0018b560: 3c018019 lui r1,0x8019 | 0018b564: a02438da sb r4,0x38da(r1) |Store Weapon's proc ID in current ability data proc ID at 801938da 0018b568: 90620026 lbu r2,0x0026(r3) |r2 = Attacker's Faith 0018b56c: 3c038019 lui r3,0x8019 | 0018b570: 8c632d98 lw r3,0x2d98(r3) |r3 = Defender Data location 0018b574: 3c018019 lui r1,0x8019 | 0018b578: a02238d3 sb r2,0x38d3(r1) | Store Attacker's Faith in current data section (without faith/innocent check) at 0x801938d3 0018b57c: 90620026 lbu r2,0x0026(r3) |r2 = Defender's Faith 0018b580: 3c018019 lui r1,0x8019 | 0018b584: a02238d2 sb r2,0x38d2(r1) |Store Defender's Faith in current data section (without faith/innocent check) at 0x801938d2 0018b588: 0c062b7d jal 0x0018adf4 |--> Action_data_nulling (nullify most of current TCAD and ACAP data / set hit% at 100% - Hit flag at 0x01 for target, at 0x00 for attacker) 0018b58c: 00000000 nop | 0018b590: 93a20011 lbu r2,0x0011(r29) |r2 = Attacker last used skillset (Attacker 0x16f) 0018b594: 3c038019 lui r3,0x8019 | 0018b598: 946338c8 lhu r3,0x38c8(r3) |r3 = ?? set to 0x00 if elemental nullification, to 0x01 if reaction/proc (maybe host something like"reactable" action) 0018b59c: 3c018019 lui r1,0x8019 | 0018b5a0: a02238d4 sb r2,0x38d4(r1) |Store r2 in current ability data last used skillset at 0x801938d4 0018b5a4: 304200ff andi r2,r2,0x00ff | 0018b5a8: 3c018006 lui r1,0x8006 | 0018b5ac: 00220821 addu r1,r1,r2 |r1 = 0x800600XX (XX = last used skill set) 0018b5b0: 90325cb4 lbu r18,0x5cb4(r1) |r18 = Action Menu of used skillset 0018b5b4: 10600009 beq r3,r0,0x0018b5dc #If 0x801938c8 <> 0x00 (Reaction ? Proc ?) Will switch Ability ID with reaction ID (0x801938c6) 0018b5b8: 00000000 nop | 0018b5bc: 3c028019 lui r2,0x8019 | 0018b5c0: 944238c6 lhu r2,0x38c6(r2) |r2 = current ability reaction byte Load (reaction ID? this halfword seems to handle all post-attack results...) 0018b5c4: 00000000 nop | 0018b5c8: a7a20012 sh r2,0x0012(r29) |Store Reaction ID as Attacker used ability ID on stack 0018b5cc: 3c018019 lui r1,0x8019 | 0018b5d0: a42238d6 sh r2,0x38d6(r1) |Store Reaction ID as current ability used ability ID (Proc ? Reaction ?) 0018b5d4: 08062d79 j 0x0018b5e4 >>jump after Else 0018b5d8: 00009021 addu r18,r0,r0 |r18 = 0x00 - Clear Action Menu ID to default 0018b5dc: 3c018019 lui r1,0x8019 #Else 0018b5e0: a42038c6 sh r0,0x38c6(r1) |Set current ability Reaction ID to 0x00 0018b5e4: 87a30012 lh r3,0x0012(r29) |r3 =attacker used ability ID (attacker 0x170 if not modified above) 0018b5e8: 3c028006 lui r2,0x8006 | 0018b5ec: 2442ebf0 addiu r2,r2,0xebf0 |r2 = Start of abilities data 1 0018b5f0: 000318c0 sll r3,r3,0x03 |r3 = r3 * 8 (ability ID * 8) 0018b5f4: 00621821 addu r3,r3,r2 |r3 = Ability (by ID) start of data 1 0018b5f8: 90620004 lbu r2,0x0004(r3) |r2 = used ability First set of AI Flags 0018b5fc: 3c048019 lui r4,0x8019 | 0018b600: 8c842d90 lw r4,0x2d90(r4) |r4 = Target current action data pointer 0018b604: 30420003 andi r2,r2,0x0003 |r2 = focus on target allies or target ennemies flags 0018b608: a0820018 sb r2,0x0018(r4) |Store Abilities AI Target Enemies/Allies into 0x18 of Current Action Data (positive spells 'miss,' negative spells are 'guarded'!) 0018b60c: 90620007 lbu r2,0x0007(r3) |r2 = Used ability evade with motion byte 0018b610: 00000000 nop | 0018b614: 30420001 andi r2,r2,0x0001 |r2 = 0x01 if evade with motion is checked - else 0x00 0018b618: 10400009 beq r2,r0,0x0018b640 # If Evade with motion is checked 0018b61c: 324300ff andi r3,r18,0x00ff |r3 = Action Menu ID 0018b620: 3c038019 lui r3,0x8019 | 0018b624: 8c632d90 lw r3,0x2d90(r3) |r3 = Target current action data pointer 0018b628: 00000000 nop | 0018b62c: 90620018 lbu r2,0x0018(r3) |r2 = TCADP 0x18 & 'missed' or 'guarded' byte (positive attack vs negative attack) 0018b630: 00000000 nop | 0018b634: 24420080 addiu r2,r2,0x0080 |update r2 with 0x80 if evade with motion is checked 0018b638: a0620018 sb r2,0x0018(r3) |store updated byte in Target current action 0x18 0018b63c: 324300ff andi r3,r18,0x00ff |r3 = Action Menu ID 0018b640: 34020007 ori r2,r0,0x0007 |r2 = 0x07 0018b644: 14620006 bne r3,r2,0x0018b660 #if action menu = katana inventory 0018b648: 2c62000b sltiu r2,r3,0x000b |r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow 0018b64c: 93a20018 lbu r2,0x0018(r29) |r2 = Attacker used Item ID (Attacker 0x0176) 0018b650: 00000000 nop | 0018b654: 24420026 addiu r2,r2,0x0026 |r2 = Item ID +0x26 (the displacement of katana ID from their associated abilities ID) 0018b658: a7a20012 sh r2,0x0012(r29) |Store r2 as attacker used ability ID (on stack) 0018b65c: 2c62000b sltiu r2,r3,0x000b |r2 = 0x01 if action menu < 0x0b (is not Defend or Equip Change or blank or unknow 0018b660: 10400095 beq r2,r0,0x0018b8b8 #If action menu is not defend / equip change / blank /Else jump to dedicated section 0018b664: 00031080 sll r2,r3,0x02 |r2 = action menu * 4 (word) 0018b668: 3c018017 lui r1,0x8017 | 0018b66c: 00220821 addu r1,r1,r2 |r1 = 8017XXXX (XXXX = action menu * 4) 0018b670: 8c224344 lw r2,0x4344(r1) |Load jump addresses for action menu (AM) /Action_menu_return_address_(pre_formula_set_up) 0018b674: 00000000 nop | 0018b678: 00400008 jr r2 >>jump to location specified by the above table 0018b67c: 00000000 nop | --GEOMANCY SECTION-- 0018b680: 3c048019 lui r4,0x8019 | 0018b684: 8c842d94 lw r4,0x2d94(r4) |r4 = Attacker Data pointer 0018b688: 0c05fcb6 jal 0x0017f2d8 |--> Get_Elemental_Ability_ID Attacker Tile ID to geomancy skill hard-coding (return r2 = Ability ID) 0018b68c: 00000000 nop | 0018b690: a7a20012 sh r2,0x0012(r29) |Store r2 as attacker last used ability (On stack) --DEFAULT, MATH, MONSTER, KATANA -- (And Geomancy) 0018b694: 87a20012 lh r2,0x0012(r29) |r2 = Attacker last used ability 0018b698: 00000000 nop | 0018b69c: 28420171 slti r2,r2,0x0171 |r2 = 0x01 if ability <= Potion / Else 0x00 0018b6a0: 10400086 beq r2,r0,0x0018b8bc #If Ability <= Potion Else branch after action menu sections (formula will be 0x01) 0018b6a4: 34100001 ori r16,r0,0x0001 |r16 = 0x01 (will become formula) 0018b6a8: 3c028019 lui r2,0x8019 | 0018b6ac: 8c422d94 lw r2,0x2d94(r2 |r2 = Attacker Data Pointer 0018b6b0: 00000000 nop | 0018b6b4: 9042005a lbu r2,0x005a(r2) |r2 = Attacker Third set of Current Status 0018b6b8: 00000000 nop | 0018b6bc: 30420002 andi r2,r2,0x0002 |r2 = 0x02 if Attacker is a Frog / Else 0x00 0018b6c0: 1040000d beq r2,r0,0x0018b6f8 #If Attacker is a frog (which Action menu ?) 0018b6c4: 00000000 nop | 0018b6c8: 3c058019 lui r5,0x8019 | 0018b6cc: 24a538c8 addiu r5,r5,0x38c8 |r5 = 801938c8 (Current ability ? Flag - Deals with reaction ? Proc ? - to be checked) 0018b6d0: 94a20000 lhu r2,0x0000(r5) |r2 = halfword at 0x801938c8 (reaction ? Proc ?) 0018b6d4: 00000000 nop | 0018b6d8: 14400007 bne r2,r0,0x0018b6f8 #If r2= 0x00 (no reaction ? Attack nullified ?) 0018b6dc: 24a50036 addiu r5,r5,0x0036 |0x801938c8 + 0x36 = 801938fe = current ability weapon range location 0018b6e0: 3c018019 lui r1,0x8019 | 0018b6e4: a02038d8 sb r0,0x38d8(r1) |Current ability used weapon ID = 0x00 (when frog and x38c8 = 0x00) 0018b6e8: 3c048006 lui r4,0x8006 | 0018b6ec: 24843ab8 addiu r4,r4,0x3ab8 |r4 = 0x80063ab8 = Weapons Secondary Data start 0018b6f0: 0c017895 jal 0x0005e254 |--> Store_X_Byte_into_Y Store data from the null weapon (fists) into 0x801938fe - 0x80193905 (current ability weapon section) 0018b6f4: 34060008 ori r6,r0,0x0008 |r6 = 0x08 (for Jal above) 0018b6f8: 3c058019 lui r5,0x8019 | 0018b6fc: 24a538f0 addiu r5,r5,0x38f0 |r5 = 0x801938f0 - Current ability : ability range adress (prepare jal at 0x8018b720) 0018b700: 87a20012 lh r2,0x0012(r29) |r2 = Attacker last used ability (on stack) 0018b704: 3406000e ori r6,r0,0x000e |r6 = 0x0e (limit for 0x8018b720) 0018b708: 000280c0 sll r16,r2,0x03 |r16 = r2 * 8 (Ability ID * 8) 0018b70c: 02028023 subu r16,r16,r2 |r16 = ID * 7 0018b710: 00108040 sll r16,r16,0x01 |r16 = ID * 14 0018b714: 3c028006 lui r2,0x8006 | 0018b718: 2442fbf0 addiu r2,r2-0x0410 |r2 = 0x8005fbf0 (start of abilities data 2) 0018b71c: 02028021 addu r16,r16,r2 |r16 = last used ability data 2 location for ability ID 0018b720: 0c017895 jal 0x0005e254 |--> Store_X_Byte_into_Y Store ability data 2 into 0x801938f0 - 0x801938fd (update for geomancy, katana and reaction) 0018b724: 02002021 addu r4,r16,r0 |r4 = r16 (ability data 2 location for above jal ) 0018b728: 9202000b lbu r2,0x000b(r16) |r2 = Load Ability Inflict Status ID (from ability table) 0018b72c: 3c018019 lui r1,0x8019 | 0018b730: a02238da sb r2,0x38da(r1) |Store status proc ID in current ability data section 0018b734: 3c028019 lui r2,0x8019 | 0018b738: 904238f3 lbu r2,0x38f3(r2) |r2 = Current ability ability : ability flags 1 0018b73c: 92100008 lbu r16,0x0008(r16) |r16 = Ability Formula (from ability table) 0018b740: 30420024 andi r2,r2,0x0024 |r2 = check result for "weapon strike" and "ranged weapon" flags 0018b744: 1440005e bne r2,r0,0x0018b8c0 # If weapon strike and ranged weapon are not checked Else branch after the action menu sections 0018b748: 320200ff andi r2,r16,0x00ff |r2 = Ability formula (= r16) 0018b74c: 324300ff andi r3,r18,0x00ff |r3 = Action Menu of used skillset 0018b750: 34020007 ori r2,r0,0x0007 |r2 = 0x07 0018b754: 1062005a beq r3,r2,0x0018b8c0 #If action menu <> Katana inventory Else branch after the action menu sections 0018b758: 320200ff andi r2,r16,0x00ff |r2 = Ability formula 0018b75c: 3c018019 lui r1,0x8019 | 0018b760: a02038d8 sb r0,0x38d8(r1) |Store current ability Used Weapon ID as 0x00 (not ranged weapon - not weapon strike - not draw out) 0018b764: 08062e2f j 0x0018b8bc >> Jump after action menu section 0018b768: 00000000 nop | --ITEM--- 0018b76c: 93a70018 lbu r7,0x0018(r29) |r7 = Attacker used Item/Weapon ID 0018b770: 00000000 nop | 0018b774: 2ce200f0 sltiu r2,r7,0x00f0 |r2 = 0x01 if Item used is < at Potion / Else 0x00 0018b778: 14400050 bne r2,r0,0x0018b8bc # If Attacker used item ID >= Potion ID /Else branch after action menu section (with formula = 0x01) 0018b77c: 34100001 ori r16,r0,0x0001 |r16 = 0x01 0018b780: 3c048019 lui r4,0x8019 | 0018b784: 248438d8 addiu r4,r4,0x38d8 |r4 = Current ability Used Weapon ID location (0x801938d8) 0018b788: a0870000 sb r7,0x0000(r4) |Store used item ID in Current ability Used weapon ID 0018b78c: 24e70010 addiu r7,r7,0x0010 |r7 = Used Item ID + 0x10 0018b790: 24840018 addiu r4,r4,0x0018 |r4 = Current ability - Ability range location (0x801938f0) 0018b794: 30e200ff andi r2,r7,0x00ff |r2 = r7 last byte (Used item ID + 0x10 : for potion F0 +0x10 = 0x100 then 0x0100 and 0x00FF = 0x00) 0018b798: 00028040 sll r16,r2,0x01 |r16 = r7*2 0018b79c: 02028021 addu r16,r16,r2 |r16 = r7*3 / 0x00 (for potion) to 0x27 (for phoenix down) 0018b7a0: 3c028006 lui r2,0x8006 | 0018b7a4: 24423f98 addiu r2,r2,0x3f98 |r2 = 0x80063f98 potion Secondary Data Table 0018b7a8: 02028021 addu r16,r16,r2 |r16 = 0x80063f98 + (0x00 to 0x27) = Used item secondary data table adress 0018b7ac: 3c018019 lui r1,0x8019 | 0018b7b0: a02738db sb r7,0x38db(r1) |Store r7 last byte current ability used Item ID (0x00 to 0x0d) 0018b7b4: 92020002 lbu r2,0x0002(r16) |r2 = used Item's inflicted Status 0018b7b8: 3c018019 lui r1,0x8019 | 0018b7bc: a02238da sb r2,0x38da(r1) |Store status proc of used item in current ability status proc 0018b7c0: 0c017991 jal 0x0005e644 |--> Data_Nullifying nullify data from r4 (Current ability range) to r4 + r5 (0x801938fd ability MP Cost) 0018b7c4: 3405000e ori r5,r0,0x000e |r5 = 0x0e (limit) 0018b7c8: 92100000 lbu r16,0x0000(r16) |r16 = used Item formula 0018b7cc: 08062e30 j 0x0018b8c0 >>Jump after action menu sections 0018b7d0: 320200ff andi r2,r16,0x00ff |r2 = used Item formula --THROW-- 0018b7d4: 08062e2f j 0x0018b8bc >> Jump after action menu sections with formula = 0x63 0018b7d8: 34100063 ori r16,r0,0x0063 |r16 = 0x63 --JUMP-- 0018b7dc: 08062e2f j 0x0018b8bc >> Jump after action menu sections with formula = 0x64 0018b7e0: 34100064 ori r16,r0,0x0064 |r16 = 0x64 --CHARGE-- 0018b7e4: 97a30012 lhu r3,0x0012(r29) |r3 = Attacker last used ability ID 0018b7e8: 00000000 nop | 0018b7ec: 2462fe6a addiu r2,r3,-0x0196 |r2 = ability ID - 196 (Note : Charge+1 ID = 0x0196) 0018b7f0: 2c420008 sltiu r2,r2,0x0008 |r2 =0x01 if used attack is a charge+x ability 0018b7f4: 14400003 bne r2,r0,0x0018b804 #If Used ability is not a charge ability 0018b7f8: 00031040 sll r2,r3,0x01 |r2 = r3*2 (charge + x ID*2) 0018b7fc: 34030196 ori r3,r0,0x0196 |r3 = 0x0196 (Charge + 1 ID) 0018b800: 00031040 sll r2,r3,0x01 |r2 = charge+1 ID *2 0018b804: 3c018006 lui r1,0x8006 | 0018b808: 00220821 addu r1,r1,r2 |r1 = 8006XXXX (XXXX = Ability ID * 2) 0018b80c: 90220d19 lbu r2,0x0d19(r1) |r2 = Charge Power boost (using ability ID... maths checked in patcher) 0018b810: 3c018019 lui r1,0x8019 | 0018b814: a02238e4 sb r2,0x38e4(r1) |Store Charge Power boost in current ability charge power(0x801938e4) --ATTACK / CHARGE-- 0018b818: 3c028019 lui r2,0x8019 | 0018b81c: 904238ff lbu r2,0x38ff(r2) |r2 = current ability Weapon Characteristics 0018b820: 92300002 lbu r16,0x0002(r17) |r16 = used weapon formula (r17 = start of used weapon data 2 - see 0018b52c) 0018b824: 30420004 andi r2,r2,0x0004 |r2 = 0x04 if weapon used is available to 2 hands - Else 0x00 0018b828: 10400025 beq r2,r0,0x0018b8c0 #If used weapon is 2 hands compatible # /Else jump after action menu section 0018b82c: 320200ff andi r2,r16,0x00ff |r2 = used weapon formula 0018b830: 3c038019 lui r3,0x8019 | 0018b834: 8c632d94 lw r3,0x2d94(r3) |r3 = Attacker's Data pointer 0018b838: 00000000 nop | 0018b83c: 90620091 lbu r2,0x0091(r3) |r2 = Attacker third set of support 0018b840: 00000000 nop | 0018b844: 30420002 andi r2,r2,0x0002 |r2 = 0x02 if using two hands / else 0x00 0018b848: 1040001c beq r2,r0,0x0018b8bc #If attacker is using two hands # / else jump after action menu section 0018b84c: 340200ff ori r2,r0,0x00ff |r2 = 0xff 0018b850: 9064001d lbu r4,0x001d(r3) |r4 = Attacker Right Hand Weapon ID 0018b854: 00000000 nop | 0018b858: 14820009 bne r4,r2,0x0018b880 #If weapon ID = 0xFF (do not exist ? 2Hands flag ?) 0018b85c: 00000000 nop | 0018b860: 9062001e lbu r2,0x001e(r3) |r2 = right hand shield 0018b864: 00000000 nop | 0018b868: 14440005 bne r2,r4,0x0018b880 #If right hand shield ID = right weapon ID (is 0xFF) #Shield do not exist 0018b86c: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0018b870: 3c018019 lui r1,0x8019 | 0018b874: a02238d9 sb r2,0x38d9(r1) |Store 0x01 at current ability 0x801938d9 flag (Two Hands is active) 0018b878: 3c038019 lui r3,0x8019 | 0018b87c: 8c632d94 lw r3,0x2d94(r3) |r3 = Attacker's Data pointer 0018b880: 00000000 nop | 0018b884: 9064001f lbu r4,0x001f(r3) |r4 = Left Hand Weapon ID 0018b888: 340200ff ori r2,r0,0x00ff |r2 = 0xFF 0018b88c: 1482000c bne r4,r2,0x0018b8c0 #If Left hand weapon ID = 0xFF (do not exist) /Else branch after action menu sections 0018b890: 320200ff andi r2,r16,0x00ff |r2 = used weapon formula 0018b894: 90620020 lbu r2,0x0020(r3) |r2 = Left hand shield 0018b898: 00000000 nop | 0018b89c: 14440008 bne r2,r4,0x0018b8c0 #If Left hand shield ID = 0xFF (Shield do not exist) /Else branch after action menu sections 0018b8a0: 320200ff andi r2,r16,0x00ff |r2 = used weapon formula 0018b8a4: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0018b8a8: 3c018019 lui r1,0x8019 | 0018b8ac: a02238d9 sb r2,0x38d9(r1) |Store 0x01 at current ability 0x801938d9 flag (Two Hands is active) 0018b8b0: 08062e30 j 0x0018b8c0 >> Jump after action menu sections 0018b8b4: 320200ff andi r2,r16,0x00ff |r2 = Weapon formula -- BLANK / DEFEND / EQUIP CHANGE -- 0018b8b8: 34100001 ori r16,r0,0x0001 |r16 = 0x01 formula for equip change is 0x01 0018b8bc: 320200ff andi r2,r16,0x00ff |r2 = r16 (future ability formula) 0018b8c0: 3c018019 lui r1,0x8019 | 0018b8c4: a42038c8 sh r0,0x38c8(r1) |Store 0x00 in current ability 0x38c8 (reaction flag ?) 0018b8c8: 3c018019 lui r1,0x8019 | 0018b8cc: a02038ed sb r0,0x38ed(r1) |Store 0x00 in current ability 0x38ed (fall related ? poach ?) /// Zero post-attack effects (not poach or fall damage?) 0018b8d0: 10400003 beq r2,r0,0x0018b8e0 #If future formula ID is not 0x00 /Else branch to force formula ID to be 0x01 0018b8d4: 2c420065 sltiu r2,r2,0x0065 |r2 = 0x01 if formula ID <= 0x64 / Else 0x00 0018b8d8: 14400002 bne r2,r0,0x0018b8e4 #If formula ID > 0x64 /Else branch avoiding formula beeing set to 0x01 0018b8dc: 00000000 nop | 0018b8e0: 34100001 ori r16,r0,0x0001 #ELSE (formula is 0x00) r16 = 0x01 (if formula = 0x00 or > 0x64) 0018b8e4: 3c058019 lui r5,0x8019 | 0018b8e8: 24a538da addiu r5,r5,0x38da |r5 = 0x801938da (Current Ability proc ID) 0018b8ec: 90a70000 lbu r7,0x0000(r5) |r7 = Ability/Weapon proc ID 0018b8f0: 321100ff andi r17,r16,0x00ff |r17 = Ability formula 0018b8f4: 34020003 ori r2,r0,0x0003 |r2 = 0x03 0018b8f8: 16220002 bne r17,r2,0x0018b904 #If Formula = 0x03 0018b8fc: 24a5002c addiu r5,r5,0x002c |r5 = 0x80193906 (inflicting status type location) 0018b900: 00003821 addu r7,r0,r0 |r7 = 0x00 (Force status ID to 0x00 for formula 0x03) 0018b904: 30e200ff andi r2,r7,0x00ff |r2 = Current Ability proc ID 0018b908: 00022040 sll r4,r2,0x01 |r4 = r2 * 2 0018b90c: 00822021 addu r4,r4,r2 |r4 = r2*3 0018b910: 00042040 sll r4,r4,0x01 |r4 = r2*6 (Proc ID *6) 0018b914: 3c028006 lui r2,0x8006 | 0018b918: 24423fc4 addiu r2,r2,0x3fc4 |r2 = 0x80063fc4 (Start of inflict statuses table) 0018b91c: 00822021 addu r4,r4,r2 |r4 = start of Current Ability Status Proc ID Table 0018b920: 0c017895 jal 0x0005e254 |--> Store_X_Byte_into_Y Store Status data in current ability at 0x80193906 - 0x8019390b 0018b924: 34060006 ori r6,r0,0x0006 |r6 = 0x06 (limit for above) 0018b928: 0c062e7e jal 0x0018b9f8 |--> Remove_Status if status type is cancel - store statuses set from status ID at 0x80193860 to 0x80193864 0018b92c: 00000000 nop | 0018b930: 3c018019 lui r1,0x8019 | 0018b934: a03038e5 sb r16,0x38e5(r1) |Store r16 in current Ability formula 0018b938: 0c063279 jal 0x0018c9e4 |--> %27Reflect%27,_Blade_Grasp,_and_Arrow_Guard - Set target current action hit flag to 0x00 if succeed 0018b93c: 00000000 nop | 0018b940: 3c028019 lui r2,0x8019 | 0018b944: 8c422d90 lw r2,0x2d90(r2) |r2 = Target Current Action Data Pointer 0018b948: 00000000 nop | 0018b94c: 90420000 lbu r2,0x0000(r2) |r2 = Target Current Action Hit Flag 0018b950: 00000000 nop | 0018b954: 14400003 bne r2,r0,0x0018b964 #If Attack missed (from reflect / blade grasp / arrow guard) /Else avoid the jump to end 0018b958: 00111080 sll r2,r17,0x02 |r2 = Ability formula ID * 2 0018b95c: 08062e77 j 0x0018b9dc >> Jump to END! With r2=0x01 0018b960: 34020001 ori r2,r0,0x0001 |r2 = 0x01 0018b964: 3c018019 lui r1,0x8019 | 0018b968: 00220821 addu r1,r1,r2 |r1 = 0x801900xx (xx = Formula ID*2) 0018b96c: 8c22f610 lw r2,-0x09f0(r1) |Load Formula routine adress / from Formula_Table 0018b970: 00000000 nop | 0018b974: 0040f809 jalr r2,r31 |--> Jumps to appropriate formula routine /Formulas 0018b978: 00000000 nop | 0018b97c: 2e220007 sltiu r2,r17,0x0007 |r2 = 0x01 if formula ID <= 0x06 0018b980: 10400004 beq r2,r0,0x0018b994 #If formula ID <= 0x06 0018b984: 34020064 ori r2,r0,0x0064 |r2 = 0x64 0018b988: 0c061f28 jal 0x00187ca0 |--> Formula_01_-_06_Aftermath (Contains poach and secret hunt) 0018b98c: 00000000 nop | 0018b990: 34020064 ori r2,r0,0x0064 |r2 = 0x64 0018b994: 16220003 bne r17,r2,0x0018b9a4 #If Formula ID = 0x64 (jump) 0018b998: 00000000 nop | 0018b99c: 3c018019 lui r1,0x8019 | 0018b9a0: a02038d8 sb r0,0x38d8(r1) |Store 0x00 in Current ability used weapon ID (0x801938d8) 0018b9a4: 0c062e91 jal 0x0018ba44 |-->Set_some_data_for_current_attack 0018b9a8: 00000000 nop | 0018b9ac: 3c038019 lui r3,0x8019 | 0018b9b0: 8c632d90 lw r3,0x2d90(r3) |r3 = Target Current Action Data Pointer 0018b9b4: 00000000 nop | 0018b9b8: 94620010 lhu r2,0x0010(r3) |r2 = Target Current Action Special Action Flags 0018b9bc: 00000000 nop | 0018b9c0: 10400006 beq r2,r0,0x0018b9dc #If There are specials flags 0018b9c4: 00001021 addu r2,r0,r0 |r2 = 0x00 0018b9c8: 90620025 lbu r2,0x0025(r3) |r2 = Target Current Action attack-type 0018b9cc: 00000000 nop | 0018b9d0: 34420001 ori r2,r2,0x0001 |Update r2 with 0x01 0018b9d4: a0620025 sb r2,0x0025(r3) |Store target current action attack-type as Pseudo-Status change 0018b9d8: 00001021 addu r2,r0,r0 |r2 = 0x00 0018b9dc: 8fbf0034 lw r31,0x0034(r29) |End 0018b9e0: 8fb20030 lw r18,0x0030(r29) 0018b9e4: 8fb1002c lw r17,0x002c(r29) 0018b9e8: 8fb00028 lw r16,0x0028(r29) 0018b9ec: 27bd0038 addiu r29,r29,0x0038 0018b9f0: 03e00008 jr r31 0018b9f4: 00000000 nop
Return Locations:
0017d0bc: Main ability loading routine? 0017f284: Calculate Projected Action Effect 0018ada8: Double WP if two hands is equipped?
Short Summary
Need r4 = Attacker data pointer / r5 = defender ID ------------------------------------- Set various section of current ability / current action data - Store defender ID in Current Ability data at 0x801938c1 Store defender data start location in 0x80192d98 Store defender current action data pointer at 0x80192d90 - Store attacker ID in Current Ability data (at 0x801938c0) Store Attacker current action data pointer at 0x80192d8c Store attacker data start location in 0x80192d94 - Exit here if Fall Damage or some reactions checked in Perform_reaction_abilities (at this point, formula is nullified) - Store defender terrain type at 0x801938cd Store Used weapon ID at 0x801938d8 Store used Ability ID at 0x801938d6 - Copy used Ability Data 2 into current ability section (0x801938F0 to 0x801938FD) Copy used Weapon Data 2 into current ability section (0x801938FE to 0x80193805) - Store Status/Proc ID at 0x801938da store attacker faith at 0x801938d3 store defender faith at 0x801938d2 - Nullify attacker and defender most of current action data Action_data_nulling - Store used skillset at 0x801938d4 Nullify 0x801938c6 (reaction ability ID) - Store data in Current action 0x18 (evade with motion - missed Vs guarded) - Update/disable some of the previous according to action menu / frog check - Enable or disable two hands at 0x801938d9 Enable or not charge power at 0x801938e4 Nullify 0x801938c8 Nullify 0x801938ed - Store inflicted status from 0x80193906 to 0x8019390b Note : formula 0x03 is forced to inflicted stauts ID 0x00 If inflicted status is cancel : store statuses sets from 0x80193860 to 0x80193864 - Store formula at 0x801938e5 Jump to formula routine --not revised from here-- Formula_01_-_06_Aftermath If formula = 0x64 : nullify used weapon ID Set_some_data_for_current_attack Update current action type with pseudo status enabled -
Long summary
Need r4 = Attacker data pointer / r5 = defender ID --------------- Copy_Byte_Data_(20_Bytes) Copy attacker data on tempory stack - Store defender ID in Current Ability data at 0x801938c1 Store defender data start location in 0x80192d98 Store defender current action data pointer at 0x80192d90 - Formula set to 0x00 at 0x8019390e Store attacker ID in Current Ability data (at 0x801938c0) Store 0x80192da0 at 0x80192d8c = Attacker current action data pointer Store attacker data start location in 0x80192d94 - Check 0x8018f5f0 (type of action) - if = 0x01 (= reacting ?) --> Jal Perform_reaction_abilities (Action_data_nulling if r2 <>0x00 to be looked further) - If r2 <> 0 : Store_used_weapon(0x801938d8) and exit directly (formula ste to 0x00) - If r2 = 0x00 : Continue (clearly reflect with 0x01 flaged - maybe others) Check 0x801938ed (post action byte ?) - if = 0x80 --> Knockback? - Call Action_data_nulling - Update 0x801938ed removing 0x80 - Store Target current action > Attack type = pseudo status (0x01) +/- Hp damage (0x80) > HP damage - Exit routine directly (formula set to 0x00) Jal Map_Location_Calculation Store defender terrain type at 0x801938cd - Check 0x801938c3 (strike counter ?) xxxxxx If = 0x00 : Right hand weapon stored as used weapon 0x801938d8 If != 0x00 : Left hand weapon stored as used weapon 0x801938d8 Check Attacker last skillset used If draw out :Used item (katana) stored as used weapon 0x801938d8 Check loaded Weapon/Item ID (right or left equipped) If < 0x80 (beginning of shields - End of weapon/throwable) --> store 0x00 as used Weapon ID at 0x801938d8 Store Used weapon ID at 0x801938d8 Store used Ability ID at 0x801938d6 Nullify Two Hands @@@ Check Used Ability If >= Hi-potion (potion included ?) --> Ability ID = 0x00 Copy used Ability Data 2 into current ability section (0x801938F0 to 0x801938FD) Copy used Weapon data 2 into current ability section (0x801938FE to 0x80193805) - Nullify charge power Set Formula to 0x01 Store Status/Proc ID at 0x801938da store attacker faith at 0x801938d3 store defender faith at 0x801938d2 - Action_data_nulling Nullify attacker and defender most of current action data -keep reaction ID at 0x0e - last attack received at 0x26 - 0x27 ? - from 2a to end -set hit% at 100% -set Target action hit flag to 0x01 and attacker's to 0x00 -Set status infliction and removal bytes to 0x00 -set 0x80193860 to 0x80193864 to 0x00 - Store used skillset at 0x801938d4 - Check 0x801938c8 (Reaction ? Proc ?) -If <>0x00 - load reaction ID (0x801938c6) and store it at 0x801938d6 (Used ability ID)- Nullify 0x801938c6 (reaction ability ID) Store 0x01 or 0x02 in TCAD 0x18 after checking first AI byte (target ennemies or allies --> "guarded" or "missed" Update TCADP 0x18 with evade with motion if checked - Check action menu (loaded from used skillset) If = katana inventory : ability ID is updated from used item ID (katana) + 0x26 (offset between katanas ID and ability) - but why ? - Check action menu If < defend (not defend / equip change) load return adress for specifics sections of the routine Else jump in the defend/equip change section : set formula to 0x01 > Geomancy section Get_Elemental_Ability_ID Hardcoding Ability ID from target terrain type continues in next section > Default, Math, Monster, Katana section Check Ability ID - If < Hi Potion : Check If Attacker is a frog - If Frog : check 0x801938c8 (reaction ? proc ?) - If = 0x00 : store 0x00 in used weapon id (0x801938d8) copy null weapon data 2 into current ability section (0x801938FE to 0x80193805) Copy used Ability Data 2 into current ability section (0x801938F0 to 0x801938FD) Check for weapon strike and ranged weapon - if none : check action menu for drawout - If not draw out : nullify used weapon ID at 0x801938d8 Avoid others action menus sections > Item section Check used item ID (on temporary stack) - If it's >= Potion ID : Store Item ID in used weapon ID at 0x801938d8 Store used item ID (0x00 to 0x27) at 0x801938db Store Item inflicted status in statu/proc ID at 0x801938da Avoid others action menu sections > Throw section Set formula to 0x63 Avoid others action menu section > Jump section Set formula to 0x64 Avoid others action menu section > Charge section Check used ability ID - If not a charge ability : charge power = charge +1 - Store charge power at 0x801938e4 > Attack section Check Two hands availability and usability if ok store 0x01 at 0x801938d9 > Blank, Defend, Equip change section Set formula to 0x01 (Back to global routine) Nullify 0x801938c8 Nullify 0x801938ed Check ability ID : if = 0x03 --> Force Status ID to 0x00 Store_X_Byte_into_Y - Store Inflicted Status data in current ability section (0x80193906 to 0x8019390B) Remove_Status - if status type is cancel - store statuses at 0x80193860 to 0x80193864 - Store Formula at 0x801938e5 'Reflect',_Blade_Grasp,_and_Arrow_Guard - Set hit flag to 0x00 if succeed If attack missed : jump to end Jump to formulas routines (via formula table) -- Not clearly investigated from here-- Check formula If <= 0x06 Formula_01_-_06_Aftermath If = 0x64 : nullify used weapon ID at 0x8019 38d8 Set_some_data_for_current_attack Check specials flags (current action data 0x10) - If any : update action type (current action 0x25)with 0x01 (pseudo status)