shithub: zelda3

Download patch

ref: 91d771ecc4532e4e40995b133edd9d82a39d61ac
parent: c9c6843f7d74f3c448f623e58b5364cf73bd0eb9
author: xander-haj <[email protected]>
date: Sat Oct 29 12:10:14 EDT 2022

add LR cycle limit config (#172)

when enabled, limits the the item cycle for L & R to 4 slots

--- a/config.c
+++ b/config.c
@@ -438,6 +438,8 @@
   } else if (section == 4) {
     if (StringEqualsNoCase(key, "ItemSwitchLR")) {
       return ParseBoolBit(value, &g_config.features0, kFeatures0_SwitchLR);
+    } else if (StringEqualsNoCase(key, "ItemSwitchLRLimit")) {
+      return ParseBoolBit(value, &g_config.features0, kFeatures0_SwitchLRLimit);
     } else if (StringEqualsNoCase(key, "TurnWhileDashing")) {
       return ParseBoolBit(value, &g_config.features0, kFeatures0_TurnWhileDashing);
     } else if (StringEqualsNoCase(key, "MirrorToDarkworld")) {
--- a/features.h
+++ b/features.h
@@ -42,6 +42,8 @@
   kFeatures0_CancelBirdTravel = 8192,
 
   kFeatures0_GameChangingBugFixes = 16384,
+
+  kFeatures0_SwitchLRLimit = 32768,
 };
 
 #define enhanced_features0 (*(uint32*)(g_ram+0x64c))
--- a/hud.c
+++ b/hud.c
@@ -954,8 +954,8 @@
       PV(1,1,1,3,3,1,1,1),
       PV(1,1,1,3,3,1,1,1)
     };
-    memcpy(&g_zenv.vram[0x7000 + 0xd * 8], kBytesForNewTile0xD_BottomofR, sizeof(kBytesForNewTile0xD_BottomofR));;
-  }else if (switch_lr == 2) {
+    memcpy(&g_zenv.vram[0x7000 + 0xd * 8], kBytesForNewTile0xD_BottomofR, sizeof(kBytesForNewTile0xD_BottomofR));
+  } else if (switch_lr == 2) {
     static const uint16 kBytesForNewTile0xE_TopOfL[8] = {
       PV(1,1,1,3,3,3,3,3),
       PV(1,1,1,3,3,3,3,3),
@@ -1510,7 +1510,7 @@
   bool direction;
   
   if (filtered_joypad_L & kJoypadL_L && (hud_cur_item_l == 0))
-    direction = false;
+    direction = (hud_cur_item_r != 0);
   else if (filtered_joypad_L & kJoypadL_R && (hud_cur_item_r == 0))
     direction = true;
   else
@@ -1522,7 +1522,7 @@
       Hud_GotoPrevItem(&item, 1);
     else
       Hud_GotoNextItem(&item, 1);
-    if (Hud_DoWeHaveThisItem(item)) {
+    if (Hud_DoWeHaveThisItem(item) && (!(enhanced_features0 & kFeatures0_SwitchLRLimit) || Hud_GetItemPosition(item) <= 3)) {
       if (item != hud_cur_item) {
         hud_cur_item = item;
         sound_effect_2 = 32;
--- a/zelda3.ini
+++ b/zelda3.ini
@@ -84,13 +84,14 @@
 MSUVolume = 100%
 
 [Features]
-# Item switch on L/R. Also allows reordering of items in inventory by pressing Y+direction
-# Hold X,L,or R inside of the item selection screen to reassign an item into a separate item slot.
-# When X is assigned to an item, the Select key is used to enter the map. Press Select inside
-# of the Start menu to see the old select options.
-# When L is assigned an item, Item cycle will cease for the L button
-# this also applies for the R button.
+# Item switch on L/R. Also allows reordering of items in inventory by pressing Y+direction.
+# Hold X, L, or R inside of the item selection screen to assign items to those buttons.
+# If X is reassigned, Select opens the map. Push Select while paused to save or quit.
+# When L or R are assigned items, those buttons will no longer cycle items.
 ItemSwitchLR = 0
+
+# Enable this to limit the ItemSwitchLR item cycling to the first 4 items.
+ItemSwitchLRLimit = 0
 
 # Allow turning while dashing
 TurnWhileDashing = 0