Skip to content

Commit

Permalink
Add: RPE Convertor
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleYang0531 committed Aug 14, 2024
1 parent ea5dc4a commit 7609e3a
Show file tree
Hide file tree
Showing 21 changed files with 475 additions and 74 deletions.
402 changes: 347 additions & 55 deletions convert.h

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions engine/play/Judgeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Judgeline: public Archetype {
// allocatedId = EntityInfo.get(0);
allocateJudgelineId = allocateJudgelineId + 1;
speed = 0; x = 0; y = 0; rotate = 0; disappear = 1; floorPosition = 0;
var id = speedEvent.get(); jump(id, 3);
id = moveXEvent.get(); jump(id, 5);
id = moveYEvent.get(); jump(id, 5);
id = rotateEvent.get(); jump(id, 5);
id = disappearEvent.get(); jump(id, 5);
var id = speedEvent.get(); jump(id, 4);
id = moveXEvent.get(); jump(id, 12);
id = moveYEvent.get(); jump(id, 12);
id = rotateEvent.get(); jump(id, 12);
id = disappearEvent.get(); jump(id, 12);
speed = 0; x = 0; y = 0; rotate = 0; disappear = 1; floorPosition = 0;
return VOID;
}
Expand Down
7 changes: 7 additions & 0 deletions engine/play/events/DisappearEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ class DisappearEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down
14 changes: 14 additions & 0 deletions engine/play/events/MoveEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ class MoveXEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down Expand Up @@ -40,6 +47,13 @@ class MoveYEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down
7 changes: 7 additions & 0 deletions engine/play/events/RotateEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ class RotateEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down
9 changes: 5 additions & 4 deletions engine/play/events/SpeedEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class SpeedEvent: public Archetype {
static constexpr const char* name = "Phigros Judgeline Speed Event";
defineImports(startTime);
defineImports(endTime);
defineImports(value);
defineImports(start);
defineImports(end);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand All @@ -18,14 +19,14 @@ class SpeedEvent: public Archetype {
FUNCBEGIN
bpm = EntityDataArray[judgelineId].get(5);
baseFloorPosition = EntitySharedMemoryArray[judgelineId].get(5);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (endTime - startTime) * timeMagic / bpm * value);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (endTime - startTime) * timeMagic / bpm * start);
return VOID;
}

SonolusApi updateSequential() {
FUNCBEGIN
EntitySharedMemoryArray[judgelineId].set(0, value);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (times.now - startTime * timeMagic / bpm) * value);
EntitySharedMemoryArray[judgelineId].set(0, start);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (times.now - startTime * timeMagic / bpm) * start);
IF (times.now > endTime * timeMagic / bpm) EntityDespawn.set(0, 1); FI
return VOID;
}
Expand Down
4 changes: 4 additions & 0 deletions engine/play/notes/DragNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class DragNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineExports(accuracy);
defineExports(judgeResult);
Variable<EntityMemoryId> positionY;
Expand Down
4 changes: 4 additions & 0 deletions engine/play/notes/FlickNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class FlickNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineExports(accuracy);
defineExports(judgeResult);
Variable<EntityMemoryId> positionY;
Expand Down
4 changes: 4 additions & 0 deletions engine/play/notes/HoldNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class HoldNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineExports(accuracy);
defineExports(judgeResult);
defineExports(judgeTime);
Expand Down
4 changes: 4 additions & 0 deletions engine/play/notes/NormalNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class NormalNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineExports(accuracy);
defineExports(judgeResult);
Variable<EntityMemoryId> positionY;
Expand Down
10 changes: 5 additions & 5 deletions engine/watch/Judgeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Judgeline: public Archetype {
// allocatedId = EntityInfo.get(0);
allocateJudgelineId = allocateJudgelineId + 1;
speed = 0; x = 0; y = 0; rotate = 0; disappear = 1; floorPosition = 0;
var id = speedEvent.get(); jump(id, 3);
id = moveXEvent.get(); jump(id, 5);
id = moveYEvent.get(); jump(id, 5);
id = rotateEvent.get(); jump(id, 5);
id = disappearEvent.get(); jump(id, 5);
var id = speedEvent.get(); jump(id, 4);
id = moveXEvent.get(); jump(id, 12);
id = moveYEvent.get(); jump(id, 12);
id = rotateEvent.get(); jump(id, 12);
id = disappearEvent.get(); jump(id, 12);
speed = 0; x = 0; y = 0; rotate = 0; disappear = 1; floorPosition = 0;
return VOID;
}
Expand Down
2 changes: 1 addition & 1 deletion engine/watch/StageController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class StageController: public Archetype {
var head = headNoteId.get();
IF (isReplay) {
FOR (i, 0, noteNumber, 1) {
var index = If(EntityInfoArray[head].get(1) == getArchetypeId(HoldNote), 12, 11);
var index = If(EntityInfoArray[head].get(1) == getArchetypeId(HoldNote), 16, 15);
IF (EntityDataArray[head].get(index) != 0) combo = combo + 1;
ELSE combo = 0; FI
EntitySharedMemoryArray[head].set(2, combo);
Expand Down
7 changes: 7 additions & 0 deletions engine/watch/events/DisappearEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ class DisappearEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down
14 changes: 14 additions & 0 deletions engine/watch/events/MoveEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ class MoveXEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down Expand Up @@ -39,6 +46,13 @@ class MoveYEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down
7 changes: 7 additions & 0 deletions engine/watch/events/RotateEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ class RotateEvent: public Archetype {
defineImports(start);
defineImports(end);
defineImports(easing);
defineImports(easingLeft);
defineImports(easingRight);
defineImports(bezier);
defineImports(bezierP1);
defineImports(bezierP2);
defineImports(bezierP3);
defineImports(bezierP4);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand Down
9 changes: 5 additions & 4 deletions engine/watch/events/SpeedEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class SpeedEvent: public Archetype {
static constexpr const char* name = "Phigros Judgeline Speed Event";
defineImports(startTime);
defineImports(endTime);
defineImports(value);
defineImports(start);
defineImports(end);
defineImports(next);
Variable<EntityMemoryId> bpm;
Variable<EntitySharedMemoryId> judgelineId;
Expand All @@ -18,14 +19,14 @@ class SpeedEvent: public Archetype {
FUNCBEGIN
bpm = EntityDataArray[judgelineId].get(5);
baseFloorPosition = EntitySharedMemoryArray[judgelineId].get(5);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (endTime - startTime) * timeMagic / bpm * value);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (endTime - startTime) * timeMagic / bpm * start);
return VOID;
}

SonolusApi updateSequential() {
FUNCBEGIN
EntitySharedMemoryArray[judgelineId].set(0, value);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (times.now - startTime * timeMagic / bpm) * value);
EntitySharedMemoryArray[judgelineId].set(0, start);
EntitySharedMemoryArray[judgelineId].set(5, baseFloorPosition + (times.now - startTime * timeMagic / bpm) * start);
return VOID;
}
};
4 changes: 4 additions & 0 deletions engine/watch/notes/DragNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class DragNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineImports(accuracy);
defineImports(judgeResult);
Variable<EntityMemoryId> positionY;
Expand Down
4 changes: 4 additions & 0 deletions engine/watch/notes/FlickNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class FlickNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineImports(accuracy);
defineImports(judgeResult);
Variable<EntityMemoryId> positionY;
Expand Down
4 changes: 4 additions & 0 deletions engine/watch/notes/HoldNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class HoldNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineImports(accuracy);
defineImports(judgeResult);
defineImports(judgeTime);
Expand Down
4 changes: 4 additions & 0 deletions engine/watch/notes/NormalNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class NormalNote: public Archetype {
defineImports(isFake);
defineImports(judgeline);
defineImports(bpm);
defineImports(size);
defineImports(yOffset);
defineImports(visibleTime);
defineImports(alpha);
defineImports(accuracy);
defineImports(judgeResult);
Variable<EntityMemoryId> positionY;
Expand Down
19 changes: 19 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ int main(int argc, char** argv) {
for (int i = 0; i < data.size(); i++) fout << data.v[i];
fout.close();
return 0;
} else if (string(argv[1]) == "rpe2json") {
if (argc != 4) helpText(argc, argv);
string chart = readFile(argv[2]);
string LevelData = fromRPE(chart);
ofstream fout(argv[3]);
fout.write(LevelData.c_str(), LevelData.size());
fout.close();
return 0;
} else if (string(argv[1]) == "rpe2data") {
if (argc != 4) helpText(argc, argv);
string chart = readFile(argv[2]);
string LevelData = fromPGS(fromRPE(chart));
cout << "Compressing..." << endl;
buffer data = compress_gzip(LevelData, 9);
cout << "Compress Finished." << endl;
ofstream fout(argv[3]);
for (int i = 0; i < data.size(); i++) fout << data.v[i];
fout.close();
return 0;
}
}

Expand Down

0 comments on commit 7609e3a

Please sign in to comment.