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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
//
// d_a_obj_lv3Candle.cpp
// Object - Level 3 Candle
//
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_lv3Candle.h"
#include "d/d_com_inf_game.h"
#include "d/d_s_play.h"
#include "d/d_cc_uty.h"
class daLv3Candle_HIO_c : public mDoHIO_entry_c {
public:
daLv3Candle_HIO_c();
virtual ~daLv3Candle_HIO_c() {}
void genMessage(JORMContext*);
/* 0x00 vtable */
/* 0x04 */ u8 mTimer; // Written to, but never read
};
static daLv3Candle_HIO_c l_HIO;
daLv3Candle_HIO_c::daLv3Candle_HIO_c() {
mTimer = 0x1e;
}
#if DEBUG
void daLv3Candle_HIO_c::genMessage(JORMContext* mctx) {
mctx->genSlider("timer", &mTimer, 0, 0xFF);
}
#endif
dCcD_SrcGObjInf const daLv3Candle_c::mCcDObjInfo = {
{0, {{0x200, 0, 0x13}, {0xd8fbfdff, 0x1f}, {0x79}}},
{1, 0, 0, 0, 0},
{0xa, 0, 0, 0, 6},
{0},
};
dCcD_SrcSph daLv3Candle_c::mCcDSph = {daLv3Candle_c::mCcDObjInfo, {{{0.0f, 0.0f, 0.0f}, 0.0f}}};
static char* l_resNameIdx[] = {"L3candl", "L3candl2"};
void daLv3Candle_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, current.angle.z);
mpModel->setBaseScale(scale);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
static u32 const l_bmdIdx[] = {0x03, 0x03};
int daLv3Candle_c::CreateHeap() {
J3DModelData* modelData =
(J3DModelData*)dComIfG_getObjectRes(l_resNameIdx[mType], l_bmdIdx[mType]);
JUT_ASSERT(226, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
if (mpModel == NULL) {
return FALSE;
}
return TRUE;
}
cPhs_Step daLv3Candle_c::create() {
fopAcM_ct(this, daLv3Candle_c);
mType = getType();
if (mType == 0xff) {
mType = 0;
}
cPhs_Step step = dComIfG_resLoad(&mPhaseReq, l_resNameIdx[mType]);
if (step == cPhs_COMPLEATE_e) {
if (!fopAcM_entrySolidHeap(this, createHeapCallBack, 0x900)) {
return cPhs_ERROR_e;
} else {
setBaseMtx();
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
fopAcM_setCullSizeBox2(this, mpModel->getModelData());
mStts.Init(0xff, 0xff, this);
mSph.Set(mCcDSph);
mSph.SetStts(&mStts);
mTorchPos = current.pos;
if (mType == 0) {
cXyz v(0.0f, 20.0f, 125.0f);
mDoMtx_stack_c::ZXYrotS(shape_angle.x, shape_angle.y, shape_angle.z);
mDoMtx_stack_c::multVec(&v, &v);
mTorchPos += v;
} else {
mTorchPos.y -= 200.0f;
}
mIsLit = getSwBit();
if (mIsLit == 0xff) {
mIsLit = 0;
}
lightInit();
eyePos = mTorchPos;
mSound.init(¤t.pos, 1);
mTgHit = 0;
}
}
return step;
}
int daLv3Candle_c::createHeapCallBack(fopAc_ac_c* i_this) {
daLv3Candle_c* actor = static_cast<daLv3Candle_c*>(i_this);
return actor->CreateHeap();
}
void daLv3Candle_c::lightInit() {
mLightPos = mTorchPos;
mLightPos.y += 10.0f;
if (mIsLit) {
mLight.mPosition = mLightPos;
mLight.mColor.r = 188;
mLight.mColor.g = 102;
mLight.mColor.b = 66;
mLight.mPow = 500.0f;
mLight.mFluctuation = 1.0f;
return;
}
mIntensity = 0.0f;
}
void daLv3Candle_c::pointLightProc() {
if (mIsLit)
return;
GXColor color = {188, 102, 66, 255};
cLib_addCalc(&mIntensity, 1.0f, 0.5f, 0.1f, 0.0001f);
if (mIntensity >= 0.000001f)
dKy_BossLight_set(&mLightPos, &color, mIntensity, 0);
}
int daLv3Candle_c::Execute() {
dComIfGp_particle_setSimple(0x100, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f);
dComIfGp_particle_setSimple(0x101, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f);
dComIfGp_particle_setSimple(0x103, &mTorchPos, 0xff, g_whiteColor, g_whiteColor, 0, 0.0f);
mDoAud_seStartLevel(Z2SE_OBJ_FIRE_BURNING, &mTorchPos, 0,
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
if (mSph.ChkTgHit()) {
cCcD_Obj* obj = mSph.GetTgHitObj();
if (obj != NULL) {
u8 play_sound = true;
fopAc_ac_c* actor = dCc_GetAc(obj->GetAc());
if (fopAcM_GetName(actor) == fpcNm_ALINK_e) {
dCcD_GObjInf* gobj = mSph.GetTgHitGObj();
if (gobj->GetAtType() & AT_TYPE_NORMAL_SWORD && mTgHit != 0) {
play_sound = false;
}
}
if (play_sound) {
u32 se_id = mSph.GetTgHitObjHitSeID(1);
mSound.startCollisionSE(se_id, 9, NULL);
}
}
} else {
mTgHit = 0;
}
mSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
setBaseMtx();
cXyz pos = current.pos;
if (mType == 0) {
mSph.SetR(90.0f + oREG_F(0));
pos.z += 70.0f + oREG_F(1);
} else {
mSph.SetR(60.0f + oREG_F(3));
pos.y -= 200.0f + oREG_F(2);
}
mSph.SetC(pos);
dComIfG_Ccsp()->Set(&mSph);
pointLightProc();
return TRUE;
}
int daLv3Candle_c::Draw() {
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
dComIfGd_setListBG();
mDoExt_modelUpdateDL(mpModel);
dComIfGd_setList();
return TRUE;
}
int daLv3Candle_c::Delete() {
mSound.deleteObject();
dComIfG_resDelete(&mPhaseReq, l_resNameIdx[mType]);
if (mIsLit) {
dKy_plight_cut(&mLight);
}
return TRUE;
}
static int daLv3Candle_Draw(daLv3Candle_c* i_this) {
return static_cast<daLv3Candle_c*>(i_this)->Draw();
}
static int daLv3Candle_Execute(daLv3Candle_c* i_this) {
return static_cast<daLv3Candle_c*>(i_this)->Execute();
}
static int daLv3Candle_Delete(daLv3Candle_c* i_this) {
fopAcM_RegisterDeleteID(i_this, "daLv3Candle");
return static_cast<daLv3Candle_c*>(i_this)->Delete();
}
static int daLv3Candle_Create(fopAc_ac_c* i_this) {
daLv3Candle_c* const actor = static_cast<daLv3Candle_c*>(i_this);
fopAcM_RegisterCreateID(i_this, "daLv3Candle");
return actor->create();
}
static actor_method_class l_daLv3Candle_Method = {
(process_method_func)daLv3Candle_Create, (process_method_func)daLv3Candle_Delete,
(process_method_func)daLv3Candle_Execute, NULL,
(process_method_func)daLv3Candle_Draw,
};
actor_process_profile_definition g_profile_Obj_Lv3Candle = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 7,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_Lv3Candle_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daLv3Candle_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_Lv3Candle_e,
/* Actor SubMtd */ &l_daLv3Candle_Method,
/* Status */ fopAcStts_UNK_0x40000_e | fopAcStts_NOPAUSE_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|