fix weirdnesses with real lantern

This commit is contained in:
MelonSpeedruns
2026-04-26 12:10:08 -04:00
parent 120864a5c9
commit a470b73b1b
4 changed files with 55 additions and 20 deletions
+4
View File
@@ -4380,6 +4380,7 @@ public:
/* 0x03194 */ int field_0x3194;
/* 0x03198 */ int field_0x3198;
/* 0x0319C */ int field_0x319c;
/* 0x0319C */ int ghostLanternFlameEffect;
/* 0x031A0 */ u32 mModeFlg;
/* 0x031A4 */ int field_0x31a4;
/* 0x031A8 */ u32 field_0x31a8[2];
@@ -4520,6 +4521,9 @@ public:
/* 0x03618 */ cXyz field_0x3618;
/* 0x03624 */ cXyz field_0x3624;
/* 0x03630 */ cXyz field_0x3630;
/* 0x03618 */ cXyz ghost_lantern_0x3618;
/* 0x03624 */ cXyz ghost_lantern_0x3624;
/* 0x03630 */ cXyz ghost_lantern_0x3630;
/* 0x0363C */ cXyz field_0x363c[4];
/* 0x0366C */ cXyz field_0x366c[4];
/* 0x0369C */ cXyz field_0x369c;
+33 -2
View File
@@ -6097,6 +6097,7 @@ void daAlink_c::setItemMatrix(int param_0) {
mpGhostLanternModel->setBaseTRMtx(mDoMtx_stack_c::get());
modelCalc(mpGhostLanternModel);
mGhostLanternFlamePos.y -= 25.0f;
mDoMtx_stack_c::transS(mGhostLanternFlamePos);
mpGhostLanternGlowModel->setBaseTRMtx(mDoMtx_stack_c::get());
modelCalc(mpGhostLanternGlowModel);
@@ -18585,6 +18586,21 @@ int daAlink_c::execute() {
setLight();
setEffect();
if (mEquipItem == dItemNo_LENS_OF_TRUTH_e) {
u16 effName;
dPa_levelEcallBack* callbackp;
JPABaseEmitter* emitterp;
effName = ID_ZI_J_KANTERA_FIRE;
callbackp = NULL;
ghostLanternFlameEffect = dComIfGp_particle_set(
ghostLanternFlameEffect, effName, &mGhostLanternFlamePos, &tevStr, &shape_angle,
NULL, 0xFF, callbackp, -1, NULL, NULL, NULL);
} else {
stopDrawParticle(ghostLanternFlameEffect);
}
if (mClothesChangeWaitTimer != 0) {
mDoMtx_stack_c::copy(mpLinkModel->getBaseTRMtx());
@@ -19439,6 +19455,18 @@ int daAlink_c::draw() {
}
}
if (mEquipItem == dItemNo_LENS_OF_TRUTH_e) {
JPABaseEmitter* emitter_gl = dComIfGp_particle_getEmitter(ghostLanternFlameEffect);
if (emitter_gl != NULL) {
daE_HP_c* foundPoe = (daE_HP_c*)fopAcM_Search(srchPoe, this);
if (checkPlayerNoDraw() || foundPoe == NULL) {
emitter_gl->stopDrawParticle();
} else {
emitter_gl->playDrawParticle();
}
}
}
if (mClothesChangeWaitTimer != 0) {
if (mProcID == PROC_METAMORPHOSE) {
if (mProcVar3.field_0x300e > 0) {
@@ -19744,9 +19772,12 @@ int daAlink_c::draw() {
}
if (mEquipItem == dItemNo_LENS_OF_TRUTH_e) {
daE_HP_c* foundPoe = (daE_HP_c*)fopAcM_Search(srchPoe, this);
modelDraw(mpGhostLanternModel, isPlayerNoDraw);
preGhostLanternDraw();
modelDraw(mpGhostLanternGlowModel, isPlayerNoDraw);
if (foundPoe != NULL) {
preGhostLanternDraw();
modelDraw(mpGhostLanternGlowModel, isPlayerNoDraw);
}
}
if (checkEquipHeavyBoots()) {
+14 -14
View File
@@ -143,10 +143,10 @@ int daAlink_c::ghostLanternModelCallBack() {
cXyz sp44;
mDoMtx_multVecZero(J3DSys::mCurrentMtx, &sp44);
field_0x3630 = field_0x3624;
field_0x3624 = mGhostLanternFlamePos;
ghost_lantern_0x3630 = ghost_lantern_0x3624;
ghost_lantern_0x3624 = mGhostLanternFlamePos;
cXyz sp38 = (mGhostLanternFlamePos - sp44) + field_0x3618;
cXyz sp38 = (mGhostLanternFlamePos - sp44) + ghost_lantern_0x3618;
sp38.y -= 3.0f;
cXyz sp2C;
@@ -167,7 +167,7 @@ int daAlink_c::ghostLanternModelCallBack() {
static Vec const kandelaarOffset = {0.0f, -17.0f, 0.0f};
mDoMtx_stack_c::multVec(&kandelaarOffset, &mGhostLanternFlamePos);
field_0x3618 = (mGhostLanternFlamePos - field_0x3624) * 0.9f;
ghost_lantern_0x3618 = (mGhostLanternFlamePos - ghost_lantern_0x3624) * 0.9f;
if (!checkEndResetFlg1(ERFLG1_UNK_8)) {
f32 scale = JMAFastSqrt(SQUARE(J3DSys::mCurrentMtx[0][0]) + SQUARE(J3DSys::mCurrentMtx[1][0]) + SQUARE(J3DSys::mCurrentMtx[2][0]));
@@ -233,18 +233,16 @@ void* daAlink_c::srchPoe(void* i_actor, void* i_this) {
void daAlink_c::preGhostLanternDraw() {
J3DMaterial* mat_p = mpGhostLanternGlowModel->getModelData()->getMaterialNodePointer(0);
daE_HP_c* foundPoe = (daE_HP_c*)fopAcM_Search(srchPoe, this);
J3DGXColorS10 color;
color.r = 0;
color.g = 0;
color.b = foundPoe != NULL ? 255 : 0;
color.a = foundPoe != NULL ? 255 : 0;
color.r = 64;
color.g = 128;
color.b = 128;
color.a = 255;
mat_p->setTevColor(1, &color);
color.r = 0;
color.g = 0;
color.b = foundPoe != NULL ? 255 : 0;
color.r = 64;
color.g = 128;
color.b = 128;
mat_p->setTevColor(2, &color);
cXyz proj;
@@ -267,7 +265,8 @@ void daAlink_c::preGhostLanternDraw() {
f32 near_ = dComIfGd_getView()->near_;
f32 far_ = dComIfGd_getView()->far_;
mDoLib_pos2camera(&mKandelaarFlamePos, &proj);
mDoLib_pos2camera(&mGhostLanternFlamePos, &proj);
proj.z += 30.0f;
if (proj.z > -0.01f) {
proj.z = -0.01f;
@@ -332,6 +331,7 @@ void daAlink_c::setKandelaarModel() {
field_0x3630 = field_0x3624;
field_0x3624 = mKandelaarFlamePos;
field_0x3618 = cXyz::Zero;
ghost_lantern_0x3618 = cXyz::Zero;
field_0x32c8 = 0;
field_0x3448 = 0.0f;
+4 -4
View File
@@ -404,18 +404,18 @@ void daAlink_c::changeLink(int param_0) {
}
mpKanteraModel = initModelEnv(static_cast<J3DModelData*>(dComIfG_getObjectRes(mArcName, "al_kantera.bmd")), 0);
mpGhostLanternModel = initModelEnv(static_cast<J3DModelData*>(dComIfG_getObjectRes(mArcName, "al_ghostlantern.bmd")), 0);
mpGhostLanternModel = initModelEnv(static_cast<J3DModelData*>(dComIfG_getObjectRes(mArcName, "ghost_lantern.bmd")), 0);
modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(mArcName, "ef_ktGlow.bmd"));
mpKanteraGlowModel = initModel(modelData, 0x200);
mpGhostLanternGlowModel = initModel(modelData, 0x200);
mpKanteraGlowBtk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(mArcName, "ef_ktGlow.btk"));
mpKanteraGlowBtk->setFrame(0.0f);
mpKanteraGlowBtk->searchUpdateMaterialID(modelData);
modelData->entryTexMtxAnimator(mpKanteraGlowBtk);
mpGhostLanternGlowBtk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(mArcName, "ef_ktGlow.btk"));
modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(mArcName, "ef_ghost_lantern.bmd"));
mpGhostLanternGlowModel = initModel(modelData, 0x200);
mpGhostLanternGlowBtk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(mArcName, "ef_ghost_lantern.btk"));
mpGhostLanternGlowBtk->setFrame(0.0f);
mpGhostLanternGlowBtk->searchUpdateMaterialID(modelData);
modelData->entryTexMtxAnimator(mpGhostLanternGlowBtk);