Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions soh/assets/objects/object_custom_equip/object_custom_equip.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,43 @@ static const ALIGN_ASSET(2) char gCustomAdultFPSHandDL[] = dgCustomAdultFPSHandD
#define dgCustomChildFPSHandDL "__OTR__objects/object_custom_equip/gCustomChildFPSHandDL"
static const ALIGN_ASSET(2) char gCustomChildFPSHandDL[] = dgCustomChildFPSHandDL;

#define dgCustomBottleDL "__OTR__objects/object_custom_equip/gCustomBottleDL"
static const ALIGN_ASSET(2) char gCustomBottleDL[] = dgCustomBottleDL;

#define dgCustomBottleRedPotionDL "__OTR__objects/object_custom_equip/gCustomBottleRedPotionDL"
static const ALIGN_ASSET(2) char gCustomBottleRedPotionDL[] = dgCustomBottleRedPotionDL;

#define dgCustomBottleGreenPotionDL "__OTR__objects/object_custom_equip/gCustomBottleGreenPotionDL"
static const ALIGN_ASSET(2) char gCustomBottleGreenPotionDL[] = dgCustomBottleGreenPotionDL;

#define dgCustomBottleBluePotionDL "__OTR__objects/object_custom_equip/gCustomBottleBluePotionDL"
static const ALIGN_ASSET(2) char gCustomBottleBluePotionDL[] = dgCustomBottleBluePotionDL;

#define dgCustomBottleFairyDL "__OTR__objects/object_custom_equip/gCustomBottleFairyDL"
static const ALIGN_ASSET(2) char gCustomBottleFairyDL[] = dgCustomBottleFairyDL;

#define dgCustomBottleFishDL "__OTR__objects/object_custom_equip/gCustomBottleFishDL"
static const ALIGN_ASSET(2) char gCustomBottleFishDL[] = dgCustomBottleFishDL;

#define dgCustomBottleMilkDL "__OTR__objects/object_custom_equip/gCustomBottleMilkDL"
static const ALIGN_ASSET(2) char gCustomBottleMilkDL[] = dgCustomBottleMilkDL;

#define dgCustomBottleMilkHalfDL "__OTR__objects/object_custom_equip/gCustomBottleMilkHalfDL"
static const ALIGN_ASSET(2) char gCustomBottleMilkHalfDL[] = dgCustomBottleMilkHalfDL;

#define dgCustomBottleLetterDL "__OTR__objects/object_custom_equip/gCustomBottleLetterDL"
static const ALIGN_ASSET(2) char gCustomBottleLetterDL[] = dgCustomBottleLetterDL;

#define dgCustomBottleBlueFireDL "__OTR__objects/object_custom_equip/gCustomBottleBlueFireDL"
static const ALIGN_ASSET(2) char gCustomBottleBlueFireDL[] = dgCustomBottleBlueFireDL;

#define dgCustomBottleBugDL "__OTR__objects/object_custom_equip/gCustomBottleBugDL"
static const ALIGN_ASSET(2) char gCustomBottleBugDL[] = dgCustomBottleBugDL;

#define dgCustomBottleBigPoeDL "__OTR__objects/object_custom_equip/gCustomBottleBigPoeDL"
static const ALIGN_ASSET(2) char gCustomBottleBigPoeDL[] = dgCustomBottleBigPoeDL;

#define dgCustomBottlePoeDL "__OTR__objects/object_custom_equip/gCustomBottlePoeDL"
static const ALIGN_ASSET(2) char gCustomBottlePoeDL[] = dgCustomBottlePoeDL;

#endif // OBJECTS_OBJECT_CUSTOM_EQUIP_H
42 changes: 42 additions & 0 deletions soh/soh/Enhancements/customequipment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ static bool IsScalingAdultItemAsChild() {
CVarGetInteger(CVAR_ENHANCEMENT("ScaleAdultEquipmentAsChild"), 0) && !LINK_IS_ADULT;
}

const char* bottleContentDLs[] = {
nullptr, // 0: PLAYER_IA_BOTTLE (empty - no custom content needed)
gCustomBottleFishDL, // 1: PLAYER_IA_BOTTLE_FISH
gCustomBottleBlueFireDL, // 2: PLAYER_IA_BOTTLE_FIRE
gCustomBottleBugDL, // 3: PLAYER_IA_BOTTLE_BUG
gCustomBottlePoeDL, // 4: PLAYER_IA_BOTTLE_POE
gCustomBottleBigPoeDL, // 5: PLAYER_IA_BOTTLE_BIG_POE
gCustomBottleLetterDL, // 6: PLAYER_IA_BOTTLE_RUTOS_LETTER
gCustomBottleRedPotionDL, // 7: PLAYER_IA_BOTTLE_POTION_RED
gCustomBottleBluePotionDL, // 8: PLAYER_IA_BOTTLE_POTION_BLUE
gCustomBottleGreenPotionDL, // 9: PLAYER_IA_BOTTLE_POTION_GREEN
gCustomBottleMilkDL, // 10: PLAYER_IA_BOTTLE_MILK_FULL
gCustomBottleMilkHalfDL, // 11: PLAYER_IA_BOTTLE_MILK_HALF
gCustomBottleFairyDL, // 12: PLAYER_IA_BOTTLE_FAIRY
};

static void RegisterCustomEquipment() {
// World (gameplay) character
COND_VB_SHOULD(VB_PLAYER_OVERRIDE_LIMB_DRAW, CVarGetInteger(CVAR_SETTING("AltAssets"), 1), {
Expand Down Expand Up @@ -582,6 +598,32 @@ static void RegisterCustomEquipment() {
gSPDisplayList(play->state.gfxCtx->polyOpa.p++, resolvedChain);
}
});

COND_VB_SHOULD(VB_PLAYER_DRAW_BOTTLE, CVarGetInteger(CVAR_SETTING("AltAssets"), 1), {
Player* player = va_arg(args, Player*);
PlayState* play = va_arg(args, PlayState*);
const char* contentDL = nullptr;
if (player->itemAction >= PLAYER_IA_BOTTLE &&
player->itemAction < PLAYER_IA_BOTTLE + std::size(bottleContentDLs)) {
contentDL = bottleContentDLs[player->itemAction - PLAYER_IA_BOTTLE];
}
Gfx* resolvedContent = LoadCustomGfx(contentDL);
Gfx* resolvedBottle = LoadCustomGfx(gCustomBottleDL);
if (resolvedBottle) {
*should = false;
gSPDisplayList(play->state.gfxCtx->polyXlu.p++, resolvedBottle);
gSPDisplayList(play->state.gfxCtx->polyOpa.p++, resolvedContent);
}
});

COND_VB_SHOULD(VB_PLAYER_UPDATE_BOTTLE_HELD, CVarGetInteger(CVAR_SETTING("AltAssets"), 1), {
Player* player = va_arg(args, Player*);
const bool isFullMilk = player->itemAction == PLAYER_IA_BOTTLE_MILK_FULL;
if (isFullMilk) {
*should = false;
player->itemAction = PLAYER_IA_BOTTLE_MILK_HALF;
}
});
}

static RegisterShipInitFunc initFunc(RegisterCustomEquipment, { CVAR_SETTING("AltAssets") });
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,11 @@ typedef enum {
// - `*int32_t` (arrowType)
VB_PLAYER_ARROW_MAGIC_CONSUMPTION,

// #### `args`
// - `void*` player (Player*)
// - `PlayState*` play
VB_PLAYER_DRAW_BOTTLE,

// #### `args`
// - `s32` limbIndex
// - `Gfx**` dList (write to *dList to replace the resolved display list)
Expand All @@ -2018,6 +2023,11 @@ typedef enum {
// - `PlayState*` play
VB_PLAYER_OVERRIDE_LIMB_DRAW_PAUSE,

// #### `args`
// - `*Player`
// - `*PlayState`
VB_PLAYER_UPDATE_BOTTLE_HELD,

// #### `result`
// ```c
// item == ITEM_SAW
Expand Down
10 changes: 7 additions & 3 deletions soh/src/code/z_player_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,9 @@ void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 action
this->heldItemAction = actionParam;
}

this->itemAction = actionParam;
if (GameInteractor_Should(VB_PLAYER_UPDATE_BOTTLE_HELD, this->itemAction != PLAYER_IA_BOTTLE_MILK_FULL, this)) {
this->itemAction = actionParam;
}
}

void Player_ReleaseLockOn(Player* this) {
Expand Down Expand Up @@ -1833,8 +1835,10 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
OPEN_DISPS(play->state.gfxCtx);

gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[(gSaveContext.linkAge)]);
if (GameInteractor_Should(VB_PLAYER_DRAW_BOTTLE, true, this, play)) {
gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0);
gSPDisplayList(POLY_XLU_DISP++, sBottleDLists[(gSaveContext.linkAge)]);
}

CLOSE_DISPS(play->state.gfxCtx);
}
Expand Down
Loading