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
|
//
// Generated by dtk
// Translation Unit: d_ky_thunder.cpp
//
#include "f_op/f_op_kankyo.h"
#include "f_op/f_op_kankyo_mng.h"
#include "f_op/f_op_camera.h"
#include "d/d_com_inf_game.h"
#include "d/d_kankyo_rain.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
#include "SSystem/SComponent/c_phase.h"
#include "m_Do/m_Do_audio.h"
#include "m_Do/m_Do_ext.h"
#include "m_Do/m_Do_mtx.h"
class dThunder_c : public kankyo_class {
public:
inline ~dThunder_c();
BOOL createHeap();
void adjustHeap();
s32 create();
inline BOOL draw();
inline BOOL execute();
public:
/* 0x0F8 */ JKRSolidHeap * solid_heap;
/* 0x0FC */ J3DModel * mpModel;
/* 0x100 */ mDoExt_invisibleModel mInvisModel;
/* 0x108 */ mDoExt_btkAnm mBtk;
/* 0x11C */ mDoExt_brkAnm mBrk;
/* 0x134 */ cXyz mScale;
/* 0x140 */ cXyz mPos;
/* 0x14C */ cXyz mPosNeg;
/* 0x150 */ f32 mRot;
/* 0x154 */ f32 mBtkTime;
};
dThunder_c::~dThunder_c() {
mDoAud_seDeleteObject(&mPos);
mDoAud_seDeleteObject(&mPosNeg);
if (solid_heap != NULL)
mDoExt_destroySolidHeap(solid_heap);
}
BOOL dThunder_c::execute() {
mBrk.setPlaySpeed(1.0f);
if (mBrk.play()) {
mDoAud_seStart(JA_SE_OBJ_THUNDER_FAR, &mPos, 0, 0);
fopKyM_Delete(this);
}
return TRUE;
}
BOOL dThunder_c::draw() {
static cXyz l_offsetPos(0.0f, 40.0f, -250.0f);
mDoMtx_stack_c::transS(mPos);
mDoMtx_stack_c::ZrotM(mRot);
mDoMtx_stack_c::XrotM(mRot);
Mtx m;
MTXCopy(mDoMtx_stack_c::get(), m);
mpModel->setBaseScale(mScale);
mpModel->setBaseTRMtx(m);
mBtk.entry(mpModel->getModelData(), mBtkTime);
mBrk.entry(mpModel->getModelData());
dComIfGd_setList();
mDoExt_modelUpdateDL(mpModel);
mInvisModel.entryMaskOff();
mBtk.remove(mpModel->getModelData());
mBrk.remove(mpModel->getModelData());
return TRUE;
}
/* 80198810-8019886C .text createHeap__10dThunder_cFv */
BOOL dThunder_c::createHeap() {
if (solid_heap == NULL) {
solid_heap = mDoExt_createSolidHeapFromGameToCurrent(0x4a0, 0x20);
if (solid_heap == NULL)
return FALSE;
}
return TRUE;
}
/* 8019886C-801988B8 .text adjustHeap__10dThunder_cFv */
void dThunder_c::adjustHeap() {
mDoExt_restoreCurrentHeap();
if (mDoExt_adjustSolidHeap(solid_heap) >= 0)
DCStoreRangeNoSync(solid_heap->getStartAddr(), solid_heap->getHeapSize());
}
/* 801988B8-80198A38 .text dThunder_Draw__FP10dThunder_c */
BOOL dThunder_Draw(dThunder_c* i_this) {
return i_this->draw();
}
/* 80198A38-80198AB4 .text dThunder_Execute__FP10dThunder_c */
BOOL dThunder_Execute(dThunder_c* i_this) {
return i_this->execute();
}
/* 80198AB4-80198ABC .text dThunder_IsDelete__FP10dThunder_c */
BOOL dThunder_IsDelete(dThunder_c* i_this) {
return TRUE;
}
/* 80198ABC-80198B68 .text dThunder_Delete__FP10dThunder_c */
BOOL dThunder_Delete(dThunder_c* i_this) {
i_this->~dThunder_c();
return TRUE;
}
/* 80198B68-80198BC4 .text dThunder_Create__FP12kankyo_class */
s32 dThunder_Create(kankyo_class* i_ky) {
dThunder_c * i_this = (dThunder_c *)i_ky;
if (!i_this->createHeap())
return cPhs_ERROR_e;
s32 ret = i_this->create();
i_this->adjustHeap();
return ret;
}
/* 80198BC4-801990CC .text create__10dThunder_cFv */
s32 dThunder_c::create() {
s32 ret;
camera_class *pCamera = dComIfGp_getCamera(0);
new(this) dThunder_c();
J3DModelData *modelData = (J3DModelData *)dComIfG_getObjectRes("Always", ALWAYS_BDL_YTHDR00);
JUT_ASSERT(0x6e, modelData != 0);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x01000200);
if (mpModel == NULL)
return cPhs_ERROR_e;
if (!mInvisModel.create(mpModel))
return cPhs_ERROR_e;
J3DAnmTextureSRTKey * anm = (J3DAnmTextureSRTKey *)dComIfG_getObjectRes("Always", ALWAYS_BTK_YTHDR00);
JUT_ASSERT(0x7d, anm != 0);
if (!mBtk.init(mpModel->getModelData(), anm, false, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false, 0))
return cPhs_ERROR_e;
J3DAnmTevRegKey * canm = (J3DAnmTevRegKey *)dComIfG_getObjectRes("Always", ALWAYS_BRK_YTHDR00);
JUT_ASSERT(0x8c, canm != 0);
if (!mBrk.init(mpModel->getModelData(), canm, true, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1, false, 0))
return cPhs_ERROR_e;
mBtkTime = cM_rndF(1.0f);
f32 size = g_env_light.mThunderEff.mStateTimer < 10 ? 1.0f : 0.5f;
mRot = 4000.0f;
mRot = size * cM_rndFX(mRot);
mScale.x = size * (cM_rndF(15.0f) + 5.0f);
if (cM_rndFX(1.0) >= 0.5f)
mScale.x *= -1.0f;
mScale.y = size * (cM_rndF(60.0f) + 20.0f);
mScale.z = 1.0f;
cXyz fwd;
dKyr_get_vectle_calc(&pCamera->mLookat.mEye, &pCamera->mLookat.mCenter, &fwd);
f32 distXZ = fwd.absXZ();
s16 rotX = cM_atan2s(fwd.x, fwd.z);
s16 rotY = cM_atan2s(fwd.y, distXZ);
if (cM_rndFX(1.0f) >= 0.0f) {
rotX += 0x4000;
} else {
rotX -= 0x4000;
}
f32 y = cM_scos(rotY);
f32 x = cM_ssin(rotX);
f32 z = cM_scos(rotX);
f32 baseXZ = cM_rndF(120000.f);
f32 baseY = cM_rndFX(2000.0f);
mPos.x = pCamera->mLookat.mEye.x + fwd.x * 100000.0f + y * x * baseXZ;
mPos.x = pCamera->mLookat.mEye.x + baseY;
mPos.z = pCamera->mLookat.mEye.z + fwd.z * 100000.0f + y * z * baseXZ;
if (cM_rndF(1.0f) < 0.3) {
mPosNeg.x = -mPos.x;
mPosNeg.y = -mPos.y;
mPosNeg.z = -mPos.z;
mDoAud_seStart(JA_SE_OBJ_THUNDER_FAR, &mPosNeg, 0, 0);
}
return cPhs_COMPLEATE_e;
}
|