Store/Generate Character Names

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Store/Generate Character Names
0005c984: 3c028006 lui r2,0x8006
0005c988: 8c426200 lw r2,0x6200(r2)		Load Battle Initialization flag?
0005c98c: 27bdfec8 addiu r29,r29,0xfec8
0005c990: afb20118 sw r18,0x0118(r29)
0005c994: 00809021 addu r18,r4,r0		r18 = Unit's Data Pointer
0005c998: afb50124 sw r21,0x0124(r29)
0005c99c: 3c158013 lui r21,0x8013
0005c9a0: 26b52824 addiu r21,r21,0x2824		r21 = Pointer to "Prep for Loading Text" Code (battle)
0005c9a4: afbf0130 sw r31,0x0130(r29)
0005c9a8: afb7012c sw r23,0x012c(r29)
0005c9ac: afb60128 sw r22,0x0128(r29)
0005c9b0: afb40120 sw r20,0x0120(r29)
0005c9b4: afb3011c sw r19,0x011c(r29)
0005c9b8: afb10114 sw r17,0x0114(r29)
0005c9bc: 10400003 beq r2,r0,0x 0005c9cc		Branch if not Initializing Data?
0005c9c0: afb00110 sw r16,0x0110(r29)
0005c9c4: 3c15800e lui r21,0x800e
0005c9c8: 26b56edc addiu r21,r21,0x6edc		r21 = Pointer to "Prep for Loading Text" Code (world)
0005c9cc: 92440002 lbu r4,0x0002(r18)		Load Unit's Party ID
0005c9d0: 340200ff ori r2,r0,0x00ff		r2 = FF
0005c9d4: 14820053 bne r4,r2,0x 0005cb24		Branch if Party ID != FF (already named)
0005c9d8: 00000000 nop
0005c9dc: 9247016c lbu r7,0x016c(r18)		Load Unit's Name ID
0005c9e0: 00000000 nop
0005c9e4: 14e4004a bne r7,r4,0x 0005cb10		Branch if Name ID != Party ID (name already chosen)
0005c9e8: 34114000 ori r17,r0,0x4000		Name Flags = 0x4000 (Special Names)
0005c9ec: 92430006 lbu r3,0x0006(r18)		Load Unit's Gender Byte
0005c9f0: 00000000 nop
0005c9f4: 30620080 andi r2,r3,0x0080
0005c9f8: 10400004 beq r2,r0,0x 0005ca0c		Branch if Unit isn't a male
0005c9fc: 306400e0 andi r4,r3,0x00e0		r4 = Unit's Gender
0005ca00: 34114100 ori r17,r0,0x4100		Name Flags = 0x4100 (Generic Male Names)
0005ca04: 0801728a j 0x 0005ca28
0005ca08: 34140100 ori r20,r0,0x0100		Name Modifier = 0x100
0005ca0c: 30620040 andi r2,r3,0x0040
0005ca10: 10400003 beq r2,r0,0x 0005ca20		Branch if Unit isn't a Female
0005ca14: 34114200 ori r17,r0,0x4200		Name Flags = 0x4200 (Generic Female Names)
0005ca18: 0801728a j 0x 0005ca28
0005ca1c: 34140200 ori r20,r0,0x0200		Name Mod = 0x200
0005ca20: 34114300 ori r17,r0,0x4300		Name Flags = 0x4300 (Generic Monster Names)
0005ca24: 34140300 ori r20,r0,0x0300		Name Mod = 0x300
0005ca28: 3c178005 lui r23,0x8005
0005ca2c: 26f77f74 addiu r23,r23,0x7f74		r23 = Party Data Pointer
0005ca30: 341600ff ori r22,r0,0x00ff		r22 = FF
0005ca34: 309300ff andi r19,r4,0x00ff		r19 = Unit's Gender
0005ca38: 0c0088c3 jal 0x0002230c		Random Number Generator
0005ca3c: 34100001 ori r16,r0,0x0001		r16 = 1 (success, for later)
0005ca40: 00021a00 sll r3,r2,0x08		Random * 256
0005ca44: 00621023 subu r2,r3,r2		Random * 255 (supposed to be * 256 instead?)
0005ca48: 04410002 bgez r2,0x 0005ca54		Branch if Random >= 0 (it's never negative)
0005ca4c: 00003021 addu r6,r0,r0		Counter = 0
0005ca50: 24427fff addiu r2,r2,0x7fff		Random * 255 + 0x7FFF
0005ca54: 000213c3 sra r2,r2,0x0f		Random * 255 / 0x8000 (rand(0..254)
0005ca58: 02823821 addu r7,r20,r2		Chosen Name = Name Mod + rand(0..254)
0005ca5c: 30e4ffff andi r4,r7,0xffff
0005ca60: 02e02821 addu r5,r23,r0		r5 = Party Data Pointer
0005ca64: 90a20001 lbu r2,0x0001(r5)		Load Unit's Party ID
0005ca68: 00000000 nop
0005ca6c: 1056000e beq r2,r22,0x 0005caa8	Branch if Party ID = FF
0005ca70: 00000000 nop
0005ca74: 90a20004 lbu r2,0x0004(r5)		Load Unit's Gender Byte
0005ca78: 00000000 nop
0005ca7c: 304200e0 andi r2,r2,0x00e0
0005ca80: 16620009 bne r19,r2,0x 0005caa8	Branch if Unit's Gender != Unit's Party Gender
0005ca84: 00000000 nop
0005ca88: 90a200cf lbu r2,0x00cf(r5)		Load Unit's Name ID (high bit)
0005ca8c: 90a300ce lbu r3,0x00ce(r5)		Load Unit's Name ID
0005ca90: 00021200 sll r2,r2,0x08		High Bit * 256
0005ca94: 00621825 or r3,r3,r2			Name ID + High Bit * 256
0005ca98: 14640004 bne r3,r4,0x 0005caac		Branch if Name ID != Chosen Name
0005ca9c: 24c60001 addiu r6,r6,0x0001		Counter ++
0005caa0: 080172ae j 0x 0005cab8
0005caa4: 00008021 addu r16,r0,r0		r16 = 0 (Another Party Unit has this name)
0005caa8: 24c60001 addiu r6,r6,0x0001		Counter ++
0005caac: 28c20014 slti r2,r6,0x0014
0005cab0: 1440ffec bne r2,r0,0x 0005ca64		Branch if Counter < 20
0005cab4: 24a50100 addiu r5,r5,0x0100		Party Data Pointer += 0x100
0005cab8: 00003021 addu r6,r0,r0		Counter = 0
0005cabc: 30e5ffff andi r5,r7,0xffff		r5 = Unit's Chosen Name
0005cac0: 3c038019 lui r3,0x8019
0005cac4: 246308cc addiu r3,r3,0x08cc		r3 = Unit Data Pointer
0005cac8: 90620006 lbu r2,0x0006(r3)		Load Unit's Gender
0005cacc: 00000000 nop
0005cad0: 304200e0 andi r2,r2,0x00e0
0005cad4: 16620007 bne r19,r2,0x 0005caf4	Branch if Gender != Gender
0005cad8: 00000000 nop
0005cadc: 9462016c lhu r2,0x016c(r3)		Load Unit's Name ID
0005cae0: 00000000 nop
0005cae4: 14450003 bne r2,r5,0x 0005caf4		Branch if Name ID != Chosen Name
0005cae8: 00000000 nop
0005caec: 080172c1 j 0x 0005cb04
0005caf0: 00008021 addu r16,r0,r0		r16 = 0 (Another Battle Unit has this name)
0005caf4: 24c60001 addiu r6,r6,0x0001		Counter ++
0005caf8: 28c20015 slti r2,r6,0x0015
0005cafc: 1440fff2 bne r2,r0,0x 0005cac8		Branch if Counter < 21
0005cb00: 246301c0 addiu r3,r3,0x01c0		Pointer += 0x1c0
0005cb04: 1200ffcc beq r16,r0,0x 0005ca38	Branch if Another Unit has the chosen name
0005cb08: 00000000 nop
0005cb0c: a647016c sh r7,0x016c(r18)		Store Unit's Chosen Name ID
0005cb10: 30e400ff andi r4,r7,0x00ff		r4 = Chosen Name
0005cb14: 02a0f809 jalr r21,r31			Prep for Loading Text
0005cb18: 02242021 addu r4,r17,r4		r4 = Chosen Name + Name Flags
0005cb1c: 080172cd j 0x 0005cb34
0005cb20: 00402021 addu r4,r2,r0		r4 = Text Pointer
0005cb24: 0c0166bc jal 0x 00059af0		Get Party Data Pointer
0005cb28: 00000000 nop
0005cb2c: 244200be addiu r2,r2,0x00be		Unit's Party Name Pointer
0005cb30: 00402021 addu r4,r2,r0		r4 = "
0005cb34: 2645012c addiu r5,r18,0x012c		r5 = Unit's Name Pointer
0005cb38: 0c017319 jal 0x 0005cc64		Store X into Y (Unit's Name)
0005cb3c: 34060010 ori r6,r0,0x0010		Limit = 16
0005cb40: 92440003 lbu r4,0x0003(r18)		Load Unit's Job ID
0005cb44: 02a0f809 jalr r21,r31			Prep for Loading Text
0005cb48: 34843000 ori r4,r4,0x3000		Job ID + 0x3000 (Job Names)
0005cb4c: 00402021 addu r4,r2,r0		r4 = Text Pointer
0005cb50: 2645013c addiu r5,r18,0x013c		r5 = Unit's Job Name Pointer
0005cb54: 0c017319 jal 0x 0005cc64		Store X into Y (Job Name)
0005cb58: 34060010 ori r6,r0,0x0010		Limit = 16
0005cb5c: 92440012 lbu r4,0x0012(r18)		Load Unit's Primary Skillset
0005cb60: 02a0f809 jalr r21,r31			Prep for Loading Text
0005cb64: 34841000 ori r4,r4,0x1000		Primary Skillset ID += 0x1000 (Skillset Name)
0005cb68: 00402021 addu r4,r2,r0		r4 = Text Pointer
0005cb6c: 2645014c addiu r5,r18,0x014c		r5 = Pointer to Unit's Primary Skillset Name
0005cb70: 0c017319 jal 0x 0005cc64		Store X into Y (Primary Skillset Name)
0005cb74: 34060008 ori r6,r0,0x0008		Limit = 8
0005cb78: 92440013 lbu r4,0x0013(r18)		Load Unit's Secondary Skillset ID
0005cb7c: 02a0f809 jalr r21,r31			Prep for Loading Text
0005cb80: 34841000 ori r4,r4,0x1000		Secondary Skillset ID += 0x1000 (skillset Name)
0005cb84: 00402021 addu r4,r2,r0		r4 = Text Pointer
0005cb88: 26450154 addiu r5,r18,0x0154		r5 = Pointer to Unit's Secondary Skillset Name
0005cb8c: 0c017319 jal 0x 0005cc64		Store X into Y (Secondary Skillset Name)
0005cb90: 34060008 ori r6,r0,0x0008		Limit = 8
0005cb94: 264401a7 addiu r4,r18,0x01a7		r4 = Pointer to Unit's Attack's Status Infliction
0005cb98: 0c017991 jal 0x 0005e644		Data Nullifying (Attack's Status Infliction/Removal)
0005cb9c: 3405000a ori r5,r0,0x000a		Limit = 10
0005cba0: 8fbf0130 lw r31,0x0130(r29)
0005cba4: 8fb7012c lw r23,0x012c(r29)
0005cba8: 8fb60128 lw r22,0x0128(r29)
0005cbac: 8fb50124 lw r21,0x0124(r29)
0005cbb0: 8fb40120 lw r20,0x0120(r29)
0005cbb4: 8fb3011c lw r19,0x011c(r29)
0005cbb8: 8fb20118 lw r18,0x0118(r29)
0005cbbc: 8fb10114 lw r17,0x0114(r29)
0005cbc0: 8fb00110 lw r16,0x0110(r29)
0005cbc4: 27bd0138 addiu r29,r29,0x0138
0005cbc8: 03e00008 jr r31
0005cbcc: 00000000 nop


Return Locations

0005ab2c: Equipment/Move/Jump +X/Name Storing/Generation