mirror of
https://github.com/zeldaret/tww.git
synced 2026-05-30 17:05:33 -04:00
Match d_a_lamp
Matched everything in lamp_class. Some member names might be off, but I gave my best guess.
This commit is contained in:
+1
-1
@@ -1242,7 +1242,7 @@ config.libs = [
|
||||
ActorRel(Matching, "d_a_kytag05"),
|
||||
ActorRel(Matching, "d_a_kytag06"),
|
||||
ActorRel(NonMatching, "d_a_kytag07"),
|
||||
ActorRel(NonMatching, "d_a_lamp"),
|
||||
ActorRel(Matching, "d_a_lamp" , extra_cflags=['-sym off']),
|
||||
ActorRel(NonMatching, "d_a_lod_bg"),
|
||||
ActorRel(NonMatching, "d_a_lwood"),
|
||||
ActorRel(Matching, "d_a_magma"),
|
||||
|
||||
@@ -105,6 +105,9 @@ void MtxScale(f32, f32, f32, u8);
|
||||
void MtxPosition(cXyz* src, cXyz* dest);
|
||||
void MtxPush(void);
|
||||
Mtx* MtxPull(void);
|
||||
void MtxRotX(f32 rot, u8 concat);
|
||||
void MtxRotY(f32 rot, u8 concat);
|
||||
void MtxRotZ(f32 rot, u8 concat);
|
||||
|
||||
extern Mtx* calc_mtx;
|
||||
|
||||
|
||||
@@ -2,10 +2,33 @@
|
||||
#define D_A_LAMP_H
|
||||
|
||||
#include "f_op/f_op_actor.h"
|
||||
#include "d/d_particle.h"
|
||||
#include "d/d_cc_d.h"
|
||||
#include "global.h"
|
||||
|
||||
class lamp_class : public fopAc_ac_c {
|
||||
public:
|
||||
/* Place member variables here */
|
||||
/* 0x290 */ request_of_phase_process_class mPhs;
|
||||
/* 0x298 */ u8 mParameters;
|
||||
/* 0x299 padding */
|
||||
/* 0x29a */ s16 mCycleCtr;
|
||||
/* 0x29c */ J3DModel* mModel;
|
||||
/* 0x2a0 */ dPa_followEcallBack mPa; // Bad?
|
||||
/* 0x2b4 */ u8 mParticleInit;
|
||||
/* 0x2b5-2b7 padding */
|
||||
/* 0x2b8 */ cXyz mPos;
|
||||
/* 0x2c4 */ dCcD_Stts mStts; // Bad?
|
||||
/* 0x300 */ dCcD_Sph mSph;
|
||||
/* 0x42c */ s8 mOto;
|
||||
/* 0x42d-42f padding */
|
||||
/* 0x430 */ float mLength;
|
||||
/* 0x434 */ s8 mHitTimeoutLeft;
|
||||
/* 0x435-437 padding */
|
||||
/* 0x438 */ float mHitReactCurZ;
|
||||
/* 0x43c */ s16 mHitAngle;
|
||||
/* 0x440 */ LIGHT_INFLUENCE mInf;
|
||||
/* 0x460 */ float mParticlePower;
|
||||
};
|
||||
STATIC_ASSERT(sizeof(lamp_class) == 0x464);
|
||||
|
||||
#endif /* D_A_LAMP_H */
|
||||
|
||||
+206
-15
@@ -4,39 +4,230 @@
|
||||
//
|
||||
|
||||
#include "d/actor/d_a_lamp.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_procname.h"
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
|
||||
// RW data
|
||||
static dCcD_SrcSph sph_src = {
|
||||
// dCcD_SrcGObjInf
|
||||
{
|
||||
/* Flags */ 0,
|
||||
/* SrcObjAt Type */ 0,
|
||||
/* SrcObjAt Atp */ 0,
|
||||
/* SrcObjAt SPrm */ 0x0,
|
||||
/* SrcObjTg Type */ AT_TYPE_FIRE | AT_TYPE_UNK20000 | AT_TYPE_FIRE_ARROW | AT_TYPE_LEAF_WIND | AT_TYPE_UNK400000,
|
||||
/* SrcObjTg SPrm */ 0x9,
|
||||
/* SrcObjCo SPrm */ 0,
|
||||
/* SrcGObjAt Se */ 0,
|
||||
/* SrcGObjAt HitMark */ 0,
|
||||
/* SrcGObjAt Spl */ 0,
|
||||
/* SrcGObjAt Mtrl */ 0,
|
||||
/* SrcGObjAt GFlag */ 0,
|
||||
/* SrcGObjTg Se */ 0,
|
||||
/* SrcGObjTg HitMark */ 0,
|
||||
/* SrcGObjTg Spl */ 0,
|
||||
/* SrcGObjTg Mtrl */ 0,
|
||||
/* SrcGObjTg GFlag */ 0x00,
|
||||
/* SrcGObjCo GFlag */ 0,
|
||||
},
|
||||
// cM3dGSphS
|
||||
{
|
||||
/* Center */ 0.0f, 0.0f, 0.0f,
|
||||
/* Radius */ 30.0f,
|
||||
},
|
||||
};
|
||||
static u8 padding[76];
|
||||
|
||||
// Need to break these out to get the rodata ordered right
|
||||
static const float partHeightOffset = 20.0;
|
||||
static const float partMaxFlickerPerTick = 0.02;
|
||||
|
||||
/* 000000EC-00000158 .text daLamp_Draw__FP10lamp_class */
|
||||
void daLamp_Draw(lamp_class*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daLamp_Draw(lamp_class* i_lamp) {
|
||||
g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_lamp->current.pos, &i_lamp->mTevStr);
|
||||
J3DModel* pModel = i_lamp->mModel;
|
||||
g_env_light.setLightTevColorType(pModel, &i_lamp->mTevStr);
|
||||
mDoExt_modelUpdateDL(pModel);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000158-000005C8 .text daLamp_Execute__FP10lamp_class */
|
||||
void daLamp_Execute(lamp_class*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daLamp_Execute(lamp_class* i_lamp) {
|
||||
i_lamp->mCycleCtr += 1;
|
||||
MtxTrans(i_lamp->current.pos.x, i_lamp->current.pos.y, i_lamp->current.pos.z, 0);
|
||||
mDoMtx_YrotM(*calc_mtx, i_lamp->current.angle.GetY());
|
||||
if (i_lamp->mParameters == 0) {
|
||||
i_lamp->mLength = 0.1;
|
||||
} else {
|
||||
if (dComIfGp_getVibration().CheckQuake() || fopAcM_otoCheck(i_lamp, 1000.0) > 400) {
|
||||
i_lamp->mOto = 0x14;
|
||||
}
|
||||
if (i_lamp->mOto) {
|
||||
i_lamp->mOto--;
|
||||
cLib_addCalc2(&i_lamp->mLength, 0.15, 1.0, 0.015);
|
||||
} else {
|
||||
cLib_addCalc2(&i_lamp->mLength, 0.01, 1.0, 0.0005);
|
||||
}
|
||||
}
|
||||
f32 oppDist = cM_ssin(i_lamp->mCycleCtr * 0x320) * i_lamp->mLength;
|
||||
MtxRotX(oppDist, 1);
|
||||
f32 adjDist = cM_scos(i_lamp->mCycleCtr * 0x2bc) * i_lamp->mLength;
|
||||
MtxRotZ(adjDist, 1);
|
||||
MtxScale(0.4, 0.4, 0.4, 1);
|
||||
i_lamp->mModel->setBaseTRMtx(*calc_mtx);
|
||||
MtxTrans(10.0, -140.0, -15.0, 1);
|
||||
|
||||
cXyz pos;
|
||||
pos.z = 0.0f;
|
||||
pos.y = 0.0f;
|
||||
pos.x = 0.0f;
|
||||
MtxPosition(&pos, &i_lamp->mPos);
|
||||
|
||||
if (!i_lamp->mParticleInit) {
|
||||
static cXyz fire_scale(0.5f, 0.5f, 0.5f);
|
||||
|
||||
dComIfGp_particle_set(0x1ea, &i_lamp->mPos, NULL, &fire_scale, 0xFF, &i_lamp->mPa);
|
||||
i_lamp->mParticleInit = 1;
|
||||
i_lamp->mParticlePower = 1.0f;
|
||||
}
|
||||
|
||||
if (i_lamp->mPa.getEmitter()) {
|
||||
cXyz whitePartPos = i_lamp->mPos;
|
||||
whitePartPos.y += partHeightOffset;
|
||||
dComIfGp_particle_setSimple(0x4004, &whitePartPos, 0xFF, g_whiteColor, g_whiteColor, 0);
|
||||
cLib_addCalc2(&i_lamp->mParticlePower, cM_rndF(0.2) + 1.0f, 0.5f, partMaxFlickerPerTick);
|
||||
} else {
|
||||
i_lamp->mParticlePower = 0.0;
|
||||
}
|
||||
i_lamp->mInf.mPos = i_lamp->mPos;
|
||||
i_lamp->mInf.mColor.r = 600;
|
||||
i_lamp->mInf.mColor.g = 400;
|
||||
i_lamp->mInf.mColor.b = 120;
|
||||
|
||||
s16 power = i_lamp->mParticlePower * 150.0f;
|
||||
i_lamp->mInf.mPower = power;
|
||||
i_lamp->mInf.mFluctuation = 250.0f;
|
||||
|
||||
i_lamp->mSph.SetC(i_lamp->mPos);
|
||||
dComIfG_Ccsp()->Set(&i_lamp->mSph);
|
||||
if (!i_lamp->mHitTimeoutLeft) {
|
||||
if (i_lamp->mSph.ChkTgHit()) {
|
||||
cCcD_Obj* pHitObj = i_lamp->mSph.GetTgHitObj();
|
||||
if (pHitObj && pHitObj->ChkAtType(AT_TYPE_LEAF_WIND | AT_TYPE_UNK400000)) {
|
||||
i_lamp->mHitAngle = dComIfGp_getPlayer(0)->shape_angle.y;
|
||||
i_lamp->mHitTimeoutLeft = 0x28;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
i_lamp->mHitTimeoutLeft--;
|
||||
if (i_lamp->mPa.mpEmitter) {
|
||||
float tgtZ;
|
||||
if (i_lamp->mHitTimeoutLeft > 10) {
|
||||
tgtZ = 4.0;
|
||||
} else {
|
||||
tgtZ = 0.0;
|
||||
}
|
||||
cLib_addCalc2(&i_lamp->mHitReactCurZ, tgtZ, 1.0, 0.5);
|
||||
cMtx_YrotS(*calc_mtx, i_lamp->mHitAngle);
|
||||
cXyz localPos;
|
||||
localPos.set(0.0f, 1.0f, i_lamp->mHitReactCurZ);
|
||||
cXyz globalPos;
|
||||
MtxPosition(&localPos, &globalPos);
|
||||
float y = globalPos.y;
|
||||
float z = globalPos.z;
|
||||
float x = globalPos.x;
|
||||
i_lamp->mPa.mpEmitter->mEmitterDir.set(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000604-00000634 .text daLamp_IsDelete__FP10lamp_class */
|
||||
void daLamp_IsDelete(lamp_class*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daLamp_IsDelete(lamp_class* i_lamp) {
|
||||
i_lamp->mPa.end();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000634-00000678 .text daLamp_Delete__FP10lamp_class */
|
||||
void daLamp_Delete(lamp_class*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daLamp_Delete(lamp_class* i_lamp) {
|
||||
dComIfG_resDelete(&i_lamp->mPhs, "Lamp");
|
||||
dKy_plight_cut(&i_lamp->mInf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 00000678-0000073C .text useHeapInit__FP10lamp_class */
|
||||
void useHeapInit(lamp_class*) {
|
||||
/* Nonmatching */
|
||||
static BOOL useHeapInit(lamp_class* i_lamp) {
|
||||
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes("Lamp", 3));
|
||||
JUT_ASSERT(0x170, modelData != 0);
|
||||
|
||||
i_lamp->mModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
|
||||
if (i_lamp->mModel == 0) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* 0000073C-0000075C .text daLamp_solidHeapCB__FP10fopAc_ac_c */
|
||||
void daLamp_solidHeapCB(fopAc_ac_c*) {
|
||||
/* Nonmatching */
|
||||
static BOOL daLamp_solidHeapCB(fopAc_ac_c* i_ac) {
|
||||
return useHeapInit((lamp_class*)i_ac);
|
||||
}
|
||||
|
||||
/* 0000075C-00000914 .text daLamp_Create__FP10fopAc_ac_c */
|
||||
void daLamp_Create(fopAc_ac_c*) {
|
||||
/* Nonmatching */
|
||||
static int daLamp_Create(fopAc_ac_c* i_ac) {
|
||||
fopAcM_SetupActor(i_ac, lamp_class);
|
||||
lamp_class* i_lamp = (lamp_class*)i_ac;
|
||||
|
||||
s32 phase_state = dComIfG_resLoad(&i_lamp->mPhs, "Lamp");
|
||||
if (phase_state == cPhs_COMPLEATE_e) {
|
||||
if (fopAcM_entrySolidHeap(i_lamp, (heapCallbackFunc)&daLamp_solidHeapCB, 0x6040)) {
|
||||
i_lamp->mParameters = fopAcM_GetParam(i_lamp);
|
||||
if (i_lamp->mParameters == 0xFF) {
|
||||
i_lamp->mParameters = 0;
|
||||
}
|
||||
i_lamp->mStts.Init(0xff, 0xff, i_lamp);
|
||||
i_lamp->mSph.Set(sph_src);
|
||||
i_lamp->mSph.SetStts(&i_lamp->mStts);
|
||||
|
||||
i_lamp->mCycleCtr = cM_rndFX(32768.0f);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
daLamp_Execute(i_lamp);
|
||||
}
|
||||
|
||||
dKy_plight_set(&i_lamp->mInf);
|
||||
} else {
|
||||
phase_state = cPhs_ERROR_e;
|
||||
}
|
||||
}
|
||||
|
||||
return phase_state;
|
||||
}
|
||||
|
||||
static actor_method_class l_daLamp_Method = {
|
||||
(process_method_func)daLamp_Create,
|
||||
(process_method_func)daLamp_Delete,
|
||||
(process_method_func)daLamp_Execute,
|
||||
(process_method_func)daLamp_IsDelete,
|
||||
(process_method_func)daLamp_Draw,
|
||||
};
|
||||
|
||||
actor_process_profile_definition g_profile_LAMP = {
|
||||
/* LayerID */ fpcLy_CURRENT_e,
|
||||
/* ListID */ 7,
|
||||
/* ListPrio */ fpcLy_CURRENT_e,
|
||||
/* ProcName */ PROC_LAMP,
|
||||
/* Proc SubMtd */ &g_fpcLf_Method.mBase,
|
||||
/* Size */ sizeof(lamp_class),
|
||||
/* SizeOther */ 0,
|
||||
/* Parameters */ 0,
|
||||
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
||||
/* Priority */ 0x00AE,
|
||||
/* Actor SubMtd */ &l_daLamp_Method,
|
||||
/* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
|
||||
/* Group */ fopAc_ACTOR_e,
|
||||
/* CullType */ 0,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user