Focus Event Instruction

From Final Fantasy Hacktics Wiki
Revision as of 00:34, 18 May 2018 by Glain (talk | contribs) (Created page with " # ROUTINE: FOCUS EVENT INSTRUCTION # Parameters: # r4 = (params) Event instruction parameters 80147584: 27bdffa8 addiu r29,r29,-0x0058 80147588: afb10...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: FOCUS EVENT INSTRUCTION
#       Parameters:
#           r4 = (params) Event instruction parameters

80147584: 27bdffa8 addiu r29,r29,-0x0058
80147588: afb10034 sw r17,0x0034(r29)
8014758c: 00808821 addu r17,r4,r0                   #   eventDataPtr = params
80147590: afbf0050 sw r31,0x0050(r29)
80147594: afb7004c sw r23,0x004c(r29)
80147598: afb60048 sw r22,0x0048(r29)
8014759c: afb50044 sw r21,0x0044(r29)
801475a0: afb40040 sw r20,0x0040(r29)
801475a4: afb3003c sw r19,0x003c(r29)
801475a8: afb20038 sw r18,0x0038(r29)
801475ac: 0c05181e jal 0x80146078                   #   unit1ID = Load Halfword (eventDataPtr);
801475b0: afb00030 sw r16,0x0030(r29)
801475b4: 0040a021 addu r20,r2,r0                   #   unit1ID
801475b8: 26310002 addiu r17,r17,0x0002             #   eventDataPtr = eventDataPtr + 2
801475bc: 0c05181e jal 0x80146078                   #   unit2ID = Load Halfword (eventDataPtr);
801475c0: 02202021 addu r4,r17,r0
801475c4: 00409821 addu r19,r2,r0                   #   unit2ID
801475c8: 26310002 addiu r17,r17,0x0002             #   eventDataPtr + eventDataPtr + 2
801475cc: 92370000 lbu r23,0x0000(r17)              #   unknownParam = *eventDataPtr
801475d0: 26310001 addiu r17,r17,0x0001             #   eventDataPtr = eventDataPtr + 1                 // Points to next event instruction
801475d4: 92230000 lbu r3,0x0000(r17)               #   eventInstructionID = *eventDataPtr
801475d8: 34020019 ori r2,r0,0x0019
801475dc: 1062000c beq r3,r2,0x80147610             #   if (eventInstructionID != 0x19) {               // 0x19 = Camera
801475e0: 34030019 ori r3,r0,0x0019
                                                    #       do {
801475e4: 92220000 lbu r2,0x0000(r17)               #           eventInstructionID
801475e8: 3c018015 lui r1,0x8015
801475ec: 00220821 addu r1,r1,r2
801475f0: 9022d170 lbu r2,-0x2e90(r1)               #           eventParameterLengthArray[eventInstructionID]
801475f4: 00000000 nop
801475f8: 24420001 addiu r2,r2,0x0001               #           eventParameterLengthArray[eventInstructionID] + 1
801475fc: 02228821 addu r17,r17,r2                  #           eventDataPtr = eventDataPtr + eventParameterLengthArray[eventInstructionID] + 1
80147600: 92220000 lbu r2,0x0000(r17)               #           eventInstructionID = *eventDataPtr
80147604: 00000000 nop
80147608: 1443fff6 bne r2,r3,0x801475e4             #       } while (eventInstructionID != 0x19);
8014760c: 00000000 nop                              #   }                                                 
80147610: 26310001 addiu r17,r17,0x0001             #   eventDataPtr = eventDataPtr + 1
80147614: 00141400 sll r2,r20,0x10
80147618: 0002ac03 sra r21,r2,0x10                  #   unit1ID
8014761c: 02a02021 addu r4,r21,r0
80147620: 00131400 sll r2,r19,0x10
80147624: 0c04cc56 jal 0x80133158                   #   unit1MiscID = Get misc ID (unit1ID);
80147628: 0002b403 sra r22,r2,0x10                  #   unit2ID
8014762c: 00408021 addu r16,r2,r0                   #   unit1MiscID
80147630: 0200a021 addu r20,r16,r0                  #   unit1MiscID
80147634: 0c04cc56 jal 0x80133158                   #   unit2MiscID = Get misc ID (unit2ID);
80147638: 02c02021 addu r4,r22,r0
8014763c: 00108400 sll r16,r16,0x10
80147640: 00102403 sra r4,r16,0x10                  #   unit1MiscID
80147644: 340307d0 ori r3,r0,0x07d0                 #   0x07d0
80147648: 10830005 beq r4,r3,0x80147660             
8014764c: 00409821 addu r19,r2,r0                   #   unit2MiscID
80147650: 00021400 sll r2,r2,0x10
80147654: 00029403 sra r18,r2,0x10
80147658: 16430008 bne r18,r3,0x8014767c            #   if ((unit1MiscID == 0x07d0) or (unit2MiscID == 0x07d0)) {
8014765c: 00000000 nop                              
80147660: 340200c0 ori r2,r0,0x00c0
80147664: a222ffff sb r2,-0x0001(r17)               #       *(eventDataPtr - 1) = 0xc0              // Overwrite camera event instruction ID with 0xc0?  
80147668: 34040007 ori r4,r0,0x0007
8014766c: 0c011280 jal 0x80044a00                   #       Blank Routine (0x44a00) (7, 0);     // Blank routine; does nothing.
80147670: 00002821 addu r5,r0,r0
80147674: 08051dd4 j 0x80147750                     #       return;
80147678: 00000000 nop                              #   }
8014767c: 0c04cc39 jal 0x801330e4                   #   Copy Unit Screen Location Data (unit1MiscID, unit1ScreenData);
80147680: 27a50010 addiu r5,r29,0x0010              #   unit1ScreenData
80147684: 02402021 addu r4,r18,r0
80147688: 0c04cc39 jal 0x801330e4                   #   Copy Unit Screen Location Data (unit2MiscID, unit2ScreenData);
8014768c: 27a50020 addiu r5,r29,0x0020              #   unit2ScreenData
80147690: 8fa30014 lw r3,0x0014(r29)                #   oldUnit1Z = unit1ScreenData.Z
80147694: 8fa40024 lw r4,0x0024(r29)                #   oldUnit2Z = unit2ScreenData.Z
80147698: 24620020 addiu r2,r3,0x0020               #   oldUnit1Z + 32
8014769c: afa20014 sw r2,0x0014(r29)                #   unit1ScreenData.Z = oldUnit1Z + 32
801476a0: 24820020 addiu r2,r4,0x0020               #   oldUnit2Z + 32
801476a4: afa20024 sw r2,0x0024(r29)                #   unit2ScreenData.Z = oldUnit2Z + 32
801476a8: 34020049 ori r2,r0,0x0049
801476ac: 16a20006 bne r21,r2,0x801476c8            #   if (unit1ID == 0x49) {          // 0x49 = Arch Angel
801476b0: 34020041 ori r2,r0,0x0041
801476b4: 2462ffd0 addiu r2,r3,-0x0030              #       oldUnit1Z - 48    
801476b8: afa20014 sw r2,0x0014(r29)                #       unit1ScreenData.Z = oldUnit1Z - 48
801476bc: 2482ffd0 addiu r2,r4,-0x0030              #       oldUnit2Z - 48
801476c0: afa20024 sw r2,0x0024(r29)                #       unit2ScreenData.Z = oldUnit2Z - 48
801476c4: 34020041 ori r2,r0,0x0041
                                                    #   }
801476c8: 16c20007 bne r22,r2,0x801476e8            
801476cc: 00009021 addu r18,r0,r0                   #   count = 0 
                                                    #   if (unit2ID == 0x41) {          //  0x41 = Holy Angel
801476d0: 8fa20014 lw r2,0x0014(r29)                #       unit1ScreenData.Z
801476d4: 8fa30024 lw r3,0x0024(r29)                #       unit2ScreenData.Z
801476d8: 2442ffe0 addiu r2,r2,-0x0020              #       unit1ScreenData.Z - 32
801476dc: 2463ffe0 addiu r3,r3,-0x0020              #       unit2ScreenData.Z - 32
801476e0: afa20014 sw r2,0x0014(r29)                #       unit1ScreenData.Z = unit1ScreenData.Z - 32
801476e4: afa30024 sw r3,0x0024(r29)                #       unit2ScreenData.Z = unit2ScreenData.Z - 32
                                                    #   }
801476e8: 27b00010 addiu r16,r29,0x0010             #   loopScreenDataPtr = unit1ScreenData
801476ec: 02202021 addu r4,r17,r0                   #   oldEventDataPtr = eventDataPtr
                                                    #   do {
801476f0: 26310002 addiu r17,r17,0x0002             #       eventDataPtr = eventDataPtr + 2
801476f4: 8e020000 lw r2,0x0000(r16)                #       unit1CoordValue = *loopScreenDataPtr
801476f8: 8e030010 lw r3,0x0010(r16)                #       unit2CoordValue = *(loopScreenDataPtr + 16)
801476fc: 26520001 addiu r18,r18,0x0001             #       count = count + 1
80147700: 00431021 addu r2,r2,r3                    #       unit1CoordValue + unit2CoordValue
80147704: 00021040 sll r2,r2,0x01                   #       (unit1CoordValue + unit2CoordValue) * 2
80147708: ae020000 sw r2,0x0000(r16)                #       *loopScreenDataPtr = (unit1CoordValue + unit2CoordValue) * 2
8014770c: 86050000 lh r5,0x0000(r16)                #       *loopScreenDataPtr
80147710: 0c051825 jal 0x80146094                   #       Store Halfword (oldEventDataPtr, *loopScreenDataPtr);
80147714: 26100004 addiu r16,r16,0x0004             #       loopScreenDataPtr = loopScreenDataPtr + 4       // Move to next coordinate
80147718: 2a420003 slti r2,r18,0x0003
8014771c: 1440fff4 bne r2,r0,0x801476f0
80147720: 02202021 addu r4,r17,r0                   #       oldEventDataPtr = eventDataPtr
                                                    #   } while (count < 3);
80147724: 16e0000a bne r23,r0,0x80147750
80147728: 26310002 addiu r17,r17,0x0002             #   eventDataPtr = eventDataPtr + 2
                                                    #   if (unknownParam == 0) {                            // Change map rotation value?
8014772c: 00142400 sll r4,r20,0x10
80147730: 00042403 sra r4,r4,0x10                   #       unit1MiscID
80147734: 00132c00 sll r5,r19,0x10
80147738: 0c051cc6 jal 0x80147318                   #       result_0x147318 = ? 0x147318 (unit1MiscID, unit2MiscID);
8014773c: 00052c03 sra r5,r5,0x10                   #       unit2MiscID
80147740: 02202021 addu r4,r17,r0                   #       eventDataPtr
80147744: 00021400 sll r2,r2,0x10                   
80147748: 0c051825 jal 0x80146094                   #       Store Halfword (eventDataPtr, result_0x147318);
8014774c: 00022c03 sra r5,r2,0x10                   #       result_0x147318
                                                    #   }
80147750: 8fbf0050 lw r31,0x0050(r29)
80147754: 8fb7004c lw r23,0x004c(r29)
80147758: 8fb60048 lw r22,0x0048(r29)
8014775c: 8fb50044 lw r21,0x0044(r29)
80147760: 8fb40040 lw r20,0x0040(r29)
80147764: 8fb3003c lw r19,0x003c(r29)
80147768: 8fb20038 lw r18,0x0038(r29)
8014776c: 8fb10034 lw r17,0x0034(r29)
80147770: 8fb00030 lw r16,0x0030(r29)
80147774: 27bd0058 addiu r29,r29,0x0058
80147778: 03e00008 jr r31
8014777c: 00000000 nop