more kankyo work / d_a_kytag08 work

This commit is contained in:
TakaRikka
2023-08-02 01:31:23 -07:00
parent 9773c9dbf1
commit 623622b9b6
11 changed files with 735 additions and 160 deletions
+5 -1
View File
@@ -541,7 +541,7 @@ private:
extern const u16 j3dDefaultZModeID;
inline u16 calcZModeID(u8 param_0, u8 param_1, u8 param_2) {
return param_0 * 0x10 + param_2 + param_1 * 2;
return ((param_1 * 2) & 0x1FE) + (param_0 * 0x10) + param_2;
}
struct J3DZModeInfo {
@@ -631,6 +631,10 @@ struct J3DAlphaComp {
mRef1 = param_1.field_0x4;
u32 p1_mref1 = param_1.mRef1;
field_0x0 = calcAlphaCmpID(param_1.field_0x0, param_1.mRef0, p1_mref1);
// this matches for `dKy_bg_MAxx_proc` but causes `addWarpMaterial` to fail,
// while the above matches for `addWarpMaterial` but causes `dKy_bg_MAxx_proc` to fail?
// field_0x0 = calcAlphaCmpID(param_1.field_0x0, param_1.mRef0, param_1.mRef1);
}
/* 0x00 */ u16 field_0x0;
+1
View File
@@ -712,6 +712,7 @@ public:
void onForceAutoJump() { i_onEndResetFlg0(ERFLG0_FORCE_AUTO_JUMP); }
void onNotAutoJump() { i_onEndResetFlg0(ERFLG0_NOT_AUTO_JUMP); }
void onNotHang() { i_onEndResetFlg0(ERFLG0_NOT_HANG); }
void onFogFade() { i_onNoResetFlg2(FLG2_UNK_4000); }
void offGoronSideMove() {
if (i_checkGoronSideMove()) {
+4 -1
View File
@@ -88,7 +88,10 @@ struct stage_scls_info_dummy_class {
struct stage_pure_lightvec_info_class {
// LGT
};
/* 0x00 */ u8 field_0x0[0x1E - 0x0];
/* 0x1E */ u8 field_0x1e;
/* 0x1F */ u8 field_0x1f;
}; // Size: 0x20
// Col
struct stage_pselect_info_class {
+4
View File
@@ -50,6 +50,9 @@ static void dKy_calc_color_set(_GXColorS10* param_0, color_RGB_class* param_1,
color_RGB_class* param_4, f32 param_5, f32 param_6,
_GXColorS10 param_7, f32 param_8);
static void dKy_twilight_camelight_set();
u8 dKy_shadow_mode_check(u8 mode);
void dKy_shadow_mode_set(u8 mode);
void dKy_shadow_mode_reset(u8 mode);
struct LIGHT_INFLUENCE {
/* 800CFC7C */ ~LIGHT_INFLUENCE() {}
@@ -101,6 +104,7 @@ struct SND_INFLUENCE {
struct DALKMIST_INFLUENCE {
/* 0x00 */ cXyz mPos;
/* 0x0C */ f32 field_0xc;
/* 0x10 */ s8 mIndex;
};
struct DUNGEON_LIGHT {
+1
View File
@@ -27,6 +27,7 @@ cXyz dKyw_get_wind_vecpow();
void dKyw_evt_wind_set(s16 angleX, s16 angleY);
void dKyw_custom_windpower(f32 pow);
void dKyw_evt_wind_set_go();
void dKyw_wether_proc();
class dKankyo_sun_Packet : public J3DPacket {
public:
+8
View File
@@ -115,6 +115,14 @@ inline void mDoAud_heartGaugeOn() {
Z2AudioMgr::getInterface()->mStatusMgr.heartGaugeOn();
}
inline void mDoAud_setFogWipeWidth(f32 i_width) {
g_mEnvSeMgr.setFogWipeWidth(i_width);
}
inline void mDoAud_startFogWipeTrigger(const Vec* param_0) {
g_mEnvSeMgr.startFogWipeTrigger((Vec*)param_0);
}
inline void mDoAud_mEnvse_framework() {
g_mEnvSeMgr.framework();
}
@@ -6,10 +6,10 @@
class kytag08_class : public fopAc_ac_c {
public:
/* 0x568 */ J3DModel* mpModel;
/* 0x56C */ mDoExt_btkAnm field_0x56c;
/* 0x584 */ mDoExt_brkAnm field_0x584;
/* 0x59C */ JPABaseEmitter* field_0x59c;
/* 0x5A0 */ JPABaseEmitter* field_0x5a0;
/* 0x56C */ mDoExt_btkAnm mBtk;
/* 0x584 */ mDoExt_brkAnm mBrk;
/* 0x59C */ JPABaseEmitter* mpEmitter1;
/* 0x5A0 */ JPABaseEmitter* mpEmitter2;
/* 0x5A4 */ request_of_phase_process_class mPhase;
/* 0x5AC */ cXyz field_0x5ac;
/* 0x5B8 */ cXyz field_0x5b8;
@@ -2,7 +2,6 @@
#define D_A_TAG_LIGHTBALL_H
#include "d/kankyo/d_kankyo.h"
#include "dolphin/types.h"
#include "f_op/f_op_actor_mng.h"
class daTagLightBall_c : public fopAc_ac_c {
@@ -19,11 +18,8 @@ public:
u32 getType() { return fopAcM_GetParamBit(this, 8, 4); }
/* 0x568 */ DALKMIST_INFLUENCE mInfluence;
/* 0x578 */ int field_0x578;
/* 0x57C */ u8 field_0x57c;
/* 0x57D */ u8 field_0x57d;
/* 0x57E */ u8 field_0x57e;
/* 0x57F */ u8 field_0x57f;
/* 0x57D */ u8 mInfSet;
};
#endif /* D_A_TAG_LIGHTBALL_H */
+259 -22
View File
@@ -4,10 +4,11 @@
//
#include "rel/d/a/kytag/d_a_kytag08/d_a_kytag08.h"
#include "dol2asm.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "d/a/d_a_player.h"
#include "d/com/d_com_inf_game.h"
#include "d/d_procname.h"
#include "dol2asm.h"
//
// Types:
@@ -59,8 +60,8 @@ extern "C" void _restgpr_28();
/* 8085A578-8085A580 000078 0008+00 1/0 0/0 0/0 .text daKytag08_Draw__FP13kytag08_class
*/
static bool daKytag08_Draw(kytag08_class* param_0) {
return true;
static int daKytag08_Draw(kytag08_class* i_this) {
return 1;
}
/* ############################################################################################## */
@@ -283,47 +284,240 @@ COMPILER_STRIP_GATE(0x8085B30C, &lit_4041);
#pragma pop
/* 8085A580-8085AEA0 000080 0920+00 1/0 0/0 0/0 .text daKytag08_Execute__FP13kytag08_class */
// matches with literals
#ifdef NONMATCHING
static int daKytag08_Execute(kytag08_class* i_this) {
dScnKy_env_light_c* env_light = i_dKy_getEnvlight();
daPy_py_c* player_p = daPy_getPlayerActorClass();
JGeometry::TVec3<f32> particle_scale;
i_this->field_0x5d8 = 1;
if (i_this->field_0x5d8 == 0) {
i_this->current.pos.x = player_p->current.pos.x;
i_this->current.pos.y = 100.0f;
i_this->current.pos.z = player_p->current.pos.z;
} else if (env_light->field_0x0c18[0].field_0x26 == 1) {
i_this->current.pos.x = env_light->field_0x0c18[0].mPos.x;
i_this->current.pos.y = 100.0f;
i_this->current.pos.z = env_light->field_0x0c18[0].mPos.z;
}
if (i_this->field_0x5b8.abs(i_this->current.pos) < 2000.0f && !i_dComIfGp_event_runCheck()) {
if (i_this->field_0x5d4 > 100) {
f32 var_f30;
f32 var_f31;
if (i_this->field_0x5d8 != 0) {
var_f30 = 20.0f;
var_f31 = 0.1f;
} else {
var_f30 = 10.0f;
var_f31 = 0.2f;
}
cLib_addCalc(&i_this->field_0x5b8.x, i_this->field_0x5c4.x, var_f31, var_f30, 1.0E-5f);
cLib_addCalc(&i_this->field_0x5b8.z, i_this->field_0x5c4.z, var_f31, var_f30, 1.0E-5f);
} else {
f32 var_f30;
f32 var_f31;
if (i_this->field_0x5d8 != 0) {
var_f30 = 20.0f;
var_f31 = 0.1f;
} else {
var_f30 = 10.0f;
var_f31 = 0.2f;
}
cLib_addCalc(&i_this->field_0x5b8.x, i_this->field_0x5c4.x, var_f31, var_f30, 1.0E-5f);
cLib_addCalc(&i_this->field_0x5b8.z, i_this->field_0x5c4.z, var_f31, var_f30, 1.0E-5f);
}
} else {
i_this->field_0x5b8.x = i_this->current.pos.x;
i_this->field_0x5b8.z = i_this->current.pos.z;
}
if (!dKy_shadow_mode_check(2)) {
if (!i_dComIfGp_event_runCheck()) {
cLib_addCalc(&i_this->field_0x5d0, 0.0f, 0.2f, 0.005f, 0.001f);
}
} else if (i_this->field_0x5d4 != 0) {
cLib_addCalc(&i_this->field_0x5d0, 1.0f, 0.5f, 0.01f, 0.001f);
} else if (!i_dComIfGp_event_runCheck()) {
cLib_addCalc(&i_this->field_0x5d0, 0.25f, 0.01f, 0.002f, 0.001f);
}
mDoAud_setFogWipeWidth(i_this->field_0x5d0);
if (i_this->field_0x5d8 != 0) {
f32 tmp2 = 37.5f;
if (i_this->field_0x5b8.abs(i_this->current.pos) >
i_this->field_0x5d0 * tmp2 * i_this->field_0x5ac.x)
{
dComIfGs_BossLife_public_Set(2);
}
}
if ((daPy_getPlayerActorClass()->checkKandelaarSwing(1) && i_this->field_0x5d4 < 100) ||
dComIfGs_BossLife_public_Get() == 1)
{
dComIfGs_BossLife_public_Set(0);
i_this->field_0x5c4 = i_this->current.pos;
i_this->field_0x5d4 = 180;
mDoAud_startFogWipeTrigger(&i_this->current.pos);
} else {
f32 var_f30_3;
f32 var_f31_3;
if (i_this->field_0x5d8 != 0) {
var_f30_3 = 4000.0f;
var_f31_3 = 0.5f;
} else {
var_f30_3 = 4.0f;
var_f31_3 = 0.025f;
}
cLib_addCalc(&i_this->field_0x5c4.x, i_this->current.pos.x, var_f31_3, var_f30_3, 0.01f);
cLib_addCalc(&i_this->field_0x5c4.z, i_this->current.pos.z, var_f31_3, var_f30_3, 0.01f);
}
if (i_this->field_0x5d4 != 0) {
i_this->field_0x5d4--;
}
if (i_this->mpEmitter1 != NULL) {
i_this->mpEmitter1->setGlobalTranslation(i_this->field_0x5b8.x, i_this->field_0x5b8.y,
i_this->field_0x5b8.z);
i_this->mpEmitter1->setVolumeSize(i_this->field_0x5ac.x * 50.0f * i_this->field_0x5d0);
f32 temp_f0_7 = 1.0f - i_this->field_0x5d0;
particle_scale.x = 1.0f - (temp_f0_7 * temp_f0_7);
particle_scale.y = 1.0f - (temp_f0_7 * temp_f0_7);
particle_scale.z = 1.0f - (temp_f0_7 * temp_f0_7);
i_this->mpEmitter1->setGlobalParticleScale(particle_scale);
}
if (i_this->field_0x5d0 <= 0.001f) {
i_this->field_0x5b8.x = i_this->current.pos.x;
i_this->field_0x5b8.z = i_this->current.pos.z;
i_this->field_0x5c4 = i_this->field_0x5b8;
}
f32 var_f30_4 = 20.0f;
if (dKy_darkworld_check()) {
var_f30_4 = 56.0f;
}
f32 var_f0;
if (player_p->getSpinnerActor()) {
var_f0 = player_p->getSpinnerActor()->current.pos.y;
} else {
var_f0 = player_p->current.pos.y;
}
if (var_f0 < var_f30_4) {
cXyz sp24(player_p->current.pos);
sp24.y = 100.0f;
if (i_this->field_0x5b8.abs(sp24) > i_this->field_0x5ac.x * 45.0f * i_this->field_0x5d0 ||
i_this->field_0x5d0 <= 0.01f)
{
player_p->onFogFade();
}
}
if (player_p != NULL && i_this->mpEmitter2 != NULL) {
i_this->mpEmitter2->setGlobalTranslation(player_p->current.pos.x, 100.0f,
player_p->current.pos.z);
particle_scale.z = 0.0f;
particle_scale.y = 0.0f;
particle_scale.x = 0.0f;
if (player_p->current.pos.y < 100.0f) {
cXyz sp18(player_p->current.pos);
sp18.y = 100.0f;
if (i_this->field_0x5b8.abs(sp18) > i_this->field_0x5ac.x * 45.0f * i_this->field_0x5d0)
{
f32 scale_factor = (100.0f - player_p->current.pos.y) / 30.0f;
if (scale_factor > 1.0f) {
scale_factor = 1.0f;
}
particle_scale.z = scale_factor;
particle_scale.y = scale_factor;
particle_scale.x = scale_factor;
}
}
i_this->mpEmitter2->setGlobalParticleScale(particle_scale);
}
return 1;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
static asm void daKytag08_Execute(kytag08_class* param_0) {
static asm int daKytag08_Execute(kytag08_class* param_0) {
nofralloc
#include "asm/rel/d/a/kytag/d_a_kytag08/d_a_kytag08/daKytag08_Execute__FP13kytag08_class.s"
}
#pragma pop
#endif
/* 8085AEA0-8085AEA8 0009A0 0008+00 1/0 0/0 0/0 .text daKytag08_IsDelete__FP13kytag08_class */
static bool daKytag08_IsDelete(kytag08_class* param_0) {
return true;
static int daKytag08_IsDelete(kytag08_class* i_this) {
return 1;
}
/* ############################################################################################## */
/* 8085B310-8085B310 000084 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
#pragma push
#pragma force_active on
SECTION_DEAD static char const* const stringBase_8085B310 = "Kytag08";
#pragma pop
/* 8085AEA8-8085AF74 0009A8 00CC+00 1/0 0/0 0/0 .text daKytag08_Delete__FP13kytag08_class
*/
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
static asm void daKytag08_Delete(kytag08_class* param_0) {
nofralloc
#include "asm/rel/d/a/kytag/d_a_kytag08/d_a_kytag08/daKytag08_Delete__FP13kytag08_class.s"
static int daKytag08_Delete(kytag08_class* i_this) {
if (i_this->mpEmitter1 != NULL) {
i_this->mpEmitter1->deleteAllParticle();
i_this->mpEmitter1->becomeInvalidEmitter();
i_this->mpEmitter1->quitImmortalEmitter();
i_this->mpEmitter1->setEmitterCallBackPtr(NULL);
i_this->mpEmitter1 = NULL;
}
if (i_this->mpEmitter2 != NULL) {
i_this->mpEmitter2->deleteAllParticle();
i_this->mpEmitter2->becomeInvalidEmitter();
i_this->mpEmitter2->quitImmortalEmitter();
i_this->mpEmitter2->setEmitterCallBackPtr(NULL);
i_this->mpEmitter2 = NULL;
}
dComIfG_resDelete(&i_this->mPhase, "Kytag08");
return 1;
}
#pragma pop
/* 8085AF74-8085AFEC 000A74 0078+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */
// getting optimized when it shouldnt be?
#ifdef NONMATCHING
static int useHeapInit(fopAc_ac_c* i_this) {
kytag08_class* this_ = (kytag08_class*)i_this;
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Kytag08", 3);
this_->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11020202);
if (this_->mpModel == NULL) {
return 0;
}
return 1;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
static asm void useHeapInit(fopAc_ac_c* param_0) {
static asm int useHeapInit(fopAc_ac_c* param_0) {
nofralloc
#include "asm/rel/d/a/kytag/d_a_kytag08/d_a_kytag08/useHeapInit__FP10fopAc_ac_c.s"
}
#pragma pop
#endif
/* ############################################################################################## */
/* 8085B318-8085B338 -00001 0020+00 1/0 0/0 0/0 .data l_daKytag08_Method */
@@ -356,14 +550,57 @@ SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = {
};
/* 8085AFEC-8085B23C 000AEC 0250+00 1/0 0/0 0/0 .text daKytag08_Create__FP10fopAc_ac_c */
// regswap
#ifdef NONMATCHING
static int daKytag08_Create(fopAc_ac_c* i_this) {
cXyz sp(1.0f, 1.0f, 1.0f);
dScnKy_env_light_c* env_light = i_dKy_getEnvlight();
if (!fopAcM_CheckCondition(i_this, 8)) {
new (i_this) kytag08_class();
fopAcM_OnCondition(i_this, 8);
}
kytag08_class* this_ = (kytag08_class*)i_this;
int phase = dComIfG_resLoad(&this_->mPhase, "Kytag08");
if (phase == cPhs_COMPLEATE_e) {
if (!fopAcM_entrySolidHeap(this_, useHeapInit, 0x550)) {
return cPhs_ERROR_e;
}
this_->field_0x5ac.x = 20.0f;
this_->field_0x5ac.y = 20.0f;
this_->field_0x5ac.z = 20.0f;
this_->field_0x5d0 = 0.0f;
this_->mpEmitter1 = dComIfGp_particle_set(0x84A0, &this_->current.pos, NULL, &sp);
if (!dKy_darkworld_check()) {
this_->mpEmitter2 = dComIfGp_particle_set(0x84A1, &this_->current.pos, NULL, &sp);
} else {
this_->mpEmitter2 = dComIfGp_particle_set(0x84A2, &this_->current.pos, NULL, &sp);
}
this_->field_0x5b8 = this_->current.pos;
this_->field_0x5b8.y = 100.0f;
this_->field_0x5c4 = this_->field_0x5b8;
env_light->field_0x1060 = this_;
}
return phase;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
static asm void daKytag08_Create(fopAc_ac_c* param_0) {
static asm int daKytag08_Create(fopAc_ac_c* param_0) {
nofralloc
#include "asm/rel/d/a/kytag/d_a_kytag08/d_a_kytag08/daKytag08_Create__FP10fopAc_ac_c.s"
}
#pragma pop
#endif
/* 8085B23C-8085B284 000D3C 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */
#pragma push
@@ -12,8 +12,8 @@ void daTagLightBall_c::initBaseMtx() {
/* 80D5A818-80D5A870 000098 0058+00 1/1 0/0 0/0 .text setBaseMtx__16daTagLightBall_cFv */
void daTagLightBall_c::setBaseMtx() {
PSMTXTrans(mDoMtx_stack_c::now, current.pos.x, current.pos.y, current.pos.z);
mDoMtx_ZXYrotM(mDoMtx_stack_c::now, shape_angle.x, shape_angle.y, shape_angle.z);
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
}
/* 80D5A870-80D5A9B8 0000F0 0148+00 1/1 0/0 0/0 .text Create__16daTagLightBall_cFv */
@@ -25,21 +25,24 @@ int daTagLightBall_c::Create() {
i_fopAcM_offSwitch(this, swbit);
}
}
mInfluence.mPos = current.pos;
mInfluence.field_0xc = mScale.x * 100.0f;
if (swbit != 0xFF) {
if (getType() == 15) {
if (i_fopAcM_isSwitch(this, swbit)) {
dKy_dalkmist_inf_set(&mInfluence);
field_0x57d = 1;
mInfSet = true;
}
} else {
if (!i_fopAcM_isSwitch(this, swbit)) {
dKy_dalkmist_inf_set(&mInfluence);
field_0x57d = 1;
mInfSet = true;
}
}
}
field_0x57c = i_fopAcM_isSwitch(this, swbit);
return 1;
}
@@ -50,9 +53,11 @@ int daTagLightBall_c::create() {
new (this) daTagLightBall_c;
fopAcM_OnCondition(this, 8);
}
if (Create() == 0) {
if (!Create()) {
return cPhs_ERROR_e;
}
return cPhs_COMPLEATE_e;
}
@@ -61,21 +66,22 @@ int daTagLightBall_c::execute() {
u8 swbit = getSwBit();
if (swbit != 0xFF) {
if (getType() == 15) {
if (field_0x57c != 0 && !i_fopAcM_isSwitch(this, swbit)) {
if (field_0x57c && !i_fopAcM_isSwitch(this, swbit)) {
dKy_dalkmist_inf_cut(&mInfluence);
field_0x57d = 0;
} else if (field_0x57c == 0 && i_fopAcM_isSwitch(this, swbit)) {
mInfSet = false;
} else if (!field_0x57c && i_fopAcM_isSwitch(this, swbit)) {
dKy_dalkmist_inf_set(&mInfluence);
field_0x57d = 1;
mInfSet = true;
}
} else if (field_0x57c == 0 && i_fopAcM_isSwitch(this, swbit)) {
} else if (!field_0x57c && i_fopAcM_isSwitch(this, swbit)) {
dKy_dalkmist_inf_cut(&mInfluence);
field_0x57d = 0;
} else if (field_0x57c != 0 && !i_fopAcM_isSwitch(this, swbit)) {
mInfSet = false;
} else if (field_0x57c && !i_fopAcM_isSwitch(this, swbit)) {
dKy_dalkmist_inf_set(&mInfluence);
field_0x57d = 1;
mInfSet = true;
}
}
mInfluence.mPos = current.pos;
field_0x57c = i_fopAcM_isSwitch(this, swbit);
return 1;
@@ -88,33 +94,34 @@ int daTagLightBall_c::draw() {
/* 80D5ABA8-80D5ABF0 000428 0048+00 1/1 0/0 0/0 .text _delete__16daTagLightBall_cFv */
int daTagLightBall_c::_delete() {
if (field_0x57d) {
if (mInfSet) {
dKy_dalkmist_inf_cut(&mInfluence);
field_0x57d = 0;
mInfSet = false;
}
return 1;
}
/* 80D5ABF0-80D5AC10 000470 0020+00 1/0 0/0 0/0 .text daTagLightBall_Draw__FP16daTagLightBall_c */
static void daTagLightBall_Draw(daTagLightBall_c* i_this) {
((daTagLightBall_c*)i_this)->draw();
static int daTagLightBall_Draw(daTagLightBall_c* i_this) {
return i_this->draw();
}
/* 80D5AC10-80D5AC30 000490 0020+00 1/0 0/0 0/0 .text daTagLightBall_Execute__FP16daTagLightBall_c
*/
static void daTagLightBall_Execute(daTagLightBall_c* i_this) {
((daTagLightBall_c*)i_this)->execute();
static int daTagLightBall_Execute(daTagLightBall_c* i_this) {
return i_this->execute();
}
/* 80D5AC30-80D5AC50 0004B0 0020+00 1/0 0/0 0/0 .text daTagLightBall_Delete__FP16daTagLightBall_c
*/
static void daTagLightBall_Delete(daTagLightBall_c* i_this) {
((daTagLightBall_c*)i_this)->_delete();
static int daTagLightBall_Delete(daTagLightBall_c* i_this) {
return i_this->_delete();
}
/* 80D5AC50-80D5AC70 0004D0 0020+00 1/0 0/0 0/0 .text daTagLightBall_Create__FP10fopAc_ac_c */
static void daTagLightBall_Create(fopAc_ac_c* i_this) {
((daTagLightBall_c*)i_this)->create();
static int daTagLightBall_Create(fopAc_ac_c* i_this) {
return static_cast<daTagLightBall_c*>(i_this)->create();
}
/* ############################################################################################## */
+418 -104
View File
File diff suppressed because it is too large Load Diff