mirror of
https://github.com/zeldaret/botw
synced 2026-08-20 05:46:16 -04:00
CreatePlayerEquipActorMgr
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
#include <limits>
|
||||
#include <math/seadMathCalcCommon.h>
|
||||
#include <prim/seadScopedLock.h>
|
||||
#include "Game/Actor/actCreatePlayerEquipActorMgr.h"
|
||||
#include "Game/Actor/actPlayerCreateMgr.h"
|
||||
#include "Game/Actor/actPlayerCreateUtils.h"
|
||||
#include "Game/Actor/actWeapon.h"
|
||||
#include "Game/Cooking/cookManager.h"
|
||||
#include "Game/DLC/aocManager.h"
|
||||
@@ -1481,7 +1482,7 @@ void PauseMenuDataMgr::createPlayerEquipment() {
|
||||
break;
|
||||
}
|
||||
if (item->isInInventory() && item->isEquipped()) {
|
||||
u64 slot = (u64)act::getCreateEquipmentSlot(type);
|
||||
u64 slot = (u64)getCreateEquipmentSlot(type);
|
||||
if (slot < equipment_items.size()) {
|
||||
equipment_items[slot] = item;
|
||||
}
|
||||
@@ -1501,7 +1502,7 @@ void PauseMenuDataMgr::createPlayerEquipment() {
|
||||
for (u64 i = 0; i != equipment_items.size(); slot = s32(++i)) {
|
||||
if (equipment_items[i]) {
|
||||
if (!need_head_b || i != (u64)act::CreateEquipmentSlot::ArmorHead) {
|
||||
act::createEquipmentFromItem(equipment_items[i], Caller);
|
||||
createEquipmentFromItem(equipment_items[i], Caller);
|
||||
} else {
|
||||
create_mgr->requestCreateArmorHeadB(equipment_items[i]->getName(),
|
||||
equipment_items[i]->getValue(), Caller);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Game/UI/uiUtils.h"
|
||||
#include "Game/Actor/actPlayerCreateMgr.h"
|
||||
#include "Game/Actor/actWeapon.h"
|
||||
#include "Game/DLC/aocHardModeManager.h"
|
||||
#include "Game/Damage/dmgInfoManager.h"
|
||||
@@ -114,4 +115,70 @@ bool isMasterSwordActorName(const sead::SafeString& name) {
|
||||
return name == "Weapon_Sword_070";
|
||||
}
|
||||
|
||||
act::CreateEquipmentSlot getCreateEquipmentSlot(ui::PouchItemType type) {
|
||||
switch (type) {
|
||||
case ui::PouchItemType::Sword:
|
||||
return act::CreateEquipmentSlot::WeaponSword;
|
||||
case ui::PouchItemType::Bow:
|
||||
return act::CreateEquipmentSlot::WeaponBow;
|
||||
case ui::PouchItemType::Shield:
|
||||
return act::CreateEquipmentSlot::WeaponShield;
|
||||
case ui::PouchItemType::ArmorHead:
|
||||
return act::CreateEquipmentSlot::ArmorHead;
|
||||
case ui::PouchItemType::ArmorUpper:
|
||||
return act::CreateEquipmentSlot::ArmorUpper;
|
||||
case ui::PouchItemType::ArmorLower:
|
||||
return act::CreateEquipmentSlot::ArmorLower;
|
||||
default:
|
||||
return act::CreateEquipmentSlot::Length;
|
||||
}
|
||||
}
|
||||
|
||||
ui::EquipmentSlot getEquipmentSlot(act::CreateEquipmentSlot slot) {
|
||||
switch (slot) {
|
||||
case act::CreateEquipmentSlot::WeaponSword:
|
||||
return ui::EquipmentSlot::WeaponRight;
|
||||
case act::CreateEquipmentSlot::WeaponShield:
|
||||
return ui::EquipmentSlot::WeaponLeft;
|
||||
case act::CreateEquipmentSlot::WeaponBow:
|
||||
return ui::EquipmentSlot::WeaponBow;
|
||||
case act::CreateEquipmentSlot::ArmorHead:
|
||||
return ui::EquipmentSlot::ArmorHead;
|
||||
case act::CreateEquipmentSlot::ArmorUpper:
|
||||
return ui::EquipmentSlot::ArmorUpper;
|
||||
case act::CreateEquipmentSlot::ArmorLower:
|
||||
return ui::EquipmentSlot::ArmorLower;
|
||||
default:
|
||||
return ui::EquipmentSlot::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
bool createEquipmentFromItem(const ui::PouchItem* item, const sead::SafeString& caller) {
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* mgr = act::CreatePlayerEquipActorMgr::instance();
|
||||
if (!mgr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto type = item->getType();
|
||||
auto slot = getCreateEquipmentSlot(type);
|
||||
int slot_idx = (int)slot;
|
||||
|
||||
if (slot <= act::CreateEquipmentSlot::WeaponBow) {
|
||||
act::WeaponModifierInfo modifier(*item);
|
||||
mgr->requestCreateWeapon(slot_idx, item->getName(), item->getValue(), &modifier, caller);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (slot <= act::CreateEquipmentSlot::ArmorLower) {
|
||||
mgr->requestCreateArmor(slot_idx, item->getName(), item->getValue(), caller);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace uking::ui
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
#include <prim/seadSafeString.h>
|
||||
#include "Game/Actor/actWeapon.h"
|
||||
|
||||
namespace uking::act {
|
||||
enum class CreateEquipmentSlot : u8;
|
||||
}
|
||||
|
||||
namespace uking::ui {
|
||||
|
||||
enum class EquipmentSlot;
|
||||
enum class PouchItemType;
|
||||
class PouchItem;
|
||||
|
||||
struct WeaponStats {
|
||||
@@ -47,4 +53,8 @@ int getItemValue(const sead::SafeString& name);
|
||||
// Do not implement until the location is figured out
|
||||
void applyScreenFade(float progress);
|
||||
|
||||
act::CreateEquipmentSlot getCreateEquipmentSlot(ui::PouchItemType type);
|
||||
ui::EquipmentSlot getEquipmentSlot(act::CreateEquipmentSlot slot);
|
||||
bool createEquipmentFromItem(const ui::PouchItem* item, const sead::SafeString& caller);
|
||||
|
||||
} // namespace uking::ui
|
||||
|
||||
Reference in New Issue
Block a user