mirror of https://github.com/zeldaret/tp.git
2009 lines
64 KiB
C++
2009 lines
64 KiB
C++
//
|
||
// Generated By: dol2asm
|
||
// Translation Unit: d_a_tbox
|
||
//
|
||
|
||
#include "d/actor/d_a_tbox.h"
|
||
#include "d/d_tresure.h"
|
||
#include "d/d_item_data.h"
|
||
#include "d/actor/d_a_midna.h"
|
||
#include "d/d_path.h"
|
||
#include "d/d_bg_w.h"
|
||
#include "SSystem/SComponent/c_math.h"
|
||
#include "Z2AudioLib/Z2Instances.h"
|
||
#include <cmath.h>
|
||
|
||
UNK_REL_DATA
|
||
|
||
UNK_BSS(1109)
|
||
UNK_BSS(1107)
|
||
UNK_BSS(1105)
|
||
UNK_BSS(1104)
|
||
UNK_BSS(1099)
|
||
UNK_BSS(1097)
|
||
UNK_BSS(1095)
|
||
UNK_BSS(1094)
|
||
UNK_BSS(1057)
|
||
UNK_BSS(1055)
|
||
UNK_BSS(1053)
|
||
UNK_BSS(1052)
|
||
UNK_BSS(1014)
|
||
UNK_BSS(1012)
|
||
UNK_BSS(1010)
|
||
UNK_BSS(1009)
|
||
|
||
/* 804961D4-804961EC 000000 0018+00 16/16 0/0 0/0 .rodata l_cull_size_box */
|
||
static const f32 l_cull_size_box[6] = { -150.0f, -10.0f, -150.0f, 150.0f, 300.0f, 100.0f };
|
||
|
||
/* 804961EC-80496228 000018 003C+00 1/2 0/0 0/0 .rodata l_cyl_info */
|
||
static const cM3dGCylS l_cyl_info[3] = {
|
||
{ 0.0f, 0.0f, -40.0f, 40.0f, 60.0f },
|
||
{ 0.0f, 0.0f, -60.0f, 50.0f, 70.0f },
|
||
{ 0.0f, 0.0f, -60.0f, 70.0f, 80.0f },
|
||
};
|
||
|
||
/* 804964B4-804964B8 -00001 0004+00 2/4 0/0 0/0 .data l_staff_name */
|
||
static char* l_staff_name = "TREASURE";
|
||
|
||
/* 804964B8-804964FC 000024 0044+00 1/1 0/0 0/0 .data l_cyl_src */
|
||
static dCcD_SrcCyl l_cyl_src = {
|
||
{
|
||
{0x0, {{0x0, 0x0, 0x1e}, {0x0, 0x0}, 0x79}}, // mObj
|
||
{dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt
|
||
{dCcD_SE_METAL, 0x2, 0x0, 0x0, 0x3}, // mGObjTg
|
||
{0x0}, // mGObjCo
|
||
}, // mObjInf
|
||
{
|
||
{0.0f, 0.0f, 0.0f}, // mCenter
|
||
0.0f, // mRadius
|
||
0.0f // mHeight
|
||
} // mCyl
|
||
};
|
||
|
||
/* 804964FC-80496550 -00001 0054+00 1/1 0/0 0/0 .data l_modelInfo */
|
||
static daTbox_ModelInfo l_modelInfo[3] = {
|
||
{ "Dalways", 12, 7, 25, 26, 14, 19 },
|
||
{ "Dalways", 13, 8, 27, 28, 14, 19 },
|
||
{ "BoxC", 14, 8, 20, 21, 11, 17 },
|
||
};
|
||
|
||
/* 804968E4-804968F0 000054 000C+00 2/3 0/0 0/0 .bss l_light_offset */
|
||
static cXyz l_light_offset(0.0f, 35.0f, 0.0f);
|
||
|
||
/* 80490D2C-80490DCC 0000EC 00A0+00 1/1 0/0 0/0 .text __ct__12daTbox_HIO_cFv */
|
||
daTbox_HIO_c::daTbox_HIO_c() {
|
||
mItemNo = 1;
|
||
mUseDebugItemNo = 0;
|
||
mGravity = -2.0f;
|
||
mDemoType = 0;
|
||
mTimerDisplay = 0;
|
||
mCheckDisplay = 0;
|
||
mClearSwitch = 0;
|
||
mSaveOff = 0;
|
||
mDebugLightColorEnabled = 0;
|
||
mLightColorR = 0;
|
||
mLightColorG = 0;
|
||
mLightColorB = 0;
|
||
mLightOffset = l_light_offset;
|
||
mLightPower = 70.0f;
|
||
mFluctuationRate = 0.3f;
|
||
mFluctuationSpeed = 7500;
|
||
mEnvColorInfluence = 0.55f;
|
||
mForPlacementCheck = 0;
|
||
}
|
||
|
||
/* 80490E50-80490E6C 000210 001C+00 6/6 0/0 0/0 .text getModelInfo__8daTbox_cFv */
|
||
daTbox_ModelInfo* daTbox_c::getModelInfo() {
|
||
return &l_modelInfo[getShapeType()];
|
||
}
|
||
|
||
/* 80496238-80496244 000064 000C+00 0/1 0/0 0/0 .rodata l_open_se_id */
|
||
static const u32 l_open_se_id[3] = { Z2SE_OBJ_TBOX_OPEN_A, Z2SE_OBJ_TBOX_OPEN_B, Z2SE_OBJ_TBOX_OPEN_C };
|
||
|
||
/* 80490E6C-80491170 00022C 0304+00 1/1 0/0 0/0 .text commonShapeSet__8daTbox_cFv */
|
||
cPhs__Step daTbox_c::commonShapeSet() {
|
||
daTbox_ModelInfo* model_info = getModelInfo();
|
||
|
||
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(model_info->mArcName, model_info->mModelResNo);
|
||
JUT_ASSERT(0x191, modelData != 0);
|
||
|
||
mpAnm = new mDoExt_bckAnm();
|
||
if (mpAnm == NULL) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
|
||
J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(model_info->mArcName, model_info->mBckResNo);
|
||
if (!mpAnm->init(bck, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false)) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
|
||
mOpenSeId = l_open_se_id[getShapeType()];
|
||
u32 model_flag = 0x80000;
|
||
if (getShapeType() == SHAPE_BOSSKEY) {
|
||
model_flag = 0;
|
||
}
|
||
|
||
mpModel = mDoExt_J3DModel__create(modelData, model_flag, 0x11000084);
|
||
if (mpModel == NULL) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
|
||
if (!strcmp(dComIfGp_getStartStageName(), "D_MN01B")) { // Deku Toad chest
|
||
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Dalways", 15);
|
||
JUT_ASSERT(0x1BD, modelData != 0);
|
||
mpSlimeModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
|
||
if (mpSlimeModel == NULL) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
}
|
||
|
||
if (checkAppear()) {
|
||
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(model_info->mArcName, model_info->mEffectResNo);
|
||
JUT_ASSERT(0x1CE, modelData != 0);
|
||
mpEffectModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084);
|
||
if (mpEffectModel == NULL) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
|
||
mpEffectAnm = new mDoExt_brkAnm();
|
||
if (mpEffectAnm == NULL) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
|
||
J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(model_info->mArcName, model_info->mBrkResNo);
|
||
JUT_ASSERT(0x1E1, brk != 0);
|
||
if (!mpEffectAnm->init(modelData, brk, TRUE, J3DFrameCtrl::EMode_NONE, 0.0f, 0, -1)) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
}
|
||
|
||
mpModel->setBaseScale(scale);
|
||
mDoMtx_stack_c::transS(current.pos);
|
||
mDoMtx_stack_c::YrotM(home.angle.y);
|
||
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
||
|
||
if (mpEffectModel != NULL) {
|
||
mpEffectModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
||
}
|
||
|
||
mDoMtx_copy(mDoMtx_stack_c::get(), mBgMtx);
|
||
return cPhs_COMPLEATE_e;
|
||
}
|
||
|
||
/* 804911B8-804911C0 000578 0008+00 1/1 0/0 0/0 .text effectShapeSet__8daTbox_cFv */
|
||
cPhs__Step daTbox_c::effectShapeSet() {
|
||
return cPhs_COMPLEATE_e;
|
||
}
|
||
|
||
/* 804911C0-804911C8 000580 0008+00 1/1 0/0 0/0 .text envShapeSet__8daTbox_cFv */
|
||
cPhs__Step daTbox_c::envShapeSet() {
|
||
return cPhs_COMPLEATE_e;
|
||
}
|
||
|
||
/* 804911C8-8049129C 000588 00D4+00 1/1 0/0 0/0 .text bgCheckSet__8daTbox_cFv */
|
||
cPhs__Step daTbox_c::bgCheckSet() {
|
||
daTbox_ModelInfo* model_info = getModelInfo();
|
||
|
||
cBgD_t* bgd = (cBgD_t*)dComIfG_getObjectRes(model_info->mArcName, model_info->mOpenDzbResNo);
|
||
JUT_ASSERT(0x210, bgd != 0);
|
||
mpOpenBgW = new dBgW();
|
||
if (mpOpenBgW == NULL) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
|
||
if (mpOpenBgW->Set(bgd, 1, &mBgMtx) == 1) {
|
||
return cPhs_ERROR_e;
|
||
}
|
||
|
||
mpOpenBgW->SetCrrFunc(dBgS_MoveBGProc_TypicalRotY);
|
||
mpOpenBgW->Move();
|
||
mpBgCollision = NULL;
|
||
return cPhs_COMPLEATE_e;
|
||
}
|
||
|
||
/* 8049129C-804912EC 00065C 0050+00 1/1 0/0 0/0 .text lightReady__8daTbox_cFv */
|
||
void daTbox_c::lightReady() {
|
||
setLightPos();
|
||
mLight.mColor.r = 0;
|
||
mLight.mColor.g = 0;
|
||
mLight.mColor.b = 0;
|
||
mLight.mPow = 0.0f;
|
||
mLight.mFluctuation = 0.0f;
|
||
mAllcolRatio = 0.0f;
|
||
}
|
||
|
||
/* 804912EC-8049135C 0006AC 0070+00 2/2 0/0 0/0 .text setLightPos__8daTbox_cFv */
|
||
void daTbox_c::setLightPos() {
|
||
cXyz offset(l_light_offset);
|
||
cXyz pos;
|
||
cLib_offsetPos(&pos, ¤t.pos, current.angle.y, &offset);
|
||
mLight.mPosition.set(pos.x, pos.y, pos.z);
|
||
}
|
||
|
||
/* 8049135C-80491364 00071C 0008+00 2/2 0/0 0/0 .text checkEnv__8daTbox_cFv */
|
||
int daTbox_c::checkEnv() {
|
||
return true;
|
||
}
|
||
|
||
/* 80491364-8049139C 000724 0038+00 2/2 0/0 0/0 .text checkAppear__8daTbox_cFv */
|
||
int daTbox_c::checkAppear() {
|
||
if (getFuncType() == 2 || (getSwType() == 15 && getFuncType() == 1)) {
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
/* 8049139C-804913D0 00075C 0034+00 4/4 0/0 0/0 .text checkOpen__8daTbox_cFv */
|
||
int daTbox_c::checkOpen() {
|
||
return dComIfGs_isTbox(getTboxNo());
|
||
}
|
||
|
||
/* 804913D0-8049141C 000790 004C+00 3/3 0/0 0/0 .text clrDzb__8daTbox_cFv */
|
||
void daTbox_c::clrDzb() {
|
||
if (mpBgCollision != NULL) {
|
||
dComIfG_Bgsp().Release(mpBgCollision);
|
||
mpBgCollision = NULL;
|
||
}
|
||
}
|
||
|
||
/* 8049141C-80491484 0007DC 0068+00 6/6 0/0 0/0 .text setDzb__8daTbox_cFv */
|
||
void daTbox_c::setDzb() {
|
||
clrDzb();
|
||
|
||
if (checkOpen()) {
|
||
mpBgCollision = mpOpenBgW;
|
||
// "Opened Check Set\n"
|
||
OS_REPORT("開いたチェックセット\n");
|
||
} else {
|
||
mpBgCollision = mpBgW;
|
||
// "Closed Check Set\n"
|
||
OS_REPORT("閉じたチェックセット\n");
|
||
}
|
||
|
||
bool rt = dComIfG_Bgsp().Regist(mpBgCollision, this);
|
||
JUT_ASSERT(0x285, !rt);
|
||
}
|
||
|
||
/* 80491484-80491544 000844 00C0+00 1/1 0/0 0/0 .text surfaceProc__8daTbox_cFv */
|
||
void daTbox_c::surfaceProc() {
|
||
if (mpBgCollision != NULL && flagCheck(0x20)) {
|
||
if (field_0x750 < -1.0f) {
|
||
field_0x750 += 1.0f;
|
||
} else {
|
||
flagOff(0x20);
|
||
field_0x750 = 0.0f;
|
||
}
|
||
|
||
mDoMtx_stack_c::transS(current.pos.x, current.pos.y + field_0x750, current.pos.z);
|
||
mDoMtx_stack_c::YrotM(home.angle.y);
|
||
MTXCopy(mDoMtx_stack_c::get(), mBgMtx);
|
||
mpBgCollision->Move();
|
||
}
|
||
}
|
||
|
||
/* 80491544-804915BC 000904 0078+00 1/1 0/0 0/0 .text checkNormal__8daTbox_cFv */
|
||
int daTbox_c::checkNormal() {
|
||
int func_type = getFuncType();
|
||
if (func_type == 0 || func_type == 6 || func_type == 5 || func_type == 3) {
|
||
return true;
|
||
}
|
||
|
||
if (getSwNo() >= 0xC0) {
|
||
return false;
|
||
}
|
||
|
||
if (dComIfGs_isSwitch(getSwNo(), fopAcM_GetRoomNo(this))) {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/* 804915BC-80491624 00097C 0068+00 2/2 0/0 0/0 .text checkEnvEffectTbox__8daTbox_cFv */
|
||
int daTbox_c::checkEnvEffectTbox() {
|
||
if (getShapeType() == SHAPE_SMALL) {
|
||
return false;
|
||
}
|
||
|
||
if (getItemNo() == fpcNm_ITEM_BOOMERANG || getItemNo() == fpcNm_ITEM_MAP || getItemNo() == fpcNm_ITEM_COMPUS) {
|
||
return true;
|
||
}
|
||
|
||
if (getShapeType() == SHAPE_BOSSKEY) {
|
||
return true;
|
||
}
|
||
|
||
return dItem_data::chkFlag(getItemNo(), 0x40);
|
||
}
|
||
|
||
/* 80491624-804916A4 0009E4 0080+00 1/1 0/0 0/0 .text calcHeapSize__8daTbox_cFv */
|
||
u32 daTbox_c::calcHeapSize() {
|
||
int shape_type = getShapeType();
|
||
checkOpen();
|
||
checkAppear();
|
||
|
||
u32 heap_size = 0;
|
||
switch (shape_type) {
|
||
case SHAPE_SMALL:
|
||
heap_size = 0x1840;
|
||
break;
|
||
case SHAPE_LARGE:
|
||
heap_size = 0x2040;
|
||
break;
|
||
case SHAPE_BOSSKEY:
|
||
heap_size = 0x3060;
|
||
break;
|
||
}
|
||
|
||
return heap_size;
|
||
}
|
||
|
||
/* 804916A4-80491744 000A64 00A0+00 1/0 0/0 0/0 .text CreateHeap__8daTbox_cFv */
|
||
int daTbox_c::CreateHeap() {
|
||
cPhs__Step step = commonShapeSet();
|
||
if (step != cPhs_COMPLEATE_e) {
|
||
return false;
|
||
}
|
||
|
||
if (checkEnv()) {
|
||
step = envShapeSet();
|
||
if (step != cPhs_COMPLEATE_e) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
if (!checkOpen()) {
|
||
step = effectShapeSet();
|
||
if (step != cPhs_COMPLEATE_e) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
step = bgCheckSet();
|
||
if (step != cPhs_COMPLEATE_e) {
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 80491744-804919B0 000B04 026C+00 1/1 0/0 0/0 .text CreateInit__8daTbox_cFv */
|
||
void daTbox_c::CreateInit() {
|
||
int func_type = getFuncType();
|
||
flagClr();
|
||
|
||
mpAnm->setPlaySpeed(0.0f);
|
||
initPos();
|
||
initAnm();
|
||
|
||
shape_angle.z = 0;
|
||
shape_angle.x = 0;
|
||
current.angle.z = 0;
|
||
current.angle.x = 0;
|
||
|
||
mStts.Init(0xff, 0xff, this);
|
||
mCyl.Set(l_cyl_src);
|
||
mCyl.SetStts(&mStts);
|
||
mCyl.cM3dGCyl::Set(l_cyl_info[getShapeType()]);
|
||
|
||
if (mpBgW != NULL) {
|
||
dComIfG_Bgsp().Release(mpBgW);
|
||
}
|
||
|
||
if (flagCheck(2)) {
|
||
clrDzb();
|
||
} else if (mpBgCollision == NULL) {
|
||
setDzb();
|
||
}
|
||
|
||
if (func_type == 5 || func_type == 6 || field_0x9cc == 1) {
|
||
mAcchCir.SetWall(500.0f, 0.0f);
|
||
mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir,
|
||
fopAcM_GetSpeed_p(this), ¤t.angle, &shape_angle);
|
||
gravity = -2.0f;
|
||
field_0x97d = true;
|
||
field_0x97c = true;
|
||
} else if (func_type == 3) {
|
||
mAcchCir.SetWall(500.0f, 0.0f);
|
||
mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir,
|
||
fopAcM_GetSpeed_p(this), NULL, NULL);
|
||
}
|
||
|
||
mTboxNo = getTboxNo();
|
||
mEventId = dComIfGp_getEventManager().getEventIdx(this, getEvent());
|
||
|
||
if (getShapeType() == SHAPE_BOSSKEY) {
|
||
eventInfo.setArchiveName(getModelInfo()->mArcName);
|
||
field_0x984 = dComIfGp_getEventManager().getEventIdx(this, "DEFAULT_TREASURE_BOSS", 0xff);
|
||
}
|
||
|
||
initBaseMtx();
|
||
|
||
lightReady();
|
||
mAllcolRatio = 1.0f;
|
||
|
||
fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
|
||
fopAcM_setCullSizeBox(this, l_cull_size_box[0], l_cull_size_box[1], l_cull_size_box[2],
|
||
l_cull_size_box[3], l_cull_size_box[4], l_cull_size_box[5]);
|
||
}
|
||
|
||
/* 804919B0-80491BB0 000D70 0200+00 1/1 0/0 0/0 .text initPos__8daTbox_cFv */
|
||
void daTbox_c::initPos() {
|
||
int func_type = getFuncType();
|
||
if ((func_type == 6 && getSwType() == 15) || func_type == 7) {
|
||
dPath* path_p = dPath_GetRoomPath(getPathId(), -1);
|
||
JUT_ASSERT(0x3B7, path_p != 0);
|
||
|
||
if (func_type == 6 && path_p->m_num != 2 && path_p->m_num != 3) {
|
||
fopAcM_setWarningMessage(this, __FILE__, 0x3BD, "Num of Jump TBox's path point must be 2 or 3!");
|
||
}
|
||
|
||
if (dComIfGs_isSwitch(getSwNo(), fopAcM_GetRoomNo(this))) {
|
||
dStage_dPnt_c* pnt = &path_p->m_points[path_p->m_num - 1];
|
||
current.pos = pnt->m_position;
|
||
home.pos = pnt->m_position;
|
||
}
|
||
} else if (func_type == 6 && getSwType() == 0 && checkDrop()) {
|
||
cXyz pos;
|
||
if (!calcJumpGoalAndAngle(&pos, ¤t.angle.y)) {
|
||
// "Jump Treasure Chest: Failed to get Jump Goal!\n"
|
||
OS_REPORT_ERROR("ジャンプ宝箱:ジャンプ先の取得に失敗しました!\n");
|
||
}
|
||
|
||
current.pos = pos;
|
||
home.pos = pos;
|
||
getDropSAngle(&home.angle.y);
|
||
}
|
||
|
||
cXyz start = home.pos;
|
||
cXyz end = home.pos;
|
||
start.y += 5.0f;
|
||
end.y -= 30.0f;
|
||
|
||
bool line_check = fopAcM_lc_c::lineCheck(&start, &end, this);
|
||
if ((line_check && fopAcM_lc_c::checkMoveBG()) || (!line_check && func_type != 3)) {
|
||
// "Treasure Chest position initialization: No BG within 25cm, waiting for MoveBG!\n"
|
||
OS_REPORT("宝箱位置初期設定:25cm以内にBGが無いのでMoveBGを待ちます!\n");
|
||
field_0x9cc = 1;
|
||
mMode = MODE_EXEC_WAIT;
|
||
} else {
|
||
// "Treasure Chest position initialization complete!\n"
|
||
OS_REPORT("宝箱位置初期設定完了!\n");
|
||
field_0x9cc = 0;
|
||
mMode = MODE_EXEC;
|
||
}
|
||
}
|
||
|
||
/* 80491BB0-80491F68 000F70 03B8+00 1/1 0/0 0/0 .text initAnm__8daTbox_cFv */
|
||
void daTbox_c::initAnm() {
|
||
int func_type = getFuncType();
|
||
|
||
if (checkOpen()) {
|
||
mpAnm->setFrame(mpAnm->getEndFrame());
|
||
if (func_type == 3) {
|
||
cXyz pos = current.pos;
|
||
if (fopAcM_gc_c::gndCheck(&pos)) {
|
||
current.pos.y = fopAcM_gc_c::getGroundY();
|
||
shape_angle.z = 0;
|
||
shape_angle.x = 0;
|
||
}
|
||
|
||
home.pos = current.pos;
|
||
attention_info.position = current.pos;
|
||
eyePos = current.pos;
|
||
}
|
||
|
||
setAction(&daTbox_c::actionWait);
|
||
int tbox_no = getTboxNo();
|
||
dTres_c::offStatus(0, tbox_no, 1);
|
||
} else if (!checkEnv()) {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
} else if (checkNormal()) {
|
||
if (func_type == 6 && !checkDrop()) {
|
||
setAction(&daTbox_c::actionDropWait);
|
||
} else if (func_type == 3) {
|
||
if (fopAcM_isSwitch(this, getSwNo())) {
|
||
cXyz pos = current.pos;
|
||
if (fopAcM_gc_c::gndCheck(&pos)) {
|
||
current.pos.y = fopAcM_gc_c::getGroundY();
|
||
shape_angle.z = 0;
|
||
shape_angle.x = 0;
|
||
}
|
||
|
||
home.pos = current.pos;
|
||
attention_info.position = current.pos;
|
||
eyePos = current.pos;
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
} else {
|
||
setAction(&daTbox_c::actionDropWaitForWeb);
|
||
flagOn(2);
|
||
field_0x9fd = 1;
|
||
}
|
||
} else if (func_type == 0) {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
} else {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
}
|
||
|
||
int tbox_no = getTboxNo();
|
||
dTres_c::onStatus(0, tbox_no, 1);
|
||
} else {
|
||
int tbox_no = getTboxNo();
|
||
dTres_c::offStatus(0, tbox_no, 1);
|
||
|
||
switch (func_type) {
|
||
case 2:
|
||
setAction(&daTbox_c::actionGenocide);
|
||
mTimer = 65;
|
||
flagOn(3);
|
||
field_0x75a = 120;
|
||
break;
|
||
case 1:
|
||
if (getSwType() == 15) {
|
||
setAction(&daTbox_c::actionSwOnWait);
|
||
} else {
|
||
setAction(&daTbox_c::actionSwOnWait2);
|
||
}
|
||
field_0x75a = 120;
|
||
flagOn(3);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* 80491F68-804920A8 001328 0140+00 1/1 0/0 0/0 .text boxCheck__8daTbox_cFv */
|
||
int daTbox_c::boxCheck() {
|
||
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
|
||
if (!strcmp(dComIfGp_getStartStageName(), "R_SP01") && fopAcM_GetRoomNo(this) == 7 &&
|
||
player->getKandelaarFlamePos() == NULL) {
|
||
return false;
|
||
}
|
||
|
||
cXyz vec = player->attention_info.position - current.pos;
|
||
f32 dist2_xz = vec.abs2XZ();
|
||
f32 dist_y = fabsf(player->current.pos.y - current.pos.y);
|
||
if (dist2_xz < 22500.0f && fopAcM_seenPlayerAngleY(this) < 0x2000 &&
|
||
fopAcM_seenActorAngleY(player, this) < 0x2000 && dist_y < 20.0f) {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/* 804920A8-8049216C 001468 00C4+00 1/1 0/0 0/0 .text demoProcOpen__8daTbox_cFv */
|
||
void daTbox_c::demoProcOpen() {
|
||
if (mDemoFrame < 1000) {
|
||
mDemoFrame++;
|
||
}
|
||
|
||
if (mDemoFrame == 152) {
|
||
dKy_efplight_cut(&mLight);
|
||
} else if (mDemoFrame > 112) {
|
||
lightDownProc();
|
||
} else if (mDemoFrame > 2) {
|
||
lightUpProc();
|
||
}
|
||
|
||
if (mDemoFrame > 22) {
|
||
mLight.mPow = cM_ssin(mDemoFrame * 7500) * 21.0f + 70.0f;
|
||
}
|
||
|
||
lightColorProc();
|
||
environmentProc();
|
||
}
|
||
|
||
/* 8049216C-8049233C 00152C 01D0+00 1/1 0/0 0/0 .text lightColorProc__8daTbox_cFv */
|
||
// NONMATCHING - regalloc
|
||
void daTbox_c::lightColorProc() {
|
||
static int const key_frame[7] = {0x00, 0x07, 0x1e, 0x25, 0x2c, 0x5c, 0x8c};
|
||
static GXColorS10 const key_color[7] = {
|
||
{0x00, 0x00, 0x00, 0xff},
|
||
{0xff, 0xc3, 0x8a, 0xff},
|
||
{0xff, 0xc3, 0x8a, 0xff},
|
||
{0x37, 0x34, 0x24, 0xff},
|
||
{0xff, 0xc3, 0x8a, 0xff},
|
||
{0xff, 0xc3, 0x8a, 0xff},
|
||
{0x00, 0x00, 0x00, 0xff},
|
||
};
|
||
|
||
int var_r25, var_r24, var_r28, var_r30;
|
||
if (mDemoFrame < 140) {
|
||
for (var_r30 = 0; var_r30 < 7; var_r30++) {
|
||
if (key_frame[var_r30] <= mDemoFrame && key_frame[var_r30 + 1] > mDemoFrame) {
|
||
var_r25 = key_frame[var_r30];
|
||
var_r24 = key_frame[var_r30 + 1];
|
||
var_r28 = var_r30 + 1;
|
||
break;
|
||
}
|
||
}
|
||
|
||
int num_frames = var_r25 - var_r24;
|
||
s16 step_r = std::fabs<int>(key_color[var_r30 + 1].r - key_color[var_r30].r) / num_frames;
|
||
s16 step_g = std::fabs<int>(key_color[var_r30 + 1].g - key_color[var_r30].g) / num_frames;
|
||
s16 step_b = std::fabs<int>(key_color[var_r30 + 1].b - key_color[var_r30].b) / num_frames;
|
||
step_r++;
|
||
step_g++;
|
||
step_b++;
|
||
|
||
cLib_chaseS(&mLight.mColor.r, key_color[var_r28].r, step_r);
|
||
cLib_chaseS(&mLight.mColor.g, key_color[var_r28].g, step_g);
|
||
cLib_chaseS(&mLight.mColor.b, key_color[var_r28].b, step_b);
|
||
}
|
||
}
|
||
|
||
/* 8049233C-80492398 0016FC 005C+00 1/1 0/0 0/0 .text environmentProc__8daTbox_cFv */
|
||
void daTbox_c::environmentProc() {
|
||
if (mDemoFrame > 139) {
|
||
cLib_addCalc(&mAllcolRatio, 1.0f, 0.05f, 0.1f, 0.05f);
|
||
} else if (mDemoFrame > 169) {
|
||
mAllcolRatio = 1.0f;
|
||
}
|
||
}
|
||
|
||
/* 80492398-804923D4 001758 003C+00 1/1 0/0 0/0 .text lightUpProc__8daTbox_cFv */
|
||
void daTbox_c::lightUpProc() {
|
||
cLib_addCalc(&mLight.mPow, 70.0f, 0.05f, 5.0f, 1.0f);
|
||
}
|
||
|
||
/* 804923D4-80492408 001794 0034+00 1/1 0/0 0/0 .text lightDownProc__8daTbox_cFv */
|
||
void daTbox_c::lightDownProc() {
|
||
cLib_addCalc0(&mLight.mPow, 0.05f, 5.0f);
|
||
}
|
||
|
||
/* 80492408-80492450 0017C8 0048+00 2/2 0/0 0/0 .text dropProcInitCall__8daTbox_cFv */
|
||
void daTbox_c::dropProcInitCall() {
|
||
switch (getSwType()) {
|
||
case 0:
|
||
dropProcInit2();
|
||
break;
|
||
case 15:
|
||
dropProcInit();
|
||
break;
|
||
}
|
||
}
|
||
|
||
/* 80492450-804928DC 001810 048C+00 1/1 0/0 0/0 .text dropProcInit__8daTbox_cFv */
|
||
void daTbox_c::dropProcInit() {
|
||
dPath* path_p = dPath_GetRoomPath(getPathId(), -1);
|
||
JUT_ASSERT(0x56A, path_p != 0);
|
||
|
||
cXyz pos = current.pos;
|
||
cXyz pnt1 = path_p->m_points[1].m_position;
|
||
|
||
f32 var_f30;
|
||
if (path_p->m_num == 2) {
|
||
field_0x97c = false;
|
||
|
||
f32 delta_y = pos.y - pnt1.y;
|
||
f32 abs_gravity = std::fabsf(fopAcM_GetGravity(this));
|
||
|
||
var_f30 = JMAFastSqrt(2.0f * delta_y / abs_gravity);
|
||
speedF = pos.absXZ(pnt1) / var_f30;
|
||
setRotAxis(&pos, &pnt1);
|
||
} else if (path_p->m_num == 3) {
|
||
cXyz pnt2(path_p->m_points[2].m_position);
|
||
if (pos.y < pnt2.y) {
|
||
OS_REPORT_ERROR("落下開始点より落下点の方が上にあります!!!\n");
|
||
JUT_ASSERT(0x58F, 0);
|
||
}
|
||
|
||
f32 delta_y1 = pos.y - pnt2.y;
|
||
f32 delta_y2 = pnt1.y - pos.y;
|
||
f32 abs_gravity = fabsf(fopAcM_GetGravity(this));
|
||
f32 dist_xz = pos.absXZ(pnt2);
|
||
|
||
speedF = dist_xz * JMAFastSqrt(abs_gravity) /
|
||
(JMAFastSqrt(2.0f * delta_y2) + JMAFastSqrt(2.0f * (delta_y1 + delta_y2)));
|
||
speed.y = JMAFastSqrt(2.0f * abs_gravity * delta_y2);
|
||
setRotAxis(&pos, &pnt1);
|
||
var_f30 = JMAFastSqrt(2.0f / abs_gravity) *
|
||
(JMAFastSqrt(delta_y1) + JMAFastSqrt(delta_y1 + delta_y2));
|
||
}
|
||
|
||
field_0x9c8 = var_f30 / 19.0f;
|
||
}
|
||
|
||
/* 804928DC-80492B10 001C9C 0234+00 2/2 0/0 0/0 .text calcJumpGoalAndAngle__8daTbox_cFP4cXyzPs */
|
||
int daTbox_c::calcJumpGoalAndAngle(cXyz* i_pos, s16* i_angle) {
|
||
dPath* path_p = dPath_GetRoomPath(getPathId(), -1);
|
||
if (path_p != NULL) {
|
||
cXyz home_pos = home.pos;
|
||
cXyz vec2 = path_p->m_points[1].m_position;
|
||
f32 dist_xz = home_pos.absXZ(vec2);
|
||
|
||
s16 angle;
|
||
getDropSAngle(&angle);
|
||
|
||
cXyz goal(0.0f, 0.0f, dist_xz);
|
||
mDoMtx_stack_c::YrotS(angle);
|
||
mDoMtx_stack_c::multVec(&goal, &goal);
|
||
goal += home_pos;
|
||
goal.y = vec2.y;
|
||
|
||
*i_pos = goal;
|
||
*i_angle = angle;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
/* 80492B10-80492BC8 001ED0 00B8+00 4/4 0/0 0/0 .text getDropSAngle__8daTbox_cFPs */
|
||
bool daTbox_c::getDropSAngle(s16* i_angle) {
|
||
if (getFuncType() == 6 && getSwType() == 0 && getDir() != 0) {
|
||
*i_angle = cM_deg2s((getDir() - 1) * 24 + 12);
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
/* 80492BC8-80492C84 001F88 00BC+00 1/1 0/0 0/0 .text getDir__8daTbox_cFv */
|
||
int daTbox_c::getDir() {
|
||
if (getSwType() == 15) {
|
||
if (dComIfGs_isSwitch(getSwNo(), fopAcM_GetRoomNo(this))) {
|
||
return 1;
|
||
} else {
|
||
return 0;
|
||
}
|
||
} else {
|
||
u16 bit = 1;
|
||
u16 dir = 0;
|
||
for (int i = 0; i < 4; i++) {
|
||
if (fopAcM_isSwitch(this, getSwNo() + i)) {
|
||
dir += bit;
|
||
}
|
||
bit = bit << 1;
|
||
}
|
||
return dir;
|
||
}
|
||
}
|
||
|
||
/* 80492C84-80492D08 002044 0084+00 2/2 0/0 0/0 .text setRotAxis__8daTbox_cFPC4cXyzPC4cXyz */
|
||
void daTbox_c::setRotAxis(cXyz const* i_pos, cXyz const* i_goalPos) {
|
||
mRotAxis = *i_goalPos - *i_pos;
|
||
mRotAxis.y = 0.0f;
|
||
mDoMtx_stack_c::YrotS(0x4000);
|
||
mDoMtx_stack_c::multVec(&mRotAxis, &mRotAxis);
|
||
}
|
||
|
||
/* 80492D08-80492F50 0020C8 0248+00 1/1 0/0 0/0 .text dropProcInit2__8daTbox_cFv */
|
||
void daTbox_c::dropProcInit2() {
|
||
cXyz goal_pos;
|
||
if (!calcJumpGoalAndAngle(&goal_pos, ¤t.angle.y)) {
|
||
// "Jump Treasure Chest: Failed to get jump goal!\n"
|
||
OSReport_Error("ジャンプ宝箱:ジャンプ先の取得に失敗しました!\n");
|
||
}
|
||
|
||
dPath* path_p = dPath_GetRoomPath(getPathId(), -1);
|
||
f32 temp;
|
||
if (path_p->m_num == 2) {
|
||
cXyz vec1 = current.pos;
|
||
cXyz vec2 = path_p->m_points[1].m_position;
|
||
field_0x97c = false;
|
||
f32 delta_y = vec1.y - vec2.y;
|
||
f32 abs_gravity = fabsf(fopAcM_GetGravity(this));
|
||
temp = JMAFastSqrt(2.0f * delta_y / abs_gravity);
|
||
speedF = vec1.absXZ(vec2) / temp;
|
||
setRotAxis(&vec1, &goal_pos);
|
||
} else {
|
||
// "Falling Memory Treasure Chest: There's not 2 points!\n"
|
||
OS_REPORT_ERROR("落下方向記憶宝箱:ポイントが2点ではありません!\n");
|
||
JUT_ASSERT(0x641, 0);
|
||
}
|
||
|
||
field_0x9c8 = temp / 19.0f;
|
||
}
|
||
|
||
/* 80492F50-804932C0 002310 0370+00 2/2 0/0 0/0 .text dropProc__8daTbox_cFv */
|
||
void daTbox_c::dropProc() {
|
||
if (field_0x9c8 != 0) {
|
||
s16 temp = field_0x9c6;
|
||
field_0x9c4 = 3400;
|
||
field_0x9c6 += field_0x9c4;
|
||
if (temp < 0 && field_0x9c6 > 0) {
|
||
field_0x9c8--;
|
||
}
|
||
} else if (field_0x9c8 == 0) {
|
||
field_0x9c4 = 0;
|
||
mDoMtx_identity(field_0x988);
|
||
}
|
||
|
||
if (mAcch.ChkGroundLanding() && field_0x97d) {
|
||
field_0x9c8 = 0;
|
||
field_0x9c4 = 0;
|
||
mDoMtx_identity(field_0x988);
|
||
speedF = 0.0f;
|
||
|
||
cXyz vec1(2.0f, 2.0f, 2.0f);
|
||
dComIfGp_particle_setPolyColor(0xe7, mAcch.m_gnd, ¤t.pos, &tevStr, &home.angle,
|
||
&vec1, 0, NULL, fopAcM_GetRoomNo(this), NULL);
|
||
dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f));
|
||
|
||
u32 sound_id = 0;
|
||
cXyz chkpos = current.pos;
|
||
chkpos.y += 10.0f;
|
||
|
||
dBgS_ObjGndChk gnd_chk;
|
||
gnd_chk.SetPos(&chkpos);
|
||
gnd_chk.SetActorPid(base.id);
|
||
dComIfG_Bgsp().GroundCross(&gnd_chk);
|
||
|
||
int bg_index = gnd_chk.GetBgIndex();
|
||
if (bg_index >= 0 && bg_index < 0x100) {
|
||
sound_id = dComIfG_Bgsp().GetMtrlSndId(gnd_chk);
|
||
}
|
||
|
||
mDoAud_seStart(JA_SE_OBJ_BLOCK_FALL_NORMAL, &eyePos, sound_id, dComIfGp_getReverb(home.roomNo));
|
||
}
|
||
|
||
if (home.pos.abs(current.pos) > 400.0f) {
|
||
field_0x97c = true;
|
||
field_0x97d = true;
|
||
}
|
||
}
|
||
|
||
/* 80493338-80493484 0026F8 014C+00 1/1 0/0 0/0 .text demoInitAppear__8daTbox_cFv */
|
||
void daTbox_c::demoInitAppear() {
|
||
mpEffectAnm->setFrame(0.0f);
|
||
mpEffectAnm->setPlaySpeed(1.0f);
|
||
|
||
cXyz particle_pos(current.pos.x, current.pos.y + 55.0f, current.pos.z);
|
||
csXyz particle_rot = home.angle;
|
||
|
||
static u16 const eff_id[6] = {0x8840, 0x8841, 0x8842, 0x8843, 0x8844, 0x8845};
|
||
for (u32 i = 0; i < 6; i++) {
|
||
dComIfGp_particle_set(eff_id[i], &particle_pos, &particle_rot, &scale, 0xff, NULL, -1, NULL, NULL, NULL);
|
||
}
|
||
|
||
flagOff(0x40);
|
||
flagOn(1);
|
||
fopAcM_seStart(this, Z2SE_OBJ_T_BOX_EMERGE, 0);
|
||
}
|
||
|
||
/* 80493484-80493518 002844 0094+00 1/1 0/0 0/0 .text demoProcAppear__8daTbox_cFv */
|
||
void daTbox_c::demoProcAppear() {
|
||
if (field_0x75a != 0) {
|
||
field_0x75a--;
|
||
}
|
||
|
||
if (mpEffectAnm->getFrame() == 110.0f) {
|
||
flagOff(1);
|
||
}
|
||
|
||
if (mpEffectAnm->play()) {
|
||
mpEffectAnm->setPlaySpeed(0.0f);
|
||
dComIfGp_evmng_cutEnd(mStaffId);
|
||
}
|
||
}
|
||
|
||
/* 80493518-80493838 0028D8 0320+00 7/7 0/0 0/0 .text demoProc__8daTbox_cFv */
|
||
int daTbox_c::demoProc() {
|
||
static char* action_table[] = {"WAIT", "OPEN", "APPEAR", "OPEN_SHORT", "DROP"};
|
||
int act_idx = dComIfGp_evmng_getMyActIdx(mStaffId, action_table, ARRAY_SIZE(action_table), 0, 0);
|
||
int tbox_no;
|
||
|
||
if (dComIfGp_evmng_getIsAddvance(mStaffId)) {
|
||
field_0x758 = false;
|
||
switch (act_idx) {
|
||
case 1:
|
||
OpenInit();
|
||
tbox_no = getTboxNo();
|
||
dTres_c::offStatus(0, tbox_no, 1);
|
||
break;
|
||
case 2:
|
||
flagOn(0x20);
|
||
field_0x750 = -130.0f;
|
||
setDzb();
|
||
flagOff(2);
|
||
tbox_no = getTboxNo();
|
||
dTres_c::onStatus(0, tbox_no, 1);
|
||
demoInitAppear();
|
||
break;
|
||
case 3:
|
||
OpenInit_com();
|
||
tbox_no = getTboxNo();
|
||
dTres_c::offStatus(0, tbox_no, 1);
|
||
break;
|
||
case 4:
|
||
field_0x9ca = 7;
|
||
}
|
||
}
|
||
|
||
switch (act_idx) {
|
||
case 2:
|
||
demoProcAppear();
|
||
surfaceProc();
|
||
break;
|
||
case 1:
|
||
if (field_0x758) {
|
||
dComIfGp_evmng_cutEnd(mStaffId);
|
||
} else {
|
||
if (field_0x97e != 0) {
|
||
mpAnm->setFrame(daPy_getPlayerActorClass()->getBaseAnimeFrame());
|
||
}
|
||
|
||
mpAnm->play();
|
||
|
||
if (mpAnm->getFrameCtrl()->checkState(1)) {
|
||
field_0x758 = true;
|
||
dComIfGp_evmng_cutEnd(mStaffId);
|
||
}
|
||
}
|
||
|
||
field_0x97e++;
|
||
break;
|
||
case 3:
|
||
if (field_0x758) {
|
||
dComIfGp_evmng_cutEnd(mStaffId);
|
||
} else {
|
||
if (field_0x97e != 0) {
|
||
mpAnm->setFrame(daPy_getPlayerActorClass()->getBaseAnimeFrame());
|
||
}
|
||
|
||
mpAnm->play();
|
||
|
||
if (mpAnm->getFrameCtrl()->checkState(1)) {
|
||
field_0x758 = true;
|
||
dComIfGp_evmng_cutEnd(mStaffId);
|
||
}
|
||
}
|
||
|
||
field_0x97e++;
|
||
break;
|
||
case 4:
|
||
if (field_0x9ca > -2) {
|
||
field_0x9ca--;
|
||
}
|
||
|
||
if (field_0x9ca == 0) {
|
||
dropProcInitCall();
|
||
} else if (field_0x9ca < 0) {
|
||
dropProc();
|
||
if (mAcch.ChkGroundHit() && field_0x97d) {
|
||
dComIfGp_evmng_cutEnd(mStaffId);
|
||
}
|
||
}
|
||
break;
|
||
default:
|
||
dComIfGp_evmng_cutEnd(mStaffId);
|
||
break;
|
||
}
|
||
|
||
if (flagCheck(0x10)) {
|
||
demoProcOpen();
|
||
}
|
||
|
||
if (flagCheck(8)) {
|
||
dKy_set_allcol_ratio(mAllcolRatio);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
/* 80493838-804939A4 002BF8 016C+00 2/2 0/0 0/0 .text OpenInit_com__8daTbox_cFv */
|
||
void daTbox_c::OpenInit_com() {
|
||
field_0x97e = 0;
|
||
|
||
if (!field_0x718) {
|
||
dComIfGs_onTbox(getTboxNo());
|
||
setDzb();
|
||
if (mpBgCollision != NULL) {
|
||
mpBgCollision->Move();
|
||
}
|
||
}
|
||
|
||
if (checkEnvEffectTbox()) {
|
||
mAllcolRatio = 0.55f;
|
||
dKy_set_allcol_ratio(mAllcolRatio);
|
||
flagOn(8);
|
||
dKy_efplight_set(&mLight);
|
||
|
||
if (getShapeType() == SHAPE_LARGE) {
|
||
J3DAnmTransform* bck =
|
||
(J3DAnmTransform*)dComIfG_getObjectRes(getModelInfo()->mArcName, 9);
|
||
mpAnm->init(bck, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, bck->getFrameMax(), true);
|
||
mOpenSeId = Z2SE_OBJ_TBOX_OPEN_B_SLOW;
|
||
}
|
||
}
|
||
|
||
mpAnm->setPlaySpeed(0.0f);
|
||
fopAcM_seStart(this, mOpenSeId, 0);
|
||
}
|
||
|
||
/* 804939A4-804939F4 002D64 0050+00 1/1 0/0 0/0 .text OpenInit__8daTbox_cFv */
|
||
void daTbox_c::OpenInit() {
|
||
OpenInit_com();
|
||
field_0x759 = 1;
|
||
mDemoFrame = 0;
|
||
flagOn(0x10);
|
||
setLightPos();
|
||
}
|
||
|
||
/* 804939F4-804939FC 002DB4 0008+00 2/0 0/0 0/0 .text actionWait__8daTbox_cFv */
|
||
int daTbox_c::actionWait() {
|
||
return true;
|
||
}
|
||
|
||
/* 804939FC-80493CC8 002DBC 02CC+00 1/0 0/0 0/0 .text actionDemo__8daTbox_cFv */
|
||
int daTbox_c::actionDemo() {
|
||
if (dComIfGp_evmng_endCheck(eventInfo.getEventId())) {
|
||
if (field_0x718) {
|
||
mpAnm->setPlaySpeed(0.0f);
|
||
mpAnm->setFrame(0.0f);
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
} else {
|
||
setAction(&daTbox_c::actionWait);
|
||
}
|
||
|
||
dComIfGp_event_reset();
|
||
dKy_set_allcol_ratio(1.0f);
|
||
flagOff(0x18);
|
||
dComIfGp_event_setItemPartner(NULL);
|
||
|
||
if (getItemNo() == fpcNm_ITEM_KAKERA_HEART) {
|
||
if (!strcmp(dComIfGp_getStartStageName(), "F_SP121")) {
|
||
if (fopAcM_GetRoomNo(this) == 0) {
|
||
switch (getTboxNo()) {
|
||
case 3:
|
||
dComIfGs_setEventReg(0xedff, dComIfGs_getEventReg(0xedff) | 0x40);
|
||
break;
|
||
case 2:
|
||
dComIfGs_setEventReg(0xebff, dComIfGs_getEventReg(0xebff) | 0x10);
|
||
break;
|
||
default:
|
||
// "Piece of Heart: Unexpected configuration. Couldn't set Event Bit!\n"
|
||
OSReport_Error("ハートの欠片:想定外の配置です。イベントビットセットできませんでした!\n");
|
||
break;
|
||
}
|
||
} else if (fopAcM_GetRoomNo(this) == 3) {
|
||
switch (getTboxNo()) {
|
||
case 5:
|
||
dComIfGs_setEventReg(0xf0ff, dComIfGs_getEventReg(0xf0ff) | 0x80);
|
||
break;
|
||
default:
|
||
// "Piece of Heart: Unexpected configuration. Couldn't set Event Bit!\n"
|
||
OSReport_Error("ハートの欠片:想定外の配置です。イベントビットセットできませんでした!\n");
|
||
break;
|
||
}
|
||
}
|
||
} else if (!strcmp(dComIfGp_getStartStageName(), "F_SP109")) {
|
||
if (fopAcM_GetRoomNo(this) == 0 && getTboxNo() == 21) {
|
||
dComIfGs_setEventReg(0xefff, dComIfGs_getEventReg(0xefff) | 0x10);
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
demoProc();
|
||
}
|
||
|
||
field_0x9f4++;
|
||
return true;
|
||
}
|
||
|
||
/* 80493CC8-80493D90 003088 00C8+00 2/0 0/0 0/0 .text actionDemo2__8daTbox_cFv */
|
||
int daTbox_c::actionDemo2() {
|
||
if ((getEvent() == 0xFF && dComIfGp_evmng_endCheck("DEFAULT_TREASURE_APPEAR")) ||
|
||
(getEvent() != 0xFF && dComIfGp_evmng_endCheck(mEventId))) {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
dComIfGp_event_reset();
|
||
} else {
|
||
demoProc();
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 80493D90-80493ED8 003150 0148+00 2/0 0/0 0/0 .text actionDropDemo__8daTbox_cFv */
|
||
int daTbox_c::actionDropDemo() {
|
||
if (mEventId != -1) {
|
||
if (dComIfGp_evmng_endCheck(mEventId)) {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
dComIfGp_event_reset();
|
||
setDzb();
|
||
home.pos = current.pos;
|
||
|
||
if (field_0x9c9 != 0) {
|
||
camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0));
|
||
camera->mCamera.Start();
|
||
camera->mCamera.SetTrimSize(0);
|
||
field_0x9c9 = 0;
|
||
}
|
||
} else {
|
||
demoProc();
|
||
}
|
||
} else {
|
||
dropProc();
|
||
if (mAcch.ChkGroundLanding() && field_0x97d) {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
home.pos = current.pos;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
/* 80493ED8-80493FE8 003298 0110+00 5/3 0/0 0/0 .text getBombItemNo__8daTbox_cFUcUc */
|
||
u8 daTbox_c::getBombItemNo(u8 i_bombType, u8 i_itemNo) {
|
||
u8 new_item_no = i_itemNo;
|
||
switch (i_bombType) {
|
||
case fpcNm_ITEM_NORMAL_BOMB:
|
||
switch (i_itemNo) {
|
||
case fpcNm_ITEM_WATER_BOMB_5:
|
||
case fpcNm_ITEM_WATER_BOMB_30:
|
||
case fpcNm_ITEM_BOMB_INSECT_5:
|
||
case fpcNm_ITEM_BOMB_INSECT_20:
|
||
new_item_no = fpcNm_ITEM_BOMB_5;
|
||
break;
|
||
case fpcNm_ITEM_WATER_BOMB_10:
|
||
case fpcNm_ITEM_BOMB_INSECT_10:
|
||
new_item_no = fpcNm_ITEM_BOMB_10;
|
||
break;
|
||
case fpcNm_ITEM_WATER_BOMB_20:
|
||
new_item_no = fpcNm_ITEM_BOMB_20;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_INSECT_30:
|
||
new_item_no = fpcNm_ITEM_BOMB_30;
|
||
break;
|
||
}
|
||
break;
|
||
case fpcNm_ITEM_WATER_BOMB:
|
||
switch (i_itemNo) {
|
||
case fpcNm_ITEM_BOMB_INSECT_20:
|
||
case fpcNm_ITEM_BOMB_INSECT_30:
|
||
new_item_no = fpcNm_ITEM_WATER_BOMB_30;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_5:
|
||
case fpcNm_ITEM_BOMB_INSECT_5:
|
||
new_item_no = fpcNm_ITEM_WATER_BOMB_5;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_10:
|
||
case fpcNm_ITEM_BOMB_INSECT_10:
|
||
new_item_no = fpcNm_ITEM_WATER_BOMB_10;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_20:
|
||
case fpcNm_ITEM_BOMB_30:
|
||
new_item_no = fpcNm_ITEM_WATER_BOMB_20;
|
||
break;
|
||
}
|
||
break;
|
||
case fpcNm_ITEM_POKE_BOMB:
|
||
switch (i_itemNo) {
|
||
case fpcNm_ITEM_WATER_BOMB_30:
|
||
new_item_no = fpcNm_ITEM_BOMB_INSECT_20;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_5:
|
||
case fpcNm_ITEM_WATER_BOMB_5:
|
||
new_item_no = fpcNm_ITEM_BOMB_INSECT_5;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_10:
|
||
case fpcNm_ITEM_BOMB_20:
|
||
case fpcNm_ITEM_BOMB_30:
|
||
case fpcNm_ITEM_WATER_BOMB_10:
|
||
case fpcNm_ITEM_WATER_BOMB_20:
|
||
new_item_no = fpcNm_ITEM_BOMB_INSECT_10;
|
||
break;
|
||
}
|
||
break;
|
||
case fpcNm_ITEM_BOMB_BAG_LV1:
|
||
break;
|
||
}
|
||
|
||
// "Bomb Check\n"
|
||
OS_REPORT("\x1b[43;30m爆弾チェック\n");
|
||
if (i_itemNo == new_item_no) {
|
||
// "Get bomb %d as is\n"
|
||
OS_REPORT("爆弾 %d をそのままゲットします\n\x1b[m", new_item_no);
|
||
} else {
|
||
// "Bomb %d replaced by %d\n"
|
||
OS_REPORT("爆弾 %d を %d に差し替えました\n\x1b[m", i_itemNo, new_item_no);
|
||
}
|
||
|
||
return new_item_no;
|
||
}
|
||
|
||
/* 80493FE8-80494144 0033A8 015C+00 1/1 0/0 0/0 .text getBombItemNo2__8daTbox_cFUcUcUc */
|
||
u8 daTbox_c::getBombItemNo2(u8 i_bombType1, u8 i_bombType2, u8 i_itemNo) {
|
||
u8 new_type, new_item_no = i_itemNo;
|
||
switch (i_itemNo) {
|
||
case fpcNm_ITEM_BOMB_5:
|
||
case fpcNm_ITEM_BOMB_10:
|
||
case fpcNm_ITEM_BOMB_20:
|
||
case fpcNm_ITEM_BOMB_30:
|
||
new_type = fpcNm_ITEM_NORMAL_BOMB;
|
||
break;
|
||
case fpcNm_ITEM_WATER_BOMB_5:
|
||
case fpcNm_ITEM_WATER_BOMB_10:
|
||
case fpcNm_ITEM_WATER_BOMB_20:
|
||
case fpcNm_ITEM_WATER_BOMB_30:
|
||
new_type = fpcNm_ITEM_WATER_BOMB;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_INSECT_5:
|
||
case fpcNm_ITEM_BOMB_INSECT_10:
|
||
case fpcNm_ITEM_BOMB_INSECT_20:
|
||
case fpcNm_ITEM_BOMB_INSECT_30:
|
||
new_type = fpcNm_ITEM_POKE_BOMB;
|
||
break;
|
||
}
|
||
|
||
// "Bomb Check - 2 Bags\n"
|
||
OS_REPORT("\x1b[43;30m爆弾チェック・袋2個\n");
|
||
// "Bomb Type is %d\n"
|
||
OS_REPORT("爆弾の種別は %d です\n", new_type);
|
||
|
||
if (i_bombType1 == new_type || i_bombType2 == new_type) {
|
||
// "There's a bag with the same bomb in it\n"
|
||
OS_REPORT("同じ爆弾入りの袋があるのでそこに入れます\n");
|
||
} else if (i_bombType1 == fpcNm_ITEM_BOMB_BAG_LV1 || i_bombType2 == fpcNm_ITEM_BOMB_BAG_LV1) {
|
||
// "This is an empty bag so put it in\n"
|
||
OS_REPORT("空の袋があるのでそこに入れます\n");
|
||
} else {
|
||
switch (new_type) {
|
||
case fpcNm_ITEM_NORMAL_BOMB:
|
||
if (i_bombType1 == fpcNm_ITEM_WATER_BOMB || i_bombType2 == fpcNm_ITEM_WATER_BOMB) {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_WATER_BOMB, i_itemNo);
|
||
} else {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_POKE_BOMB, i_itemNo);
|
||
}
|
||
break;
|
||
case fpcNm_ITEM_WATER_BOMB:
|
||
if (i_bombType1 == fpcNm_ITEM_NORMAL_BOMB || i_bombType2 == fpcNm_ITEM_NORMAL_BOMB) {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_NORMAL_BOMB, i_itemNo);
|
||
} else {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_POKE_BOMB, i_itemNo);
|
||
}
|
||
break;
|
||
case fpcNm_ITEM_POKE_BOMB:
|
||
if (i_bombType1 == fpcNm_ITEM_NORMAL_BOMB || i_bombType2 == fpcNm_ITEM_NORMAL_BOMB) {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_NORMAL_BOMB, i_itemNo);
|
||
} else {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_WATER_BOMB, i_itemNo);
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
OS_REPORT("\x1b[m\n");
|
||
return new_item_no;
|
||
}
|
||
|
||
/* 80494144-804942CC 003504 0188+00 1/1 0/0 0/0 .text getBombItemNo3__8daTbox_cFUcUcUcUc
|
||
*/
|
||
u8 daTbox_c::getBombItemNo3(u8 i_bombType1, u8 i_bombType2, u8 i_bombType3, u8 i_itemNo) {
|
||
u8 new_type, new_item_no = i_itemNo;
|
||
switch (i_itemNo) {
|
||
case fpcNm_ITEM_BOMB_5:
|
||
case fpcNm_ITEM_BOMB_10:
|
||
case fpcNm_ITEM_BOMB_20:
|
||
case fpcNm_ITEM_BOMB_30:
|
||
new_type = fpcNm_ITEM_NORMAL_BOMB;
|
||
break;
|
||
case fpcNm_ITEM_WATER_BOMB_5:
|
||
case fpcNm_ITEM_WATER_BOMB_10:
|
||
case fpcNm_ITEM_WATER_BOMB_20:
|
||
case fpcNm_ITEM_WATER_BOMB_30:
|
||
new_type = fpcNm_ITEM_WATER_BOMB;
|
||
break;
|
||
case fpcNm_ITEM_BOMB_INSECT_5:
|
||
case fpcNm_ITEM_BOMB_INSECT_10:
|
||
case fpcNm_ITEM_BOMB_INSECT_20:
|
||
case fpcNm_ITEM_BOMB_INSECT_30:
|
||
new_type = fpcNm_ITEM_POKE_BOMB;
|
||
break;
|
||
}
|
||
|
||
// "Bomb Check - 3 Bags\n"
|
||
OS_REPORT("\x1b[43;30m爆弾チェック・袋3個\n");
|
||
// "Bomb Type is %d\n"
|
||
OS_REPORT("爆弾の種別は %d です\n", new_type);
|
||
|
||
if (i_bombType1 == new_type || i_bombType2 == new_type || i_bombType3 == new_type) {
|
||
// "There's a bag with the same bomb in it\n"
|
||
OS_REPORT("同じ爆弾入りの袋があるのでそこに入れます\n");
|
||
} else if (i_bombType1 == fpcNm_ITEM_BOMB_BAG_LV1 || i_bombType2 == fpcNm_ITEM_BOMB_BAG_LV1 || i_bombType3 == fpcNm_ITEM_BOMB_BAG_LV1) {
|
||
// "This is an empty bag so put it in\n"
|
||
OS_REPORT("空の袋があるのでそこに入れます\n");
|
||
} else {
|
||
switch (new_type) {
|
||
case fpcNm_ITEM_NORMAL_BOMB:
|
||
if (i_bombType1 == fpcNm_ITEM_WATER_BOMB || i_bombType2 == fpcNm_ITEM_WATER_BOMB || i_bombType3 == fpcNm_ITEM_WATER_BOMB) {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_WATER_BOMB, i_itemNo);
|
||
} else {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_POKE_BOMB, i_itemNo);
|
||
}
|
||
break;
|
||
case fpcNm_ITEM_WATER_BOMB:
|
||
if (i_bombType1 == fpcNm_ITEM_NORMAL_BOMB || i_bombType2 == fpcNm_ITEM_NORMAL_BOMB || i_bombType3 == fpcNm_ITEM_NORMAL_BOMB) {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_NORMAL_BOMB, i_itemNo);
|
||
} else {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_POKE_BOMB, i_itemNo);
|
||
}
|
||
break;
|
||
case fpcNm_ITEM_POKE_BOMB:
|
||
if (i_bombType1 == fpcNm_ITEM_NORMAL_BOMB || i_bombType2 == fpcNm_ITEM_NORMAL_BOMB || i_bombType3 == fpcNm_ITEM_NORMAL_BOMB) {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_NORMAL_BOMB, i_itemNo);
|
||
} else {
|
||
new_item_no = getBombItemNo(fpcNm_ITEM_WATER_BOMB, i_itemNo);
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
OS_REPORT("\x1b[m\n");
|
||
return new_item_no;
|
||
}
|
||
|
||
/* 804942CC-804945C8 00368C 02FC+00 1/1 0/0 0/0 .text getBombItemNoMain__8daTbox_cFUc */
|
||
u8 daTbox_c::getBombItemNoMain(u8 i_itemNo) {
|
||
u8 bomb_type[3], bomb_max[3], bomb_num[3];
|
||
u8 bag_count = 0;
|
||
|
||
for (int i = 0; i < 3; i++) {
|
||
bomb_type[i] = dComIfGs_getItem(SLOT_15 + i, false);
|
||
bomb_max[i] = dComIfGs_getBombMax(bomb_type[i]);
|
||
bomb_num[i] = dComIfGs_getBombNum(i);
|
||
|
||
if (bomb_type[i] != fpcNm_ITEM_NONE) {
|
||
bag_count++;
|
||
}
|
||
}
|
||
|
||
#ifdef DEBUG
|
||
// "====Bomb Bag count is %d====\n"
|
||
OS_REPORT("====バクダン袋の数は %d 個です====\n", bag_count);
|
||
for (int i = 0; i < 3; i++) {
|
||
// "Bomb Bag<%d> : Type <%d> Max <%d> Current <%d>\n"
|
||
OS_REPORT("爆弾袋<%d> : 種別 <%d> 最大 <%d> 現在 <%d>\n", i, bomb_type[i], bomb_max[i], dComIfGs_getBombNum(i));
|
||
}
|
||
OS_REPORT("==================================\n");
|
||
#endif
|
||
|
||
switch (bag_count) {
|
||
case 0:
|
||
break;
|
||
case 1:
|
||
i_itemNo = getBombItemNo(bomb_type[0], i_itemNo);
|
||
break;
|
||
case 2:
|
||
if (bomb_num[0] == bomb_max[0] && bomb_max[0] != 0) {
|
||
if (bomb_num[1] == bomb_max[1] && bomb_max[1] != 0) {
|
||
// "Both Bomb Bags are full!\n"
|
||
OS_REPORT("\x1b[43;30mバクダン袋2つ共一杯でした!\n\x1b[m");
|
||
} else {
|
||
// "Bag 2 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋2のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo(bomb_type[1], i_itemNo);
|
||
}
|
||
} else if (bomb_num[1] == bomb_max[1] && bomb_max[1] != 0) {
|
||
// "Bag 1 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋1のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo(bomb_type[0], i_itemNo);
|
||
} else {
|
||
// "Bag 1 and 2 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋1と2のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo2(bomb_type[0], bomb_type[1], i_itemNo);
|
||
}
|
||
break;
|
||
case 3:
|
||
if (bomb_num[0] == bomb_max[0] && bomb_max[0] != 0) {
|
||
if (bomb_num[1] == bomb_max[1] && bomb_max[1] != 0) {
|
||
if (bomb_num[2] == bomb_max[2] && bomb_max[2] != 0) {
|
||
// "All 3 Bomb Bags are full!\n"
|
||
OS_REPORT("\x1b[43;30mバクダン袋3つ共一杯でした!\n\x1b[m");
|
||
} else {
|
||
// "Bag 3 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋3のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo(bomb_type[2], i_itemNo);
|
||
}
|
||
} else if (bomb_num[2] == bomb_max[2] && bomb_max[2] != 0) {
|
||
// "Bag 2 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋2のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo(bomb_type[1], i_itemNo);
|
||
} else {
|
||
// "Bag 2 or 3 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋2か3のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo2(bomb_type[1], bomb_type[2], i_itemNo);
|
||
}
|
||
} else if (bomb_num[1] == bomb_max[1] && bomb_max[1] != 0) {
|
||
if (bomb_num[2] == bomb_max[2] && bomb_max[2] != 0) {
|
||
// "Bag 1 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋1のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo(bomb_type[0], i_itemNo);
|
||
} else {
|
||
// "Bag 1 and 3 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋1と3のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo2(bomb_type[0], bomb_type[2], i_itemNo);
|
||
}
|
||
} else if (bomb_num[2] == bomb_max[2] && bomb_max[2] != 0) {
|
||
// "Bag 1 and 2 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋1と2のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo2(bomb_type[0], bomb_type[1], i_itemNo);
|
||
} else {
|
||
// "Bag 1, 2 and 3 Get Bomb!\n"
|
||
OS_REPORT("\x1b[43;30m袋1と2と3のバクダンをゲット!\n\x1b[m");
|
||
i_itemNo = getBombItemNo3(bomb_type[0], bomb_type[1], bomb_type[2], i_itemNo);
|
||
}
|
||
break;
|
||
default:
|
||
// "Get Item: Wrong number of bomb bags!<%d>\n"
|
||
OS_REPORT("\x1b[41;37mゲットアイテム:バクダン袋の数がおかしい!<%d>\n\x1b[m", bag_count);
|
||
JUT_ASSERT(0xABD, 0);
|
||
break;
|
||
}
|
||
|
||
return i_itemNo;
|
||
}
|
||
|
||
/* 804945C8-804946A4 003988 00DC+00 1/1 0/0 0/0 .text setGetDemoItem__8daTbox_cFv */
|
||
int daTbox_c::setGetDemoItem() {
|
||
u8 item_no = getItemNo();
|
||
if (item_no == fpcNm_ITEM_BOMB_5 || item_no == fpcNm_ITEM_BOMB_10 || item_no == fpcNm_ITEM_BOMB_20 || item_no == fpcNm_ITEM_BOMB_30 ||
|
||
item_no == fpcNm_ITEM_WATER_BOMB_5 || item_no == fpcNm_ITEM_WATER_BOMB_10 || item_no == fpcNm_ITEM_WATER_BOMB_20 || item_no == fpcNm_ITEM_WATER_BOMB_30 ||
|
||
item_no == fpcNm_ITEM_BOMB_INSECT_5 || item_no == fpcNm_ITEM_BOMB_INSECT_10 || item_no == fpcNm_ITEM_BOMB_INSECT_20 || item_no == fpcNm_ITEM_BOMB_INSECT_30)
|
||
{
|
||
item_no = getBombItemNoMain(item_no);
|
||
}
|
||
|
||
fpc_ProcID item_id;
|
||
if (field_0x718) {
|
||
item_id = fopAcM_createItemForPresentDemo(¤t.pos, item_no, 1, -1, -1, NULL, NULL);
|
||
} else {
|
||
item_id = fopAcM_createItemForTrBoxDemo(¤t.pos, item_no, -1, -1, NULL, NULL);
|
||
}
|
||
|
||
if (item_id != fpcM_ERROR_PROCESS_ID_e) {
|
||
dComIfGp_event_setItemPartnerId(item_id);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 804946A4-804948CC 003A64 0228+00 11/0 0/0 0/0 .text actionOpenWait__8daTbox_cFv */
|
||
int daTbox_c::actionOpenWait() {
|
||
daMidna_c* midna = daPy_py_c::getMidnaActor();
|
||
daPy_py_c* player = daPy_getPlayerActorClass();
|
||
|
||
if (eventInfo.i_checkCommandDoor()) {
|
||
dComIfGp_event_onEventFlag(4);
|
||
|
||
if (getShapeType() != SHAPE_SMALL && player->i_checkNowWolf() &&
|
||
!midna->checkMetamorphoseEnable()) {
|
||
setAction(&daTbox_c::actionNotOpenDemo);
|
||
mStaffId = dComIfGp_evmng_getMyStaffId(l_staff_name, NULL, 0);
|
||
demoProc();
|
||
field_0x9f4 = 0;
|
||
} else {
|
||
field_0x718 = player->checkTreasureRupeeReturn(getItemNo());
|
||
setGetDemoItem();
|
||
setAction(&daTbox_c::actionDemo);
|
||
mStaffId = dComIfGp_evmng_getMyStaffId(l_staff_name, NULL, 0);
|
||
demoProc();
|
||
field_0x9f4 = 0;
|
||
}
|
||
} else if (boxCheck()) {
|
||
eventInfo.i_onCondition(4);
|
||
if (getShapeType() == SHAPE_SMALL) {
|
||
eventInfo.setEventName("DEFAULT_TREASURE_SIMPLE");
|
||
} else if (player->i_checkNowWolf() && !midna->checkMetamorphoseEnable()) {
|
||
eventInfo.setEventName("DEFAULT_TREASURE_NOTOPEN");
|
||
} else if (getShapeType() == SHAPE_BOSSKEY) {
|
||
eventInfo.setEventId(field_0x984);
|
||
} else if (checkEnvEffectTbox()) {
|
||
eventInfo.setEventName("DEFAULT_TREASURE_EFFECT");
|
||
} else {
|
||
eventInfo.setEventName("DEFAULT_TREASURE_NORMAL");
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 804948CC-80494950 003C8C 0084+00 1/0 0/0 0/0 .text actionNotOpenDemo__8daTbox_cFv */
|
||
int daTbox_c::actionNotOpenDemo() {
|
||
if (dComIfGp_evmng_endCheck(mEventId)) {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
dComIfGp_event_reset();
|
||
} else {
|
||
demoProc();
|
||
}
|
||
return true;
|
||
}
|
||
|
||
/* 80494950-80494A0C 003D10 00BC+00 3/3 0/0 0/0 .text checkDrop__8daTbox_cFv */
|
||
int daTbox_c::checkDrop() {
|
||
if (getSwType() == 15) {
|
||
if (dComIfGs_isSwitch(getSwNo(), fopAcM_GetRoomNo(this))) {
|
||
return true;
|
||
}
|
||
} else if (getSwType() == 0) {
|
||
for (int i = 0; i < 4; i++) {
|
||
if (fopAcM_isSwitch(this, getSwNo() + i)) {
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
/* 80494A0C-80494D88 003DCC 037C+00 1/1 0/0 0/0 .text settingDropDemoCamera__8daTbox_cFv
|
||
*/
|
||
void daTbox_c::settingDropDemoCamera() {
|
||
camera_class* player_camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0));
|
||
player_camera->mCamera.Stop();
|
||
|
||
dStage_MapEvent_dt_c* maptooldata = dEvt_control_c::searchMapEventData(getEvent(), fopAcM_GetRoomNo(this));
|
||
JUT_ASSERT(0xB89, maptooldata != 0);
|
||
|
||
player_camera->mCamera.SetTrimSize(maptooldata->field_0x1);
|
||
|
||
dStage_roomDt_c* roomdt = dComIfGp_roomControl_getStatusRoomDt(fopAcM_GetRoomNo(this));
|
||
JUT_ASSERT(0xB8E, roomdt != 0);
|
||
|
||
stage_camera_class* stage_camera = roomdt->getCamera();
|
||
stage_camera2_data_class* stage_camera_data = stage_camera->mEntries;
|
||
stage_camera_data += maptooldata->field_0x16;
|
||
|
||
stage_arrow_class* stage_arrow = roomdt->getArrow();
|
||
stage_arrow_data_class* stage_arrow_data = stage_arrow->mEntries;
|
||
stage_arrow_data += stage_camera_data->field_0x10;
|
||
|
||
cXyz spA0;
|
||
cXyz spAC;
|
||
|
||
spA0.x = stage_arrow_data->mPosition.x;
|
||
spA0.z = stage_arrow_data->mPosition.z;
|
||
spAC.x = home.pos.x;
|
||
spAC.z = home.pos.z;
|
||
f32 var_f30 = spA0.abs(spAC);
|
||
|
||
cXyz spB8;
|
||
cXyz spC4(cXyz::BaseY);
|
||
|
||
s16 angle;
|
||
getDropSAngle(&angle);
|
||
|
||
spB8.x = stage_arrow_data->mPosition.x;
|
||
spB8.y = 0.0f;
|
||
spB8.z = stage_arrow_data->mPosition.z;
|
||
spB8 -= home.pos;
|
||
|
||
Mtx mtx;
|
||
MTXRotAxisRad(mtx, &spC4, cM_s2rad(angle));
|
||
mDoMtx_multVec(mtx, &spB8, &spB8);
|
||
spB8 += home.pos;
|
||
spB8.y = stage_arrow_data->mPosition.y;
|
||
|
||
cXyz cam_eye;
|
||
cXyz cam_center;
|
||
|
||
cam_eye = spB8;
|
||
cam_center = home.pos;
|
||
|
||
f32 var_f29 = cM_ssin(stage_arrow_data->mAngle.x);
|
||
f32 var_f28 = cM_scos(stage_arrow_data->mAngle.x);
|
||
f32 dist = var_f30 * (var_f29 / var_f28);
|
||
if (stage_arrow_data->mAngle.x > 0) {
|
||
dist = -dist;
|
||
}
|
||
|
||
cam_center.y = cam_eye.y + dist;
|
||
player_camera->mCamera.Set(cam_center, cam_eye, 0, (f32)stage_camera_data->field_0x11);
|
||
field_0x9c9 = 1;
|
||
}
|
||
|
||
/* 80494D88-80494E98 004148 0110+00 1/0 0/0 0/0 .text actionSwOnWait__8daTbox_cFv */
|
||
int daTbox_c::actionSwOnWait() {
|
||
if (eventInfo.i_checkCommandDemoAccrpt()) {
|
||
setAction(&daTbox_c::actionDemo2);
|
||
mStaffId = dComIfGp_evmng_getMyStaffId(l_staff_name, NULL, 0);
|
||
demoProc();
|
||
} else if (dComIfGs_isSwitch(getSwNo(), fopAcM_GetRoomNo(this))) {
|
||
if (getEvent() == 0xff) {
|
||
fopAcM_orderOtherEvent(this, "DEFAULT_TREASURE_APPEAR", 0xffff, 1, 0);
|
||
} else {
|
||
fopAcM_orderOtherEventId(this, mEventId, getEvent(), 0xffff, 0, 1);
|
||
}
|
||
eventInfo.i_onCondition(2);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 80494E98-80494F44 004258 00AC+00 1/0 0/0 0/0 .text actionSwOnWait2__8daTbox_cFv */
|
||
int daTbox_c::actionSwOnWait2() {
|
||
if (dComIfGs_isSwitch(getSwNo(), fopAcM_GetRoomNo(this))) {
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
setDzb();
|
||
flagOff(0x43);
|
||
int tbox_no = getTboxNo();
|
||
dTres_c::onStatus(0, tbox_no, 1);
|
||
} else {
|
||
flagOn(0x40);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 80494F44-80495058 004304 0114+00 1/0 0/0 0/0 .text actionDropWait__8daTbox_cFv */
|
||
int daTbox_c::actionDropWait() {
|
||
if (eventInfo.i_checkCommandDemoAccrpt()) {
|
||
setAction(&daTbox_c::actionDropDemo);
|
||
clrDzb();
|
||
field_0x97d = false;
|
||
mStaffId = dComIfGp_evmng_getMyStaffId(l_staff_name, NULL, 0);
|
||
if (getSwType() == 0) {
|
||
settingDropDemoCamera();
|
||
}
|
||
} else if (checkDrop()) {
|
||
if (mEventId != -1) {
|
||
fopAcM_orderOtherEventId(this, mEventId, getEvent(), 0xffff, 0, 1);
|
||
eventInfo.i_onCondition(2);
|
||
} else {
|
||
dropProcInitCall();
|
||
setAction(&daTbox_c::actionDropDemo);
|
||
field_0x97d = false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 80495058-8049518C 004418 0134+00 1/0 0/0 0/0 .text actionGenocide__8daTbox_cFv */
|
||
int daTbox_c::actionGenocide() {
|
||
if (eventInfo.i_checkCommandDemoAccrpt()) {
|
||
setAction(&daTbox_c::actionDemo2);
|
||
mStaffId = dComIfGp_evmng_getMyStaffId(l_staff_name, NULL, 0);
|
||
demoProc();
|
||
} else if (!fopAcM_myRoomSearchEnemy(fopAcM_GetRoomNo(this))) {
|
||
if (mTimer != 0) {
|
||
mTimer--;
|
||
} else {
|
||
if (getEvent() == 0xff) {
|
||
fopAcM_orderOtherEvent(this, "DEFAULT_TREASURE_APPEAR", 0xffff, 1, 0);
|
||
} else {
|
||
fopAcM_orderOtherEventId(this, mEventId, getEvent(), 0xffff, 0, 1);
|
||
}
|
||
eventInfo.i_onCondition(2);
|
||
dComIfGs_onSwitch(getSwNo(), fopAcM_GetRoomNo(this));
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
/* 8049518C-80495250 00454C 00C4+00 1/0 0/0 0/0 .text actionDropWaitForWeb__8daTbox_cFv
|
||
*/
|
||
int daTbox_c::actionDropWaitForWeb() {
|
||
if (field_0x9fd != 0) {
|
||
if (field_0x9fc != 0) {
|
||
field_0x9fd = 0;
|
||
return true;
|
||
}
|
||
} else {
|
||
if (field_0x9fc == 0) {
|
||
setAction(&daTbox_c::actionDropForWeb);
|
||
shape_angle.z = 0;
|
||
shape_angle.x = 0;
|
||
fopAcM_SetGravity(this, -2.0f);
|
||
fopAcM_onSwitch(this, getSwNo());
|
||
|
||
// "Treasure Chest: Falling!<%d>\n"
|
||
OS_REPORT("宝箱:落下!<%d>\n", getSwNo());
|
||
}
|
||
}
|
||
|
||
setBaseMtx();
|
||
field_0x9fc = 0;
|
||
return true;
|
||
}
|
||
|
||
/* 80495250-804953D4 004610 0184+00 1/0 0/0 0/0 .text actionDropForWeb__8daTbox_cFv */
|
||
int daTbox_c::actionDropForWeb() {
|
||
fopAcM_posMoveF(this, NULL);
|
||
mAcch.CrrPos(dComIfG_Bgsp());
|
||
|
||
home.pos = current.pos;
|
||
attention_info.position = current.pos;
|
||
eyePos = current.pos;
|
||
|
||
setBaseMtx();
|
||
|
||
if (mAcch.ChkGroundLanding()) {
|
||
cXyz vec(2.0f, 2.0f, 2.0f);
|
||
dComIfGp_particle_setPolyColor(0xe7, mAcch.m_gnd, ¤t.pos, &tevStr, &home.angle,
|
||
&vec, 0, NULL, fopAcM_GetRoomNo(this), NULL);
|
||
dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f));
|
||
setDzb();
|
||
|
||
if (mpBgCollision != NULL) {
|
||
mpBgCollision->Move();
|
||
}
|
||
|
||
setAction(&daTbox_c::actionOpenWait);
|
||
}
|
||
|
||
dTres_c::setPosition(getTboxNo(), ¤t.pos);
|
||
return true;
|
||
}
|
||
|
||
/* 804953D4-80495490 004794 00BC+00 1/1 0/0 0/0 .text initBaseMtx__8daTbox_cFv */
|
||
void daTbox_c::initBaseMtx() {
|
||
field_0x9c4 = 0;
|
||
mRotAxis = cXyz::BaseX;
|
||
mDoMtx_identity(field_0x988);
|
||
|
||
mpModel->setBaseScale(scale);
|
||
if (mpSlimeModel != NULL) {
|
||
mpSlimeModel->setBaseScale(scale);
|
||
}
|
||
|
||
setBaseMtx();
|
||
|
||
if (mpBgW != NULL) {
|
||
mpBgW->Move();
|
||
}
|
||
if (mpOpenBgW != NULL) {
|
||
mpOpenBgW->Move();
|
||
}
|
||
}
|
||
|
||
/* 80495490-80495660 004850 01D0+00 4/4 0/0 0/0 .text setBaseMtx__8daTbox_cFv */
|
||
void daTbox_c::setBaseMtx() {
|
||
Mtx mtx;
|
||
if (field_0x9c4 == 0) {
|
||
mDoMtx_identity(mtx);
|
||
} else {
|
||
MTXRotAxisRad(mtx, &mRotAxis, cM_s2rad(field_0x9c4));
|
||
}
|
||
|
||
s16 angle;
|
||
if (getDropSAngle(&angle) && std::fabs(speed.y) > 2.0f) {
|
||
cLib_addCalcAngleS(&home.angle.y, angle, 10, 0xc00, 0x400);
|
||
shape_angle = home.angle;
|
||
}
|
||
|
||
mDoMtx_stack_c::transS(current.pos);
|
||
mDoMtx_stack_c::transM(0.0f, 50.0f, 0.0f);
|
||
mDoMtx_stack_c::concat(mtx);
|
||
mDoMtx_stack_c::concat(field_0x988);
|
||
mDoMtx_stack_c::ZXYrotM(shape_angle);
|
||
mDoMtx_stack_c::transM(0.0f, -50.0f, 0.0f);
|
||
|
||
if (field_0x9fc != 0) {
|
||
mpModel->setBaseTRMtx(field_0xa00);
|
||
} else {
|
||
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
||
}
|
||
|
||
mDoMtx_concat(mtx, field_0x988, field_0x988);
|
||
MTXCopy(mpModel->getBaseTRMtx(), mBgMtx);
|
||
|
||
if (mpSlimeModel != NULL) {
|
||
mDoMtx_stack_c::transS(current.pos.x, current.pos.y + 15.0f, current.pos.z);
|
||
mDoMtx_stack_c::ZXYrotM(shape_angle);
|
||
mpSlimeModel->setBaseTRMtx(mDoMtx_stack_c::get());
|
||
}
|
||
}
|
||
|
||
/* 804968FC-80496930 00006C 0034+00 0/1 0/0 0/0 .bss l_HIO */
|
||
static daTbox_HIO_c l_HIO;
|
||
|
||
/* 80495660-804956EC 004A20 008C+00 1/1 0/0 0/0 .text mode_proc_call__8daTbox_cFv */
|
||
void daTbox_c::mode_proc_call() {
|
||
static daTbox_modeFn l_func[2] = {
|
||
&daTbox_c::mode_exec_wait,
|
||
&daTbox_c::mode_exec,
|
||
};
|
||
(this->*l_func[mMode])();
|
||
}
|
||
|
||
/* 804956EC-80495818 004AAC 012C+00 1/0 0/0 0/0 .text mode_exec_wait__8daTbox_cFv */
|
||
void daTbox_c::mode_exec_wait() {
|
||
bool bvar1 = false;
|
||
|
||
if (field_0x9cc != 0) {
|
||
flagOn(0x40);
|
||
cXyz start(home.pos);
|
||
cXyz end(home.pos);
|
||
start.y += 5.0f;
|
||
end.y -= 30.0f;
|
||
|
||
if (fopAcM_lc_c::lineCheck(&start, &end, this) && fopAcM_lc_c::checkMoveBG()) {
|
||
bvar1 = true;
|
||
home.pos = *fopAcM_lc_c::getCrossP();
|
||
current.pos = home.pos;
|
||
}
|
||
}
|
||
|
||
if (bvar1) {
|
||
flagOff(0x40);
|
||
mMode = MODE_EXEC;
|
||
mode_exec();
|
||
}
|
||
}
|
||
|
||
/* 80495818-80495910 004BD8 00F8+00 2/1 0/0 0/0 .text mode_exec__8daTbox_cFv */
|
||
void daTbox_c::mode_exec() {
|
||
action();
|
||
|
||
if (getFuncType() == 5 || getFuncType() == 6 || field_0x9cc == 1) {
|
||
fopAcM_posMoveF(this, NULL);
|
||
|
||
if (field_0x97c) {
|
||
mAcch.CrrPos(dComIfG_Bgsp());
|
||
} else {
|
||
mAcch.ClrGroundHit();
|
||
}
|
||
|
||
attention_info.position = current.pos;
|
||
eyePos = current.pos;
|
||
setBaseMtx();
|
||
|
||
if (mpBgCollision == mpOpenBgW) {
|
||
mpBgCollision->Move();
|
||
}
|
||
|
||
dTres_c::setPosition(getTboxNo(), ¤t.pos);
|
||
}
|
||
}
|
||
|
||
/* 80495910-804959EC 004CD0 00DC+00 1/1 0/0 0/0 .text create1st__8daTbox_cFv */
|
||
cPhs__Step daTbox_c::create1st() {
|
||
if (!mParamsInit) {
|
||
field_0x980 = home.angle.x;
|
||
field_0x982 = home.angle.z;
|
||
home.angle.z = 0;
|
||
home.angle.x = 0;
|
||
mParamsInit = true;
|
||
}
|
||
|
||
if (getShapeType() > 2) {
|
||
OS_REPORT("\x1b[43;30mTbox Type Error!!!<%d>\n\x1b[m", getShapeType());
|
||
JUT_ASSERT(0xDD8, 0);
|
||
}
|
||
|
||
daTbox_ModelInfo* model_info = getModelInfo();
|
||
cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&mPhase, model_info->mArcName);
|
||
if (step != cPhs_COMPLEATE_e) {
|
||
return step;
|
||
}
|
||
|
||
step = (cPhs__Step)MoveBGCreate(model_info->mArcName, model_info->mClosedDzbResNo,
|
||
dBgS_MoveBGProc_TypicalRotY, calcHeapSize(), NULL);
|
||
if (step == cPhs_ERROR_e) {
|
||
return step;
|
||
}
|
||
|
||
CreateInit();
|
||
attention_info.flags = 0x40;
|
||
attention_info.flags |= 0x400000;
|
||
return step;
|
||
}
|
||
|
||
/* 804959EC-80495AF0 004DAC 0104+00 1/0 0/0 0/0 .text Execute__8daTbox_cFPPA3_A4_f */
|
||
int daTbox_c::Execute(Mtx** param_0) {
|
||
mode_proc_call();
|
||
*param_0 = &mBgMtx;
|
||
|
||
cXyz center(l_cyl_info[getShapeType()].mCenter);
|
||
mDoMtx_stack_c::YrotS(shape_angle.y);
|
||
mDoMtx_stack_c::multVec(¢er, ¢er);
|
||
center += current.pos;
|
||
|
||
if ((getSwNo() != 0xff && fopAcM_isSwitch(this, getSwNo())) || getSwNo() == 0xff) {
|
||
mCyl.SetC(center);
|
||
dComIfG_Ccsp()->Set(&mCyl);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
/* 80495AF0-80495C9C 004EB0 01AC+00 1/0 0/0 0/0 .text Draw__8daTbox_cFv */
|
||
int daTbox_c::Draw() {
|
||
if (flagCheck(0x40)) {
|
||
return true;
|
||
}
|
||
|
||
g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr);
|
||
|
||
if (mpEffectModel != NULL && mpEffectAnm->getPlaySpeed() != 0.0f) {
|
||
g_env_light.setLightTevColorType_MAJI(mpEffectModel, &tevStr);
|
||
mpEffectAnm->entry(mpEffectModel->getModelData());
|
||
mDoExt_modelUpdateDL(mpEffectModel);
|
||
mDoExt_brkAnmRemove(mpEffectModel->getModelData());
|
||
}
|
||
|
||
if (flagCheck(1)) {
|
||
return true;
|
||
}
|
||
|
||
g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr);
|
||
|
||
if (mpSlimeModel != NULL) {
|
||
dComIfGd_setXluListBG();
|
||
mDoExt_modelUpdateDL(mpSlimeModel);
|
||
dComIfGd_setList();
|
||
}
|
||
|
||
mpAnm->entry(mpModel->getModelData());
|
||
|
||
if (getShapeType() == SHAPE_BOSSKEY) {
|
||
fopAcM_setEffectMtx(this, mpModel->getModelData());
|
||
}
|
||
|
||
dComIfGd_setListBG();
|
||
mDoExt_modelUpdateDL(mpModel);
|
||
dComIfGd_setList();
|
||
return true;
|
||
}
|
||
|
||
/* 80495C9C-80495CFC 00505C 0060+00 1/0 0/0 0/0 .text Delete__8daTbox_cFv */
|
||
int daTbox_c::Delete() {
|
||
if (mpBgCollision != NULL) {
|
||
dComIfG_Bgsp().Release(mpBgCollision);
|
||
}
|
||
|
||
dComIfG_resDelete(&mPhase, getModelInfo()->mArcName);
|
||
return true;
|
||
}
|
||
|
||
/* 80495CFC-80495E38 0050BC 013C+00 1/0 0/0 0/0 .text daTbox_create1st__FP8daTbox_c */
|
||
cPhs__Step daTbox_create1st(daTbox_c* i_this) {
|
||
fopAcM_SetupActor(i_this, daTbox_c);
|
||
return i_this->create1st();
|
||
}
|
||
|
||
/* 80496004-80496024 0053C4 0020+00 1/0 0/0 0/0 .text daTbox_MoveBGDelete__FP8daTbox_c */
|
||
static int daTbox_MoveBGDelete(daTbox_c* i_this) {
|
||
return i_this->MoveBGDelete();
|
||
}
|
||
|
||
/* 80496024-80496044 0053E4 0020+00 1/0 0/0 0/0 .text daTbox_MoveBGExecute__FP8daTbox_c
|
||
*/
|
||
static int daTbox_MoveBGExecute(daTbox_c* i_this) {
|
||
return i_this->MoveBGExecute();
|
||
}
|
||
|
||
/* 80496044-80496070 005404 002C+00 1/0 0/0 0/0 .text daTbox_MoveBGDraw__FP8daTbox_c */
|
||
static int daTbox_MoveBGDraw(daTbox_c* i_this) {
|
||
return i_this->MoveBGDraw();
|
||
}
|
||
|
||
/* 804961B0-804961B8 005570 0008+00 1/0 0/0 0/0 .text Create__8daTbox_cFv */
|
||
int daTbox_c::Create() {
|
||
return true;
|
||
}
|
||
|
||
/* 804961B8-804961C0 005578 0008+00 1/0 0/0 0/0 .text checkSmallTbox__8daTbox_cFv */
|
||
BOOL daTbox_c::checkSmallTbox() {
|
||
return true;
|
||
}
|
||
|
||
/* 80496730-80496750 -00001 0020+00 1/0 0/0 0/0 .data daTbox_METHODS */
|
||
static actor_method_class daTbox_METHODS = {
|
||
(process_method_func)daTbox_create1st,
|
||
(process_method_func)daTbox_MoveBGDelete,
|
||
(process_method_func)daTbox_MoveBGExecute,
|
||
NULL,
|
||
(process_method_func)daTbox_MoveBGDraw,
|
||
};
|
||
|
||
/* 80496750-80496780 -00001 0030+00 0/0 0/0 1/0 .data g_profile_TBOX */
|
||
extern actor_process_profile_definition g_profile_TBOX = {
|
||
fpcLy_CURRENT_e,
|
||
4,
|
||
fpcPi_CURRENT_e,
|
||
PROC_TBOX,
|
||
&g_fpcLf_Method.base,
|
||
sizeof(daTbox_c),
|
||
0,
|
||
0,
|
||
&g_fopAc_Method.base,
|
||
0x10c,
|
||
&daTbox_METHODS,
|
||
0x44100,
|
||
fopAc_ACTOR_e,
|
||
fopAc_CULLBOX_CUSTOM_e,
|
||
};
|
||
|
||
AUDIO_INSTANCES
|