Load Scenario Conditionals

From Final Fantasy Hacktics Wiki
Revision as of 17:54, 16 August 2020 by Glain (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#   ROUTINE: LOAD SCENARIO CONDITIONALS
#   No parameters.

801c34b4: 27bdffb8 addiu r29,r29,-0x0048
801c34b8: 34040064 ori r4,r0,0x0064
801c34bc: afbf0044 sw r31,0x0044(r29)
801c34c0: afb60040 sw r22,0x0040(r29)
801c34c4: afb5003c sw r21,0x003c(r29)
801c34c8: afb40038 sw r20,0x0038(r29)
801c34cc: afb30034 sw r19,0x0034(r29)
801c34d0: afb20030 sw r18,0x0030(r29)
801c34d4: afb1002c sw r17,0x002c(r29)
801c34d8: 0c04ed64 jal 0x8013b590                   #   var_0x64 = Get Script Variable (0x64);              //  0x64 = Next Scenario? New Game?
801c34dc: afb00028 sw r16,0x0028(r29)
801c34e0: 10400010 beq r2,r0,0x801c3524             #   if (var_0x64 != 0) {
801c34e4: 00000000 nop
801c34e8: 0c04ed64 jal 0x8013b590                   #       currentEventID =  Get Script Variable (0x27);   //  0x27 = Current Event
801c34ec: 34040027 ori r4,r0,0x0027
801c34f0: 34030008 ori r3,r0,0x0008
801c34f4: 1443000b bne r2,r3,0x801c3524             #       if (currentEventID == 0x08) {                       //  0x08 = Military Academy
801c34f8: 34040027 ori r4,r0,0x0027
801c34fc: 0c04ed91 jal 0x8013b644                   #           Set Script Variable (0x27, 0x09);           //  0x09 = Gariland Fight (Setup)
801c3500: 34050009 ori r5,r0,0x0009
801c3504: 34040064 ori r4,r0,0x0064
801c3508: 0c04ed91 jal 0x8013b644                   #           Set Script Variable (0x64, 0);              //  0x64 = Next Scenario? New Game?
801c350c: 00002821 addu r5,r0,r0
801c3510: 34020001 ori r2,r0,0x0001
801c3514: 3c018016 lui r1,0x8016
801c3518: a4225fda sh r2,0x5fda(r1)                 #           *0x80165fda = 1
801c351c: 3c018004 lui r1,0x8004
801c3520: a02073a0 sb r0,0x73a0(r1)                 #           *0x800473a0 = 0
                                                    #       }
                                                    #   }
801c3524: 3c038016 lui r3,0x8016
801c3528: 94635fda lhu r3,0x5fda(r3)                #   *0x80165fda
801c352c: 34020002 ori r2,r0,0x0002
801c3530: 14620029 bne r3,r2,0x801c35d8
801c3534: 34100070 ori r16,r0,0x0070                #   scriptVarID = 0x70
                                                    #   if (*0x80165fda == 2) {
801c3538: 3c018005 lui r1,0x8005
801c353c: a020d9ac sb r0,-0x2654(r1)                #       *0x8004d9ac = 0
801c3540: 3c018005 lui r1,0x8005
801c3544: a020d954 sb r0,-0x26ac(r1)                #       *0x8004d954 = 0
801c3548: 0c04ed64 jal 0x8013b590                   #       currentEventID =  Get Script Variable (0x27);   //  0x27 = Current Event       
801c354c: 34040027 ori r4,r0,0x0027
801c3550: 00021040 sll r2,r2,0x01                   #       currentEventID * 2
801c3554: 3c018005 lui r1,0x8005
801c3558: 00220821 addu r1,r1,r2
801c355c: 9423e5d0 lhu r3,-0x1a30(r1)               #       value = *(0x8004e5d0 + (currentEventID * 2))
801c3560: 00000000 nop
801c3564: 1060015b beq r3,r0,0x801c3ad4             #       if (value == 0) return currentEventID * 2;
801c3568: 00008021 addu r16,r0,r0                   #       count = 0
801c356c: 30620c00 andi r2,r3,0x0c00                #       value & 0x0c00
801c3570: 00021083 sra r2,r2,0x02                   #       (value & 0x0c00) / 4
801c3574: 306300ff andi r3,r3,0x00ff                #       value & 0xff
801c3578: 00439021 addu r18,r2,r3                   #       checkValue = ((value & 0x0c00) / 4) + (value & 0xff)
801c357c: 3c11801d lui r17,0x801d
801c3580: 2631f938 addiu r17,r17,-0x06c8            #       scenarioDataPtr = 0x801cf938                        //  Start of scenario data in ATTACK.OUT (0x10938)
                                                    #       do {
801c3584: 92220001 lbu r2,0x0001(r17)               #           highByte = *(scenarioDataPtr + 1)
801c3588: 92230000 lbu r3,0x0000(r17)               #           lowByte = *scenarioDataPtr
801c358c: 00021200 sll r2,r2,0x08                   #           highByte << 8
801c3590: 00623021 addu r6,r3,r2                    #           scenarioID = (highByte << 8) + lowByte
801c3594: 10d20006 beq r6,r18,0x801c35b0            #           if (scenarioID == checkValue) break;
801c3598: 00000000 nop
801c359c: 10c0014d beq r6,r0,0x801c3ad4             #           if (scenarioID == 0) return highByte << 8;
801c35a0: 26100001 addiu r16,r16,0x0001             #           count = count + 1
801c35a4: 2a0201f4 slti r2,r16,0x01f4
801c35a8: 1440fff6 bne r2,r0,0x801c3584
801c35ac: 26310018 addiu r17,r17,0x0018             #           scenarioDataPtr = scenarioDataPtr + 24          //  24 == sizeof(scenario)
                                                    #       } while (count < 0x1f4);
801c35b0: 10c00148 beq r6,r0,0x801c3ad4             #       if (scenarioID == 0) return 0;
801c35b4: 00000000 nop
801c35b8: 9222000d lbu r2,0x000d(r17)               #       scenarioDataPtr.portraitID
801c35bc: 3c018005 lui r1,0x8005
801c35c0: a022d9ac sb r2,-0x2654(r1)                #       *0x8004d9ac = scenarioDataPtr.portraitID
801c35c4: 9222000e lbu r2,0x000e(r17)               #       scenarioDataPtr.unitID
801c35c8: 3c018005 lui r1,0x8005
801c35cc: a022d954 sb r2,-0x26ac(r1)                #       *0x8004d954 = scenarioDataPtr.unitID
801c35d0: 08070eb5 j 0x801c3ad4
801c35d4: 00000000 nop
                                                    #   }
801c35d8: 3c018017 lui r1,0x8017
801c35dc: a4203cb0 sh r0,0x3cb0(r1)                 #   *0x80173cb0 = 0
                                                    #   do {
801c35e0: 02002021 addu r4,r16,r0                       
801c35e4: 0c04ed91 jal 0x8013b644                   #       Set Script Variable (scriptVarID, 0);
801c35e8: 00002821 addu r5,r0,r0
801c35ec: 26100001 addiu r16,r16,0x0001             #       scriptVarID = scriptVarID + 1
801c35f0: 2a020090 slti r2,r16,0x0090
801c35f4: 1440fffa bne r2,r0,0x801c35e0
801c35f8: 340401fd ori r4,r0,0x01fd
                                                    #   } while (scriptVarID < 0x90);
801c35fc: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x1fd, 1);
801c3600: 34050001 ori r5,r0,0x0001
801c3604: 0c04ed64 jal 0x8013b590                   #   var_0xa0 = Get Script Variable (0xa0);                  //  0xa0 = Olan saw Ramza at his own funeral
801c3608: 340400a0 ori r4,r0,0x00a0
801c360c: 1040000e beq r2,r0,0x801c3648             #   if ((var_0xa0 != 0)
801c3610: 00000000 nop
801c3614: 0c04ed64 jal 0x8013b590                   #           var_0x64 =  Get Script Variable (0x64);         //  0x64 = Next Scenario? New Game?
801c3618: 34040064 ori r4,r0,0x0064
801c361c: 1040000a beq r2,r0,0x801c3648             #       and (var_0x64 != 0))
801c3620: 00000000 nop
801c3624: 0c04ed64 jal 0x8013b590                   #           currentEventID =  Get Script Variable (0x27);   //  0x27 = Current Event
801c3628: 34040027 ori r4,r0,0x0027
801c362c: 3403012a ori r3,r0,0x012a
801c3630: 14430005 bne r2,r3,0x801c3648             #       and (currentEventID == 0x12a)) {
801c3634: 34040027 ori r4,r0,0x0027
801c3638: 0c04ed91 jal 0x8013b644                   #           Set Script Variable (0x27, 0x012b);             //  0x27 = Current Event; 0x12b = Final scene Delita/Ovelia
801c363c: 3405012b ori r5,r0,0x012b
801c3640: 08070dbc j 0x801c36f0
801c3644: 00000000 nop
                                                    #   } else {
801c3648: 0c04ed64 jal 0x8013b590
801c364c: 34040064 ori r4,r0,0x0064                 #       var_0x64 =  Get Script Variable (0x64);             //  0x64 = Next Scenario? New Game?
801c3650: 10400018 beq r2,r0,0x801c36b4             #       if (var_0x64 != 0) {
801c3654: 00000000 nop
801c3658: 0c04ed64 jal 0x8013b590
801c365c: 34040027 ori r4,r0,0x0027                 #           currentEventID = Get Script Variable (0x27);    //  0x27 = Current Event
801c3660: 00403021 addu r6,r2,r0                    #           currentEventID
801c3664: 3402005a ori r2,r0,0x005a
801c3668: 14c20006 bne r6,r2,0x801c3684
801c366c: 3402012a ori r2,r0,0x012a
                                                    #           if (currentEventID == 0x5a) {                       //  0x5a = Fort Zeakden end scene (End Ch. 1)
801c3670: 34040027 ori r4,r0,0x0027
801c3674: 0c04ed91 jal 0x8013b644                   #               Set Script Variable (0x27, 0x74);           //  0x74 = Ch. 2 Start Orbonne
801c3678: 34050074 ori r5,r0,0x0074
801c367c: 08070dbc j 0x801c36f0
801c3680: 00000000 nop                              
801c3684: 14c20006 bne r6,r2,0x801c36a0             #           } else if (currentEventID == 0x12a) {               //  0x12a = Riovanes Castle Ch.3 End (Ramza finds Pisces stone)
801c3688: 00000000 nop
801c368c: 34040027 ori r4,r0,0x0027
801c3690: 0c04ed91 jal 0x8013b644                   #               Set Script Variable (0x27, 0x148);          //  0x148 = Riovanes Castle Ch.3 End (Ramza/Rafa/Malak conversation)
801c3694: 34050148 ori r5,r0,0x0148
801c3698: 08070dbc j 0x801c36f0
801c369c: 00000000 nop                              #           } else {
801c36a0: 34040027 ori r4,r0,0x0027
801c36a4: 0c04ed91 jal 0x8013b644                   #               Set Script Variable (0x27, currentEventID + 1);
801c36a8: 24c50001 addiu r5,r6,0x0001
801c36ac: 08070dbc j 0x801c36f0
801c36b0: 00000000 nop                              
                                                    #           }
                                                    #       } else {
801c36b4: 3c028004 lui r2,0x8004
801c36b8: 904273a0 lbu r2,0x73a0(r2)                #           *0x800473a0
801c36bc: 00000000 nop
801c36c0: 1040000b beq r2,r0,0x801c36f0             #           if (*0x800473a0 != 0) {
801c36c4: 00000000 nop
801c36c8: 34040027 ori r4,r0,0x0027
801c36cc: 0c04ed91 jal 0x8013b644                   #               Set Script Variable (0x27, 1);          //  0x27 = Current Event
801c36d0: 34050001 ori r5,r0,0x0001
801c36d4: 34100001 ori r16,r0,0x0001                #               unitIndex = 1
                                                    #               do {
801c36d8: 0c0167f8 jal 0x80059fe0                   #                   Remove Unit from Party (unitIndex);
801c36dc: 02002021 addu r4,r16,r0
801c36e0: 26100001 addiu r16,r16,0x0001             #                   unitIndex = unitIndex + 1
801c36e4: 2a020014 slti r2,r16,0x0014
801c36e8: 1440fffb bne r2,r0,0x801c36d8             
801c36ec: 00000000 nop
                                                    #               } while (unitIndex < 20);
                                                    #           }
                                                    #       }
                                                    #   }
801c36f0: 3c018004 lui r1,0x8004
801c36f4: a02073a0 sb r0,0x73a0(r1)                 #   0x800473a0 = 0
801c36f8: 34040064 ori r4,r0,0x0064
801c36fc: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x64, 0)               //  0x64 = Next Scenario? New Game?
801c3700: 00002821 addu r5,r0,r0
801c3704: 0c04ed64 jal 0x8013b590                   #   currentEventID = Get Script Variable (0x27);
801c3708: 34040027 ori r4,r0,0x0027                 
801c370c: 00409021 addu r18,r2,r0                   #   currentEventID
801c3710: 3c11801d lui r17,0x801d
801c3714: 2631f938 addiu r17,r17,-0x06c8            #   scenarioDataPtr = 0x801cf938                    //  Start of scenario data in ATTACK.OUT (0x10938)
801c3718: 00008021 addu r16,r0,r0                   #   count = 0
801c371c: 3c088005 lui r8,0x8005
801c3720: 2508e5d0 addiu r8,r8,-0x1a30              #   0x8004e5d0
801c3724: 26270012 addiu r7,r17,0x0012              #   scenarioDataPtr + 0x12
                                                    #   do {
801c3728: 90e2ffef lbu r2,-0x0011(r7)               #       highByte = *(scenarioDataPtr + 1)
801c372c: 92230000 lbu r3,0x0000(r17)               #       lowByte = *scenarioDataPtr
801c3730: 00021200 sll r2,r2,0x08                   #       highByte << 8
801c3734: 00623021 addu r6,r3,r2                    #       scenarioID = (highByte << 8) + lowByte      
801c3738: 10c0000f beq r6,r0,0x801c3778
801c373c: 26100001 addiu r16,r16,0x0001             #       count = count + 1
                                                    #       if (scenarioID == 0) break;
801c3740: 90e30002 lbu r3,0x0002(r7)                #       afterEventAction = *(scenarioDataPtr + 0x14)
801c3744: 90e40001 lbu r4,0x0001(r7)                #       nextScenarioID_highByte = *(scenarioDataPtr + 0x13)
801c3748: 90e50000 lbu r5,0x0000(r7)                #       nextScenarioID_lowByte = *(scenarioDataPtr + 0x12)
801c374c: 24e70018 addiu r7,r7,0x0018
801c3750: 00061040 sll r2,r6,0x01                   #       scenarioID * 2
801c3754: 00481021 addu r2,r2,r8                    #       (scenarioID * 2) + 0x8004e5d0
801c3758: 00031a00 sll r3,r3,0x08                   #       afterEventAction << 8
801c375c: 00042280 sll r4,r4,0x0a                   #       nextScenarioID_highByte << 10
801c3760: 00a42821 addu r5,r5,r4                    #       nextScenarioID_lowByte + (nextScenarioID_highByte << 10)
801c3764: 00651825 or r3,r3,r5                      #       (afterEventAction << 8) | (nextScenarioID_lowByte + (nextScenarioID_highByte << 10))
801c3768: a4430000 sh r3,0x0000(r2)                 #       *((scenarioID * 2) + 0x8004e5d0) = (afterEventAction << 8) | (nextScenarioID_lowByte + (nextScenarioID_highByte << 10))
801c376c: 2a0201f4 slti r2,r16,0x01f4
801c3770: 1440ffed bne r2,r0,0x801c3728
801c3774: 26310018 addiu r17,r17,0x0018             #       scenarioDataPtr = scenarioDataPtr + 24
                                                    #   } while (count < 0x1f4);
801c3778: 34108000 ori r16,r0,0x8000
801c377c: 3c018005 lui r1,0x8005
801c3780: a430e8f4 sh r16,-0x170c(r1)               #   *0x8004e8f4 = 0x8000
801c3784: 3c018005 lui r1,0x8005
801c3788: a420e8f2 sh r0,-0x170e(r1)                #   *0x8004e8f2 = 0
801c378c: 3c018005 lui r1,0x8005
801c3790: a420e8f6 sh r0,-0x170a(r1)                #   *0x8004e8f6 = 0
801c3794: 0c04ed64 jal 0x8013b590                   #   var_0x1fe = Get Script Variable (0x1fe);    // Next Random is World Debug Battle Style
801c3798: 340401fe ori r4,r0,0x01fe
801c379c: 10400007 beq r2,r0,0x801c37bc             #   if (var_0x1fe != 0) {
801c37a0: 34028200 ori r2,r0,0x8200
801c37a4: 3c018005 lui r1,0x8005
801c37a8: a430e8f0 sh r16,-0x1710(r1)               #       *0x8004e8f0 = 0x8000
801c37ac: 3c018005 lui r1,0x8005
801c37b0: a430e8f8 sh r16,-0x1708(r1)               #       *0x8004e8f8 = 0x8000
801c37b4: 08070df3 j 0x801c37cc
801c37b8: 00000000 nop                              #   } else {
801c37bc: 3c018005 lui r1,0x8005
801c37c0: a422e8f0 sh r2,-0x1710(r1)                #       *0x8004e8f0 = 0x8200
801c37c4: 3c018005 lui r1,0x8005
801c37c8: a422e8f8 sh r2,-0x1708(r1)                #       *0x8004e8f8 = 0x8200
                                                    #   }
801c37cc: 3c11801d lui r17,0x801d
801c37d0: 2631f938 addiu r17,r17,-0x06c8            #   scenarioDataPtr = 0x801cf938                    // Start of scenario data in ATTACK.OUT (0x10938)
801c37d4: 00008021 addu r16,r0,r0                   #   count = 0
                                                    #   do {
801c37d8: 92220001 lbu r2,0x0001(r17)               #       highByte = *(scenarioDataPtr + 1)
801c37dc: 92230000 lbu r3,0x0000(r17)               #       lowByte = *scenarioDataPtr
801c37e0: 00021200 sll r2,r2,0x08                   #       highByte << 8
801c37e4: 00623021 addu r6,r3,r2                    #       scenarioID = (highByte << 8) + lowByte
801c37e8: 10d20006 beq r6,r18,0x801c3804            #       if (scenarioID == currentEventID) break;
801c37ec: 00000000 nop
801c37f0: 10c00006 beq r6,r0,0x801c380c             #       if (scenarioID == 0) break;
801c37f4: 26100001 addiu r16,r16,0x0001             #       count = count + 1
801c37f8: 2a0201f4 slti r2,r16,0x01f4
801c37fc: 1440fff6 bne r2,r0,0x801c37d8
801c3800: 26310018 addiu r17,r17,0x0018             #       scenarioDataPtr = scenarioDataPtr + 24      // 24 == sizeof(scenario)
                                                    #   } while (count < 0x1f4);
801c3804: 14c00009 bne r6,r0,0x801c382c             #   if (scenarioID == 0) {
801c3808: 00000000 nop
801c380c: 34040030 ori r4,r0,0x0030
801c3810: 0c04ed91 jal 0x8013b644                   #       Set Script Variable (0x30, 0);          // Map Arrangement
801c3814: 00002821 addu r5,r0,r0
801c3818: 34040027 ori r4,r0,0x0027
801c381c: 08070eb2 j 0x801c3ac8                     #       Set Script Variable (0x27, 0);          // Current Event
801c3820: 00002821 addu r5,r0,r0                            return 0;
                                                    #   }
801c3824: 08070e5a j 0x801c3968
801c3828: a4800000 sh r0,0x0000(r4)
                                                    
801c382c: 3c028017 lui r2,0x8017                       
801c3830: 94423cb0 lhu r2,0x3cb0(r2)                #   *0x80173cb0
801c3834: 00000000 nop
801c3838: 24420001 addiu r2,r2,0x0001               #   *0x80173cb0 + 1
801c383c: 3c018017 lui r1,0x8017
801c3840: a4223cb0 sh r2,0x3cb0(r1)                 #   *0x80173cb0 = *0x80173cb0 + 1
801c3844: 0c070cea jal 0x801c33a8                   #  Load Halfword (ATTACK.OUT) (scenarioDataPtr);        // Value thrown away
801c3848: 02202021 addu r4,r17,r0
801c384c: 92220005 lbu r2,0x0005(r17)               #   scenarioDataPtr.musicChoice1
801c3850: 92340002 lbu r20,0x0002(r17)              #   scenarioDataPtr.mapID
801c3854: 92320003 lbu r18,0x0003(r17)              #   scenarioDataPtr.weatherAndObjects
801c3858: 92350004 lbu r21,0x0004(r17)              #   scenarioDataPtr.daytimeState
801c385c: 3c018016 lui r1,0x8016
801c3860: a42260a4 sh r2,0x60a4(r1)                 #   *0x801660a4 = scenarioDataPtr.musicChoice1
801c3864: 92220006 lbu r2,0x0006(r17)               #   scenarioDataPtr.musicChoice2
801c3868: 3c018016 lui r1,0x8016
801c386c: a42260a6 sh r2,0x60a6(r1)                 #   *0x801660a6 = scenarioDataPtr.musicChoice2
801c3870: 0c070cea jal 0x801c33a8                   #   ENTD_ID = Load Halfword (ATTACK.OUT) (scenarioDataPtr + 7);
801c3874: 26240007 addiu r4,r17,0x0007
801c3878: 26240009 addiu r4,r17,0x0009
801c387c: 00021400 sll r2,r2,0x10
801c3880: 0c070cea jal 0x801c33a8                   #   squadID1 = Load Halfword (ATTACK.OUT) (scenarioDataPtr + 9);
801c3884: 00029c03 sra r19,r2,0x10                  #   ENTD_ID
801c3888: 2624000b addiu r4,r17,0x000b
801c388c: 00021400 sll r2,r2,0x10
801c3890: 00021403 sra r2,r2,0x10
801c3894: 0c070cea jal 0x801c33a8                   #   squadID2 = Load Halfword (ATTACK.OUT) (scenarioDataPtr + 11);
801c3898: afa20010 sw r2,0x0010(r29)                #   squadID1
801c389c: 00021400 sll r2,r2,0x10
801c38a0: 00021403 sra r2,r2,0x10
801c38a4: afa20014 sw r2,0x0014(r29)                #   squadID2
801c38a8: 9222000d lbu r2,0x000d(r17)               #   scenarioDataPtr.portraitID
801c38ac: 00008021 addu r16,r0,r0                   #   count = 0
801c38b0: 3c018005 lui r1,0x8005
801c38b4: a022d9ac sb r2,-0x2654(r1)                #   *0x8004d9ac = scenarioDataPtr.portraitID
801c38b8: 9222000e lbu r2,0x000e(r17)               #   scenarioDataPtr.unitID
801c38bc: 3c018005 lui r1,0x8005
801c38c0: a022d954 sb r2,-0x26ac(r1)                #   *0x8004d954 = scenarioDataPtr.unitID
801c38c4: 0c070cea jal 0x801c33a8                   #   braveStoryENTD = Load Halfword (ATTACK.OUT) (scenarioDataPtr + 15);
801c38c8: 2624000f addiu r4,r17,0x000f
801c38cc: 00021400 sll r2,r2,0x10
801c38d0: 00021403 sra r2,r2,0x10
801c38d4: afa2001c sw r2,0x001c(r29)                #   braveStoryENTD
801c38d8: 92360011 lbu r22,0x0011(r17)              #   scenarioDataPtr.ramzaMandatoryFlag
801c38dc: 0c070cea jal 0x801c33a8                   #   Load Halfword (ATTACK.OUT) (scenarioDataPtr + 18);      // Value thrown away
801c38e0: 26240012 addiu r4,r17,0x0012
801c38e4: 0c070cea jal 0x801c33a8                   #   Load Halfword (ATTACK.OUT) (scenarioDataPtr + 20);      // Value thrown away
801c38e8: 26240014 addiu r4,r17,0x0014
801c38ec: 0c070cea jal 0x801c33a8                   #   eventScriptID = Load Halfword (ATTACK.OUT) (scenarioDataPtr + 22); 
801c38f0: 26240016 addiu r4,r17,0x0016
801c38f4: 3c048004 lui r4,0x8004
801c38f8: 248475e0 addiu r4,r4,0x75e0               #   storeConditionalOffsetPtr = 0x800475e0
801c38fc: 00021400 sll r2,r2,0x10
801c3900: 000213c3 sra r2,r2,0x0f                   #   eventScriptID * 2
801c3904: 3c01801d lui r1,0x801d
801c3908: 00220821 addu r1,r1,r2
801c390c: 94233938 lhu r3,0x3938(r1)                #   blockOffsetPtr = *(0x801d3938 + (eventScriptID * 2))         
801c3910: 3c07801d lui r7,0x801d
801c3914: 24e73938 addiu r7,r7,0x3938               #   baseBlockPtr = 0x801d3938                               // Start of block pointer data in ATTACK.OUT (0x14938)
801c3918: 00031c00 sll r3,r3,0x10
801c391c: 00031403 sra r2,r3,0x10                   #   blockOffsetPtr = blockOffsetPtr << 16 >> 16             // Sign extension
801c3920: 00031fc2 srl r3,r3,0x1f                   #   (blockOffsetPtr >> 31)
801c3924: 00431021 addu r2,r2,r3                    #   blockOffsetPtr + (blockOffsetPtr >> 31)
801c3928: 00021043 sra r2,r2,0x01                   #   (blockOffsetPtr + (blockOffsetPtr >> 31)) / 2
801c392c: 00021040 sll r2,r2,0x01                   #   offset = ((blockOffsetPtr + (blockOffsetPtr >> 31)) / 2) * 2
801c3930: 00471821 addu r3,r2,r7                    #   conditionalOffsetPtr = baseBlockPtr + offset
801c3934: 84660000 lh r6,0x0000(r3)                 #   firstConditionalOffset = *conditionalOffsetPtr
                                                    #   do {
801c3938: 94620000 lhu r2,0x0000(r3)                #       conditionalOffset = *conditionalOffsetPtr
801c393c: 00000000 nop
801c3940: 00461023 subu r2,r2,r6                    #       conditionalOffset - firstConditionalOffset
801c3944: a4820000 sh r2,0x0000(r4)                 #       *storeConditionalOffsetPtr = conditionalOffset - firstConditionalOffset
801c3948: 84620000 lh r2,0x0000(r3)                 #       conditionalOffset = *conditionalOffsetPtr
801c394c: 00000000 nop
801c3950: 1040ffb4 beq r2,r0,0x801c3824             
801c3954: 24630002 addiu r3,r3,0x0002               #       conditionalOffsetPtr = conditionalOffsetPtr + 2
                                                    #       if (conditionalOffset == 0) { *storeConditionalOffsetPtr = 0; break; }
801c3958: 26100001 addiu r16,r16,0x0001             #       count = count + 1
801c395c: 2a020010 slti r2,r16,0x0010
801c3960: 1440fff5 bne r2,r0,0x801c3938
801c3964: 24840002 addiu r4,r4,0x0002               #       storeConditionalOffsetPtr = storeConditionalOffsetPtr + 2
                                                    #   } while (count < 16);
801c3968: 00008021 addu r16,r0,r0                   #   count = 0
801c396c: 3c088004 lui r8,0x8004
801c3970: 250875e0 addiu r8,r8,0x75e0               #   baseConditionalOffsetPtr = 0x800475e0
801c3974: 3c058005 lui r5,0x8005
801c3978: 24a59a18 addiu r5,r5,-0x65e8              #   storeConditionalDataPtr = 0x80049a18
                                                    #   do {
801c397c: 85020000 lh r2,0x0000(r8)                 #       baseConditionalOffset = *baseConditionalOffsetPtr
801c3980: 00102040 sll r4,r16,0x01                  #       count * 2
801c3984: 00461021 addu r2,r2,r6                    #       conditionalOffset = baseConditionalOffset + firstConditionalOffset
801c3988: 00021fc2 srl r3,r2,0x1f                   #       conditionalOffset >> 31
801c398c: 00431021 addu r2,r2,r3                    #       conditionalOffset + (conditionalOffset >> 31)
801c3990: 00021043 sra r2,r2,0x01                   #       (conditionalOffset + (conditionalOffset >> 31)) / 2
801c3994: 00021040 sll r2,r2,0x01                   #       conditionalOffset = ((conditionalOffset + (conditionalOffset >> 31)) / 2) * 2
801c3998: 00471021 addu r2,r2,r7                    #       conditionalOffset + baseBlockPtr
801c399c: 00822021 addu r4,r4,r2                    #       (count * 2) + (conditionalOffset + baseBlockPtr)
801c39a0: 94820000 lhu r2,0x0000(r4)                #       conditionalDataOffset = *((count * 2) + (conditionalOffset + baseBlockPtr))
801c39a4: 26100001 addiu r16,r16,0x0001             #       count = count + 1
801c39a8: a4a20000 sh r2,0x0000(r5)                 #       *storeConditionalDataPtr = conditionalDataOffset
801c39ac: 2a020100 slti r2,r16,0x0100
801c39b0: 1440fff2 bne r2,r0,0x801c397c
801c39b4: 24a50002 addiu r5,r5,0x0002               #       storeConditionalDataPtr = storeConditionalDataPtr + 2
                                                    #   } while (count < 256);
801c39b8: 00008821 addu r17,r0,r0                   #   numSquads = 0
801c39bc: 00008021 addu r16,r0,r0                   #   count = 0
801c39c0: 27a30010 addiu r3,r29,0x0010              #   squadIDPtr = sp + 16      
                                                    #   do {
801c39c4: 8c620000 lw r2,0x0000(r3)                 #       *squadIDPtr
801c39c8: 00000000 nop
801c39cc: 10400002 beq r2,r0,0x801c39d8
801c39d0: 24630004 addiu r3,r3,0x0004               #       squadIDPtr = squadIDPtr + 4
                                                    #       if (*squadIDPtr != 0) {
801c39d4: 26310001 addiu r17,r17,0x0001             #           numSquads = numSquads + 1
                                                    #       }
801c39d8: 26100001 addiu r16,r16,0x0001             #       count = count + 1
801c39dc: 2a020002 slti r2,r16,0x0002
801c39e0: 1440fff8 bne r2,r0,0x801c39c4
801c39e4: 34040033 ori r4,r0,0x0033
                                                    #   } while (count < 2);
801c39e8: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x33, scenarioDataPtr.mapID);                      //  Current map
801c39ec: 02802821 addu r5,r20,r0
801c39f0: 34040030 ori r4,r0,0x0030
801c39f4: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x30, scenarioDataPtr.weatherAndObjects >> 4);     //  Map Arrangement
801c39f8: 00122902 srl r5,r18,0x04
801c39fc: 34040023 ori r4,r0,0x0023
801c3a00: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x30, scenarioDataPtr.weatherAndObjects & 0x0f);   //  Weather
801c3a04: 3245000f andi r5,r18,0x000f
801c3a08: 34040024 ori r4,r0,0x0024
801c3a0c: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x24, scenarioDataPtr.daytimeState);               //  Map State
801c3a10: 02a02821 addu r5,r21,r0
801c3a14: 1260000a beq r19,r0,0x801c3a40            #   if (ENTD_ID != 0) {
801c3a18: 00000000 nop
801c3a1c: 0c04ed64 jal 0x8013b590                   #       var_0x1fc = Get Script Variable (0x1fc);
801c3a20: 340401fc ori r4,r0,0x01fc
801c3a24: 10400004 beq r2,r0,0x801c3a38             
801c3a28: 34040032 ori r4,r0,0x0032                 #       variable = 0x32                     //  Current ENTD
                                                    #       if (var_0x1fc != 0) {
801c3a2c: 8fa5001c lw r5,0x001c(r29)                #           value = braveStoryENTD
801c3a30: 08070e97 j 0x801c3a5c
801c3a34: 00000000 nop
                                                    #       } else {
801c3a38: 08070e97 j 0x801c3a5c
801c3a3c: 02602821 addu r5,r19,r0                   #           value = ENTD_ID
                                                    #       }
                                                    #   } else {
801c3a40: 0c04ed64 jal 0x8013b590                   #       var_0x68 = Get Script Variable (0x68);     //  Randomized Deep Dungeon Exit ID
801c3a44: 34040068 ori r4,r0,0x0068
801c3a48: 28420005 slti r2,r2,0x0005                #       if (var_0x68 >= 5) {
801c3a4c: 14400006 bne r2,r0,0x801c3a68
801c3a50: 34040034 ori r4,r0,0x0034
801c3a54: 34040068 ori r4,r0,0x0068                 #           variable = 0x68
801c3a58: 00002821 addu r5,r0,r0                    #           value = 0
                                                    #       }
                                                    #   }
                                                    #   if ((ENTD_ID != 0) or (var_0x68 >= 5)) {
801c3a5c: 0c04ed91 jal 0x8013b644                   #       Set Script Variable (variable, value);
801c3a60: 00000000 nop
801c3a64: 34040034 ori r4,r0,0x0034 
                                                    #   }
801c3a68: 3c018004 lui r1,0x8004
801c3a6c: ac2059dc sw r0,0x59dc(r1)                 #   *0x800459dc = 0
801c3a70: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x34, numSquads);      //  0x34 = Number of Squads
801c3a74: 02202821 addu r5,r17,r0
801c3a78: 34040039 ori r4,r0,0x0039
801c3a7c: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x39, 0);              //  0x39 = (Overwritten on new event?)
801c3a80: 00002821 addu r5,r0,r0
801c3a84: 8fa50010 lw r5,0x0010(r29)                #   squadID1
801c3a88: 00000000 nop
801c3a8c: 10a00011 beq r5,r0,0x801c3ad4             #   if (squadID1 == 0) return 1;
801c3a90: 34020001 ori r2,r0,0x0001
801c3a94: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x35, squadID1);       //  0x35 = Squad #1 ID
801c3a98: 34040035 ori r4,r0,0x0035
801c3a9c: 8fa50014 lw r5,0x0014(r29)
801c3aa0: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x36, squadID2);       //  0x36 = Squad #2 ID
801c3aa4: 34040036 ori r4,r0,0x0036
801c3aa8: 34040037 ori r4,r0,0x0037
801c3aac: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x37, 0);              
801c3ab0: 00002821 addu r5,r0,r0
801c3ab4: 34040038 ori r4,r0,0x0038
801c3ab8: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x38, 0);
801c3abc: 00002821 addu r5,r0,r0
801c3ac0: 340401ff ori r4,r0,0x01ff
801c3ac4: 02c02821 addu r5,r22,r0
801c3ac8: 0c04ed91 jal 0x8013b644                   #   Set Script Variable (0x01ff, scenarioDataPtr.ramzaMandatoryFlag);
801c3acc: 00000000 nop
801c3ad0: 00001021 addu r2,r0,r0                    #   return 0;
801c3ad4: 8fbf0044 lw r31,0x0044(r29)
801c3ad8: 8fb60040 lw r22,0x0040(r29)
801c3adc: 8fb5003c lw r21,0x003c(r29)
801c3ae0: 8fb40038 lw r20,0x0038(r29)
801c3ae4: 8fb30034 lw r19,0x0034(r29)
801c3ae8: 8fb20030 lw r18,0x0030(r29)
801c3aec: 8fb1002c lw r17,0x002c(r29)
801c3af0: 8fb00028 lw r16,0x0028(r29)
801c3af4: 27bd0048 addiu r29,r29,0x0048
801c3af8: 03e00008 jr r31
801c3afc: 00000000 nop