Difference between revisions of "04 Magic Gun"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
Line 2: Line 2:
 
  00188c24: 27bdffe8 addiu r29,r29,0xffe8
 
  00188c24: 27bdffe8 addiu r29,r29,0xffe8
 
  00188c28: afbf0010 sw r31,0x0010(r29)
 
  00188c28: afbf0010 sw r31,0x0010(r29)
  00188c2c: 0c061dcc jal 0x 00187730 [[Magic Gun Ability Decision]]
+
  00188c2c: 0c061dcc jal 0x 00187730             ;  [[Magic Gun Ability Decision]]
 
  00188c30: 00000000 nop
 
  00188c30: 00000000 nop
 
  00188c34: 3c028019 lui r2,0x8019
 
  00188c34: 3c028019 lui r2,0x8019
  00188c38: 90423902 lbu r2,0x3902(r2) Load WP
+
  00188c38: 90423902 lbu r2,0x3902(r2)           ;  Load WP
 
  00188c3c: 3c038019 lui r3,0x8019
 
  00188c3c: 3c038019 lui r3,0x8019
  00188c40: 906338fa lbu r3,0x38fa(r3) Load Ability Power
+
  00188c40: 906338fa lbu r3,0x38fa(r3)           ;  Load Ability Power
 
  00188c44: 3c018019 lui r1,0x8019
 
  00188c44: 3c018019 lui r1,0x8019
  00188c48: a42238ce sh r2,0x38ce(r1) XA = WP
+
  00188c48: a42238ce sh r2,0x38ce(r1)           ;  XA = WP
 
  00188c4c: 3c018019 lui r1,0x8019
 
  00188c4c: 3c018019 lui r1,0x8019
  00188c50: a42338d0 sh r3,0x38d0(r1) YA = Ability Power
+
  00188c50: a42338d0 sh r3,0x38d0(r1)           ;  YA = Ability Power
  00188c54: 0c0617e0 jal 0x 00185f80 [[Charge Calculation]]
+
  00188c54: 0c0617e0 jal 0x 00185f80             ;  [[Charge Calculation]]
 
  00188c58: 00000000 nop
 
  00188c58: 00000000 nop
  00188c5c: 0c0617e9 jal 0x 00185fa4 [[Weapon Element Strengthen]]
+
  00188c5c: 0c0617e9 jal 0x 00185fa4             ;  [[Weapon Element Strengthen]]
 
  00188c60: 00000000 nop
 
  00188c60: 00000000 nop
  00188c64: 0c0621d1 jal 0x 00188744 [[Magical Support/Status/Compat]]
+
  00188c64: 0c0621d1 jal 0x 00188744             ;  [[Magical Support/Status/Compat]]
 
  00188c68: 00000000 nop
 
  00188c68: 00000000 nop
  00188c6c: 0c0621df jal 0x 0018877c [[Elemental XA * YA]]
+
  00188c6c: 0c0621df jal 0x 0018877c             ;  [[Elemental XA * YA]]
 
  00188c70: 00000000 nop
 
  00188c70: 00000000 nop
  00188c74: 14400005 bne r2,r0,0x 00188c8c Branch if element was nullified
+
  00188c74: 14400005 bne r2,r0,0x 00188c8c       ;  Branch if element was nullified
 
  00188c78: 00000000 nop
 
  00188c78: 00000000 nop
  00188c7c: 0c061c54 jal 0x 00187150 [[Faith Calculation]]
+
  00188c7c: 0c061c54 jal 0x 00187150             ;  [[Faith Calculation]]
 
  00188c80: 00000000 nop
 
  00188c80: 00000000 nop
  00188c84: 0c061c3f jal 0x 001870fc [[Elemental Absorption]]
+
  00188c84: 0c061c3f jal 0x 001870fc             ;  [[Elemental Absorption]]
 
  00188c88: 00000000 nop
 
  00188c88: 00000000 nop
 
  00188c8c: 8fbf0010 lw r31,0x0010(r29)
 
  00188c8c: 8fbf0010 lw r31,0x0010(r29)
Line 35: Line 35:
 
  00187734: afb00010 sw r16,0x0010(r29)
 
  00187734: afb00010 sw r16,0x0010(r29)
 
  00187738: 3c108019 lui r16,0x8019
 
  00187738: 3c108019 lui r16,0x8019
  0018773c: 92103904 lbu r16,0x3904(r16) Load Weapon's Element
+
  0018773c: 92103904 lbu r16,0x3904(r16)         ;  Load Weapon's Element
 
  00187740: afbf0014 sw r31,0x0014(r29)
 
  00187740: afbf0014 sw r31,0x0014(r29)
  00187744: 0c063ba8 jal 0x 0018eea0 Random Process
+
  00187744: 0c063ba8 jal 0x 0018eea0             ;  Random Process
 
  00187748: 00000000 nop
 
  00187748: 00000000 nop
  0018774c: 00021840 sll r3,r2,0x01 Random * 2
+
  0018774c: 00021840 sll r3,r2,0x01             ;  Random * 2
  00187750: 00621821 addu r3,r3,r2 Random * 3
+
  00187750: 00621821 addu r3,r3,r2               ;  Random * 3
  00187754: 000318c0 sll r3,r3,0x03 Random * 24
+
  00187754: 000318c0 sll r3,r3,0x03             ;  Random * 24
  00187758: 00621821 addu r3,r3,r2 Random * 25
+
  00187758: 00621821 addu r3,r3,r2               ;  Random * 25
  0018775c: 00031880 sll r3,r3,0x02 Random * 100 (or mult r2, r3 with r3 = 64)
+
  0018775c: 00031880 sll r3,r3,0x02             ;  Random * 100 (or mult r2, r3 with r3 = 64)
  00187760: 04610002 bgez r3,0x 0018776c Branch if Random is Positive
+
  00187760: 04610002 bgez r3,0x 0018776c         ;  Branch if Random is Positive
 
  00187764: 32020080 andi r2,r16,0x0080
 
  00187764: 32020080 andi r2,r16,0x0080
  00187768: 24637fff addiu r3,r3,0x7fff Random + 7fff
+
  00187768: 24637fff addiu r3,r3,0x7fff         ;  Random + 7fff
  0018776c: 1040000b beq r2,r0,0x 0018779c Branch if Weapon doesn't have Fire
+
  0018776c: 1040000b beq r2,r0,0x 0018779c       ;  Branch if Weapon doesn't have Fire
  00187770: 00031bc2 srl r3,r3,0x0f Random / 8000 (rand 0..99)
+
  00187770: 00031bc2 srl r3,r3,0x0f             ;  Random / 8000 (rand 0..99)
 
  00187774: 306400ff andi r4,r3,0x00ff
 
  00187774: 306400ff andi r4,r3,0x00ff
 
  00187778: 2c82000a sltiu r2,r4,0x000a
 
  00187778: 2c82000a sltiu r2,r4,0x000a
  0018777c: 10400003 beq r2,r0,0x 0018778c Branch if Random > a (90% chance to branch)
+
  0018777c: 10400003 beq r2,r0,0x 0018778c       ;  Branch if Random > a (90% chance to branch)
 
  00187780: 2c820028 sltiu r2,r4,0x0028
 
  00187780: 2c820028 sltiu r2,r4,0x0028
 
  00187784: 08061dfb j 0x 001877ec
 
  00187784: 08061dfb j 0x 001877ec
  00187788: 34030012 ori r3,r0,0x0012 r3 = 12 (Firaga, 10% chance)
+
  00187788: 34030012 ori r3,r0,0x0012           ;  r3 = 12 (Firaga, 10% chance)
  0018778c: 10400017 beq r2,r0,0x 001877ec Branch if Random > 28 (60% chance to branch)
+
  0018778c: 10400017 beq r2,r0,0x 001877ec       ;  Branch if Random > 28 (60% chance to branch)
  00187790: 34030010 ori r3,r0,0x0010 r3 = 10 (Fire, 60% chance)
+
  00187790: 34030010 ori r3,r0,0x0010           ;  r3 = 10 (Fire, 60% chance)
 
  00187794: 08061dfb j 0x 001877ec
 
  00187794: 08061dfb j 0x 001877ec
  00187798: 34030011 ori r3,r0,0x0011 r3 = 11 (Fira, 30% chance)
+
  00187798: 34030011 ori r3,r0,0x0011           ;  r3 = 11 (Fira, 30% chance)
 
  0018779c: 32020040 andi r2,r16,0x0040
 
  0018779c: 32020040 andi r2,r16,0x0040
  001877a0: 1040000a beq r2,r0,0x 001877cc Branch if Weapon doesn't have Lightning
+
  001877a0: 1040000a beq r2,r0,0x 001877cc       ;  Branch if Weapon doesn't have Lightning
 
  001877a4: 306400ff andi r4,r3,0x00ff
 
  001877a4: 306400ff andi r4,r3,0x00ff
 
  001877a8: 2c82000a sltiu r2,r4,0x000a
 
  001877a8: 2c82000a sltiu r2,r4,0x000a
  001877ac: 10400003 beq r2,r0,0x 001877bc Branch if Ranfom > a
+
  001877ac: 10400003 beq r2,r0,0x 001877bc       ;  Branch if Ranfom > a
 
  001877b0: 2c820028 sltiu r2,r4,0x0028
 
  001877b0: 2c820028 sltiu r2,r4,0x0028
 
  001877b4: 08061dfb j 0x 001877ec
 
  001877b4: 08061dfb j 0x 001877ec
  001877b8: 34030016 ori r3,r0,0x0016 r3 = 16 (Thundaga)
+
  001877b8: 34030016 ori r3,r0,0x0016           ;  r3 = 16 (Thundaga)
  001877bc: 1040000b beq r2,r0,0x 001877ec Branch if Random > 28
+
  001877bc: 1040000b beq r2,r0,0x 001877ec       ;  Branch if Random > 28
  001877c0: 34030014 ori r3,r0,0x0014 r3 = 14 (Thunder)
+
  001877c0: 34030014 ori r3,r0,0x0014           ;  r3 = 14 (Thunder)
 
  001877c4: 08061dfb j 0x 001877ec
 
  001877c4: 08061dfb j 0x 001877ec
  001877c8: 34030015 ori r3,r0,0x0015 r3 = 15 (Thundara)
+
  001877c8: 34030015 ori r3,r0,0x0015           ;  r3 = 15 (Thundara)
 
  001877cc: 2c82000a sltiu r2,r4,0x000a
 
  001877cc: 2c82000a sltiu r2,r4,0x000a
  001877d0: 10400003 beq r2,r0,0x 001877e0 Branch if Random > a
+
  001877d0: 10400003 beq r2,r0,0x 001877e0       ;  Branch if Random > a
 
  001877d4: 2c820028 sltiu r2,r4,0x0028
 
  001877d4: 2c820028 sltiu r2,r4,0x0028
 
  001877d8: 08061dfb j 0x 001877ec
 
  001877d8: 08061dfb j 0x 001877ec
  001877dc: 3403001a ori r3,r0,0x001a r3 = 1a (Blizzaga)
+
  001877dc: 3403001a ori r3,r0,0x001a           ;  r3 = 1a (Blizzaga)
  001877e0: 10400002 beq r2,r0,0x 001877ec Branch if Random > 28
+
  001877e0: 10400002 beq r2,r0,0x 001877ec       ;  Branch if Random > 28
  001877e4: 3403 0018 ori r3,r0,0x 0018 r3 = 18 (Blizzard)
+
  001877e4: 3403 0018 ori r3,r0,0x 0018         ;  r3 = 18 (Blizzard)
  001877e8: 34030019 ori r3,r0,0x0019 r3 = 19 (Blizzara)
+
  001877e8: 34030019 ori r3,r0,0x0019           ;  r3 = 19 (Blizzara)
 
  001877ec: 3c058019 lui r5,0x8019
 
  001877ec: 3c058019 lui r5,0x8019
 
  001877f0: 24a538d6 addiu r5,r5,0x38d6
 
  001877f0: 24a538d6 addiu r5,r5,0x38d6
  001877f4: 000320c0 sll r4,r3,0x03 Ability ID * 8
+
  001877f4: 000320c0 sll r4,r3,0x03             ;  Ability ID * 8
  001877f8: 00832023 subu r4,r4,r3 Ability ID * 7
+
  001877f8: 00832023 subu r4,r4,r3               ;  Ability ID * 7
  001877fc: 00042040 sll r4,r4,0x01 Ability ID * 14
+
  001877fc: 00042040 sll r4,r4,0x01             ;  Ability ID * 14
  00187800: a4a30000 sh r3,0x0000(r5) Store Used Ability ID
+
  00187800: a4a30000 sh r3,0x0000(r5)           ;  Store Used Ability ID
  00187804: 24a5001a addiu r5,r5,0x001a r5 = 801938f0 (Current Action Ability Data start)
+
  00187804: 24a5001a addiu r5,r5,0x001a         ;  r5 = 801938f0 (Current Action Ability Data start)
 
  00187808: 3c028019 lui r2,0x8019
 
  00187808: 3c028019 lui r2,0x8019
  0018780c: 8c422d94 lw r2,0x2d94(r2) Load Attacker's Data Pointer
+
  0018780c: 8c422d94 lw r2,0x2d94(r2)           ;  Load Attacker's Data Pointer
  00187810: 3406000e ori r6,r0,0x000e r6 = e (Loop Limit)
+
  00187810: 3406000e ori r6,r0,0x000e           ;  r6 = e (Loop Limit)
  00187814: a4430170 sh r3,0x0170(r2) Store Last Attack? = Ability ID
+
  00187814: a4430170 sh r3,0x0170(r2)           ;  Store Last Attack? = Ability ID
 
  00187818: 3c028006 lui r2,0x8006
 
  00187818: 3c028006 lui r2,0x8006
  0018781c: 2442fbf0 addiu r2,r2,-0x0410 r2 = 5fbf0 (Ability Data)
+
  0018781c: 2442fbf0 addiu r2,r2,-0x0410         ;  r2 = 5fbf0 (Ability Data)
  00187820: 0c017895 jal 0x0005e254 Load X into Y (Ability Data -> Current Action Data)
+
  00187820: 0c017895 jal 0x0005e254             ;  Load X into Y (Ability Data -> Current Action Data)
  00187824: 00822021 addu r4,r4,r2 r4 = Ability Data Pointer
+
  00187824: 00822021 addu r4,r4,r2               ;  r4 = Ability Data Pointer
 
  00187828: 8fbf0014 lw r31,0x0014(r29)
 
  00187828: 8fbf0014 lw r31,0x0014(r29)
 
  0018782c: 8fb00010 lw r16,0x0010(r29)
 
  0018782c: 8fb00010 lw r16,0x0010(r29)

Revision as of 02:39, 3 October 2020

[04] Magic Guns
00188c24: 27bdffe8 addiu r29,r29,0xffe8
00188c28: afbf0010 sw r31,0x0010(r29)
00188c2c: 0c061dcc jal 0x 00187730             ;   Magic Gun Ability Decision
00188c30: 00000000 nop
00188c34: 3c028019 lui r2,0x8019
00188c38: 90423902 lbu r2,0x3902(r2)           ;   Load WP
00188c3c: 3c038019 lui r3,0x8019
00188c40: 906338fa lbu r3,0x38fa(r3)           ;   Load Ability Power
00188c44: 3c018019 lui r1,0x8019
00188c48: a42238ce sh r2,0x38ce(r1)            ;   XA = WP
00188c4c: 3c018019 lui r1,0x8019
00188c50: a42338d0 sh r3,0x38d0(r1)            ;   YA = Ability Power
00188c54: 0c0617e0 jal 0x 00185f80             ;   Charge Calculation
00188c58: 00000000 nop
00188c5c: 0c0617e9 jal 0x 00185fa4             ;   Weapon Element Strengthen
00188c60: 00000000 nop
00188c64: 0c0621d1 jal 0x 00188744             ;   Magical Support/Status/Compat
00188c68: 00000000 nop
00188c6c: 0c0621df jal 0x 0018877c             ;   Elemental XA * YA
00188c70: 00000000 nop
00188c74: 14400005 bne r2,r0,0x 00188c8c       ;   Branch if element was nullified
00188c78: 00000000 nop
00188c7c: 0c061c54 jal 0x 00187150             ;   Faith Calculation
00188c80: 00000000 nop
00188c84: 0c061c3f jal 0x 001870fc             ;   Elemental Absorption
00188c88: 00000000 nop
00188c8c: 8fbf0010 lw r31,0x0010(r29)
00188c90: 27bd0018 addiu r29,r29,0x 0018
00188c94: 03e00008 jr r31
00188c98: 00000000 nop

Magic Gun Ability Decision

00187730: 27bdffe8 addiu r29,r29,0xffe8
00187734: afb00010 sw r16,0x0010(r29)
00187738: 3c108019 lui r16,0x8019
0018773c: 92103904 lbu r16,0x3904(r16)         ;   Load Weapon's Element
00187740: afbf0014 sw r31,0x0014(r29)
00187744: 0c063ba8 jal 0x 0018eea0             ;   Random Process
00187748: 00000000 nop
0018774c: 00021840 sll r3,r2,0x01              ;   Random * 2
00187750: 00621821 addu r3,r3,r2               ;   Random * 3
00187754: 000318c0 sll r3,r3,0x03              ;   Random * 24
00187758: 00621821 addu r3,r3,r2               ;   Random * 25
0018775c: 00031880 sll r3,r3,0x02              ;   Random * 100 (or mult r2, r3 with r3 = 64)
00187760: 04610002 bgez r3,0x 0018776c         ;   Branch if Random is Positive
00187764: 32020080 andi r2,r16,0x0080
00187768: 24637fff addiu r3,r3,0x7fff          ;   Random + 7fff
0018776c: 1040000b beq r2,r0,0x 0018779c       ;   Branch if Weapon doesn't have Fire
00187770: 00031bc2 srl r3,r3,0x0f              ;   Random / 8000 (rand 0..99)
00187774: 306400ff andi r4,r3,0x00ff
00187778: 2c82000a sltiu r2,r4,0x000a
0018777c: 10400003 beq r2,r0,0x 0018778c       ;   Branch if Random > a (90% chance to branch)
00187780: 2c820028 sltiu r2,r4,0x0028
00187784: 08061dfb j 0x 001877ec
00187788: 34030012 ori r3,r0,0x0012            ;   r3 = 12 (Firaga, 10% chance)
0018778c: 10400017 beq r2,r0,0x 001877ec       ;   Branch if Random > 28 (60% chance to branch)
00187790: 34030010 ori r3,r0,0x0010            ;   r3 = 10 (Fire, 60% chance)
00187794: 08061dfb j 0x 001877ec
00187798: 34030011 ori r3,r0,0x0011            ;   r3 = 11 (Fira, 30% chance)
0018779c: 32020040 andi r2,r16,0x0040
001877a0: 1040000a beq r2,r0,0x 001877cc       ;   Branch if Weapon doesn't have Lightning
001877a4: 306400ff andi r4,r3,0x00ff
001877a8: 2c82000a sltiu r2,r4,0x000a
001877ac: 10400003 beq r2,r0,0x 001877bc       ;   Branch if Ranfom > a
001877b0: 2c820028 sltiu r2,r4,0x0028
001877b4: 08061dfb j 0x 001877ec
001877b8: 34030016 ori r3,r0,0x0016            ;   r3 = 16 (Thundaga)
001877bc: 1040000b beq r2,r0,0x 001877ec       ;   Branch if Random > 28
001877c0: 34030014 ori r3,r0,0x0014            ;   r3 = 14 (Thunder)
001877c4: 08061dfb j 0x 001877ec
001877c8: 34030015 ori r3,r0,0x0015            ;   r3 = 15 (Thundara)
001877cc: 2c82000a sltiu r2,r4,0x000a
001877d0: 10400003 beq r2,r0,0x 001877e0       ;   Branch if Random > a
001877d4: 2c820028 sltiu r2,r4,0x0028
001877d8: 08061dfb j 0x 001877ec
001877dc: 3403001a ori r3,r0,0x001a            ;   r3 = 1a (Blizzaga)
001877e0: 10400002 beq r2,r0,0x 001877ec       ;   Branch if Random > 28
001877e4: 3403 0018 ori r3,r0,0x 0018          ;   r3 = 18 (Blizzard)
001877e8: 34030019 ori r3,r0,0x0019            ;   r3 = 19 (Blizzara)
001877ec: 3c058019 lui r5,0x8019
001877f0: 24a538d6 addiu r5,r5,0x38d6
001877f4: 000320c0 sll r4,r3,0x03              ;   Ability ID * 8
001877f8: 00832023 subu r4,r4,r3               ;   Ability ID * 7
001877fc: 00042040 sll r4,r4,0x01              ;   Ability ID * 14
00187800: a4a30000 sh r3,0x0000(r5)            ;   Store Used Ability ID
00187804: 24a5001a addiu r5,r5,0x001a          ;   r5 = 801938f0 (Current Action Ability Data start)
00187808: 3c028019 lui r2,0x8019
0018780c: 8c422d94 lw r2,0x2d94(r2)            ;   Load Attacker's Data Pointer
00187810: 3406000e ori r6,r0,0x000e            ;   r6 = e (Loop Limit)
00187814: a4430170 sh r3,0x0170(r2)            ;   Store Last Attack? = Ability ID
00187818: 3c028006 lui r2,0x8006
0018781c: 2442fbf0 addiu r2,r2,-0x0410         ;   r2 = 5fbf0 (Ability Data)
00187820: 0c017895 jal 0x0005e254              ;   Load X into Y (Ability Data -> Current Action Data)
00187824: 00822021 addu r4,r4,r2               ;   r4 = Ability Data Pointer
00187828: 8fbf0014 lw r31,0x0014(r29)
0018782c: 8fb00010 lw r16,0x0010(r29)
00187830: 27bd 0018 addiu r29,r29,0x 0018
00187834: 03e00008 jr r31
00187838: 00000000 nop