|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -8,36 +8,6 @@
|
|||||||
// On Mac, not using aligned resource names was causing crashes in release builds
|
// On Mac, not using aligned resource names was causing crashes in release builds
|
||||||
|
|
||||||
// objects
|
// objects
|
||||||
#define dgChristmasGreenTreasureChestFrontTex "__OTR__objects/object_box/gChristmasGreenTreasureChestFrontTex"
|
|
||||||
static const ALIGN_ASSET(2) char gChristmasGreenTreasureChestFrontTex[] = dgChristmasGreenTreasureChestFrontTex;
|
|
||||||
|
|
||||||
#define dgChristmasGreenTreasureChestSideAndTopTex "__OTR__objects/object_box/gChristmasGreenTreasureChestSideAndTopTex"
|
|
||||||
static const ALIGN_ASSET(2) char gChristmasGreenTreasureChestSideAndTopTex[] = dgChristmasGreenTreasureChestSideAndTopTex;
|
|
||||||
|
|
||||||
#define dgChristmasRedTreasureChestFrontTex "__OTR__objects/object_box/gChristmasRedTreasureChestFrontTex"
|
|
||||||
static const ALIGN_ASSET(2) char gChristmasRedTreasureChestFrontTex[] = dgChristmasRedTreasureChestFrontTex;
|
|
||||||
|
|
||||||
#define dgChristmasRedTreasureChestSideAndTopTex "__OTR__objects/object_box/gChristmasRedTreasureChestSideAndTopTex"
|
|
||||||
static const ALIGN_ASSET(2) char gChristmasRedTreasureChestSideAndTopTex[] = dgChristmasRedTreasureChestSideAndTopTex;
|
|
||||||
|
|
||||||
#define dgGoldTreasureChestFrontTex "__OTR__objects/object_box/gGoldTreasureChestFrontTex"
|
|
||||||
static const ALIGN_ASSET(2) char gGoldTreasureChestFrontTex[] = dgGoldTreasureChestFrontTex;
|
|
||||||
|
|
||||||
#define dgGoldTreasureChestSideAndTopTex "__OTR__objects/object_box/gGoldTreasureChestSideAndTopTex"
|
|
||||||
static const ALIGN_ASSET(2) char gGoldTreasureChestSideAndTopTex[] = dgGoldTreasureChestSideAndTopTex;
|
|
||||||
|
|
||||||
#define dgKeyTreasureChestFrontTex "__OTR__objects/object_box/gKeyTreasureChestFrontTex"
|
|
||||||
static const ALIGN_ASSET(2) char gKeyTreasureChestFrontTex[] = dgKeyTreasureChestFrontTex;
|
|
||||||
|
|
||||||
#define dgKeyTreasureChestSideAndTopTex "__OTR__objects/object_box/gKeyTreasureChestSideAndTopTex"
|
|
||||||
static const ALIGN_ASSET(2) char gKeyTreasureChestSideAndTopTex[] = dgKeyTreasureChestSideAndTopTex;
|
|
||||||
|
|
||||||
#define dgSkullTreasureChestFrontTex "__OTR__objects/object_box/gSkullTreasureChestFrontTex"
|
|
||||||
static const ALIGN_ASSET(2) char gSkullTreasureChestFrontTex[] = dgSkullTreasureChestFrontTex;
|
|
||||||
|
|
||||||
#define dgSkullTreasureChestSideAndTopTex "__OTR__objects/object_box/gSkullTreasureChestSideAndTopTex"
|
|
||||||
static const ALIGN_ASSET(2) char gSkullTreasureChestSideAndTopTex[] = dgSkullTreasureChestSideAndTopTex;
|
|
||||||
|
|
||||||
#define dgChestBodyHeartDL "__OTR__objects/object_box/gChestBodyHeartDL"
|
#define dgChestBodyHeartDL "__OTR__objects/object_box/gChestBodyHeartDL"
|
||||||
static const ALIGN_ASSET(2) char gChestBodyHeartDL[] = dgChestBodyHeartDL;
|
static const ALIGN_ASSET(2) char gChestBodyHeartDL[] = dgChestBodyHeartDL;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "z_en_box.h"
|
#include "z_en_box.h"
|
||||||
#include "objects/object_box/object_box.h"
|
#include "objects/object_box/object_box.h"
|
||||||
#include "soh_assets.h"
|
#include "soh_assets.h"
|
||||||
#include "soh/Enhancements/enhancementTypes.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "soh/OTRGlobals.h"
|
#include "soh/OTRGlobals.h"
|
||||||
#include "soh/ResourceManagerHelpers.h"
|
#include "soh/ResourceManagerHelpers.h"
|
||||||
@@ -54,7 +53,6 @@ void EnBox_AppearInit(EnBox*, PlayState*);
|
|||||||
void EnBox_AppearAnimation(EnBox*, PlayState*);
|
void EnBox_AppearAnimation(EnBox*, PlayState*);
|
||||||
void EnBox_WaitOpen(EnBox*, PlayState*);
|
void EnBox_WaitOpen(EnBox*, PlayState*);
|
||||||
void EnBox_Open(EnBox*, PlayState*);
|
void EnBox_Open(EnBox*, PlayState*);
|
||||||
void EnBox_CreateExtraChestTextures();
|
|
||||||
void EnBox_UpdateTexture(EnBox*, PlayState*);
|
void EnBox_UpdateTexture(EnBox*, PlayState*);
|
||||||
|
|
||||||
const ActorInit En_Box_InitVars = {
|
const ActorInit En_Box_InitVars = {
|
||||||
@@ -79,20 +77,6 @@ static InitChainEntry sInitChain[] = {
|
|||||||
|
|
||||||
static UNK_TYPE sUnused;
|
static UNK_TYPE sUnused;
|
||||||
|
|
||||||
Gfx gSkullTreasureChestChestSideAndLidDL[116] = { 0 };
|
|
||||||
Gfx gGoldTreasureChestChestSideAndLidDL[116] = { 0 };
|
|
||||||
Gfx gKeyTreasureChestChestSideAndLidDL[116] = { 0 };
|
|
||||||
Gfx gChristmasRedTreasureChestChestSideAndLidDL[116] = { 0 };
|
|
||||||
Gfx gChristmasGreenTreasureChestChestSideAndLidDL[116] = { 0 };
|
|
||||||
Gfx gSkullTreasureChestChestFrontDL[128] = { 0 };
|
|
||||||
Gfx gGoldTreasureChestChestFrontDL[128] = { 0 };
|
|
||||||
Gfx gKeyTreasureChestChestFrontDL[128] = { 0 };
|
|
||||||
Gfx gChristmasRedTreasureChestChestFrontDL[128] = { 0 };
|
|
||||||
Gfx gChristmasGreenTreasureChestChestFrontDL[128] = { 0 };
|
|
||||||
u8 hasCreatedRandoChestTextures = 0;
|
|
||||||
u8 hasCustomChestDLs = 0;
|
|
||||||
u8 hasChristmasChestTexturesAvailable = 0;
|
|
||||||
|
|
||||||
static Gfx* EnBox_LoadChestDL(const char* dlName, const char* fallbackName) {
|
static Gfx* EnBox_LoadChestDL(const char* dlName, const char* fallbackName) {
|
||||||
Gfx* dl = ResourceMgr_LoadGfxByName(dlName);
|
Gfx* dl = ResourceMgr_LoadGfxByName(dlName);
|
||||||
|
|
||||||
@@ -586,7 +570,6 @@ void EnBox_Update(Actor* thisx, PlayState* play) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EnBox_UpdateTexture(EnBox* this, PlayState* play) {
|
void EnBox_UpdateTexture(EnBox* this, PlayState* play) {
|
||||||
EnBox_CreateExtraChestTextures();
|
|
||||||
bool csmc = CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), 0);
|
bool csmc = CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), 0);
|
||||||
int requiresStoneAgony = CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeDependsStoneOfAgony"), 0);
|
int requiresStoneAgony = CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeDependsStoneOfAgony"), 0);
|
||||||
GetItemCategory getItemCategory;
|
GetItemCategory getItemCategory;
|
||||||
@@ -672,150 +655,6 @@ void EnBox_UpdateTexture(EnBox* this, PlayState* play) {
|
|||||||
this->boxLidDL = EnBox_LoadChestDL(gTreasureChestBossKeyChestSideAndTopDL, gTreasureChestChestSideAndLidDL);
|
this->boxLidDL = EnBox_LoadChestDL(gTreasureChestBossKeyChestSideAndTopDL, gTreasureChestChestSideAndLidDL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0) && hasChristmasChestTexturesAvailable &&
|
|
||||||
hasCreatedRandoChestTextures && !hasCustomChestDLs) {
|
|
||||||
if (this->dyna.actor.scale.x == 0.01f) {
|
|
||||||
this->boxBodyDL = gChristmasRedTreasureChestChestFrontDL;
|
|
||||||
this->boxLidDL = gChristmasRedTreasureChestChestSideAndLidDL;
|
|
||||||
} else {
|
|
||||||
this->boxBodyDL = gChristmasGreenTreasureChestChestFrontDL;
|
|
||||||
this->boxLidDL = gChristmasGreenTreasureChestChestSideAndLidDL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnBox_CreateExtraChestTextures() {
|
|
||||||
// Don't patch textures for custom chest models, as they do not import textures the exact same way as vanilla chests
|
|
||||||
// OTRTODO: Make it so model packs can provide a unique DL per chest type, instead of us copying the brown chest and
|
|
||||||
// attempting to patch
|
|
||||||
if (ResourceMgr_FileIsCustomByName(gTreasureChestChestFrontDL) ||
|
|
||||||
ResourceMgr_FileIsCustomByName(gTreasureChestChestSideAndLidDL)) {
|
|
||||||
hasCustomChestDLs = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
hasCustomChestDLs = 0;
|
|
||||||
|
|
||||||
if (hasCreatedRandoChestTextures)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Gfx gTreasureChestChestTextures[] = {
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gSkullTreasureChestFrontTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gSkullTreasureChestSideAndTopTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gGoldTreasureChestFrontTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gGoldTreasureChestSideAndTopTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gKeyTreasureChestFrontTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gKeyTreasureChestSideAndTopTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gChristmasRedTreasureChestFrontTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gChristmasRedTreasureChestSideAndTopTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gChristmasGreenTreasureChestFrontTex),
|
|
||||||
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gChristmasGreenTreasureChestSideAndTopTex),
|
|
||||||
};
|
|
||||||
|
|
||||||
Gfx gNoOp[] = { gsDPNoOp() };
|
|
||||||
|
|
||||||
Gfx* frontCmd = ResourceMgr_LoadGfxByName(gTreasureChestChestFrontDL);
|
|
||||||
int frontIndex = 0;
|
|
||||||
while (frontCmd->words.w0 >> 24 != G_ENDDL) {
|
|
||||||
gSkullTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gGoldTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gKeyTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gChristmasRedTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gChristmasGreenTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
|
|
||||||
// Set the second instruction of img OTR hash opcode to noop, since we will replace it with the
|
|
||||||
// OTR filepath opcode below
|
|
||||||
if (frontCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) {
|
|
||||||
frontIndex++;
|
|
||||||
++frontCmd;
|
|
||||||
|
|
||||||
gSkullTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
|
|
||||||
gGoldTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
|
|
||||||
gKeyTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
|
|
||||||
gChristmasRedTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
|
|
||||||
gChristmasGreenTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
frontIndex++;
|
|
||||||
++frontCmd;
|
|
||||||
}
|
|
||||||
gSkullTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gGoldTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gKeyTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gChristmasRedTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
gChristmasGreenTreasureChestChestFrontDL[frontIndex] = *frontCmd;
|
|
||||||
|
|
||||||
gSkullTreasureChestChestFrontDL[5] = gTreasureChestChestTextures[0];
|
|
||||||
gSkullTreasureChestChestFrontDL[23] = gTreasureChestChestTextures[1];
|
|
||||||
gSkullTreasureChestChestFrontDL[37] = gTreasureChestChestTextures[0];
|
|
||||||
gSkullTreasureChestChestFrontDL[50] = gTreasureChestChestTextures[1];
|
|
||||||
gGoldTreasureChestChestFrontDL[5] = gTreasureChestChestTextures[2];
|
|
||||||
gGoldTreasureChestChestFrontDL[23] = gTreasureChestChestTextures[3];
|
|
||||||
gGoldTreasureChestChestFrontDL[37] = gTreasureChestChestTextures[2];
|
|
||||||
gGoldTreasureChestChestFrontDL[50] = gTreasureChestChestTextures[3];
|
|
||||||
gKeyTreasureChestChestFrontDL[5] = gTreasureChestChestTextures[4];
|
|
||||||
gKeyTreasureChestChestFrontDL[23] = gTreasureChestChestTextures[5];
|
|
||||||
gKeyTreasureChestChestFrontDL[37] = gTreasureChestChestTextures[4];
|
|
||||||
gKeyTreasureChestChestFrontDL[50] = gTreasureChestChestTextures[5];
|
|
||||||
gChristmasRedTreasureChestChestFrontDL[5] = gTreasureChestChestTextures[6];
|
|
||||||
gChristmasRedTreasureChestChestFrontDL[23] = gTreasureChestChestTextures[7];
|
|
||||||
gChristmasRedTreasureChestChestFrontDL[37] = gTreasureChestChestTextures[6];
|
|
||||||
gChristmasRedTreasureChestChestFrontDL[50] = gTreasureChestChestTextures[7];
|
|
||||||
gChristmasGreenTreasureChestChestFrontDL[5] = gTreasureChestChestTextures[8];
|
|
||||||
gChristmasGreenTreasureChestChestFrontDL[23] = gTreasureChestChestTextures[9];
|
|
||||||
gChristmasGreenTreasureChestChestFrontDL[37] = gTreasureChestChestTextures[8];
|
|
||||||
gChristmasGreenTreasureChestChestFrontDL[50] = gTreasureChestChestTextures[9];
|
|
||||||
|
|
||||||
Gfx* sideCmd = ResourceMgr_LoadGfxByName(gTreasureChestChestSideAndLidDL);
|
|
||||||
int sideIndex = 0;
|
|
||||||
while (sideCmd->words.w0 >> 24 != G_ENDDL) {
|
|
||||||
gSkullTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gGoldTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gKeyTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
|
|
||||||
// Set the second instruction of img OTR hash opcode to noop, since we will replace it with the
|
|
||||||
// OTR filepath opcode below
|
|
||||||
if (sideCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) {
|
|
||||||
sideIndex++;
|
|
||||||
++sideCmd;
|
|
||||||
|
|
||||||
gSkullTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
|
|
||||||
gGoldTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
|
|
||||||
gKeyTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
|
|
||||||
gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
|
|
||||||
gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
sideIndex++;
|
|
||||||
++sideCmd;
|
|
||||||
}
|
|
||||||
gSkullTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gGoldTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gKeyTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
|
|
||||||
|
|
||||||
gSkullTreasureChestChestSideAndLidDL[5] = gTreasureChestChestTextures[0];
|
|
||||||
gSkullTreasureChestChestSideAndLidDL[29] = gTreasureChestChestTextures[1];
|
|
||||||
gSkullTreasureChestChestSideAndLidDL[45] = gTreasureChestChestTextures[0];
|
|
||||||
gGoldTreasureChestChestSideAndLidDL[5] = gTreasureChestChestTextures[2];
|
|
||||||
gGoldTreasureChestChestSideAndLidDL[29] = gTreasureChestChestTextures[3];
|
|
||||||
gGoldTreasureChestChestSideAndLidDL[45] = gTreasureChestChestTextures[2];
|
|
||||||
gKeyTreasureChestChestSideAndLidDL[5] = gTreasureChestChestTextures[4];
|
|
||||||
gKeyTreasureChestChestSideAndLidDL[29] = gTreasureChestChestTextures[5];
|
|
||||||
gKeyTreasureChestChestSideAndLidDL[45] = gTreasureChestChestTextures[4];
|
|
||||||
gChristmasRedTreasureChestChestSideAndLidDL[5] = gTreasureChestChestTextures[6];
|
|
||||||
gChristmasRedTreasureChestChestSideAndLidDL[29] = gTreasureChestChestTextures[7];
|
|
||||||
gChristmasRedTreasureChestChestSideAndLidDL[45] = gTreasureChestChestTextures[6];
|
|
||||||
gChristmasGreenTreasureChestChestSideAndLidDL[5] = gTreasureChestChestTextures[8];
|
|
||||||
gChristmasGreenTreasureChestChestSideAndLidDL[29] = gTreasureChestChestTextures[9];
|
|
||||||
gChristmasGreenTreasureChestChestSideAndLidDL[45] = gTreasureChestChestTextures[8];
|
|
||||||
|
|
||||||
ResourceMgr_ListFiles("objects/object_box/gChristmas*", &hasChristmasChestTexturesAvailable);
|
|
||||||
hasCreatedRandoChestTextures = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnBox_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) {
|
void EnBox_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) {
|
||||||
|
|||||||