add LR cycle limit config (#172)

when enabled, limits the the item cycle for L & R to 4 slots
This commit is contained in:
xander-haj
2022-10-29 16:10:14 -05:00
committed by GitHub
parent c9c6843f7d
commit 91d771ecc4
4 changed files with 15 additions and 10 deletions

View File

@@ -438,6 +438,8 @@ static bool HandleIniConfig(int section, const char *key, char *value) {
} 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")) {

View File

@@ -42,6 +42,8 @@ enum {
kFeatures0_CancelBirdTravel = 8192,
kFeatures0_GameChangingBugFixes = 16384,
kFeatures0_SwitchLRLimit = 32768,
};
#define enhanced_features0 (*(uint32*)(g_ram+0x64c))

8
hud.c
View File

@@ -954,8 +954,8 @@ static void CopyTilesForSwitchLR(int switch_lr) {
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 @@ void Hud_HandleItemSwitchInputs() {
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 @@ void Hud_HandleItemSwitchInputs() {
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;

View File

@@ -84,14 +84,15 @@ ResumeMSU = 1
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