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
|
/**
* d_a_scene_exit2.cpp
* Grotto Scene Exit trigger
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_scene_exit2.h"
#include "d/d_com_inf_game.h"
#include "f_pc/f_pc_name.h"
void daScExit_c::initBaseMtx() {
setBaseMtx();
}
void daScExit_c::setBaseMtx() {
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::ZXYrotM(shape_angle);
}
static char* l_arcName = "SceneExit";
static char* l_evName = "SCENE_EXIT";
int daScExit_c::Create() {
mRadius = scale.x * 100.0f;
initBaseMtx();
mToolID = 0xFF;
eventInfo.setArchiveName(l_arcName);
mEventID = dComIfGp_getEventManager().getEventIdx(this, l_evName, 0xFF);
return 1;
}
int daScExit_c::create() {
fopAcM_ct(this, daScExit_c);
int phase = dComIfG_resLoad(&mPhase, l_arcName);
if (phase == cPhs_COMPLEATE_e) {
if (!Create()) {
return cPhs_ERROR_e;
}
}
return phase;
}
int daScExit_c::execute() {
event_proc_call();
return 1;
}
void daScExit_c::event_proc_call() {
typedef void (daScExit_c::*actionFunc)();
static actionFunc l_func[] = {&daScExit_c::actionWait, &daScExit_c::actionOrderEvent,
&daScExit_c::actionEvent, &daScExit_c::actionDead};
(this->*l_func[mAction])();
}
void daScExit_c::actionWait() {
if (checkArea()) {
setAction(ACTION_ORDER_EVENT_e);
fopAcM_orderOtherEventId(this, mEventID, mToolID, 0xFFFF, 0, 1);
eventInfo.onCondition(2);
}
}
void daScExit_c::actionOrderEvent() {
if (eventInfo.checkCommandDemoAccrpt()) {
setAction(ACTION_EVENT_e);
demoProc();
dComIfGp_setPlayerStatus1(0, 0x4000000);
} else {
fopAcM_orderOtherEventId(this, mEventID, mToolID, 0xFFFF, 0, 1);
eventInfo.onCondition(2);
}
}
void daScExit_c::actionEvent() {
if (dComIfGp_evmng_endCheck(mEventID)) {
setAction(ACTION_DEAD_e);
dComIfGp_event_reset();
} else {
demoProc();
dComIfGp_setPlayerStatus1(0, 0x4000000);
}
}
void daScExit_c::actionDead() {}
int daScExit_c::demoProc() {
static char* action_table[3] = {"WAIT", "START", "SCENE_CHG"};
u8 scene_id = getSceneID();
int act_id = dComIfGp_evmng_getMyActIdx(mStaffID, action_table, 3, 0, 0);
if (dComIfGp_evmng_getIsAddvance(mStaffID)) {
switch (act_id) {
case WAIT_e: {
int* timer_p = dComIfGp_evmng_getMyIntegerP(mStaffID, "Timer");
if (timer_p == NULL) {
mTimer = 1;
} else {
mTimer = *timer_p;
}
break;
}
case START_e:
fopAcM_seStart(this, Z2SE_SY_WARP_FADE, 0);
attention_info.position.y = current.pos.y + 800.0f;
eyePos.y = attention_info.position.y;
break;
case SCENE_CHG_e:
break;
}
}
switch (act_id) {
case WAIT_e:
if (cLib_calcTimer(&mTimer) == 0) {
dComIfGp_evmng_cutEnd(mStaffID);
}
break;
case START_e:
dComIfGp_evmng_cutEnd(mStaffID);
break;
case SCENE_CHG_e:
dStage_changeScene(scene_id, 0.0f, 0, fopAcM_GetRoomNo(this), 0, -1);
break;
default:
dComIfGp_evmng_cutEnd(mStaffID);
break;
}
return 0;
}
BOOL daScExit_c::checkArea() {
return fopAcM_searchPlayerDistanceXZ(this) < mRadius;
}
int daScExit_c::draw() {
return 1;
}
int daScExit_c::_delete() {
dComIfG_resDelete(&mPhase, l_arcName);
return 1;
}
static int daScExit_Draw(daScExit_c* i_this) {
return i_this->draw();
}
static int daScExit_Execute(daScExit_c* i_this) {
return i_this->execute();
}
static int daScExit_Delete(daScExit_c* i_this) {
return i_this->_delete();
}
static int daScExit_Create(daScExit_c* i_this) {
return i_this->create();
}
static actor_method_class l_daScExit_Method = {
(process_method_func)daScExit_Create, (process_method_func)daScExit_Delete,
(process_method_func)daScExit_Execute, (process_method_func)NULL,
(process_method_func)daScExit_Draw,
};
actor_process_profile_definition g_profile_SCENE_EXIT2 = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 7,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_SCENE_EXIT2_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daScExit_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_SCENE_EXIT2_e,
/* Actor SubMtd */ &l_daScExit_Method,
/* Status */ fopAcStts_UNK_0x40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|