New drops shadows & rotation fixes (#627)

* fixes

* forgot to add heart pieces in rotation logic
This commit is contained in:
Baoulettes 2022-07-10 02:38:59 +02:00 committed by GitHub
parent 24856a6e8c
commit d1a2f98524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,6 @@
#define FLAGS 0
//Used to force variable to be used in different function, feel free to correct me if you have a better way
static s16 DroppedItemRot = 0;
void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx);
@ -525,40 +522,30 @@ void EnItem00_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
if (CVar_GetS32("gNewDrops", 0) !=0) { //set the rotation system on selected model only :)
if ((this->actor.params == ITEM_RUPEE_GOLD) || (this->actor.params == ITEM_RUPEE_PURPLE) ||
(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_STICK) ||
(this->actor.params == ITEM00_MAGIC_SMALL) || (this->actor.params == ITEM00_SEEDS) || (this->actor.params == ITEM00_SMALL_KEY) ||
(this->actor.params == ITEM00_MAGIC_LARGE) || (this->actor.params == ITEM00_HEART) || (this->actor.params == ITEM00_BOMBS_SPECIAL)) {
this->actor.shape.rot.y = DroppedItemRot;
}
}
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;
} else {
if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) {
if (this->unk_15A == -1) {
if (Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500) ==
0) {
this->unk_15A = -2;
}
} else {
if (Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.world.rot.x - 0x4000, 2, 3000, 1500) ==
0) {
this->unk_15A = -1;
if (!CVar_GetS32("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;
} else {
if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) {
if (this->unk_15A == -1) {
if (Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500) ==
0) {
this->unk_15A = -2;
}
} else {
if (Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.world.rot.x - 0x4000, 2, 3000, 1500) ==
0) {
this->unk_15A = -1;
}
}
Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500);
}
Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500);
}
}
if (this->actor.params == ITEM00_HEART_PIECE) {
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
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;
@ -590,7 +577,7 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) {
f32 originalVelocity;
Vec3f effectPos;
if (this->actor.params <= ITEM00_RUPEE_RED) {
if (this->actor.params <= ITEM00_RUPEE_RED && !CVar_GetS32("gNewDrops", 0)) {
this->actor.shape.rot.y += 960;
}
@ -688,9 +675,9 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) {
this->actor.world.pos = player->actor.world.pos;
if (this->actor.params <= ITEM00_RUPEE_RED) {
if (this->actor.params <= ITEM00_RUPEE_RED && !CVar_GetS32("gNewDrops", 0)) {
this->actor.shape.rot.y += 960;
} else if (this->actor.params == ITEM00_HEART) {
} else if (this->actor.params == ITEM00_HEART && !CVar_GetS32("gNewDrops", 0)) {
this->actor.shape.rot.y = 0;
}
@ -714,8 +701,18 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = (EnItem00*)thisx;
s32 pad;
if (CVar_GetS32("gNewDrops", 0) !=0) { //Update 3D Model rotation on frame update :)
DroppedItemRot += 120;
if (CVar_GetS32("gNewDrops", 0)) { //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_SMALL_KEY) || (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.shape.rot.y += 960;
}
}
if (this->unk_15A > 0) {
@ -928,7 +925,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (!(this->unk_156 & this->unk_158)) {
switch (this->actor.params) {
case ITEM00_RUPEE_GREEN:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
this->actor.shape.yOffset = 50.0f;
@ -938,7 +935,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_RUPEE_BLUE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
this->actor.shape.yOffset = 50.0f;
@ -948,7 +945,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_RUPEE_RED:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
this->actor.shape.yOffset = 50.0f;
@ -965,7 +962,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_RUPEE_ORANGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.45f);
this->scale = 0.45f;
this->actor.shape.yOffset = 50.0f;
@ -982,7 +979,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_RUPEE_PURPLE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.4f);
this->scale = 0.4f;
this->actor.shape.yOffset = 50.0f;
@ -998,14 +995,16 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_HEART_PIECE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
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;
GetItem_Draw(globalCtx, 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, globalCtx);
@ -1015,9 +1014,10 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnItem00_DrawHeartContainer(this, globalCtx);
break;
case ITEM00_HEART:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("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(globalCtx, GID_HEART);
@ -1027,6 +1027,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
} else {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
this->actor.shape.yOffset = 430.0f;
this->actor.shape.shadowScale = 0.03f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
if (this->unk_15A < 0) {
@ -1047,7 +1048,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
}
case ITEM00_BOMBS_A:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1057,7 +1058,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_BOMBS_B:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1068,7 +1069,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
case ITEM00_BOMBS_SPECIAL:
case ITEM00_ARROWS_SINGLE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1078,7 +1079,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_ARROWS_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1088,7 +1089,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_ARROWS_MEDIUM:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1098,7 +1099,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_ARROWS_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1108,7 +1109,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_NUTS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1118,7 +1119,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_STICK:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1128,7 +1129,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_MAGIC_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1138,7 +1139,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_MAGIC_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1148,7 +1149,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_SEEDS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;
@ -1158,7 +1159,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break;
}
case ITEM00_SMALL_KEY:
if (CVar_GetS32("gNewDrops", 0) !=0) {
if (CVar_GetS32("gNewDrops", 0)) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
this->actor.shape.yOffset = 50.0f;