mirror of
https://github.com/zeldaret/tww.git
synced 2026-06-10 12:55:02 -04:00
465 lines
16 KiB
C++
465 lines
16 KiB
C++
//
|
|
// Generated by dtk
|
|
// Translation Unit: d_a_demo00.cpp
|
|
//
|
|
|
|
#include "d/dolzel.h" // IWYU pragma: keep
|
|
#include "d/actor/d_a_demo00.h"
|
|
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
|
|
#include "JSystem/J3DGraphBase/J3DSys.h"
|
|
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
|
#include "JSystem/JUtility/JUTNameTab.h"
|
|
#include "SSystem/SComponent/c_phase.h"
|
|
#include "d/d_com_inf_game.h"
|
|
#include "d/d_demo.h"
|
|
#include "d/d_item.h"
|
|
#include "d/d_kankyo.h"
|
|
#include "d/d_kankyo_demo.h"
|
|
#include "d/d_procname.h"
|
|
#include "d/d_priority.h"
|
|
#include "f_op/f_op_actor_mng.h"
|
|
#include "m_Do/m_Do_ext.h"
|
|
#include "m_Do/m_Do_graphic.h"
|
|
#include "m_Do/m_Do_mtx.h"
|
|
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
|
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
|
|
#include "string.h"
|
|
|
|
static void dummy() {
|
|
OSReport("V_24_tri_joint");
|
|
}
|
|
|
|
/* 800E595C-800E598C .text reset__16daDemo00_resID_cFv */
|
|
void daDemo00_resID_c::reset() {
|
|
modelID = -1;
|
|
bckID = -1;
|
|
field_0x08 = -1;
|
|
btpID = -1;
|
|
btkID = -1;
|
|
brkID = -1;
|
|
field_0x18 = -1;
|
|
field_0x1C = -1;
|
|
plightID = -1;
|
|
shadowID = -1;
|
|
}
|
|
|
|
/* 800E598C-800E59EC .text reset__16daDemo00_model_cFv */
|
|
void daDemo00_model_c::reset() {
|
|
resID.reset();
|
|
model = NULL;
|
|
btpAnm = NULL;
|
|
btkAnm = NULL;
|
|
brkAnm = NULL;
|
|
if (plight != NULL) {
|
|
dKydm_demo_plight_delete(plight);
|
|
plight = NULL;
|
|
}
|
|
shadow = NULL;
|
|
}
|
|
|
|
#if VERSION > VERSION_DEMO
|
|
daDemo00_c::~daDemo00_c() {
|
|
if (heap != NULL && model.morf != NULL) {
|
|
model.morf->stopZelAnime();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
/* 800E5A60-800E5AFC .text setBaseMtx__10daDemo00_cFv */
|
|
void daDemo00_c::setBaseMtx() {
|
|
mDoMtx_stack_c::transS(current.pos);
|
|
mDoMtx_stack_c::XYZrotM(shape_angle);
|
|
model.model->setBaseTRMtx(mDoMtx_stack_c::get());
|
|
model.model->setBaseScale(scale);
|
|
model.model->calc();
|
|
}
|
|
|
|
/* 800E5AFC-800E5DEC .text setShadowSize__10daDemo00_cFv */
|
|
void daDemo00_c::setShadowSize() {
|
|
J3DModelData* modelData = model.model->getModelData();
|
|
|
|
cXyz min(100000000.0f, 100000000.0f, 100000000.0f);
|
|
cXyz max(-100000000.0f, -100000000.0f, -100000000.0f);
|
|
|
|
for (u16 i = 0; i < modelData->getJointNum(); i++) {
|
|
J3DJoint* joint = modelData->getJointNodePointer(i);
|
|
if (joint->getKind() == 0) {
|
|
cXyz jntMin;
|
|
cXyz jntMax;
|
|
|
|
mDoMtx_multVec(model.model->getAnmMtx(i), joint->getMin(), &jntMin);
|
|
mDoMtx_multVec(model.model->getAnmMtx(i), joint->getMax(), &jntMax);
|
|
min.x = jntMin.x < min.x ? jntMin.x : min.x;
|
|
min.y = jntMin.y < min.y ? jntMin.y : min.y;
|
|
min.z = jntMin.z < min.z ? jntMin.z : min.z;
|
|
max.x = jntMax.x > max.x ? jntMax.x : max.x;
|
|
max.y = jntMax.y > max.y ? jntMax.y : max.y;
|
|
max.z = jntMax.z > max.z ? jntMax.z : max.z;
|
|
}
|
|
}
|
|
|
|
model.shadow->pos.x = (max.x + min.x) * 0.5f;
|
|
model.shadow->pos.y = (max.y + min.y) * 0.5f;
|
|
model.shadow->pos.z = (max.z + min.z) * 0.5f;
|
|
|
|
cXyz extents = max - min;
|
|
model.shadow->field_0x10 = extents.abs() * 3.0f;
|
|
model.shadow->field_0x14 = extents.absXZ() * 0.25f;
|
|
}
|
|
|
|
/* 800E5DEC-800E5FF4 .text awaCheck__FP8J3DModel */
|
|
BOOL awaCheck(J3DModel* model) {
|
|
J3DModelData* modelData = model->getModelData();
|
|
J3DTexture* tex = modelData->getTexture();
|
|
if (tex != NULL) {
|
|
JUTNameTab* texName = modelData->getTextureName();
|
|
if (texName != NULL) {
|
|
for (u16 i = 0; i < tex->getNum(); i++) {
|
|
const char* name = texName->getName(i);
|
|
if (strcmp(name, "B_dummy") == 0
|
|
#if VERSION > VERSION_DEMO
|
|
|| strcmp(name, "cy_kankyo") == 0
|
|
#endif
|
|
) {
|
|
J3DSkinDeform* deform = new J3DSkinDeform();
|
|
if (deform == NULL)
|
|
return FALSE;
|
|
|
|
if (model->setSkinDeform(deform, 1) != J3DErrType_Success)
|
|
return FALSE;
|
|
|
|
#if VERSION > VERSION_DEMO
|
|
if (strcmp(name, "B_dummy") == 0)
|
|
#endif
|
|
{
|
|
tex->setResTIMG(i, *mDoGph_gInf_c::getFrameBufferTimg());
|
|
mDoExt_modelTexturePatch(modelData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E5FF4-800E6014 .text createHeapCallBack__FP10fopAc_ac_c */
|
|
static BOOL createHeapCallBack(fopAc_ac_c* i_this) {
|
|
return ((daDemo00_c*)i_this)->createHeap();
|
|
}
|
|
|
|
/* 800E6014-800E6620 .text createHeap__10daDemo00_cFv */
|
|
BOOL daDemo00_c::createHeap() {
|
|
/* Nonmatching */
|
|
J3DModelData* modelData;
|
|
JUT_ASSERT(0, modelData != NULL);
|
|
void* anm;
|
|
JUT_ASSERT(0, anm != NULL);
|
|
}
|
|
|
|
/* 800E6620-800E6758 .text actStandby__10daDemo00_cFP13dDemo_actor_c */
|
|
BOOL daDemo00_c::actStandby(dDemo_actor_c* act) {
|
|
if (nextRes.modelID != -1 || nextRes.plightID != -1) {
|
|
model.resID = nextRes;
|
|
if (fopAcM_entrySolidHeap(this, createHeapCallBack, 0x4000) != 0) {
|
|
if (model.model != NULL) {
|
|
setBaseMtx();
|
|
fopAcM_SetMtx(this, model.model->getBaseTRMtx());
|
|
act->setModel(model.model);
|
|
if (model.morf != NULL)
|
|
act->setAnmFrameMax(model.morf->getEndFrame());
|
|
}
|
|
|
|
setAction(&daDemo00_c::actPerformance);
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E6758-800E6E2C .text actPerformance__10daDemo00_cFP13dDemo_actor_c */
|
|
BOOL daDemo00_c::actPerformance(dDemo_actor_c*) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800E6E2C-800E6E90 .text actLeaving__10daDemo00_cFP13dDemo_actor_c */
|
|
BOOL daDemo00_c::actLeaving(dDemo_actor_c* act) {
|
|
#if VERSION > VERSION_DEMO
|
|
if (model.morf != NULL) {
|
|
model.morf->stopZelAnime();
|
|
}
|
|
#endif
|
|
|
|
fopAcM_DeleteHeap(this);
|
|
setAction(&daDemo00_c::actStandby);
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E6E90-800E6EB0 .text daDemo00_Draw__FP10daDemo00_c */
|
|
static BOOL daDemo00_Draw(daDemo00_c* i_this) {
|
|
return i_this->draw();
|
|
}
|
|
|
|
/* 800E6EB0-800E7204 .text draw__10daDemo00_cFv */
|
|
BOOL daDemo00_c::draw() {
|
|
/* Nonmatching */
|
|
#if VERSION > VERSION_DEMO
|
|
OSReport("GTower");
|
|
#endif
|
|
}
|
|
|
|
/* 800E7204-800E7224 .text daDemo00_Execute__FP10daDemo00_c */
|
|
static BOOL daDemo00_Execute(daDemo00_c* i_this) {
|
|
return i_this->execute();
|
|
}
|
|
|
|
/* 800E7224-800E78A0 .text execute__10daDemo00_cFv */
|
|
BOOL daDemo00_c::execute() {
|
|
#if VERSION > VERSION_DEMO
|
|
field_0x29e = 0;
|
|
#endif
|
|
|
|
dDemo_actor_c* demo_actor = dComIfGp_demo_getActor(demoActorID);
|
|
if (demo_actor == NULL) {
|
|
fopAcM_delete(this);
|
|
} else {
|
|
if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_SHAPE_e)) {
|
|
nextRes.modelID = demo_actor->getShapeId();
|
|
}
|
|
if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_ANM_e)) {
|
|
nextRes.bckID = demo_actor->getAnmId();
|
|
}
|
|
if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_UNK_e)) {
|
|
#if VERSION > VERSION_DEMO
|
|
u8 r29 = field_0x29c;
|
|
#endif
|
|
field_0x29c = demo_actor->getPrm()->getId();
|
|
if (field_0x29c == 4) {
|
|
static const u16 l_eventBit[] = {
|
|
0xFFFF,
|
|
0x2A80,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0x2401,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0x2110,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0x2D01,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0xFFFF,
|
|
0x3802,
|
|
};
|
|
dDemo_prm_data* data = demo_actor->getPrm()->getData();
|
|
JStudio::stb::TParseData_fixed<49, TValueIterator_raw<u8> > spCC(data);
|
|
if (!spCC.isEnd() && spCC.isValid()) {
|
|
TValueIterator_raw<u8> it = spCC.begin();
|
|
int argID = *it;
|
|
JUT_ASSERT(DEMO_SELECT(771, 832), argID < (sizeof(l_eventBit)/sizeof(u16)));
|
|
if (l_eventBit[argID] != 0xFFFF) {
|
|
dComIfGs_onEventBit(l_eventBit[argID]);
|
|
}
|
|
}
|
|
} else if (field_0x29c == 5) {
|
|
static const u8 l_itemNo[] = {
|
|
dItem_MASTER_SWORD_1_e,
|
|
dItem_MASTER_SWORD_2_e,
|
|
dItem_MASTER_SWORD_3_e,
|
|
dItem_PEARL_DIN_e,
|
|
dItem_PEARL_FARORE_e,
|
|
dItem_PEARL_NAYRU_e,
|
|
dItem_DELIVERY_BAG_e,
|
|
dItem_SHIELD_e,
|
|
dItem_MAGIC_ARROW_e,
|
|
dItem_NONE_e,
|
|
};
|
|
dDemo_prm_data* data = demo_actor->getPrm()->getData();
|
|
JStudio::stb::TParseData_fixed<49, TValueIterator_raw<u8> > spB8(data);
|
|
if (!spB8.isEnd() && spB8.isValid()) {
|
|
TValueIterator_raw<u8> it = spB8.begin();
|
|
int argID = *it;
|
|
JUT_ASSERT(DEMO_SELECT(797, 858), argID < (sizeof(l_itemNo)/sizeof(u8)));
|
|
if (l_itemNo[argID] != dItem_NONE_e) {
|
|
execItemGet(l_itemNo[argID]);
|
|
}
|
|
}
|
|
} else if (field_0x29c == 6) {
|
|
dDemo_prm_data* data = demo_actor->getPrm()->getData();
|
|
JStudio::stb::TParseData_fixed<33, TValueIterator_misaligned<s8> > spA4(data);
|
|
if (!spA4.isEnd() && spA4.isValid()) {
|
|
TValueIterator_misaligned<s8> it = spA4.begin();
|
|
int argID = *it;
|
|
mDoGph_gInf_c::setMonotoneRateSpeed(argID);
|
|
}
|
|
} else if (field_0x29c == 7) {
|
|
dDemo_prm_data* data = demo_actor->getPrm()->getData();
|
|
JStudio::stb::TParseData_fixed<49, TValueIterator_raw<u8> > sp90(data);
|
|
if (!sp90.isEnd() && sp90.isValid()) {
|
|
TValueIterator_raw<u8> it = sp90.begin();
|
|
int argID = *it;
|
|
if (argID < 100) {
|
|
dComIfGp_getVibration().StartShock(argID, 1, cXyz(0.0f, 1.0f, 0.0f));
|
|
} else if (argID != 0xFF) {
|
|
dComIfGp_getVibration().StartQuake(argID - 100, 1, cXyz(0.0f, 1.0f, 0.0f));
|
|
} else {
|
|
dComIfGp_getVibration().StopQuake(1);
|
|
}
|
|
}
|
|
} else if (field_0x29c == 9 || field_0x29c == 10) {
|
|
dDemo_prm_data* data = demo_actor->getPrm()->getData();
|
|
JStudio::stb::TParseData_fixed<33, TValueIterator_raw<s8> > sp7C(data);
|
|
if (!sp7C.isEnd() && sp7C.isValid()) {
|
|
TValueIterator_raw<s8> it = sp7C.begin();
|
|
int r4 = *it;
|
|
#if VERSION > VERSION_DEMO
|
|
if (field_0x29c != r29 || r4 != field_0x29d)
|
|
#endif
|
|
{
|
|
#if VERSION > VERSION_DEMO
|
|
field_0x29d = r4;
|
|
#endif
|
|
s8 r5 = 0;
|
|
if (++it != sp7C.end()) {
|
|
r5 = (int)*it;
|
|
}
|
|
if ((s8)r4 == 0) {
|
|
mDoGph_gInf_c::startFadeOut(r5);
|
|
} else {
|
|
mDoGph_gInf_c::startFadeIn(r5);
|
|
}
|
|
|
|
JUtility::TColor& fade_color = field_0x29c == 9 ? (JUtility::TColor&)g_blackColor : (JUtility::TColor&)g_saftyWhiteColor;
|
|
mDoGph_gInf_c::setFadeColor(fade_color);
|
|
}
|
|
}
|
|
} else {
|
|
dDemo_prm_data* data = demo_actor->getPrm()->getData();
|
|
JStudio::stb::TParseData_fixed<51, TValueIterator_misaligned<u32> > sp68(data);
|
|
if (!sp68.isEnd() && sp68.isValid()) {
|
|
int r5 = -1;
|
|
for (TValueIterator_misaligned<u32> it = sp68.begin(); it != sp68.end(); it++) {
|
|
if (r5 < 0) {
|
|
r5 = *it;
|
|
} else {
|
|
if (r5 == 0) {
|
|
nextRes.btpID = *it;
|
|
} else if (r5 == 1) {
|
|
nextRes.btkID = *it;
|
|
} else if (r5 == 2) {
|
|
nextRes.plightID = *it;
|
|
} else if (r5 == 3) {
|
|
nextRes.field_0x1C = *it;
|
|
} else if (r5 == 4) {
|
|
nextRes.brkID = *it;
|
|
} else if (r5 == 5) {
|
|
nextRes.shadowID = *it;
|
|
} else if (r5 == 6) {
|
|
#if VERSION == VERSION_DEMO
|
|
nextRes.btkID = *it | 0x10000;
|
|
#else
|
|
nextRes.btkID = *it | 0x10000000;
|
|
#endif
|
|
} else if (r5 == 7) {
|
|
#if VERSION == VERSION_DEMO
|
|
nextRes.brkID = *it | 0x10000;
|
|
#else
|
|
nextRes.brkID = *it | 0x10000000;
|
|
#endif
|
|
}
|
|
r5 = -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
action(demo_actor);
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E78A0-800E78A8 .text daDemo00_IsDelete__FP10daDemo00_c */
|
|
static BOOL daDemo00_IsDelete(daDemo00_c* i_this) {
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E78A8-800E78D0 .text daDemo00_Delete__FP10daDemo00_c */
|
|
static BOOL daDemo00_Delete(daDemo00_c* i_this) {
|
|
i_this->~daDemo00_c();
|
|
return TRUE;
|
|
}
|
|
|
|
/* 800E78D0-800E7964 .text daDemo00_Create__FP10fopAc_ac_c */
|
|
static cPhs_State daDemo00_Create(fopAc_ac_c* i_ac) {
|
|
daDemo00_c* i_this = (daDemo00_c*)i_ac;
|
|
fopAcM_SetupActor(i_this, daDemo00_c);
|
|
dKy_tevstr_init(&i_this->tevStr, dComIfGp_roomControl_getStayNo(), 0xFF);
|
|
i_this->setAction(&daDemo00_c::actStandby);
|
|
i_this->nextRes.reset();
|
|
#if VERSION > VERSION_DEMO
|
|
i_this->field_0x29d = -1;
|
|
#endif
|
|
return cPhs_COMPLEATE_e;
|
|
}
|
|
|
|
static actor_method_class l_daDemo00_Method = {
|
|
(process_method_func)daDemo00_Create,
|
|
(process_method_func)daDemo00_Delete,
|
|
(process_method_func)daDemo00_Execute,
|
|
(process_method_func)daDemo00_IsDelete,
|
|
(process_method_func)daDemo00_Draw,
|
|
};
|
|
|
|
actor_process_profile_definition g_profile_DEMO00 = {
|
|
/* LayerID */ fpcLy_CURRENT_e,
|
|
/* ListID */ 0x0007,
|
|
/* ListPrio */ fpcPi_CURRENT_e,
|
|
/* ProcName */ PROC_DEMO00,
|
|
/* Proc SubMtd */ &g_fpcLf_Method.base,
|
|
/* Size */ sizeof(daDemo00_c),
|
|
/* SizeOther */ 0,
|
|
/* Parameters */ 0,
|
|
/* Leaf SubMtd */ &g_fopAc_Method.base,
|
|
/* Priority */ PRIO_DEMO00,
|
|
/* Actor SubMtd */ &l_daDemo00_Method,
|
|
/* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e,
|
|
/* Group */ fopAc_ACTOR_e,
|
|
/* CullType */ fopAc_CULLBOX_0_e,
|
|
};
|