Difference between revisions of "Main ability loading routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 0017ce44: 27bdffb0 addiu r29,r29,0xffb0 0017ce48: afb40040 sw r20,0x0040(r29) 0017ce4c: 0080a021 addu r20,r4,r0 r20 = unit ID of the attacker ...")
 
Tag: Redirect target changed
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<font face='Courier New'>
+
#REDIRECT [[Main Ability Loading Routine]]
 
 
 
 
0017ce44: 27bdffb0 addiu r29,r29,0xffb0
 
0017ce48: afb40040 sw r20,0x0040(r29)
 
0017ce4c: 0080a021 addu r20,r4,r0 r20 = unit ID of the attacker
 
0017ce50: afb10034 sw r17,0x0034(r29)
 
0017ce54: 00a08821 addu r17,r5,r0 r17 = misc unit data
 
0017ce58: 340300ff ori r3,r0,0x00ff
 
0017ce5c: afb20038 sw r18,0x0038(r29)
 
0017ce60: 34120014 ori r18,r0,0x0014
 
0017ce64: 27a20024 addiu r2,r29,0x0024
 
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 8018f4f8
 
0017ce80: 3c018019 lui r1,0x8019
 
0017ce84: ac20f4f4 sw r0,-0x0b0c(r1)
 
0017ce88: 3c018019 lui r1,0x8019
 
0017ce8c: a020390f sb r0,0x390f(r1) clear ability X
 
0017ce90: a0430000 sb r3,0x0000(r2) store 0xff onto stack
 
0017ce94: 2652ffff addiu r18,r18,0xffff decrease r18 (starts at 0x14)
 
0017ce98: 0641fffd bgez r18,0x0017ce90 branch if greater or equal to zero
 
0017ce9c: 2442ffff addiu r2,r2,0xffff decrease r2
 
0017cea0: 2a820015 slti r2,r20,0x0015 set if attacker ID < 20
 
0017cea4: 14400003 bne r2,r0,0x0017ceb4 branch if so
 
0017cea8: 34120015 ori r18,r0,0x0015
 
0017ceac: 0805f4ca j 0x0017d328 jump to end
 
0017ceb0: 2402ffff addiu r2,r0,0xffff
 
0017ceb4: 001410c0 sll r2,r20,0x03
 
0017ceb8: 00541023 subu r2,r2,r20
 
0017cebc: 00021180 sll r2,r2,0x06
 
0017cec0: 3c038019 lui r3,0x8019
 
0017cec4: 246308cc addiu r3,r3,0x08cc r19 = attacker unit data
 
0017cec8: 00439821 addu r19,r2,r3
 
0017cecc: 0c062f5d jal 0x0018bd74 Nullify attacker's current action data
 
0017ced0: 2664018c addiu r4,r19,0x018c
 
0017ced4: 3c108019 lui r16,0x8019
 
0017ced8: 26102da0 addiu r16,r16,0x2da0
 
0017cedc: 02002021 addu r4,r16,r0
 
0017cee0: 34020008 ori r2,r0,0x0008
 
0017cee4: a260018c sb r0,0x018c(r19) clear hit flag byte
 
0017cee8: 0c062f5d jal 0x0018bd74 Current action data nulling
 
0017ceec: a262018e sb r2,0x018e(r19) store evade type = 8
 
0017cef0: a2000000 sb r0,0x0000(r16) clear temp action data
 
0017cef4: a2200022 sb r0,0x0022(r17) clear misc. data
 
0017cef8: a2200016 sb r0,0x0016(r17)
 
0017cefc: a2200013 sb r0,0x0013(r17)
 
0017cf00: 3c028019 lui r2,0x8019
 
0017cf04: 8c42f5f0 lw r2,-0x0a10(r2) load reaction check
 
0017cf08: 00008021 addu r16,r0,r0
 
0017cf0c: 10400015 beq r2,r0,0x0017cf64 branch if not reacting
 
0017cf10: a6200020 sh r0,0x0020(r17)
 
 
If Reacting
 
0017cf14: 02802021 addu r4,r20,r0 r4 = attacker ID
 
0017cf18: 02202821 addu r5,r17,r0 r5 = misc. data
 
0017cf1c: 27a60028 addiu r6,r29,0x0028
 
0017cf20: 3c028019 lui r2,0x8019
 
0017cf24: 94422d9c lhu r2,0x2d9c(r2) load reaction ID
 
0017cf28: 27a70010 addiu r7,r29,0x0010
 
0017cf2c: 0c05f2b3 jal 0x0017cacc Reaction Target/Hit Calculation
 
0017cf30: a6220020 sh r2,0x0020(r17) returns r2=01 if no hit
 
flags = 04, !08
 
0017cf34: 10400010 beq r2,r0,0x0017cf78 branch if hit
 
0017cf38: 340201b8 ori r2,r0,0x01b8
 
0017cf3c: 3c038019 lui r3,0x8019
 
0017cf40: 84632d9c lh r3,0x2d9c(r3) load reaction ID
 
0017cf44: 00000000 nop
 
0017cf48: 14620003 bne r3,r2,0x0017cf58 branch if not 0x1b8 - Reflect
 
0017cf4c: 34020001 ori r2,r0,0x0001 return r2=01
 
0017cf50: 0805f3d7 j 0x0017cf5c
 
0017cf54: a3a2002c sb r2,0x002c(r29) store 1 on the stack
 
0017cf58: a3a0002c sb r0,0x002c(r29) store 0 on the stack
 
0017cf5c: 0805f3de j 0x0017cf78
 
0017cf60: 34100001 ori r16,r0,0x0001
 
 
If not Reacting
 
0017cf64: 9262016f lbu r2,0x016f(r19) load skillset of last attack?
 
0017cf68: 00000000 nop
 
0017cf6c: 14520002 bne r2,r18,0x0017cf78 branch if skillset isn't 0x15 - math skill
 
0017cf70: 34020001 ori r2,r0,0x0001
 
0017cf74: a2220013 sb r2,0x0013(r17)
 
 
If reaction target/hit calculation is affirmative
 
0017cf78: 16000041 bne r16,r0,0x0017d080 branch if reaction = reflect
 
0017cf7c: 27a40010 addiu r4,r29,0x0010
 
0017cf80: 2664016e addiu r4,r19,0x016e r4 = attackers target data offset
 
0017cf84: 0c05f349 jal 0x0017cd24 map calculation for attack, weapon range, etc.
 
0017cf88: 27a5002c addiu r5,r29,0x002c
 
0017cf8c: 2403ffff addiu r3,r0,0xffff
 
0017cf90: 14430004 bne r2,r3,0x0017cfa4 branch attack is valid
 
0017cf94: 2402ffff addiu r2,r0,0xffff
 
0017cf98: a2200001 sb r0,0x0001(r17) clear hit counter
 
0017cf9c: 0805f4ca j 0x0017d328
 
0017cfa0: a2200018 sb r0,0x0018(r17) clear ??
 
 
0017cfa4: 3c108019 lui r16,0x8019
 
0017cfa8: 261038ef addiu r16,r16,0x38ef 801938ef
 
0017cfac: 92020000 lbu r2,0x0000(r16) load post action target ID
 
0017cfb0: 00000000 nop
 
0017cfb4: 2c420015 sltiu r2,r2,0x0015 set if less than 20
 
0017cfb8: 1040002d beq r2,r0,0x0017d070 branch if invalid target
 
0017cfbc: 27a40010 addiu r4,r29,0x0010
 
0017cfc0: 3c028019 lui r2,0x8019
 
0017cfc4: 944238c8 lhu r2,0x38c8(r2) load post-action
 
0017cfc8: 00000000 nop
 
0017cfcc: 14400007 bne r2,r0,0x0017cfec branch if not 0 (reacting?)
 
0017cfd0: 00000000 nop
 
0017cfd4: 3c028019 lui r2,0x8019
 
0017cfd8: 904238ed lbu r2,0x38ed(r2) load can poach flags
 
0017cfdc: 00000000 nop
 
0017cfe0: 30420080 andi r2,r2,0x0080
 
0017cfe4: 10400022 beq r2,r0,0x0017d070 branch if not taking fall damage
 
0017cfe8: 00000000 nop
 
if 801938ed
 
0017cfec: 0c05ed28 jal 0x0017b4a0 disable green panels?
 
0017cff0: 00000000 nop
 
0017cff4: 340600ff ori r6,r0,0x00ff
 
0017cff8: 27a40011 addiu r4,r29,0x0011
 
0017cffc: 27a50020 addiu r5,r29,0x0020
 
0017d000: 92030000 lbu r3,0x0000(r16) load post action target ID
 
0017d004: 34020001 ori r2,r0,0x0001
 
0017d008: afa20028 sw r2,0x0028(r29)
 
0017d00c: a3a30010 sb r3,0x0010(r29)
 
0017d010: a0860000 sb r6,0x0000(r4)
 
0017d014: 24840001 addiu r4,r4,0x0001
 
0017d018: 0085102a slt r2,r4,r5
 
0017d01c: 1440fffc bne r2,r0,0x0017d010
 
0017d020: 00000000 nop
 
0017d024: 3c028019 lui r2,0x8019
 
0017d028: 904238ef lbu r2,0x38ef(r2) load post action target ID
 
0017d02c: 00000000 nop
 
0017d030: 000220c0 sll r4,r2,0x03
 
0017d034: 00822023 subu r4,r4,r2
 
0017d038: 00042180 sll r4,r4,0x06
 
0017d03c: 3c028019 lui r2,0x8019
 
0017d040: 244208cc addiu r2,r2,0x08cc get target for post action's data
 
0017d044: 0c060428 jal 0x001810a0 map location calculation
 
0017d048: 00822021 addu r4,r4,r2
 
0017d04c: 000210c0 sll r2,r2,0x03
 
0017d050: 3c038019 lui r3,0x8019
 
0017d054: 2463f8cc addiu r3,r3,0xf8cc tile data
 
0017d058: 00431021 addu r2,r2,r3
 
0017d05c: 90430005 lbu r3,0x0005(r2)
 
0017d060: 00000000 nop
 
0017d064: 34630080 ori r3,r3,0x0080 set target's panel = targeted
 
0017d068: a0430005 sb r3,0x0005(r2)
 
0017d06c: 27a40010 addiu r4,r29,0x0010
 
 
0017d070: 0c05f614 jal 0x0017d850 more targeting checks
 
0017d074: 02602821 addu r5,r19,r0
 
0017d078: afa20028 sw r2,0x0028(r29)
 
0017d07c: 27a40010 addiu r4,r29,0x0010
 
0017d080: 341500ff ori r21,r0,0x00ff
 
0017d084: 27b00010 addiu r16,r29,0x0010
 
0017d088: 93a20028 lbu r2,0x0028(r29)
 
0017d08c: 3c018019 lui r1,0x8019
 
0017d090: a02238ec sb r2,0x38ec(r1) store able to knockback/hit counter
 
0017d094: 0c063b7e jal 0x0018edf8 target ID's of units hit by ability
 
0017d098: 27b20025 addiu r18,r29,0x0025
 
0017d09c: 0c062c9d jal 0x0018b274 Store used weapon ID based on action menu byte
 
0017d0a0: 2664016e addiu r4,r19,0x016e
 
0017d0a4: 92050000 lbu r5,0x0000(r16) load from stack
 
0017d0a8: 00000000 nop
 
0017d0ac: 10b50005 beq r5,r21,0x0017d0c4 branch if r5 = 0xff?
 
0017d0b0: 26100001 addiu r16,r16,0x0001
 
0017d0b4: 3c018019 lui r1,0x8019
 
0017d0b8: a02038e9 sb r0,0x38e9(r1) clear default to attack?
 
0017d0bc: 0c062cd3 jal 0x0018b34c Jump to pre-formula setup
 
0017d0c0: 2664016e addiu r4,r19,0x016e
 
0017d0c4: 0212102a slt r2,r16,r18 r16 and r18 = stack addresses
 
0017d0c8: 1440fff6 bne r2,r0,0x0017d0a4 perform for all targets?
 
0017d0cc: 00000000 nop
 
0017d0d0: 0c062b1d jal 0x0018ac74 remove transparent status if Jump is used?
 
0017d0d4: 02602021 addu r4,r19,r0
 
0017d0d8: 0c063b89 jal 0x0018ee24 Count targets hit, return r2 = hit counter
 
0017d0dc: 26240002 addiu r4,r17,0x0002
 
0017d0e0: afa20028 sw r2,0x0028(r29) store hit counter
 
0017d0e4: 93a20028 lbu r2,0x0028(r29) load hit counter
 
0017d0e8: 00000000 nop
 
0017d0ec: a2220001 sb r2,0x0001(r17) store hit counter in 0x18c of misc. data
 
0017d0f0: 93a20028 lbu r2,0x0028(r29) load hit counter
 
0017d0f4: 3c038019 lui r3,0x8019
 
0017d0f8: 8c63f5f0 lw r3,-0x0a10(r3) load reaction byte
 
0017d0fc: 3c018019 lui r1,0x8019
 
0017d100: a02238ec sb r2,0x38ec(r1) store hit counter
 
0017d104: 14600004 bne r3,r0,0x0017d118 branch if ability is a reaction?
 
0017d108: 02602021 addu r4,r19,r0
 
0017d10c: 34020001 ori r2,r0,0x0001
 
0017d110: 3c018019 lui r1,0x8019
 
0017d114: a02238e8 sb r2,0x38e8(r1) store can gain exp
 
0017d118: a2200023 sb r0,0x0023(r17)
 
0017d11c: 93a60028 lbu r6,0x0028(r29) load hit counter
 
0017d120: 0c05f504 jal 0x0017d410 some draw out routine
 
0017d124: 02202821 addu r5,r17,r0 r5 = misc. data
 
0017d128: a2340000 sb r20,0x0000(r17) store attacking unit ID?
 
0017d12c: 3c028019 lui r2,0x8019
 
0017d130: 904238d8 lbu r2,0x38d8(r2) load used weapon ID
 
0017d134: 02602021 addu r4,r19,r0
 
0017d138: a2200017 sb r0,0x0017(r17) clear reaction occurred byte?
 
0017d13c: a222001f sb r2,0x001f(r17) store used weapon ID
 
0017d140: 3c028019 lui r2,0x8019
 
0017d144: 904238c3 lbu r2,0x38c3(r2) load hit number
 
0017d148: 02202821 addu r5,r17,r0 r5 = misc unit data
 
0017d14c: 0c05f4d4 jal 0x0017d350 set target location for ability
 
0017d150: a2220019 sb r2,0x0019(r17) store hit number
 
0017d154: 8fa20028 lw r2,0x0028(r29) load hit counter
 
0017d158: 00000000 nop
 
0017d15c: 1440001c bne r2,r0,0x0017d1d0 branch if units are hit
 
0017d160: 00000000 nop
 
 
If units are not hit
 
0017d164: 3c028019 lui r2,0x8019
 
0017d168: 904238c3 lbu r2,0x38c3(r2) load hit number
 
0017d16c: 00000000 nop
 
0017d170: 24420001 addiu r2,r2,0x0001 increment current hit counter
 
0017d174: 3c018019 lui r1,0x8019
 
0017d178: a02238c3 sb r2,0x38c3(r1) store new hit number
 
0017d17c: 96630170 lhu r3,0x0170(r19) load last attack used
 
0017d180: 93a2002c lbu r2,0x002c(r29) load ability flags 5
 
0017d184: a620001a sh r0,0x001a(r17) clear ?? reaction ID?
 
0017d188: 30420001 andi r2,r2,0x0001
 
0017d18c: 14400003 bne r2,r0,0x0017d19c branch if animate on miss = true
 
0017d190: a6230014 sh r3,0x0014(r17) store last attack used
 
0017d194: 34020001 ori r2,r0,0x0001
 
0017d198: a2220012 sb r2,0x0012(r17) store animate on miss flag
 
0017d19c: 3c028019 lui r2,0x8019
 
0017d1a0: 904238c3 lbu r2,0x38c3(r2) load current hit counter
 
0017d1a4: 3c038019 lui r3,0x8019
 
0017d1a8: 906338c2 lbu r3,0x38c2(r3) load number of hits
 
0017d1ac: 00000000 nop
 
0017d1b0: 0043102b sltu r2,r2,r3 set if number of hits not reached total yet
 
0017d1b4: 10400003 beq r2,r0,0x0017d1c4 branch if not
 
0017d1b8: 34020001 ori r2,r0,0x0001
 
0017d1bc: 0805f472 j 0x0017d1c8
 
0017d1c0: a2220018 sb r2,0x0018(r17) store 01 into ??
 
0017d1c4: a2200018 sb r0,0x0018(r17) clear ??
 
0017d1c8: 0805f4ca j 0x0017d328 jump to end
 
0017d1cc: 34020001 ori r2,r0,0x0001 return r2 = 0x01
 
 
if units are hit:
 
0017d1d0: 3c028019 lui r2,0x8019
 
0017d1d4: 9042390e lbu r2,0x390e(r2) load ability formula?
 
0017d1d8: a2200012 sb r0,0x0012(r17) clear ??
 
0017d1dc: a2220016 sb r2,0x0016(r17) store ability formula?
 
0017d1e0: 3c038019 lui r3,0x8019
 
0017d1e4: 946338c6 lhu r3,0x38c6(r3) load reaction ID ?
 
0017d1e8: 00000000 nop
 
0017d1ec: 10600009 beq r3,r0,0x0017d214 branch if no reaction?
 
0017d1f0: 00000000 nop
 
0017d1f4: 3c028019 lui r2,0x8019
 
0017d1f8: 944238c8 lhu r2,0x38c8(r2) load post action thing?
 
0017d1fc: 00000000 nop
 
0017d200: 14400004 bne r2,r0,0x0017d214
 
0017d204: 34020001 ori r2,r0,0x0001
 
0017d208: a6230014 sh r3,0x0014(r17) store last attack used = reaction ID
 
0017d20c: 0805f48f j 0x0017d23c
 
0017d210: a2220017 sb r2,0x0017(r17) store reaction occurred
 
0017d214: 3c028019 lui r2,0x8019
 
0017d218: 904238e9 lbu r2,0x38e9(r2) load default to attack flag?
 
0017d21c: 00000000 nop
 
0017d220: 10400003 beq r2,r0,0x0017d230 branch if not defaulting to attack
 
0017d224: 00000000 nop
 
0017d228: 0805f48f j 0x0017d23c
 
0017d22c: a6200014 sh r0,0x0014(r17) Store last attack used = attack
 
0017d230: 96620170 lhu r2,0x0170(r19) load last attack used half from unit data
 
0017d234: 00000000 nop
 
0017d238: a6220014 sh r2,0x0014(r17) store last attack used half from unit data
 
0017d23c: 3c028019 lui r2,0x8019
 
0017d240: 944238c6 lhu r2,0x38c6(r2) load reaction ID
 
0017d244: 00000000 nop
 
0017d248: a622001a sh r2,0x001a(r17) store reaction ID in misc. data
 
0017d24c: 3c028019 lui r2,0x8019
 
0017d250: 904238ed lbu r2,0x38ed(r2) load can poach? post action?
 
0017d254: 00000000 nop
 
0017d258: 1040000e beq r2,r0,0x0017d294 branch if cannot
 
0017d25c: 3042007f andi r2,r2,0x007f remove poach byte?
 
0017d260: a2220022 sb r2,0x0022(r17) store cannot poach?
 
0017d264: 3c028019 lui r2,0x8019
 
0017d268: 904238ca lbu r2,0x38ca(r2) load target new X coordinate
 
0017d26c: 00000000 nop
 
0017d270: a222001c sb r2,0x001c(r17) store target X coordinate
 
0017d274: 3c028019 lui r2,0x8019
 
0017d278: 904238cb lbu r2,0x38cb(r2) Y coordinate
 
0017d27c: 00000000 nop
 
0017d280: a222001d sb r2,0x001d(r17) store new
 
0017d284: 3c028019 lui r2,0x8019
 
0017d288: 904238cc lbu r2,0x38cc(r2) Elevation
 
0017d28c: 00000000 nop
 
0017d290: a222001e sb r2,0x001e(r17) store new
 
 
0017d294: 3c028019 lui r2,0x8019
 
0017d298: 944238c8 lhu r2,0x38c8(r2) some reaction/poach flag
 
0017d29c: 00000000 nop
 
0017d2a0: 1440001d bne r2,r0,0x0017d318 branch if != 0
 
0017d2a4: 34020001 ori r2,r0,0x0001 store 01 in 0x18 of current action data in misc. data
 
0017d2a8: 3c028019 lui r2,0x8019
 
0017d2ac: 904238ed lbu r2,0x38ed(r2) load can poach?
 
0017d2b0: 00000000 nop
 
0017d2b4: 30420080 andi r2,r2,0x0080
 
0017d2b8: 14400017 bne r2,r0,0x0017d318 branch if ??
 
0017d2bc: 34020001 ori r2,r0,0x0001 store 01 in 0x18 of current action data in misc. data
 
0017d2c0: 3c028019 lui r2,0x8019
 
0017d2c4: 904238ed lbu r2,0x38ed(r2) load aftermath byte?
 
0017d2c8: 00000000 nop
 
0017d2cc: 10400005 beq r2,r0,0x0017d2e4 branch if 0
 
0017d2d0: 34020001 ori r2,r0,0x0001
 
0017d2d4: a2220017 sb r2,0x0017(r17) store post action occurrence
 
0017d2d8: a2220012 sb r2,0x0012(r17) store animate on miss not true/no units hit
 
0017d2dc: 34020200 ori r2,r0,0x0200
 
0017d2e0: a6220014 sh r2,0x0014(r17) store 0x200 flag on last ability used ID
 
0017d2e4: 3c028019 lui r2,0x8019
 
0017d2e8: 904238c3 lbu r2,0x38c3(r2) load current hit counter
 
0017d2ec: 3c038019 lui r3,0x8019
 
0017d2f0: 906338c2 lbu r3,0x38c2(r3) load number of hits
 
0017d2f4: 24420001 addiu r2,r2,0x0001 current hit counter++
 
0017d2f8: 3c018019 lui r1,0x8019
 
0017d2fc: a02238c3 sb r2,0x38c3(r1) store current hit counter
 
0017d300: 3c028019 lui r2,0x8019
 
0017d304: 904238c3 lbu r2,0x38c3(r2) load load it again
 
0017d308: 00000000 nop
 
0017d30c: 0043102b sltu r2,r2,r3 set if current hit coutner < # hits
 
0017d310: 10400003 beq r2,r0,0x0017d320 branch if not
 
0017d314: 34020001 ori r2,r0,0x0001
 
0017d318: 0805f4c9 j 0x0017d324
 
0017d31c: a2220018 sb r2,0x0018(r17) store continue attack?
 
0017d320: a2200018 sb r0,0x0018(r17) store end attack
 
0017d324: 00001021 addu r2,r0,r0 return 0
 
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 nop</font>
 

Latest revision as of 03:15, 19 October 2024