Difference between revisions of "ENTD Data Calculation"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " ENTD Data Calculation 0005ac1c: 27bdffd0 addiu r29,r29,0xffd0 0005ac20: afb20018 sw r18,0x0018(r29) 0005ac24: 00a09021 addu r18,r5,r0 r18 = ENTD Pointer 0005ac28: afbf00...")
 
 
Line 263: Line 263:
 
  0005b030: 03e00008 jr r31
 
  0005b030: 03e00008 jr r31
 
  0005b034: 00000000 nop
 
  0005b034: 00000000 nop
 +
 +
 +
 +
== Return Locations ==
 +
 +
0005a9f0: [[Unit Battle Initialization]]

Latest revision as of 13:52, 29 February 2012

ENTD Data Calculation
0005ac1c: 27bdffd0 addiu r29,r29,0xffd0
0005ac20: afb20018 sw r18,0x0018(r29)
0005ac24: 00a09021 addu r18,r5,r0		r18 = ENTD Pointer
0005ac28: afbf0028 sw r31,0x0028(r29)
0005ac2c: afb50024 sw r21,0x0024(r29)
0005ac30: afb40020 sw r20,0x0020(r29)
0005ac34: afb3001c sw r19,0x001c(r29)
0005ac38: afb10014 sw r17,0x0014(r29)
0005ac3c: afb00010 sw r16,0x0010(r29)
0005ac40: 92420017 lbu r2,0x0017(r18)		Load ENTD Palette
0005ac44: 00809821 addu r19,r4,r0		r19 = Unit's Data Pointer
0005ac48: a2620004 sb r2,0x0004(r19)		Store Unit's Palette
0005ac4c: 92420018 lbu r2,0x0018(r18)		Load ENTD Flags
0005ac50: 00000000 nop
0005ac54: a262 0005 sb r2,0x 0005(r19)		Store Unit's ENTD Flags
0005ac58: 92420018 lbu r2,0x0018(r18)		Load ENTD Flags
0005ac5c: 00000000 nop
0005ac60: a26201ba sb r2,0x01ba(r19)		Store Unit's Modified ENTD Flags
0005ac64: 92500001 lbu r16,0x0001(r18)		Load ENTD Gender Byte
0005ac68: 00000000 nop
0005ac6c: 32020008 andi r2,r16,0x0008
0005ac70: 1040 0005 beq r2,r0,0x 0005ac88		Branch if Unit doesn't have Load Formation
0005ac74: 00000000 nop
0005ac78: 0c016c0e jal 0x 0005b038		Prep for Initializing Unit's Job Data
0005ac7c: 00000000 nop
0005ac80: 08016b63 j 0x 0005ad8c
0005ac84: 0040a021 addu r20,r2,r0		r2 = Success Check
0005ac88: 92420000 lbu r2,0x0000(r18)		Load Unit's ENTD Sprite Set
0005ac8c: 00000000 nop
0005ac90: 2c420004 sltiu r2,r2,0x0004
0005ac94: 1040003e beq r2,r0,0x 0005ad90		Branch if Unit isn't Ramza
0005ac98: 00002021 addu r4,r0,r0		r4 = 0
0005ac9c: 92420004 lbu r2,0x0004(r18)		Load Unit's ENTD Birth Month
0005aca0: 00000000 nop
0005aca4: 1440003a bne r2,r0,0x 0005ad90		Branch if Month != 0 (Ramza Initialization)
0005aca8: 00000000 nop
0005acac: 00008821 addu r17,r0,r0		Counter = 0
0005acb0: 3c158006 lui r21,0x8006
0005acb4: 26b510e8 addiu r21,r21,0x10e8		r21 = Ramza's Job Data Pointer
0005acb8: 0c0166bc jal 0x 00059af0		Get Party Data Pointer
0005acbc: 02202021 addu r4,r17,r0		r4 = Counter
0005acc0: 00402021 addu r4,r2,r0		r4 = Party Data Pointer
0005acc4: 90830001 lbu r3,0x0001(r4)		Load Unit's Party ID
0005acc8: 340200ff ori r2,r0,0x00ff		r2 = FF
0005accc: 1062002b beq r3,r2,0x 0005ad7c		Branch if Unit's Party ID = FF
0005acd0: 00000000 nop
0005acd4: 90820000 lbu r2,0x0000(r4)		Load Unit's Sprite Set
0005acd8: 00000000 nop
0005acdc: 2c420004 sltiu r2,r2,0x0004
0005ace0: 10400026 beq r2,r0,0x 0005ad7c		Branch if Unit isn't Ramza
0005ace4: 00000000 nop
0005ace8: 90820002 lbu r2,0x0002(r4)		Load Unit's Job ID
0005acec: 92430000 lbu r3,0x0000(r18)		Load Unit's ENTD Sprite Set
0005acf0: 2c420003 sltiu r2,r2,0x0003
0005acf4: a0830000 sb r3,0x0000(r4)		Store Unit's Sprite Set
0005acf8: 90830007 lbu r3,0x0007(r4)		Load Unit's Secondary Skillset
0005acfc: 10400004 beq r2,r0,0x 0005ad10		Branch if Unit's Job isn't Ramza's Squire
0005ad00: 306300ff andi r3,r3,0x00ff
0005ad04: 92420000 lbu r2,0x0000(r18)		Load Unit's ENTD Sprite Set
0005ad08: 00000000 nop
0005ad0c: a0820002 sb r2,0x0002(r4)		Store Unit's Job ID = Sprite Set
0005ad10: 92a20000 lbu r2,0x0000(r21)		Load Job's Skillset
0005ad14: 00000000 nop
0005ad18: 10620009 beq r3,r2,0x 0005ad40		Branch if Job's Skillset = Unit's Secondary Skillset
0005ad1c: 00000000 nop
0005ad20: 92a20030 lbu r2,0x0030(r21)		Load 2nd Job's Skillset
0005ad24: 00000000 nop
0005ad28: 1062 0005 beq r3,r2,0x 0005ad40		Branch if 2nd Job's Skillset = Unit's Secondary Skillset
0005ad2c: 00000000 nop
0005ad30: 92a20060 lbu r2,0x0060(r21)		Load 3rd Job's Skillset
0005ad34: 00000000 nop
0005ad38: 1462000b bne r3,r2,0x 0005ad68		Branch if 3rd Job's Skillset != Unit's Secondary Skillset
0005ad3c: 00000000 nop
0005ad40: 92420000 lbu r2,0x0000(r18)		Load Unit's ENTD Sprite Set
0005ad44: 00000000 nop
0005ad48: 00021840 sll r3,r2,0x01		ID * 2
0005ad4c: 00621821 addu r3,r3,r2		ID * 3
0005ad50: 00031900 sll r3,r3,0x04		ID * 48
0005ad54: 3c018006 lui r1,0x8006
0005ad58: 00230821 addu r1,r1,r3
0005ad5c: 902210b8 lbu r2,0x10b8(r1)		Load Sprite Set's Job's Skillset
0005ad60: 00000000 nop
0005ad64: a0820007 sb r2,0x0007(r4)		Store Unit's Secondary Skillset = Sprite Set's Job's Skillset
0005ad68: 02602021 addu r4,r19,r0		r4 = Units Data Pointer
0005ad6c: 0c016c0e jal 0x 0005b038		Prep for Initializing Unit's Job Data
0005ad70: 02402821 addu r5,r18,r0		r5 = ENTD Pointer
0005ad74: 0040a021 addu r20,r2,r0		r20 = Success Check
0005ad78: 34100008 ori r16,r0,0x0008		Gender Byte = 8 (Load Formation Flag)
0005ad7c: 26310001 addiu r17,r17,0x0001		Counter ++
0005ad80: 2a220014 slti r2,r17,0x0014
0005ad84: 1440ffcc bne r2,r0,0x 0005acb8		Branch if Counter < 20
0005ad88: 00000000 nop
0005ad8c: 00002021 addu r4,r0,r0		Counter = 0
0005ad90: 3c028006 lui r2,0x8006
0005ad94: 8c426238 lw r2,0x6238(r2)		Load Current ENTD Pointer
0005ad98: 02641821 addu r3,r19,r4		r3 = Unit's Data Pointer + Counter
0005ad9c: 00441021 addu r2,r2,r4		r2 = Current ENTD Pointer + Counter
0005ada0: 90420021 lbu r2,0x0021(r2)		Load ENTD AI Data
0005ada4: 24840001 addiu r4,r4,0x0001		Counter ++
0005ada8: a0620165 sb r2,0x0165(r3)		Store Unit's ENTD AI Data
0005adac: 28820007 slti r2,r4,0x0007
0005adb0: 1440fff7 bne r2,r0,0x 0005ad90		Branch if Counter < 7
0005adb4: 32020008 andi r2,r16,0x0008		r2 = Unit's Load Formation Flag
0005adb8: 14400095 bne r2,r0,0x 0005b010		Branch if Unit has Load Formation
0005adbc: 02801021 addu r2,r20,r0		r2 = Success Check
0005adc0: a2700006 sb r16,0x0006(r19)		Store Unit's Gender Byte
0005adc4: 92430000 lbu r3,0x0000(r18)		Load ENTD Sprite Set
0005adc8: 340200ff ori r2,r0,0x00ff		r2 = FF
0005adcc: a2620002 sb r2,0x0002(r19)		Store Unit's Party ID = FF
0005add0: a2630000 sb r3,0x0000(r19)		Store Unit's Sprite Set = ENTD Sprite Set
0005add4: 92500003 lbu r16,0x0003(r18)		Load ENTD Level
0005add8: 00000000 nop
0005addc: 320300ff andi r3,r16,0x00ff
0005ade0: 10600003 beq r3,r0,0x 0005adf0		Branch if Level = Party Level
0005ade4: 340200fe ori r2,r0,0x00fe		r2 = FE
0005ade8: 14620010 bne r3,r2,0x 0005ae2c		Branch if Level != Party Level: Random
0005adec: 2c620064 sltiu r2,r3,0x0064
0005adf0: 3c038006 lui r3,0x8006
0005adf4: 90636308 lbu r3,0x6308(r3)		Load Highest Party Level
0005adf8: 00000000 nop
0005adfc: 000310c2 srl r2,r3,0x03		High Level / 8
0005ae00: 24500001 addiu r16,r2,0x0001		ENTD Level = High Level / 8 + 1
0005ae04: 0c0088c3 jal 0x0002230c		Random Number Generator
0005ae08: 00628823 subu r17,r3,r2		r17 = High Level - High Level / 8
0005ae0c: 02020018 mult r16,r2			(High Level / 8 + 1) * Random
0005ae10: 00001012 mflo r2
0005ae14: 04410002 bgez r2,0x 0005ae20		Branch if Result is Positive
0005ae18: 00000000 nop
0005ae1c: 24427fff addiu r2,r2,0x7fff
0005ae20: 000213c3 sra r2,r2,0x0f		Result = rand(0..High Level / 8)
0005ae24: 08016b92 j 0x 0005ae48
0005ae28: 02228021 addu r16,r17,r2		r16 = rand((High Level - High Level / 8)..High Level)
0005ae2c: 14400007 bne r2,r0,0x 0005ae4c		Branch if Level < 100
0005ae30: 02001821 addu r3,r16,r0		r3 = ENTD Level
0005ae34: 3c028006 lui r2,0x8006
0005ae38: 90426308 lbu r2,0x6308(r2)		Load Highest Party Level
0005ae3c: 00000000 nop
0005ae40: 2442009c addiu r2,r2,0x009c		High Level += 0x9c
0005ae44: 02028021 addu r16,r16,r2		Level = Level + High Level + 0x9c
0005ae48: 02001821 addu r3,r16,r0		r3 = " (amount over 0x100 = Level to obtain)
0005ae4c: 306200ff andi r2,r3,0x00ff
0005ae50: 14400003 bne r2,r0,0x 0005ae60		Branch if Level != 0
0005ae54: 00608021 addu r16,r3,r0
0005ae58: 34030001 ori r3,r0,0x0001
0005ae5c: 00608021 addu r16,r3,r0		Level = 1
0005ae60: 320200ff andi r2,r16,0x00ff
0005ae64: 2c420064 sltiu r2,r2,0x0064
0005ae68: 14400002 bne r2,r0,0x 0005ae74		Branch if Level < 100
0005ae6c: 00000000 nop
0005ae70: 34100063 ori r16,r0,0x0063		Level = 99
0005ae74: a2700022 sb r16,0x0022(r19)		Store Unit's Level
0005ae78: 92430004 lbu r3,0x0004(r18)		Load ENTD Birth Month
0005ae7c: 9250 0005 lbu r16,0x 0005(r18)		Load ENTD Birth Day
0005ae80: 10600007 beq r3,r0,0x 0005aea0		Branch if Birth Month = 0
0005ae84: 2c62000d sltiu r2,r3,0x000d
0005ae88: 1040 0005 beq r2,r0,0x 0005aea0		Branch if Month isn't legal
0005ae8c: 320200ff andi r2,r16,0x00ff
0005ae90: 10400003 beq r2,r0,0x 0005aea0		Branch if Day is 0
0005ae94: 2c420020 sltiu r2,r2,0x0020
0005ae98: 1440000f bne r2,r0,0x 0005aed8		Branch if Day is legal
0005ae9c: 00031040 sll r2,r3,0x01		Month * 2
0005aea0: 0c0088c3 jal 0x0002230c		Random Number Generator
0005aea4: 00000000 nop
0005aea8: 000218c0 sll r3,r2,0x03		Random * 8
0005aeac: 00621821 addu r3,r3,r2		Random * 9
0005aeb0: 000318c0 sll r3,r3,0x03		Random * 72
0005aeb4: 00621821 addu r3,r3,r2		Random * 73
0005aeb8: 00031080 sll r2,r3,0x02		Random * 292
0005aebc: 00621021 addu r2,r3,r2		Random * 365
0005aec0: 04410002 bgez r2,0x 0005aecc		Branch if Random * 365 is positive (it is)
0005aec4: 00000000 nop
0005aec8: 24427fff addiu r2,r2,0x7fff
0005aecc: 000213c3 sra r2,r2,0x0f		Birthday = rand(0..364)
0005aed0: 08016bbb j 0x 0005aeec
0005aed4: 24420001 addiu r2,r2,0x0001		Birthday += 1
0005aed8: 3c018006 lui r1,0x8006
0005aedc: 00220821 addu r1,r1,r2
0005aee0: 942261ce lhu r2,0x61ce(r1)		Load Month's Day Value
0005aee4: 00000000 nop
0005aee8: 00501021 addu r2,r2,r16		Birth Day = Day + Month's Day Value
0005aeec: 3044ffff andi r4,r2,0xffff
0005aef0: 96620008 lhu r2,0x0008(r19)		Load Unit's Birthday
0005aef4: 308301ff andi r3,r4,0x01ff		r3 = Unit's Birthday
0005aef8: 3042fe00 andi r2,r2,0xfe00		r2 = Unit's Zodiac
0005aefc: 00431025 or r2,r2,r3			Unit's Birthday + Zodiac
0005af00: 0c017976 jal 0x 0005e5d8		Calculate Zodiac Symbol
0005af04: a6620008 sh r2,0x0008(r19)		Store Unit's new Birthday
0005af08: 3042ffff andi r2,r2,0xffff		r2 = Zodiac ID
0005af0c: 96630008 lhu r3,0x0008(r19)		Load Unit's Birthday
0005af10: 00021300 sll r2,r2,0x0c		ID * 0x1000
0005af14: 30630fff andi r3,r3,0x0fff		r3 = Unit's Birthday
0005af18: 00622025 or r4,r3,r2			Unit's Birthday + Zodiac Sign
0005af1c: a6640008 sh r4,0x0008(r19)		Store Unit's new Birthday
0005af20: 9243000a lbu r3,0x000a(r18)		Load ENTD Job ID
0005af24: 34020097 ori r2,r0,0x0097		r2 = 0x97
0005af28: 14620003 bne r3,r2,0x 0005af38		Branch if Job != Serpentarius
0005af2c: 30820fff andi r2,r4,0x0fff		r2 = Unit's Birthday + Zodiac
0005af30: 3442c000 ori r2,r2,0xc000		Enable Serpentarius
0005af34: a6620008 sh r2,0x0008(r19)		Store Unit's new Birthday
0005af38: 92500006 lbu r16,0x0006(r18)		Load ENTD Brave
0005af3c: 00000000 nop
0005af40: 2e020065 sltiu r2,r16,0x0065
0005af44: 1440000b bne r2,r0,0x 0005af74		Branch if Brave < 101
0005af48: 00000000 nop
0005af4c: 0c0088c3 jal 0x0002230c		Random Number Generator
0005af50: 00000000 nop
0005af54: 00021900 sll r3,r2,0x04		Random * 16
0005af58: 00621823 subu r3,r3,r2		Random * 15
0005af5c: 00031040 sll r2,r3,0x01		Random * 30
0005af60: 04410002 bgez r2,0x 0005af6c		Branch if Random is positive
0005af64: 00000000 nop
0005af68: 24427fff addiu r2,r2,0x7fff
0005af6c: 000213c3 sra r2,r2,0x0f		rand(0..29)
0005af70: 2450002d addiu r16,r2,0x002d		Brave = rand(0..29) + 45
0005af74: a2700024 sb r16,0x0024(r19)		Store Unit's Brave
0005af78: a2700023 sb r16,0x0023(r19)		Store Unit's Original Brave
0005af7c: 92500007 lbu r16,0x0007(r18)		Load ENTD Faith
0005af80: 00000000 nop
0005af84: 2e020065 sltiu r2,r16,0x0065
0005af88: 1440000b bne r2,r0,0x 0005afb8		Branch if Faith < 101
0005af8c: 00000000 nop
0005af90: 0c0088c3 jal 0x0002230c		Random Number Generator
0005af94: 00000000 nop
0005af98: 00021900 sll r3,r2,0x04		Random * 16
0005af9c: 00621823 subu r3,r3,r2		Random * 15
0005afa0: 00031040 sll r2,r3,0x01		Random * 30
0005afa4: 04410002 bgez r2,0x 0005afb0		Branch if Random is Positive
0005afa8: 00000000 nop
0005afac: 24427fff addiu r2,r2,0x7fff
0005afb0: 000213c3 sra r2,r2,0x0f		rand(0..29)
0005afb4: 2450002d addiu r16,r2,0x002d		Faith = rand(0..29) + 45
0005afb8: a2700026 sb r16,0x0026(r19)		Store Unit's Faith
0005afbc: a2700025 sb r16,0x0025(r19)		Store Unit's Original Faith
0005afc0: 9250001c lbu r16,0x001c(r18)		Load ENTD Starting Experience
0005afc4: 00000000 nop
0005afc8: 2e020064 sltiu r2,r16,0x0064
0005afcc: 1440000c bne r2,r0,0x 0005b000		Branch if Starting Experience < 100
0005afd0: 00000000 nop
0005afd4: 0c0088c3 jal 0x0002230c		Random Number Generator
0005afd8: 00000000 nop
0005afdc: 00021840 sll r3,r2,0x01		Random * 2
0005afe0: 00621821 addu r3,r3,r2		Random * 3
0005afe4: 000318c0 sll r3,r3,0x03		Random * 24
0005afe8: 00621821 addu r3,r3,r2		Random * 25
0005afec: 00031880 sll r3,r3,0x02		Random * 100
0005aff0: 04610003 bgez r3,0x 0005b000		Branch if Random is positive
0005aff4: 000383c2 srl r16,r3,0x0f		rand(0..99)
0005aff8: 24637fff addiu r3,r3,0x7fff
0005affc: 000383c2 srl r16,r3,0x0f
0005b000: a2700021 sb r16,0x0021(r19)		Store Unit's Experience
0005b004: 92430002 lbu r3,0x0002(r18)		Load ENTD Name ID
0005b008: 00001021 addu r2,r0,r0		r2 = 0 (Success)
0005b00c: a663016c sh r3,0x016c(r19)		Store Unit's Name ID
0005b010: 8fbf0028 lw r31,0x0028(r29)
0005b014: 8fb50024 lw r21,0x0024(r29)
0005b018: 8fb40020 lw r20,0x0020(r29)
0005b01c: 8fb3001c lw r19,0x001c(r29)
0005b020: 8fb20018 lw r18,0x0018(r29)
0005b024: 8fb10014 lw r17,0x0014(r29)
0005b028: 8fb00010 lw r16,0x0010(r29)
0005b02c: 27bd0030 addiu r29,r29,0x0030
0005b030: 03e00008 jr r31
0005b034: 00000000 nop


Return Locations

0005a9f0: Unit Battle Initialization