Skip to content

Commit

Permalink
Fix: FPS Drop
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleYang0531 committed Aug 12, 2024
1 parent b01c035 commit ea5dc4a
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 28 deletions.
47 changes: 37 additions & 10 deletions convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,14 @@ string trim(string s) {
return s;
}

void PECSolveEvent(vector<PGREvent> &events) {
for (int i = 1; i < events.size(); i++) events[i].start = events[i - 1].end;
for (int i = events.size() - 2; i >= 0; i--) {
double et = events[i].endTime, st = events[i + 1].startTime;
if (et < st) events.push_back({ et, st, events[i].end, events[i].end, 0 });
if (et > st) events[i + 1].startTime = events[i].endTime;
} sort(events.begin(), events.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
}
string fromPEC(string txt, double bgmOffset = 0) {
int easingSize = sizeof(PECEasingMap) / sizeof(int);

Expand Down Expand Up @@ -662,16 +670,8 @@ string fromPEC(string txt, double bgmOffset = 0) {
sort(j.rotateEvents.begin(), j.rotateEvents.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
sort(j.disappearEvents.begin(), j.disappearEvents.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
for (int i = j.speedEvents.size() - 2; i >= 0; i--) j.speedEvents[i].endTime = j.speedEvents[i + 1].startTime;
auto solveEvent = [&](vector<PGREvent> &events, bool output = false){
for (int i = 1; i < events.size(); i++) events[i].start = events[i - 1].end;
for (int i = events.size() - 2; i >= 0; i--) {
double et = events[i].endTime, st = events[i + 1].startTime;
if (et < st) events.push_back({ et, st, events[i].end, events[i].end, 0 });
if (et > st) events[i + 1].startTime = events[i].endTime;
} sort(events.begin(), events.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
};
solveEvent(j.moveXEvents); solveEvent(j.moveYEvents);
solveEvent(j.rotateEvents); solveEvent(j.disappearEvents);
PECSolveEvent(j.moveXEvents); PECSolveEvent(j.moveYEvents);
PECSolveEvent(j.rotateEvents); PECSolveEvent(j.disappearEvents);
}

// 给所有的事件加上个尾巴,不然 tmd 会出事
Expand Down Expand Up @@ -717,13 +717,29 @@ string fromPEC(string txt, double bgmOffset = 0) {
// ========================================================================================
//
// RPE Format Chart --> Official Phigros Format Chart
// 摆了,太 tm 复杂了,有时间我再写
//
// ========================================================================================



double BeatToDouble(Json::Value beat) {
return beat[0].asDouble() + beat[1].asDouble() / beat[2].asDouble();
}
void RPESolveEvent(vector<PGRSpeedEvent> &events) {
// 排序
sort(events.begin(), events.end(), [&](PGRSpeedEvent a, PGRSpeedEvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
// 先处理异常 1
assert(events.size());
if (events[0].startTime > 0) events.insert(events.begin(), { 0, events[0].startTime, 0.0, 0 });
// 异常 1 处理结束
// =========================
// 再处理异常 3
// for (int i = 0; i < events.size(); i++) if (events[i].startTime > events[i].endTime)

}
void RPESolveEvent(vector<PGREvent> &events) {

}
string fromRPE(string json, double bgmOffset = 0) {
Json::Value rpe; json_decode(json, rpe);
Expand Down Expand Up @@ -752,6 +768,7 @@ string fromRPE(string json, double bgmOffset = 0) {
for (int i = 0; i < rpe["judgeLineList"].size(); i++) {
auto item = rpe["judgeLineList"][i];
// 先将所有的事件添加进判定线去
judgelines[i].bpm = basicBpm * item["bpmfactor"].asDouble();
for (int j = 0; j < item["eventLayers"].size(); j++) {
auto layer = item["eventLayers"][j];
for (int k = 0; k < layer["speedEvents"].size(); k++)
Expand Down Expand Up @@ -811,4 +828,14 @@ string fromRPE(string json, double bgmOffset = 0) {
});
}
}

for (auto &j: judgelines) {
sort(j.moveXEvents.begin(), j.moveXEvents.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
sort(j.moveYEvents.begin(), j.moveYEvents.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
sort(j.rotateEvents.begin(), j.rotateEvents.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
sort(j.disappearEvents.begin(), j.disappearEvents.end(), [&](PGREvent a, PGREvent b){ return a.startTime + a.endTime < b.startTime + b.endTime; });
RPESolveEvent(j.speedEvents);
RPESolveEvent(j.moveXEvents); RPESolveEvent(j.moveYEvents);
RPESolveEvent(j.rotateEvents); RPESolveEvent(j.disappearEvents);
}
}
6 changes: 3 additions & 3 deletions engine/buckets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ auto bucket = defineBuckets<class Buckets>({
x: 0,
y: 0,
w: 4.0,
h: 4.0,
h: 2.0,
rotation: 0
}
},
Expand All @@ -30,7 +30,7 @@ auto bucket = defineBuckets<class Buckets>({
x: 0,
y: 0,
w: 4.0,
h: 4.0,
h: 2.0,
rotation: 0
}
},
Expand Down Expand Up @@ -64,7 +64,7 @@ auto bucket = defineBuckets<class Buckets>({
x: 0,
y: 0,
w: 4.0,
h: 4.0,
h: 2.0,
rotation: 0
}
},
Expand Down
14 changes: 7 additions & 7 deletions engine/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ double targetAspectRatio = 1920.0 / 1080.0;
double judgelineHeight = 0.01;
double baseNoteWidth = 0.48;
double minSFXDistance = 0.02;
double noteRatio = 1;
double dragRatio = 1;
double flickRatio = 1;
double hlNoteRatio = 1;
double hlDragRatio = 1;
double hlFlickRatio = 1;
double noteRatio = 2;
double dragRatio = 2;
double flickRatio = 2;
double hlNoteRatio = 2;
double hlDragRatio = 2;
double hlFlickRatio = 2;
double holdHeadRatio = 989.0 / 50.0;
double holdBodyRatio = 989.0 / 1950.0;
double hlHoldHeadRatio = 1062.0 / 97.0;
Expand Down Expand Up @@ -68,7 +68,7 @@ class stage {
#endif

#if play || watch
let noteWidth = noteWidth2 / (3.25 / stage.w);
let noteWidth = noteWidth2 * (stage.w / 3.55) * (stage.w / 3.55);
class judgment {
public:

Expand Down
3 changes: 1 addition & 2 deletions engine/watch/notes/DragNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ class DragNote: public Archetype {
SonolusApi updateSequential() {
FUNCBEGIN
IF (times.now < 0) Return(0); FI
IF (isAbove) positionY = floorPosition - line.get(5);
ELSE positionY = floorPosition + line.get(5); FI
positionY = If(isAbove, floorPosition - line.get(5), floorPosition + line.get(5));
return VOID;
}

Expand Down
3 changes: 1 addition & 2 deletions engine/watch/notes/FlickNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ class FlickNote: public Archetype {
SonolusApi updateSequential() {
FUNCBEGIN
IF (times.now < 0) Return(0); FI
IF (isAbove) positionY = floorPosition - line.get(5);
ELSE positionY = floorPosition + line.get(5); FI
positionY = If(isAbove, floorPosition - line.get(5), floorPosition + line.get(5));
return VOID;
}

Expand Down
3 changes: 1 addition & 2 deletions engine/watch/notes/HoldNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ class HoldNote: public Archetype {
FUNCBEGIN
IF (times.skip) lastSpawn = -1; FI
IF (times.now < 0) Return(0); FI
IF (isAbove) positionY = floorPosition - line.get(5);
ELSE positionY = floorPosition + line.get(5); FI
positionY = If(isAbove, floorPosition - line.get(5), floorPosition + line.get(5));
IF (isFake) Return(0); FI

// 画粒子效果
Expand Down
3 changes: 1 addition & 2 deletions engine/watch/notes/NormalNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ class NormalNote: public Archetype {
SonolusApi updateSequential() {
FUNCBEGIN
IF (times.now < 0) Return(0); FI
IF (isAbove) positionY = floorPosition - line.get(5);
ELSE positionY = floorPosition + line.get(5); FI
positionY = If(isAbove, floorPosition - line.get(5), floorPosition + line.get(5));
return VOID;
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
},
"level": {
"name": "phigros-test-114514",
"generate": "",
"i18n": [
{
"localization": "default",
Expand Down
Binary file modified skin/#JUDGMENT_LINE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_CONNECTION_BLUE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_CONNECTION_YELLOW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_HEAD_BLUE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_HEAD_CYAN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_HEAD_RED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_HEAD_YELLOW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_TAIL_BLUE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_TAIL_CYAN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_TAIL_RED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/#NOTE_TAIL_YELLOW.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/Judgeline AllPerfect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified skin/Judgeline FullCombo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ea5dc4a

Please sign in to comment.