-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdebug_params.h
More file actions
253 lines (228 loc) · 9.7 KB
/
Copy pathdebug_params.h
File metadata and controls
253 lines (228 loc) · 9.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#pragma once
#include <fstream>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <string>
#include "framework/nlohmann/json.hpp"
struct CameraFaceOffset {
float yaw = 0.0f;
float pitch = 0.0f;
float posX = 0.0f;
float posY = 0.0f;
float posZ = 0.0f;
};
// =========================================================================
// 【リリース用定数予約】
// デバッグで調整した確定値をここに書き込んでください。
// リリースビルド時には、JSONは読み込まれず、ここに定義した値が使われます。
// =========================================================================
namespace ReleaseConfig
{
constexpr float noteSpeed = 10.0f;
constexpr float hitDistance = 2.0f;
constexpr float laneWidth = 2.0f;
constexpr float gravityTransTime = 0.3f;
constexpr float damageFlashColor[4] = { 1.0f, 0.1f, 0.1f, 1.0f };
constexpr float damageFlashDuration = 0.7f;
constexpr float damageFlashInterval = 0.08f;
constexpr int baseScore = 100;
constexpr float comboMultiplier = 0.1f;
constexpr int orbHealAmount = 100;
constexpr float orbJudgeWindow = -0.5f;
constexpr float rainbowCornerSoftness = 0.5f;
// 各面のカメラオフセット(Yaw, Pitch, PosX, PosY, PosZ)
constexpr CameraFaceOffset cameraOffsets[4] = {
{ 0.0f, -12.3f, 0.0f, 1.3f, 2.5f }, // FLOOR
{ 10.3f, 0.0f, 1.7f, 0.0f, 2.5f }, // LEFT_WALL
{ 0.0f, 12.3f, 0.0f, -1.3f, 2.5f }, // CEILING
{ -10.3f, 0.0f, -1.7f, 0.0f, 2.5f } // RIGHT_WALL
};
}
struct DebugParams
{
// ノーツ
float noteSpeed = 10.0f; // ノーツのZ軸移動速度 (units/sec)
float hitDistance = 2.0f; // 判定が発生するZ距離 (units)
// プレイヤー
float laneWidth = 2.0f; // レーン間の距離 (units)
float gravityTransTime = 0.3f; // 重力移動にかかる時間 (sec)
float damageFlashColor[4] = { 1.0f, 0.1f, 0.1f, 1.0f };
float damageFlashDuration = 0.7f; // ダメージ点滅の合計時間 (sec)
float damageFlashInterval = 0.08f;// 通常色/点滅色の切替間隔 (sec)
// スコア
int baseScore = 100; // 1ヒットあたりの基本スコア
float comboMultiplier = 0.1f; // コンボ数 × この値が倍率に加算(1.0 + combo * multiplier)
// オーブ
int orbHealAmount = 100; // オーブ取得時のHP回復量
float orbJudgeWindow = -0.5f; // オーブの早期HIT判定を開始する追加Z距離(HIT_ZONE_Zに加算。値を大きくするほどプレイヤーから遠い位置で取得判定になり、見た目の取得位置が胴側に上がる)
// レインボー(ロープホールド)
// コーナー制御点を角(0.0)〜中点(1.0)の間でブレンドし、カーブの鋭さを緩和する。
// 回転数が多いノーツほど1セグメントの奥行きが短くなり、値が0だとリボンが壁/床に埋まって見えやすい。
float rainbowCornerSoftness = 0.5f;
// カメラの面ごとオフセット
CameraFaceOffset cameraOffsets[4] = {
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }, // FACE_FLOOR (0)
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }, // FACE_LEFT_WALL (1)
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }, // FACE_CEILING (2)
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } // FACE_RIGHT_WALL (3)
};
static DebugParams& Get()
{
static DebugParams s;
return s;
}
void Save()
{
#ifdef _DEBUG
try
{
nlohmann::json j;
j["noteSpeed"] = noteSpeed;
j["hitDistance"] = hitDistance;
j["laneWidth"] = laneWidth;
j["gravityTransTime"] = gravityTransTime;
nlohmann::json flashColor = { damageFlashColor[0], damageFlashColor[1], damageFlashColor[2], damageFlashColor[3] };
j["damageFlashColor"] = flashColor;
j["damageFlashDuration"] = damageFlashDuration;
j["damageFlashInterval"] = damageFlashInterval;
j["baseScore"] = baseScore;
j["comboMultiplier"] = comboMultiplier;
j["orbHealAmount"] = orbHealAmount;
j["orbJudgeWindow"] = orbJudgeWindow;
j["rainbowCornerSoftness"] = rainbowCornerSoftness;
// JSONへのカメラオフセット出力は全廃止
// C++コピペ用テキストファイルの出力
std::ofstream txtFile("debugscene/camera_offsets_release.txt");
if (txtFile.is_open())
{
txtFile << std::fixed << std::setprecision(1);
txtFile << " constexpr CameraFaceOffset cameraOffsets[4] = {\n";
const char* comments[] = { " // FLOOR", " // LEFT_WALL", " // CEILING", " // RIGHT_WALL" };
for (int i = 0; i < 4; i++)
{
float y = roundf(cameraOffsets[i].yaw * 10.0f) / 10.0f;
float p = roundf(cameraOffsets[i].pitch * 10.0f) / 10.0f;
float px = roundf(cameraOffsets[i].posX * 10.0f) / 10.0f;
float py = roundf(cameraOffsets[i].posY * 10.0f) / 10.0f;
float pz = roundf(cameraOffsets[i].posZ * 10.0f) / 10.0f;
txtFile << " { "
<< y << "f, "
<< p << "f, "
<< px << "f, "
<< py << "f, "
<< pz << "f }";
if (i < 3) txtFile << ",";
txtFile << comments[i] << "\n";
}
txtFile << " };\n";
txtFile.close();
}
}
catch (...)
{
}
#endif
}
void LoadCameraOffsets()
{
#ifdef _DEBUG
try
{
std::ifstream file("debugscene/camera_offsets_release.txt");
if (!file.is_open()) return;
std::string line;
int faceIndex = 0;
while (std::getline(file, line) && faceIndex < 4)
{
size_t start = line.find('{');
size_t end = line.find('}');
if (start != std::string::npos && end != std::string::npos && start < end)
{
std::string inner = line.substr(start + 1, end - start - 1);
for (char& c : inner)
{
if (c == 'f' || c == ',') c = ' ';
}
std::stringstream ss(inner);
float y = 0.0f, p = 0.0f, px = 0.0f, py = 0.0f, pz = 0.0f;
if (ss >> y >> p >> px >> py >> pz)
{
cameraOffsets[faceIndex].yaw = y;
cameraOffsets[faceIndex].pitch = p;
cameraOffsets[faceIndex].posX = px;
cameraOffsets[faceIndex].posY = py;
cameraOffsets[faceIndex].posZ = pz;
}
faceIndex++;
}
}
file.close();
}
catch (...)
{
}
#endif
}
void Load()
{
#ifdef _DEBUG
try
{
std::ifstream file("debugscene/debug_params.json");
if (file.is_open())
{
nlohmann::json j;
file >> j;
file.close();
noteSpeed = j.value("noteSpeed", noteSpeed);
hitDistance = j.value("hitDistance", hitDistance);
laneWidth = j.value("laneWidth", laneWidth);
gravityTransTime = j.value("gravityTransTime", gravityTransTime);
if (j.contains("damageFlashColor") && j["damageFlashColor"].is_array() && j["damageFlashColor"].size() == 4)
{
for (int i = 0; i < 4; i++)
{
damageFlashColor[i] = j["damageFlashColor"][i].get<float>();
}
}
damageFlashDuration = j.value("damageFlashDuration", damageFlashDuration);
damageFlashInterval = j.value("damageFlashInterval", damageFlashInterval);
baseScore = j.value("baseScore", baseScore);
comboMultiplier = j.value("comboMultiplier", comboMultiplier);
orbHealAmount = j.value("orbHealAmount", orbHealAmount);
orbJudgeWindow = j.value("orbJudgeWindow", orbJudgeWindow);
rainbowCornerSoftness = j.value("rainbowCornerSoftness", rainbowCornerSoftness);
}
// カメラオフセットはテキストファイルから読み込む
LoadCameraOffsets();
}
catch (...)
{
}
#endif
}
private:
DebugParams()
{
#ifdef _DEBUG
Load();
#else
// リリースビルド時は定数を適用
noteSpeed = ReleaseConfig::noteSpeed;
hitDistance = ReleaseConfig::hitDistance;
laneWidth = ReleaseConfig::laneWidth;
gravityTransTime = ReleaseConfig::gravityTransTime;
for (int i = 0; i < 4; i++) damageFlashColor[i] = ReleaseConfig::damageFlashColor[i];
damageFlashDuration = ReleaseConfig::damageFlashDuration;
damageFlashInterval = ReleaseConfig::damageFlashInterval;
baseScore = ReleaseConfig::baseScore;
comboMultiplier = ReleaseConfig::comboMultiplier;
orbHealAmount = ReleaseConfig::orbHealAmount;
orbJudgeWindow = ReleaseConfig::orbJudgeWindow;
rainbowCornerSoftness = ReleaseConfig::rainbowCornerSoftness;
for (int i = 0; i < 4; i++) cameraOffsets[i] = ReleaseConfig::cameraOffsets[i];
#endif
}
};
#define D_PARAMS (DebugParams::Get())