1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/**
* d_a_lamp.cpp
* Object - Generic wall lamp
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_lamp.h"
#include "res/Object/Lamp.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_mtx.h"
/* 000000EC-00000158 .text daLamp_Draw__FP10lamp_class */
static BOOL daLamp_Draw(lamp_class* i_this) {
g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_this->current.pos, &i_this->tevStr);
J3DModel* pModel = i_this->mModel;
g_env_light.setLightTevColorType(pModel, &i_this->tevStr);
mDoExt_modelUpdateDL(pModel);
return TRUE;
}
/* 00000158-000005C8 .text daLamp_Execute__FP10lamp_class */
static BOOL daLamp_Execute(lamp_class* i_this) {
i_this->mCycleCtr += 1;
MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, 0);
mDoMtx_YrotM(*calc_mtx, i_this->current.angle.y);
if (i_this->mParameters == 0) {
i_this->mLength = 0.1f;
} else {
if (dComIfGp_getVibration().CheckQuake() || fopAcM_otoCheck(i_this, 1000.0f) > 400) {
i_this->mOto = 0x14;
}
if (i_this->mOto) {
i_this->mOto--;
cLib_addCalc2(&i_this->mLength, 0.15f, 1.0f, 0.015f);
} else {
cLib_addCalc2(&i_this->mLength, 0.01f, 1.0f, 0.0005f);
}
}
f32 oppDist = cM_ssin(i_this->mCycleCtr * 0x320) * i_this->mLength;
MtxRotX(oppDist, 1);
f32 adjDist = cM_scos(i_this->mCycleCtr * 0x2bc) * i_this->mLength;
MtxRotZ(adjDist, 1);
MtxScale(0.4f, 0.4f, 0.4f, 1);
i_this->mModel->setBaseTRMtx(*calc_mtx);
MtxTrans(10.0f, -140.0f, -15.0f, 1);
cXyz offset;
offset.z = 0.0f;
offset.y = 0.0f;
offset.x = 0.0f;
MtxPosition(&offset, &i_this->mPos);
if (!i_this->mParticleInit) {
static cXyz fire_scale(0.5f, 0.5f, 0.5f);
dComIfGp_particle_set(dPa_name::ID_AK_JN_TORCH, &i_this->mPos, NULL, &fire_scale, 0xFF, &i_this->mPa);
i_this->mParticleInit = 1;
i_this->mParticlePower = 1.0f;
}
if (i_this->mPa.getEmitter()) {
cXyz whitePartPos = i_this->mPos;
whitePartPos.y += 20.0f;
dComIfGp_particle_setSimple(dPa_name::ID_AK_JP_O_KAGEROU00, &whitePartPos);
cLib_addCalc2(&i_this->mParticlePower, cM_rndF(0.2f) + 1.0f, 0.5f, 0.02f);
} else {
i_this->mParticlePower = 0.0f;
}
i_this->mInf.mPos = i_this->mPos;
i_this->mInf.mColor.r = 600;
i_this->mInf.mColor.g = 400;
i_this->mInf.mColor.b = 120;
s16 power = i_this->mParticlePower * 150.0f;
i_this->mInf.mPower = power;
i_this->mInf.mFluctuation = 250.0f;
i_this->mSph.SetC(i_this->mPos);
dComIfG_Ccsp()->Set(&i_this->mSph);
if (!i_this->mHitTimeoutLeft) {
if (i_this->mSph.ChkTgHit()) {
cCcD_Obj* pHitObj = i_this->mSph.GetTgHitObj();
if (pHitObj && pHitObj->ChkAtType(AT_TYPE_WIND | AT_TYPE_UNK400000)) {
i_this->mHitAngle = dComIfGp_getPlayer(0)->shape_angle.y;
i_this->mHitTimeoutLeft = 0x28;
}
}
} else {
i_this->mHitTimeoutLeft--;
if (i_this->mPa.getEmitter()) {
float tgtZ;
if (i_this->mHitTimeoutLeft > 10) {
tgtZ = 4.0f;
} else {
tgtZ = 0.0f;
}
cLib_addCalc2(&i_this->mHitReactCurZ, tgtZ, 1.0f, 0.5f);
cMtx_YrotS(*calc_mtx, i_this->mHitAngle);
cXyz offset;
offset.set(0.0f, 1.0f, i_this->mHitReactCurZ);
cXyz rotOffset;
MtxPosition(&offset, &rotOffset);
JGeometry::TVec3<f32> dir(rotOffset);
i_this->mPa.getEmitter()->setDirection(dir);
}
}
return TRUE;
}
/* 00000604-00000634 .text daLamp_IsDelete__FP10lamp_class */
static BOOL daLamp_IsDelete(lamp_class* i_this) {
i_this->mPa.remove();
return TRUE;
}
/* 00000634-00000678 .text daLamp_Delete__FP10lamp_class */
static BOOL daLamp_Delete(lamp_class* i_this) {
dComIfG_resDelete(&i_this->mPhs, "Lamp");
dKy_plight_cut(&i_this->mInf);
return TRUE;
}
/* 00000678-0000073C .text useHeapInit__FP10lamp_class */
static BOOL useHeapInit(lamp_class* i_this) {
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes("Lamp", dRes_INDEX_LAMP_BMD_LAMP_00_e));
JUT_ASSERT(0x170, modelData != NULL);
i_this->mModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203);
if (i_this->mModel == 0) {
return FALSE;
} else {
return TRUE;
}
}
/* 0000073C-0000075C .text daLamp_solidHeapCB__FP10fopAc_ac_c */
static BOOL daLamp_solidHeapCB(fopAc_ac_c* i_ac) {
return useHeapInit((lamp_class*)i_ac);
}
/* 0000075C-00000914 .text daLamp_Create__FP10fopAc_ac_c */
static cPhs_State daLamp_Create(fopAc_ac_c* i_ac) {
fopAcM_ct(i_ac, lamp_class);
lamp_class* i_this = (lamp_class*)i_ac;
cPhs_State phase_state = dComIfG_resLoad(&i_this->mPhs, "Lamp");
if (phase_state == cPhs_COMPLEATE_e) {
if (fopAcM_entrySolidHeap(i_this, &daLamp_solidHeapCB, 0x6040)) {
i_this->mParameters = fopAcM_GetParam(i_this);
if (i_this->mParameters == 0xFF) {
i_this->mParameters = 0;
}
i_this->mStts.Init(0xff, 0xff, i_this);
static dCcD_SrcSph sph_src = {
// dCcD_SrcGObjInf
{
/* Flags */ 0,
/* SrcObjAt Type */ 0,
/* SrcObjAt Atp */ 0,
/* SrcObjAt SPrm */ 0,
/* SrcObjTg Type */ AT_TYPE_FIRE | AT_TYPE_UNK20000 | AT_TYPE_FIRE_ARROW | AT_TYPE_WIND | AT_TYPE_UNK400000,
/* SrcObjTg SPrm */ cCcD_TgSPrm_Set_e | cCcD_TgSPrm_IsOther_e,
/* SrcObjCo SPrm */ 0,
/* SrcGObjAt Se */ 0,
/* SrcGObjAt HitMark */ 0,
/* SrcGObjAt Spl */ 0,
/* SrcGObjAt Mtrl */ 0,
/* SrcGObjAt SPrm */ 0,
/* SrcGObjTg Se */ 0,
/* SrcGObjTg HitMark */ 0,
/* SrcGObjTg Spl */ 0,
/* SrcGObjTg Mtrl */ 0,
/* SrcGObjTg SPrm */ 0,
/* SrcGObjCo SPrm */ 0,
},
// cM3dGSphS
{{
/* Center */ {0.0f, 0.0f, 0.0f},
/* Radius */ 30.0f,
}},
};
i_this->mSph.Set(sph_src);
i_this->mSph.SetStts(&i_this->mStts);
i_this->mCycleCtr = cM_rndFX(0x8000);
for (int i = 0; i < 2; i++) {
daLamp_Execute(i_this);
}
dKy_plight_set(&i_this->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 = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0007,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_LAMP_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(lamp_class),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_LAMP_e,
/* Actor SubMtd */ &l_daLamp_Method,
/* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_0_e,
};
|