Bow Arrow Secondary Effect
Jump to navigation
Jump to search
001b0ffc: 3c02801c lui r2,0x801c 001b1000: 8c42c098 lw r2,-0x3f68(r2) #loads current effect target data 001b1004: 27bdff80 addiu r29,r29,0xff80 001b1008: afbf007c sw r31,0x007c(r29) 001b100c: afb60078 sw r22,0x0078(r29) 001b1010: afb50074 sw r21,0x0074(r29) 001b1014: afb40070 sw r20,0x0070(r29) 001b1018: afb3006c sw r19,0x006c(r29) 001b101c: afb20068 sw r18,0x0068(r29) 001b1020: afb10064 sw r17,0x0064(r29) 001b1024: afb00060 sw r16,0x0060(r29) 001b1028: 8c540008 lw r20,0x0008(r2) #load some effect initialising/engaging/ending? 001b102c: 34110002 ori r17,r0,0x0002 001b1030: 12910087 beq r20,r17,0x001b1250 #branch if it's 2. 001b1034: 2e820003 sltiu r2,r20,0x0003 001b1038: 10400005 beq r2,r0,0x001b1050 #branch if it's more than 2 001b103c: 34020001 ori r2,r0,0x0001 001b1040: 12820008 beq r20,r2,0x001b1064 #branch if it's 1 001b1044: 02c01021 addu r2,r22,r0 001b1048: 0806c544 j 0x001b1510 #otherwise fail. 001b104c: 00000000 nop 001b1050: 34020003 ori r2,r0,0x0003 001b1054: 1282012c beq r20,r2,0x001b1508 #branch if it's 3 001b1058: 02c01021 addu r2,r22,r0 001b105c: 0806c544 j 0x001b1510 #otherwise fail 001b1060: 00000000 nop
if initialising (0x8* = 1) 001b1064: 3c05801c lui r5,0x801c 001b1068: 84a59264 lh r5,-0x6d9c(r5) #target's X mod 001b106c: 3c02801c lui r2,0x801c 001b1070: 8442925c lh r2,-0x6da4(r2) #acting unit's x mod 001b1074: 00000000 nop 001b1078: 00a22823 subu r5,r5,r2 #find difference 001b107c: 00a50018 mult r5,r5 #square 001b1080: 3c03801c lui r3,0x801c 001b1084: 84639268 lh r3,-0x6d98(r3) 001b1088: 3c02801c lui r2,0x801c 001b108c: 84429260 lh r2,-0x6da0(r2) #target's y mod and acting unit's y mod 001b1090: 00002012 mflo r4 001b1094: 00621823 subu r3,r3,r2 001b1098: 00000000 nop 001b109c: 00630018 mult r3,r3 #find difference and square 001b10a0: 3c06801c lui r6,0x801c 001b10a4: 84c69266 lh r6,-0x6d9a(r6) 001b10a8: 3c02801c lui r2,0x801c 001b10ac: 8442925e lh r2,-0x6da2(r2) #target/caster height 001b10b0: afa50020 sw r5,0x0020(r29) #store X and y differences (not squared) 001b10b4: afa30028 sw r3,0x0028(r29) 001b10b8: 00461023 subu r2,r2,r6 #difference (don't square.) 001b10bc: afa20024 sw r2,0x0024(r29) # 001b10c0: 00001012 mflo r2 001b10c4: 00822021 addu r4,r4,r2 # 001b10c8: 0c00709a jal 0x0001c268 #Get Square root of r4 dealing with 4096 001b10cc: 00042300 sll r4,r4,0x0c #sqrt(x^2 + y^2) but * 0x4096 for the precision. 001b10d0: 8fa50020 lw r5,0x0020(r29) 001b10d4: 8fa40028 lw r4,0x0028(r29) 001b10d8: 3c01801c lui r1,0x801c 001b10dc: ac22c08c sw r2,-0x3f74(r1) #store length of straight line between x and y 001b10e0: 0c00763a jal 0x0001d8e8 #Get Angle Value via ArcTan Table 001b10e4: 00042023 subu r4,r0,r4 #x and negative y 001b10e8: 3c03801c lui r3,0x801c 001b10ec: 8c63c098 lw r3,-0x3f68(r3) #effect target data 001b10f0: 3c01801c lui r1,0x801c 001b10f4: a4228b28 sh r2,-0x74d8(r1) #store angle of arrow projectile in the xy direction 001b10f8: 90640012 lbu r4,0x0012(r3) #load unit's misc ID? (not referenced in daughter routine.) 001b10fc: 0c022fc7 jal 0x0008bf1c #0008bf1c - 0008bf58 - returns some, cardinal direction related number 001b1100: 34160001 ori r22,r0,0x0001 #r22 = 1 001b1104: 24420001 addiu r2,r2,0x0001 001b1108: 30420003 andi r2,r2,0x0003 001b110c: 00021280 sll r2,r2,0x0a #returns one of the 4 cardinal directions based on? idk lol 001b1110: 3c03801c lui r3,0x801c 001b1114: 94638b28 lhu r3,-0x74d8(r3) #loads projectile's XY angle trajectory 001b1118: 3c04801c lui r4,0x801c 001b111c: 8c848b74 lw r4,-0x748c(r4) #direction of projectile travel relative to horizon, in terms of some relative length above/below the projectile 001b1120: 00621823 subu r3,r3,r2 001b1124: 3c01801c lui r1,0x801c 001b1128: a4238b2c sh r3,-0x74d4(r1) #cardinal direction - xy angle trajectory 001b112c: 3c01801c lui r1,0x801c 001b1130: ac24926c sw r4,-0x6d94(r1) 001b1134: 0c00763a jal 0x0001d8e8 #Get Angle Value via ArcTan Table - gets angle of projectile upward 001b1138: 34051000 ori r5,r0,0x1000 #r5 is baseline for angle? like, z velocity is 0 at 0x1000, and + if more than or - if less than, and arctan nonsense 001b113c: 3c01801c lui r1,0x801c 001b1140: a4228b30 sh r2,-0x74d0(r1) #store projectile's z angle trajectory 001b1144: 3c01801c lui r1,0x801c 001b1148: ac208b24 sw r0,-0x74dc(r1) 001b114c: 0c06bdcd jal 0x001af734 #Give Gravity Impact - returns impact of gravity on projectile 001b1150: 00000000 nop 001b1154: 3c04801c lui r4,0x801c 001b1158: 84848b30 lh r4,-0x74d0(r4) #load projectile's z angle trajectory 001b115c: 0c006f0a jal 0x0001bc28 #Cos call function - you have an angle, stick it into cos and you break it up into Adjacent/hypotenuse 001b1160: 00028203 sra r16,r2,0x08 #divide by big number and put in r16 001b1164: 00500018 mult r2,r16 #* z angle's horizontal component * gravity impact 001b1168: 3c02801c lui r2,0x801c 001b116c: 9442bf3c lhu r2,-0x40c4(r2) #load 3D step counter 001b1170: 3c03801c lui r3,0x801c 001b1174: 94638b28 lhu r3,-0x74d8(r3) #load arrows XY angle trajectory 001b1178: 3c05801c lui r5,0x801c 001b117c: 24a5acec addiu r5,r5,0xacec #argument 2 is 0x801bacec, location of rotation matrix for projectile 001b1180: a7a0001c sh r0,0x001c(r29) 001b1184: a7a00018 sh r0,0x0018(r29) #stores no additional angles. 001b1188: 3c01801c lui r1,0x801c 001b118c: a4228b3c sh r2,-0x74c4(r1) #store 3D steps counter in 801b8b3c 001b1190: a7a3001a sh r3,0x001a(r29) #store XY angle trajectory in stack 001b1194: 00001012 mflo r2 001b1198: 00021103 sra r2,r2,0x04 # 001b119c: 3c01801c lui r1,0x801c 001b11a0: ac229254 sw r2,-0x6dac(r1) #store change in vertical velocity due to gravity (proportional to z?) 001b11a4: 0c007596 jal 0x0001d658 #Set Rotation matrix elements 001b11a8: 27a40018 addiu r4,r29,0x0018 001b11ac: 3c02801c lui r2,0x801c 001b11b0: 8c42c098 lw r2,-0x3f68(r2) #effect target data pointer 001b11b4: 00000000 nop 001b11b8: 8c440050 lw r4,0x0050(r2) #pointer to effect data in RAM 001b11bc: 00000000 nop 001b11c0: 10800003 beq r4,r0,0x001b11d0 #branch if none 001b11c4: ac510008 sw r17,0x0008(r2) #stores "initialised" in effect target data 001b11c8: 0c011180 jal 0x00044600 #LBA 001b11cc: 00000000 nop 001b11d0: 0c011105 jal 0x00044414 #LBA 001b11d4: 34040c88 ori r4,r0,0x0c88 #r4 is that 001b11d8: 341400e0 ori r20,r0,0x00e0 #0xe0 001b11dc: 0040a821 addu r21,r2,r0 #r21 = effect data address 001b11e0: 02a09821 addu r19,r21,r0 # 001b11e4: 3c02801c lui r2,0x801c 001b11e8: 8c42c098 lw r2,-0x3f68(r2) #effect target data pointer 001b11ec: 00009021 addu r18,r0,r0 001b11f0: ac550050 sw r21,0x0050(r2) #stores effect data address 001b11f4: 00008021 addu r16,r0,r0 001b11f8: 02608821 addu r17,r19,r0 #this could be done better tbh. 001b11fc: 0c008f38 jal 0x00023ce0 #P14 SetPolyG3 001b1200: 02202021 addu r4,r17,r0 #parses effect data address 001b1204: 26100001 addiu r16,r16,0x0001 #counter ++ 001b1208: 2a020004 slti r2,r16,0x0004 #repeat 4 times 001b120c: 1440fffb bne r2,r0,0x001b11fc 001b1210: 2631001c addiu r17,r17,0x001c #increment effect data address by 0x1c 001b1214: 00008021 addu r16,r0,r0 #clear counter again 001b1218: 02b48821 addu r17,r21,r20 #effect data pointer + 0xe0 001b121c: 0c008f4c jal 0x00023d30 #P18 SetPolyG4 001b1220: 02202021 addu r4,r17,r0 001b1224: 26100001 addiu r16,r16,0x0001 001b1228: 2a02000d slti r2,r16,0x000d #repeat 13 times 001b122c: 1440fffb bne r2,r0,0x001b121c 001b1230: 26310024 addiu r17,r17,0x0024 #effect data + 0x24 001b1234: 269401d4 addiu r20,r20,0x01d4 #0x2b4 001b1238: 26520070 addiu r18,r18,0x0070 #that's a weird way of counting but okay. 001b123c: 2a4200e0 slti r2,r18,0x00e0 #perform twice 001b1240: 1440ffec bne r2,r0,0x001b11f4 001b1244: 26730070 addiu r19,r19,0x0070 #effect data + 0x70 (stores all above again but offset by 0x70 (1st jal) and 0x324 (2nd jal) 001b1248: 0806c544 j 0x001b1510 001b124c: 02c01021 addu r2,r22,r0 #r2 = 1 (success?)
if engaged? (0x8* = 2) 001b1250: 3c04801c lui r4,0x801c 001b1254: 8c84926c lw r4,-0x6d94(r4) #ratio of horizontal/vertical velocity 001b1258: 3c05801c lui r5,0x801c 001b125c: 8ca58b24 lw r5,-0x74dc(r5) #Z velocity 001b1260: 0c06bd67 jal 0x001af59c #some vector trajectory math 001af59c - 001af6d4 001b1264: 00000000 nop 001b1268: 3c05801c lui r5,0x801c 001b126c: 8ca58b24 lw r5,-0x74dc(r5) #Z velocity 001b1270: 3c03801c lui r3,0x801c 001b1274: 8c639254 lw r3,-0x6dac(r3) #load change in z motion due to gravity 001b1278: 3c04801c lui r4,0x801c 001b127c: 8c84926c lw r4,-0x6d94(r4) #ratio of horizontal/vertical velocity 001b1280: 00a32821 addu r5,r5,r3 #obtain new z velocity after gravity 001b1284: 3c01801c lui r1,0x801c 001b1288: ac258b24 sw r5,-0x74dc(r1) #stores new z vel. 001b128c: 0c06bd67 jal 0x001af59c #more trajectory math with new r5 001b1290: 00028023 subu r16,r0,r2 #stores result #1 001b1294: 00028823 subu r17,r0,r2 #stores result #2 (Current Z velocity for step) 001b1298: 3c03801c lui r3,0x801c 001b129c: 8c638b24 lw r3,-0x74dc(r3) #new Z velocity 001b12a0: 3c05801c lui r5,0x801c 001b12a4: 8ca59254 lw r5,-0x6dac(r5) #change in z motion due to gravity 001b12a8: 3c04801c lui r4,0x801c 001b12ac: 8c84926c lw r4,-0x6d94(r4) #ratio of horizontal/vertical velocity 001b12b0: 0c06bd67 jal 0x001af59c #uses z vel. 2 steps in advance? 001b12b4: 00652821 addu r5,r3,r5 #new z velocity + change in z due to gravity 001b12b8: 00021023 subu r2,r0,r2 #obtain negative of newest trajectory 001b12bc: 00502023 subu r4,r2,r16 #-1 * (result #2 + result #1) 001b12c0: 3c05801c lui r5,0x801c 001b12c4: 8ca59254 lw r5,-0x6dac(r5) #change in z motion due to gravity 001b12c8: 3c02801c lui r2,0x801c 001b12cc: 94428b28 lhu r2,-0x74d8(r2) #projectile's xy angle 001b12d0: a7a00040 sh r0,0x0040(r29) #? 001b12d4: 00052840 sll r5,r5,0x01 #change in z motion due to gravity * 2 001b12d8: 0c00763a jal 0x0001d8e8 #Get Angle Value via ArcTan Table - r5 = change in z vel. (grav), r4 = 001b12dc: a7a20042 sh r2,0x0042(r29) #store xy angle 001b12e0: 3c10801c lui r16,0x801c 001b12e4: 2610acec addiu r16,r16,0xacec #location of projectile's rotation matrix 001b12e8: 02002021 addu r4,r16,r0 001b12ec: 24420400 addiu r2,r2,0x0400 #r2 = angle of difference in trajectory at next step 001b12f0: 0c00742a jal 0x0001d0a8 #Store Rotation matrix elements to GTE 001b12f4: a7a20044 sh r2,0x0044(r29) #parse 001b12f8: 0c00744e jal 0x0001d138 #Store Translation Vectors to GTE 001b12fc: 02002021 addu r4,r16,r0 #matrix address 001b1300: 27a40018 addiu r4,r29,0x0018 #stack + 0x18 (0x18 - vector xy, 0x1c - vector z) 001b1304: 27b20020 addiu r18,r29,0x0020 #+ 0x20 001b1308: 02402821 addu r5,r18,r0 #to store x, z, and y vector 001b130c: 27b3002c addiu r19,r29,0x002c #stack + 0x2c 001b1310: 02603021 addu r6,r19,r0 #to store negative vector flag 001b1314: 3c02801c lui r2,0x801c 001b1318: 8c428b24 lw r2,-0x74dc(r2) #old horizontal velocity ratio via vertical velocity? 001b131c: 00118b03 sra r17,r17,0x0c #new trajectory >> 0xc 001b1320: a7b1001a sh r17,0x001a(r29) #store trajectory as vector z 001b1324: a7a0001c sh r0,0x001c(r29) #- 001b1328: 00021303 sra r2,r2,0x0c 001b132c: 0c00755e jal 0x0001d578 #Get vector*matrix from GTE rotates and translates projectile using projectile's velocity 001b1330: a7a20018 sh r2,0x0018(r29) #vector xy is horizontal velocity ratio 001b1334: 3c11801c lui r17,0x801c 001b1338: 2631925c addiu r17,r17,0x925c #acting unit's XYZ mods 001b133c: 3c10800a lui r16,0x800a 001b1340: 26108a24 addiu r16,r16,0x8a24 #new matrix address? 001b1344: 02002021 addu r4,r16,r0 001b1348: 86220000 lh r2,0x0000(r17) #load acting units X mod 001b134c: 8fa30020 lw r3,0x0020(r29) #load projectile's x vector 001b1350: 8fa50024 lw r5,0x0024(r29) #projectile's Z vector 001b1354: 8fa60028 lw r6,0x0028(r29) #Y vector 001b1358: 00431021 addu r2,r2,r3 #add X mod of acting unit and X vector of projectile 001b135c: afa20030 sw r2,0x0030(r29) #store translated X vector 001b1360: 3c02801c lui r2,0x801c 001b1364: 8442925e lh r2,-0x6da2(r2) #load acting unit's z mod 001b1368: 3c03801c lui r3,0x801c 001b136c: 84639260 lh r3,-0x6da0(r3) #load acting unit's y mod 001b1370: 00451021 addu r2,r2,r5 001b1374: 00661821 addu r3,r3,r6 #translate projectile's vectors by acting unit's height and y mods 001b1378: afa20034 sw r2,0x0034(r29) 001b137c: 0c00742a jal 0x0001d0a8 #Store Rotation matrix elements to GTE 001b1380: afa30038 sw r3,0x0038(r29) #store them both 001b1384: 0c00744e jal 0x0001d138 #Store Translation Vectors to GTE - loads a new set of matrix elements to GTE, I think this might be the camera matrix? 001b1388: 02002021 addu r4,r16,r0 001b138c: 27a40018 addiu r4,r29,0x0018 # 001b1390: 02402821 addu r5,r18,r0 001b1394: 02603021 addu r6,r19,r0 #to store matrix results 001b1398: 96220000 lhu r2,0x0000(r17) #load acting unit's X mod 001b139c: 97a30020 lhu r3,0x0020(r29) #load projectile's x vector 001b13a0: 97a70024 lhu r7,0x0024(r29) #load projectile's z vector 001b13a4: 97a80028 lhu r8,0x0028(r29) #load projectile's y vector 001b13a8: 00431021 addu r2,r2,r3 001b13ac: a7a20018 sh r2,0x0018(r29) #translate and store 001b13b0: 3c02801c lui r2,0x801c 001b13b4: 9442925e lhu r2,-0x6da2(r2) 001b13b8: 3c03801c lui r3,0x801c 001b13bc: 94639260 lhu r3,-0x6da0(r3) #load acting unit's z and y mods 001b13c0: 00471021 addu r2,r2,r7 001b13c4: 00681821 addu r3,r3,r8 001b13c8: a7a2001a sh r2,0x001a(r29) 001b13cc: 0c00755e jal 0x0001d578 #Get vector*matrix from GTE rotates and translates projectile by... camera? 001b13d0: a7a3001c sh r3,0x001c(r29) #translate and store projectile's vectors 001b13d4: 27a40058 addiu r4,r29,0x0058 #stack + 0x58 001b13d8: 34020040 ori r2,r0,0x0040 001b13dc: 3c03801c lui r3,0x801c 001b13e0: 8c63c098 lw r3,-0x3f68(r3) #effect target data pointer 001b13e4: 27a50030 addiu r5,r29,0x0030 001b13e8: afa20050 sw r2,0x0050(r29) #store 0x40 to stack thrice 001b13ec: afa2004c sw r2,0x004c(r29) 001b13f0: afa20048 sw r2,0x0048(r29) 001b13f4: 94620004 lhu r2,0x0004(r3) #load secondary animation of attack for target 001b13f8: 27a60040 addiu r6,r29,0x0040 #r6 = stack + 0x40 001b13fc: 00021080 sll r2,r2,0x02 001b1400: 3c01801c lui r1,0x801c 001b1404: 00220821 addu r1,r1,r2 001b1408: 842284de lh r2,-0x7b22(r1) #load Model ID 001b140c: 27a70048 addiu r7,r29,0x0048 #r7 = stack + 0x48 001b1410: a7a0005c sh r0,0x005c(r29) 001b1414: a7a0005a sh r0,0x005a(r29) 001b1418: a7a00058 sh r0,0x0058(r29) #all angles are set to 0 here 001b141c: 0c06b8d0 jal 0x001ae340 #Arrow, Throw stone, Reflect Model Loading 001b1420: afa20010 sw r2,0x0010(r29) #Parse Model ID 001b1424: 3c02801c lui r2,0x801c 001b1428: 84428b3c lh r2,-0x74c4(r2) #load 3d steps counter 001b142c: 00000000 nop 001b1430: 14540011 bne r2,r20,0x001b1478 #branch if not 1 step left 001b1434: 2402ffff addiu r2,r0,0xffff 001b1438: 3c03801c lui r3,0x801c 001b143c: 8c638b64 lw r3,-0x749c(r3) #target's ID 001b1440: 00000000 nop 001b1444: 1062000c beq r3,r2,0x001b1478 #branch if invalid 001b1448: 00000000 nop 001b144c: 3c03801c lui r3,0x801c 001b1450: 8c63c098 lw r3,-0x3f68(r3) #load effect target data pointer 001b1454: 00000000 nop 001b1458: 8c620028 lw r2,0x0028(r3) #load hit counter of attack 001b145c: 00000000 nop 001b1460: 10400005 beq r2,r0,0x001b1478 #branch if 0 001b1464: 00000000 nop 001b1468: 90640012 lbu r4,0x0012(r3) #loads target's misc ID 001b146c: 9065001c lbu r5,0x001c(r3) #loads attacker's misc ID 001b1470: 0c01a331 jal 0x00068cc4 #Call Bow Hardcoding routine Copy 001b1474: 00000000 nop 001b1478: 3c02801c lui r2,0x801c 001b147c: 94428b3c lhu r2,-0x74c4(r2) #load 3d steps counter 001b1480: 00000000 nop 001b1484: 2442ffff addiu r2,r2,0xffff #subtract 1 001b1488: 3c01801c lui r1,0x801c 001b148c: a4228b3c sh r2,-0x74c4(r1) #store incremented 3d steps counter 001b1490: 00021400 sll r2,r2,0x10 001b1494: 10400005 beq r2,r0,0x001b14ac #branch if no steps left 001b1498: 00000000 nop 001b149c: 8fa20034 lw r2,0x0034(r29) #load arrow's z vector 001b14a0: 00000000 nop 001b14a4: 04400019 bltz r2,0x001b150c #branch if negative (arrow moving upward when attack finishes? I suppose that would cause issues) 001b14a8: 34160001 ori r22,r0,0x0001 001b14ac: 3c03801c lui r3,0x801c 001b14b0: 8c63c098 lw r3,-0x3f68(r3) #load effect target data pointer 001b14b4: 00000000 nop 001b14b8: 9064001d lbu r4,0x001d(r3) #load 001b14bc: 34020003 ori r2,r0,0x0003 001b14c0: 1082000a beq r4,r2,0x001b14ec #branch if 3 001b14c4: ac620008 sw r2,0x0008(r3) #store initialization stage as "complete" 001b14c8: 2482fffc addiu r2,r4,0xfffc #0x1d* - 0x4 001b14cc: 2c420002 sltiu r2,r2,0x0002 # 001b14d0: 14400007 bne r2,r0,0x001b14f0 #branch if 0x1d = 0x4, 0x5 (bug/oversight? should be 2-3 not 4-5?) 001b14d4: 3c028000 lui r2,0x8000 001b14d8: 3c03801c lui r3,0x801c 001b14dc: 8c638b64 lw r3,-0x749c(r3) #load target's ID 001b14e0: 2402ffff addiu r2,r0,0xffff # 001b14e4: 14620009 bne r3,r2,0x001b150c #branch if ID is valid 001b14e8: 34160001 ori r22,r0,0x0001 001b14ec: 3c028000 lui r2,0x8000 001b14f0: 3c01801c lui r1,0x801c 001b14f4: ac228b98 sw r2,-0x7468(r1) # 001b14f8: 0c06b8b2 jal 0x001ae2c8 #sets secondary animation to 0x15 if invalid ID/0x1d value 001b14fc: 00000000 nop 001b1500: 0806c543 j 0x001b150c 001b1504: 34160001 ori r22,r0,0x0001 #continue and perform 0x15 secondary anim on the next frame.
Kill projectile (0x8* = 0x3) 001b1508: 0000b021 addu r22,r0,r0 #animation is finished
End 001b150c: 02c01021 addu r2,r22,r0 #return 1 if still animating and no error. otherwise 0 001b1510: 8fbf007c lw r31,0x007c(r29) 001b1514: 8fb60078 lw r22,0x0078(r29) 001b1518: 8fb50074 lw r21,0x0074(r29) 001b151c: 8fb40070 lw r20,0x0070(r29) 001b1520: 8fb3006c lw r19,0x006c(r29) 001b1524: 8fb20068 lw r18,0x0068(r29) 001b1528: 8fb10064 lw r17,0x0064(r29) 001b152c: 8fb00060 lw r16,0x0060(r29) 001b1530: 27bd0080 addiu r29,r29,0x0080 001b1534: 03e00008 jr r31 001b1538: 00000000 nop