Camera Event Instruction

From Final Fantasy Hacktics Wiki
Revision as of 05:17, 4 May 2018 by Glain (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: CAMERA EVENT INSTRUCTION (0x19)

80146110: 27bdff58 addiu r29,r29,-0x00a8
80146114: 3c028016 lui r2,0x8016
80146118: 8c426054 lw r2,0x6054(r2)             #   *0x80166054
8014611c: 34040004 ori r4,r0,0x0004             #   4
80146120: afb50094 sw r21,0x0094(r29)
80146124: 0000a821 addu r21,r0,r0               #   count = 0
80146128: afb10084 sw r17,0x0084(r29)
8014612c: 27b10010 addiu r17,r29,0x0010         #   parameterArrayElementPtr = sp + 0x10
80146130: afbf00a4 sw r31,0x00a4(r29)
80146134: afbe00a0 sw r30,0x00a0(r29)
80146138: afb7009c sw r23,0x009c(r29)
8014613c: afb60098 sw r22,0x0098(r29)
80146140: afb40090 sw r20,0x0090(r29)
80146144: afb3008c sw r19,0x008c(r29)
80146148: afb20088 sw r18,0x0088(r29)
8014614c: afb00080 sw r16,0x0080(r29)
80146150: 30480003 andi r8,r2,0x0003            #   *0x80166054 & 0x03
80146154: 3043000c andi r3,r2,0x000c            #   *0x80166054 & 0x0c
80146158: 00031883 sra r3,r3,0x02               #   (*0x80166054 & 0x0c) >> 2
8014615c: 304200f0 andi r2,r2,0x00f0            #   *0x80166054 & 0xf0
80146160: 00021103 sra r2,r2,0x04               #   (*0x80166054 & 0xf0) >> 4
80146164: afa80068 sw r8,0x0068(r29)            #   *0x80166054 & 0x03
80146168: afa30058 sw r3,0x0058(r29)            #   (*0x80166054 & 0x0c) >> 2   
8014616c: 0c052752 jal 0x80149d48               #   ROUTINE: Set Thread Task ID (4);
80146170: afa20060 sw r2,0x0060(r29)            #   (*0x80166054 & 0xf0) >> 4   
80146174: 0c0532f0 jal 0x8014cbc0               #   ROUTINE: firstParam = Get First Thread Parameter ();
80146178: 00000000 nop
8014617c: 00408021 addu r16,r2,r0               #   value = firstParam
                                                #   do {
80146180: 0c05181e jal 0x80146078               #       ROUTINE: parameterValue = Load Halfword (value)
80146184: 02002021 addu r4,r16,r0               #       value
80146188: 00021400 sll r2,r2,0x10
8014618c: 00021403 sra r2,r2,0x10
80146190: ae220000 sw r2,0x0000(r17)            #       *parameterArrayElementPtr = parameterValue
80146194: 26100002 addiu r16,r16,0x0002         #       value = value + 2
80146198: 26b50001 addiu r21,r21,0x0001         #       count = count + 1
8014619c: 2aa20008 slti r2,r21,0x0008
801461a0: 1440fff7 bne r2,r0,0x80146180
801461a4: 26310004 addiu r17,r17,0x0004         #       parameterArrayElementPtr = parameterArrayElementPtr + 4
                                                #   } while (count < 8)
801461a8: 3c028017 lui r2,0x8017
801461ac: 8c4296f8 lw r2,-0x6908(r2)            #   *0x801696f8
801461b0: 00000000 nop
801461b4: 10400019 beq r2,r0,0x8014621c         #   if (*0x801696f8 != 0) {
801461b8: 00000000 nop
801461bc: 3c018017 lui r1,0x8017
801461c0: ac2096f8 sw r0,-0x6908(r1)            #       *0x801696f8 = 0
801461c4: 0c04ed64 jal 0x8013b590               #       ROUTINE: result_scriptVar = Get Script Variable (0x1e: Map Rotation)
801461c8: 3404001e ori r4,r0,0x001e             #       0x1e
801461cc: 00402021 addu r4,r2,r0                #       result_scriptVar
801461d0: 00041400 sll r2,r4,0x10               
801461d4: 8fa30020 lw r3,0x0020(r29)            #       parameterArrayElementPtr[4]
801461d8: 00021403 sra r2,r2,0x10
801461dc: 00431023 subu r2,r2,r3                #       value1 = result_scriptVar - parameterArrayElementPtr[4]
801461e0: 24431000 addiu r3,r2,0x1000           #       value2 = (result_scriptVar - parameterArrayElementPtr[4]) + 0x1000
801461e4: 04610002 bgez r3,0x801461f0           #       if (value2 < 0) {
801461e8: 00000000 nop
801461ec: 00031823 subu r3,r0,r3                #           value2 = -value2
                                                #       }
801461f0: 04410002 bgez r2,0x801461fc           #       if (value1 < 0) {
801461f4: 00000000 nop
801461f8: 00021023 subu r2,r0,r2                #           value1 = -value1
                                                #       }
801461fc: 0062182a slt r3,r3,r2
80146200: 10600002 beq r3,r0,0x8014620c
80146204: 00802821 addu r5,r4,r0                #       value3 = result_scriptVar
                                                #       if (value2 < value1) {
80146208: 24851000 addiu r5,r4,0x1000           #           value3 = result_scriptVar + 0x1000
                                                #       }
8014620c: 3404001e ori r4,r0,0x001e             #       0x1e
80146210: 00052c00 sll r5,r5,0x10
80146214: 0c04ed91 jal 0x8013b644               #       ROUTINE: Set Script Variable (0x1e (Map Rotation), value3)
80146218: 00052c03 sra r5,r5,0x10
                                                #   }
8014621c: 0000a821 addu r21,r0,r0               #   count = 0
80146220: 3c058016 lui r5,0x8016
80146224: 8ca55f9c lw r5,0x5f9c(r5)             #   *0x80165f9c
80146228: 3c048016 lui r4,0x8016
8014622c: 24845ed4 addiu r4,r4,0x5ed4           #   ptr = 0x80165ed4
80146230: 27a30010 addiu r3,r29,0x0010          #   arrayElementPtr = arrayPtr

                                                #   do {
80146234: 94820000 lhu r2,0x0000(r4)            #       value = *ptr
80146238: 24840002 addiu r4,r4,0x0002           #       ptr = ptr + 2
8014623c: 00021080 sll r2,r2,0x02               #       value * 4
80146240: 00451021 addu r2,r2,r5                #       value * 4 + *0x80165f9c
80146244: 8c420000 lw r2,0x0000(r2)             #       *(value * 4 + *0x80165f9c)
80146248: 26b50001 addiu r21,r21,0x0001         #       count = count + 1
8014624c: ac620020 sw r2,0x0020(r3)             #       *(arrayElementPtr + 0x20) = *(value * 4 + *0x80165f9c)
80146250: 2aa20007 slti r2,r21,0x0007
80146254: 1440fff7 bne r2,r0,0x80146234
80146258: 24630004 addiu r3,r3,0x0004           #       arrayElementPtr = arrayElementPtr + 4
                                                #   } while (count < 7);
8014625c: 0000a821 addu r21,r0,r0               #   count = 0
80146260: 2404f000 addiu r4,r0,-0x1000          #   bitMask = 0xfffff000
80146264: 27a30010 addiu r3,r29,0x0010          #   arrayElementPtr = arrayPtr
                                                #   do {
80146268: 8c620020 lw r2,0x0020(r3)             #       value = *(arrayElementPtr + 0x20)
8014626c: 00000000 nop
80146270: 00441024 and r2,r2,r4                 #       value = value & 0xfffff000
80146274: 04410002 bgez r2,0x80146280
80146278: ac620020 sw r2,0x0020(r3)             #       *(arrayElementPtr + 0x20) = value
                                                #       if (value < 0) {
8014627c: 24420003 addiu r2,r2,0x0003           #           value = value + 3
                                                #       }
80146280: 00021083 sra r2,r2,0x02               #       value = value / 4
80146284: ac620020 sw r2,0x0020(r3)             #       *(arrayElementPtr + 0x20) = value
80146288: 26b50001 addiu r21,r21,0x0001         #       count = count + 1
8014628c: 2aa20003 slti r2,r21,0x0003
80146290: 1440fff5 bne r2,r0,0x80146268
80146294: 24630004 addiu r3,r3,0x0004           #       arrayElementPtr = arrayElementPtr + 4
                                                #   } while (count < 3);
80146298: 8fb6002c lw r22,0x002c(r29)           #   numFrames = parameterArray[7]
8014629c: 00000000 nop
801462a0: 1ac000c4 blez r22,0x801465b4
801462a4: 0000a821 addu r21,r0,r0               #   frameCount = 0
801462a8: 8fa80060 lw r8,0x0060(r29)            #   (*0x80166054 & 0xf0) >> 4   
801462ac: 34020010 ori r2,r0,0x0010             #   16
801462b0: 0048f023 subu r30,r2,r8               #   16 - ((*0x80166054 & 0xf0) >> 4)
801462b4: 02d51023 subu r2,r22,r21              #   numFrames - frameCount
                                                #   do {
801462b8: 00550018 mult r2,r21                  #       (numFrames - frameCount) * frameCount
801462bc: 0000a021 addu r20,r0,r0               #       count = 0
801462c0: 00004012 mflo r8                      #       (numFrames - frameCount) * frameCount
801462c4: afa80070 sw r8,0x0070(r29)            #       (numFrames - frameCount) * frameCount
801462c8: 00141040 sll r2,r20,0x01              #       count * 2
                                                #       do { 
801462cc: 3c018016 lui r1,0x8016
801462d0: 00220821 addu r1,r1,r2
801462d4: 94225ed4 lhu r2,0x5ed4(r1)
801462d8: 3c038016 lui r3,0x8016
801462dc: 8c635f9c lw r3,0x5f9c(r3)
801462e0: 00021080 sll r2,r2,0x02
801462e4: 00431021 addu r2,r2,r3
801462e8: 00141880 sll r3,r20,0x02
801462ec: afa20050 sw r2,0x0050(r29)
801462f0: 27a20010 addiu r2,r29,0x0010
801462f4: 00621821 addu r3,r3,r2
801462f8: 8c640000 lw r4,0x0000(r3)
801462fc: 34022710 ori r2,r0,0x2710
80146300: 1082009f beq r4,r2,0x80146580
80146304: 00000000 nop
80146308: 3c028016 lui r2,0x8016
8014630c: 94425fdc lhu r2,0x5fdc(r2)
80146310: 00000000 nop
80146314: 10400003 beq r2,r0,0x80146324
80146318: 2a820003 slti r2,r20,0x0003
8014631c: 14400098 bne r2,r0,0x80146580
80146320: 00000000 nop
80146324: 2a820003 slti r2,r20,0x0003
80146328: 1040000a beq r2,r0,0x80146354
8014632c: 00041200 sll r2,r4,0x08
80146330: 8c630020 lw r3,0x0020(r3)
80146334: 00000000 nop
80146338: 00439023 subu r18,r2,r3
8014633c: 0060b821 addu r23,r3,r0
80146340: 06410002 bgez r18,0x8014634c
80146344: 02401021 addu r2,r18,r0
80146348: 00021023 subu r2,r0,r2
8014634c: 080518de j 0x80146378
80146350: 28420600 slti r2,r2,0x0600
80146354: 8c630020 lw r3,0x0020(r3)
80146358: 00000000 nop
8014635c: 00831023 subu r2,r4,r3
80146360: 00029180 sll r18,r2,0x06
80146364: 0003b980 sll r23,r3,0x06
80146368: 06410002 bgez r18,0x80146374
8014636c: 02401021 addu r2,r18,r0
80146370: 00021023 subu r2,r0,r2
80146374: 28420060 slti r2,r2,0x0060
80146378: 14400081 bne r2,r0,0x80146580
8014637c: 00000000 nop
80146380: 8fa80068 lw r8,0x0068(r29)
80146384: 00000000 nop
80146388: 1100000c beq r8,r0,0x801463bc
8014638c: 02402021 addu r4,r18,r0
80146390: 8fa80058 lw r8,0x0058(r29)
80146394: 00000000 nop
80146398: 15000004 bne r8,r0,0x801463ac
8014639c: 34020001 ori r2,r0,0x0001
801463a0: 2a820003 slti r2,r20,0x0003
801463a4: 10400005 beq r2,r0,0x801463bc
801463a8: 34020001 ori r2,r0,0x0001
801463ac: 15020008 bne r8,r2,0x801463d0
801463b0: 2a820003 slti r2,r20,0x0003
801463b4: 10400006 beq r2,r0,0x801463d0
801463b8: 02402021 addu r4,r18,r0
801463bc: 02a02821 addu r5,r21,r0
801463c0: 0c05332e jal 0x8014ccb8
801463c4: 02c03021 addu r6,r22,r0
801463c8: 0805190d j 0x80146434
801463cc: 00571821 addu r3,r2,r23
801463d0: 8fa80068 lw r8,0x0068(r29)
801463d4: 34020001 ori r2,r0,0x0001
801463d8: 1502001b bne r8,r2,0x80146448
801463dc: 00158040 sll r16,r21,0x01
801463e0: 025e0018 mult r18,r30
801463e4: 00009812 mflo r19
801463e8: 8fa80060 lw r8,0x0060(r29)
801463ec: 00000000 nop
801463f0: 02480018 mult r18,r8
801463f4: 02a02821 addu r5,r21,r0
801463f8: 00163140 sll r6,r22,0x05
801463fc: 00001012 mflo r2
80146400: 00028840 sll r17,r2,0x01
80146404: 02332021 addu r4,r17,r19
80146408: 0c05332e jal 0x8014ccb8
8014640c: 00932021 addu r4,r4,r19
80146410: 02d60018 mult r22,r22
80146414: 02202021 addu r4,r17,r0
80146418: 00408021 addu r16,r2,r0
8014641c: 8fa50070 lw r5,0x0070(r29)
80146420: 00003012 mflo r6
80146424: 0c05332e jal 0x8014ccb8
80146428: 00063140 sll r6,r6,0x05
8014642c: 00501021 addu r2,r2,r16
80146430: 00571821 addu r3,r2,r23
80146434: 2a820003 slti r2,r20,0x0003
80146438: 1040003f beq r2,r0,0x80146538
8014643c: 00000000 nop
80146440: 0805194c j 0x80146530
80146444: 00031880 sll r3,r3,0x02
80146448: 0216102a slt r2,r16,r22
8014644c: 10400018 beq r2,r0,0x801464b0
80146450: 00129040 sll r18,r18,0x01
80146454: 025e0018 mult r18,r30
80146458: 00009812 mflo r19
8014645c: 8fa80060 lw r8,0x0060(r29)
80146460: 00000000 nop
80146464: 02480018 mult r18,r8
80146468: 02002821 addu r5,r16,r0
8014646c: 02c03021 addu r6,r22,r0
80146470: 00002012 mflo r4
80146474: 0c05332e jal 0x8014ccb8
80146478: 00042040 sll r4,r4,0x01
8014647c: 00531021 addu r2,r2,r19
80146480: 00532021 addu r4,r2,r19
80146484: 02002821 addu r5,r16,r0
80146488: 0c05332e jal 0x8014ccb8
8014648c: 00163140 sll r6,r22,0x05
80146490: 00401821 addu r3,r2,r0
80146494: 2a820003 slti r2,r20,0x0003
80146498: 1440001c bne r2,r0,0x8014650c
8014649c: 00000000 nop
801464a0: 04610020 bgez r3,0x80146524
801464a4: 00601021 addu r2,r3,r0
801464a8: 08051949 j 0x80146524
801464ac: 24620003 addiu r2,r3,0x0003
801464b0: 025e0018 mult r18,r30
801464b4: 00009812 mflo r19
801464b8: 8fa80060 lw r8,0x0060(r29)
801464bc: 00000000 nop
801464c0: 02480018 mult r18,r8
801464c4: 02168023 subu r16,r16,r22
801464c8: 02d02823 subu r5,r22,r16
801464cc: 02c03021 addu r6,r22,r0
801464d0: 00001012 mflo r2
801464d4: 00028840 sll r17,r2,0x01
801464d8: 0c05332e jal 0x8014ccb8
801464dc: 02202021 addu r4,r17,r0
801464e0: 02221021 addu r2,r17,r2
801464e4: 00531021 addu r2,r2,r19
801464e8: 00532021 addu r4,r2,r19
801464ec: 02002821 addu r5,r16,r0
801464f0: 0c05332e jal 0x8014ccb8
801464f4: 00163140 sll r6,r22,0x05
801464f8: 00401821 addu r3,r2,r0
801464fc: 2a820003 slti r2,r20,0x0003
80146500: 10400005 beq r2,r0,0x80146518
80146504: 00721021 addu r2,r3,r18
80146508: 00721821 addu r3,r3,r18
8014650c: 00171080 sll r2,r23,0x02
80146510: 0805194b j 0x8014652c
80146514: 00621821 addu r3,r3,r2
80146518: 04410002 bgez r2,0x80146524
8014651c: 00000000 nop
80146520: 24420003 addiu r2,r2,0x0003
80146524: 00021083 sra r2,r2,0x02
80146528: 00571821 addu r3,r2,r23
8014652c: 2a820003 slti r2,r20,0x0003
80146530: 14400010 bne r2,r0,0x80146574
80146534: 00000000 nop
80146538: 18600006 blez r3,0x80146554
8014653c: 306200ff andi r2,r3,0x00ff
80146540: 28420021 slti r2,r2,0x0021
80146544: 14400007 bne r2,r0,0x80146564
80146548: 00000000 nop
8014654c: 08051959 j 0x80146564
80146550: 24630040 addiu r3,r3,0x0040
80146554: 28420020 slti r2,r2,0x0020
80146558: 10400002 beq r2,r0,0x80146564
8014655c: 00000000 nop
80146560: 2463ffc0 addiu r3,r3,-0x0040
80146564: 04610002 bgez r3,0x80146570
80146568: 00601021 addu r2,r3,r0
8014656c: 2462003f addiu r2,r3,0x003f
80146570: 00021983 sra r3,r2,0x06
80146574: 8fa80050 lw r8,0x0050(r29)
80146578: 00000000 nop
8014657c: ad030000 sw r3,0x0000(r8)
80146580: 26940001 addiu r20,r20,0x0001         #           count = count + 1
80146584: 2a820007 slti r2,r20,0x0007
80146588: 1440ff50 bne r2,r0,0x801462cc
8014658c: 00141040 sll r2,r20,0x01
                                                #       } while (count < 7);
80146590: 0c051839 jal 0x801460e4               #       ? 0x1460e4 ();
80146594: 26b50001 addiu r21,r21,0x0001         #       frameCount = frameCount + 1
80146598: 0c0532a0 jal 0x8014ca80               #       Switch To Next Thread ();
8014659c: 00000000 nop
801465a0: 8fa2002c lw r2,0x002c(r29)            #       numFrames (parameter value)
801465a4: 00000000 nop
801465a8: 02a2102a slt r2,r21,r2
801465ac: 1440ff42 bne r2,r0,0x801462b8
801465b0: 02d51023 subu r2,r22,r21              #       numFrames - frameCount
                                                #   } while (frameCount < numFrames);
801465b4: 3c028016 lui r2,0x8016
801465b8: 94425fdc lhu r2,0x5fdc(r2)            #   *0x80165fdc
801465bc: 00000000 nop
801465c0: 14400016 bne r2,r0,0x8014661c
801465c4: 34150003 ori r21,r0,0x0003            #   count = 3
                                                #   if (*0x80165fdc == 0) {
801465c8: 0000a821 addu r21,r0,r0               #       count = 0
801465cc: 34072710 ori r7,r0,0x2710             #       0x2710
801465d0: 3c068016 lui r6,0x8016
801465d4: 8cc65f9c lw r6,0x5f9c(r6)             #       *0x80165f9c
801465d8: 3c058016 lui r5,0x8016
801465dc: 24a55ed4 addiu r5,r5,0x5ed4           #       r5ptr = 0x80165ed4
801465e0: 27a40010 addiu r4,r29,0x0010          #       arrayElementPtr = arrayPtr
                                                #       do {
801465e4: 8c830000 lw r3,0x0000(r4)             #           value = *arrayElementPtr
801465e8: 00000000 nop
801465ec: 10670006 beq r3,r7,0x80146608         
801465f0: 24840004 addiu r4,r4,0x0004           #           arrayElementPtr = arrayElementPtr + 4
                                                #           if (value != 0x2710) {
801465f4: 94a20000 lhu r2,0x0000(r5)            #               *r5ptr
801465f8: 00031a80 sll r3,r3,0x0a               #               value * 1024
801465fc: 00021080 sll r2,r2,0x02               #               *r5ptr * 4
80146600: 00461021 addu r2,r2,r6                #               (*r5ptr * 4) + *0x80165f9c
80146604: ac430000 sw r3,0x0000(r2)             #               *((*r5ptr * 4) + *0x80165f9c) = value * 1024
                                                #           }
80146608: 26b50001 addiu r21,r21,0x0001         #           count = count + 1
8014660c: 2aa20003 slti r2,r21,0x0003
80146610: 1440fff4 bne r2,r0,0x801465e4
80146614: 24a50002 addiu r5,r5,0x0002           #           r5ptr = r5ptr + 2
                                                #       } while (count < 3);
80146618: 34150003 ori r21,r0,0x0003            #       count = 3
                                                #   }
8014661c: 34072710 ori r7,r0,0x2710             #   0x2710
80146620: 3c068016 lui r6,0x8016
80146624: 8cc65f9c lw r6,0x5f9c(r6)             #   *0x80165f9c
80146628: 3c058016 lui r5,0x8016
8014662c: 24a55eda addiu r5,r5,0x5eda           #   r5ptr = 0x80165eda
80146630: 27a4001c addiu r4,r29,0x001c          #   arrayElementPtr = arrayPtr2 (sp + 0x1c)
                                                #   do {
80146634: 8c830000 lw r3,0x0000(r4)             #       value = *arrayElementPtr
80146638: 00000000 nop
8014663c: 10670006 beq r3,r7,0x80146658         
80146640: 24840004 addiu r4,r4,0x0004           #       arrayElementPtr = arrayElementPtr + 4 
                                                #       if (value != 0x2710) {
80146644: 94a20000 lhu r2,0x0000(r5)            #           *r5ptr
80146648: 00000000 nop
8014664c: 00021080 sll r2,r2,0x02               #           *r5ptr * 4
80146650: 00461021 addu r2,r2,r6                #           (*r5ptr * 4) + *0x80165f9c
80146654: ac430000 sw r3,0x0000(r2)             #           *((*r5ptr * 4) + *0x80165f9c) = value
                                                #       }
80146658: 26b50001 addiu r21,r21,0x0001         #       count = count + 1
8014665c: 2aa20007 slti r2,r21,0x0007
80146660: 1440fff4 bne r2,r0,0x80146634
80146664: 24a50002 addiu r5,r5,0x0002           #       r5ptr = r5ptr + 2
                                                #   } while (count < 7);

80146668: 0c051839 jal 0x801460e4               #   ? 0x1460e4 ();
8014666c: 00000000 nop
80146670: 0c0532a0 jal 0x8014ca80               #   Switch To Next Thread ();
80146674: 00000000 nop
80146678: 0c053256 jal 0x8014c958               #   Stop Current Thread ();
8014667c: 00000000 nop
80146680: 8fbf00a4 lw r31,0x00a4(r29)
80146684: 8fbe00a0 lw r30,0x00a0(r29)
80146688: 8fb7009c lw r23,0x009c(r29)
8014668c: 8fb60098 lw r22,0x0098(r29)
80146690: 8fb50094 lw r21,0x0094(r29)
80146694: 8fb40090 lw r20,0x0090(r29)
80146698: 8fb3008c lw r19,0x008c(r29)
8014669c: 8fb20088 lw r18,0x0088(r29)
801466a0: 8fb10084 lw r17,0x0084(r29)
801466a4: 8fb00080 lw r16,0x0080(r29)
801466a8: 27bd00a8 addiu r29,r29,0x00a8
801466ac: 03e00008 jr r31
801466b0: 00000000 nop