mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 01:12:19 -05:00
Merge pull request #4122 from Archez/merge-macready-may6
Merge macready -> develop
This commit is contained in:
commit
a860a7ea39
@ -46,10 +46,18 @@ template<> struct is_char_type<std::byte>: public boost::true_type {};
|
|||||||
|
|
||||||
#endif // #if !BOOST_VERSION_HAS_HASH_RANGE
|
#endif // #if !BOOST_VERSION_HAS_HASH_RANGE
|
||||||
|
|
||||||
|
#if BOOST_USE_STD_TYPES
|
||||||
|
#define BOOST_ENABLE_IF std::enable_if
|
||||||
|
#define BOOST_IS_SAME std::is_same
|
||||||
|
#else
|
||||||
|
#define BOOST_ENABLE_IF boost::enable_if_
|
||||||
|
#define BOOST_IS_SAME is_same
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class It>
|
template<class It>
|
||||||
inline typename boost::enable_if_<
|
inline typename BOOST_ENABLE_IF<
|
||||||
is_char_type<typename std::iterator_traits<It>::value_type>::value &&
|
is_char_type<typename std::iterator_traits<It>::value_type>::value &&
|
||||||
is_same<typename std::iterator_traits<It>::iterator_category, std::random_access_iterator_tag>::value,
|
BOOST_IS_SAME<typename std::iterator_traits<It>::iterator_category, std::random_access_iterator_tag>::value,
|
||||||
std::size_t>::type
|
std::size_t>::type
|
||||||
hash_range_32( uint32_t seed, It first, It last )
|
hash_range_32( uint32_t seed, It first, It last )
|
||||||
{
|
{
|
||||||
@ -114,4 +122,7 @@ std::size_t>::type
|
|||||||
} // namespace hash_detail
|
} // namespace hash_detail
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
#undef BOOST_ENABLE_IF
|
||||||
|
#undef BOOST_IS_SAME
|
||||||
|
|
||||||
#endif // #ifndef BOOST_HASH_DETAIL_HASH_RANGE_32_HPP
|
#endif // #ifndef BOOST_HASH_DETAIL_HASH_RANGE_32_HPP
|
||||||
|
@ -23,6 +23,18 @@
|
|||||||
|
|
||||||
#endif // #if !BOOST_VERSION_HAS_HASH_RANGE
|
#endif // #if !BOOST_VERSION_HAS_HASH_RANGE
|
||||||
|
|
||||||
|
#if BOOST_USE_STD_TYPES
|
||||||
|
#define BOOST_ENABLE_IF std::enable_if
|
||||||
|
#define BOOST_IS_INTEGRAL hash_detail::is_integral
|
||||||
|
#define BOOST_IS_UNSIGNED is_unsigned
|
||||||
|
#define BOOST_MAKE_UNSIGNED make_unsigned
|
||||||
|
#else
|
||||||
|
#define BOOST_ENABLE_IF boost::enable_if_
|
||||||
|
#define BOOST_IS_INTEGRAL boost::is_integral
|
||||||
|
#define BOOST_IS_UNSIGNED boost::is_unsigned
|
||||||
|
#define BOOST_MAKE_UNSIGNED boost::make_unsigned
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -36,7 +48,7 @@ namespace boost
|
|||||||
{
|
{
|
||||||
template<class T,
|
template<class T,
|
||||||
bool bigger_than_size_t = (sizeof(T) > sizeof(uint32_t)),
|
bool bigger_than_size_t = (sizeof(T) > sizeof(uint32_t)),
|
||||||
bool is_unsigned = boost::is_unsigned<T>::value,
|
bool is_unsigned = BOOST_IS_UNSIGNED<T>::value,
|
||||||
std::size_t size_t_bits = sizeof(uint32_t) * CHAR_BIT,
|
std::size_t size_t_bits = sizeof(uint32_t) * CHAR_BIT,
|
||||||
std::size_t type_bits = sizeof(T) * CHAR_BIT>
|
std::size_t type_bits = sizeof(T) * CHAR_BIT>
|
||||||
struct hash_integral_impl_32;
|
struct hash_integral_impl_32;
|
||||||
@ -53,7 +65,7 @@ namespace boost
|
|||||||
{
|
{
|
||||||
static uint32_t fn( T v )
|
static uint32_t fn( T v )
|
||||||
{
|
{
|
||||||
typedef typename boost::make_unsigned<T>::type U;
|
typedef typename BOOST_MAKE_UNSIGNED<T>::type U;
|
||||||
|
|
||||||
if( v >= 0 )
|
if( v >= 0 )
|
||||||
{
|
{
|
||||||
@ -97,7 +109,7 @@ namespace boost
|
|||||||
} // namespace hash_detail
|
} // namespace hash_detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename boost::enable_if_<boost::is_integral<T>::value, uint32_t>::type
|
typename BOOST_ENABLE_IF<BOOST_IS_INTEGRAL<T>::value, uint32_t>::type
|
||||||
hash_value_32( T v )
|
hash_value_32( T v )
|
||||||
{
|
{
|
||||||
return hash_detail::hash_integral_impl_32<T>::fn( v );
|
return hash_detail::hash_integral_impl_32<T>::fn( v );
|
||||||
@ -106,7 +118,7 @@ namespace boost
|
|||||||
// contiguous ranges (string, vector, array)
|
// contiguous ranges (string, vector, array)
|
||||||
#if BOOST_VERSION_HAS_HASH_RANGE
|
#if BOOST_VERSION_HAS_HASH_RANGE
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename boost::enable_if_<container_hash::is_contiguous_range<T>::value, uint32_t>::type
|
typename BOOST_ENABLE_IF<container_hash::is_contiguous_range<T>::value, uint32_t>::type
|
||||||
hash_value_32( T const& v )
|
hash_value_32( T const& v )
|
||||||
{
|
{
|
||||||
return boost::hash_range_32( v.data(), v.data() + v.size() );
|
return boost::hash_range_32( v.data(), v.data() + v.size() );
|
||||||
@ -168,5 +180,9 @@ namespace boost
|
|||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#undef BOOST_HASH_CHAR_TRAITS
|
#undef BOOST_HASH_CHAR_TRAITS
|
||||||
|
#undef BOOST_ENABLE_IF
|
||||||
|
#undef BOOST_IS_INTEGRAL
|
||||||
|
#undef BOOST_IS_UNSIGNED
|
||||||
|
#undef BOOST_MAKE_UNSIGNED
|
||||||
|
|
||||||
#endif // #ifndef BOOST_FUNCTIONAL_HASH_HASH_32_HPP
|
#endif // #ifndef BOOST_FUNCTIONAL_HASH_HASH_32_HPP
|
||||||
|
@ -6,4 +6,6 @@
|
|||||||
|
|
||||||
#define BOOST_VERSION_HAS_HASH_RANGE ((BOOST_VERSION / 100 % 1000) >= 81)
|
#define BOOST_VERSION_HAS_HASH_RANGE ((BOOST_VERSION / 100 % 1000) >= 81)
|
||||||
|
|
||||||
|
#define BOOST_USE_STD_TYPES ((BOOST_VERSION / 100 % 1000) >= 84)
|
||||||
|
|
||||||
#endif // #ifndef BOOST_CONTAINER_HASH_VERSION_HPP
|
#endif // #ifndef BOOST_CONTAINER_HASH_VERSION_HPP
|
||||||
|
@ -1436,64 +1436,62 @@ Gfx* Gfx_TextureI8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 te
|
|||||||
return displayListHead;
|
return displayListHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inventory_SwapAgeEquipment(void) {
|
void Rando_Inventory_SwapAgeEquipment(void) {
|
||||||
s16 i;
|
s16 i;
|
||||||
u16 shieldEquipValue;
|
u16 shieldEquipValue;
|
||||||
|
|
||||||
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
gSaveContext.childEquips.buttonItems[i] =
|
||||||
|
gSaveContext.equips.buttonItems[i];
|
||||||
} else {
|
} else {
|
||||||
gSaveContext.childEquips.buttonItems[i] = ITEM_SWORD_KOKIRI;
|
gSaveContext.childEquips.buttonItems[i] = ITEM_SWORD_KOKIRI;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
gSaveContext.childEquips.cButtonSlots[i - 1] = gSaveContext.equips.cButtonSlots[i - 1];
|
gSaveContext.childEquips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.equips.cButtonSlots[i - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When becoming adult, remove swordless flag since we'll get master sword
|
|
||||||
// (Unless Master Sword is shuffled)
|
|
||||||
// Only in rando to keep swordless link bugs in vanilla
|
|
||||||
if (IS_RANDO && !Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD)) {
|
|
||||||
Flags_UnsetInfTable(INFTABLE_SWORDLESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
gSaveContext.childEquips.equipment = gSaveContext.equips.equipment;
|
gSaveContext.childEquips.equipment = gSaveContext.equips.equipment;
|
||||||
|
|
||||||
if (gSaveContext.adultEquips.buttonItems[0] == ITEM_NONE && !(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) && gSaveContext.adultEquips.equipment)) {
|
// When becoming adult, remove swordless flag since we'll get master sword
|
||||||
if (!IS_RANDO || !Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD)) {
|
// This gets set back appropriately later in the case of master sword shuffle
|
||||||
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
|
Flags_UnsetInfTable(INFTABLE_SWORDLESS);
|
||||||
} else {
|
|
||||||
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
// This section sets up the equipment on the first time going adult.
|
||||||
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
// On master sword shuffle the check for the B button is insufficient, and so checking the equipment is completely zero-ed is needed
|
||||||
}
|
// (Could just always use `gSaveContext.adultEquips.equipment == 0` for rando?)
|
||||||
|
if (gSaveContext.adultEquips.buttonItems[0] == ITEM_NONE && ((IS_RANDO && !Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD)) || (gSaveContext.adultEquips.equipment == 0))) {
|
||||||
|
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
|
||||||
|
|
||||||
if (gSaveContext.inventory.items[SLOT_NUT] != ITEM_NONE) {
|
if (gSaveContext.inventory.items[SLOT_NUT] != ITEM_NONE) {
|
||||||
gSaveContext.equips.buttonItems[1] = ITEM_NUT;
|
gSaveContext.equips.buttonItems[1] = ITEM_NUT;
|
||||||
gSaveContext.equips.cButtonSlots[0] = SLOT_NUT;
|
gSaveContext.equips.cButtonSlots[0] = SLOT_NUT;
|
||||||
} else {
|
} else {
|
||||||
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.cButtonSlots[0] = ITEM_NONE;
|
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.cButtonSlots[0] =
|
||||||
|
ITEM_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gSaveContext.equips.buttonItems[2] = ITEM_BOMB;
|
gSaveContext.equips.buttonItems[2] = ITEM_BOMB;
|
||||||
gSaveContext.equips.buttonItems[3] = gSaveContext.inventory.items[SLOT_OCARINA];
|
gSaveContext.equips.buttonItems[3] = gSaveContext.inventory.items[SLOT_OCARINA];
|
||||||
gSaveContext.equips.cButtonSlots[1] = SLOT_BOMB;
|
gSaveContext.equips.cButtonSlots[1] = SLOT_BOMB;
|
||||||
gSaveContext.equips.cButtonSlots[2] = SLOT_OCARINA;
|
gSaveContext.equips.cButtonSlots[2] = SLOT_OCARINA;
|
||||||
|
|
||||||
gSaveContext.equips.equipment = (EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4)) |
|
gSaveContext.equips.equipment = (EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4)) |
|
||||||
(EQUIP_VALUE_SHIELD_HYLIAN << (EQUIP_TYPE_SHIELD * 4)) |
|
(EQUIP_VALUE_SHIELD_HYLIAN << (EQUIP_TYPE_SHIELD * 4)) |
|
||||||
(EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4)) |
|
(EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4)) |
|
||||||
(EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4));
|
(EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4));
|
||||||
|
|
||||||
|
// In Master Sword Shuffle we want to override the equip of the master sword from the vanilla code
|
||||||
|
// First check we have the Master sword in our inventory, and if not, then unequip
|
||||||
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) &&
|
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) &&
|
||||||
gSaveContext.equips.buttonItems[0] == ITEM_NONE) {
|
!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)) {
|
||||||
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
||||||
|
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
||||||
|
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the dpad to nothing
|
// Set the dpad to nothing
|
||||||
gSaveContext.equips.buttonItems[4] = ITEM_NONE;
|
gSaveContext.equips.buttonItems[4] = ITEM_NONE;
|
||||||
gSaveContext.equips.buttonItems[5] = ITEM_NONE;
|
gSaveContext.equips.buttonItems[5] = ITEM_NONE;
|
||||||
@ -1505,24 +1503,24 @@ void Inventory_SwapAgeEquipment(void) {
|
|||||||
gSaveContext.equips.cButtonSlots[6] = SLOT_NONE;
|
gSaveContext.equips.cButtonSlots[6] = SLOT_NONE;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
gSaveContext.equips.buttonItems[i] = gSaveContext.adultEquips.buttonItems[i];
|
gSaveContext.equips.buttonItems[i] =
|
||||||
|
gSaveContext.adultEquips.buttonItems[i];
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
gSaveContext.equips.cButtonSlots[i - 1] = gSaveContext.adultEquips.cButtonSlots[i - 1];
|
gSaveContext.equips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.adultEquips.cButtonSlots[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
|
if (((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
|
||||||
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) ||
|
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) ||
|
||||||
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
||||||
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
||||||
osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.cButtonSlots[i - 1]);
|
|
||||||
gSaveContext.equips.buttonItems[i] =
|
gSaveContext.equips.buttonItems[i] =
|
||||||
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In Rando, when switching to adult for the second+ time, if a sword was not previously
|
// In Master Sword Shuffle we want to set the swordless flag if no item is on the B button
|
||||||
// equiped in MS shuffle, then we need to set the swordless flag again
|
|
||||||
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) &&
|
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) &&
|
||||||
gSaveContext.equips.buttonItems[0] == ITEM_NONE) {
|
gSaveContext.equips.buttonItems[0] == ITEM_NONE) {
|
||||||
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
||||||
@ -1531,90 +1529,43 @@ void Inventory_SwapAgeEquipment(void) {
|
|||||||
gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment;
|
gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// When becoming child, set swordless flag if player doesn't have kokiri sword
|
|
||||||
// Only in rando to keep swordless link bugs in vanilla
|
|
||||||
if (IS_RANDO && CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0) {
|
|
||||||
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// When using enhancements, set swordless flag if player doesn't have kokiri sword or hasn't equipped a sword yet.
|
|
||||||
// Then set the child equips button items to item none to ensure kokiri sword is not equipped
|
|
||||||
if ((CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) || CVarGetInteger(CVAR_GENERAL("SwitchTimeline"), 0)) && (CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0 || Flags_GetInfTable(INFTABLE_SWORDLESS))) {
|
|
||||||
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
|
||||||
gSaveContext.childEquips.buttonItems[0] = ITEM_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
gSaveContext.adultEquips.cButtonSlots[i - 1] = gSaveContext.equips.cButtonSlots[i - 1];
|
gSaveContext.adultEquips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.equips.cButtonSlots[i - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
|
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
|
||||||
// Switching age using enhancements separated out to make vanilla flow clear
|
|
||||||
if (CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) || CVarGetInteger(CVAR_GENERAL("SwitchTimeline"), 0)) {
|
if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE) {
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i];
|
gSaveContext.equips.buttonItems[i] =
|
||||||
|
gSaveContext.childEquips.buttonItems[i];
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
gSaveContext.equips.cButtonSlots[i - 1] = gSaveContext.childEquips.cButtonSlots[i - 1];
|
gSaveContext.equips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.childEquips.cButtonSlots[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
|
if (((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
|
||||||
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) ||
|
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) ||
|
||||||
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
||||||
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
||||||
osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.cButtonSlots[i - 1]);
|
|
||||||
gSaveContext.equips.buttonItems[i] =
|
gSaveContext.equips.buttonItems[i] =
|
||||||
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gSaveContext.equips.equipment = gSaveContext.childEquips.equipment;
|
|
||||||
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
|
||||||
// Equips kokiri sword in the inventory screen only if kokiri sword exists in inventory and a sword has been equipped already
|
|
||||||
if (!(CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0) && !Flags_GetInfTable(INFTABLE_SWORDLESS)) {
|
|
||||||
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4);
|
|
||||||
}
|
|
||||||
} else if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE) {
|
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
|
||||||
gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i];
|
|
||||||
|
|
||||||
if (i != 0) {
|
|
||||||
gSaveContext.equips.cButtonSlots[i - 1] = gSaveContext.childEquips.cButtonSlots[i - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
|
|
||||||
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) ||
|
|
||||||
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
|
||||||
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
|
||||||
osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.cButtonSlots[i - 1]);
|
|
||||||
gSaveContext.equips.buttonItems[i] =
|
|
||||||
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// In Rando, when switching to child from a swordless adult, and child Link previously had a
|
|
||||||
// sword equiped, then we need to unset the swordless flag to match
|
|
||||||
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) &&
|
|
||||||
gSaveContext.equips.buttonItems[0] != ITEM_NONE) {
|
|
||||||
Flags_UnsetInfTable(INFTABLE_SWORDLESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
gSaveContext.equips.equipment = gSaveContext.childEquips.equipment;
|
gSaveContext.equips.equipment = gSaveContext.childEquips.equipment;
|
||||||
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
||||||
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4);
|
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4);
|
||||||
} else if (IS_RANDO && Randomizer_GetSettingValue(RSK_STARTING_AGE) == RO_AGE_ADULT) {
|
}
|
||||||
/*If in rando and starting age is adult, childEquips is not initialized and buttonItems[0]
|
// In Rando we need an extra case to handle starting as adult. We can use the fact that the childEquips will be uninitialised (i.e. 0) at this point
|
||||||
will be ITEM_NONE. When changing age from adult -> child, reset equips to "default"
|
else if (gSaveContext.childEquips.equipment == 0) {
|
||||||
(only kokiri tunic/boots equipped, no sword, no C-button items, no D-Pad items).
|
|
||||||
When becoming child, set swordless flag if player doesn't have kokiri sword
|
|
||||||
Only in rando to keep swordless link bugs in vanilla*/
|
|
||||||
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0) {
|
|
||||||
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
//zero out items
|
//zero out items
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
@ -1629,20 +1580,147 @@ void Inventory_SwapAgeEquipment(void) {
|
|||||||
(EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4));
|
(EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) || CVarGetInteger(CVAR_GENERAL("SwitchTimeline"), 0)) &&
|
// When becoming child in rando, set swordless flag and clear B button if player doesn't have kokiri sword
|
||||||
(gSaveContext.equips.buttonItems[0] == ITEM_NONE)) {
|
// Otherwise, equip sword and unset flag
|
||||||
|
if (!CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI)) {
|
||||||
|
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
||||||
|
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
|
||||||
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
Flags_SetInfTable(INFTABLE_SWORDLESS);
|
||||||
if (gSaveContext.childEquips.equipment == 0) {
|
} else {
|
||||||
// force equip kokiri tunic and boots in scenario gSaveContext.childEquips.equipment is uninitialized
|
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
||||||
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
gSaveContext.equips.equipment |= (EQUIP_VALUE_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4));
|
||||||
gSaveContext.equips.equipment |= (EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4)) |
|
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
|
||||||
(EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4));
|
Flags_UnsetInfTable(INFTABLE_SWORDLESS);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CVarSetInteger(CVAR_GENERAL("SwitchTimeline"), 0);
|
|
||||||
shieldEquipValue = gEquipMasks[EQUIP_TYPE_SHIELD] & gSaveContext.equips.equipment;
|
shieldEquipValue = gEquipMasks[EQUIP_TYPE_SHIELD] & gSaveContext.equips.equipment;
|
||||||
if (shieldEquipValue != 0) {
|
if (shieldEquipValue) {
|
||||||
|
shieldEquipValue >>= gEquipShifts[EQUIP_TYPE_SHIELD];
|
||||||
|
if (!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, shieldEquipValue - 1)) {
|
||||||
|
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SHIELD];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Inventory_SwapAgeEquipment(void) {
|
||||||
|
s16 i;
|
||||||
|
u16 shieldEquipValue;
|
||||||
|
|
||||||
|
// Mod Enhancments can utilise the rando flow path
|
||||||
|
if (IS_RANDO || CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) || CVarGetInteger(CVAR_GENERAL("SwitchTimeline"), 0)) {
|
||||||
|
Rando_Inventory_SwapAgeEquipment();
|
||||||
|
CVarSetInteger(CVAR_GENERAL("SwitchTimeline"), 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
||||||
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
|
if (i != 0) {
|
||||||
|
gSaveContext.childEquips.buttonItems[i] =
|
||||||
|
gSaveContext.equips.buttonItems[i];
|
||||||
|
} else {
|
||||||
|
gSaveContext.childEquips.buttonItems[i] = ITEM_SWORD_KOKIRI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i != 0) {
|
||||||
|
gSaveContext.childEquips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.equips.cButtonSlots[i - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gSaveContext.childEquips.equipment = gSaveContext.equips.equipment;
|
||||||
|
|
||||||
|
if (gSaveContext.adultEquips.buttonItems[0] == ITEM_NONE) {
|
||||||
|
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
|
||||||
|
|
||||||
|
if (gSaveContext.inventory.items[SLOT_NUT] != ITEM_NONE) {
|
||||||
|
gSaveContext.equips.buttonItems[1] = ITEM_NUT;
|
||||||
|
gSaveContext.equips.cButtonSlots[0] = SLOT_NUT;
|
||||||
|
} else {
|
||||||
|
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.cButtonSlots[0] =
|
||||||
|
ITEM_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gSaveContext.equips.buttonItems[2] = ITEM_BOMB;
|
||||||
|
gSaveContext.equips.buttonItems[3] = gSaveContext.inventory.items[SLOT_OCARINA];
|
||||||
|
gSaveContext.equips.cButtonSlots[1] = SLOT_BOMB;
|
||||||
|
gSaveContext.equips.cButtonSlots[2] = SLOT_OCARINA;
|
||||||
|
gSaveContext.equips.equipment = (EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4)) |
|
||||||
|
(EQUIP_VALUE_SHIELD_HYLIAN << (EQUIP_TYPE_SHIELD * 4)) |
|
||||||
|
(EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4)) |
|
||||||
|
(EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4));
|
||||||
|
// Set the dpad to nothing
|
||||||
|
gSaveContext.equips.buttonItems[4] = ITEM_NONE;
|
||||||
|
gSaveContext.equips.buttonItems[5] = ITEM_NONE;
|
||||||
|
gSaveContext.equips.buttonItems[6] = ITEM_NONE;
|
||||||
|
gSaveContext.equips.buttonItems[7] = ITEM_NONE;
|
||||||
|
gSaveContext.equips.cButtonSlots[3] = SLOT_NONE;
|
||||||
|
gSaveContext.equips.cButtonSlots[4] = SLOT_NONE;
|
||||||
|
gSaveContext.equips.cButtonSlots[5] = SLOT_NONE;
|
||||||
|
gSaveContext.equips.cButtonSlots[6] = SLOT_NONE;
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
|
gSaveContext.equips.buttonItems[i] =
|
||||||
|
gSaveContext.adultEquips.buttonItems[i];
|
||||||
|
|
||||||
|
if (i != 0) {
|
||||||
|
gSaveContext.equips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.adultEquips.cButtonSlots[i - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
|
||||||
|
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) ||
|
||||||
|
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
||||||
|
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
||||||
|
osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.cButtonSlots[i - 1]);
|
||||||
|
gSaveContext.equips.buttonItems[i] =
|
||||||
|
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
|
gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
|
||||||
|
|
||||||
|
if (i != 0) {
|
||||||
|
gSaveContext.adultEquips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.equips.cButtonSlots[i - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment;
|
||||||
|
|
||||||
|
if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE) {
|
||||||
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
|
||||||
|
gSaveContext.equips.buttonItems[i] =
|
||||||
|
gSaveContext.childEquips.buttonItems[i];
|
||||||
|
|
||||||
|
if (i != 0) {
|
||||||
|
gSaveContext.equips.cButtonSlots[i - 1] =
|
||||||
|
gSaveContext.childEquips.cButtonSlots[i - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) &&
|
||||||
|
(gSaveContext.equips.buttonItems[i] <= ITEM_POE)) ||
|
||||||
|
((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
|
||||||
|
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) {
|
||||||
|
osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.cButtonSlots[i - 1]);
|
||||||
|
gSaveContext.equips.buttonItems[i] =
|
||||||
|
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[i - 1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gSaveContext.equips.equipment = gSaveContext.childEquips.equipment;
|
||||||
|
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
||||||
|
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shieldEquipValue = gEquipMasks[EQUIP_TYPE_SHIELD] & gSaveContext.equips.equipment;
|
||||||
|
if (shieldEquipValue) {
|
||||||
shieldEquipValue >>= gEquipShifts[EQUIP_TYPE_SHIELD];
|
shieldEquipValue >>= gEquipShifts[EQUIP_TYPE_SHIELD];
|
||||||
if (!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, shieldEquipValue - 1)) {
|
if (!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, shieldEquipValue - 1)) {
|
||||||
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SHIELD];
|
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SHIELD];
|
||||||
|
Loading…
Reference in New Issue
Block a user