Advertisement
MrCheeze

Majora's Mask - button dim logic

Dec 3rd, 2019
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 202.66 KB | None | 0 0
  1. void func_80110038(void *arg0, u8 arg2)
  2. {
  3.     void *sp74;
  4.     s16 sp72;
  5.     s16 sp70;
  6.     void *sp28;
  7.     void *sp1C;
  8.     s16 temp_a3_8;
  9.     s16 temp_t3;
  10.     s16 temp_t3_2;
  11.     s32 temp_a3;
  12.     s32 temp_a3_10;
  13.     s32 temp_a3_11;
  14.     s32 temp_a3_2;
  15.     s32 temp_a3_3;
  16.     s32 temp_a3_4;
  17.     s32 temp_a3_5;
  18.     s32 temp_a3_6;
  19.     s32 temp_a3_7;
  20.     s32 temp_a3_9;
  21.     u8 temp_a1_11;
  22.     u8 temp_t1;
  23.     u8 temp_t6;
  24.     u8 temp_t8;
  25.     u8 temp_t9;
  26.     u8 temp_v0;
  27.     u8 temp_v0_10;
  28.     u8 temp_v0_11;
  29.     u8 temp_v0_12;
  30.     u8 temp_v0_13;
  31.     u8 temp_v0_14;
  32.     u8 temp_v0_15;
  33.     u8 temp_v0_16;
  34.     u8 temp_v0_17;
  35.     u8 temp_v0_18;
  36.     u8 temp_v0_19;
  37.     u8 temp_v0_20;
  38.     u8 temp_v0_21;
  39.     u8 temp_v0_22;
  40.     u8 temp_v0_23;
  41.     u8 temp_v0_24;
  42.     u8 temp_v0_25;
  43.     u8 temp_v0_26;
  44.     u8 temp_v0_27;
  45.     u8 temp_v0_28;
  46.     u8 temp_v0_29;
  47.     u8 temp_v0_30;
  48.     u8 temp_v0_31;
  49.     u8 temp_v0_32;
  50.     u8 temp_v0_3;
  51.     u8 temp_v0_4;
  52.     u8 temp_v0_5;
  53.     u8 temp_v0_6;
  54.     u8 temp_v0_7;
  55.     u8 temp_v0_8;
  56.     u8 temp_v0_9;
  57.     void *temp_a1;
  58.     void *temp_a1_10;
  59.     void *temp_a1_12;
  60.     void *temp_a1_13;
  61.     void *temp_a1_14;
  62.     void *temp_a1_15;
  63.     void *temp_a1_16;
  64.     void *temp_a1_17;
  65.     void *temp_a1_18;
  66.     void *temp_a1_19;
  67.     void *temp_a1_20;
  68.     void *temp_a1_21;
  69.     void *temp_a1_22;
  70.     void *temp_a1_23;
  71.     void *temp_a1_24;
  72.     void *temp_a1_2;
  73.     void *temp_a1_3;
  74.     void *temp_a1_4;
  75.     void *temp_a1_5;
  76.     void *temp_a1_6;
  77.     void *temp_a1_7;
  78.     void *temp_a1_8;
  79.     void *temp_a1_9;
  80.     void *temp_v0_2;
  81.     void *temp_v0_33;
  82.     s32 phi_a3;
  83.     u8 phi_a2;
  84.     void *phi_a1;
  85.     s32 phi_a3_2;
  86.     s32 phi_a3_3;
  87.     s32 phi_a3_4;
  88.     u8 phi_a2_2;
  89.     u8 phi_a0;
  90.     u8 phi_v0;
  91.     void *phi_a1_2;
  92.     s32 phi_a3_5;
  93.     u8 phi_a2_3;
  94.     u8 phi_a0_2;
  95.     void *phi_a1_3;
  96.     s32 phi_a3_6;
  97.     u8 phi_a2_4;
  98.     s32 phi_a3_7;
  99.     s16 phi_t3;
  100.     u8 phi_a2_5;
  101.     u8 phi_a2_6;
  102.     s16 phi_t3_2;
  103.     u8 phi_a2_7;
  104.     u8 phi_v1;
  105.     u8 phi_a2_8;
  106.     u8 phi_a2_9;
  107.     u8 phi_a2_10;
  108.     s16 phi_a3_8;
  109.     s32 phi_t2;
  110.     void *phi_t0;
  111.     u8 phi_a2_11;
  112.     void *phi_a1_4;
  113.     s16 phi_t3_3;
  114.     u8 phi_a2_12;
  115.     u8 phi_a0_3;
  116.     s32 phi_t4;
  117.     s16 phi_t3_4;
  118.     void *phi_t0_2;
  119.     s32 phi_a3_9;
  120.     u8 phi_a2_13;
  121.     void *phi_a1_5;
  122.     u8 phi_a2_14;
  123.     u8 phi_v1_2;
  124.     u8 phi_a0_4;
  125.     u8 phi_a2_15;
  126.     u8 phi_a2_16;
  127.     u8 phi_a1_6;
  128.     u8 phi_a2_17;
  129.     u8 phi_a2_18;
  130.     u8 phi_a2_19;
  131.     u8 phi_v1_3;
  132.     u8 phi_a0_5;
  133.     u8 phi_a2_20;
  134.     u8 phi_a2_21;
  135.     void *phi_t0_3;
  136.     u8 phi_t7;
  137.     void *phi_t0_4;
  138.     s32 phi_a3_10;
  139.     s32 phi_t2_2;
  140.     u8 phi_a2_22;
  141.     s32 phi_t4_2;
  142.     u8 phi_a2_23;
  143.     u8 phi_a2_24;
  144.     u8 phi_a2_25;
  145.     u8 phi_a2_26;
  146.     u8 phi_a0_6;
  147.     u8 phi_v0_2;
  148.     u8 phi_v0_3;
  149.     u8 phi_v0_4;
  150.     u8 phi_a2_27;
  151.     u8 phi_a0_7;
  152.     u8 phi_v0_5;
  153.     u8 phi_v0_6;
  154.     u8 phi_v0_7;
  155.     u8 phi_a2_28;
  156.     u8 phi_a0_8;
  157.     u8 phi_a2_29;
  158.     u8 phi_a0_9;
  159.     u8 phi_a2_30;
  160.     u8 phi_a2_31;
  161.     u8 phi_a2_32;
  162.     u8 phi_a0_10;
  163.     u8 phi_v0_8;
  164.     u8 phi_v0_9;
  165.     u8 phi_v0_10;
  166.     u8 phi_v0_11;
  167.     u8 phi_v0_12;
  168.     u8 phi_v0_13;
  169.     u8 phi_a2_33;
  170.     u8 phi_a0_11;
  171.     u8 phi_v0_14;
  172.     u8 phi_v0_15;
  173.     u8 phi_v0_16;
  174.     u8 phi_v0_17;
  175.     u8 phi_v0_18;
  176.     u8 phi_v0_19;
  177.     s16 phi_t3_5;
  178.     void *phi_t0_5;
  179.     u8 phi_v1_4;
  180.     u8 phi_v1_5;
  181.     u8 phi_v1_6;
  182.     u8 phi_v1_7;
  183.     u8 phi_v1_8;
  184.     u8 phi_v1_9;
  185.     s16 phi_t3_6;
  186.     u8 phi_v1_10;
  187.     u8 phi_v1_11;
  188.     u8 phi_v1_12;
  189.     u8 phi_v1_13;
  190.     void *phi_t1;
  191.     u8 phi_v1_14;
  192.     u8 phi_v1_15;
  193.     u8 phi_v1_16;
  194.     u8 phi_v1_17;
  195.     u8 phi_v1_18;
  196.     u8 phi_v1_19;
  197.     u8 phi_v1_20;
  198.     u8 phi_v1_21;
  199.     u8 phi_v1_22;
  200.     u8 phi_v1_23;
  201.     u8 phi_v1_24;
  202.     u8 phi_v1_25;
  203.     u8 phi_v1_26;
  204.     u8 phi_v1_27;
  205.     u8 phi_v1_28;
  206.     u8 phi_v1_29;
  207.     u8 phi_v1_30;
  208.     u8 phi_v1_31;
  209.     u8 phi_v1_32;
  210.     u8 phi_v1_33;
  211.     u8 phi_v1_34;
  212.     u8 phi_v1_35;
  213.     u8 phi_v1_36;
  214.     u8 phi_v1_37;
  215.     u8 phi_v1_38;
  216.     u8 phi_v1_39;
  217.     u8 phi_v1_40;
  218.     u8 phi_v1_41;
  219.     u8 phi_v1_42;
  220.     u8 phi_v1_43;
  221.     u8 phi_v1_44;
  222.     u8 phi_v1_45;
  223.     u8 phi_v1_46;
  224.     u8 phi_v1_47;
  225.     u8 phi_v1_48;
  226.     u8 phi_v1_49;
  227.     s16 phi_t3_7;
  228.     s16 phi_t3_8;
  229.     s16 phi_t3_9;
  230.     s16 phi_t3_10;
  231.     s16 phi_t3_11;
  232.     s16 phi_t3_12;
  233.     s32 phi_t2_3;
  234.     s16 phi_t3_13;
  235.     s16 phi_t3_14;
  236.     s16 phi_t3_15;
  237.     s16 phi_t3_16;
  238.     s16 phi_t3_17;
  239.     s16 phi_t3_18;
  240.     s16 phi_t3_19;
  241.     s16 phi_t3_20;
  242.     s16 phi_t3_21;
  243.     s16 phi_t3_22;
  244.  
  245.     if ((D_801EF670.unk1010 & 2) != 0) // in boat ride
  246.     {
  247.         phi_a3 = 1;
  248.         phi_t3_22 = (u16)0;
  249. loop_2:
  250.         if (phi_a3 == 0)
  251.         {
  252.             if (4 == D_801EF670.unk20) // current transformation (4=link, 0=FD)
  253.             {
  254.                 phi_v1_4 = (u8)0U;
  255.             }
  256.             else
  257.             {
  258.                 phi_v1_4 = D_801EF670.unk20; // current transformation
  259.             }
  260.             phi_a2 = ((&D_801EF670 + (phi_v1_4 * 4)) + phi_a3)->unk4C; // B button per transformation
  261.             phi_a1 = &D_801EF670 + phi_a3;
  262.         }
  263.         else
  264.         {
  265.             temp_a1 = &D_801EF670 + phi_a3;
  266.             phi_a2 = temp_a1->unk4C;
  267.             phi_a1 = temp_a1;
  268.         }
  269.         if (0xd == (phi_a2 & 0xff))
  270.         {
  271.             if ((arg0 + 0x10000)->unk682A != 0)
  272.             {
  273. block_10:
  274.                 phi_t3_16 = phi_t3_22;
  275.                 if (phi_a1->unk3F18 == 0)
  276.                 {
  277.                     phi_t3_16 = (u16)1;
  278.                 }
  279.                 phi_a1->unk3F18 = (u8)0xffU;
  280.             }
  281.             else
  282.             {
  283.                 phi_t3_16 = phi_t3_22;
  284.                 if (0xff == phi_a1->unk3F18)
  285.                 {
  286.                     phi_t3_16 = (u16)1;
  287.                 }
  288.                 phi_a1->unk3F18 = (u8)0U;
  289.             }
  290.         }
  291.         else
  292.         {
  293.             goto block_10;
  294.         }
  295.         temp_a3 = (s32) ((phi_a3 + 1) << 0x10) >> 0x10;
  296.         phi_a3 = temp_a3;
  297.         phi_t3_22 = phi_t3_16;
  298.         if (temp_a3 < 4)
  299.         {
  300.             goto loop_2;
  301.         }
  302.         if (D_801BF884 == 0)
  303.         {
  304.             phi_t3_5 = phi_t3_16;
  305.             if (0xff != D_801EF670.unk3F18)
  306.             {
  307.                 phi_t3_5 = (u16)1;
  308.             }
  309.             D_801EF670.unk3F18 = (u8)0xffU;
  310.             phi_t0_5 = &D_801EF670;
  311.         }
  312.         else
  313.         {
  314.             phi_t3_5 = phi_t3_16;
  315.             if (0xff == D_801EF670.unk3F18)
  316.             {
  317.                 phi_t3_5 = (u16)1;
  318.             }
  319.             D_801EF670.unk3F18 = (u8)0U;
  320.             phi_t0_5 = &D_801EF670;
  321.         }
  322.     }
  323.     else // not in boat ride
  324.     {
  325.         if ((D_801EF670.unkF52 & 0x20) != 0) // Fisherman's Jumping Game that hides all except B
  326.         {
  327.             phi_a3_2 = 1;
  328. loop_26:
  329.             temp_a1_2 = &D_801EF670 + phi_a3_2;
  330.             if (temp_a1_2->unk3F18 == 0)
  331.             {
  332.                 temp_a1_2->unk3F18 = (u8)0xffU;
  333.             }
  334.             temp_a3_2 = (s32) ((phi_a3_2 + 1) << 0x10) >> 0x10;
  335.             phi_a3_2 = temp_a3_2;
  336.             if (temp_a3_2 < 4)
  337.             {
  338.                 goto loop_26;
  339.             }
  340.             sp70 = (u16)0;
  341.             func_8010EF68(8, temp_a1_2, temp_a3_2);
  342.             phi_t3_5 = (u16)0;
  343.             phi_t0_5 = &D_801EF670;
  344.         }
  345.         else // not Fisherman's Jumping Game
  346.         {
  347.             if ((D_801EF670.unkF4A & 8) != 0) // Swordsman hides C
  348.             {
  349.                 phi_a3_3 = 1;
  350. loop_32:
  351.                 temp_a1_3 = &D_801EF670 + phi_a3_3;
  352.                 if (temp_a1_3->unk3F18 == 0)
  353.                 {
  354.                     temp_a1_3->unk3F18 = (u8)0xffU;
  355.                 }
  356.                 temp_a3_3 = (s32) ((phi_a3_3 + 1) << 0x10) >> 0x10;
  357.                 phi_a3_3 = temp_a3_3;
  358.                 if (temp_a3_3 < 4)
  359.                 {
  360.                     goto loop_32;
  361.                 }
  362.                 sp70 = (u16)0;
  363.                 func_8010EF68(0x16, temp_a1_3, temp_a3_3);
  364.                 phi_t3_5 = (u16)0;
  365.                 phi_t0_5 = &D_801EF670;
  366.             }
  367.             else // not Swordsman
  368.             {
  369.                 if ((D_801EF670.unkF4C & 0x20) != 0) // moon children enable all except transformation masks
  370.                 {
  371.                     if (arg0->unk1CCC->unk153 == 0x15)
  372.                     {
  373.                         phi_a3_4 = 1;
  374.                         phi_t3_15 = (u16)0;
  375. loop_39:
  376.                         if (phi_a3_4 == 0)
  377.                         {
  378.                             if (4 == D_801EF670.unk20)
  379.                             {
  380.                                 phi_v1_5 = (u8)0U;
  381.                             }
  382.                             else
  383.                             {
  384.                                 phi_v1_5 = D_801EF670.unk20;
  385.                             }
  386.                             phi_a2_2 = ((&D_801EF670 + (phi_v1_5 * 4)) + phi_a3_4)->unk4C;
  387.                             phi_a1_2 = &D_801EF670 + phi_a3_4;
  388.                         }
  389.                         else
  390.                         {
  391.                             temp_a1_4 = &D_801EF670 + phi_a3_4;
  392.                             phi_a2_2 = temp_a1_4->unk4C;
  393.                             phi_a1_2 = temp_a1_4;
  394.                         }
  395.                         if (0x35 != (phi_a2_2 & 0xff))
  396.                         {
  397.                             if (phi_a3_4 == 0)
  398.                             {
  399.                                 if (4 == D_801EF670.unk20)
  400.                                 {
  401.                                     phi_v1_6 = (u8)0U;
  402.                                 }
  403.                                 else
  404.                                 {
  405.                                     phi_v1_6 = D_801EF670.unk20;
  406.                                 }
  407.                                 phi_a0 = ((&D_801EF670 + (phi_v1_6 * 4)) + phi_a3_4)->unk4C;
  408.                             }
  409.                             else
  410.                             {
  411.                                 phi_a0 = phi_a1_2->unk4C;
  412.                             }
  413.                             if ((phi_a0 & 0xff) >= 0x12)
  414.                             {
  415.                                 if (phi_a3_4 == 0)
  416.                                 {
  417.                                     if (4 == D_801EF670.unk20)
  418.                                     {
  419.                                         phi_v1_7 = (u8)0U;
  420.                                     }
  421.                                     else
  422.                                     {
  423.                                         phi_v1_7 = D_801EF670.unk20;
  424.                                     }
  425.                                     phi_v0 = ((&D_801EF670 + (phi_v1_7 * 4)) + phi_a3_4)->unk4C;
  426.                                 }
  427.                                 else
  428.                                 {
  429.                                     phi_v0 = phi_a1_2->unk4C;
  430.                                 }
  431.                                 if ((phi_v0 & 0xff) < 0x28)
  432.                                 {
  433. block_60:
  434.                                     phi_t3_12 = phi_t3_15;
  435.                                     if (0xff == phi_a1_2->unk3F18)
  436.                                     {
  437.                                         phi_a1_2->unk3F18 = (u8)0U;
  438.                                         phi_t3_12 = (u16)1;
  439.                                     }
  440.                                 }
  441.                                 else
  442.                                 {
  443. block_62:
  444.                                     phi_t3_12 = phi_t3_15;
  445.                                     if (0xff != phi_a1_2->unk3F18)
  446.                                     {
  447.                                         phi_a1_2->unk3F18 = (u8)0xffU;
  448.                                         phi_t3_12 = (u16)1;
  449.                                     }
  450.                                 }
  451.                             }
  452.                             else
  453.                             {
  454.                                 goto block_62;
  455.                             }
  456.                         }
  457.                         else
  458.                         {
  459.                             goto block_60;
  460.                         }
  461.                         temp_a3_4 = (s32) ((phi_a3_4 + 1) << 0x10) >> 0x10;
  462.                         phi_a3_4 = temp_a3_4;
  463.                         phi_t3_15 = phi_t3_12;
  464.                         if (temp_a3_4 < 4)
  465.                         {
  466.                             goto loop_39;
  467.                         }
  468.                         phi_t3_5 = phi_t3_12;
  469.                         phi_t0_5 = &D_801EF670;
  470.                     }
  471.                     else
  472.                     {
  473.                         phi_a3_5 = 1;
  474.                         phi_t3_20 = (u16)0;
  475. loop_67:
  476.                         if (phi_a3_5 == 0)
  477.                         {
  478.                             if (4 == D_801EF670.unk20)
  479.                             {
  480.                                 phi_v1_8 = (u8)0U;
  481.                             }
  482.                             else
  483.                             {
  484.                                 phi_v1_8 = D_801EF670.unk20;
  485.                             }
  486.                             phi_a2_3 = ((&D_801EF670 + (phi_v1_8 * 4)) + phi_a3_5)->unk4C;
  487.                             phi_a1_3 = &D_801EF670 + phi_a3_5;
  488.                         }
  489.                         else
  490.                         {
  491.                             temp_a1_5 = &D_801EF670 + phi_a3_5;
  492.                             phi_a2_3 = temp_a1_5->unk4C;
  493.                             phi_a1_3 = temp_a1_5;
  494.                         }
  495.                         if ((phi_a2_3 & 0xff) >= 0x32)
  496.                         {
  497.                             if (phi_a3_5 == 0)
  498.                             {
  499.                                 if (4 == D_801EF670.unk20)
  500.                                 {
  501.                                     phi_v1_9 = (u8)0U;
  502.                                 }
  503.                                 else
  504.                                 {
  505.                                     phi_v1_9 = D_801EF670.unk20;
  506.                                 }
  507.                                 phi_a0_2 = ((&D_801EF670 + (phi_v1_9 * 4)) + phi_a3_5)->unk4C;
  508.                             }
  509.                             else
  510.                             {
  511.                                 phi_a0_2 = phi_a1_3->unk4C;
  512.                             }
  513.                             if ((phi_a0_2 & 0xff) < 0x35)
  514.                             {
  515.                                 phi_t3_11 = phi_t3_20;
  516.                                 if (0xff != phi_a1_3->unk3F18)
  517.                                 {
  518.                                     phi_t3_11 = (u16)1;
  519.                                 }
  520.                                 phi_a1_3->unk3F18 = (u8)0xffU;
  521.                             }
  522.                             else
  523.                             {
  524. block_84:
  525.                                 phi_t3_11 = phi_t3_20;
  526.                                 if (0xff == phi_a1_3->unk3F18)
  527.                                 {
  528.                                     phi_t3_11 = (u16)1;
  529.                                 }
  530.                                 phi_a1_3->unk3F18 = (u8)0U;
  531.                             }
  532.                         }
  533.                         else
  534.                         {
  535.                             goto block_84;
  536.                         }
  537.                         temp_a3_5 = (s32) ((phi_a3_5 + 1) << 0x10) >> 0x10;
  538.                         phi_a3_5 = temp_a3_5;
  539.                         phi_t3_20 = phi_t3_11;
  540.                         if (temp_a3_5 < 4)
  541.                         {
  542.                             goto loop_67;
  543.                         }
  544.                         phi_t3_5 = phi_t3_11;
  545.                         phi_t0_5 = &D_801EF670;
  546.                     }
  547.                 }
  548.                 else // not moon children
  549.                 {
  550.                     if (arg0->unkA4 == 8) // in cutscene scene
  551.                     {
  552.                         if (D_801EF670.unk3CAC == 6) // cutscene entrance mod = 6
  553.                         {
  554.                             phi_a3_6 = 1;
  555.                             phi_t3_10 = (u16)0;
  556. loop_92:
  557.                             temp_a1_6 = &D_801EF670 + phi_a3_6;
  558.                             if (temp_a1_6->unk3F18 == 0)
  559.                             {
  560.                                 phi_t3_10 = (u16)1;
  561.                             }
  562.                             temp_a3_6 = (s32) ((phi_a3_6 + 1) << 0x10) >> 0x10;
  563.                             temp_a1_6->unk3F18 = (u8)0xffU; // disable C buttons
  564.                             phi_a3_6 = temp_a3_6;
  565.                             phi_t3_10 = phi_t3_10;
  566.                             if (temp_a3_6 < 4)
  567.                             {
  568.                                 goto loop_92;
  569.                             }
  570.                             phi_t3_5 = phi_t3_10;
  571.                             phi_t0_5 = &D_801EF670;
  572.                         }
  573.                         else // not in cutscene with entrance mod 6
  574.                         {
  575. block_96:
  576.                             if ((D_801EF670.unk100F & 0x10) != 0) // Deku Scrub Playground - B and A only
  577.                             {
  578.                                 if ((arg0->unk1CCC->unkA74 << 7) < 0) // |= 01000000 -- deku flying
  579.                                 {
  580.                                     if (9 == D_801EF670.unk79) // nuts in inventory
  581.                                     {
  582.                                         if (4 == D_801EF670.unk20)
  583.                                         {
  584.                                             phi_a2_4 = (u8)0U;
  585.                                         }
  586.                                         else
  587.                                         {
  588.                                             phi_a2_4 = D_801EF670.unk20;
  589.                                         }
  590.                                         (&D_801EF670 + (phi_a2_4 * 4))->unk4C = (u8)9; // put nuts on B
  591.                                         sp70 = (u16)0;
  592.                                         func_80112B40(arg0, 0, phi_a2_4, 1);
  593.                                         phi_t3 = (u16)0;
  594.                                     }
  595.                                     else
  596.                                     {
  597.                                         D_801EF670.unk3F18 = (u8)0xffU; // disable B
  598.                                         phi_t3 = (u16)1;
  599.                                     }
  600.                                 }
  601.                                 else // not deku flying
  602.                                 {
  603.                                     phi_t3_6 = (u16)0;
  604.                                     if (0xff == D_801EF670.unk3F18)
  605.                                     {
  606.                                         D_801EF670.unk3F18 = (u8)0U; // enable B
  607.                                         phi_t3_6 = (u16)1;
  608.                                     }
  609.                                     phi_a3_7 = 1;
  610. loop_107:
  611.                                     temp_a1_7 = &D_801EF670 + phi_a3_7;
  612.                                     if (temp_a1_7->unk3F18 == 0)
  613.                                     {
  614.                                         phi_t3_6 = (u16)1;
  615.                                     }
  616.                                     temp_a3_7 = (s32) ((phi_a3_7 + 1) << 0x10) >> 0x10;
  617.                                     temp_a1_7->unk3F18 = (u8)0xffU; // disable all C
  618.                                     phi_a3_7 = temp_a3_7;
  619.                                     phi_t3 = phi_t3_6;
  620.                                     phi_t3_6 = phi_t3_6;
  621.                                     if (temp_a3_7 < 4)
  622.                                     {
  623.                                         goto loop_107;
  624.                                     }
  625.                                 }
  626.                                 if (phi_t3 == 0)
  627.                                 {
  628.                                     phi_t3_5 = phi_t3;
  629.                                     phi_t0_5 = &D_801EF670;
  630.                                     if (&D_801EF670->unk3F22 != 0xc)
  631.                                     {
  632. block_112:
  633.                                         &D_801EF670->unk3F22 = (u16)0U;
  634.                                         sp70 = (u16)0;
  635.                                         func_8010EF68(0xc);
  636.                                         phi_t3_5 = sp70;
  637.                                         phi_t0_5 = &D_801EF670;
  638.                                     }
  639.                                 }
  640.                                 else
  641.                                 {
  642.                                     goto block_112;
  643.                                 }
  644.                             }
  645.                             else // not Deku Scrub Playground
  646.                             {
  647.                                 if ((arg0->unk1CCC->unkA74 << 7) < 0) // |= 01000000 -- deku flying
  648.                                 {
  649.                                     if (9 == D_801EF670.unk79) // deku nuts in inventory
  650.                                     {
  651.                                         if (4 == D_801EF670.unk20)
  652.                                         {
  653.                                             phi_a2_5 = (u8)0U;
  654.                                         }
  655.                                         else
  656.                                         {
  657.                                             phi_a2_5 = D_801EF670.unk20;
  658.                                         }
  659.                                         phi_t3_2 = (u16)0;
  660.                                         if (9 != (&D_801EF670 + (phi_a2_5 * 4))->unk4C) // deku nuts/shoot are not on B
  661.                                         {
  662.                                             if (4 == D_801EF670.unk20)
  663.                                             {
  664.                                                 phi_a2_6 = (u8)0U;
  665.                                             }
  666.                                             else
  667.                                             {
  668.                                                 phi_a2_6 = D_801EF670.unk20;
  669.                                             }
  670.                                             (&D_801EF670 + (phi_a2_6 * 4))->unk4C = (u8)9; // add deku nuts/shoot to B
  671.                                             func_80112B40(arg0, 0, phi_a2_6, 1);
  672.                                             D_801EF670.unk3F18 = (u8)0; // enable B
  673.                                             phi_t3_2 = (u16)1;
  674.                                         }
  675.                                     }
  676.                                     else // deku nuts not in inventory
  677.                                     {
  678.                                         phi_t3_2 = (u16)0;
  679.                                         if (D_801EF670.unk3F18 == 0) // if B is enabled
  680.                                         {
  681.                                             D_801EF670.unk3F18 = (u8)0xffU; // disable B
  682.                                             phi_t3_2 = (u16)1;
  683.                                         }
  684.                                     }
  685.                                     phi_t3_5 = phi_t3_2;
  686.                                     phi_t0_5 = &D_801EF670;
  687.                                     if (phi_t3_2 != 0) // disabled/enabled B this frame
  688.                                     {
  689.                                         &D_801EF670->unk3F19 = (u8)0xff; // disable C
  690.                                         &D_801EF670->unk3F1A = (u8)0xff;
  691.                                         &D_801EF670->unk3F1B = (u8)0xff;
  692.                                         phi_t3_5 = phi_t3_2;
  693.                                         phi_t0_5 = &D_801EF670;
  694.                                     }
  695.                                 }
  696.                                 else // not deku flying
  697.                                 {
  698.                                     phi_a2_9 = arg2;
  699.                                     if (D_801EF670.unk40 == 0) // don't have magic
  700.                                     {
  701.                                         if (4 == D_801EF670.unk20)
  702.                                         {
  703.                                             phi_a2_7 = (u8)0U;
  704.                                         }
  705.                                         else
  706.                                         {
  707.                                             phi_a2_7 = D_801EF670.unk20;
  708.                                         }
  709.                                         phi_a2_9 = phi_a2_7;
  710.                                         if (phi_a2_7 == 3) // is deku
  711.                                         {
  712.                                             if (4 == D_801EF670.unk20)
  713.                                             {
  714.                                                 phi_v1 = (u8)0U;
  715.                                             }
  716.                                             else
  717.                                             {
  718.                                                 phi_v1 = D_801EF670.unk20;
  719.                                             }
  720.                                             phi_a2_9 = phi_a2_7;
  721.                                             if (9 == (&D_801EF670 + (phi_v1 * 4))->unk4C) // deku B is nuts/shoot
  722.                                             {
  723.                                                 if (4 == D_801EF670.unk20)
  724.                                                 {
  725.                                                     phi_a2_8 = (u8)0U;
  726.                                                 }
  727.                                                 else
  728.                                                 {
  729.                                                     phi_a2_8 = D_801EF670.unk20;
  730.                                                 }
  731.                                                 (&D_801EF670 + (phi_a2_8 * 4))->unk4C = (u8)0xfd; // make deku B blank
  732.                                                 D_801EF670.unk3F18 = (u8)0xffU; //disable B, although this only takes effect for one frame
  733.                                                 phi_t3_5 = (u16)0;
  734.                                                 phi_t0_5 = &D_801EF670;
  735.                                             }
  736.                                             else // not blanking out deku B this frame
  737.                                             {
  738. block_140:
  739.                                                 sp74 = (void *) arg0->unk1CCC;
  740.                                                 sp70 = (u16)0;
  741.                                                 if (func_801242DC(arg0, arg0->unk1CCC, phi_a2_9, 1) >= 2) // if in water
  742.                                                 {
  743.                                                     sp70 = (u16)0;
  744.                                                     if (func_801242DC(arg0) < 5) // if in water
  745.                                                     {
  746.                                                         if (4 == D_801EF670.unk20)
  747.                                                         {
  748.                                                             phi_a2_10 = (u8)0U;
  749.                                                         }
  750.                                                         else
  751.                                                         {
  752.                                                             phi_a2_10 = D_801EF670.unk20;
  753.                                                         }
  754.                                                         if (phi_a2_10 != 2) // not zora
  755.                                                         {
  756.                                                             if (0x12 == sp74->unk153) // wearing blast mask
  757.                                                             {
  758.                                                                 if (sp74->unkB60 == 0) // blast mask timer done
  759.                                                                 {
  760.                                                                     phi_t3_3 = (u16)0;
  761.                                                                     if (0xff == D_801EF670.unk1015)
  762.                                                                     {
  763.                                                                         phi_t3_3 = (u16)1;
  764.                                                                     }
  765.                                                                     D_801EF670.unk1015 = (u8)0U; // enable B from 1F0685
  766. block_162:
  767.                                                                     phi_a3_8 = (u16)1;
  768.                                                                     phi_t2 = 4;
  769.                                                                     phi_t0 = &D_801EF670;
  770.                                                                 }
  771.                                                                 else // blast mask not worn or timer done
  772.                                                                 {
  773. block_151:
  774.                                                                     if ((0x10000 + arg0)->unk6C06 == 0x18) // blast mask action on B
  775.                                                                     {
  776.                                                                         if (0x12 == sp74->unk153) // wearing blast mask
  777.                                                                         {
  778.                                                                             phi_t3_3 = (u16)0;
  779.                                                                             if (0xff != D_801EF670.unk1015) // if B not disabled from 1F0685
  780.                                                                             {
  781.                                                                                 D_801EF670.unk1015 = (u8)0xffU; // disable B from 1F0685
  782.                                                                                 phi_t3_3 = (u16)1;
  783.                                                                             }
  784.                                                                             phi_a3_8 = (u16)1;
  785.                                                                             phi_t2 = 4;
  786.                                                                             phi_t0 = &D_801EF670;
  787.                                                                             phi_t4 = 0xff;
  788.                                                                         }
  789.                                                                         else // not wearing blast mask
  790.                                                                         {
  791. block_156:
  792.                                                                             phi_t3_3 = (u16)0;
  793.                                                                             if (0xff != D_801EF670.unk3F18)
  794.                                                                             {
  795.                                                                                 phi_t3_3 = (u16)1;
  796.                                                                             }
  797.                                                                             D_801EF670.unk3F18 = (u8)0xffU; // disable B
  798.                                                                             goto block_162;
  799.                                                                         }
  800.                                                                     }
  801.                                                                     else // blast mask action not on B
  802.                                                                     {
  803.                                                                         goto block_156;
  804.                                                                     }
  805.                                                                 }
  806.                                                             }
  807.                                                             else // not wearing blast mask
  808.                                                             {
  809.                                                                 goto block_151;
  810.                                                             }
  811.                                                         }
  812.                                                         else // zora
  813.                                                         {
  814.                                                             phi_t3_3 = (u16)0;
  815.                                                             if (0xff == D_801EF670.unk3F18) // if B disabled
  816.                                                             {
  817.                                                                 phi_t3_3 = (u16)1;
  818.                                                             }
  819.                                                             D_801EF670.unk3F18 = (u8)0U; // enable B
  820.                                                             goto block_162;
  821.                                                         }
  822. loop_163:
  823.                                                         if (phi_a3_8 == 0) // currently iterating over B button (never)
  824.                                                         {
  825.                                                             temp_v0 = phi_t0->unk20;
  826.                                                             if (phi_t2 == temp_v0)
  827.                                                             {
  828.                                                                 phi_v1_10 = (u8)0U;
  829.                                                             }
  830.                                                             else
  831.                                                             {
  832.                                                                 phi_v1_10 = temp_v0;
  833.                                                             }
  834.                                                             phi_a2_11 = ((phi_t0 + (phi_v1_10 * 4)) + phi_a3_8)->unk4C;
  835.                                                             phi_a1_4 = phi_t0 + phi_a3_8;
  836.                                                         }
  837.                                                         else // normal
  838.                                                         {
  839.                                                             temp_a1_8 = phi_t0 + phi_a3_8;
  840.                                                             phi_a2_11 = temp_a1_8->unk4C;
  841.                                                             phi_a1_4 = temp_a1_8;
  842.                                                         }
  843.                                                         if ((phi_a2_11 & 0xff) != 0x34) // item isn't zora mask
  844.                                                         {
  845.                                                             sp1C = (void *) phi_a1_4;
  846.                                                             sp72 = (s16) phi_a3_8;
  847.                                                             sp70 = (s16) phi_t3_3;
  848.                                                             temp_a1_9 = phi_a1_4;
  849.                                                             temp_a3_8 = phi_a3_8;
  850.                                                             temp_t3 = phi_t3_3;
  851.                                                             if (func_801242DC(arg0, phi_a1_4, phi_a2_11, phi_a3_8) == 2) // standing on bottom
  852.                                                             {
  853.                                                                 if (temp_a3_8 == 0) // currently iterating over B button (never)
  854.                                                                 {
  855.                                                                     if (4 == D_801EF670.unk20)
  856.                                                                     {
  857.                                                                         phi_v1_11 = (u8)0U;
  858.                                                                     }
  859.                                                                     else
  860.                                                                     {
  861.                                                                         phi_v1_11 = D_801EF670.unk20;
  862.                                                                     }
  863.                                                                     phi_a2_12 = ((&D_801EF670 + (phi_v1_11 * 4)) + temp_a3_8)->unk4C;
  864.                                                                 }
  865.                                                                 else // normal
  866.                                                                 {
  867.                                                                     phi_a2_12 = temp_a1_9->unk4C;
  868.                                                                 }
  869.                                                                 if ((phi_a2_12 & 0xff) >= 0x12) // item is bottle
  870.                                                                 {
  871.                                                                     if (temp_a3_8 == 0) // currently iterating over B button (never)
  872.                                                                     {
  873.                                                                         if (4 == D_801EF670.unk20)
  874.                                                                         {
  875.                                                                             phi_v1_12 = (u8)0U;
  876.                                                                         }
  877.                                                                         else
  878.                                                                         {
  879.                                                                             phi_v1_12 = D_801EF670.unk20;
  880.                                                                         }
  881.                                                                         phi_a0_3 = ((&D_801EF670 + (phi_v1_12 * 4)) + temp_a3_8)->unk4C;
  882.                                                                     }
  883.                                                                     else // normal
  884.                                                                     {
  885.                                                                         phi_a0_3 = temp_a1_9->unk4C;
  886.                                                                     }
  887.                                                                     if ((phi_a0_3 & 0xff) >= 0x28) // item isn't bottle
  888.                                                                     {
  889. block_185:
  890.                                                                         phi_t3_4 = temp_t3;
  891.                                                                         if (temp_a1_9->unk3F18 == 0)
  892.                                                                         {
  893.                                                                             phi_t3_4 = (u16)1;
  894.                                                                         }
  895.                                                                         temp_a1_9->unk3F18 = (u8)0xffU; // disable item
  896.                                                                         phi_t0_2 = &D_801EF670;
  897.                                                                         phi_t2 = 4;
  898.                                                                         phi_t4 = 0xff;
  899.                                                                     }
  900.                                                                     else // item is bottle
  901.                                                                     {
  902.                                                                         phi_t3_4 = temp_t3;
  903.                                                                         if (0xff == temp_a1_9->unk3F18)
  904.                                                                         {
  905.                                                                             phi_t3_4 = (u16)1;
  906.                                                                         }
  907.                                                                         temp_a1_9->unk3F18 = (u8)0U; // enable item
  908.                                                                         phi_t0_2 = &D_801EF670;
  909.                                                                         phi_t2 = 4;
  910.                                                                         phi_t4 = 0xff;
  911.                                                                     }
  912.                                                                 }
  913.                                                                 else // item isn't bottle
  914.                                                                 {
  915.                                                                     goto block_185;
  916.                                                                 }
  917.                                                             }
  918.                                                             else
  919.                                                             {
  920.                                                                 phi_t3_4 = temp_t3;
  921.                                                                 if (temp_a1_9->unk3F18 == 0)
  922.                                                                 {
  923.                                                                     phi_t3_4 = (u16)1;
  924.                                                                 }
  925.                                                                 temp_a1_9->unk3F18 = (u8)0xffU; // disable C button
  926.                                                                 phi_t0_2 = &D_801EF670;
  927.                                                                 phi_t2 = 4;
  928.                                                                 phi_t4 = 0xff;
  929.                                                             }
  930.                                                         }
  931.                                                         else // item is zora mask
  932.                                                         {
  933.                                                             phi_t3_4 = phi_t3_3;
  934.                                                             phi_t0_2 = phi_t0;
  935.                                                             phi_t2 = phi_t2;
  936.                                                             phi_t4 = phi_t4;
  937.                                                             if (phi_t4 == phi_a1_4->unk3F18) // if C button disabled
  938.                                                             {
  939.                                                                 phi_a1_4->unk3F18 = (u8)0U; // enable it
  940.                                                                 phi_t3_4 = (u16)1;
  941.                                                                 phi_t0_2 = phi_t0;
  942.                                                                 phi_t2 = phi_t2;
  943.                                                                 phi_t4 = phi_t4;
  944.                                                             }
  945.                                                         }
  946.                                                         temp_a3_9 = (s32) ((phi_a3_8 + 1) << 0x10) >> 0x10;
  947.                                                         phi_a3_8 = temp_a3_9;
  948.                                                         phi_t0 = phi_t0_2;
  949.                                                         phi_t3_3 = phi_t3_4;
  950.                                                         if (temp_a3_9 < 4)
  951.                                                         {
  952.                                                             goto loop_163;
  953.                                                         }
  954.                                                         if (phi_t3_4 != 0)
  955.                                                         {
  956.                                                             phi_t0_2->unk3F22 = (u16)0;
  957.                                                         }
  958.                                                         temp_v0_2 = arg0 + 0x18000;
  959.                                                         phi_t3_5 = phi_t3_4;
  960.                                                         phi_t0_5 = phi_t0_2;
  961.                                                         if (temp_v0_2->unk875 == 0)
  962.                                                         {
  963.                                                             phi_t3_5 = phi_t3_4;
  964.                                                             phi_t0_5 = phi_t0_2;
  965.                                                             if (temp_v0_2->unkB4A == 0)
  966.                                                             {
  967.                                                                 sp70 = (s16) phi_t3_4;
  968.                                                                 temp_t3_2 = phi_t3_4;
  969.                                                                 phi_t3_5 = temp_t3_2;
  970.                                                                 phi_t0_5 = &D_801EF670;
  971.                                                                 if (func_800F207C(phi_a1_4, temp_a3_9) == -1)
  972.                                                                 {
  973.                                                                     sp70 = temp_t3_2;
  974.                                                                     func_8010EF68(0x32);
  975.                                                                     phi_t3_5 = temp_t3_2;
  976.                                                                     phi_t0_5 = &D_801EF670;
  977.                                                                 }
  978.                                                             }
  979.                                                         }
  980.                                                     }
  981.                                                     else // not in water
  982.                                                     {
  983. block_203:
  984.                                                         if ((sp74->unkA6C << 0xa) < 0) // 00200000 = ladder down A
  985.                                                         {
  986.                                                             phi_a3_9 = 1;
  987.                                                             phi_t3_19 = (u16)0;
  988. loop_205:
  989.                                                             if (phi_a3_9 == 0) // B (won't happen)
  990.                                                             {
  991.                                                                 temp_v0_3 = &D_801EF670->unk20;
  992.                                                                 if (4 == temp_v0_3)
  993.                                                                 {
  994.                                                                     phi_v1_13 = (u8)0U;
  995.                                                                 }
  996.                                                                 else
  997.                                                                 {
  998.                                                                     phi_v1_13 = temp_v0_3;
  999.                                                                 }
  1000.                                                                 phi_a2_13 = ((&D_801EF670 + (phi_v1_13 * 4)) + phi_a3_9)->unk4C;
  1001.                                                                 phi_a1_5 = &D_801EF670 + phi_a3_9;
  1002.                                                             }
  1003.                                                             else // C (normal)
  1004.                                                             {
  1005.                                                                 temp_a1_10 = &D_801EF670 + phi_a3_9;
  1006.                                                                 phi_a2_13 = temp_a1_10->unk4C;
  1007.                                                                 phi_a1_5 = temp_a1_10;
  1008.                                                             }
  1009.                                                             if (0xe != (phi_a2_13 & 0xff)) // item isn't lens
  1010.                                                             {
  1011.                                                                 phi_t3_9 = phi_t3_19;
  1012.                                                                 if (phi_a1_5->unk3F18 == 0)
  1013.                                                                 {
  1014.                                                                     phi_t3_9 = (u16)1;
  1015.                                                                 }
  1016.                                                                 phi_a1_5->unk3F18 = (u8)0xffU; // disable C
  1017.                                                             }
  1018.                                                             else // item is lens
  1019.                                                             {
  1020.                                                                 phi_t3_9 = phi_t3_19;
  1021.                                                                 if (0xff == phi_a1_5->unk3F18)
  1022.                                                                 {
  1023.                                                                     phi_t3_9 = (u16)1;
  1024.                                                                 }
  1025.                                                                 phi_a1_5->unk3F18 = (u8)0U; // enable C
  1026.                                                             }
  1027.                                                             temp_a3_10 = (s32) ((phi_a3_9 + 1) << 0x10) >> 0x10;
  1028.                                                             phi_a3_9 = temp_a3_10;
  1029.                                                             phi_t3_19 = phi_t3_9;
  1030.                                                             if (temp_a3_10 < 4)
  1031.                                                             {
  1032.                                                                 goto loop_205;
  1033.                                                             }
  1034.                                                             phi_t3_5 = phi_t3_9;
  1035.                                                             phi_t0_5 = &D_801EF670;
  1036.                                                             if (0xff != &D_801EF670->unk3F18)
  1037.                                                             {
  1038.                                                                 &D_801EF670->unk3F18 = (u8)0xffU; // disable B
  1039.                                                                 phi_t3_5 = (u16)1;
  1040.                                                                 phi_t0_5 = &D_801EF670;
  1041.                                                             }
  1042.                                                         }
  1043.                                                         else // not ladder down A
  1044.                                                         {
  1045.                                                             if ((sp74->unkA6C & 0x2000) != 0) // 00002000 = ledge down A
  1046.                                                             {
  1047.                                                                 phi_t3_5 = (u16)0;
  1048.                                                                 phi_t0_5 = &D_801EF670;
  1049.                                                                 if (0xff != &D_801EF670->unk3F18) // if B enabled
  1050.                                                                 {
  1051.                                                                     &D_801EF670->unk3F18 = (u8)0xffU; // disable B and C
  1052.                                                                     &D_801EF670->unk3F19 = (u8)0xffU;
  1053.                                                                     &D_801EF670->unk3F1A = (u8)0xffU;
  1054.                                                                     &D_801EF670->unk3F1B = (u8)0xffU;
  1055.                                                                     sp70 = (u16)1;
  1056.                                                                     func_8010EF68(0x32, 1);
  1057.                                                                     phi_t3_5 = (u16)1;
  1058.                                                                     phi_t0_5 = &D_801EF670;
  1059.                                                                 }
  1060.                                                             }
  1061.                                                             else // not ledge down A
  1062.                                                             {
  1063.                                                                 sp28 = (void *) (arg0 + 0x169e8);
  1064.                                                                 if ((0x10000 + arg0)->unk6C06 == 0x18) // blast mask action on B
  1065.                                                                 {
  1066.                                                                     if (0x12 == sp74->unk153) // mask equipped == blast mask
  1067.                                                                     {
  1068.                                                                         if (sp74->unkB60 != 0) // blast mask timer counting down
  1069.                                                                         {
  1070.                                                                             phi_t3_8 = (u16)0;
  1071.                                                                             if (0xff != &D_801EF670->unk1015) // if B not disabled from 1F0685
  1072.                                                                             {
  1073.                                                                                 &D_801EF670->unk1015 = (u8)0xffU; // make B disabled from 1F0685
  1074.                                                                                 phi_t3_8 = (u16)1;
  1075.                                                                             }
  1076.                                                                             phi_t7 = sp74->unk14B;
  1077.                                                                             phi_t0_4 = &D_801EF670;
  1078.                                                                             phi_t2_2 = 4;
  1079.                                                                             phi_t4_2 = 0xff;
  1080.                                                                         }
  1081.                                                                         else // blast mask timer not counting down
  1082.                                                                         {
  1083. block_230:
  1084.                                                                             phi_t3_18 = (u16)0;
  1085.                                                                             if (0xff == &D_801EF670->unk1015) // if B disabled from 1F0685
  1086.                                                                             {
  1087.                                                                                 &D_801EF670->unk1015 = (u8)0U; // make B not disabled from 1F0685
  1088.                                                                                 phi_t3_18 = (u16)1;
  1089.                                                                             }
  1090.                                                                             if (sp28->unk30F == 0) // not dim B
  1091.                                                                             {
  1092.                                                                                 temp_v0_4 = &D_801EF670->unk20;
  1093.                                                                                 if (4 == temp_v0_4)
  1094.                                                                                 {
  1095.                                                                                     phi_a2_14 = (u8)0U;
  1096.                                                                                 }
  1097.                                                                                 else
  1098.                                                                                 {
  1099.                                                                                     phi_a2_14 = temp_v0_4;
  1100.                                                                                 }
  1101.                                                                                 if ((&D_801EF670 + (phi_a2_14 * 4))->unk4C != 1) // current form's B is not bow
  1102.                                                                                 {
  1103.                                                                                     if (4 == temp_v0_4)
  1104.                                                                                     {
  1105.                                                                                         phi_v1_2 = (u8)0U;
  1106.                                                                                     }
  1107.                                                                                     else
  1108.                                                                                     {
  1109.                                                                                         phi_v1_2 = temp_v0_4;
  1110.                                                                                     }
  1111.                                                                                     if ((&D_801EF670 + (phi_v1_2 * 4))->unk4C != 6) // current form's B is not bow/bombs
  1112.                                                                                     {
  1113.                                                                                         if (4 == temp_v0_4)
  1114.                                                                                         {
  1115.                                                                                             phi_a0_4 = (u8)0U;
  1116.                                                                                         }
  1117.                                                                                         else
  1118.                                                                                         {
  1119.                                                                                             phi_a0_4 = temp_v0_4;
  1120.                                                                                         }
  1121.                                                                                         if ((&D_801EF670 + (phi_a0_4 * 4))->unk4C == 7) // current form's B is bow/bombs/bombchus
  1122.                                                                                         {
  1123. block_245:
  1124.                                                                                             if (((s32) (&D_801EF670->unk6C & D_801C1DB0) >> D_801C1E00) == 0)
  1125.                                                                                             {
  1126.                                                                                                 &D_801EF670->unk3F18 = (u8)0xffU;
  1127.                                                                                             }
  1128.                                                                                             temp_a1_11 = &D_801EF670->unk3F18;
  1129.                                                                                             phi_a1_6 = temp_a1_11;
  1130.                                                                                             if (temp_a1_11 == 0)
  1131.                                                                                             {
  1132.                                                                                                 temp_t9 = ((s32) (&D_801EF670->unk6C & D_801C1DB0) >> D_801C1E00) + 0x4c;
  1133.                                                                                                 &D_801EF670->unk3F18 = temp_t9;
  1134.                                                                                                 phi_a1_6 = temp_t9 & 0xff;
  1135.                                                                                             }
  1136.                                                                                             temp_v0_5 = &D_801EF670->unk20;
  1137.                                                                                             if (4 == temp_v0_5)
  1138.                                                                                             {
  1139.                                                                                                 phi_a2_17 = (u8)0U;
  1140.                                                                                             }
  1141.                                                                                             else
  1142.                                                                                             {
  1143.                                                                                                 phi_a2_17 = temp_v0_5;
  1144.                                                                                             }
  1145.                                                                                             (&D_801EF670 + (phi_a2_17 * 4))->unk4C = (u8) phi_a1_6;
  1146.                                                                                             temp_v0_6 = &D_801EF670->unk20;
  1147.                                                                                             if (4 == temp_v0_6)
  1148.                                                                                             {
  1149.                                                                                                 phi_a2_18 = (u8)0U;
  1150.                                                                                             }
  1151.                                                                                             else
  1152.                                                                                             {
  1153.                                                                                                 phi_a2_18 = temp_v0_6;
  1154.                                                                                             }
  1155.                                                                                             phi_t3_8 = (u16)1;
  1156.                                                                                             if (0xff != (&D_801EF670 + (phi_a2_18 * 4))->unk4C)
  1157.                                                                                             {
  1158.                                                                                                 sp70 = (u16)1;
  1159.                                                                                                 func_80112B40(arg0, 0, phi_a2_18, 1);
  1160.                                                                                                 phi_t1 = sp74;
  1161.                                                                                                 phi_t0_4 = &D_801EF670;
  1162.                                                                                                 phi_t2_2 = 4;
  1163.                                                                                                 phi_t4_2 = 0xff;
  1164.                                                                                                 phi_t3_8 = (u16)1;
  1165. block_302:
  1166.                                                                                                 phi_t7 = phi_t1->unk14B;
  1167.                                                                                             }
  1168.                                                                                             else
  1169.                                                                                             {
  1170. block_276:
  1171.                                                                                                 phi_t7 = sp74->unk14B;
  1172.                                                                                                 phi_t0_4 = &D_801EF670;
  1173.                                                                                                 phi_t2_2 = 4;
  1174.                                                                                                 phi_t4_2 = 0xff;
  1175.                                                                                             }
  1176.                                                                                         }
  1177.                                                                                         else // current form's B is not bow/bombs/bombchus
  1178.                                                                                         {
  1179.                                                                                             if (4 == temp_v0_4)
  1180.                                                                                             {
  1181.                                                                                                 phi_a2_15 = (u8)0U;
  1182.                                                                                             }
  1183.                                                                                             else
  1184.                                                                                             {
  1185.                                                                                                 phi_a2_15 = temp_v0_4;
  1186.                                                                                             }
  1187.                                                                                             if (0xff == (&D_801EF670 + (phi_a2_15 * 4))->unk4C) // current form's B is nothing
  1188.                                                                                             {
  1189.                                                                                                 if (sp28->unk21E != 0)
  1190.                                                                                                 {
  1191.                                                                                                     phi_t3_8 = phi_t3_18;
  1192.                                                                                                     if (0xff == &D_801EF670->unk3F18)
  1193.                                                                                                     {
  1194.                                                                                                         &D_801EF670->unk3F18 = (u8)0U;
  1195.                                                                                                         phi_t1 = sp74;
  1196.                                                                                                         phi_t0_4 = &D_801EF670;
  1197.                                                                                                         phi_t2_2 = 4;
  1198.                                                                                                         phi_t4_2 = 0xff;
  1199.                                                                                                         phi_t3_8 = (u16)1;
  1200.                                                                                                         goto block_302;
  1201.                                                                                                     }
  1202.                                                                                                     else
  1203.                                                                                                     {
  1204. block_266:
  1205.                                                                                                         phi_t7 = sp74->unk14B;
  1206.                                                                                                         phi_t0_4 = &D_801EF670;
  1207.                                                                                                         phi_t2_2 = 4;
  1208.                                                                                                         phi_t4_2 = 0xff;
  1209.                                                                                                     }
  1210.                                                                                                 }
  1211.                                                                                                 else
  1212.                                                                                                 {
  1213.                                                                                                     phi_t3_8 = phi_t3_18;
  1214.                                                                                                     if (0xff != &D_801EF670->unk3F18)
  1215.                                                                                                     {
  1216.                                                                                                         &D_801EF670->unk3F18 = (u8)0xffU;
  1217.                                                                                                         phi_t3_8 = (u16)1;
  1218.                                                                                                     }
  1219.                                                                                                     goto block_266;
  1220.                                                                                                 }
  1221.                                                                                             }
  1222.                                                                                             else // current form's B is not nothing
  1223.                                                                                             {
  1224.                                                                                                 if (4 == temp_v0_4)
  1225.                                                                                                 {
  1226.                                                                                                     phi_a2_16 = (u8)0U;
  1227.                                                                                                 }
  1228.                                                                                                 else
  1229.                                                                                                 {
  1230.                                                                                                     phi_a2_16 = temp_v0_4;
  1231.                                                                                                 }
  1232.                                                                                                 if (0xff == (&D_801EF670 + (phi_a2_16 * 4))->unk4C) // current form's B is nothing (unreachable code?)
  1233.                                                                                                 {
  1234.                                                                                                     phi_t3_8 = phi_t3_18;
  1235.                                                                                                     if (0xff != &D_801EF670->unk3F18) // if B is not disabled
  1236.                                                                                                     {
  1237.                                                                                                         &D_801EF670->unk3F18 = (u8)0xffU; // make B disabled
  1238.                                                                                                         phi_t3_8 = (u16)1;
  1239.                                                                                                     }
  1240.                                                                                                     phi_t7 = sp74->unk14B;
  1241.                                                                                                     phi_t0_4 = &D_801EF670;
  1242.                                                                                                     phi_t2_2 = 4;
  1243.                                                                                                     phi_t4_2 = 0xff;
  1244.                                                                                                 }
  1245.                                                                                                 else
  1246.                                                                                                 {
  1247.                                                                                                     phi_t3_8 = phi_t3_18;
  1248.                                                                                                     if (0xff == &D_801EF670->unk3F18) // if B is disabled
  1249.                                                                                                     {
  1250.                                                                                                         &D_801EF670->unk3F18 = (u8)0U; // make B not disabled
  1251.                                                                                                         phi_t3_8 = (u16)1;
  1252.                                                                                                     }
  1253.                                                                                                     goto block_276;
  1254.                                                                                                 }
  1255.                                                                                             }
  1256.                                                                                         }
  1257.                                                                                     }
  1258.                                                                                     else // current form's B is bombs
  1259.                                                                                     {
  1260.                                                                                         goto block_245;
  1261.                                                                                     }
  1262.                                                                                 }
  1263.                                                                                 else // current form's B is bow
  1264.                                                                                 {
  1265.                                                                                     goto block_245;
  1266.                                                                                 }
  1267.                                                                             }
  1268.                                                                             else // dim B
  1269.                                                                             {
  1270.                                                                                 phi_t1 = sp74;
  1271.                                                                                 phi_t0_4 = &D_801EF670;
  1272.                                                                                 phi_t2_2 = 4;
  1273.                                                                                 phi_t4_2 = 0xff;
  1274.                                                                                 phi_t3_8 = phi_t3_18;
  1275.                                                                                 if (sp28->unk30F != 0) // dim B (we already checked this?)
  1276.                                                                                 {
  1277.                                                                                     temp_v0_7 = &D_801EF670->unk20;
  1278.                                                                                     if (4 == temp_v0_7)
  1279.                                                                                     {
  1280.                                                                                         phi_a2_19 = (u8)0U;
  1281.                                                                                     }
  1282.                                                                                     else
  1283.                                                                                     {
  1284.                                                                                         phi_a2_19 = temp_v0_7;
  1285.                                                                                     }
  1286.                                                                                     if ((&D_801EF670 + (phi_a2_19 * 4))->unk4C != 1) // current form's B is not bow
  1287.                                                                                     {
  1288.                                                                                         if (4 == temp_v0_7)
  1289.                                                                                         {
  1290.                                                                                             phi_v1_3 = (u8)0U;
  1291.                                                                                         }
  1292.                                                                                         else
  1293.                                                                                         {
  1294.                                                                                             phi_v1_3 = temp_v0_7;
  1295.                                                                                         }
  1296.                                                                                         if ((&D_801EF670 + (phi_v1_3 * 4))->unk4C != 6) // current form's B is not bow/bombs
  1297.                                                                                         {
  1298.                                                                                             if (4 == temp_v0_7)
  1299.                                                                                             {
  1300.                                                                                                 phi_a0_5 = (u8)0U;
  1301.                                                                                             }
  1302.                                                                                             else
  1303.                                                                                             {
  1304.                                                                                                 phi_a0_5 = temp_v0_7;
  1305.                                                                                             }
  1306.                                                                                             phi_t0_3 = &D_801EF670;
  1307.                                                                                             phi_t2_3 = 4;
  1308.                                                                                             phi_t3_8 = phi_t3_18;
  1309.                                                                                             if ((&D_801EF670 + (phi_a0_5 * 4))->unk4C == 7) // current form's B is bow/bombs/bombchus
  1310.                                                                                             {
  1311. block_290:
  1312.                                                                                                 if (((s32) (&D_801EF670->unk6C & D_801C1DB0) >> D_801C1E00) == 0)
  1313.                                                                                                 {
  1314.                                                                                                     &D_801EF670->unk3F18 = (u8)0xffU;
  1315.                                                                                                 }
  1316.                                                                                                 if (4 == &D_801EF670->unk20)
  1317.                                                                                                 {
  1318.                                                                                                     phi_a2_20 = (u8)0U;
  1319.                                                                                                 }
  1320.                                                                                                 else
  1321.                                                                                                 {
  1322.                                                                                                     phi_a2_20 = &D_801EF670->unk20;
  1323.                                                                                                 }
  1324.                                                                                                 (&D_801EF670 + (phi_a2_20 * 4))->unk4C = (u8) &D_801EF670->unk3F18;
  1325.                                                                                                 temp_v0_8 = &D_801EF670->unk20;
  1326.                                                                                                 if (4 == temp_v0_8)
  1327.                                                                                                 {
  1328.                                                                                                     phi_a2_21 = (u8)0U;
  1329.                                                                                                 }
  1330.                                                                                                 else
  1331.                                                                                                 {
  1332.                                                                                                     phi_a2_21 = temp_v0_8;
  1333.                                                                                                 }
  1334.                                                                                                 phi_t0_3 = &D_801EF670;
  1335.                                                                                                 phi_t2_3 = 4;
  1336.                                                                                                 phi_t3_8 = (u16)1;
  1337.                                                                                                 if (0xff != (&D_801EF670 + (phi_a2_21 * 4))->unk4C)
  1338.                                                                                                 {
  1339.                                                                                                     sp70 = (u16)1;
  1340.                                                                                                     func_80112B40(arg0, 0, phi_a2_21, 1);
  1341.                                                                                                     phi_t0_3 = &D_801EF670;
  1342.                                                                                                     phi_t2_3 = 4;
  1343.                                                                                                     phi_t3_8 = (u16)1;
  1344.                                                                                                 }
  1345.                                                                                             }
  1346.                                                                                         }
  1347.                                                                                         else // current form's B is bombs
  1348.                                                                                         {
  1349.                                                                                             goto block_290;
  1350.                                                                                         }
  1351.                                                                                     }
  1352.                                                                                     else // current form's B is bow
  1353.                                                                                     {
  1354.                                                                                         goto block_290;
  1355.                                                                                     }
  1356.                                                                                     phi_t1 = sp74;
  1357.                                                                                     phi_t0_4 = phi_t0_3;
  1358.                                                                                     phi_t2_2 = phi_t2_3;
  1359.                                                                                     phi_t4_2 = 0xff;
  1360.                                                                                     if (0xff != phi_t0_3->unk3F18) // if B not disabled
  1361.                                                                                     {
  1362.                                                                                         phi_t0_3->unk3F18 = (u8)0xffU; // disable B
  1363.                                                                                         phi_t1 = sp74;
  1364.                                                                                         phi_t0_4 = phi_t0_3;
  1365.                                                                                         phi_t2_2 = phi_t2_3;
  1366.                                                                                         phi_t4_2 = 0xff;
  1367.                                                                                         phi_t3_8 = (u16)1;
  1368.                                                                                     }
  1369.                                                                                 }
  1370.                                                                                 goto block_302;
  1371.                                                                             }
  1372.                                                                         }
  1373.                                                                     }
  1374.                                                                     else
  1375.                                                                     {
  1376.                                                                         goto block_230;
  1377.                                                                     }
  1378.                                                                 }
  1379.                                                                 else
  1380.                                                                 {
  1381.                                                                     goto block_230;
  1382.                                                                 }
  1383.                                                                 phi_t3_5 = phi_t3_8;
  1384.                                                                 phi_t0_5 = phi_t0_4;
  1385.                                                                 if (phi_t7 == phi_t0_4->unk20) // link actor agrees with save file on what link's current form is?
  1386.                                                                 {
  1387.                                                                     phi_a3_10 = 1;
  1388.                                                                     phi_t3_14 = phi_t3_8;
  1389. loop_305:
  1390.                                                                     temp_t1 = phi_t0_4->unk20;
  1391.                                                                     if (phi_a3_10 == 0) //uhhhh should be impossible??
  1392.                                                                     {
  1393.                                                                         if (phi_t2_2 == temp_t1)
  1394.                                                                         {
  1395.                                                                             phi_v1_14 = (u8)0U;
  1396.                                                                         }
  1397.                                                                         else
  1398.                                                                         {
  1399.                                                                             phi_v1_14 = temp_t1;
  1400.                                                                         }
  1401.                                                                         phi_a2_22 = ((phi_t0_4 + (phi_v1_14 * 4)) + phi_a3_10)->unk4C;
  1402.                                                                     }
  1403.                                                                     else // normal
  1404.                                                                     {
  1405.                                                                         phi_a2_22 = (phi_t0_4 + phi_a3_10)->unk4C; // item equipped to C button 1/2/3
  1406.                                                                     }
  1407.                                                                     temp_a1_12 = phi_t0_4 + phi_a3_10;
  1408.                                                                     if (*(&D_801C2410 + ((temp_t1 * 0x72) + (phi_a2_22 & 0xff))) == 0) // equippableness per form table says no
  1409.                                                                     {
  1410.                                                                         phi_t3_7 = phi_t3_14;
  1411.                                                                         if (phi_t4_2 != temp_a1_12->unk3F18) // if C not disabled
  1412.                                                                         {
  1413.                                                                             temp_a1_12->unk3F18 = (u8)0xffU; // disable C
  1414.                                                                             phi_t3_7 = (u16)1;
  1415.                                                                         }
  1416.                                                                     }
  1417.                                                                     else // equippableness per form table sayss yes
  1418.                                                                     {
  1419.                                                                         temp_a1_13 = phi_t0_4 + phi_a3_10;
  1420.                                                                         if (sp74->unk0 != 0) // if link is not player_actor ?? wtf ????
  1421.                                                                         {
  1422.                                                                             phi_t3_7 = phi_t3_14;
  1423.                                                                             if (phi_t4_2 != temp_a1_13->unk3F18) // if C is not disabled
  1424.                                                                             {
  1425.                                                                                 temp_a1_13->unk3F18 = (u8)0xffU; // disable C
  1426.                                                                                 phi_t3_7 = (u16)1;
  1427.                                                                             }
  1428.                                                                         }
  1429.                                                                         else
  1430.                                                                         {
  1431.                                                                             if (sp74->unk153 == 0x14) // giant's mask worn
  1432.                                                                             {
  1433.                                                                                 temp_a1_14 = phi_t0_4 + phi_a3_10;
  1434.                                                                                 if (phi_a3_10 == 0) // still should be impossible
  1435.                                                                                 {
  1436.                                                                                     if (phi_t2_2 == temp_t1)
  1437.                                                                                     {
  1438.                                                                                         phi_v1_15 = (u8)0U;
  1439.                                                                                     }
  1440.                                                                                     else
  1441.                                                                                     {
  1442.                                                                                         phi_v1_15 = temp_t1;
  1443.                                                                                     }
  1444.                                                                                     phi_a2_23 = ((phi_t0_4 + (phi_v1_15 * 4)) + phi_a3_10)->unk4C;
  1445.                                                                                 }
  1446.                                                                                 else // normal
  1447.                                                                                 {
  1448.                                                                                     phi_a2_23 = temp_a1_14->unk4C; // item equipped to C button 1/2/3
  1449.                                                                                 }
  1450.                                                                                 if ((phi_a2_23 & 0xff) != 0x49) // if item isn't giant's mask
  1451.                                                                                 {
  1452.                                                                                     phi_t3_7 = phi_t3_14;
  1453.                                                                                     if (phi_t4_2 != temp_a1_14->unk3F18) // if C button enabled
  1454.                                                                                     {
  1455.                                                                                         temp_a1_14->unk3F18 = (u8)0xffU; // disable c button
  1456.                                                                                         phi_t3_7 = (u16)1;
  1457.                                                                                     }
  1458.                                                                                 }
  1459.                                                                                 else // if item is giant's mask
  1460.                                                                                 {
  1461.                                                                                     phi_t3_7 = phi_t3_14;
  1462.                                                                                     if (phi_t4_2 == temp_a1_14->unk3F18) // if C button disabled
  1463.                                                                                     {
  1464.                                                                                         temp_a1_14->unk3F18 = (u8)0U; // enable C button
  1465.                                                                                         phi_t3_7 = (u16)1;
  1466.                                                                                     }
  1467.                                                                                 }
  1468.                                                                             }
  1469.                                                                             else // giant's mask not worn
  1470.                                                                             {
  1471.                                                                                 if (phi_a3_10 == 0)
  1472.                                                                                 {
  1473.                                                                                     if (phi_t2_2 == temp_t1)
  1474.                                                                                     {
  1475.                                                                                         phi_v1_16 = (u8)0U;
  1476.                                                                                     }
  1477.                                                                                     else
  1478.                                                                                     {
  1479.                                                                                         phi_v1_16 = temp_t1;
  1480.                                                                                     }
  1481.                                                                                     phi_a2_24 = ((phi_t0_4 + (phi_v1_16 * 4)) + phi_a3_10)->unk4C;
  1482.                                                                                 }
  1483.                                                                                 else
  1484.                                                                                 {
  1485.                                                                                     phi_a2_24 = (phi_t0_4 + phi_a3_10)->unk4C; // item equipped to C button 1/2/3
  1486.                                                                                 }
  1487.                                                                                 if ((phi_a2_24 & 0xff) == 0x49) // if item is giant's mask
  1488.                                                                                 {
  1489.                                                                                     temp_a1_15 = phi_t0_4 + phi_a3_10;
  1490.                                                                                     if (arg0->unkA4 != 0x36) // if not in twinmold's lair
  1491.                                                                                     {
  1492.                                                                                         phi_t3_7 = phi_t3_14;
  1493.                                                                                         if (phi_t4_2 != temp_a1_15->unk3F18) // if C button enabled
  1494.                                                                                         {
  1495.                                                                                             temp_a1_15->unk3F18 = (u8)0xffU; // disable C button
  1496.                                                                                             phi_t3_7 = (u16)1;
  1497.                                                                                         }
  1498.                                                                                     }
  1499.                                                                                     else // in twinmold's lair
  1500.                                                                                     {
  1501.                                                                                         phi_t3_7 = phi_t3_14;
  1502.                                                                                         if (phi_t4_2 == temp_a1_15->unk3F18) // if C button disabled
  1503.                                                                                         {
  1504.                                                                                             temp_a1_15->unk3F18 = (u8)0U; // enable button
  1505.                                                                                             phi_t3_7 = (u16)1;
  1506.                                                                                         }
  1507.                                                                                     }
  1508.                                                                                 }
  1509.                                                                                 else // item isn't giant's mask
  1510.                                                                                 {
  1511.                                                                                     if (phi_a3_10 == 0)
  1512.                                                                                     {
  1513.                                                                                         if (phi_t2_2 == temp_t1)
  1514.                                                                                         {
  1515.                                                                                             phi_v1_17 = (u8)0U;
  1516.                                                                                         }
  1517.                                                                                         else
  1518.                                                                                         {
  1519.                                                                                             phi_v1_17 = temp_t1;
  1520.                                                                                         }
  1521.                                                                                         phi_a2_25 = ((phi_t0_4 + (phi_v1_17 * 4)) + phi_a3_10)->unk4C; // item equipped to C button 1/2/3
  1522.                                                                                     }
  1523.                                                                                     else
  1524.                                                                                     {
  1525.                                                                                         phi_a2_25 = (phi_t0_4 + phi_a3_10)->unk4C;
  1526.                                                                                     }
  1527.                                                                                     if ((phi_a2_25 & 0xff) == 0x35) // if item is fierce deity's mask
  1528.                                                                                     {
  1529.                                                                                         temp_a1_16 = phi_t0_4 + phi_a3_10;
  1530.                                                                                         if (arg0->unkA4 != 0x1f)
  1531.                                                                                         {
  1532.                                                                                             if (arg0->unkA4 != 0x44)
  1533.                                                                                             {
  1534.                                                                                                 if (arg0->unkA4 != 0x5f)
  1535.                                                                                                 {
  1536.                                                                                                     if (arg0->unkA4 != 0x36)
  1537.                                                                                                     {
  1538.                                                                                                         if (arg0->unkA4 != 0xb) // room is not boss room, disable FD mask
  1539.                                                                                                         {
  1540.                                                                                                             phi_t3_7 = phi_t3_14;
  1541.                                                                                                             if (phi_t4_2 != temp_a1_16->unk3F18)
  1542.                                                                                                             {
  1543.                                                                                                                 temp_a1_16->unk3F18 = (u8)0xffU;
  1544.                                                                                                                 phi_t3_7 = (u16)1;
  1545.                                                                                                             }
  1546.                                                                                                         }
  1547.                                                                                                         else // room is boss room, enable FD mask
  1548.                                                                                                         {
  1549. block_355:
  1550.                                                                                                             phi_t3_7 = phi_t3_14;
  1551.                                                                                                             if (phi_t4_2 == temp_a1_16->unk3F18)
  1552.                                                                                                             {
  1553.                                                                                                                 temp_a1_16->unk3F18 = (u8)0U;
  1554.                                                                                                                 phi_t3_7 = (u16)1;
  1555.                                                                                                             }
  1556.                                                                                                         }
  1557.                                                                                                     }
  1558.                                                                                                     else
  1559.                                                                                                     {
  1560.                                                                                                         goto block_355;
  1561.                                                                                                     }
  1562.                                                                                                 }
  1563.                                                                                                 else
  1564.                                                                                                 {
  1565.                                                                                                     goto block_355;
  1566.                                                                                                 }
  1567.                                                                                             }
  1568.                                                                                             else
  1569.                                                                                             {
  1570.                                                                                                 goto block_355;
  1571.                                                                                             }
  1572.                                                                                         }
  1573.                                                                                         else
  1574.                                                                                         {
  1575.                                                                                             goto block_355;
  1576.                                                                                         }
  1577.                                                                                     }
  1578.                                                                                     else // item isn't fierce deity's mask
  1579.                                                                                     {
  1580.                                                                                         if (sp28->unk311 != 0) // dim items
  1581.                                                                                         {
  1582.                                                                                             if (phi_a3_10 == 0)
  1583.                                                                                             {
  1584.                                                                                                 if (phi_t2_2 == temp_t1)
  1585.                                                                                                 {
  1586.                                                                                                     phi_v1_18 = (u8)0U;
  1587.                                                                                                 }
  1588.                                                                                                 else
  1589.                                                                                                 {
  1590.                                                                                                     phi_v1_18 = temp_t1;
  1591.                                                                                                 }
  1592.                                                                                                 phi_a2_26 = ((phi_t0_4 + (phi_v1_18 * 4)) + phi_a3_10)->unk4C;
  1593.                                                                                             }
  1594.                                                                                             else
  1595.                                                                                             {
  1596.                                                                                                 phi_a2_26 = (phi_t0_4 + phi_a3_10)->unk4C;
  1597.                                                                                             }
  1598.                                                                                             if ((phi_a2_26 & 0xff) >= 0x28)
  1599.                                                                                             {
  1600.                                                                                                 if (phi_a3_10 == 0)
  1601.                                                                                                 {
  1602.                                                                                                     if (phi_t2_2 == temp_t1)
  1603.                                                                                                     {
  1604.                                                                                                         phi_v1_19 = (u8)0U;
  1605.                                                                                                     }
  1606.                                                                                                     else
  1607.                                                                                                     {
  1608.                                                                                                         phi_v1_19 = temp_t1;
  1609.                                                                                                     }
  1610.                                                                                                     phi_a0_6 = ((phi_t0_4 + (phi_v1_19 * 4)) + phi_a3_10)->unk4C;
  1611.                                                                                                 }
  1612.                                                                                                 else
  1613.                                                                                                 {
  1614.                                                                                                     phi_a0_6 = (phi_t0_4 + phi_a3_10)->unk4C;
  1615.                                                                                                 }
  1616.                                                                                                 if ((phi_a0_6 & 0xff) >= 0x31)
  1617.                                                                                                 {
  1618. block_372:
  1619.                                                                                                     if (phi_a3_10 == 0)
  1620.                                                                                                     {
  1621.                                                                                                         if (phi_t2_2 == temp_t1)
  1622.                                                                                                         {
  1623.                                                                                                             phi_v1_20 = (u8)0U;
  1624.                                                                                                         }
  1625.                                                                                                         else
  1626.                                                                                                         {
  1627.                                                                                                             phi_v1_20 = temp_t1;
  1628.                                                                                                         }
  1629.                                                                                                         phi_v0_2 = ((phi_t0_4 + (phi_v1_20 * 4)) + phi_a3_10)->unk4C;
  1630.                                                                                                     }
  1631.                                                                                                     else
  1632.                                                                                                     {
  1633.                                                                                                         phi_v0_2 = (phi_t0_4 + phi_a3_10)->unk4C;
  1634.                                                                                                     }
  1635.                                                                                                     if ((phi_v0_2 & 0xff) >= 0x12)
  1636.                                                                                                     {
  1637.                                                                                                         if (phi_a3_10 == 0)
  1638.                                                                                                         {
  1639.                                                                                                             if (phi_t2_2 == temp_t1)
  1640.                                                                                                             {
  1641.                                                                                                                 phi_v1_21 = (u8)0U;
  1642.                                                                                                             }
  1643.                                                                                                             else
  1644.                                                                                                             {
  1645.                                                                                                                 phi_v1_21 = temp_t1;
  1646.                                                                                                             }
  1647.                                                                                                             phi_v0_3 = ((phi_t0_4 + (phi_v1_21 * 4)) + phi_a3_10)->unk4C;
  1648.                                                                                                         }
  1649.                                                                                                         else
  1650.                                                                                                         {
  1651.                                                                                                             phi_v0_3 = (phi_t0_4 + phi_a3_10)->unk4C;
  1652.                                                                                                         }
  1653.                                                                                                         if ((phi_v0_3 & 0xff) >= 0x28)
  1654.                                                                                                         {
  1655. block_386:
  1656.                                                                                                             if (phi_a3_10 == 0)
  1657.                                                                                                             {
  1658.                                                                                                                 if (phi_t2_2 == temp_t1)
  1659.                                                                                                                 {
  1660.                                                                                                                     phi_v1_22 = (u8)0U;
  1661.                                                                                                                 }
  1662.                                                                                                                 else
  1663.                                                                                                                 {
  1664.                                                                                                                     phi_v1_22 = temp_t1;
  1665.                                                                                                                 }
  1666.                                                                                                                 phi_v0_4 = ((phi_t0_4 + (phi_v1_22 * 4)) + phi_a3_10)->unk4C;
  1667.                                                                                                             }
  1668.                                                                                                             else
  1669.                                                                                                             {
  1670.                                                                                                                 phi_v0_4 = (phi_t0_4 + phi_a3_10)->unk4C;
  1671.                                                                                                             }
  1672.                                                                                                             phi_t3_21 = phi_t3_14;
  1673.                                                                                                             if ((phi_v0_4 & 0xff) == 0)
  1674.                                                                                                             {
  1675. block_393:
  1676.                                                                                                                 temp_a1_17 = phi_t0_4 + phi_a3_10;
  1677.                                                                                                                 phi_t3_21 = phi_t3_14;
  1678.                                                                                                                 if (temp_a1_17->unk3F18 == 0)
  1679.                                                                                                                 {
  1680.                                                                                                                     phi_t3_21 = (u16)1;
  1681.                                                                                                                 }
  1682.                                                                                                                 temp_a1_17->unk3F18 = (u8)0xffU;
  1683.                                                                                                             }
  1684.                                                                                                         }
  1685.                                                                                                         else
  1686.                                                                                                         {
  1687.                                                                                                             goto block_393;
  1688.                                                                                                         }
  1689.                                                                                                     }
  1690.                                                                                                     else
  1691.                                                                                                     {
  1692.                                                                                                         goto block_386;
  1693.                                                                                                     }
  1694.                                                                                                 }
  1695.                                                                                                 else
  1696.                                                                                                 {
  1697.                                                                                                     goto block_393;
  1698.                                                                                                 }
  1699.                                                                                             }
  1700.                                                                                             else
  1701.                                                                                             {
  1702.                                                                                                 goto block_372;
  1703.                                                                                             }
  1704.                                                                                         }
  1705.                                                                                         else
  1706.                                                                                         {
  1707.                                                                                             phi_t3_21 = phi_t3_14;
  1708.                                                                                             if (sp28->unk311 == 0)
  1709.                                                                                             {
  1710.                                                                                                 if (phi_a3_10 == 0)
  1711.                                                                                                 {
  1712.                                                                                                     if (phi_t2_2 == temp_t1)
  1713.                                                                                                     {
  1714.                                                                                                         phi_v1_23 = (u8)0U;
  1715.                                                                                                     }
  1716.                                                                                                     else
  1717.                                                                                                     {
  1718.                                                                                                         phi_v1_23 = temp_t1;
  1719.                                                                                                     }
  1720.                                                                                                     phi_a2_27 = ((phi_t0_4 + (phi_v1_23 * 4)) + phi_a3_10)->unk4C;
  1721.                                                                                                 }
  1722.                                                                                                 else
  1723.                                                                                                 {
  1724.                                                                                                     phi_a2_27 = (phi_t0_4 + phi_a3_10)->unk4C;
  1725.                                                                                                 }
  1726.                                                                                                 if ((phi_a2_27 & 0xff) >= 0x28)
  1727.                                                                                                 {
  1728.                                                                                                     if (phi_a3_10 == 0)
  1729.                                                                                                     {
  1730.                                                                                                         if (phi_t2_2 == temp_t1)
  1731.                                                                                                         {
  1732.                                                                                                             phi_v1_24 = (u8)0U;
  1733.                                                                                                         }
  1734.                                                                                                         else
  1735.                                                                                                         {
  1736.                                                                                                             phi_v1_24 = temp_t1;
  1737.                                                                                                         }
  1738.                                                                                                         phi_a0_7 = ((phi_t0_4 + (phi_v1_24 * 4)) + phi_a3_10)->unk4C;
  1739.                                                                                                     }
  1740.                                                                                                     else
  1741.                                                                                                     {
  1742.                                                                                                         phi_a0_7 = (phi_t0_4 + phi_a3_10)->unk4C;
  1743.                                                                                                     }
  1744.                                                                                                     if ((phi_a0_7 & 0xff) >= 0x31)
  1745.                                                                                                     {
  1746. block_411:
  1747.                                                                                                         if (phi_a3_10 == 0)
  1748.                                                                                                         {
  1749.                                                                                                             if (phi_t2_2 == temp_t1)
  1750.                                                                                                             {
  1751.                                                                                                                 phi_v1_25 = (u8)0U;
  1752.                                                                                                             }
  1753.                                                                                                             else
  1754.                                                                                                             {
  1755.                                                                                                                 phi_v1_25 = temp_t1;
  1756.                                                                                                             }
  1757.                                                                                                             phi_v0_5 = ((phi_t0_4 + (phi_v1_25 * 4)) + phi_a3_10)->unk4C;
  1758.                                                                                                         }
  1759.                                                                                                         else
  1760.                                                                                                         {
  1761.                                                                                                             phi_v0_5 = (phi_t0_4 + phi_a3_10)->unk4C;
  1762.                                                                                                         }
  1763.                                                                                                         if ((phi_v0_5 & 0xff) >= 0x12)
  1764.                                                                                                         {
  1765.                                                                                                             if (phi_a3_10 == 0)
  1766.                                                                                                             {
  1767.                                                                                                                 if (phi_t2_2 == temp_t1)
  1768.                                                                                                                 {
  1769.                                                                                                                     phi_v1_26 = (u8)0U;
  1770.                                                                                                                 }
  1771.                                                                                                                 else
  1772.                                                                                                                 {
  1773.                                                                                                                     phi_v1_26 = temp_t1;
  1774.                                                                                                                 }
  1775.                                                                                                                 phi_v0_6 = ((phi_t0_4 + (phi_v1_26 * 4)) + phi_a3_10)->unk4C;
  1776.                                                                                                             }
  1777.                                                                                                             else
  1778.                                                                                                             {
  1779.                                                                                                                 phi_v0_6 = (phi_t0_4 + phi_a3_10)->unk4C;
  1780.                                                                                                             }
  1781.                                                                                                             if ((phi_v0_6 & 0xff) >= 0x28)
  1782.                                                                                                             {
  1783. block_425:
  1784.                                                                                                                 if (phi_a3_10 == 0)
  1785.                                                                                                                 {
  1786.                                                                                                                     if (phi_t2_2 == temp_t1)
  1787.                                                                                                                     {
  1788.                                                                                                                         phi_v1_27 = (u8)0U;
  1789.                                                                                                                     }
  1790.                                                                                                                     else
  1791.                                                                                                                     {
  1792.                                                                                                                         phi_v1_27 = temp_t1;
  1793.                                                                                                                     }
  1794.                                                                                                                     phi_v0_7 = ((phi_t0_4 + (phi_v1_27 * 4)) + phi_a3_10)->unk4C;
  1795.                                                                                                                 }
  1796.                                                                                                                 else
  1797.                                                                                                                 {
  1798.                                                                                                                     phi_v0_7 = (phi_t0_4 + phi_a3_10)->unk4C;
  1799.                                                                                                                 }
  1800.                                                                                                                 phi_t3_21 = phi_t3_14;
  1801.                                                                                                                 if ((phi_v0_7 & 0xff) == 0)
  1802.                                                                                                                 {
  1803. block_432:
  1804.                                                                                                                     temp_a1_18 = phi_t0_4 + phi_a3_10;
  1805.                                                                                                                     phi_t3_21 = phi_t3_14;
  1806.                                                                                                                     if (phi_t4_2 == temp_a1_18->unk3F18)
  1807.                                                                                                                     {
  1808.                                                                                                                         phi_t3_21 = (u16)1;
  1809.                                                                                                                     }
  1810.                                                                                                                     temp_a1_18->unk3F18 = (u8)0U;
  1811.                                                                                                                 }
  1812.                                                                                                             }
  1813.                                                                                                             else
  1814.                                                                                                             {
  1815.                                                                                                                 goto block_432;
  1816.                                                                                                             }
  1817.                                                                                                         }
  1818.                                                                                                         else
  1819.                                                                                                         {
  1820.                                                                                                             goto block_425;
  1821.                                                                                                         }
  1822.                                                                                                     }
  1823.                                                                                                     else
  1824.                                                                                                     {
  1825.                                                                                                         goto block_432;
  1826.                                                                                                     }
  1827.                                                                                                 }
  1828.                                                                                                 else
  1829.                                                                                                 {
  1830.                                                                                                     goto block_411;
  1831.                                                                                                 }
  1832.                                                                                             }
  1833.                                                                                         }
  1834.                                                                                         if (sp28->unk317 != 0) // dim masks
  1835.                                                                                         {
  1836.                                                                                             if (phi_a3_10 == 0)
  1837.                                                                                             {
  1838.                                                                                                 temp_v0_9 = phi_t0_4->unk20;
  1839.                                                                                                 if (phi_t2_2 == temp_v0_9)
  1840.                                                                                                 {
  1841.                                                                                                     phi_v1_28 = (u8)0U;
  1842.                                                                                                 }
  1843.                                                                                                 else
  1844.                                                                                                 {
  1845.                                                                                                     phi_v1_28 = temp_v0_9;
  1846.                                                                                                 }
  1847.                                                                                                 phi_a2_28 = ((phi_t0_4 + (phi_v1_28 * 4)) + phi_a3_10)->unk4C;
  1848.                                                                                             }
  1849.                                                                                             else
  1850.                                                                                             {
  1851.                                                                                                 phi_a2_28 = (phi_t0_4 + phi_a3_10)->unk4C;
  1852.                                                                                             }
  1853.                                                                                             phi_t3_17 = phi_t3_21;
  1854.                                                                                             if ((phi_a2_28 & 0xff) >= 0x32)
  1855.                                                                                             {
  1856.                                                                                                 if (phi_a3_10 == 0)
  1857.                                                                                                 {
  1858.                                                                                                     temp_v0_10 = phi_t0_4->unk20;
  1859.                                                                                                     if (phi_t2_2 == temp_v0_10)
  1860.                                                                                                     {
  1861.                                                                                                         phi_v1_29 = (u8)0U;
  1862.                                                                                                     }
  1863.                                                                                                     else
  1864.                                                                                                     {
  1865.                                                                                                         phi_v1_29 = temp_v0_10;
  1866.                                                                                                     }
  1867.                                                                                                     phi_a0_8 = ((phi_t0_4 + (phi_v1_29 * 4)) + phi_a3_10)->unk4C;
  1868.                                                                                                 }
  1869.                                                                                                 else
  1870.                                                                                                 {
  1871.                                                                                                     phi_a0_8 = (phi_t0_4 + phi_a3_10)->unk4C;
  1872.                                                                                                 }
  1873.                                                                                                 temp_a1_19 = phi_t0_4 + phi_a3_10;
  1874.                                                                                                 phi_t3_17 = phi_t3_21;
  1875.                                                                                                 if ((phi_a0_8 & 0xff) < 0x4a)
  1876.                                                                                                 {
  1877.                                                                                                     temp_v0_11 = temp_a1_19->unk3F18;
  1878.                                                                                                     temp_a1_19->unk3F18 = (u8)0xffU;
  1879.                                                                                                     phi_t3_17 = phi_t3_21;
  1880.                                                                                                     if (temp_v0_11 == 0)
  1881.                                                                                                     {
  1882.                                                                                                         phi_t3_17 = (u16)1;
  1883.                                                                                                     }
  1884.                                                                                                 }
  1885.                                                                                             }
  1886.                                                                                         }
  1887.                                                                                         else
  1888.                                                                                         {
  1889.                                                                                             phi_t3_17 = phi_t3_21;
  1890.                                                                                             if (sp28->unk317 == 0)
  1891.                                                                                             {
  1892.                                                                                                 if (phi_a3_10 == 0)
  1893.                                                                                                 {
  1894.                                                                                                     temp_v0_12 = phi_t0_4->unk20;
  1895.                                                                                                     if (phi_t2_2 == temp_v0_12)
  1896.                                                                                                     {
  1897.                                                                                                         phi_v1_30 = (u8)0U;
  1898.                                                                                                     }
  1899.                                                                                                     else
  1900.                                                                                                     {
  1901.                                                                                                         phi_v1_30 = temp_v0_12;
  1902.                                                                                                     }
  1903.                                                                                                     phi_a2_29 = ((phi_t0_4 + (phi_v1_30 * 4)) + phi_a3_10)->unk4C;
  1904.                                                                                                 }
  1905.                                                                                                 else
  1906.                                                                                                 {
  1907.                                                                                                     phi_a2_29 = (phi_t0_4 + phi_a3_10)->unk4C;
  1908.                                                                                                 }
  1909.                                                                                                 phi_t3_17 = phi_t3_21;
  1910.                                                                                                 if ((phi_a2_29 & 0xff) >= 0x32)
  1911.                                                                                                 {
  1912.                                                                                                     if (phi_a3_10 == 0)
  1913.                                                                                                     {
  1914.                                                                                                         temp_v0_13 = phi_t0_4->unk20;
  1915.                                                                                                         if (phi_t2_2 == temp_v0_13)
  1916.                                                                                                         {
  1917.                                                                                                             phi_v1_31 = (u8)0U;
  1918.                                                                                                         }
  1919.                                                                                                         else
  1920.                                                                                                         {
  1921.                                                                                                             phi_v1_31 = temp_v0_13;
  1922.                                                                                                         }
  1923.                                                                                                         phi_a0_9 = ((phi_t0_4 + (phi_v1_31 * 4)) + phi_a3_10)->unk4C;
  1924.                                                                                                     }
  1925.                                                                                                     else
  1926.                                                                                                     {
  1927.                                                                                                         phi_a0_9 = (phi_t0_4 + phi_a3_10)->unk4C;
  1928.                                                                                                     }
  1929.                                                                                                     temp_a1_20 = phi_t0_4 + phi_a3_10;
  1930.                                                                                                     phi_t3_17 = phi_t3_21;
  1931.                                                                                                     if ((phi_a0_9 & 0xff) < 0x4a)
  1932.                                                                                                     {
  1933.                                                                                                         temp_t6 = temp_a1_20->unk3F18;
  1934.                                                                                                         temp_a1_20->unk3F18 = (u8)0U;
  1935.                                                                                                         phi_t3_17 = phi_t3_21;
  1936.                                                                                                         if ((u32) (phi_t4_2 ^ temp_t6) < 1U)
  1937.                                                                                                         {
  1938.                                                                                                             phi_t3_17 = (u16)1;
  1939.                                                                                                         }
  1940.                                                                                                     }
  1941.                                                                                                 }
  1942.                                                                                             }
  1943.                                                                                         }
  1944.                                                                                         if (sp28->unk318 != 0) // dim pictograph and sticks??
  1945.                                                                                         {
  1946.                                                                                             if (phi_a3_10 == 0)
  1947.                                                                                             {
  1948.                                                                                                 temp_v0_14 = phi_t0_4->unk20;
  1949.                                                                                                 if (phi_t2_2 == temp_v0_14)
  1950.                                                                                                 {
  1951.                                                                                                     phi_v1_32 = (u8)0U;
  1952.                                                                                                 }
  1953.                                                                                                 else
  1954.                                                                                                 {
  1955.                                                                                                     phi_v1_32 = temp_v0_14;
  1956.                                                                                                 }
  1957.                                                                                                 phi_a2_30 = ((phi_t0_4 + (phi_v1_32 * 4)) + phi_a3_10)->unk4C;
  1958.                                                                                             }
  1959.                                                                                             else
  1960.                                                                                             {
  1961.                                                                                                 phi_a2_30 = (phi_t0_4 + phi_a3_10)->unk4C;
  1962.                                                                                             }
  1963.                                                                                             temp_a1_21 = phi_t0_4 + phi_a3_10;
  1964.                                                                                             phi_t3_13 = phi_t3_17;
  1965.                                                                                             if (0xd == (phi_a2_30 & 0xff))
  1966.                                                                                             {
  1967.                                                                                                 temp_v0_15 = temp_a1_21->unk3F18;
  1968.                                                                                                 temp_a1_21->unk3F18 = (u8)0xffU;
  1969.                                                                                                 phi_t3_13 = phi_t3_17;
  1970.                                                                                                 if (temp_v0_15 == 0)
  1971.                                                                                                 {
  1972.                                                                                                     phi_t3_13 = (u16)1;
  1973.                                                                                                 }
  1974.                                                                                             }
  1975.                                                                                         }
  1976.                                                                                         else
  1977.                                                                                         {
  1978.                                                                                             phi_t3_13 = phi_t3_17;
  1979.                                                                                             if (sp28->unk318 == 0)
  1980.                                                                                             {
  1981.                                                                                                 if (phi_a3_10 == 0)
  1982.                                                                                                 {
  1983.                                                                                                     temp_v0_16 = phi_t0_4->unk20;
  1984.                                                                                                     if (phi_t2_2 == temp_v0_16)
  1985.                                                                                                     {
  1986.                                                                                                         phi_v1_33 = (u8)0U;
  1987.                                                                                                     }
  1988.                                                                                                     else
  1989.                                                                                                     {
  1990.                                                                                                         phi_v1_33 = temp_v0_16;
  1991.                                                                                                     }
  1992.                                                                                                     phi_a2_31 = ((phi_t0_4 + (phi_v1_33 * 4)) + phi_a3_10)->unk4C;
  1993.                                                                                                 }
  1994.                                                                                                 else
  1995.                                                                                                 {
  1996.                                                                                                     phi_a2_31 = (phi_t0_4 + phi_a3_10)->unk4C;
  1997.                                                                                                 }
  1998.                                                                                                 temp_a1_22 = phi_t0_4 + phi_a3_10;
  1999.                                                                                                 phi_t3_13 = phi_t3_17;
  2000.                                                                                                 if (0xd == (phi_a2_31 & 0xff))
  2001.                                                                                                 {
  2002.                                                                                                     temp_t8 = temp_a1_22->unk3F18;
  2003.                                                                                                     temp_a1_22->unk3F18 = (u8)0U;
  2004.                                                                                                     phi_t3_13 = phi_t3_17;
  2005.                                                                                                     if ((u32) (phi_t4_2 ^ temp_t8) < 1U)
  2006.                                                                                                     {
  2007.                                                                                                         phi_t3_13 = (u16)1;
  2008.                                                                                                     }
  2009.                                                                                                 }
  2010.                                                                                             }
  2011.                                                                                         }
  2012.                                                                                         if (sp28->unk319 != 0) // dim weapons
  2013.                                                                                         {
  2014.                                                                                             if (phi_a3_10 == 0)
  2015.                                                                                             {
  2016.                                                                                                 temp_v0_17 = phi_t0_4->unk20;
  2017.                                                                                                 if (phi_t2_2 == temp_v0_17)
  2018.                                                                                                 {
  2019.                                                                                                     phi_v1_34 = (u8)0U;
  2020.                                                                                                 }
  2021.                                                                                                 else
  2022.                                                                                                 {
  2023.                                                                                                     phi_v1_34 = temp_v0_17;
  2024.                                                                                                 }
  2025.                                                                                                 phi_a2_32 = ((phi_t0_4 + (phi_v1_34 * 4)) + phi_a3_10)->unk4C;
  2026.                                                                                             }
  2027.                                                                                             else
  2028.                                                                                             {
  2029.                                                                                                 phi_a2_32 = (phi_t0_4 + phi_a3_10)->unk4C;
  2030.                                                                                             }
  2031.                                                                                             if ((phi_a2_32 & 0xff) >= 0x28)
  2032.                                                                                             {
  2033.                                                                                                 if (phi_a3_10 == 0)
  2034.                                                                                                 {
  2035.                                                                                                     temp_v0_18 = phi_t0_4->unk20;
  2036.                                                                                                     if (phi_t2_2 == temp_v0_18)
  2037.                                                                                                     {
  2038.                                                                                                         phi_v1_35 = (u8)0U;
  2039.                                                                                                     }
  2040.                                                                                                     else
  2041.                                                                                                     {
  2042.                                                                                                         phi_v1_35 = temp_v0_18;
  2043.                                                                                                     }
  2044.                                                                                                     phi_a0_10 = ((phi_t0_4 + (phi_v1_35 * 4)) + phi_a3_10)->unk4C;
  2045.                                                                                                 }
  2046.                                                                                                 else
  2047.                                                                                                 {
  2048.                                                                                                     phi_a0_10 = (phi_t0_4 + phi_a3_10)->unk4C;
  2049.                                                                                                 }
  2050.                                                                                                 phi_t3_7 = phi_t3_13;
  2051.                                                                                                 if ((phi_a0_10 & 0xff) >= 0x31)
  2052.                                                                                                 {
  2053. block_504:
  2054.                                                                                                     if (phi_a3_10 == 0)
  2055.                                                                                                     {
  2056.                                                                                                         temp_v0_19 = phi_t0_4->unk20;
  2057.                                                                                                         if (phi_t2_2 == temp_v0_19)
  2058.                                                                                                         {
  2059.                                                                                                             phi_v1_36 = (u8)0U;
  2060.                                                                                                         }
  2061.                                                                                                         else
  2062.                                                                                                         {
  2063.                                                                                                             phi_v1_36 = temp_v0_19;
  2064.                                                                                                         }
  2065.                                                                                                         phi_v0_8 = ((phi_t0_4 + (phi_v1_36 * 4)) + phi_a3_10)->unk4C;
  2066.                                                                                                     }
  2067.                                                                                                     else
  2068.                                                                                                     {
  2069.                                                                                                         phi_v0_8 = (phi_t0_4 + phi_a3_10)->unk4C;
  2070.                                                                                                     }
  2071.                                                                                                     if ((phi_v0_8 & 0xff) >= 0x12)
  2072.                                                                                                     {
  2073.                                                                                                         if (phi_a3_10 == 0)
  2074.                                                                                                         {
  2075.                                                                                                             temp_v0_20 = phi_t0_4->unk20;
  2076.                                                                                                             if (phi_t2_2 == temp_v0_20)
  2077.                                                                                                             {
  2078.                                                                                                                 phi_v1_37 = (u8)0U;
  2079.                                                                                                             }
  2080.                                                                                                             else
  2081.                                                                                                             {
  2082.                                                                                                                 phi_v1_37 = temp_v0_20;
  2083.                                                                                                             }
  2084.                                                                                                             phi_v0_9 = ((phi_t0_4 + (phi_v1_37 * 4)) + phi_a3_10)->unk4C;
  2085.                                                                                                         }
  2086.                                                                                                         else
  2087.                                                                                                         {
  2088.                                                                                                             phi_v0_9 = (phi_t0_4 + phi_a3_10)->unk4C;
  2089.                                                                                                         }
  2090.                                                                                                         phi_t3_7 = phi_t3_13;
  2091.                                                                                                         if ((phi_v0_9 & 0xff) >= 0x28)
  2092.                                                                                                         {
  2093. block_518:
  2094.                                                                                                             if (phi_a3_10 == 0)
  2095.                                                                                                             {
  2096.                                                                                                                 temp_v0_21 = phi_t0_4->unk20;
  2097.                                                                                                                 if (phi_t2_2 == temp_v0_21)
  2098.                                                                                                                 {
  2099.                                                                                                                     phi_v1_38 = (u8)0U;
  2100.                                                                                                                 }
  2101.                                                                                                                 else
  2102.                                                                                                                 {
  2103.                                                                                                                     phi_v1_38 = temp_v0_21;
  2104.                                                                                                                 }
  2105.                                                                                                                 phi_v0_10 = ((phi_t0_4 + (phi_v1_38 * 4)) + phi_a3_10)->unk4C;
  2106.                                                                                                             }
  2107.                                                                                                             else
  2108.                                                                                                             {
  2109.                                                                                                                 phi_v0_10 = (phi_t0_4 + phi_a3_10)->unk4C;
  2110.                                                                                                             }
  2111.                                                                                                             phi_t3_7 = phi_t3_13;
  2112.                                                                                                             if ((phi_v0_10 & 0xff) != 0)
  2113.                                                                                                             {
  2114.                                                                                                                 if (phi_a3_10 == 0)
  2115.                                                                                                                 {
  2116.                                                                                                                     temp_v0_22 = phi_t0_4->unk20;
  2117.                                                                                                                     if (phi_t2_2 == temp_v0_22)
  2118.                                                                                                                     {
  2119.                                                                                                                         phi_v1_39 = (u8)0U;
  2120.                                                                                                                     }
  2121.                                                                                                                     else
  2122.                                                                                                                     {
  2123.                                                                                                                         phi_v1_39 = temp_v0_22;
  2124.                                                                                                                     }
  2125.                                                                                                                     phi_v0_11 = ((phi_t0_4 + (phi_v1_39 * 4)) + phi_a3_10)->unk4C;
  2126.                                                                                                                 }
  2127.                                                                                                                 else
  2128.                                                                                                                 {
  2129.                                                                                                                     phi_v0_11 = (phi_t0_4 + phi_a3_10)->unk4C;
  2130.                                                                                                                 }
  2131.                                                                                                                 if ((phi_v0_11 & 0xff) >= 0x32)
  2132.                                                                                                                 {
  2133.                                                                                                                     if (phi_a3_10 == 0)
  2134.                                                                                                                     {
  2135.                                                                                                                         temp_v0_23 = phi_t0_4->unk20;
  2136.                                                                                                                         if (phi_t2_2 == temp_v0_23)
  2137.                                                                                                                         {
  2138.                                                                                                                             phi_v1_40 = (u8)0U;
  2139.                                                                                                                         }
  2140.                                                                                                                         else
  2141.                                                                                                                         {
  2142.                                                                                                                             phi_v1_40 = temp_v0_23;
  2143.                                                                                                                         }
  2144.                                                                                                                         phi_v0_12 = ((phi_t0_4 + (phi_v1_40 * 4)) + phi_a3_10)->unk4C;
  2145.                                                                                                                     }
  2146.                                                                                                                     else
  2147.                                                                                                                     {
  2148.                                                                                                                         phi_v0_12 = (phi_t0_4 + phi_a3_10)->unk4C;
  2149.                                                                                                                     }
  2150.                                                                                                                     phi_t3_7 = phi_t3_13;
  2151.                                                                                                                     if ((phi_v0_12 & 0xff) >= 0x4a)
  2152.                                                                                                                     {
  2153. block_539:
  2154.                                                                                                                         if (phi_a3_10 == 0)
  2155.                                                                                                                         {
  2156.                                                                                                                             temp_v0_24 = phi_t0_4->unk20;
  2157.                                                                                                                             if (phi_t2_2 == temp_v0_24)
  2158.                                                                                                                             {
  2159.                                                                                                                                 phi_v1_41 = (u8)0U;
  2160.                                                                                                                             }
  2161.                                                                                                                             else
  2162.                                                                                                                             {
  2163.                                                                                                                                 phi_v1_41 = temp_v0_24;
  2164.                                                                                                                             }
  2165.                                                                                                                             phi_v0_13 = ((phi_t0_4 + (phi_v1_41 * 4)) + phi_a3_10)->unk4C;
  2166.                                                                                                                         }
  2167.                                                                                                                         else
  2168.                                                                                                                         {
  2169.                                                                                                                             phi_v0_13 = (phi_t0_4 + phi_a3_10)->unk4C;
  2170.                                                                                                                         }
  2171.                                                                                                                         temp_a1_23 = phi_t0_4 + phi_a3_10;
  2172.                                                                                                                         phi_t3_7 = phi_t3_13;
  2173.                                                                                                                         if (0xd != (phi_v0_13 & 0xff))
  2174.                                                                                                                         {
  2175.                                                                                                                             phi_t3_7 = phi_t3_13;
  2176.                                                                                                                             if (temp_a1_23->unk3F18 == 0)
  2177.                                                                                                                             {
  2178.                                                                                                                                 temp_a1_23->unk3F18 = (u8)0xffU;
  2179.                                                                                                                                 phi_t3_7 = (u16)1;
  2180.                                                                                                                             }
  2181.                                                                                                                         }
  2182.                                                                                                                     }
  2183.                                                                                                                 }
  2184.                                                                                                                 else
  2185.                                                                                                                 {
  2186.                                                                                                                     goto block_539;
  2187.                                                                                                                 }
  2188.                                                                                                             }
  2189.                                                                                                         }
  2190.                                                                                                     }
  2191.                                                                                                     else
  2192.                                                                                                     {
  2193.                                                                                                         goto block_518;
  2194.                                                                                                     }
  2195.                                                                                                 }
  2196.                                                                                             }
  2197.                                                                                             else
  2198.                                                                                             {
  2199.                                                                                                 goto block_504;
  2200.                                                                                             }
  2201.                                                                                         }
  2202.                                                                                         else
  2203.                                                                                         {
  2204.                                                                                             phi_t3_7 = phi_t3_13;
  2205.                                                                                             if (sp28->unk319 == 0)
  2206.                                                                                             {
  2207.                                                                                                 if (phi_a3_10 == 0)
  2208.                                                                                                 {
  2209.                                                                                                     temp_v0_25 = phi_t0_4->unk20;
  2210.                                                                                                     if (phi_t2_2 == temp_v0_25)
  2211.                                                                                                     {
  2212.                                                                                                         phi_v1_42 = (u8)0U;
  2213.                                                                                                     }
  2214.                                                                                                     else
  2215.                                                                                                     {
  2216.                                                                                                         phi_v1_42 = temp_v0_25;
  2217.                                                                                                     }
  2218.                                                                                                     phi_a2_33 = ((phi_t0_4 + (phi_v1_42 * 4)) + phi_a3_10)->unk4C;
  2219.                                                                                                 }
  2220.                                                                                                 else
  2221.                                                                                                 {
  2222.                                                                                                     phi_a2_33 = (phi_t0_4 + phi_a3_10)->unk4C;
  2223.                                                                                                 }
  2224.                                                                                                 if ((phi_a2_33 & 0xff) >= 0x28)
  2225.                                                                                                 {
  2226.                                                                                                     if (phi_a3_10 == 0)
  2227.                                                                                                     {
  2228.                                                                                                         temp_v0_26 = phi_t0_4->unk20;
  2229.                                                                                                         if (phi_t2_2 == temp_v0_26)
  2230.                                                                                                         {
  2231.                                                                                                             phi_v1_43 = (u8)0U;
  2232.                                                                                                         }
  2233.                                                                                                         else
  2234.                                                                                                         {
  2235.                                                                                                             phi_v1_43 = temp_v0_26;
  2236.                                                                                                         }
  2237.                                                                                                         phi_a0_11 = ((phi_t0_4 + (phi_v1_43 * 4)) + phi_a3_10)->unk4C;
  2238.                                                                                                     }
  2239.                                                                                                     else
  2240.                                                                                                     {
  2241.                                                                                                         phi_a0_11 = (phi_t0_4 + phi_a3_10)->unk4C;
  2242.                                                                                                     }
  2243.                                                                                                     phi_t3_7 = phi_t3_13;
  2244.                                                                                                     if ((phi_a0_11 & 0xff) >= 0x31)
  2245.                                                                                                     {
  2246. block_563:
  2247.                                                                                                         if (phi_a3_10 == 0)
  2248.                                                                                                         {
  2249.                                                                                                             temp_v0_27 = phi_t0_4->unk20;
  2250.                                                                                                             if (phi_t2_2 == temp_v0_27)
  2251.                                                                                                             {
  2252.                                                                                                                 phi_v1_44 = (u8)0U;
  2253.                                                                                                             }
  2254.                                                                                                             else
  2255.                                                                                                             {
  2256.                                                                                                                 phi_v1_44 = temp_v0_27;
  2257.                                                                                                             }
  2258.                                                                                                             phi_v0_14 = ((phi_t0_4 + (phi_v1_44 * 4)) + phi_a3_10)->unk4C;
  2259.                                                                                                         }
  2260.                                                                                                         else
  2261.                                                                                                         {
  2262.                                                                                                             phi_v0_14 = (phi_t0_4 + phi_a3_10)->unk4C;
  2263.                                                                                                         }
  2264.                                                                                                         if ((phi_v0_14 & 0xff) >= 0x12)
  2265.                                                                                                         {
  2266.                                                                                                             if (phi_a3_10 == 0)
  2267.                                                                                                             {
  2268.                                                                                                                 temp_v0_28 = phi_t0_4->unk20;
  2269.                                                                                                                 if (phi_t2_2 == temp_v0_28)
  2270.                                                                                                                 {
  2271.                                                                                                                     phi_v1_45 = (u8)0U;
  2272.                                                                                                                 }
  2273.                                                                                                                 else
  2274.                                                                                                                 {
  2275.                                                                                                                     phi_v1_45 = temp_v0_28;
  2276.                                                                                                                 }
  2277.                                                                                                                 phi_v0_15 = ((phi_t0_4 + (phi_v1_45 * 4)) + phi_a3_10)->unk4C;
  2278.                                                                                                             }
  2279.                                                                                                             else
  2280.                                                                                                             {
  2281.                                                                                                                 phi_v0_15 = (phi_t0_4 + phi_a3_10)->unk4C;
  2282.                                                                                                             }
  2283.                                                                                                             phi_t3_7 = phi_t3_13;
  2284.                                                                                                             if ((phi_v0_15 & 0xff) >= 0x28)
  2285.                                                                                                             {
  2286. block_577:
  2287.                                                                                                                 if (phi_a3_10 == 0)
  2288.                                                                                                                 {
  2289.                                                                                                                     temp_v0_29 = phi_t0_4->unk20;
  2290.                                                                                                                     if (phi_t2_2 == temp_v0_29)
  2291.                                                                                                                     {
  2292.                                                                                                                         phi_v1_46 = (u8)0U;
  2293.                                                                                                                     }
  2294.                                                                                                                     else
  2295.                                                                                                                     {
  2296.                                                                                                                         phi_v1_46 = temp_v0_29;
  2297.                                                                                                                     }
  2298.                                                                                                                     phi_v0_16 = ((phi_t0_4 + (phi_v1_46 * 4)) + phi_a3_10)->unk4C;
  2299.                                                                                                                 }
  2300.                                                                                                                 else
  2301.                                                                                                                 {
  2302.                                                                                                                     phi_v0_16 = (phi_t0_4 + phi_a3_10)->unk4C;
  2303.                                                                                                                 }
  2304.                                                                                                                 phi_t3_7 = phi_t3_13;
  2305.                                                                                                                 if ((phi_v0_16 & 0xff) != 0)
  2306.                                                                                                                 {
  2307.                                                                                                                     if (phi_a3_10 == 0)
  2308.                                                                                                                     {
  2309.                                                                                                                         temp_v0_30 = phi_t0_4->unk20;
  2310.                                                                                                                         if (phi_t2_2 == temp_v0_30)
  2311.                                                                                                                         {
  2312.                                                                                                                             phi_v1_47 = (u8)0U;
  2313.                                                                                                                         }
  2314.                                                                                                                         else
  2315.                                                                                                                         {
  2316.                                                                                                                             phi_v1_47 = temp_v0_30;
  2317.                                                                                                                         }
  2318.                                                                                                                         phi_v0_17 = ((phi_t0_4 + (phi_v1_47 * 4)) + phi_a3_10)->unk4C;
  2319.                                                                                                                     }
  2320.                                                                                                                     else
  2321.                                                                                                                     {
  2322.                                                                                                                         phi_v0_17 = (phi_t0_4 + phi_a3_10)->unk4C;
  2323.                                                                                                                     }
  2324.                                                                                                                     if ((phi_v0_17 & 0xff) >= 0x32)
  2325.                                                                                                                     {
  2326.                                                                                                                         if (phi_a3_10 == 0)
  2327.                                                                                                                         {
  2328.                                                                                                                             temp_v0_31 = phi_t0_4->unk20;
  2329.                                                                                                                             if (phi_t2_2 == temp_v0_31)
  2330.                                                                                                                             {
  2331.                                                                                                                                 phi_v1_48 = (u8)0U;
  2332.                                                                                                                             }
  2333.                                                                                                                             else
  2334.                                                                                                                             {
  2335.                                                                                                                                 phi_v1_48 = temp_v0_31;
  2336.                                                                                                                             }
  2337.                                                                                                                             phi_v0_18 = ((phi_t0_4 + (phi_v1_48 * 4)) + phi_a3_10)->unk4C;
  2338.                                                                                                                         }
  2339.                                                                                                                         else
  2340.                                                                                                                         {
  2341.                                                                                                                             phi_v0_18 = (phi_t0_4 + phi_a3_10)->unk4C;
  2342.                                                                                                                         }
  2343.                                                                                                                         phi_t3_7 = phi_t3_13;
  2344.                                                                                                                         if ((phi_v0_18 & 0xff) >= 0x4a)
  2345.                                                                                                                         {
  2346. block_598:
  2347.                                                                                                                             if (phi_a3_10 == 0)
  2348.                                                                                                                             {
  2349.                                                                                                                                 temp_v0_32 = phi_t0_4->unk20;
  2350.                                                                                                                                 if (phi_t2_2 == temp_v0_32)
  2351.                                                                                                                                 {
  2352.                                                                                                                                     phi_v1_49 = (u8)0U;
  2353.                                                                                                                                 }
  2354.                                                                                                                                 else
  2355.                                                                                                                                 {
  2356.                                                                                                                                     phi_v1_49 = temp_v0_32;
  2357.                                                                                                                                 }
  2358.                                                                                                                                 phi_v0_19 = ((phi_t0_4 + (phi_v1_49 * 4)) + phi_a3_10)->unk4C;
  2359.                                                                                                                             }
  2360.                                                                                                                             else
  2361.                                                                                                                             {
  2362.                                                                                                                                 phi_v0_19 = (phi_t0_4 + phi_a3_10)->unk4C;
  2363.                                                                                                                             }
  2364.                                                                                                                             temp_a1_24 = phi_t0_4 + phi_a3_10;
  2365.                                                                                                                             phi_t3_7 = phi_t3_13;
  2366.                                                                                                                             if (0xd != (phi_v0_19 & 0xff))
  2367.                                                                                                                             {
  2368.                                                                                                                                 phi_t3_7 = phi_t3_13;
  2369.                                                                                                                                 if (phi_t4_2 == temp_a1_24->unk3F18)
  2370.                                                                                                                                 {
  2371.                                                                                                                                     temp_a1_24->unk3F18 = (u8)0U;
  2372.                                                                                                                                     phi_t3_7 = (u16)1;
  2373.                                                                                                                                 }
  2374.                                                                                                                             }
  2375.                                                                                                                         }
  2376.                                                                                                                     }
  2377.                                                                                                                     else
  2378.                                                                                                                     {
  2379.                                                                                                                         goto block_598;
  2380.                                                                                                                     }
  2381.                                                                                                                 }
  2382.                                                                                                             }
  2383.                                                                                                         }
  2384.                                                                                                         else
  2385.                                                                                                         {
  2386.                                                                                                             goto block_577;
  2387.                                                                                                         }
  2388.                                                                                                     }
  2389.                                                                                                 }
  2390.                                                                                                 else
  2391.                                                                                                 {
  2392.                                                                                                     goto block_563;
  2393.                                                                                                 }
  2394.                                                                                             }
  2395.                                                                                         }
  2396.                                                                                     }
  2397.                                                                                 }
  2398.                                                                             }
  2399.                                                                         }
  2400.                                                                     }
  2401.                                                                     temp_a3_11 = (s32) ((phi_a3_10 + 1) << 0x10) >> 0x10;
  2402.                                                                     phi_a3_10 = temp_a3_11;
  2403.                                                                     phi_t3_5 = phi_t3_7;
  2404.                                                                     phi_t0_5 = phi_t0_4;
  2405.                                                                     phi_t3_14 = phi_t3_7;
  2406.                                                                     if (temp_a3_11 < 4)
  2407.                                                                     {
  2408.                                                                         goto loop_305;
  2409.                                                                     }
  2410.                                                                 }
  2411.                                                             }
  2412.                                                         }
  2413.                                                     }
  2414.                                                 }
  2415.                                                 else // not in water
  2416.                                                 {
  2417.                                                     goto block_203;
  2418.                                                 }
  2419.                                             }
  2420.                                         }
  2421.                                         else // not deku
  2422.                                         {
  2423.                                             goto block_140;
  2424.                                         }
  2425.                                     }
  2426.                                     else // have magic
  2427.                                     {
  2428.                                         goto block_140;
  2429.                                     }
  2430.                                 }
  2431.                             }
  2432.                         }
  2433.                     }
  2434.                     else // not in cutscene scene
  2435.                     {
  2436.                         goto block_96;
  2437.                     }
  2438.                 }
  2439.             }
  2440.         }
  2441.     }
  2442.     if (phi_t3_5 != 0)
  2443.     {
  2444.         if (arg0->unk810 == 0)
  2445.         {
  2446.             temp_v0_33 = arg0 + 0x18000;
  2447.             if (temp_v0_33->unk875 == 0)
  2448.             {
  2449.                 if (temp_v0_33->unkB4A == 0)
  2450.                 {
  2451.                     phi_t0_5->unk3F22 = (u16)0;
  2452.                     func_8010EF68(0x32);
  2453.                 }
  2454.             }
  2455.         }
  2456.     }
  2457. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement