cleanup customequipment.cpp (#6396)
This commit is contained in:
@@ -1,18 +1,20 @@
|
|||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include "src/overlays/actors/ovl_En_Elf/z_en_elf.h"
|
|
||||||
#include "objects/object_link_boy/object_link_boy.h"
|
#include "objects/object_link_boy/object_link_boy.h"
|
||||||
#include "objects/object_link_child/object_link_child.h"
|
#include "objects/object_link_child/object_link_child.h"
|
||||||
#include "objects/object_custom_equip/object_custom_equip.h"
|
#include "objects/object_custom_equip/object_custom_equip.h"
|
||||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||||
#include "soh/ShipInit.hpp"
|
#include "soh/ShipInit.hpp"
|
||||||
#include "soh/ResourceManagerHelpers.h"
|
#include "soh/ResourceManagerHelpers.h"
|
||||||
#include "soh_assets.h"
|
|
||||||
#include "kaleido.h"
|
|
||||||
#include "soh/cvar_prefixes.h"
|
#include "soh/cvar_prefixes.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "variables.h"
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
extern SaveContext gSaveContext;
|
extern SaveContext gSaveContext;
|
||||||
extern PlayState* gPlayState;
|
extern PlayState* gPlayState;
|
||||||
extern void Overlay_DisplayText(float duration, const char* text);
|
}
|
||||||
|
|
||||||
void DummyPlayer_Update(Actor* actor, PlayState* play);
|
void DummyPlayer_Update(Actor* actor, PlayState* play);
|
||||||
|
|
||||||
static void UpdatePatchCustomEquipmentDlists();
|
static void UpdatePatchCustomEquipmentDlists();
|
||||||
@@ -66,33 +68,17 @@ static void UpdateCustomEquipmentSetModel(Player* player, u8 ModelGroup) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateCustomEquipment() {
|
static void UpdateCustomEquipment() {
|
||||||
if (!GameInteractor::IsSaveLoaded() || gPlayState == nullptr) {
|
if (!GameInteractor::IsSaveLoaded() || gPlayState == nullptr || GET_PLAYER(gPlayState) == nullptr ||
|
||||||
return;
|
IsDummyPlayer(GET_PLAYER(gPlayState))) {
|
||||||
}
|
|
||||||
|
|
||||||
Player* player = GET_PLAYER(gPlayState);
|
|
||||||
if (player == nullptr || IsDummyPlayer(player)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshCustomEquipment();
|
RefreshCustomEquipment();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PatchCustomEquipment() {
|
|
||||||
COND_HOOK(OnPlayerSetModels, true, UpdateCustomEquipmentSetModel);
|
|
||||||
COND_HOOK(OnLinkEquipmentChange, true, UpdateCustomEquipment);
|
|
||||||
COND_HOOK(OnLinkSkeletonInit, true, UpdateCustomEquipment);
|
|
||||||
COND_HOOK(OnAssetAltChange, true, UpdateCustomEquipment);
|
|
||||||
}
|
|
||||||
|
|
||||||
static RegisterShipInitFunc initFunc(PatchCustomEquipment);
|
|
||||||
|
|
||||||
static void RefreshCustomEquipment() {
|
static void RefreshCustomEquipment() {
|
||||||
if (!GameInteractor::IsSaveLoaded() || gPlayState == NULL || GET_PLAYER(gPlayState) == nullptr) {
|
if (!GameInteractor::IsSaveLoaded() || gPlayState == nullptr || GET_PLAYER(gPlayState) == nullptr ||
|
||||||
return;
|
IsDummyPlayer(GET_PLAYER(gPlayState))) {
|
||||||
}
|
|
||||||
|
|
||||||
if (IsDummyPlayer(GET_PLAYER(gPlayState))) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,3 +497,12 @@ void UpdatePatchCustomEquipmentDlists() {
|
|||||||
|
|
||||||
ApplyCommonEquipmentPatches();
|
ApplyCommonEquipmentPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PatchCustomEquipment() {
|
||||||
|
COND_HOOK(OnPlayerSetModels, true, UpdateCustomEquipmentSetModel);
|
||||||
|
COND_HOOK(OnLinkEquipmentChange, true, UpdateCustomEquipment);
|
||||||
|
COND_HOOK(OnLinkSkeletonInit, true, UpdateCustomEquipment);
|
||||||
|
COND_HOOK(OnAssetAltChange, true, UpdateCustomEquipment);
|
||||||
|
}
|
||||||
|
|
||||||
|
static RegisterShipInitFunc initFunc(PatchCustomEquipment);
|
||||||
|
|||||||
Reference in New Issue
Block a user