Load Event

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: LOAD EVENT
#       Parameters:
#           r4 = (eventID) Event ID 

8013c9c0: 27bdffe0 addiu r29,r29,-0x0020
8013c9c4: afb10014 sw r17,0x0014(r29)
8013c9c8: 3c118004 lui r17,0x8004
8013c9cc: 26314694 addiu r17,r17,0x4694             #   0x80044694
8013c9d0: afb00010 sw r16,0x0010(r29)
8013c9d4: 00048080 sll r16,r4,0x02                  #   eventID * 4
8013c9d8: afbf0018 sw r31,0x0018(r29)
                                                    #   do {
8013c9dc: 0c0532a0 jal 0x8014ca80                   #       Switch To Next Thread ();
8013c9e0: 00000000 nop
8013c9e4: 3c018017 lui r1,0x8017
8013c9e8: ac313ca8 sw r17,0x3ca8(r1)                #       functionPtr = 0x80044694        // Load Data From Disc (0x44694)
8013c9ec: 26040e7b addiu r4,r16,0x0e7b              #       (eventID * 4) + 3707            // LBA = TEST.EVT LBA + (eventID * 4)
8013c9f0: 3c068005 lui r6,0x8005
8013c9f4: 24c6a6bc addiu r6,r6,-0x5944              #       baseEventPtr = 0x8004a6bc
8013c9f8: 0c0533ad jal 0x8014ceb4                   #       result = Call Inner Subroutine ((eventID * 4) + 3707, 0x2000, baseEventPtr);
8013c9fc: 34052000 ori r5,r0,0x2000                 #       0x2000 (Number of bytes to load)
8013ca00: 1440fff6 bne r2,r0,0x8013c9dc             #   } while (result != 0);
8013ca04: 00000000 nop
8013ca08: 3c108004 lui r16,0x8004
8013ca0c: 261046c8 addiu r16,r16,0x46c8             #   0x800446c8
                                                    #   do {
8013ca10: 0c0532a0 jal 0x8014ca80                   #       Switch To Next Thread ();
8013ca14: 00000000 nop
8013ca18: 3c018017 lui r1,0x8017
8013ca1c: ac303ca8 sw r16,0x3ca8(r1)                #       functionPtr = 0x800446c8        // Checks *0x8004eaf8, result of loading from disc
8013ca20: 0c0533ad jal 0x8014ceb4                   #       result = Call Inner Subroutine ();
8013ca24: 00000000 nop
8013ca28: 1440fff9 bne r2,r0,0x8013ca10             #   } while (result != 0);              // Loop until loading is complete
8013ca2c: 3c04f2f2 lui r4,0xf2f2
8013ca30: 3c038017 lui r3,0x8017
8013ca34: 8c633ca4 lw r3,0x3ca4(r3)                 #   event
8013ca38: 00000000 nop
8013ca3c: 8c620000 lw r2,0x0000(r3)                 #   event.TextOffset
8013ca40: 3484f2f2 ori r4,r4,0xf2f2                 #   0xf2f2f2f2
8013ca44: 10440004 beq r2,r4,0x8013ca58
8013ca48: 00431021 addu r2,r2,r3                    #   event + event.TextOffset
                                                    #   if (event.TextOffset != 0xf2f2f2f2) {
8013ca4c: 3c018017 lui r1,0x8017
8013ca50: ac223f8c sw r2,0x3f8c(r1)                 #       textDataPtr = event + event.TextOffset
8013ca54: ac640000 sw r4,0x0000(r3)                 #       event.TextOffset = 0xf2f2f2f2
                                                    #   }
8013ca58: 8fbf0018 lw r31,0x0018(r29)
8013ca5c: 8fb10014 lw r17,0x0014(r29)
8013ca60: 8fb00010 lw r16,0x0010(r29)
8013ca64: 27bd0020 addiu r29,r29,0x0020
8013ca68: 03e00008 jr r31
8013ca6c: 00000000 nop