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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
/**
* d_a_shop_item.cpp
* Item - Shop Item
*/
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_shop_item.h"
#include "f_op/f_op_actor_mng.h"
#include "d/d_com_inf_game.h"
#include "d/d_s_play.h"
#include "d/d_item.h"
#include "d/d_item_data.h"
#include "d/d_cloth_packet.h"
#include "res/Object/Fdai.h"
#include "res/Object/Cloth.h"
#include "m_Do/m_Do_mtx.h"
#include "m_Do/m_Do_lib.h"
const char daShopItem_c::m_cloth_arcname[] = "Cloth";
const f32 daShopItem_c::m_cullfar_max = 5000.0f;
/* 00000078-000000D8 .text getShopArcname__12daShopItem_cFv */
char* daShopItem_c::getShopArcname() {
u8 type = fopAcM_GetParamBit(fopAcM_GetParam(this), 8, 4);
if(type == 1 || (type == 0 && mModelType[m_itemNo] == 0x01)) {
return dItem_data::getFieldArc(m_itemNo);
}
else {
return dItem_data::getArcname(m_itemNo);
}
}
/* 000000D8-00000140 .text getShopBmdIdx__12daShopItem_cFv */
s16 daShopItem_c::getShopBmdIdx() {
u8 type = fopAcM_GetParamBit(fopAcM_GetParam(this), 8, 4);
if(type == 1 || (type == 0 && mModelType[m_itemNo] == 0x01)) {
return dItem_data::getFieldBmdIdx(m_itemNo);
}
else {
return dItem_data::getBmdIdx(m_itemNo);
}
}
/* 00000140-00000240 .text CreateInit__12daShopItem_cFv */
void daShopItem_c::CreateInit() {
fopAcM_SetMtx(this, field_0x64C);
fopAcM_setCullSizeBox(this, -100.0f, 0.0f, -100.0f, 100.0f, 200.0f, 100.0f);
if(mDoLib_clipper::getFar() > 1.0f) {
fopAcM_setCullSizeFar(this, 5000.0f / mDoLib_clipper::getFar());
}
show();
scale = getData()[m_itemNo].mScale;
home.pos = current.pos;
set_mtx();
if(isDaizaItem(m_itemNo)) {
mTevType = TEV_TYPE_ACTOR;
}
else {
mTevType = TEV_TYPE_BG1_PLIGHT;
}
mpModel->setUserArea(0);
}
/* 00000240-000003BC .text clothCreate__12daShopItem_cFv */
BOOL daShopItem_c::clothCreate() {
if(isUseClothPacket(m_itemNo)) {
dCloth_packet_c::CreateFunc clothFunc[4] = {
(dCloth_packet_c::CreateFunc)dClothVobj03_create,
(dCloth_packet_c::CreateFunc)dClothVobj04_create,
(dCloth_packet_c::CreateFunc)dClothVobj05_create,
(dCloth_packet_c::CreateFunc)dClothVobj07_0_create
};
u32 clothRes[4] = {
dRes_INDEX_FDAI_BTI_FTEX03_e,
dRes_INDEX_FDAI_BTI_FTEX04_e,
dRes_INDEX_FDAI_BTI_FTEX05_e,
dRes_INDEX_FDAI_BTI_FTEX07_e
};
switch(m_itemNo) {
case dItemNo_HEROS_FLAG_e:
field_0x648 = 0;
break;
case dItemNo_BIG_CATCH_FLAG_e:
field_0x648 = 1;
break;
case dItemNo_BIG_SALE_FLAG_e:
field_0x648 = 2;
break;
case dItemNo_SICKLE_MOON_FLAG_e:
default:
field_0x648 = 3;
}
ResTIMG* shopArc = (ResTIMG*)dComIfG_getObjectRes(getShopArcname(), clothRes[field_0x648]);
ResTIMG* clothArc = (ResTIMG*)dComIfG_getObjectRes(m_cloth_arcname, dRes_INDEX_CLOTH_BTI_CLOTHTOON_e);
field_0x644 = (*clothFunc[field_0x648])(shopArc, clothArc, &tevStr, 0);
if (field_0x644 == 0) {
return FALSE;
}
}
else {
field_0x644 = 0;
}
return TRUE;
}
/* 000003BC-000005A8 .text set_mtx__12daShopItem_cFv */
void daShopItem_c::set_mtx() {
mpModel->setBaseScale(scale);
MTXTrans(mDoMtx_stack_c::get(), current.pos.x, current.pos.y, current.pos.z);
mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, current.angle.z);
MTXCopy(mDoMtx_stack_c::get(), field_0x64C);
const Vec& temp1 = getData()[m_itemNo].field_0x0C;
mDoMtx_stack_c::transM(temp1.x, temp1.y, temp1.z);
const SVec& temp2 = getData()[m_itemNo].field_0x18;
mDoMtx_stack_c::ZXYrotM(temp2.x, temp2.y, temp2.z);
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
if(field_0x644 != 0) {
// I have no clue why Nintendo would do this but it works
cXyz local[4];
cXyz local2[4];
local2[3].set(0.0f, REG10_F(15) + 94.0f, 0.0f);
local[0].set(0.0f, REG10_F(15) + 94.0f, 0.0f);
local2[2].set(0.0f, REG10_F(15) + 94.0f, 0.0f);
local[1].set(0.0f, REG10_F(15) + 94.0f, 0.0f);
local2[1].set(0.0f, REG10_F(15) + 97.5f, 0.0f);
local[2].set(0.0f, REG10_F(15) + 97.5f, 0.0f);
local2[0].set(0.0f, REG10_F(15) + 94.0f, 0.0f);
local[3].set(0.0f, REG10_F(15) + 94.0f, 0.0f);
mDoMtx_stack_c::transM(local[field_0x648]);
mDoMtx_stack_c::YrotM(0x4000);
field_0x644->setScale(scale);
field_0x644->setMtx(mDoMtx_stack_c::get());
}
}
/* 000005A8-000005F8 .text _execute__12daShopItem_cFv */
bool daShopItem_c::_execute() {
animPlay(1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
set_mtx();
return true;
}
/* 000005F8-00000694 .text _draw__12daShopItem_cFv */
bool daShopItem_c::_draw() {
if(!chkDraw()) return true;
if(m_itemNo == dItemNo_FOUNTAIN_IDOL_e || m_itemNo == dItemNo_POSTMAN_STATUE_e) {
mpModel->getModelData()->getJointNodePointer(0)->setMtxCalc(0);
}
DrawBase();
if(field_0x644 != 0) field_0x644->cloth_draw();
return true;
}
/* 00000694-0000070C .text settingBeforeDraw__12daShopItem_cFv */
void daShopItem_c::settingBeforeDraw() {
if(isBomb(m_itemNo) || (m_itemNo == dItemNo_BOMB_BAG_e) || (m_itemNo == dItemNo_SKULL_HAMMER_e) || m_itemNo == dItemNo_SMALL_KEY_e || m_itemNo == dItemNo_SHOP_GURU_STATUE_e) {
dDlst_texSpecmapST(&eyePos, &tevStr, mpModel->getModelData(), 1.0f);
}
}
/* 0000070C-000007A4 .text setTevStr__12daShopItem_cFv */
void daShopItem_c::setTevStr() {
g_env_light.settingTevStruct(mTevType, ¤t.pos, &tevStr);
g_env_light.setLightTevColorType(mpModel, &tevStr);
for(int i = 0; i < 2; i++) {
if(mpModelArrow[i] != 0) {
g_env_light.setLightTevColorType(mpModelArrow[i], &tevStr);
}
}
}
/* 000007A4-000007C4 .text daShopItem_Create__FPv */
static cPhs_State daShopItem_Create(void* i_this) {
return static_cast<daShopItem_c*>(i_this)->_create();
}
/* 000007C4-00000AA4 .text _create__12daShopItem_cFv */
cPhs_State daShopItem_c::_create() {
fopAcM_ct(this, daShopItem_c);
m_itemNo = fopAcM_GetParamBit(fopAcM_GetParam(this), 0, 8);
const char* arcName = getShopArcname();
if (getShopBmdIdx() == -1 || arcName == 0) {
m_itemNo = dItemNo_GREEN_RUPEE_e;
}
arcName = getShopArcname();
cPhs_State result = dComIfG_resLoad(&mPhs, arcName);
if(result != cPhs_COMPLEATE_e) {
return result;
}
else {
int result2 = cPhs_COMPLEATE_e;
if(isUseClothPacket(m_itemNo)) {
result2 = dComIfG_resLoad(&mPhase, m_cloth_arcname);
}
if(result2 != cPhs_COMPLEATE_e) {
return result2;
}
else if(result == cPhs_COMPLEATE_e && result2 == cPhs_COMPLEATE_e) {
u8 type = fopAcM_GetParamBit(fopAcM_GetParam(this), 8, 4);
if(type == 2 || (type == 0 && mModelType[m_itemNo] == 0x02)) {
if(fopAcM_entrySolidHeap(this, CheckItemCreateHeap, dItem_data::getHeapSize(m_itemNo)) == 0) {
return cPhs_ERROR_e;
}
}
else if(type == 1 || (type == 0 && mModelType[m_itemNo] == 0x01)) {
if(fopAcM_entrySolidHeap(this, CheckFieldItemCreateHeap, dItem_data::getFieldHeapSize(m_itemNo)) == 0) {
return cPhs_ERROR_e;
}
}
else {
if(fopAcM_entrySolidHeap(this, CheckItemCreateHeap, dItem_data::getHeapSize(m_itemNo)) == 0) {
return cPhs_ERROR_e;
}
}
CreateInit();
}
}
return result;
}
/* 00000CCC-00000D2C .text daShopItem_Delete__FPv */
static BOOL daShopItem_Delete(void* i_this) {
daShopItem_c* inst = static_cast<daShopItem_c*>(i_this);
if(isUseClothPacket(inst->m_itemNo)) {
dComIfG_resDelete(&inst->mPhase, daShopItem_c::m_cloth_arcname);
}
inst->DeleteBase(inst->getShopArcname());
return TRUE;
}
/* 00000D2C-00000D50 .text daShopItem_Draw__FPv */
static BOOL daShopItem_Draw(void* i_this) {
return static_cast<daShopItem_c*>(i_this)->_draw();
}
/* 00000D50-00000D74 .text daShopItem_Execute__FPv */
static BOOL daShopItem_Execute(void* i_this) {
return static_cast<daShopItem_c*>(i_this)->_execute();
}
/* 00000D74-00000D7C .text daShopItem_IsDelete__FPv */
static BOOL daShopItem_IsDelete(void*) {
return TRUE;
}
static actor_method_class daShopItemMethodTable = {
(process_method_func)daShopItem_Create,
(process_method_func)daShopItem_Delete,
(process_method_func)daShopItem_Execute,
(process_method_func)daShopItem_IsDelete,
(process_method_func)daShopItem_Draw,
};
actor_process_profile_definition g_profile_ShopItem = {
/* Layer ID */ fpcLy_CURRENT_e,
/* List ID */ 0x0007,
/* List Prio */ fpcPi_CURRENT_e,
/* Proc Name */ fpcNm_ShopItem_e,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(daShopItem_c),
/* Size Other */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Draw Prio */ fpcDwPi_ShopItem_e,
/* Actor SubMtd */ &daShopItemMethodTable,
/* Status */ fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
/* Group */ fopAc_ACTOR_e,
/* Cull Type */ fopAc_CULLBOX_CUSTOM_e,
};
|