diff options
Diffstat (limited to 'src/d/d_cam_param.cpp')
| -rw-r--r-- | src/d/d_cam_param.cpp | 732 |
1 files changed, 683 insertions, 49 deletions
diff --git a/src/d/d_cam_param.cpp b/src/d/d_cam_param.cpp index d6b383a007..77e62ac4bf 100644 --- a/src/d/d_cam_param.cpp +++ b/src/d/d_cam_param.cpp @@ -7,49 +7,87 @@ #include "d/d_cam_param.h" +#include "JSystem/JHostIO/JORFile.h" +#include "JSystem/JHostIO/JORServer.h" #include "SSystem/SComponent/c_math.h" #include "d/actor/d_a_player.h" #include "d/d_camera.h" #include "d/d_com_inf_game.h" -f32 dCamMath::rationalBezierRatio(f32 param_0, f32 param_1) { - f64 var_f31; - f32 var_f1 = param_0; - - if (var_f1 >= 0.0f) { - var_f31 = 1.0; - } else { - var_f31 = -1.0; - var_f1 = -var_f1; - } +enum CameraFlags { + CAM_PARAM_GAPX, CAM_PARAM_GAPZ, + CAM_PARAM_HBAS, CAM_PARAM_HMIN, CAM_PARAM_HMAX, + CAM_PARAM_CDST, CAM_PARAM_CANG, + CAM_PARAM_RBAS, CAM_PARAM_RMIN, CAM_PARAM_RMAX, CAM_PARAM_RNAR, CAM_PARAM_RFAR, + CAM_PARAM_VBAS, CAM_PARAM_VMIN, CAM_PARAM_VMAX, CAM_PARAM_VNAR, CAM_PARAM_VFAR, + CAM_PARAM_FBAS, CAM_PARAM_FMIN, CAM_PARAM_FMAX, CAM_PARAM_FNAR, CAM_PARAM_FFAR, + CAM_PARAM_UTRN, CAM_PARAM_UNAR, CAM_PARAM_UFAR, + CAM_PARAM_HNAR, CAM_PARAM_HFAR, + CAM_PARAM_USLW, +}; + +#if DEBUG +namespace camera_names { + const char* engine_name[] = { + "LET", "CHASE", "LOCKON", "TALK", + "SUBJECT", "FIXEDPOS", "FIXEDFRM", "TOWER", + "RIDE", "MANUAL", "EVENT", "HOOKSHOT", + "COLOSSEUM", "OBSERVE", "MAGNE", "RAIL", + "PARARAIL", "ONESIDE", "TEST1", "TEST2", + }; + const char* mode_name[] = { + "NORMAL", "PARALLEL", "LOCKON", "TALK", + "SUBJECT", "ATTACK", "ATTACK2", "SHOOT", + "OBJSHOOT", "HOOKSHOT", "PUSHPULL", + }; + const char* param_name[] = { + "GAPX", "GAPZ", "HBAS", "HMIN", "HMAX", "CDST", "CANG", "RBAS", + "RMIN", "RMAX", "RNAR", "RFAR", "VBAS", "VMIN", "VMAX", "VNAR", + "VFAR", "FBAS", "FMIN", "FMAX", "FNAR", "FFAR", "UTRN", "UNAR", + "UFAR", "HNAR", "HFAR", "USLW", + }; + const char* flag_name[] = { + "BGCHECK", "BGCHKLIGHT", "BGCHECKOFF", "BUSHCHECK", + "COCHKOFF", "FWDCHECKH", "ROLLOFF", "HIGHOFF", + "DIRECTSTK", "USEMAPTOOL", "RZOOM", "WIDEUSE1", + "WIDEUSE2", "TARGETUSE", "FWDCHECK", + }; +} +#endif - f64 temp_f2 = 2.0 * var_f1; - f64 temp_f2_2 = ((temp_f2 * param_1) - temp_f2) - (2.0 * param_1); - f64 temp_f29 = -temp_f2_2; - f64 temp_f28 = temp_f29 - 1.0; - f64 var_f1_2 = (temp_f2_2 * temp_f2_2) - (4.0 * temp_f28 * var_f1); +f32 dCamMath::rationalBezierRatio(f32 param_0, f32 param_1) { + f64 sp68; - if (var_f1_2 > 0.0) { - var_f1_2 = sqrt(var_f1_2); + if (param_0 >= 0.0f) { + sp68 = 1.0; } else { - var_f1_2 = 0.0; + sp68 = -1.0; + param_0 = -param_0; } - f64 temp = temp_f29 - var_f1_2; - f64 temp_f2_3 = temp_f28 * 2.0; - if (temp_f2_3 > 1e-07 || temp_f2_3 < -1e-07) { - f64 temp_f2_4 = temp / temp_f2_3; - f64 temp_f3 = temp_f2_4 * temp_f2_4; - f64 temp_f4 = 1.0 - temp_f2_4; - f64 temp_f1 = temp_f3 + ((temp_f4 * temp_f4) + (param_1 * (2.0 * temp_f4 * temp_f2_4))); - - if (temp_f1 > 1.0000000116860974e-07) { - return var_f31 * (temp_f3 / temp_f1); + f64 sp60 = 2.0 * param_0; + f64 sp58 = 2.0 * param_1; + f64 sp50 = sp60 * param_1; + f64 var_f31 = sp50 - sp60 - sp58; + f64 sp48 = -var_f31 - 1.0; + f64 sp40 = param_0; + f64 sp38 = (var_f31 * var_f31) - (4.0 * sp48 * sp40); + + f64 sp30 = -var_f31 - (sp38 > 0.0 ? sqrt(sp38) : 0.0); + f64 sp28 = sp48 * 2.0; + if (sp28 > 1e-07 || sp28 < -1e-07) { + f64 var_f30 = sp30 / sp28; + f64 sp20 = var_f30 * var_f30; + f64 sp18 = 1.0 - var_f30; + f64 sp10 = sp20 + ((sp18 * sp18) + (param_1 * (2.0 * sp18 * var_f30))); + + if (sp10 > 1.0000000116860974e-07) { + return sp68 * (sp20 / sp10); } return 0.0f; + } else { + return 0.0f; } - - return 0.0f; } static f32 dummy_literal1() { @@ -59,16 +97,14 @@ static f32 dummy_literal1() { f32 dCamMath::zoomFovy(f32 param_0, f32 param_1) { cDegree deg(param_0); - f32 radian = cM_atan2f(deg.Sin(), param_1 * deg.Cos()); - return cAngle::r2d(radian); + return cAngle::r2d(cM_atan2f(deg.Sin(), param_1 * deg.Cos())); } cXyz dCamMath::xyzRotateX(cXyz& i_xyz, cSAngle i_angle) { Mtx m; cXyz rot_xyz; - s16 angle = i_angle.Val(); - mDoMtx_XrotS(m, angle); + cMtx_XrotS(m, i_angle.Val()); MTXMultVec(m, &i_xyz, &rot_xyz); return rot_xyz; } @@ -77,8 +113,7 @@ cXyz dCamMath::xyzRotateY(cXyz& i_xyz, cSAngle i_angle) { Mtx m; cXyz rot_xyz; - s16 angle = i_angle.Val(); - mDoMtx_YrotS(m, angle); + cMtx_YrotS(m, i_angle.Val()); MTXMultVec(m, &i_xyz, &rot_xyz); return rot_xyz; } @@ -94,9 +129,41 @@ dCstick_c::dCstick_c() { mThresholdLow = 0.2f; mThresholdHigh = 0.95f; mInputSpeed = 6; +#if DEBUG + mDisplayPosX = 170; + mDisplayPosY = 40; +#endif } +#if DEBUG +void dCstick_c::genMessage(JORMContext* ctx) { + // "- Switch" + ctx->genLabel("- スイッチ", 0, 0, NULL, -1, -1, 0x200); + // " Threshold: Low" + ctx->genSlider(" しきい値 低", &mThresholdLow, 0.0f, 1.0f, 0, NULL, -1, -1, 0x200); + // " High" + ctx->genSlider(" 高", &mThresholdHigh, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + // " Input speed" + ctx->genSlider(" 入力スピード", &mInputSpeed, 0x0, 0x50, 0, 0, -1); + + ctx->genLabel("-", 0, 0, NULL, -1, -1, 0x200); + // " Debug display" + ctx->genCheckBox(" デバッグ表示", &mIsDebugDisplay, -0x8000, 0, 0, -1, -1); + // " Display position X" + ctx->genSlider(" 表示位置 X", &mDisplayPosX, 0x0, 0x280, 0, 0, -1); + // " Y" + ctx->genSlider(" Y", &mDisplayPosY, 0x0, 0x1e0, 0, 0, -1); + + ctx->genLabel("-", 0, 0, NULL, -1, -1, 0x200); +} +#endif + bool dCstick_c::Shift(u32 param_0) { + UNUSED(param_0); +#if DEBUG + CheckFlag(0x8000); +#endif + return false; } @@ -124,11 +191,68 @@ dCamBGChk_c::dCamBGChk_c() { mCornerAngleMax = 120.0f; } +#if DEBUG +void dCamBGChk_c::genMessage(JORMContext* ctx) { + ctx->genLabel("-", 0, 0, 0, -1, -1, 0x200); + // "- Floor check" + ctx->genLabel("- 床チェック", 0, 0, 0, -1, -1, 0x200); + // " Margin" + ctx->genSlider(" マージン", &mFloorMargin, 0.0f, 1000.0f, 0, 0, -1, -1, 0x200); + ctx->genLabel("-", 0, 0, 0, -1, -1, 0x200); + // "- Forward check" + ctx->genLabel("- 前方チェック", 0, 0, 0, -1, -1, 0x200); + // " [0]Angle" + ctx->genSlider(" [0]角度", &mChkInfo[0].mChkAngle, 1.0f, 90.0f, 0, 0, -1, -1, 0x200); + // " [0]Length (height X)" + ctx->genSlider(" [0]長さ(身長X)", &mChkInfo[0].mDistance, 1.0f, 25.0f, 0, 0, -1, -1, 0x200); + // " [0]Weight+" + ctx->genSlider(" [0]ウエイト+", &mChkInfo[0].mWeightH, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + // " [0]Weight-" + ctx->genSlider(" [0]ウエイト-", &mChkInfo[0].mWeightL, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + // " [1]Angle" + ctx->genSlider(" [1]角度", &mChkInfo[1].mChkAngle, 1.0f, 90.0f, 0, 0, -1, -1, 0x200); + // " [1]Length (height X)" + ctx->genSlider(" [1]長さ(身長X)", &mChkInfo[1].mDistance, 1.0f, 25.0f, 0, 0, -1, -1, 0x200); + // " [1]Weight+" + ctx->genSlider(" [1]ウエイト+", &mChkInfo[1].mWeightH, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + // " [1]Weight-" + ctx->genSlider(" [1]ウエイト-", &mChkInfo[1].mWeightL, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + // " Margin" + ctx->genSlider(" マージン", &mFwdBackMargin, 0.0f, 1000.0f, 0, 0, -1, -1, 0x200); + // " Cusion" + ctx->genSlider(" クッション", &mFwdCushion, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + ctx->genLabel("-", 0, 0, 0, -1, -1, 0x200); + // "- Per camera" + ctx->genLabel("- カメラあたり", 0, 0, 0, -1, -1, 0x200); + // " Margin" + ctx->genSlider(" マージン", &mGazeBackMargin, 0.0f, 1000.0f, 0, 0, -1, -1, 0x200); + // BUG: second parameter should be &mCornerAngleMax + // " Corner wall detection angle" + ctx->genSlider(" 角壁判別角度", &mCornerCushion, 0.0f, 180.0f, 0, 0, -1, -1, 0x200); + // " Corner cushion" + ctx->genSlider(" 角クッション", &mCornerCushion, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + // " Wall cushion" + ctx->genSlider(" 壁クッション", &mWallCushion, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + // " Wall up distance" + ctx->genSlider(" 壁上がり距離", &mWallUpDistance, 0.0f, 1000.0f, 0, 0, -1, -1, 0x200); + // " Wall back cushion" + ctx->genSlider(" 壁戻クッション", &mWallBackCushion, 0.0f, 1.0f, 0, 0, -1, -1, 0x200); + ctx->genLabel("-", 0, 0, 0, -1, -1, 0x200); +} +#endif + dCamParam_c::dCamParam_c(s32 i_styleID) { - u8* cam_data = (u8*)dComIfG_getObjectRes(dComIfGp_getCameraParamFileName(0), "camstyle.dat"); + const char* fileName = dComIfGp_getCameraParamFileName(0); + void* objRes = dComIfG_getObjectRes(fileName, "camstyle.dat"); + u8* cam_data = (u8*)objRes; mCamStyleData = (dCamStyleData::StyleData*)(cam_data + 8); mStyleNum = ((dCamStyleData*)cam_data)->mStyleNum; + +#if DEBUG + mpHIOChild = mDoHIO_createChild("カメラパラメタ", this); +#endif + Change(i_styleID); mMapToolFovy = 0xFF; @@ -137,12 +261,21 @@ dCamParam_c::dCamParam_c(s32 i_styleID) { mMapToolArg2 = -1; } -dCamParam_c::~dCamParam_c() {} +dCamParam_c::~dCamParam_c() { +#if DEBUG + mDoHIO_deleteChild(mpHIOChild); +#endif +} int dCamParam_c::Change(s32 i_styleID) { if (i_styleID >= 0 && i_styleID < mStyleNum) { mStyleID = i_styleID; mCurrentStyle = &mCamStyleData[mStyleID]; + +#if DEBUG + mDoHIO_updateChild(mpHIOChild); +#endif + return 1; } @@ -153,17 +286,263 @@ int dCamParam_c::Change(s32 i_styleID) { int dCamParam_c::SearchStyle(u32 param_0) { int styleID = -1; - - for (int i = 0; i < mStyleNum; i++) { + int i = 0; + while (i < mStyleNum) { if (param_0 == mCamStyleData[i].field_0x0) { styleID = i; break; } + i++; } return styleID; } +#if DEBUG +void dCamParam_c::genMessage(JORMContext* ctx) { + ctx->genSlider(" STYLE ID", &mStyleID, 0, mStyleNum, 0x40000000, NULL, 0xffff, 0xffff, 0x200, + 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Origin C" + ctx->genLabel("- 原点C", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Front/back (GAPZ)" + ctx->genSlider(" 前後(GAPZ)", &mCurrentStyle->mParams[CAM_PARAM_GAPZ], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Left/right (GAPX)" + ctx->genSlider(" 左右(GAPX)", &mCurrentStyle->mParams[CAM_PARAM_GAPX], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Distance (CDST)" + ctx->genSlider(" 距離(CDST)", &mCurrentStyle->mParams[CAM_PARAM_CDST], -1.0f, 1.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Angle (CANG)" + ctx->genSlider(" 角度(CANG)", &mCurrentStyle->mParams[CAM_PARAM_CANG], -1.0f, 1.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Origin point high" + ctx->genLabel("- 原点高", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Standard (HBAS)" + ctx->genSlider(" 標準(HBAS)", &mCurrentStyle->mParams[CAM_PARAM_HBAS], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Minimum (HMIN)" + ctx->genSlider(" 最小(HMIN)", &mCurrentStyle->mParams[CAM_PARAM_HMIN], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Maximum (HMAX)" + ctx->genSlider(" 最大(HMAX)", &mCurrentStyle->mParams[CAM_PARAM_HMAX], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Nearest (HNAR)" + ctx->genSlider(" 最近(HNAR)", &mCurrentStyle->mParams[CAM_PARAM_HNAR], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Farthest (HFAR)" + ctx->genSlider(" 最遠(HFAR)", &mCurrentStyle->mParams[CAM_PARAM_HFAR], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Distance" + ctx->genLabel("- 距離", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genSlider(" 標準(RBAS)", &mCurrentStyle->mParams[CAM_PARAM_RBAS], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genSlider(" 最小(RMIN)", &mCurrentStyle->mParams[CAM_PARAM_RMIN], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genSlider(" 最大(RMAX)", &mCurrentStyle->mParams[CAM_PARAM_RMAX], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genSlider(" 最近(RNAR)", &mCurrentStyle->mParams[CAM_PARAM_RNAR], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genSlider(" 最遠(RFAR)", &mCurrentStyle->mParams[CAM_PARAM_RFAR], -10000.0f, 10000.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genLabel("- 縦角", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Standard (VBAS)" + ctx->genSlider(" 標準(VBAS)", &mCurrentStyle->mParams[CAM_PARAM_VBAS], -180.0f, 180.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Minimuum (VMIN)" + ctx->genSlider(" 最小(VMIN)", &mCurrentStyle->mParams[CAM_PARAM_VMIN], -180.0f, 180.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Maximum (VMAX)" + ctx->genSlider(" 最大(VMAX)", &mCurrentStyle->mParams[CAM_PARAM_VMAX], -180.0f, 180.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Nearest (VNAR)" + ctx->genSlider(" 最近(VNAR)", &mCurrentStyle->mParams[CAM_PARAM_VNAR], -180.0f, 180.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Farthest (VFAR)" + ctx->genSlider(" 最遠(VFAR)", &mCurrentStyle->mParams[CAM_PARAM_VFAR], -180.0f, 180.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Horizontal angle" + ctx->genLabel("- 横角", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Rotation speed (UTRN)" + ctx->genSlider(" 回速(UTRN)", &mCurrentStyle->mParams[CAM_PARAM_UTRN], -1.0f, 1.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Lap behind (USLW)" + ctx->genSlider(" 回遅(USLW)", &mCurrentStyle->mParams[CAM_PARAM_USLW], -1.0f, 1.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Nearest (UNAR)" + ctx->genSlider(" 最近(UNAR)", &mCurrentStyle->mParams[CAM_PARAM_UNAR], -180.0f, 180.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Farthest (UFAR)" + ctx->genSlider(" 最遠(UFAR)", &mCurrentStyle->mParams[CAM_PARAM_UFAR], -180.0f, 180.0f, 0, + NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Field of view" + ctx->genLabel("- 画角", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Standard (FBAS)" + ctx->genSlider(" 標準(FBAS)", &mCurrentStyle->mParams[CAM_PARAM_FBAS], -30.0f, 90.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Minimum (FMIN)" + ctx->genSlider(" 最小(FMIN)", &mCurrentStyle->mParams[CAM_PARAM_FMIN], -30.0f, 90.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Maximum (FMAX)" + ctx->genSlider(" 最大(FMAX)", &mCurrentStyle->mParams[CAM_PARAM_FMAX], -30.0f, 90.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Nearest (FNAR)" + ctx->genSlider(" 最近(FNAR)", &mCurrentStyle->mParams[CAM_PARAM_FNAR], -30.0f, 90.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Farthest (FFAR)" + ctx->genSlider(" 最遠(FFAR)", &mCurrentStyle->mParams[CAM_PARAM_FFAR], -30.0f, 90.0f, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + // "- Flag" + ctx->genLabel("- フラグ", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "BG check (BGCHECK)" + ctx->genCheckBox(" BGチェック(BGCHECK)", &mCurrentStyle->mFlags, 0x1, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "BG check light (BGCHKLIGHT)" + ctx->genCheckBox(" BGチェック軽(BGCHKLIGHT)", &mCurrentStyle->mFlags, 0x2, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "Grass check (BUSHCHECK)" + ctx->genCheckBox(" 草チェック(BUSHCHECK)", &mCurrentStyle->mFlags, 0x8, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "Front check (FWDCHECK)" + ctx->genCheckBox(" 前方チェック(FWDCHECK)", &mCurrentStyle->mFlags, 0x4000, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "CO check prohibited (COCHKOFF)" + ctx->genCheckBox(" COチェック禁止(COCHKOFF)", &mCurrentStyle->mFlags, 0x10, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "R button zoom (RZOOM)" + ctx->genCheckBox(" Rボタンズーム(RZOOM)", &mCurrentStyle->mFlags, 0x400, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "Stick direct value (DIRECTSTK)" + ctx->genCheckBox(" スティック直値(DIRECTSTK)", &mCurrentStyle->mFlags, 0x100, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "Use map tool (USEMAPTOOL)" + ctx->genCheckBox(" マップツール使用(USEMAPTOOL)", &mCurrentStyle->mFlags, 0x200, 0, NULL, + 0xffff, 0xffff, 0x200, 0x18); + // "No BG check (BGCHECKOFF)" + ctx->genCheckBox(" BGチェック無(BGCHECKOFF)", &mCurrentStyle->mFlags, 0x4, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "Forward check distance (FWDCHECKH)" + ctx->genCheckBox(" 前方チェック遠(FWDCHECKH)", &mCurrentStyle->mFlags, 0x20, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "C-axis rotation prohibited (ROLLOFF)" + ctx->genCheckBox(" C回転禁止(ROLLOFF)", &mCurrentStyle->mFlags, 0x40, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "C pulling prohibited (HIGHOFF)" + ctx->genCheckBox(" C引き禁止(HIGHOFF)", &mCurrentStyle->mFlags, 0x80, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "General purpose 1 (WIDEUSE1)" + ctx->genCheckBox(" 汎用1(WIDEUSE1)", &mCurrentStyle->mFlags, 0x800, 0, NULL, 0xffff, 0xffff, + 0x200, 0x18); + // "General purpose 2 (WIDEUSE2)" + ctx->genCheckBox(" 汎用2(WIDEUSE2)", &mCurrentStyle->mFlags, 0x1000, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "Target specification (TARGETUSE)" + ctx->genCheckBox(" 対象指定(TARGETUSE)", &mCurrentStyle->mFlags, 0x2000, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Map tools" + ctx->genLabel("- マップツール", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Field of view" + ctx->genSlider(" 画角 ", &mMapToolFovy, 0, 0xff, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Argument 0" + ctx->genSlider(" 引数0", &mMapToolArg0, 0, 0xff, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Argument 1" + ctx->genSlider(" 引数1", &mMapToolArg1, 0, 0xff, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Argument 2" + ctx->genSlider(" 引数2", &mMapToolArg2, 0, 0xffff, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Output file" + ctx->genLabel("- ファイル出力", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Save" + ctx->genButton(" 保存 ", 0x12d, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); +} + +void dCamParam_c::listenPropertyEvent(const JORPropertyEvent* event) { + JORReflexible::listenPropertyEvent(event); + JORMContext* ctx = attachJORMContext(8); + switch ((int)event->id) { + case 0x12d: + writeParamXML(); + break; + } +} + +int dCamParam_c::writeParamXML() { + int i; + char styleName[5]; + styleName[0] = (mCurrentStyle->field_0x0 >> 24) & 0xff; + styleName[1] = (mCurrentStyle->field_0x0 >> 16) & 0xff; + styleName[2] = (mCurrentStyle->field_0x0 >> 8) & 0xff; + styleName[3] = (mCurrentStyle->field_0x0 >> 0) & 0xff; + styleName[4] = '\0'; + + OpenFile(); + PrintFile("\n"); + PrintFile(" <style name=\"%s\">\n", styleName); + PrintFile(" <engine type=\"%s\"/>\n", camera_names::engine_name[mCurrentStyle->field_0x4]); + for (i = 0; i < ARRAY_SIZE(camera_names::param_name); i++) { + PrintFile(" <param type=\"%s\">%f</param>\n", camera_names::param_name[i], mCurrentStyle->mParams[i]); + } + for (i = 0; i < 16; i++) { + if ((mCurrentStyle->mFlags & 1 << i) != 0) { + PrintFile(" <flag type=\"%s\"/>\n", camera_names::flag_name[i]); + } + } + PrintFile(" </style>\n"); + PrintFile("\n"); + CloseFile(); + return 1; +} + +void dCamParam_c::OpenFile() { + char fileSuffix[9]; + fileSuffix[0] = (mCurrentStyle->field_0x0 >> 24) & 0xff; + fileSuffix[1] = (mCurrentStyle->field_0x0 >> 16) & 0xff; + fileSuffix[2] = (mCurrentStyle->field_0x0 >> 8) & 0xff; + fileSuffix[3] = (mCurrentStyle->field_0x0 >> 0) & 0xff; + fileSuffix[4] = '.'; + fileSuffix[5] = 'x'; + fileSuffix[6] = 'c'; + fileSuffix[7] = 's'; + fileSuffix[8] = '\0'; + const char ext[] = "パラメタベースファイル(*.xcs)\0*.xcs\0その他のファイル(*.*)\0*.*\0"; + mFile.open(JORFile::EFlags_WRITE | JORFile::EFlags_UNK_0x4, ext, "xcs", NULL, fileSuffix); +} + +void dCamParam_c::PrintFile(char* i_fmt, ...) { + UNUSED(i_fmt); + char buf[0x100]; + va_list args; + va_start(args, i_fmt); + vsnprintf(buf, sizeof(buf), i_fmt, args); + va_end(args); + + mFile.writeData(buf, strlen(buf)); +} + +void dCamParam_c::CloseFile() { + mFile.close(); +} +#endif + static f32 dummy_literal2() { return 0.25f; } @@ -202,8 +581,8 @@ dCamSetup_c::dCamSetup_c() { mDebugFlags = 1; mFlags2 = 0x118; - mFlags2 |= 0x200; - mFlags2 |= 0x400; + mFlags2 |= (u16)0x200; + mFlags2 |= (u16)0x400; mChargeLatitude = 27.0f; mChargeTimer = 90; @@ -227,12 +606,28 @@ dCamSetup_c::dCamSetup_c() { mWindShakeFvy = 0.3f; mMapToolCamShortTimer = 60; mMapToolCamLongTimer = 120; - mDebugFlags |= 0x4800; +#if DEBUG + mDebugFlags |= (u16)0x3000; + mpHIOChild = mDoHIO_createChild("カメラ", this); +#endif +#if PLATFORM_WII + mDebugFlags |= (u16)0x7800; +#else + mDebugFlags |= (u16)0x4800; +#endif field_0x15c = 0.0f; field_0x160 = 0.0f; - mDebugFlags |= 0x800; + mDebugFlags |= (u16)0x800; +#if PLATFORM_GCN mWaitRollTimer = 120; +#else + mWaitRollTimer = 20; +#endif +#if PLATFORM_GCN mWaitRollSpeed = 0.02f; +#else + mWaitRollSpeed = 0.05f; +#endif field_0x16c = 1200.0f; field_0xe0 = 0.06f; field_0xec = 25; @@ -248,7 +643,11 @@ dCamSetup_c::dCamSetup_c() { dCam_getBody()->EventRecoverNotime(); } -dCamSetup_c::~dCamSetup_c() {} +dCamSetup_c::~dCamSetup_c() { +#if DEBUG + mDoHIO_deleteChild(mpHIOChild); +#endif +} bool dCamSetup_c::CheckLatitudeRange(s16* param_0) { s16 temp0 = cAngle::d2s(field_0x60); @@ -268,9 +667,244 @@ bool dCamSetup_c::CheckLatitudeRange(s16* param_0) { } f32 dCamSetup_c::PlayerHideDist() { - if (daPy_py_c::checkNowWolf()) { - return 120.0f; - } + return daPy_py_c::checkNowWolf() ? 120.0f : mSubjLinkCullDist; +} - return mSubjLinkCullDist; +#if DEBUG +void dCamSetup_c::genMessage(JORMContext* ctx) { + int i; + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Debug" + ctx->genLabel("- デバッグ", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Camera information display" + ctx->genCheckBox(" カメラ情報表示", &mDebugFlags, 0x8000, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Event information display" + ctx->genCheckBox(" イベント情報表示", &mDebugFlags, 0x40, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Player 2D position" + ctx->genCheckBox(" プレイヤ2D位置", &mDebugFlags, 0x80, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Imaginary line" + ctx->genCheckBox(" イマジナリライン", &mDebugFlags, 0x100, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + // "Location information" + ctx->genCheckBox(" 位置情報", &mDebugFlags, 0x200, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Camera type switching" + ctx->startComboBox("カメラタイプ切替", &mForceType, 0, NULL, 0xffff, 0xffff, 0x100, 0x1a); + // "Unused" + ctx->genComboBoxItem("未使用", -1); + for (i = 0; i < mTypeNum; i++) { + ctx->genComboBoxItem((char*)((int)mTypeTable + i * 0x44), i); + } + ctx->endComboBox(); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Wolf special attack" + ctx->genLabel("- 狼特殊攻撃", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Return timer" + ctx->genSlider(" もどりタイマー", &mChargeTimer, 1, 3000, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Screensaver" + ctx->genLabel("- スクリーンセーバー", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Enabled" + ctx->genCheckBox(" 有効", &mFlags2, 0x800, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Initial wait time (s)" + ctx->genSlider(" 待ち時間最初(s)", &mScreensaverFirstWaitTimer, 1, 0xe10, 0, NULL, 0xffff, + 0xffff, 0x200, 0x18); + // "Wait time" + ctx->genSlider(" 待ち時間(s)", &mScreensaverWaitTimer, 1, 0xe10, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + // "Execution time" + ctx->genSlider(" 実行時間(s)", &mScreensaverExecTimer, 1, 0xe10, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Event" + ctx->genLabel("- イベント", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Conversation cut switching" + ctx->startComboBox("会話カット切替", &mModeSwitchType, 0, NULL, 0xffff, 0xffff, 0x100, 0x1a); + // "Unused" + ctx->genComboBoxItem("未使用", -1); + // "00. Default" + ctx->genComboBoxItem("00.デフォルト", 0); + // "50. Default (no connection)" + ctx->genComboBoxItem("50.デフォルト繋ぎ無", 50); + // "11. Speaker to listener" + ctx->genComboBoxItem("11.話し手から聞き手", 11); + // "12. Listener to speaker" + ctx->genComboBoxItem("12.聞き手から話し手", 12); + // "13. Long shot" + ctx->genComboBoxItem("13.ロングショット", 13); + // "14. Listener's point of view" + ctx->genComboBoxItem("14.聞き手の主観", 14); + // "15. Speaker's point of view" + ctx->genComboBoxItem("15.話し手の主観", 15); + // "16. Close-up of listener" + ctx->genComboBoxItem("16.聞き手のアップ", 16); + // "17. Close-up of speaker" + ctx->genComboBoxItem("17.話し手のアップ", 17); + // "61. Close of of speaker B" + ctx->genComboBoxItem("61.話し手のアップB", 61); + // "18. From the side of the listener" + ctx->genComboBoxItem("18.聞き手の横から", 18); + // "19. From the side of the speaker" + ctx->genComboBoxItem("19.話し手の横から", 19); + // "20. Listener from the front" + ctx->genComboBoxItem("20.聞き手正面", 20); + // "21. Speaker from the front" + ctx->genComboBoxItem("21.話し手正面", 21); + // "62. Speaker from the front B" + ctx->genComboBoxItem("62.話し手正面B", 62); + // "22. Listener bust shot" + ctx->genComboBoxItem("22.聞き手胸像", 22); + // "23. Speaker bust shot" + ctx->genComboBoxItem("23.話し手胸像", 23); + // "63. Speaker bust shot B" + ctx->genComboBoxItem("63.話し手胸像B", 63); + // "24. Listener from the front diagonal" + ctx->genComboBoxItem("24.聞き手斜前", 24); + // "25. Speaker from the front diagonal" + ctx->genComboBoxItem("25.話し手斜前", 25); + // "26. Listener from the lower diagonal" + ctx->genComboBoxItem("26.聞き手斜下", 26); + // "27 Speaker from the lower diagonal" + ctx->genComboBoxItem("27.話し手斜下", 27); + // "28. From the side" + ctx->genComboBoxItem("28.横から", 28); + // "29. Large face from the front" + ctx->genComboBoxItem("29.でか顔正面", 29); + // "30. Speaker to listener (wide)" + ctx->genComboBoxItem("30.話し手から聞き手広", 30); + // "31. Listener to speaker (wide)" + ctx->genComboBoxItem("31.聞き手から話し手広", 31); + // "32. Long shot from the side" + ctx->genComboBoxItem("32.横からロング", 32); + // "33. Midna" + ctx->genComboBoxItem("33.ミドナ", 33); + // "34. Midna back" + ctx->genComboBoxItem("34.ミドナ後", 34); + // "35. Midna diagonal" + ctx->genComboBoxItem("35.ミドナ斜", 35); + // "36. Midna diagonal back" + ctx->genComboBoxItem("36.ミドナ斜後", 36); + // "37. Midna attention, long shot" + ctx->genComboBoxItem("37.ミドナ注目ロング", 37); + // "38. Over the shoulder shot" + ctx->genComboBoxItem("38.肩なめ", 38); + // "39. Listener from the front (upper body)" + ctx->genComboBoxItem("39.聞き手正面上", 39); + // "40. Speaker from the front (upper body)" + ctx->genComboBoxItem("40.話し手正面上", 40); + // "64: Speaker from the front (upper body) B" + ctx->genComboBoxItem("64.話し手正面上B", 64); + // "41. Listener from the waist up" + ctx->genComboBoxItem("41.聞き手腰上", 41); + // "42. Speaker from the waist up" + ctx->genComboBoxItem("42.話し手腰上", 42); + // "65. Speaker from the waist up B" + ctx->genComboBoxItem("65.話し手腰上B", 65); + ctx->endComboBox(); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Short connection" + ctx->genSlider(" 短つなぎ", &mMapToolCamShortTimer, 0, 3000, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + // "Long connection" + ctx->genSlider(" 長つなぎ", &mMapToolCamLongTimer, 0, 3000, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Attention" + ctx->genLabel("- 注目", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Switching timer" + ctx->genSlider(" 切替タイマー", &mLockonChangeTimer, 0, 400, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + // "Switching cushion" + ctx->genSlider(" 切替クッション", &mLockonChangeCushion, 0.0f, 1.0f, 0, NULL, 0xffff, 0xffff, + 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Subject" + ctx->genLabel("- 主観", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Distance to cull the link" + ctx->genSlider(" リンク消す距離", &mSubjLinkCullDist, 0.0f, 400.0f, 0, NULL, 0xffff, 0xffff, + 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Manual" + ctx->genLabel("- マニュアル", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Start C threshold" + ctx->genSlider(" 開始Cしきい", &mManualStartCThreshold, 0.0f, 400.0f, 0, NULL, 0xffff, 0xffff, + 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Trimming" + ctx->genLabel("- トリミング", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Vista" + ctx->genSlider(" ビスタ", &mTrimVistaHeight, 0.0f, 200.0f, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + // "Cinemascope" + ctx->genSlider(" シネスコ", &mTrimCineScopeHeight, 0.0f, 200.0f, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Fake angle system" + ctx->genLabel("- 嘘アングルシステム", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Value" + ctx->genSlider(" 値", &mFalseValue, 0.0f, 1.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Angle" + ctx->genSlider(" 角度", &mFalseAngle, 0.0f, 180.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Forced attention" + ctx->genLabel("- 強制注目", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Limit distance" + ctx->genSlider(" 限界距離", &mForceLockOffDist, 0.0, 100000.0, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + // "Timer" + ctx->genSlider(" タイマー", &mForceLockOffTimer, 0, 100000, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Object avoidance" + ctx->genLabel("- オブジェクト避け", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Valid" + ctx->genCheckBox(" 有効", &mFlags2, 0x400, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Windstorm shaking experiment" + ctx->genLabel("- 暴風揺れ実験", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Valid" + ctx->genCheckBox(" 有効", &mFlags2, 0x100, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Focal point" + ctx->genSlider(" 注視点", &mWindShakeCtr, 0.0, 100.0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Angle of view" + ctx->genSlider(" 画角", &mWindShakeFvy, 0.0, 10.0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- After throwing" + ctx->genLabel("- 投げ後", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Angle" + ctx->genSlider(" 角度", &mThrowVAngle, -180.0f, 180.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Height (relative)" + ctx->genSlider(" 高さ(相対)", &mThrowCtrOffset, -180.0f, 180.0f, 0, NULL, 0xffff, 0xffff, 0x200, + 0x18); + // "Timer" + ctx->genSlider(" タイマー", &mThrowTimer, 1, 3000, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Cushion" + ctx->genSlider(" クッション", &mThrowCushion, 0.0f, 1.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "- Drawing settings" + ctx->genLabel("- 描画設定", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + // "Valid" + ctx->genCheckBox(" 有効", &mDebugFlags, 0x400, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genSlider(" near", &mDrawNear, 0.0f, 1000000.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + ctx->genSlider(" far", &mDrawFar, 0.0f, 1000000.0f, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); + + ctx->genLabel("-", 0, 0, NULL, 0xffff, 0xffff, 0x200, 0x18); } +#endif |
