Initialize Unit's Battle Data
Jump to navigation
Jump to search
Initialize Unit's Battle Data 0005b0d0: 27bdffe0 addiu r29,r29,0xffe0 (very badly done) 0005b0d4: afb10014 sw r17,0x0014(r29) 0005b0d8: 00808821 addu r17,r4,r0 r17 = Unit's Data Pointer 0005b0dc: afb00010 sw r16,0x0010(r29) 0005b0e0: 00a08021 addu r16,r5,r0 r16 = Unit's Party Data Pointer 0005b0e4: afbf0018 sw r31,0x0018(r29) 0005b0e8: 92020000 lbu r2,0x0000(r16) Load Unit's Sprite Set 0005b0ec: 00000000 nop 0005b0f0: 2c420004 sltiu r2,r2,0x0004 0005b0f4: 10400002 beq r2,r0,0x 0005b100 Branch if Sprite Set isn't Ramza 0005b0f8: 34030008 ori r3,r0,0x0008 ENTD Flags = 0x8 (Control) 0005b0fc: 3403000b ori r3,r0,0x000b ENTD Flags = 0xb (Control, 0x01 and 0x02) 0005b100: a223 0005 sb r3,0x 0005(r17) Store Unit's ENTD Flags 0005b104: a22301ba sb r3,0x01ba(r17) Store Unit's Modified ENTD Flags 0005b108: 92020000 lbu r2,0x0000(r16) Load Unit's Sprite Set 0005b10c: 00000000 nop 0005b110: a2220000 sb r2,0x0000(r17) Store Unit's Sprite Set 0005b114: 92020001 lbu r2,0x0001(r16) Load Unit's Party ID 0005b118: 00000000 nop 0005b11c: a2220002 sb r2,0x0002(r17) Store Unit's Party ID 0005b120: 92020002 lbu r2,0x0002(r16) Load Unit's Job ID 0005b124: 00000000 nop 0005b128: a2220003 sb r2,0x0003(r17) Store Unit's Job ID 0005b12c: 92020001 lbu r2,0x0001(r16) Load Unit's Party ID 0005b130: 92030003 lbu r3,0x0003(r16) Load Unit's Palette 0005b134: 2c420010 sltiu r2,r2,0x0010 0005b138: 10400002 beq r2,r0,0x 0005b144 Branch if Unit isn't in the Main Party 0005b13c: 2604000e addiu r4,r16,0x000e r4 = Unit's Party Equipment Data Pointer 0005b140: 00001821 addu r3,r0,r0 r3 = 0 (default Palette) 0005b144: a2230004 sb r3,0x0004(r17) Store Unit's Palette 0005b148: 92020004 lbu r2,0x0004(r16) Load Unit's Gender Byte 0005b14c: 2625001a addiu r5,r17,0x001a r5 = Unit's Equipment Data Pointer 0005b150: a2220006 sb r2,0x0006(r17) Store Unit's Gender Byte 0005b154: 92020006 lbu r2,0x0006(r16) Load Unit's Zodiac Sign 0005b158: 9203 0005 lbu r3,0x 0005(r16) Load Unit's Birthday (could load/store as halfword) 0005b15c: 00021200 sll r2,r2,0x08 Zodiac Sign * 256 0005b160: 00621821 addu r3,r3,r2 Zodiac Sign * 256 + Birthday 0005b164: 96220008 lhu r2,0x0008(r17) Load Unit's Birthday + Zodiac Sign 0005b168: 306301ff andi r3,r3,0x01ff r3 = Unit's Birthday 0005b16c: 3042fe00 andi r2,r2,0xfe00 r2 = Unit's Zodiac Sign 0005b170: 00431025 or r2,r2,r3 r2 = Unit's Birthday + Zodiac Sign 0005b174: a6220008 sh r2,0x0008(r17) Store Unit's Birthday + Zodiac Sign 0005b178: 92030006 lbu r3,0x0006(r16) Load Unit's Zodiac Sign 0005b17c: 30420fff andi r2,r2,0x0fff r2 = Unit's Birthday 0005b180: 00031902 srl r3,r3,0x04 Zodiac Sign / 16 0005b184: 00031b00 sll r3,r3,0x0c Zodiac Sign / 16 * 4096 0005b188: 00431025 or r2,r2,r3 r2 = Zodiac Sign / 16 * 4096 + Unit's Birthday 0005b18c: a6220008 sh r2,0x0008(r17) Store Unit's Birthday + Zodiac Sign 0005b190: 92020007 lbu r2,0x0007(r16) Load Unit's Secondary Skillset 0005b194: 34060007 ori r6,r0,0x0007 Limit = 7 0005b198: a2220013 sb r2,0x0013(r17) Store Unit's Secondary Skillset 0005b19c: 92020009 lbu r2,0x0009(r16) Load Unit's Reaction Ability (high bit) 0005b1a0: 92030008 lbu r3,0x0008(r16) Load Unit's Reaction Ability 0005b1a4: 00021200 sll r2,r2,0x08 High Bit * 256 0005b1a8: 00621821 addu r3,r3,r2 Reaction Ability + High Bit * 256 0005b1ac: a6230014 sh r3,0x0014(r17) Store Unit's Reaction ID 0005b1b0: 9202000b lbu r2,0x000b(r16) Load Unit's Support Ability (high Bit) 0005b1b4: 9203000a lbu r3,0x000a(r16) Load Unit's Support Ability 0005b1b8: 00021200 sll r2,r2,0x08 High Bit * 256 0005b1bc: 00621821 addu r3,r3,r2 Support Ability + High Bit * 256 0005b1c0: a6230016 sh r3,0x0016(r17) Store Unit's Support Ability ID 0005b1c4: 9202000d lbu r2,0x000d(r16) Load Unit's Movement Ability (high bit) 0005b1c8: 9203000c lbu r3,0x000c(r16) Load Unit's Movement Ability 0005b1cc: 00021200 sll r2,r2,0x08 High Bit * 256 0005b1d0: 00621821 addu r3,r3,r2 Movement Ability + High Bit * 256 0005b1d4: 0c017895 jal 0x 0005e254 Store X Byte into Y (Equipment ID's) 0005b1d8: a6230018 sh r3,0x0018(r17) Store Unit's Movement Ability ID 0005b1dc: 92020015 lbu r2,0x0015(r16) Load Unit's Experience (could have raised limit to 9) 0005b1e0: 00000000 nop 0005b1e4: a2220021 sb r2,0x0021(r17) Store Unit's Experience 0005b1e8: 92020016 lbu r2,0x0016(r16) Load Unit's Level 0005b1ec: 26040019 addiu r4,r16,0x0019 r4 = Pointer to Unit's Party Raw HP 0005b1f0: a2220022 sb r2,0x0022(r17) Store Unit's Level 0005b1f4: 92020017 lbu r2,0x0017(r16) Load Unit's Brave 0005b1f8: 26250072 addiu r5,r17,0x0072 r5 = Pointer to Unit's Raw HP 0005b1fc: a2220024 sb r2,0x0024(r17) Store Unit's Brave 0005b200: a2220023 sb r2,0x0023(r17) Store Unit's Original Brave 0005b204: 92020018 lbu r2,0x0018(r16) Load Unit's Faith 0005b208: 3406000f ori r6,r0,0x000f Limit = 0xF 0005b20c: a2220026 sb r2,0x0026(r17) Store Unit's Faith 0005b210: 0c017895 jal 0x 0005e254 Store X Byte into Y (Raw Stats) 0005b214: a2220025 sb r2,0x0025(r17) Store Unit's Original Faith 0005b218: 00002021 addu r4,r0,r0 Counter = 0 0005b21c: 02241821 addu r3,r17,r4 r3 = Unit's Data Pointer + Counter 0005b220: 02041021 addu r2,r16,r4 r2 = Unit's Party Data Pointer + Counter 0005b224: 90420028 lbu r2,0x0028(r2) Load Unit's Unlocked Jobs 0005b228: 24840001 addiu r4,r4,0x0001 Counter ++ 0005b22c: a0620096 sb r2,0x0096(r3) Store Unit's Unlocked Jobs 0005b230: 28820003 slti r2,r4,0x0003 (could add this to below) 0005b234: 1440fffa bne r2,r0,0x 0005b220 Branch if Counter < 3 0005b238: 02241821 addu r3,r17,r4 r3 = Unit's Data Pointer + Counter 0005b23c: 2604002b addiu r4,r16,0x002b r4 = Unit's Party Action Abilities 0005b240: 26250099 addiu r5,r17,0x0099 r5 = Unit's Action Abilities 0005b244: 0c017895 jal 0x 0005e254 Store X Byte into Y (Job Abilities) 0005b248: 34060039 ori r6,r0,0x0039 Limit = 0x39 (Limit = 9c would also work, including above) 0005b24c: 26040064 addiu r4,r16,0x0064 r4 = Unit's Party Job Levels 0005b250: 262500d2 addiu r5,r17,0x00d2 r5 = Unit's Job Levels 0005b254: 0c017895 jal 0x 0005e254 Store X Byte into Y (Job Levels) 0005b258: 3406000a ori r6,r0,0x000a Limit = 0xa 0005b25c: 2604006e addiu r4,r16,0x006e r4 = Unit's Party JP 0005b260: 262500dc addiu r5,r17,0x00dc r5 = Unit's JP 0005b264: 0c017895 jal 0x 0005e254 Store X Byte into Y (JP/Total JP) 0005b268: 34060050 ori r6,r0,0x0050 Limit = 0x50 0005b26c: 260400be addiu r4,r16,0x00be r4 = Unit's Party Name 0005b270: 2625012c addiu r5,r17,0x012c r5 = Unit's Name 0005b274: 0c017895 jal 0x 0005e254 Store X Byte into Y (Unit's Name) 0005b278: 34060010 ori r6,r0,0x0010 Limit = 0x10 0005b27c: 26240165 addiu r4,r17,0x0165 r4 = Unit's ENTD AI Data 0005b280: 34050007 ori r5,r0,0x0007 Limit = 7 0005b284: 920200cf lbu r2,0x00cf(r16) Load Unit's Name ID (high bit) 0005b288: 920300ce lbu r3,0x00ce(r16) Load Unit's Name ID 0005b28c: 00021200 sll r2,r2,0x08 High Bit * 256 0005b290: 00621821 addu r3,r3,r2 Name ID + High Bit * 256 0005b294: 0c017991 jal 0x 0005e644 Data Nullifying (ENTD AI Data) 0005b298: a623016c sh r3,0x016c(r17) Store Unit's Name ID 0005b29c: 8fbf0018 lw r31,0x0018(r29) 0005b2a0: 8fb10014 lw r17,0x0014(r29) 0005b2a4: 8fb00010 lw r16,0x0010(r29) 0005b2a8: 27bd0020 addiu r29,r29,0x0020 0005b2ac: 03e00008 jr r31 0005b2b0: 00000000 nop