exodus122

OoT Button Dimming Logic

May 20th, 2020
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.00 KB | None | 0 0
  1. if (not_paused_or_in_game_over_screen // checks if menu short == 0 and debug menu activator short == 0
  2.     && (playing_horse_back_archery // if minigame state == 1
  3.             || scene_setup < 4 // this is why wrong warps give RI
  4.             || in_ranch_scene_setup_4) // ranch horse race
  5.     && (no_textbox_on_screen // this causes nothing to update b or c
  6.             || in_bombchu_bowling_with_textbox_on_screen)
  7.     && (not_dead) // (global_context.0x10A20 == 0)
  8.     && (current_cutscene < 0xFFF0
  9.             || in_ranch_watching_cutscene_0) // ranch horse race intro cutscene
  10. {
  11.     if (riding_epona // RC epona counts as riding epona
  12.         || playing_shooting_gallery // this flag gets unset when outside shooting gallery (not just by stopping minigame)
  13.         || playing_bombchu_bowling)
  14.     {
  15.         if (b != blank) {  // this was to prevent putting item on b repeatedly
  16.         // this check causes any item on epona with blank b
  17.             if (temp_b == 255) { // if b is dimmed but not blank when you start playing game or riding epona, all buttons should be undimmed
  18.                 temp_b = 0 // undim b
  19.                 undim all c buttons
  20.             }
  21.             if (b != sling/bow/chu/blank) // if dont have minigame item or blank on b. also b was already checked to not be blank
  22.             {
  23.                 temp_b = b // place original b item on temp_b
  24.                 if (playing_bombchu_bowling)
  25.                     b = bombchu // put bombchu on b
  26.                 else {
  27.                     b = bow // put bow on b
  28.                     if (playing_shooting_gallery)
  29.                         if(are_child)
  30.                             b = slingshot // put slingshot on b
  31.                     else // if riding epona
  32.                         if (bow slot == empty)
  33.                             b = blank // put blank on b
  34.                 }
  35.                 dim all c buttons
  36.             }
  37.         }
  38.     }
  39.     else if (in_chamber_of_sages)
  40.     {
  41.         // this just hides the HUD
  42.     }
  43.     else if (in_fishing_pond)
  44.     {
  45.         if (playing_fishing_minigame) // used to put rod on b when playing
  46.         // this flag gets unset when outside fishing pond (not jsut by leaving through door)
  47.         {
  48.             if (b != fishing rod) // only do this once, when start minigame
  49.             {
  50.                 temp_b = b // place orignal b item on temp_b
  51.                 b = fishing rod // put rod on b
  52.             }
  53.         }
  54.         else if (fishing rod on b)  // used to remove rod from b when stop
  55.         // if enter pond with rod on b, push temp_b to b, and dim b+c
  56.         {
  57.             b = temp_b // restore original b item
  58.             temp_b = 255 // dim b
  59.             dim all c buttons
  60.         }
  61.         else { // used to dim buttons when in pond, when not playing
  62.         // if enter pond without rod on b, dim b+c
  63.             temp_b = 255 // dim b
  64.             dim all c buttons
  65.         }
  66.     }
  67.     else if (no_textbox_on_screen))
  68.     {
  69.         if (not_in_room_with_heat_timer && swimming_state_set)
  70.         {
  71.             temp_b = 255
  72.             if (standing_underwater_with_iron_boots_for_4_seconds)
  73.                 dim all c buttons except hookshot/longshot
  74.             else
  75.                 dim all c buttons
  76.         }
  77.         else if (crawling || climbing_on_ladder_or_wall) // down a or blank a
  78.         {
  79.             if (temp_b != 255)
  80.             {
  81.                 temp_b = 255
  82.                 dim all c buttons
  83.             }
  84.         }
  85.         else if (rented_horse_from_ingo) // event_inf is a table of shorts. the 1 bit is checked in the first entry of this table. so (event_inf[0] & 1 == 1)
  86.             // this flag gets set when you say yes to ingo to ride a horse. then gets unset when you ask to leave the corral
  87.             // this is how windy b works
  88.         {
  89.             if (riding_epona) // impossible to be true, because there is a check higher up for "riding epona"
  90.             {
  91.                 if (b != bow && b != blank)
  92.                     if (bow_slot == empty)
  93.                         b = blank
  94.                     else
  95.                         b = bow
  96.             }
  97.             else
  98.             {
  99.                 if (b == bow || b == blank)
  100.                     if (b != sword_item) // has to be true. sword item means "0x3B kokiri sword", "0x3C master sword", "0x3C biggoron sword/giant's knife", "0x55 giant's knife"
  101.                         b = temp_b
  102.                     else
  103.                         temp_b = b // impossible to reach?
  104.             }
  105.             dim all c buttons except ocarina
  106.         }
  107.         else
  108.         {
  109.             if (b_not_restricted_in_current_scene)
  110.             {
  111.                 if (b == sling/bow/bombchu/blank)
  112.                 {
  113.                     if (b != blank || sword_not_equipped_flag == 0)
  114.                         b = temp_b
  115.                 }
  116.                 else if (temp_b == 255)
  117.                 {
  118.                     if (temp_b == 255 || temp_b == 0)
  119.                         temp_b = 0
  120.                     else
  121.                         b = temp_b
  122.                 }
  123.                 // if you have blank b and sword_not_equipped == 1 (sword hasn't been equipped), do nothing
  124.                 // if you have blank b and sword_not_equipped == 0 (sword has been equipped), b = temp b
  125.                 // if you have sling/bow/bombchu on b, b = temp b
  126.                 // else if b is dimmed, undim it
  127.                 // else do nothing
  128.             }
  129.             else if (b_restricted_in_current_scene)
  130.             {
  131.                 if (b == sling/bow/bombchu/blank)
  132.                 {
  133.                     if (b != blank || sword_not_equipped_flag == 1)
  134.                         b = temp_b
  135.                 }
  136.                 else
  137.                 {
  138.                     temp_b = 255
  139.                 }
  140.                 // if you have blank b and sword_not_equipped == 1, do nothing
  141.                 // if you have blank b and sword_not_equipped == 0, b = temp b
  142.                 // if you have sling/bow/bombchu on b, b = temp b
  143.                 // else dim b
  144.                
  145.             }
  146.            
  147.             restrict certain buttons/items depending on current scene
  148.             (this includes FW outside dungeons,
  149.             c buttons and weapons in houses,
  150.             ocarina in boss rooms, and more)
  151.             // for a full list, go here: https://docs.google.com/spreadsheets/d/1SLJzamokLb7wDOaJh5x8DsxmMBy9oIYawyDN3dAWppw/edit#gid=577133954
  152.         }
  153.     }
  154. }
Add Comment
Please, Sign In to add comment