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
|
/**
* @file d_a_obj_lv6FurikoTrap.cpp
*
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/d_s_play.h"
#include "d/actor/d_a_obj_lv6FurikoTrap.h"
daLv6FurikoTrap_HIO_c::daLv6FurikoTrap_HIO_c() {
mIntervalSeconds = 1.0f;
mMaxAngle = 45.0f;
unk10 = 3;
}
#if DEBUG
void daLv6FurikoTrap_HIO_c::genMessage(JORMContext* context) {
context->genSlider("周期(秒)", &mIntervalSeconds, 0.1f, 100.0f);
context->genSlider("最大角度", &mMaxAngle, 0.1f, 90.0f);
}
#endif
static daLv6FurikoTrap_HIO_c l_HIO;
const dCcD_SrcGObjInf daLv6FurikoTrap_c::mCcDObjInfo = {
{0, {{0x800, 1, 0x1f}, {0, 0}, {0x79}}},
{1, 0, 1, 0, 1},
{0xa, 5, 0, 0, 0},
{0},
};
dCcD_SrcSph daLv6FurikoTrap_c::mCcDSph = {mCcDObjInfo};
void daLv6FurikoTrap_c::setBaseMtx() {
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);
mModel->setBaseScale(scale);
mModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
int daLv6FurikoTrap_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("L6Furiko", 4);
JUT_ASSERT(236, modelData != NULL);
mModel = mDoExt_J3DModel__create(modelData, 0, 0x11000084);
if (mModel == NULL) {
return FALSE;
}
return TRUE;
}
int daLv6FurikoTrap_c::create() {
fopAcM_ct(this, daLv6FurikoTrap_c);
int phase = dComIfG_resLoad(&mPhase, "L6Furiko");
if (phase == cPhs_COMPLEATE_e) {
if (MoveBGCreate("L6Furiko", 7, dBgS_MoveBGProc_TypicalRotY, 0x2e80, NULL) == cPhs_ERROR_e)
{
return cPhs_ERROR_e;
}
fopAcM_SetMtx(this, mModel->getBaseTRMtx());
fopAcM_setCullSizeBox2(this, mModel->getModelData());
init_modeMove();
setBaseMtx();
mCcStts.Init(0xff, 0, this);
for (int i = 0; i < 13; i++) {
mCcSph1[i].Set(mCcDSph);
mCcSph1[i].SetStts(&mCcStts);
}
for (int i = 0; i < 6; i++) {
mCcSph2[i].Set(mCcDSph);
mCcSph2[i].SetStts(&mCcStts);
}
#if DEBUG
l_HIO.entryHIO("振り子トラップ(Lv6)");
#endif
}
return phase;
}
int daLv6FurikoTrap_c::Execute(Mtx** i_pMtx) {
move();
*i_pMtx = &mModel->getBaseTRMtx();
setBaseMtx();
for (int i = 0; i < 13; i++) {
cXyz c(0.0f, -850.0f + oREG_F(0), 0.0f);
mDoMtx_stack_c::ZrotS(cM_deg2s((-21.5f + oREG_F(2)) + i * (3.6f + oREG_F(3))));
mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z);
mDoMtx_stack_c::multVec(&c, &c);
c += current.pos;
mCcSph1[i].SetR(30.0f + oREG_F(4));
mCcSph1[i].SetC(c);
dComIfG_Ccsp()->Set(&mCcSph1[i]);
mCcSph1[i].ClrAtHit();
}
for (int i = 0; i < 3; i++) {
static f32 posx[] = {383.0f, 356.0f, 329.0f};
static f32 posy[] = {-660.0f, -700.0f, -740.0f};
cXyz c(posx[i] + oREG_F(5), posy[i] + oREG_F(6), 0.0f);
cXyz c2(-posx[i] + oREG_F(5), posy[i] + oREG_F(6), 0.0f);
mDoMtx_stack_c::ZXYrotS(shape_angle.x, shape_angle.y, shape_angle.z);
mDoMtx_stack_c::multVec(&c, &c);
mDoMtx_stack_c::multVec(&c2, &c2);
c += current.pos;
c2 += current.pos;
mCcSph2[i].SetR(30.0f + oREG_F(4));
mCcSph2[i + 3].SetR(30.0f + oREG_F(4));
mCcSph2[i].SetC(c);
mCcSph2[i + 3].SetC(c2);
dComIfG_Ccsp()->Set(&mCcSph2[i]);
dComIfG_Ccsp()->Set(&mCcSph2[i + 3]);
mCcSph2[i].ClrAtHit();
}
mCcStts.Move();
return TRUE;
}
void daLv6FurikoTrap_c::move() {
typedef void (daLv6FurikoTrap_c::*func_call)();
static const func_call mode_proc[] = {
&daLv6FurikoTrap_c::modeMove
};
(this->*mode_proc[mMode])();
}
void daLv6FurikoTrap_c::init_modeMove() {
mAngle = 0;
mTimer = 0;
mMode = 0;
}
void daLv6FurikoTrap_c::modeMove() {
int unused = shape_angle.z;
mAngleIncrement = cM_deg2s((2.0f * l_HIO.mMaxAngle) / (30.0f * l_HIO.mIntervalSeconds));
s16 s = cM_deg2s(cM_scos(mAngle) * l_HIO.mMaxAngle);
shape_angle.z = s;
mAngle += mAngleIncrement;
if (std::fabs(cM_scos(mAngle)) > 0.999f && mTimer == 0) {
mTimer = 3;
cXyz c(0.0f, -940.0f, 0.0f);
mDoMtx_stack_c::ZXYrotS(shape_angle.x, shape_angle.y, shape_angle.z);
mDoMtx_stack_c::multVec(&c, &c);
c += current.pos;
mDoAud_seStart(Z2SE_OBJ_L6_BLADE, &c, (u32)fopAcM_GetSpeedF(this),
dComIfGp_getReverb(fopAcM_GetRoomNo(this)));
}
if (mTimer != 0) {
mTimer--;
}
}
int daLv6FurikoTrap_c::Draw() {
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType_MAJI(mModel, &tevStr);
fopAcM_setEffectMtx(this, mModel->getModelData());
dComIfGd_setListBG();
mDoExt_modelUpdateDL(mModel);
dComIfGd_setList();
return TRUE;
}
int daLv6FurikoTrap_c::Delete() {
dComIfG_resDelete(&mPhase, "L6Furiko");
#if DEBUG
l_HIO.removeHIO();
#endif
return TRUE;
}
static int daLv6FurikoTrap_Draw(daLv6FurikoTrap_c* i_this) {
return i_this->MoveBGDraw();
}
static int daLv6FurikoTrap_Execute(daLv6FurikoTrap_c* i_this) {
return i_this->MoveBGExecute();
}
static int daLv6FurikoTrap_Delete(daLv6FurikoTrap_c* i_this) {
fpc_ProcID id = fopAcM_GetID(i_this);
return i_this->MoveBGDelete();
}
static int daLv6FurikoTrap_Create(fopAc_ac_c* i_this) {
daLv6FurikoTrap_c* this_trap = (daLv6FurikoTrap_c*)i_this;
fpc_ProcID id = fopAcM_GetID(i_this);
return this_trap->create();
}
static actor_method_class l_daLv6FurikoTrap_Method = {
(process_method_func)daLv6FurikoTrap_Create,
(process_method_func)daLv6FurikoTrap_Delete,
(process_method_func)daLv6FurikoTrap_Execute,
0,
(process_method_func)daLv6FurikoTrap_Draw,
};
actor_process_profile_definition g_profile_Obj_Lv6FuriTrap = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 3,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_Obj_Lv6FuriTrap_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daLv6FurikoTrap_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_Obj_Lv6FuriTrap_e,
/* Actor SubMtd */ &l_daLv6FurikoTrap_Method,
/* Status */ fopAcStts_UNK_0x40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|