ENTD Open - Initialize Unit Data

From Final Fantasy Hacktics Wiki
(Redirected from 00042930 - 00042a0c)
Jump to navigation Jump to search

r4 = current event ID

00042930: 27bdffe0 addiu r29,r29,0xffe0
00042934: afbf0018 sw r31,0x0018(r29)
00042938: afb10014 sw r17,0x0014(r29)
0004293c: afb00010 sw r16,0x0010(r29)
00042940: 3c018004 lui r1,0x8004
00042944: ac247600 sw r4,0x7600(r1)                    store current event ID
00042948: 0c0109e9 jal 0x000427a4                      Open ENTD with event ID
0004294c: 00000000 nop
00042950: 14400009 bne r2,r0,0x00042978                branch if legal event
00042954: 2410ffff addiu r16,r0,0xffff
00042958: 0c0076ea jal 0x0001dba8                      VSync call
0004295c: 00002021 addu r4,r0,r0
00042960: 3c048005 lui r4,0x8005
00042964: 2484eaf4 addiu r4,r4,0xeaf4                  file header address
00042968: 0c00478e jal 0x00011e38                      Open File to RAM Centre
0004296c: 00000000 nop
00042970: 08010a52 j 0x00042948                        loop forever
00042974: 00000000 nop
00042978: 0c010a20 jal 0x00042880			Get Current ENTD Data Pointer
0004297c: 00000000 nop
00042980: 00408821 addu r17,r2,r0
00042984: 1230001c beq r17,r16,0x000429f8
00042988: 00000000 nop
0004298c: 12200012 beq r17,r0,0x000429d8		branch if no ENTD data pointer
00042990: 00000000 nop
00042994: 0c0166b2 jal 0x00059ac8			Initialize Party ID to FF 
00042998: 00008021 addu r16,r0,r0
0004299c: 02202021 addu r4,r17,r0			ENTD data pointer
000429a0: 02002821 addu r5,r16,r0			#appears to be a loop
000429a4: 00003021 addu r6,r0,r0			No guest party members
000429a8: 0c0166c6 jal 0x00059b18			Unit Initialization
000429ac: 34070001 ori r7,r0,0x0001			initialization flag = 1 (initialize units for battle)
000429b0: 26100001 addiu r16,r16,0x0001		counter ++ (unit ENTD ID)
000429b4: 2a020010 slti r2,r16,0x0010			set while less than 16 (battle cap)
000429b8: 1440fff9 bne r2,r0,0x000429a0		#Loop back
000429bc: 02202021 addu r4,r17,r0
000429c0: 3c048004 lui r4,0x8004
000429c4: 8c847604 lw r4,0x7604(r4)                    size of event?
000429c8: 0c011273 jal 0x000449cc                      C52 Free but with extra steps
000429cc: 00000000 nop
000429d0: 08010a7e j 0x000429f8                        RETURN
000429d4: 00000000 nop
000429d8: 0c0076ea jal 0x0001dba8                      VSync call
000429dc: 00002021 addu r4,r0,r0
000429e0: 3c048005 lui r4,0x8005
000429e4: 2484eaf4 addiu r4,r4,0xeaf4                  open file header address
000429e8: 0c00478e jal 0x00011e38                      Open File to RAM Centre
000429ec: 00000000 nop
000429f0: 08010a5e j 0x00042978                        loop forever
000429f4: 00000000 nop
000429f8: 8fbf0018 lw r31,0x0018(r29)
000429fc: 8fb10014 lw r17,0x0014(r29)
00042a00: 8fb00010 lw r16,0x0010(r29)
00042a04: 27bd0020 addiu r29,r29,0x0020
00042a08: 03e00008 jr r31
00042a0c: 00000000 nop