Set Arcing Trajectory
Jump to navigation
Jump to search
001afb38 - 001afd8c Parameters : r4 = Pointer to Attacker XYZ mods ( 0x801b925c ) r5 = Pointer to [001af3dc val2] see Maths_For_Arcing_Trajectory Note If ends in an obstacle second run with [001af3dc val1] r6 = Pointer to [AT Distance]*4096 =(Attacker to Target distance)*4096 r7 = Pointer to [Attack's XY angle] (at 0x02) Warning : load 0x1f800000 value on Previous r29 0x10 (without register) Returns : r2 = 0x01 if attack reaches target / 0x00 if attack reaches an obstacle (map or unit) Return Angle between 0x1000 and [001af3dc val2] at r7 0x04 (and 0x801b8b70 ) Store : Set some attacks XYZ values (see notes) Target ID is updated (if in the way) see Seek_Obstacle_On_Trajectory Store 3D step at 0x801bbf3c ---------------------------------------------------------------------------- 001afb38: 27bdff70 addiu r29,r29,-0x0090 | 001afb3c: afb40078 sw r20,0x0078(r29) | 001afb40: 0080a021 addu r20,r4,r0 |r20 = Attacker XYZ pointer 001afb44: afb70084 sw r23,0x0084(r29) | 001afb48: 00a0b821 addu r23,r5,r0 |r23 = [001af3dc val2] pointer 001afb4c: afb5007c sw r21,0x007c(r29) | 001afb50: 00c0a821 addu r21,r6,r0 |r21 = [AT Distance]*4096 pointer 001afb54: afb1006c sw r17,0x006c(r29) | 001afb58: 00e08821 addu r17,r7,r0 |r17 = [Attack's angle] pointer 001afb5c: afbf008c sw r31,0x008c(r29) | 001afb60: afbe0088 sw r30,0x0088(r29) | 001afb64: afb60080 sw r22,0x0080(r29) | 001afb68: afb30074 sw r19,0x0074(r29) | 001afb6c: afb20070 sw r18,0x0070(r29) | 001afb70: afb00068 sw r16,0x0068(r29) | 001afb74: 8ee40000 lw r4,0x0000(r23) |r4 = [001af3dc val2] 001afb78: 8fbe00a0 lw r30,0x00a0(r29) |r30 = 0x1f800000 Whaaat ? That's a strange way to load previous routine r29 + 0x10 001afb7c: 0c00763a jal 0x0001d8e8 |-->Get_Angle_Value_via_ArcTan_Table return r2 = (Degre Angle value * 1024)/90 (r4 and r5 = triangle sides) 001afb80: 34051000 ori r5,r0,0x1000 |r5 = 0x1000 001afb84: a6220004 sh r2,0x0004(r17) |Store Angle value at pointer 4 001afb88: 3c01801c lui r1,0x801c |r1 = 0x801c 256 001afb8c: a4228b70 sh r2,-0x7490(r1) |Store angle value at 0x801b8b70 Attack's Angle value 001afb90: 0c06bdcd jal 0x001af734 |-->Give_Gravity_Impact return r2 = 0x7660 001afb94: 00009021 addu r18,r0,r0 |r18 = 0x00 (for next loop) 001afb98: 86240004 lh r4,0x0004(r17) |r4 = Angle value 001afb9c: 0c006f0a jal 0x0001bc28 |-->Sin_call_function Returns r2 = sin(Attack's angle value)*4096 from 90° (if 20° returns sin(70°)) 001afba0: 00028203 sra r16,r2,0x08 |r16 = 0x76 001afba4: 00500018 mult r2,r16 |0x76* sin(Attack's angle value)*4096 001afba8: 00001012 mflo r2 |r2 = 0x76* sin(Attack's angle value)*4096 001afbac: 00029903 sra r19,r2,0x04 |r19 = 0x76* sin(Attack's angle value)*256 001afbb0: 12600009 beq r19,r0,0x001afbd8 #if r19 <> 0x00 001afbb4: 00000000 nop | 001afbb8: 8ea20000 lw r2,0x0000(r21) |r2 = [AT Distance]*4096 001afbbc: 00000000 nop | 001afbc0: 02621021 addu r2,r19,r2 |r2 = [AT Distance]*4096 + 0x76*sin(Attack's angle value)*256 001afbc4: 2442ffff addiu r2,r2,-0x0001 |0 001afbc8: 0053001a div r2,r19 |([AT Distance]*4096 + 0x76*sin(Attack's angle value)*256) / 0x76* sin(Attack's angle value)*256 001afbcc: 0000a812 mflo r21 |r21 = 1 + [AT Distance]/(0x76* sin(Attack's angle value)*256) 001afbd0: 0806befb j 0x001afbec >>jump (avoiding r21 and r5 nullification) 001afbd4: 27a40010 addiu r4,r29,0x0010 |r4 = stack pointer 0x0010 001afbd8: 34040001 ori r4,r0,0x0001 #Else (attack = horizontal ?) r4 = 0x01 001afbdc: 0c01127e jal 0x000449f8 |-->000449f8_-_00044a04 does nothing (…) 001afbe0: 00002821 addu r5,r0,r0 |r5 = 0x00 001afbe4: 0000a821 addu r21,r0,r0 |r21 = 0x00 001afbe8: 27a40010 addiu r4,r29,0x0010 |r4 = stack pointer 0x10 001afbec: 27b00040 addiu r16,r29,0x0040 |r16 = Stack pointer 0x40 001afbf0: a7a00014 sh r0,0x0014(r29) |Store 0x00 at stack pointer 0x14 001afbf4: a7a00010 sh r0,0x0010(r29) |Store 0x00 at stack pointer 0x10 001afbf8: 96220002 lhu r2,0x0002(r17) |r2 = [Attack's XY angle] 001afbfc: 02002821 addu r5,r16,r0 |r5 = Stack pointer 0x40 001afc00: 0c007596 jal 0x0001d658 |-->Set_Rotation_matrix_elements Returns Sine and cosine value on r5 (0x00 to 0x10) 001afc04: a7a20012 sh r2,0x0012(r29) |Store Attacker to target angle at pointer 0x12 001afc08: 86820000 lh r2,0x0000(r20) |r2 = Attacker X mod 001afc0c: 00000000 nop | 001afc10: afa20054 sw r2,0x0054(r29) |Store Attacker X mod at pointer 0x54 001afc14: afa20020 sw r2,0x0020(r29) |Store Attacker X mod at pointer 0x20 001afc18: 86820002 lh r2,0x0002(r20) |r2 = Attacker Z mod 001afc1c: 00008821 addu r17,r0,r0 |r17 = 0x00 (Next loop counter) 001afc20: afa20058 sw r2,0x0058(r29) |Store Attacker Zmod at pointer 0x58 001afc24: afa20024 sw r2,0x0024(r29) |Store Attacker Zmod at pointer 0x24 001afc28: 86820004 lh r2,0x0004(r20) |r2 = Attacker Y mod 001afc2c: 02002021 addu r4,r16,r0 |r4 = Stack pointer 0x40 001afc30: afa2005c sw r2,0x005c(r29) |Store Attacker Ymod at pointer 0x5c 001afc34: 0c00742a jal 0x0001d0a8 |-->Store_Rotation_matrix_elements_to_GTE Store data from r4 (= all the weird angles value from jal 0001d658) 001afc38: afa20028 sw r2,0x0028(r29) |Store Attacker Ymod at pointer 0x28 001afc3c: 0c00744e jal 0x0001d138 |-->Store_Translation_Vectors_to_GTE Store Xmod Zmod ans Y mod 001afc40: 02002021 addu r4,r16,r0 |r4 = Stack pointer 0x40 001afc44: 1aa00025 blez r21,0x001afcdc #If (AT distance + [sin(r4)]² ) / [sin(r4)]² > 0x00 /Else avoid loop 001afc48: a7a0001c sh r0,0x001c(r29) |Store 0x00 at pointer 0x1c will be used as vector0 Z in 0x0001d578 routine 001afc4c: 27b00020 addiu r16,r29,0x0020 |r16 = Pointer 0x20 001afc50: 8fa20020 lw r2,0x0020(r29) @LOOP throught tiles on trajectory r2 = Attacker Xmod (1st pass) / after = Get_vector*matrix_from_GTE returned value 001afc54: 8fa30024 lw r3,0x0024(r29) |r3 = Attacker Zmod / after = Get_vector*matrix_from_GTE returned value 001afc58: 8fa40028 lw r4,0x0028(r29) |r4 = Attacker Ymod / after = Get_vector*matrix_from_GTE returned value 001afc5c: 8fa5002c lw r5,0x002c(r29) |r5 = ? = value from 0x1af770 routine pointer 0x10 when investigated. host by r17 stored during jal (…) 001afc60: afa20030 sw r2,0x0030(r29) |Store Attack Xmod at pointer 0x30 001afc64: afa30034 sw r3,0x0034(r29) |Store Attack Zmod at pointer 0x34 001afc68: afa40038 sw r4,0x0038(r29) |Store Attack Ymod at pointer 0x38 001afc6c: afa5003c sw r5,0x003c(r29) |Store ??? at pointer 0x3c = 0x1af770 routine pointer 0x10 001afc70: 02539021 addu r18,r18,r19 |r18 =r19 = 0x76* sin(Attack's angle value)*256 001afc74: 8ee40000 lw r4,0x0000(r23) |r4 = [001af3dc val2] 001afc78: 0c06bd67 jal 0x001af59c |-->001af59c_-_001af6d4 Another Maths routine - returns r2 = [001af59c Val] 001afc7c: 02402821 addu r5,r18,r0 |r5 = 0x76* sin(Attack's angle value)*256 001afc80: 27a40018 addiu r4,r29,0x0018 |r4 = Stack Pointer 0x18 001afc84: 02002821 addu r5,r16,r0 |r5 = Stack pointer 0x20 001afc88: 27a6002c addiu r6,r29,0x002c |r6 = Stack pointer 0x2c 001afc8c: 00121b03 sra r3,r18,0x0c |r3 = 0x76* sin(Attack's angle value)/16 001afc90: 00021023 subu r2,r0,r2 |r2 = -[001af59c Val] 001afc94: 00021303 sra r2,r2,0x0c |r2 = -[001af59c Val]/4096 001afc98: a7a30018 sh r3,0x0018(r29) |Store 0x76* sin(Attack's angle value)/16 at pointer 0x18 (used as vector0 X) 001afc9c: 0c00755e jal 0x0001d578 |-->Get_vector*matrix_from_GTE returns vectors at r5 (0x00 0x04 0x08) and [001af3dc val2] number of leading zero at r6 0x00 001afca0: a7a2001a sh r2,0x001a(r29) |r2 = -[001af59c Val]/4096 at r29 0x1a (used as vector0 Y) 001afca4: 03c02021 addu r4,r30,r0 |r4 = 0x1f800000 pointer to targeting data see routine List_targeting_data_of_all_valid_units 001afca8: 3c06801c lui r6,0x801c |r6 = 0x801c0000 001afcac: 24c68b64 addiu r6,r6,-0x749c |r6 = 0x801b8b64 Target ID pointer 001afcb0: 3c07801c lui r7,0x801c |r7 = 0x801c0000 001afcb4: 24e78b68 addiu r7,r7,-0x7498 |r7 = 0x801b8b68 Attack's current X pointer 001afcb8: 0c06be2d jal 0x001af8b4 |-->Seek obstacle on trajectory return r2 = 0x01 if obstacle is found (map or unit), 0x00 if not 001afcbc: 02002821 addu r5,r16,r0 |r5 = Stack pointer 0x40 (host vector*matrix) 001afcc0: 0040b021 addu r22,r2,r0 |r22 = 0x01 if obstacle is found / Else 0x00 001afcc4: 16c00005 bne r22,r0,0x001afcdc #if obstacle not found /Else exit loop (trajectory ends in something) 001afcc8: 00000000 nop | 001afccc: 26310001 addiu r17,r17,0x0001 |Loop counter + 1 001afcd0: 0235102a slt r2,r17,r21 |r2 = 0x01 if counter < r21 001afcd4: 1440ffde bne r2,r0,0x001afc50 Λ Loop while counter < AT distance + [sin(r4)]² ) / [sin(r4)]² 001afcd8: 00000000 nop | 001afcdc: 8fa20020 lw r2,0x0020(r29) |r2 = Attack landing X mod updated by Get_vector*matrix_from_GTE 001afce0: 8fa40030 lw r4,0x0030(r29) |r4 = non-updated Attack X mod (not updated by loop) 001afce4: 8fa30024 lw r3,0x0024(r29) |r3 = Attack landing Z mod 001afce8: 8fa50034 lw r5,0x0034(r29) |r5 = non-updated Attack Z mod (not updated by loop) 001afcec: 97a60028 lhu r6,0x0028(r29) |r6 = lesser halfword of Attack landing Y mod why halfword ? 001afcf0: 00441023 subu r2,r2,r4 |r2 = Attack's X Mod Difference (Current X Mod - Previous X Mod) 001afcf4: 3c01801c lui r1,0x801c |r1 = 0x801c0000 001afcf8: ac228b7c sw r2,-0x7484(r1) |Store Attack's X Mod Difference at 0x801b8b7c 001afcfc: 8fa20028 lw r2,0x0028(r29) |r2 = Attack landing Y mod 001afd00: 00651823 subu r3,r3,r5 |r3 = Attack's Z Mod Difference (Current Z Mod - Previous Z Mod) 001afd04: 3c01801c lui r1,0x801c |r1 = 0x801c0000 001afd08: ac238b80 sw r3,-0x7480(r1) |Store Attack's Z Mod Difference at 0x801b8b80 001afd0c: 8fa30038 lw r3,0x0038(r29) |r3 = non-updated Attack Y mod (not updated by loop) 001afd10: 97a40020 lhu r4,0x0020(r29) |r4 = lesser halfword of attack X mod 001afd14: 97a50024 lhu r5,0x0024(r29) |r5 = lesser halfword of attack Z mod 001afd18: 3c01801c lui r1,0x801c |r1 = 0x801c0000 001afd1c: a4268b90 sh r6,-0x7470(r1) |Store Attacks current Y mod at 0x801b8b90 001afd20: 00431023 subu r2,r2,r3 |r2 = Attack's Y Mod difference 001afd24: 3c01801c lui r1,0x801c |r1 = 0x801c0000 001afd28: ac228b84 sw r2,-0x747c(r1) |Store Attack's Y Mod Difference at 0x801b8b84 001afd2c: 3c01801c lui r1,0x801c |r1 = 0x801c0000 001afd30: a4248b8c sh r4,-0x7474(r1) |Store Attacks current Xmod at 0x801b8b8c 001afd34: 3c01801c lui r1,0x801c |r1 = 0x801c0000 001afd38: a4258b8e sh r5,-0x7472(r1) |Store Attacks current Z mod at 0x801b8b8e 001afd3c: 16c00005 bne r22,r0,0x001afd54 #If Attack does not end in a obstacle (r22 = 0x00) # / Else branch to end with r2 = 0x00 001afd40: 00001021 addu r2,r0,r0 |r2 = 0x00 001afd44: 3c01801c lui r1,0x801c |r1 = 0x801c0000 001afd48: ac35bf3c sw r21,-0x40c4(r1) |Store (AT distance + [sin(r4)]² ) / [sin(r4)]² as 3D Step Counter (at 0x801bbf3c) 001afd4c: 0806bf57 j 0x001afd5c >>jump to end with r2 = 0x01 001afd50: 34020001 ori r2,r0,0x0001 |r2 = 0x01 001afd54: 3c01801c lui r1,0x801c |r1 = 0x801c 001afd58: ac31bf3c sw r17,-0x40c4(r1) |Store Loop counter as 3D Step Counter to obstalce (at 0x801bbf3c) 001afd5c: 8fbf008c lw r31,0x008c(r29) |END 001afd60: 8fbe0088 lw r30,0x0088(r29) | 001afd64: 8fb70084 lw r23,0x0084(r29) | 001afd68: 8fb60080 lw r22,0x0080(r29) | 001afd6c: 8fb5007c lw r21,0x007c(r29) | 001afd70: 8fb40078 lw r20,0x0078(r29) | 001afd74: 8fb30074 lw r19,0x0074(r29) | 001afd78: 8fb20070 lw r18,0x0070(r29) | 001afd7c: 8fb1006c lw r17,0x006c(r29) | 001afd80: 8fb00068 lw r16,0x0068(r29) | 001afd84: 27bd0090 addiu r29,r29,0x0090 | 001afd88: 03e00008 jr r31 | 001afd8c: 00000000 nop |
Flag for research
Set : - 0x801b8b7c Attack's X Mod Difference ( 801b8b7c ) - 0x801b8b80 Attack's Z Mod Difference ( 801b8b80 ) - 0x801b8b84 Attack's Y Mod Difference ( 801b8b84 ) - 0x801b8b8c Attacks current X mod ( 801b8b8c ) - 0x801b8b8c Attacks current Z mod ( 801b8b8e ) - 0x801b8b90 Attack's Current Y Mod ( 801b8b90 ) - 0x801bbf3c 3D step (801bbf3c) - 0x801b8b70 Attacks angle value ? ( 801b8b70 )
Return location
Battle.bin 001afecc: 001afd90_-_001aff14 001afef0: 001afd90_-_001aff14 001b0150: Set_and_Validate_Arc_Trajectory 001b0208: Set_and_Validate_Arc_Trajectory