Tweak: Refactor 3D drops handling (#3071)

* tweak: refactor 3d drops handling

* cleanup

* add 2d bombchu drop support
This commit is contained in:
Adam Bird 2023-08-20 13:58:39 -04:00 committed by GitHub
parent d12592377c
commit ff4d1b9f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 244 additions and 315 deletions

View File

@ -2,6 +2,7 @@
#include "overlays/actors/ovl_En_Elf/z_en_elf.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
#include "textures/icon_item_static/icon_item_static.h"
#define FLAGS 0
@ -70,7 +71,6 @@ static void* sItemDropTex[] = {
gDropRecoveryHeartTex, gDropBombTex, gDropArrows1Tex, gDropArrows2Tex,
gDropArrows3Tex, gDropBombTex, gDropDekuNutTex, gDropDekuStickTex,
gDropMagicLargeTex, gDropMagicSmallTex, gDropDekuSeedsTex, gDropKeySmallTex,
// OTRTODO: use 2D bombchu texture
};
static u8 sItemDropIds[] = {
@ -372,14 +372,32 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
case ITEM00_RUPEE_GREEN:
case ITEM00_RUPEE_BLUE:
case ITEM00_RUPEE_RED:
Actor_SetScale(&this->actor, 0.015f);
this->scale = 0.015f;
yOffset = 750.0f;
break;
case ITEM00_SMALL_KEY:
this->unk_158 = 0;
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
// Offset keys in randomizer slightly higher for their GID replacement
if (!gSaveContext.n64ddFlag) {
yOffset = 350.0f;
} else {
yOffset = 430.0f;
}
break;
case ITEM00_HEART_PIECE:
this->unk_158 = 0;
yOffset = 650.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
break;
case ITEM00_HEART:
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
yOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
break;
case ITEM00_HEART_CONTAINER:
yOffset = 430.0f;
@ -388,9 +406,17 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->scale = 0.02f;
break;
case ITEM00_ARROWS_SINGLE:
yOffset = 400.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
break;
case ITEM00_ARROWS_SMALL:
case ITEM00_ARROWS_MEDIUM:
case ITEM00_ARROWS_LARGE:
Actor_SetScale(&this->actor, 0.035f);
this->scale = 0.035f;
yOffset = 250.0f;
break;
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
case ITEM00_NUTS:
@ -398,11 +424,26 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
case ITEM00_MAGIC_SMALL:
case ITEM00_SEEDS:
case ITEM00_BOMBS_SPECIAL:
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 320.0f;
break;
case ITEM00_MAGIC_LARGE:
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 320.0f;
break;
case ITEM00_RUPEE_ORANGE:
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 750.0f;
break;
case ITEM00_RUPEE_PURPLE:
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 750.0f;
break;
case ITEM00_FLEXIBLE:
case ITEM00_BOMBCHU:
yOffset = 500.0f;
Actor_SetScale(&this->actor, 0.01f);
this->scale = 0.01f;
@ -432,6 +473,11 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
shadowScale = 0.6f;
this->actor.world.rot.x = 0x4000;
break;
case ITEM00_BOMBCHU:
yOffset = 320.0f;
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
break;
}
this->unk_156 = 0;
@ -551,8 +597,6 @@ void EnItem00_Destroy(Actor* thisx, PlayState* play) {
}
void func_8001DFC8(EnItem00* this, PlayState* play) {
if (!CVarGetInteger("gNewDrops", 0)){
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk_15A < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE)) {
this->actor.shape.rot.y += 960;
@ -573,20 +617,10 @@ void func_8001DFC8(EnItem00* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500);
}
}
}
if (this->actor.params == ITEM00_HEART_PIECE) {
if (CVarGetInteger("gNewDrops", 0) && !gSaveContext.n64ddFlag) {
this->actor.shape.yOffset = Math_SinS(this->actor.shape.rot.y) * 20.0f + 50.0f;
} else {
this->actor.shape.yOffset = Math_SinS(this->actor.shape.rot.y) * 150.0f + 850.0f;
}
}
if (gSaveContext.n64ddFlag && this->actor.params == ITEM00_SMALL_KEY) {
this->actor.shape.yOffset = 600.0f;
this->actor.shape.rot.y += 960;
}
Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f);
@ -613,7 +647,7 @@ void func_8001E1C8(EnItem00* this, PlayState* play) {
f32 originalVelocity;
Vec3f effectPos;
if (this->actor.params <= ITEM00_RUPEE_RED && !CVarGetInteger("gNewDrops", 0)) {
if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y += 960;
}
@ -715,12 +749,13 @@ void func_8001E5C8(EnItem00* this, PlayState* play) {
this->actor.world.pos = player->actor.world.pos;
if (this->actor.params <= ITEM00_RUPEE_RED && !CVarGetInteger("gNewDrops", 0)) {
if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y += 960;
} else if (this->actor.params == ITEM00_HEART && !CVarGetInteger("gNewDrops", 0)) {
} else if (this->actor.params == ITEM00_HEART) {
this->actor.shape.rot.y = 0;
}
// bounces up and down above player's head
this->actor.world.pos.y += 40.0f + Math_SinS(this->unk_15A * 15000) * (this->unk_15A * 0.3f);
if (LINK_IS_ADULT) {
@ -741,21 +776,17 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
EnItem00* this = (EnItem00*)thisx;
s32 pad;
// OTRTODO: remove special case for bombchu when its 2D drop is implemented
if (CVarGetInteger("gNewDrops", 0) || this->actor.params == ITEM00_BOMBCHU) { //set the rotation system on selected model only :)
if ((this->actor.params == ITEM00_RUPEE_GREEN) || (this->actor.params == ITEM00_RUPEE_BLUE) ||
(this->actor.params == ITEM00_RUPEE_RED) || (this->actor.params == ITEM00_ARROWS_SINGLE) ||
(this->actor.params == ITEM00_ARROWS_SMALL) || (this->actor.params == ITEM00_ARROWS_MEDIUM) ||
(this->actor.params == ITEM00_ARROWS_LARGE) || (this->actor.params == ITEM00_BOMBS_A) ||
(this->actor.params == ITEM00_BOMBS_B) || (this->actor.params == ITEM00_NUTS) ||
(this->actor.params == ITEM00_MAGIC_SMALL) || (this->actor.params == ITEM00_SEEDS) ||
(this->actor.params == ITEM00_MAGIC_LARGE) || (this->actor.params == ITEM00_HEART) ||
(this->actor.params == ITEM00_BOMBS_SPECIAL) || this->actor.params == ITEM00_HEART_PIECE ||
(this->actor.params == ITEM00_BOMBCHU)) {
this->actor.shape.rot.y += 960;
}
if (this->actor.params == ITEM00_SMALL_KEY && !gSaveContext.n64ddFlag) {
// Rotate some drops when 3D drops are on, otherwise reset rotation back to 0 for billboard effect
if ((this->actor.params == ITEM00_HEART && this->unk_15A >= 0) ||
(this->actor.params >= ITEM00_ARROWS_SMALL && this->actor.params <= ITEM00_SMALL_KEY) ||
this->actor.params == ITEM00_BOMBS_A || this->actor.params == ITEM00_ARROWS_SINGLE ||
this->actor.params == ITEM00_BOMBS_SPECIAL || this->actor.params == ITEM00_BOMBCHU) {
if (CVarGetInteger("gNewDrops", 0) ||
// Keys in randomizer need to always rotate for their GID replacement
(gSaveContext.n64ddFlag && this->actor.params == ITEM00_SMALL_KEY)) {
this->actor.shape.rot.y += 960;
} else {
this->actor.shape.rot.y = 0;
}
}
@ -978,88 +1009,48 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
mtxScale = 25.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_RUPEE_GREEN);
break;
}
case ITEM00_RUPEE_BLUE:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
mtxScale = 25.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_RUPEE_BLUE);
break;
}
case ITEM00_RUPEE_RED:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
mtxScale = 25.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_RUPEE_RED);
break;
} else {
this->actor.shape.shadowScale = 6.0f;
Actor_SetScale(&this->actor, 0.015f);
this->scale = 0.015f;
this->actor.shape.yOffset = 750.0f;
EnItem00_DrawRupee(this, play);
break;
}
case ITEM00_RUPEE_ORANGE:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.45f);
this->scale = 0.45f;
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
mtxScale = 17.5f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_RUPEE_GOLD);
break;
} else {
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->actor.shape.shadowScale = 6.0f;
this->scale = 0.045 - 1e-10;
this->actor.shape.yOffset = 750.0f;
EnItem00_DrawRupee(this, play);
break;
}
case ITEM00_RUPEE_PURPLE:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.4f);
this->scale = 0.4f;
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
mtxScale = 17.5f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_RUPEE_PURPLE);
break;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->actor.shape.shadowScale = 6.0f;
this->scale = 0.03f;
this->actor.shape.yOffset = 750.0f;
// All rupees fallthrough here when 3d drops are off
EnItem00_DrawRupee(this, play);
break;
}
break;
case ITEM00_HEART_PIECE:
if (CVarGetInteger("gNewDrops", 0) && !gSaveContext.n64ddFlag) {
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 21.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_HEART_PIECE);
} else {
this->actor.shape.yOffset = 650.0f;
this->actor.shape.shadowScale = 0.03f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
EnItem00_DrawHeartPiece(this, play);
}
break;
@ -1067,17 +1058,14 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
EnItem00_DrawHeartContainer(this, play);
break;
case ITEM00_HEART:
if (CVarGetInteger("gNewDrops", 0)) {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
this->actor.shape.yOffset = 25.0f;
this->actor.shape.shadowScale = 0.3f;
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
GetItem_Draw(play, GID_HEART);
// Only change despawn-able recovery hearts
if (CVarGetInteger("gNewDrops", 0) && this->unk_15A >= 0) {
mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_HEART);
break;
} else {
// Overworld hearts that are always 3D
if (this->unk_15A < 0) {
if (this->unk_15A == -1) {
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
@ -1093,156 +1081,89 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
}
break;
}
//Big hearts workaround
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
this->actor.shape.yOffset = 430.0f;
this->actor.shape.shadowScale = 6.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
EnItem00_DrawCollectible(this, play);
break;
}
case ITEM00_BOMBS_A:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(play, GID_BOMB);
break;
}
case ITEM00_BOMBS_B:
case ITEM00_BOMBS_SPECIAL:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 8.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_BOMB);
break;
}
case ITEM00_BOMBS_SPECIAL:
case ITEM00_ARROWS_SINGLE:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(play, GID_ARROWS_SMALL);
break;
}
case ITEM00_ARROWS_SMALL:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 7.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_ARROWS_SMALL);
break;
}
case ITEM00_ARROWS_MEDIUM:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 7.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_ARROWS_MEDIUM);
break;
}
case ITEM00_ARROWS_LARGE:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 7.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_ARROWS_LARGE);
break;
}
case ITEM00_NUTS:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 9.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_NUTS);
break;
}
case ITEM00_STICK:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 7.5f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_STICK);
break;
}
case ITEM00_MAGIC_LARGE:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
mtxScale = 8.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_MAGIC_LARGE);
break;
}
case ITEM00_MAGIC_SMALL:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
mtxScale = 8.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_MAGIC_SMALL);
break;
}
case ITEM00_SEEDS:
if (CVarGetInteger("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.shape.shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
mtxScale = 7.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_SEEDS);
break;
}
case ITEM00_BOMBCHU:
if (CVarGetInteger("gNewDrops", 0)) {
mtxScale = 9.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_BOMBCHU);
break;
}
case ITEM00_SMALL_KEY:
if (CVarGetInteger("gNewDrops", 0) && !gSaveContext.n64ddFlag) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.5f;
mtxScale = 8.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, GID_KEY_SMALL);
break;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
this->actor.shape.yOffset = 320.0f;
this->actor.shape.shadowScale = 6.0f;
if (!gSaveContext.n64ddFlag) {
this->actor.world.rot.x = 0;
this->actor.shape.rot.y = 0;
}
// All collectibles fallthrough here when 3d drops are off
EnItem00_DrawCollectible(this, play);
break;
}
case ITEM00_BOMBCHU:
// OTRTODO: Stop forcing chu drops to be 3D when the texture is added
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
this->actor.shape.shadowScale = 0.3f;
GetItem_Draw(play, GID_BOMBCHU);
break;
case ITEM00_SHIELD_DEKU:
GetItem_Draw(play, GID_SHIELD_DEKU);
@ -1406,11 +1327,11 @@ void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
rupeeColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0);
break;
case 3:
case 4: // orange rupee texture corresponds to the purple rupee (authentic bug)
rupeeColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0);
break;
case 4:
case 3: // pink rupee texture corresponds to the gold rupee (authentic bug)
rupeeColor = CVarGetColor24("gCosmetics.Consumable_GoldRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_GoldRupee.Changed", 0);
break;
@ -1430,6 +1351,13 @@ void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
static const Vtx customDropVtx[] = {
VTX(-250, -250, 0, 0 << 5, 0 << 5, 255, 255, 255, 255),
VTX(250, -250, 0, 32 << 5, 0 << 5, 255, 255, 255, 255),
VTX(-250, 250, 0, 0 << 5, 32 << 5, 255, 255, 255, 255),
VTX(250, 250, 0, 32 << 5, 32 << 5, 255, 255, 255, 255),
};
/**
* Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...).
*/
@ -1444,10 +1372,38 @@ void EnItem00_DrawCollectible(EnItem00* this, PlayState* play) {
this->randoGiEntry.getItemFrom = ITEM_FROM_FREESTANDING;
}
f32 mtxScale = 16.0f;
f32 mtxScale = 10.67f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
EnItem00_CustomItemsParticles(&this->actor, play, this->randoGiEntry);
GetItemEntry_Draw(play, this->randoGiEntry);
} else if (this->actor.params == ITEM00_BOMBCHU) {
OPEN_DISPS(play->state.gfxCtx);
Matrix_ReplaceRotation(&play->billboardMtxF);
// Need to flip vertically as drop icons are normally upside down, but here
// we are using the inventory/C-Button for th bombchu icon
Matrix_Scale(1.0f, -1.0f, 1.0f, MTXMODE_APPLY);
POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
POLY_OPA_DISP = Gfx_SetupDL_66(POLY_OPA_DISP);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetTexturePersp(POLY_OPA_DISP++, G_TP_PERSP);
gDPSetTextureLOD(POLY_OPA_DISP++, G_TL_TILE);
gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_BILERP);
gDPSetTextureConvert(POLY_OPA_DISP++, G_TC_FILT);
gDPSetTextureLUT(POLY_OPA_DISP++, G_TT_NONE);
gDPLoadTextureBlock(POLY_OPA_DISP++, gBombchuIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
gSPVertex(POLY_OPA_DISP++, customDropVtx, 4, 0);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
CLOSE_DISPS(play->state.gfxCtx);
} else {
s32 texIndex = this->actor.params - 3;
@ -1457,9 +1413,6 @@ void EnItem00_DrawCollectible(EnItem00* this, PlayState* play) {
if (this->actor.params == ITEM00_BOMBS_SPECIAL) {
texIndex = 1;
// OTRTODO: 2D bombchu drops
//} else if (this->actor.params == ITEM00_BOMBCHU) {
// texIndex = 12;
} else if (this->actor.params >= ITEM00_ARROWS_SMALL) {
texIndex -= 3;
}

View File

@ -55,12 +55,7 @@ void EnExRuppy_Init(Actor* thisx, PlayState* play) {
switch (this->type) {
case 0:
if (CVarGetInteger("gNewDrops", 0) !=0) {
this->unk_160 = 0.3f;
} else {
this->unk_160 = 0.01f;
}
Actor_SetScale(&this->actor, this->unk_160);
this->actor.room = -1;
this->actor.gravity = 0.0f;
@ -105,13 +100,9 @@ void EnExRuppy_Init(Actor* thisx, PlayState* play) {
}
}
}
if (CVarGetInteger("gNewDrops", 0) !=0) {
this->actor.shape.shadowScale = 0.3f;
this->actor.shape.yOffset = 35.0f;
} else {
this->actor.shape.shadowScale = 7.0f;
this->actor.shape.yOffset = 700.0f;
}
this->unk_15A = this->actor.world.rot.z;
this->actor.world.rot.z = 0;
this->timer = 30;
@ -122,40 +113,23 @@ void EnExRuppy_Init(Actor* thisx, PlayState* play) {
case 1:
case 2: // Giant pink ruppe that explodes when you touch it
if (this->type == 1) {
this->colorIdx = 4;
if (CVarGetInteger("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 2.0f);
} else {
Actor_SetScale(&this->actor, 0.1f);
}
} else {
this->colorIdx = (s16)Rand_ZeroFloat(3.99f) + 1;
if (CVarGetInteger("gNewDrops", 0) !=0) {
Actor_SetScale(thisx, 0.4f);
this->colorIdx = 4;
} else {
Actor_SetScale(thisx, 0.02f);
}
this->colorIdx = (s16)Rand_ZeroFloat(3.99f) + 1;
}
this->actor.gravity = -3.0f;
// "Wow Coin"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ わーなーコイン ☆☆☆☆☆ \n" VT_RST);
if (CVarGetInteger("gNewDrops", 0) !=0) {
this->actor.shape.shadowScale = 0.3f;
this->actor.shape.yOffset = 35.0f;
} else {
this->actor.shape.shadowScale = 6.0f;
this->actor.shape.yOffset = 700.0f;
}
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->actionFunc = EnExRuppy_WaitToBlowUp;
break;
case 3: // Spawned by the guard in Hyrule courtyard
if (CVarGetInteger("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.4f);
} else {
Actor_SetScale(&this->actor, 0.02f);
}
this->colorIdx = 0;
switch ((s16)Rand_ZeroFloat(30.99f)) {
case 0:
@ -170,13 +144,8 @@ void EnExRuppy_Init(Actor* thisx, PlayState* play) {
this->actor.gravity = -3.0f;
// "Normal rupee"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ノーマルルピー ☆☆☆☆☆ \n" VT_RST);
if (CVarGetInteger("gNewDrops", 0) !=0) {
this->actor.shape.shadowScale = 0.3f;
this->actor.shape.yOffset = 35.0f;
} else {
this->actor.shape.yOffset = 700.0f;
this->actor.shape.shadowScale = 6.0f;
}
this->actor.shape.yOffset = 700.0f;
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->actionFunc = EnExRuppy_WaitAsCollectible;
break;
@ -184,16 +153,9 @@ void EnExRuppy_Init(Actor* thisx, PlayState* play) {
case 4: // Progress markers in the shooting gallery
this->actor.gravity = -3.0f;
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
if (CVarGetInteger("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->actor.shape.shadowScale = 0.3f;
this->actor.shape.yOffset = -1365.0f;
} else {
Actor_SetScale(&this->actor, 0.01f);
this->actor.shape.shadowScale = 6.0f;
this->actor.shape.yOffset = -700.0f;
}
this->actionFunc = EnExRuppy_GalleryTarget;
break;
}
@ -393,20 +355,12 @@ void EnExRuppy_WaitAsCollectible(EnExRuppy* this, PlayState* play) {
}
void EnExRuppy_GalleryTarget(EnExRuppy* this, PlayState* play) {
if (CVarGetInteger("gNewDrops", 0) !=0) {
if (this->galleryFlag) {
Math_ApproachF(&this->actor.shape.yOffset, 35.0f, 0.5f, 200.0f);
} else {
Math_ApproachF(&this->actor.shape.yOffset, -1365.0f, 0.5f, 200.0f);
}
} else {
if (this->galleryFlag) {
Math_ApproachF(&this->actor.shape.yOffset, 700.0f, 0.5f, 200.0f);
} else {
Math_ApproachF(&this->actor.shape.yOffset, -700.0f, 0.5f, 200.0f);
}
}
}
void EnExRuppy_Update(Actor* thisx, PlayState* play) {
EnExRuppy* this = (EnExRuppy*)thisx;
@ -424,8 +378,9 @@ void EnExRuppy_Draw(Actor* thisx, PlayState* play) {
static void* rupeeTextures[] = {
gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeePinkTex, gRupeeOrangeTex,
};
// The pink/orange rupee textures are authentically reversed, so the GID models should be gold/purple respectively
static void* rupeeTexturesNew[] = {
GID_RUPEE_GREEN, GID_RUPEE_BLUE, GID_RUPEE_RED, GID_RUPEE_PURPLE, GID_RUPEE_GOLD,
GID_RUPEE_GREEN, GID_RUPEE_BLUE, GID_RUPEE_RED, GID_RUPEE_GOLD, GID_RUPEE_PURPLE,
};
s32 pad;
EnExRuppy* this = (EnExRuppy*)thisx;
@ -433,20 +388,52 @@ void EnExRuppy_Draw(Actor* thisx, PlayState* play) {
if (!this->invisible) {
OPEN_DISPS(play->state.gfxCtx);
if (CVarGetInteger("gNewDrops", 0)) {
// purple/gold rupees need less scaling
f32 mtxScale = this->colorIdx >= 3 ? 17.5f : 25.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
GetItem_Draw(play, rupeeTexturesNew[this->colorIdx]);
} else {
Color_RGB8 rupeeColor;
u8 shouldColor = 0;
switch (this->colorIdx) {
case 0:
rupeeColor = CVarGetColor24("gCosmetics.Consumable_GreenRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_GreenRupee.Changed", 0);
break;
case 1:
rupeeColor = CVarGetColor24("gCosmetics.Consumable_BlueRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_BlueRupee.Changed", 0);
break;
case 2:
rupeeColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0);
break;
case 4: // orange rupee texture corresponds to the purple rupee (authentic bug)
rupeeColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0);
break;
case 3: // pink rupee texture corresponds to the gold rupee (authentic bug)
rupeeColor = CVarGetColor24("gCosmetics.Consumable_GoldRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_GoldRupee.Changed", 0);
break;
}
Gfx_SetupDL_25Opa(play->state.gfxCtx);
func_8002EBCC(thisx, play, 0);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVarGetInteger("gNewDrops", 0) !=0) {
if (this->type == 4 && this->colorIdx >= 3) {
//For some reason the red rupee target become purple.
//when using new drops it will show as Gold and that wrong it need to be red.
this->colorIdx = 2;
}
GetItem_Draw(play, rupeeTexturesNew[this->colorIdx]);
if (shouldColor) {
gDPSetGrayscaleColor(POLY_OPA_DISP++, rupeeColor.r, rupeeColor.g, rupeeColor.b, 255);
gSPGrayscale(POLY_OPA_DISP++, true);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(rupeeTextures[this->colorIdx]));
gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
gSPGrayscale(POLY_OPA_DISP++, false);
} else {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(rupeeTextures[this->colorIdx]));
gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
}
}
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -119,22 +119,11 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.draw = EnGSwitch_DrawRupee;
this->actor.shape.yOffset = 700.0f;
if (CVarGetInteger("gNewDrops", 0) !=0) {
this->actor.shape.yOffset = 35.0f;
} else {
this->actor.shape.yOffset = 700.0f;
}
if (Flags_GetSwitch(play, this->switchFlag)) {
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag);
Actor_Kill(&this->actor);
} else {
if (CVarGetInteger("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.6f);
} else {
Actor_SetScale(&this->actor, 0.03f);
}
this->actionFunc = EnGSwitch_SilverRupeeIdle;
}
break;
@ -165,14 +154,8 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) {
this->actionFunc = EnGSwitch_WaitForObject;
break;
case ENGSWITCH_TARGET_RUPEE:
if (CVarGetInteger("gNewDrops", 0) !=0) {
this->actor.shape.yOffset = 35.0f;
Actor_SetScale(&this->actor, 0.9f);
} else {
this->actor.shape.yOffset = 700.0f;
Actor_SetScale(&this->actor, 0.05f);
}
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.draw = EnGSwitch_DrawRupee;
@ -486,8 +469,9 @@ void EnGSwitch_DrawPot(Actor* thisx, PlayState* play) {
static void* sRupeeTextures[] = {
gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeePinkTex, gRupeeOrangeTex, gRupeeSilverTex,
};
// The pink/orange rupee textures are authentically reversed, so the GID models should be gold/purple respectively
static void* sRupeeTexturesNew[] = {
GID_RUPEE_GREEN, GID_RUPEE_BLUE, GID_RUPEE_RED, GID_RUPEE_PURPLE, GID_RUPEE_GOLD,
GID_RUPEE_GREEN, GID_RUPEE_BLUE, GID_RUPEE_RED, GID_RUPEE_GOLD, GID_RUPEE_PURPLE,
};
void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) {
s32 pad;
@ -495,11 +479,12 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) {
if (!this->broken) {
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
func_8002EBCC(&this->actor, play, 0);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVarGetInteger("gNewDrops", 0) !=0) {
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
if (CVarGetInteger("gNewDrops", 0)) {
// purple/gold/silver rupees need less scaling
f32 mtxScale = this->colorIdx >= 3 ? 17.5f : 25.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
if (this->type == ENGSWITCH_TARGET_RUPEE) {
GetItem_Draw(play, sRupeeTexturesNew[this->colorIdx]);
} else {
@ -533,11 +518,11 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) {
rupeeColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0);
break;
case 3:
case 4: // orange rupee texture corresponds to the purple rupee (authentic bug)
rupeeColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0);
break;
case 4:
case 3: // pink rupee texture corresponds to the gold rupee (authentic bug)
rupeeColor = CVarGetColor24("gCosmetics.Consumable_GoldRupee.Value", (Color_RGB8){ 255, 255, 255 });
shouldColor = CVarGetInteger("gCosmetics.Consumable_GoldRupee.Changed", 0);
break;
@ -547,6 +532,10 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) {
break;
}
Gfx_SetupDL_25Opa(play->state.gfxCtx);
func_8002EBCC(&this->actor, play, 0);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (shouldColor) {
gDPSetGrayscaleColor(POLY_OPA_DISP++, rupeeColor.r, rupeeColor.g, rupeeColor.b, 255);
gSPGrayscale(POLY_OPA_DISP++, true);