Skip to content

Commit

Permalink
Merge pull request #3 from SonolusHaniwa/optimize
Browse files Browse the repository at this point in the history
Optimize Compilation Speed
  • Loading branch information
LittleYang0531 authored Nov 10, 2023
2 parents 5923ab4 + a010bd3 commit 0580d38
Show file tree
Hide file tree
Showing 54 changed files with 1,443 additions and 1,184 deletions.
42 changes: 31 additions & 11 deletions blocks/Archetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,44 @@ class Archetype {
bool hasInput = false;

int preprocessOrder = 0;
FuncNode preprocess = {Return(0)};
FuncNode preprocess() {
return { Return(0) };
}

int spawnOrderOrder = 0;
FuncNode spawnOrder = {Return(0)};
FuncNode spawnOrder() {
return { Return(0) };
}

int shouldSpawnOrder = 0;
FuncNode shouldSpawn = {Return(0)};
FuncNode shouldSpawn() {
return { Return(0) };
}

int initializeOrder = 0;
FuncNode initialize = {Return(0)};
FuncNode initialize() {
return { Return(0) };
}

int updateSequentialOrder = 0;
FuncNode updateSequential = {Return(0)};
FuncNode updateSequential() {
return { Return(0) };
}

int touchOrder = 0;
FuncNode touch = {Return(0)};
FuncNode touch() {
return { Return(0) };
}

int updateParallelOrder = 0;
FuncNode updateParallel = {Return(0)};
FuncNode updateParallel() {
return { Return(0) };
}

int terminateOrder = 0;
FuncNode terminate = {Return(0)};
FuncNode terminate() {
return { Return(0) };
}

vector<pair<string, int> > data;
};
Expand All @@ -40,11 +56,15 @@ class Archetype {
string name = "Default Archtype";

int preprocessOrder = 0;
FuncNode preprocess = { Return(0) };
FuncNode preprocess() {
return { Return(0) };
}

int renderOrder = 0;
FuncNode render = { Return(0) };
FuncNode render() {
return { Return(0) };
}

vector<pair<string, int> > data;
};
#endif
#endif
8 changes: 4 additions & 4 deletions blocks/Define.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ T defineInstructionIcons(vector<pair<string, int> > icons) {
return T();
}

FuncNode definePreprocess(FuncNode func) {
function<FuncNode()> definePreprocess(function<FuncNode()> func) {
tutorialPreprocess = func;
return func;
}

FuncNode defineNavigate(FuncNode func) {
function<FuncNode()> defineNavigate(function<FuncNode()> func) {
tutorialNavigate = func;
return func;
}

FuncNode defineUpdate(FuncNode func) {
function<FuncNode()> defineUpdate(function<FuncNode()> func) {
tutorialUpdate = func;
return func;
}
}
10 changes: 5 additions & 5 deletions blocks/Pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class Pointer {
int size = -1;

FuncNode get(FuncNode i) {
if (size != -1 && i.isValue == true &&
(i.value >= size || i.value < 0)) throwWarning("");
// if (size != -1 && i.isValue == true &&
// (i.value >= size || i.value < 0)) throwWarning("");
return Get(identifierId, Add({i, offset}));
}

FuncNode set(FuncNode i, FuncNode value) {
if (size != -1 && i.isValue == true &&
(i.value >= size || i.value < 0)) throwWarning("");
// if (size != -1 && i.isValue == true &&
// (i.value >= size || i.value < 0)) throwWarning("");
return Execute({
Set(identifierId, Add({i, offset}), value)
});
Expand All @@ -30,4 +30,4 @@ class PointerArray {

T operator [] (int offset) {return T(Multiply({offset, blockSize}));}
T operator [] (FuncNode offset) {return T(Multiply({offset, blockSize}));};
};
};
Binary file modified dist/EngineData
Binary file not shown.
Binary file modified dist/EnginePreviewData
Binary file not shown.
Binary file modified dist/EngineTutorialData
Binary file not shown.
95 changes: 51 additions & 44 deletions engine/data/archetype/CriticalHoldStart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,59 @@ class SiriusCriticalHoldStart : public Archetype {
var laneLength = EntityData.get(2);
var enLane = lane + laneLength - 1;

var spawnOrder = 1000 + beat;
var shouldSpawn = times.now > beat - appearTime;
var spawnOrder() { return 1000 + beat; }
var shouldSpawn() { return times.now > beat - appearTime; }

var preprocess = {
IF (LevelOption.get(Options.Mirror)) {
EntityData.set(1, 13 - enLane)
} FI,
EntityInput.set(2, Buckets.CriticalHoldStart)
};
var preprocess() {
return {
IF (LevelOption.get(Options.Mirror)) {
EntityData.set(1, 13 - enLane)
} FI,
EntityInput.set(2, Buckets.CriticalHoldStart)
};
}

var updateSequential = {
IF (times.now <= beat) {
drawNormalNote(Sprites.CriticalNote, lane, enLane, beat)
} FI,
IF (LevelOption.get(Options.Autoplay) && times.now > beat) {
JudgeCriticalNote(beat, beat),
currentJudge.set(Sprites.JudgeAuto),
currentJudgeStartTime.set(times.now),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1)
} FI,
IF (times.now > beat + judgment.good) {
currentJudge.set(Sprites.JudgeMiss),
currentJudgeStartTime.set(times.now),
} FI
};
var updateSequential() {
return {
IF (times.now <= beat) {
drawNormalNote(Sprites.CriticalNote, lane, enLane, beat)
} FI,
IF (LevelOption.get(Options.Autoplay) && times.now > beat) {
JudgeCriticalNote(beat, beat),
currentJudge.set(Sprites.JudgeAuto),
currentJudgeStartTime.set(times.now),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1)
} FI,
IF (times.now > beat + judgment.good) {
SpawnSubJudgeText(Sprites.JudgeMiss)
} FI
};
}

var touch = {
IF (LevelOption.get(Options.Autoplay) || times.now < beat - judgment.good) { Return(0) } FI,
FOR (i, 0, touches.size, 1) {
IF (touches[i].started == false) { CONTINUE } FI,
IF (!lines.inClickBox(touches[i], lane, enLane, true)) { CONTINUE } FI,
IF (isUsed(touches[i])) { CONTINUE } FI,
markAsUsed(touches[i]),
JudgeCriticalNote(times.now, beat),
SpawnJudgeText(times.now, beat),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1),
} DONE
};
var touch() {
return {
IF (LevelOption.get(Options.Autoplay) || times.now < beat - judgment.good) { Return(0) } FI,
FOR (i, 0, touches.size, 1) {
IF (touches[i].started == false) { CONTINUE } FI,
IF (!lines.inClickBox(touches[i], lane, enLane, true)) { CONTINUE } FI,
IF (isUsed(touches[i])) { CONTINUE } FI,
markAsUsed(touches[i]),
JudgeCriticalNote(times.now, beat),
SpawnJudgeText(times.now, beat),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1),
} DONE
};
}

var updateParallel = {
IF (times.now > beat + judgment.good) {
EntityInput.set(0, 0),
EntityInput.set(1, 0),
EntityDespawn.set(0, 1)
} FI
};
var updateParallel() {
return {
IF (times.now > beat + judgment.good) {
EntityInput.set(0, 0),
EntityInput.set(1, 0),
EntityDespawn.set(0, 1)
} FI
};
}
};
92 changes: 50 additions & 42 deletions engine/data/archetype/CriticalNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,58 @@ class CriticalNote : public Archetype {
var laneLength = EntityData.get(2);
var enLane = lane + laneLength - 1;

var spawnOrder = 1000 + beat;
var shouldSpawn = times.now > beat - appearTime;
var spawnOrder() { return 1000 + beat; }
var shouldSpawn() { return times.now > beat - appearTime; }

var preprocess = {
IF (LevelOption.get(Options.Mirror)) {
EntityData.set(1, 13 - enLane)
} FI,
EntityInput.set(2, Buckets.CriticalNote)
};
var preprocess() {
return {
IF (LevelOption.get(Options.Mirror)) {
EntityData.set(1, 13 - enLane)
} FI,
EntityInput.set(2, Buckets.CriticalNote)
};
}

var updateSequential = {
drawNormalNote(Sprites.CriticalNote, lane, enLane, beat),
IF (LevelOption.get(Options.Autoplay) && times.now > beat) {
JudgeCriticalNote(beat, beat),
currentJudge.set(Sprites.JudgeAuto),
currentJudgeStartTime.set(times.now),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1)
} FI,
IF (times.now > beat + judgment.good) {
currentJudge.set(Sprites.JudgeMiss),
currentJudgeStartTime.set(times.now),
} FI
};
var updateSequential() {
return {
drawNormalNote(Sprites.CriticalNote, lane, enLane, beat),
IF (LevelOption.get(Options.Autoplay) && times.now > beat) {
JudgeCriticalNote(beat, beat),
currentJudge.set(Sprites.JudgeAuto),
currentJudgeStartTime.set(times.now),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1)
} FI,
IF (times.now > beat + judgment.good) {
currentJudge.set(Sprites.JudgeMiss),
currentJudgeStartTime.set(times.now),
} FI
};
}

var touch = {
IF (LevelOption.get(Options.Autoplay) || times.now < beat - judgment.good) { Return(0) } FI,
FOR (i, 0, touches.size, 1) {
IF (touches[i].started == false) { CONTINUE } FI,
IF (!lines.inClickBox(touches[i], lane, enLane)) { CONTINUE } FI,
IF (isUsed(touches[i])) { CONTINUE } FI,
markAsUsed(touches[i]),
JudgeCriticalNote(times.now, beat),
SpawnJudgeText(times.now, beat),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1),
} DONE
};
var touch() {
return {
IF (LevelOption.get(Options.Autoplay) || times.now < beat - judgment.good) { Return(0) } FI,
FOR (i, 0, touches.size, 1) {
IF (touches[i].started == false) { CONTINUE } FI,
IF (!lines.inClickBox(touches[i], lane, enLane)) { CONTINUE } FI,
IF (isUsed(touches[i])) { CONTINUE } FI,
markAsUsed(touches[i]),
JudgeCriticalNote(times.now, beat),
SpawnJudgeText(times.now, beat),
spawnEffect(Effects.CriticalLinear, Effects.CriticalCircular, lane, enLane),
EntityDespawn.set(0, 1),
} DONE
};
}

var updateParallel = {
IF (times.now > beat + judgment.good) {
EntityInput.set(0, 0),
EntityInput.set(1, 0),
EntityDespawn.set(0, 1)
} FI
};
var updateParallel() {
return {
IF (times.now > beat + judgment.good) {
EntityInput.set(0, 0),
EntityInput.set(1, 0),
EntityDespawn.set(0, 1)
} FI
};
}
};
Loading

0 comments on commit 0580d38

Please sign in to comment.