[Modding] Refactor CustomEquipment (#6708)

This commit is contained in:
Reppan
2026-06-15 16:23:48 +02:00
committed by GitHub
parent 6bf5ec5145
commit 0e5083931f
7 changed files with 584 additions and 488 deletions
@@ -34,6 +34,12 @@ static const ALIGN_ASSET(2) char gCustomHookshotTipDL[] = dgCustomHookshotTipDL;
#define dgCustomHookshotChainDL "__OTR__objects/object_custom_equip/gCustomHookshotChainDL"
static const ALIGN_ASSET(2) char gCustomHookshotChainDL[] = dgCustomHookshotChainDL;
#define dgCustomLongshotTipDL "__OTR__objects/object_custom_equip/gCustomLongshotTipDL"
static const ALIGN_ASSET(2) char gCustomLongshotTipDL[] = dgCustomLongshotTipDL;
#define dgCustomLongshotChainDL "__OTR__objects/object_custom_equip/gCustomLongshotChainDL"
static const ALIGN_ASSET(2) char gCustomLongshotChainDL[] = dgCustomLongshotChainDL;
#define dgCustomSlingshotDL "__OTR__objects/object_custom_equip/gCustomSlingshotDL"
static const ALIGN_ASSET(2) char gCustomSlingshotDL[] = dgCustomSlingshotDL;
File diff suppressed because it is too large Load Diff
@@ -612,6 +612,12 @@ typedef enum {
// - `*int16_t` (item id)
VB_DRAW_AMMO_COUNT,
// #### `args`
// - `Player*` player
// - `PlayState*` play
VB_DRAW_HOOKSHOT_CHAIN,
VB_DRAW_HOOKSHOT_TIP,
// #### `result`
// ```c
// true
@@ -1997,6 +2003,21 @@ typedef enum {
// - `*int32_t` (arrowType)
VB_PLAYER_ARROW_MAGIC_CONSUMPTION,
// #### `args`
// - `s32` limbIndex
// - `Gfx**` dList (write to *dList to replace the resolved display list)
// - `void*` player (Player*)
// - `PlayState*` play
VB_PLAYER_OVERRIDE_LIMB_DRAW,
// Fired from Player_OverrideLimbDrawPause (pause/equipment screen character only).
// #### `args`
// - `s32` limbIndex
// - `Gfx**` dList (write to *dList to replace the resolved display list)
// - `void*` player (Player*)
// - `PlayState*` play
VB_PLAYER_OVERRIDE_LIMB_DRAW_PAUSE,
// #### `result`
// ```c
// item == ITEM_SAW
+1
View File
@@ -129,6 +129,7 @@ void DummyPlayer_Update(Actor* actor, PlayState* play) {
Math_Vec3s_Copy(&player->skelAnime.prevTransl, &client.prevTransl);
player->currentBoots = client.currentBoots;
player->currentShield = client.currentShield;
player->heldItemId = client.buttonItem0;
player->currentTunic = client.currentTunic;
player->stateFlags1 = client.stateFlags1;
player->stateFlags2 = client.stateFlags2;
+2
View File
@@ -313,6 +313,8 @@ extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path) {
ResourceMgr_UnloadOriginalWhenAltExists(path);
auto res = std::static_pointer_cast<Fast::DisplayList>(ResourceMgr_GetResourceByNameHandlingMQ(path));
if (!res)
return nullptr;
return (Gfx*)&res->Instructions[0];
}
+7
View File
@@ -1437,6 +1437,8 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx**
}
}
GameInteractor_Should(VB_PLAYER_OVERRIDE_LIMB_DRAW, true, limbIndex, dList, thisx, play);
if (GameInteractor_InvisibleLinkActive()) {
this->actor.shape.shadowDraw = NULL;
*dList = NULL;
@@ -1482,6 +1484,9 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, G
*dList = NULL;
}
}
GameInteractor_Should(VB_PLAYER_OVERRIDE_LIMB_DRAW, true, limbIndex, dList, thisx, play);
return false;
}
@@ -2061,6 +2066,8 @@ s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Ve
dLists = &sPlayerDListGroups[type][gSaveContext.linkAge];
*dList = dLists[dListOffset];
GameInteractor_Should(VB_PLAYER_OVERRIDE_LIMB_DRAW_PAUSE, true, limbIndex, dList, GET_PLAYER(play), play);
return 0;
}
@@ -1,5 +1,7 @@
#include "z_arms_hook.h"
#include "objects/object_link_boy/object_link_boy.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED)
@@ -331,7 +333,9 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
Matrix_Scale(0.8, 0.8, 0.8, MTXMODE_APPLY);
}
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL);
if (GameInteractor_Should(VB_DRAW_HOOKSHOT_TIP, true, player, play)) {
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL);
}
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Math_Vec3f_Diff(&player->unk_3C8, &this->actor.world.pos, &sp78);
sp58 = SQ(sp78.x) + SQ(sp78.z);
@@ -345,7 +349,9 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) {
Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY);
}
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotChainDL);
if (GameInteractor_Should(VB_DRAW_HOOKSHOT_CHAIN, true, player, play)) {
gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotChainDL);
}
CLOSE_DISPS(play->state.gfxCtx);
}