New drop runtime fix (#614)

* inital rework

* fixed default rotation for 2D sprites

* fix tab/space issues
This commit is contained in:
Baoulettes 2022-07-08 04:19:08 +02:00 committed by GitHub
parent 0f34b991aa
commit 60e713855a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -358,76 +358,16 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (this->actor.params) { switch (this->actor.params) {
case ITEM00_RUPEE_GREEN: case ITEM00_RUPEE_GREEN:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_RUPEE_BLUE: case ITEM00_RUPEE_BLUE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
}
case ITEM00_RUPEE_RED: case ITEM00_RUPEE_RED:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.015f);
this->scale = 0.015f;
yOffset = 750.0f;
}
break; break;
case ITEM00_SMALL_KEY: case ITEM00_SMALL_KEY:
this->unk_158 = 0; this->unk_158 = 0;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 350.0f;
}
break; break;
case ITEM00_HEART_PIECE: case ITEM00_HEART_PIECE:
this->unk_158 = 0; this->unk_158 = 0;
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
yOffset = 650.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
}
break; break;
case ITEM00_HEART: case ITEM00_HEART:
if (CVar_GetS32("gNewDrops", 0) !=0) {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
yOffset = 25.0f;
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
shadowScale = 0.5f;
} else {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
yOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
}
break; break;
case ITEM00_HEART_CONTAINER: case ITEM00_HEART_CONTAINER:
yOffset = 430.0f; yOffset = 430.0f;
@ -436,155 +376,19 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
this->scale = 0.02f; this->scale = 0.02f;
break; break;
case ITEM00_ARROWS_SINGLE: case ITEM00_ARROWS_SINGLE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
yOffset = 400.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
}
break;
case ITEM00_ARROWS_SMALL: case ITEM00_ARROWS_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_ARROWS_MEDIUM: case ITEM00_ARROWS_MEDIUM:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_ARROWS_LARGE: case ITEM00_ARROWS_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.035f);
this->scale = 0.035f;
yOffset = 250.0f;
}
break;
case ITEM00_BOMBS_A: case ITEM00_BOMBS_A:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_BOMBS_B: case ITEM00_BOMBS_B:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_NUTS: case ITEM00_NUTS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_STICK: case ITEM00_STICK:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_MAGIC_SMALL: case ITEM00_MAGIC_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_SEEDS: case ITEM00_SEEDS:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
break;
}
case ITEM00_BOMBS_SPECIAL: case ITEM00_BOMBS_SPECIAL:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 320.0f;
}
break;
case ITEM00_MAGIC_LARGE: case ITEM00_MAGIC_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.2f);
this->scale = 0.2f;
yOffset = 50.0f;
shadowScale = 0.5f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 320.0f;
}
break;
case ITEM00_RUPEE_ORANGE: case ITEM00_RUPEE_ORANGE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.45f);
this->scale = 0.45f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.045 - 1e-10);
this->scale = 0.045 - 1e-10;
yOffset = 750.0f;
}
break;
case ITEM00_RUPEE_PURPLE: case ITEM00_RUPEE_PURPLE:
if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.4f);
this->scale = 0.4f;
yOffset = 50.0f;
shadowScale = 0.3f;
this->actor.world.rot.x = 0x4000;
} else {
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
yOffset = 750.0f;
}
break;
case ITEM00_FLEXIBLE: case ITEM00_FLEXIBLE:
yOffset = 500.0f; yOffset = 500.0f;
Actor_SetScale(&this->actor, 0.01f); Actor_SetScale(&this->actor, 0.01f);
@ -911,7 +715,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
if (CVar_GetS32("gNewDrops", 0) !=0) { //Update 3D Model rotation on frame update :) if (CVar_GetS32("gNewDrops", 0) !=0) { //Update 3D Model rotation on frame update :)
DroppedItemRot += 250; DroppedItemRot += 120;
} }
if (this->unk_15A > 0) { if (this->unk_15A > 0) {
@ -1125,35 +929,85 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
switch (this->actor.params) { switch (this->actor.params) {
case ITEM00_RUPEE_GREEN: case ITEM00_RUPEE_GREEN:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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;
GetItem_Draw(globalCtx, GID_RUPEE_GREEN); GetItem_Draw(globalCtx, GID_RUPEE_GREEN);
break; break;
} }
case ITEM00_RUPEE_BLUE: case ITEM00_RUPEE_BLUE:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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;
GetItem_Draw(globalCtx, GID_RUPEE_BLUE); GetItem_Draw(globalCtx, GID_RUPEE_BLUE);
break; break;
} }
case ITEM00_RUPEE_RED: case ITEM00_RUPEE_RED:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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;
GetItem_Draw(globalCtx, GID_RUPEE_RED); GetItem_Draw(globalCtx, GID_RUPEE_RED);
break; 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, globalCtx);
break;
} }
case ITEM00_RUPEE_ORANGE: case ITEM00_RUPEE_ORANGE:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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;
GetItem_Draw(globalCtx, GID_RUPEE_GOLD); GetItem_Draw(globalCtx, GID_RUPEE_GOLD);
break; 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, globalCtx);
break;
} }
case ITEM00_RUPEE_PURPLE: case ITEM00_RUPEE_PURPLE:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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;
GetItem_Draw(globalCtx, GID_RUPEE_PURPLE); GetItem_Draw(globalCtx, GID_RUPEE_PURPLE);
} else { } else {
Actor_SetScale(&this->actor, 0.03f);
this->actor.shape.shadowScale = 6.0f;
this->scale = 0.03f;
this->actor.shape.yOffset = 750.0f;
EnItem00_DrawRupee(this, globalCtx); EnItem00_DrawRupee(this, globalCtx);
}
break; break;
}
case ITEM00_HEART_PIECE: case ITEM00_HEART_PIECE:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=0) {
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
this->actor.shape.yOffset = 50.0f;
this->actor.world.rot.x = 0x4000;
GetItem_Draw(globalCtx, GID_HEART_PIECE); GetItem_Draw(globalCtx, GID_HEART_PIECE);
} else { } else {
this->actor.shape.yOffset = 650.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
EnItem00_DrawHeartPiece(this, globalCtx); EnItem00_DrawHeartPiece(this, globalCtx);
} }
break; break;
@ -1162,11 +1016,19 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
break; break;
case ITEM00_HEART: case ITEM00_HEART:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=0) {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
this->actor.shape.yOffset = 25.0f;
Actor_SetScale(&this->actor, 0.3f);
this->scale = 0.3f;
GetItem_Draw(globalCtx, GID_HEART); GetItem_Draw(globalCtx, GID_HEART);
mtxScale = 16.0f; mtxScale = 16.0f;
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
break; break;
} else { } else {
this->actor.home.rot.z = Rand_CenteredFloat(65535.0f);
this->actor.shape.yOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->scale = 0.02f;
if (this->unk_15A < 0) { if (this->unk_15A < 0) {
if (this->unk_15A == -1) { if (this->unk_15A == -1) {
s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART);
@ -1186,64 +1048,130 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
} }
case ITEM00_BOMBS_A: case ITEM00_BOMBS_A:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_BOMB); GetItem_Draw(globalCtx, GID_BOMB);
break; break;
} }
case ITEM00_BOMBS_B: case ITEM00_BOMBS_B:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_BOMB); GetItem_Draw(globalCtx, GID_BOMB);
break; break;
} }
case ITEM00_BOMBS_SPECIAL: case ITEM00_BOMBS_SPECIAL:
case ITEM00_ARROWS_SINGLE: case ITEM00_ARROWS_SINGLE:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_ARROWS_SMALL); GetItem_Draw(globalCtx, GID_ARROWS_SMALL);
break; break;
} }
case ITEM00_ARROWS_SMALL: case ITEM00_ARROWS_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_ARROWS_SMALL); GetItem_Draw(globalCtx, GID_ARROWS_SMALL);
break; break;
} }
case ITEM00_ARROWS_MEDIUM: case ITEM00_ARROWS_MEDIUM:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_ARROWS_MEDIUM); GetItem_Draw(globalCtx, GID_ARROWS_MEDIUM);
break; break;
} }
case ITEM00_ARROWS_LARGE: case ITEM00_ARROWS_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_ARROWS_LARGE); GetItem_Draw(globalCtx, GID_ARROWS_LARGE);
break; break;
} }
case ITEM00_NUTS: case ITEM00_NUTS:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_NUTS); GetItem_Draw(globalCtx, GID_NUTS);
break; break;
} }
case ITEM00_STICK: case ITEM00_STICK:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_STICK); GetItem_Draw(globalCtx, GID_STICK);
break; break;
} }
case ITEM00_MAGIC_LARGE: case ITEM00_MAGIC_LARGE:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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(globalCtx, GID_MAGIC_LARGE); GetItem_Draw(globalCtx, GID_MAGIC_LARGE);
break; break;
} }
case ITEM00_MAGIC_SMALL: case ITEM00_MAGIC_SMALL:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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;
GetItem_Draw(globalCtx, GID_MAGIC_SMALL); GetItem_Draw(globalCtx, GID_MAGIC_SMALL);
break; break;
} }
case ITEM00_SEEDS: case ITEM00_SEEDS:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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;
GetItem_Draw(globalCtx, GID_SEEDS); GetItem_Draw(globalCtx, GID_SEEDS);
break; break;
} }
case ITEM00_SMALL_KEY: case ITEM00_SMALL_KEY:
if (CVar_GetS32("gNewDrops", 0) !=0) { if (CVar_GetS32("gNewDrops", 0) !=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.5f;
GetItem_Draw(globalCtx, GID_KEY_SMALL); GetItem_Draw(globalCtx, GID_KEY_SMALL);
} else { } else {
Actor_SetScale(&this->actor, 0.03f);
this->scale = 0.03f;
this->actor.shape.yOffset = 320.0f;
this->actor.shape.shadowScale = 6.0f;
this->actor.world.rot.x = 0;
this->actor.shape.rot.y = 0;
EnItem00_DrawCollectible(this, globalCtx); EnItem00_DrawCollectible(this, globalCtx);
} }
break; break;