Merge pull request #413 from Baoulettes/3DProjectiles

[Mod]Enable 3D Projectiles for monsters
This commit is contained in:
Kenix3 2022-06-21 22:24:29 -04:00 committed by GitHub
commit 77fc202694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 90 additions and 12 deletions

View File

@ -966,6 +966,8 @@ namespace SohImGui {
}
EnhancementCheckbox("N64 Mode", "gN64Mode");
Tooltip("Sets aspect ratio to 4:3 and lowers resolution to 240p, the N64's native resolution");
EnhancementCheckbox("Enable 3D Dropped items/projectiles", "gNewDrops");
Tooltip("Change most 2D items & projectiles to their a 3D version");
EnhancementCheckbox("Disable Black Bar Letterboxes", "gDisableBlackBars");
Tooltip("Disables Black Bar Letterboxes during cutscenes and Z-targeting\nNote: there may be minor visual glitches that were covered up by the black bars\nPlease disable this setting before reporting a bug");
EnhancementCheckbox("Enable 3D Dropped items", "gNewDrops");

View File

@ -6,6 +6,7 @@
#include "z_en_nutsball.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "objects/object_gi_nuts/object_gi_nuts.h"
#include "objects/object_dekunuts/object_dekunuts.h"
#include "objects/object_hintnuts/object_hintnuts.h"
#include "objects/object_shopnuts/object_shopnuts.h"
@ -59,6 +60,10 @@ static s16 sObjectIDs[] = {
OBJECT_DEKUNUTS, OBJECT_HINTNUTS, OBJECT_SHOPNUTS, OBJECT_DNS, OBJECT_DNK,
};
static Gfx* sDListsNew[] = {
gGiNutDL, gGiNutDL, gGiNutDL, gGiNutDL, gGiNutDL,
};
static Gfx* sDLists[] = {
gDekuNutsDekuNutDL, gHintNutsNutDL, gBusinessScrubDekuNutDL, gDntJijiNutDL, gDntStageNutDL,
};
@ -167,12 +172,26 @@ void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 327);
func_80093D18(globalCtx->state.gfxCtx);
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 333),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params]);
if (CVar_GetS32("gNewDrops", 0) != 0) {
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32));
Matrix_Scale(25.0f,25.0f,25.0f,MTXMODE_APPLY);
Matrix_RotateX(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 901),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDListsNew[thisx->params]);
} else {
func_80093D18(globalCtx->state.gfxCtx);
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(thisx->home.rot.z * 9.58738e-05f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 333),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, sDLists[thisx->params]);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 337);
}

View File

@ -1,5 +1,6 @@
#include "z_en_okuta.h"
#include "objects/object_okuta/object_okuta.h"
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2)
@ -499,7 +500,50 @@ void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) {
pos.x = this->actor.world.pos.x;
pos.y = this->actor.world.pos.y + 11.0f;
pos.z = this->actor.world.pos.z;
EffectSsHahen_SpawnBurst(globalCtx, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL);
if (CVar_GetS32("gNewDrops", 0) != 0) {
static s16 sEffectScales[] = {
145, 135, 115, 85, 75, 53, 45, 40, 35,
};
s32 pad;
Vec3f velocity;
Vec3f pos;
s16 phi_s0 = 500;
s16 gravity;
s16 phi_v0;
f32 temp_f20;
f32 temp_f22;
s32 i;
for (s16 i = 0; i < ARRAY_COUNT(sEffectScales); i++) {
phi_s0 += 10000;
temp_f20 = Rand_ZeroOne() * 5.0f;
pos.x = (Math_SinS(phi_s0) * temp_f20) + this->actor.world.pos.x;
pos.y = (Rand_ZeroOne() * 40.0f) + this->actor.world.pos.y + 5.0f;
pos.z = (Math_CosS(phi_s0) * temp_f20) + this->actor.world.pos.z;
temp_f20 = (Rand_ZeroOne() * 5.0f) + 2.0f;
velocity.x = Math_SinS(phi_s0) * temp_f20;
temp_f22 = Rand_ZeroOne();
velocity.y = (Rand_ZeroOne() * i * 2.5f) + (temp_f22 * 5.0f);
velocity.z = Math_CosS(phi_s0) * temp_f20;
if (i == 0) {
phi_v0 = 41;
gravity = -450;
} else if (i < 4) {
phi_v0 = 37;
gravity = -380;
} else {
phi_v0 = 69;
gravity = -320;
}
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &this->actor.world.pos, gravity, phi_v0, 30, 5, 0,
sEffectScales[i]/5, 3, 0, 70, 1, OBJECT_GAMEPLAY_FIELD_KEEP, gSilverRockFragmentsDL);
}
} else {
EffectSsHahen_SpawnBurst(globalCtx, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL);
}
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK);
Actor_Kill(&this->actor);
}
@ -713,11 +757,24 @@ void EnOkuta_Draw(Actor* thisx, GlobalContext* globalCtx) {
} else {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1653);
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(this->actor.home.rot.z * (M_PI / 0x8000), MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1657),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gOctorokProjectileDL);
if (CVar_GetS32("gNewDrops", 0) != 0) {
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6),
1 * (globalCtx->state.frames * 6), 32, 32));
Matrix_Scale(7.0f,7.0f,7.0f,MTXMODE_APPLY);
Matrix_RotateX(thisx->home.rot.z * (M_PI / 0x8000), MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 901),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gSilverRockDL);
} else {
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(this->actor.home.rot.z * (M_PI / 0x8000), MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1657),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gOctorokProjectileDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1662);
}