Difference between revisions of "Calculate Unit's Abilities"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Calculate Unit's Abilities 0005ba70: 27bdffc0 addiu r29,r29,0xffc0 0005ba74: afb20020 sw r18,0x0020(r29) 0005ba78: 00809021 addu r18,r4,r0 r18 = Unit's Data Pointer 0005...")
 
 
Line 208: Line 208:
 
  0005bda8: 03e00008 jr r31
 
  0005bda8: 03e00008 jr r31
 
  0005bdac: 00000000 nop
 
  0005bdac: 00000000 nop
 +
 +
== Return Locations ==
 +
 +
0005aa4c: [[Unit Battle Initialization]]

Latest revision as of 00:39, 1 March 2012

Calculate Unit's Abilities
0005ba70: 27bdffc0 addiu r29,r29,0xffc0
0005ba74: afb20020 sw r18,0x0020(r29)
0005ba78: 00809021 addu r18,r4,r0		r18 = Unit's Data Pointer
0005ba7c: afbf003c sw r31,0x003c(r29)
0005ba80: afbe0038 sw r30,0x0038(r29)
0005ba84: afb70034 sw r23,0x0034(r29)
0005ba88: afb60030 sw r22,0x0030(r29)
0005ba8c: afb5002c sw r21,0x002c(r29)
0005ba90: afb40028 sw r20,0x0028(r29)
0005ba94: afb30024 sw r19,0x0024(r29)
0005ba98: afb1001c sw r17,0x001c(r29)
0005ba9c: afb00018 sw r16,0x0018(r29)
0005baa0: 92480003 lbu r8,0x0003(r18)		Load Unit's Job ID
0005baa4: 00a0b021 addu r22,r5,r0		r22 = ENTD Pointer
0005baa8: a3a80010 sb r8,0x0010(r29)		Temp Store Unit's Job ID
0005baac: 92570006 lbu r23,0x0006(r18)		Load Unit's Gender Byte
0005bab0: 16c00006 bne r22,r0,0x 0005bacc	Branch if ENTD Pointer Exists
0005bab4: 340200ff ori r2,r0,0x00ff		r2 = FF
0005bab8: 26440014 addiu r4,r18,0x0014		r2 = Unit's Reaction Ability Pointer
0005babc: 0c017991 jal 0x 0005e644		Data Nullifying (R/S/M)
0005bac0: 34050006 ori r5,r0,0x0006		Limit = 6
0005bac4: 08016f5f j 0x 0005bd7c
0005bac8: 00000000 nop
0005bacc: 92d3001d lbu r19,0x001d(r22)		Load ENTD Primary Skillset
0005bad0: 00000000 nop
0005bad4: 326300ff andi r3,r19,0x00ff
0005bad8: 1062 0005 beq r3,r2,0x 0005baf0		Branch if Skillset = FF (Job's)
0005badc: 00000000 nop
0005bae0: 10600003 beq r3,r0,0x 0005baf0		Branch if Skillset = 0
0005bae4: 00000000 nop
0005bae8: 08016ec6 j 0x 0005bb18
0005baec: a2530012 sb r19,0x0012(r18)		Store Unit's Primary Skillset
0005baf0: 93a80010 lbu r8,0x0010(r29)		Load Temp Stored Job ID
0005baf4: 3c038006 lui r3,0x8006
0005baf8: 8c636194 lw r3,0x6194(r3)		Load Job Data Pointer
0005bafc: 00081040 sll r2,r8,0x01		ID * 2
0005bb00: 00481021 addu r2,r2,r8		ID * 3
0005bb04: 00021100 sll r2,r2,0x04		ID * 48
0005bb08: 00431021 addu r2,r2,r3
0005bb0c: 90420000 lbu r2,0x0000(r2)		Load Job's Skillset
0005bb10: 00000000 nop
0005bb14: a2420012 sb r2,0x0012(r18)		Store Unit's Primary = Job's Skillset
0005bb18: 32e200c0 andi r2,r23,0x00c0
0005bb1c: 1040006c beq r2,r0,0x 0005bcd0		Branch if Unit doesn't have a Gender
0005bb20: 26440099 addiu r4,r18,0x0099		r4 = Unit's Known Ability Pointer
0005bb24: 0c017991 jal 0x 0005e644		Data Nullifying (Known Abilities)
0005bb28: 34050039 ori r5,r0,0x0039		Limit = 0x39
0005bb2c: 00008821 addu r17,r0,r0		Counter = 0
0005bb30: 3c1e8006 lui r30,0x8006
0005bb34: 27de6182 addiu r30,r30,0x6182		r30 = Level 0 JP Req Pointer
0005bb38: 0240a021 addu r20,r18,r0		r20 = Unit's Data Pointer
0005bb3c: 0000a821 addu r21,r0,r0		Job Counter = 0
0005bb40: 02511021 addu r2,r18,r17		r2 = Unit's Data Pointer + Counter
0005bb44: 905300d2 lbu r19,0x00d2(r2)		Load Unit's Job Levels
0005bb48: 34020009 ori r2,r0,0x0009		r2 = 9
0005bb4c: 16220004 bne r17,r2,0x 0005bb60	Branch if Counter != 9 (Dancer Check)
0005bb50: 00138102 srl r16,r19,0x04		Job Level / 16 (get High Nybble Job Level)
0005bb54: 32e20080 andi r2,r23,0x0080
0005bb58: 1440001e bne r2,r0,0x 0005bbd4		Branch if Unit is a Male
0005bb5c: 00001021 addu r2,r0,r0		JP = 0
0005bb60: 12000010 beq r16,r0,0x 0005bba4	Branch if High Nybble Job Level = 0
0005bb64: 00000000 nop
0005bb68: 0c0088c3 jal 0x0002230c		Random Number Generator
0005bb6c: 00000000 nop
0005bb70: 00021840 sll r3,r2,0x01		Random * 2
0005bb74: 00621821 addu r3,r3,r2		Random * 3
0005bb78: 000318c0 sll r3,r3,0x03		Random * 24
0005bb7c: 00621821 addu r3,r3,r2		Random * 25
0005bb80: 00032080 sll r4,r3,0x02		Random * 100
0005bb84: 00101040 sll r2,r16,0x01		Dancer Job Level
0005bb88: 04810002 bgez r4,0x 0005bb94		Branch if Random is positive
0005bb8c: 005e1021 addu r2,r2,r30		Job Level + Job Req. Pointer
0005bb90: 24847fff addiu r4,r4,0x7fff
0005bb94: 94430000 lhu r3,0x0000(r2)		Load JP Requirement
0005bb98: 000413c3 sra r2,r4,0x0f		rand(0..99)
0005bb9c: 08016ef5 j 0x 0005bbd4
0005bba0: 00621021 addu r2,r3,r2		JP = JP Requirement + rand(0..99)
0005bba4: 0c0088c3 jal 0x0002230c		Random Number Generator
0005bba8: 00000000 nop
0005bbac: 00021840 sll r3,r2,0x01
0005bbb0: 00621821 addu r3,r3,r2
0005bbb4: 000318c0 sll r3,r3,0x03
0005bbb8: 00621821 addu r3,r3,r2
0005bbbc: 00031080 sll r2,r3,0x02		Random * 100
0005bbc0: 04410002 bgez r2,0x 0005bbcc		Branch if Random is Positive
0005bbc4: 00000000 nop
0005bbc8: 24427fff addiu r2,r2,0x7fff
0005bbcc: 000213c3 sra r2,r2,0x0f		rand(0..99)
0005bbd0: 24420064 addiu r2,r2,0x0064		JP = 100 + rand(0..99)
0005bbd4: 02402021 addu r4,r18,r0		r4 = Unit's Data Pointer
0005bbd8: 26a5004a addiu r5,r21,0x004a		r5 = Job Counter + 0x4a 
0005bbdc: 02c03021 addu r6,r22,r0		r6 = ENTD Pointer
0005bbe0: a6820104 sh r2,0x0104(r20)		Store Unit's Total JP
0005bbe4: 0c01739d jal 0x 0005ce74		Calculate Learned Abilities
0005bbe8: a68200dc sh r2,0x00dc(r20)		Store Unit's JP
0005bbec: 34020008 ori r2,r0,0x0008		r2 = 8
0005bbf0: 16220004 bne r17,r2,0x 0005bc04	Branch if Counter != 8 (Bard Check)
0005bbf4: 3270000f andi r16,r19,0x000f		r16 = Low Nybble Job Level
0005bbf8: 32e20040 andi r2,r23,0x0040
0005bbfc: 1440001e bne r2,r0,0x 0005bc78		Branch if Unit is Female
0005bc00: 00001021 addu r2,r0,r0		JP = 0
0005bc04: 12000010 beq r16,r0,0x 0005bc48	Branch if Job Level = 0
0005bc08: 00000000 nop
0005bc0c: 0c0088c3 jal 0x0002230c		Random Number Generator
0005bc10: 00000000 nop
0005bc14: 00021840 sll r3,r2,0x01
0005bc18: 00621821 addu r3,r3,r2
0005bc1c: 000318c0 sll r3,r3,0x03
0005bc20: 00621821 addu r3,r3,r2
0005bc24: 00032080 sll r4,r3,0x02		Random * 100
0005bc28: 00101040 sll r2,r16,0x01		Job Level * 2
0005bc2c: 04810002 bgez r4,0x 0005bc38		Branch if Random is Positive
0005bc30: 005e1021 addu r2,r2,r30		Job Level + Job Level Requirements Pointer
0005bc34: 24847fff addiu r4,r4,0x7fff
0005bc38: 94430000 lhu r3,0x0000(r2)		Load Job Level's JP Requirement
0005bc3c: 000413c3 sra r2,r4,0x0f		rand(0..99)
0005bc40: 08016f1e j 0x 0005bc78
0005bc44: 00621021 addu r2,r3,r2		JP = Job Level's JP Req. + rand(0..99)
0005bc48: 0c0088c3 jal 0x0002230c		Random Number Generator
0005bc4c: 00000000 nop
0005bc50: 00021840 sll r3,r2,0x01
0005bc54: 00621821 addu r3,r3,r2
0005bc58: 000318c0 sll r3,r3,0x03
0005bc5c: 00621821 addu r3,r3,r2
0005bc60: 00031080 sll r2,r3,0x02		Random * 100
0005bc64: 04410002 bgez r2,0x 0005bc70		Branch if Random is Positive
0005bc68: 00000000 nop
0005bc6c: 24427fff addiu r2,r2,0x7fff
0005bc70: 000213c3 sra r2,r2,0x0f		rand(0..99)
0005bc74: 24420064 addiu r2,r2,0x0064		JP = rand(0..99) + 100
0005bc78: a6820106 sh r2,0x0106(r20)		Store Unit's Total JP
0005bc7c: a68200de sh r2,0x00de(r20)		Store Unit's Current JP
0005bc80: 34020009 ori r2,r0,0x0009		r2 = 9
0005bc84: 12220009 beq r17,r2,0x 0005bcac	Branch if Counter = 9 (Mime Check)
0005bc88: 02402021 addu r4,r18,r0		r4 = Unit's Data Pointer
0005bc8c: 26a5004b addiu r5,r21,0x004b		r5 = Job Counter + 0x4b
0005bc90: 0c01739d jal 0x 0005ce74		Calculate Learned Abilities
0005bc94: 02c03021 addu r6,r22,r0		r6 = ENTD Pointer
0005bc98: 26940004 addiu r20,r20,0x0004		Unit's Data Pointer += 4 (next set of JP)
0005bc9c: 26310001 addiu r17,r17,0x0001		Counter ++
0005bca0: 2a22000a slti r2,r17,0x000a
0005bca4: 1440ffa6 bne r2,r0,0x 0005bb40		Branch if Counter < 10
0005bca8: 26b50002 addiu r21,r21,0x0002		Job Counter += 2
0005bcac: 92c3001d lbu r3,0x001d(r22)		Load ENTD Primary Skillset
0005bcb0: 00000000 nop
0005bcb4: 10600006 beq r3,r0,0x 0005bcd0		Branch if Skillset = 0
0005bcb8: 340200ff ori r2,r0,0x00ff		r2 = FF
0005bcbc: 10620004 beq r3,r2,0x 0005bcd0		Branch if Skillset = Job's
0005bcc0: 340200ff ori r2,r0,0x00ff		r2 = FF
0005bcc4: a2420099 sb r2,0x0099(r18)		Store Unit's Known Abilities 1 = FF (all abilities)
0005bcc8: a242009a sb r2,0x009a(r18)		Store Unit's Known Abilities 2 = FF
0005bccc: a242009b sb r2,0x009b(r18)		Store Unit's Known R/S/M = FF
0005bcd0: 00008821 addu r17,r0,r0		Counter = 0
0005bcd4: 93a80010 lbu r8,0x0010(r29)		Load Temp Stored Job ID
0005bcd8: 02403021 addu r6,r18,r0		r6 = Unit's Data Pointer
0005bcdc: 00081040 sll r2,r8,0x01		ID * 2
0005bce0: 00481021 addu r2,r2,r8		ID * 3
0005bce4: 00023900 sll r7,r2,0x04		ID * 48
0005bce8: 00111840 sll r3,r17,0x01		Counter * 2
0005bcec: 3c028006 lui r2,0x8006
0005bcf0: 8c426194 lw r2,0x6194(r2)		Load Job Data Pointer
0005bcf4: 02512821 addu r5,r18,r17		r5 = Unit's Data Pointer + Counter
0005bcf8: 00e21021 addu r2,r7,r2
0005bcfc: 00512021 addu r4,r2,r17		r4 = Job's Data Pointer + Counter
0005bd00: 26310001 addiu r17,r17,0x0001		Counter ++
0005bd04: 00431021 addu r2,r2,r3		r2 = Job's Data Pointer + Counter * 2
0005bd08: 90430002 lbu r3,0x0002(r2)		Load Innate Ability's High Bit
0005bd0c: 90420001 lbu r2,0x0001(r2)		Load Innate Ability
0005bd10: 00031a00 sll r3,r3,0x08		High Bit * 256
0005bd14: 00431021 addu r2,r2,r3		r2 = Innate Ability ID
0005bd18: a4c2000a sh r2,0x000a(r6)		Store Unit's Innate Ability
0005bd1c: 90820009 lbu r2,0x0009(r4)		Load Job's Equippable Items
0005bd20: 00000000 nop
0005bd24: a0a2004a sb r2,0x004a(r5)		Store Unit's Equippable Items
0005bd28: 2a220004 slti r2,r17,0x0004
0005bd2c: 1440ffee bne r2,r0,0x 0005bce8		Branch if Counter < 4
0005bd30: 24c60002 addiu r6,r6,0x0002		Unit's Data Pointer += 2
0005bd34: 02402021 addu r4,r18,r0		r4 = Unit's Data Pointer
0005bd38: 34060002 ori r6,r0,0x0002		r6 = 2 (Reaction)
0005bd3c: 96c5000c lhu r5,0x000c(r22)		Load ENTD Reaction
0005bd40: 0c01742f jal 0x 0005d0bc		Calculate Unit's R/S/M
0005bd44: 02c03821 addu r7,r22,r0		r7 = ENTD Pointer
0005bd48: 02402021 addu r4,r18,r0		r4 = Unit's Data Pointer
0005bd4c: 34060004 ori r6,r0,0x0004		r6 = 4 (Support)
0005bd50: a6420014 sh r2,0x0014(r18)		Store Unit's Reaction ID
0005bd54: 96c5000e lhu r5,0x000e(r22)		Load ENTD Support
0005bd58: 0c01742f jal 0x 0005d0bc		Calculate Unit's R/S/M
0005bd5c: 02c03821 addu r7,r22,r0		r7 = ENTD Pointer
0005bd60: 02402021 addu r4,r18,r0		r4 = Unit's Data Pointer
0005bd64: 34060008 ori r6,r0,0x0008		r6 = 8 (Movement)
0005bd68: a6420016 sh r2,0x0016(r18)		Store Unit's Support ID
0005bd6c: 96c50010 lhu r5,0x0010(r22)		Load ENTD Movement
0005bd70: 0c01742f jal 0x 0005d0bc		Calculate Unit's R/S/M
0005bd74: 02c03821 addu r7,r22,r0		r7 = ENTD Pointer
0005bd78: a6420018 sh r2,0x0018(r18)		Store Unit's Movement ID
0005bd7c: 8fbf003c lw r31,0x003c(r29)
0005bd80: 8fbe0038 lw r30,0x0038(r29)
0005bd84: 8fb70034 lw r23,0x0034(r29)
0005bd88: 8fb60030 lw r22,0x0030(r29)
0005bd8c: 8fb5002c lw r21,0x002c(r29)
0005bd90: 8fb40028 lw r20,0x0028(r29)
0005bd94: 8fb30024 lw r19,0x0024(r29)
0005bd98: 8fb20020 lw r18,0x0020(r29)
0005bd9c: 8fb1001c lw r17,0x001c(r29)
0005bda0: 8fb00018 lw r16,0x0018(r29)
0005bda4: 27bd0040 addiu r29,r29,0x0040
0005bda8: 03e00008 jr r31
0005bdac: 00000000 nop

Return Locations

0005aa4c: Unit Battle Initialization