diff --git a/blocks/Archetype.h b/blocks/Archetype.h index 3862df4..e19b8c6 100755 --- a/blocks/Archetype.h +++ b/blocks/Archetype.h @@ -69,16 +69,21 @@ class Archetype { class Archetype { public: - string name = "Default Archtype"; + static const bool disableGlobalPreprocess = false; + static constexpr const char* name = "Default Archtype"; int preprocessOrder = 0; SonolusApi preprocess() { - return { Return(0) }; + FUNCBEGIN + Return(0); + return VOID; } int renderOrder = 0; SonolusApi render() { - return { Return(0) }; + FUNCBEGIN + Return(0); + return VOID; } vector > data; diff --git a/blocks/Variable.h b/blocks/Variable.h index 9aacf1a..492156d 100644 --- a/blocks/Variable.h +++ b/blocks/Variable.h @@ -103,6 +103,7 @@ FuncNode mergeNodeContainer() { if (addBlockCounter.top()) blockCounter.pop(); else blockCounter.top() -= 1; addBlockCounter.pop(); + if (c.size() == 0) throwError("Your Sonolus will boom if I accept your empty function."); FuncNode res = FuncNode(RuntimeFunction.Block, { c.size() == 1 ? c[0] : FuncNode(RuntimeFunction.Execute, c) }); return res; diff --git a/convert.h b/convert.h index db77558..f84bd5c 100644 --- a/convert.h +++ b/convert.h @@ -358,12 +358,15 @@ string fromSUS(string text) { auto tmp3 = explode(".", type.c_str()); if (tmp3.size() != 2) throw runtime_error("Invalid Split Line Parameter: " + exp[i]); - switch(tmp2[1].size()) { - case 0: tmp2[1] = "0000"; break; - case 1: tmp2[1] = "000" + tmp2[1]; break; - case 2: tmp2[1] = "00" + tmp2[1]; break; - case 3: tmp2[1] = "0" + tmp2[1]; break; - } exp[i] = tmp2[0] + "'" + tmp2[1] + ":" + tmp3[0] + "." + tmp3[1]; + // switch(tmp2[1].size()) { + // case 0: tmp2[1] = "0000"; break; + // case 1: tmp2[1] = "000" + tmp2[1]; break; + // case 2: tmp2[1] = "00" + tmp2[1]; break; + // case 3: tmp2[1] = "0" + tmp2[1]; break; + // } + while (tmp2[1].size() < 4) tmp2[1] = '0' + tmp2[1]; + while (tmp3[1].size() < 5) tmp3[1] += '0'; // upd: 解决部分 Ched 保存 HiSpeed 不会保留五位小数的问题 2024/01/13 + exp[i] = tmp2[0] + "'" + tmp2[1] + ":" + tmp3[0] + "." + tmp3[1]; } sort(exp.begin(), exp.end()); for (auto i = 0; i < exp.size(); i++) { diff --git a/dist/EngineData b/dist/EngineData index da1dcb9..9230f64 100644 Binary files a/dist/EngineData and b/dist/EngineData differ diff --git a/dist/EnginePreviewData b/dist/EnginePreviewData index 1fe2288..2595542 100644 Binary files a/dist/EnginePreviewData and b/dist/EnginePreviewData differ diff --git a/dist/EngineWatchData b/dist/EngineWatchData index 2ac6412..7540c50 100644 Binary files a/dist/EngineWatchData and b/dist/EngineWatchData differ diff --git a/engine/constants.cpp b/engine/constants.cpp index 890840e..99af767 100644 --- a/engine/constants.cpp +++ b/engine/constants.cpp @@ -6,17 +6,11 @@ double defaultAppearTime = 7.4 / 5.0; // note 默认出现时间 double minSFXDistance = 0.02; // 最小音效时间 double judgelineMarginBottom = 0.25; // 判定线距离底部距离 double judgelineHeight = 85.0 / 640.0; // 判定线高度 -double noteHeight = 85.0 / 640.0; // note 高度 double judglineMoveLength = 0.01; // judgline 微调距离 double noteMoveLength = 0.02; // note 微调距离 double splitLineLength = 0.01; // 分裂线宽度 -double arrowWidth = 80.0 / 640.0; // 箭头宽度 -double arrowHeight = 240.0 / 640.0; // 箭头高度 double arrowPercent = 1.6; // 箭头所占比例 double arrowSpeed = 20; // 箭头速率常数 -double tickWidth = 168.0 / 640.0; // tick 宽度 -double tickHeight = 112.0 / 640.0; // tick 高度 -double syncLineHeight = 5.0 / 640.0; // 同步线高度 double splitLineAnimationStart = 0.75; // 分裂线起始动画长度, basic: 0.7595 double splitLineAnimationEnd = 0.20; // 分裂线结束动画长度, basic: 0.7595 double effectLinearHeight = 280.0 / 640.0; // 特效高度 @@ -33,17 +27,30 @@ double judgeMissRatio = 177.0 / 76.0; // 判定文字 Miss 比例 double judgeAutoRatio = 216.0 / 76.0; // 判定文字 Auto 比例 double judgeTextHeight = 0.15; // 判定文字高度 double judgeTextDuration = 0.2; // 判定文字动画时长 +double stageWidth = 0.7; // 单个舞台宽度 +double stageHeight = 2.0; // 单个舞台高度 +double stageFullWidth = stageWidth + 0.3; // 单个舞台占有宽度 +double stageTimelineWidth = stageWidth + 0.2; // 时间线宽度 +double stageTimeLength = 2.0; // 单个舞台容纳时间 +double adjustDistance = 0.002; // 按键微调距离 +double noteCountDistance = 10; // 按键计数长度 +#if play || watch +double noteHeight = 85.0 / 640.0; // note 高度 +double tickWidth = 168.0 / 640.0; // tick 宽度 +double tickHeight = 112.0 / 640.0; // tick 高度 +double arrowWidth = 80.0 / 640.0; // 箭头宽度 +double arrowHeight = 240.0 / 640.0; // 箭头高度 +double syncLineHeight = 5.0 / 640.0; // 同步线高度 +#elif preview +double noteHeight = 0.04; // 按键高度 +double tickWidth = 0.03; // tick 宽度 +double tickHeight = 0.045; // tick 高度 +double arrowWidth = 0.03; // 箭头宽度 +double arrowHeight = 0.06; // 箭头高度 +double syncLineHeight = 0.003; // 同步线高度 +#endif -#ifdef play -let mirror = LevelOption.get(Options.Mirror); -let speed = LevelOption.get(Options.NoteSpeed); -let hidden = LevelOption.get(Options.Hidden); -let splitRandom = LevelOption.get(Options.SplitRandom); -let splitLine = LevelOption.get(Options.SplitLine); -let syncLine = LevelOption.get(Options.SyncLine); -let lockAspectRatio = LevelOption.get(Options.LockAspectRatio); -let extraWidth = LevelOption.get(Options.ExtraWidth); -#elif watch +#if play || watch let mirror = LevelOption.get(Options.Mirror); let speed = LevelOption.get(Options.NoteSpeed); let hidden = LevelOption.get(Options.Hidden); @@ -52,8 +59,11 @@ let splitLine = LevelOption.get(Options.SplitLine); let syncLine = LevelOption.get(Options.SyncLine); let lockAspectRatio = LevelOption.get(Options.LockAspectRatio); let extraWidth = LevelOption.get(Options.ExtraWidth); +#elif preview +let mirror, speed, hidden, splitRandom, splitLine, syncLine, lockAspectRatio, extraWidth; #endif +#if play || watch class stage { public: @@ -68,6 +78,13 @@ class stage { Variable t = h / 2; Variable b = -1 * h / 2; }stage; +#elif preview +class stage { + public: + + let w, h, l, r, t, b; +}stage; +#endif class judgline { public: @@ -121,6 +138,15 @@ class score { let good = 0.5; }score; +#if play || watch Variable currentJudge; Variable currentJudgeStartTime; -Array splitLineMemory(16); +Array splitLineMemory(16); +let duration, noteCount, noteId; +#elif preview +Variable duration; // 谱面时长 +Variable noteCount; // note 数量 +Variable noteId; // note 编号 +Array splitLineMemory(16); +let currentJudge, currentJudgeStartTime; +#endif diff --git a/engine/engine.cpp b/engine/engine.cpp index 93ce83f..b51ad86 100755 --- a/engine/engine.cpp +++ b/engine/engine.cpp @@ -60,25 +60,22 @@ using namespace watchData; #include"tutorial/navigate.cpp" #include"tutorial/update.cpp" #elif preview -#include"skins.cpp" -#include"preview/constants.cpp" -#include"preview/utils.cpp" -#include"getSplitLine.cpp" -#include"preview/archetype/Initialization.cpp" -#include"preview/archetype/Stage.cpp" -#include"preview/archetype/NormalNote.cpp" -#include"preview/archetype/CriticalNote.cpp" -#include"preview/archetype/FlickNote.cpp" -#include"preview/archetype/HoldStart.cpp" -#include"preview/archetype/HoldEighth.cpp" -#include"preview/archetype/CriticalHoldStart.cpp" -#include"preview/archetype/ScratchHoldStart.cpp" -#include"preview/archetype/CriticalScratchHoldStart.cpp" -#include"preview/archetype/HoldEnd.cpp" -#include"preview/archetype/ScratchHoldEnd.cpp" -#include"preview/archetype/Sound.cpp" -#include"preview/archetype/SyncLine.cpp" -#include"preview/archetype/SplitLine.cpp" +#include"preview/Initialization.cpp" +#include"preview/Stage.cpp" +#include"preview/flatNotes/FlatNote.cpp" +#include"preview/flatNotes/NormalNote.cpp" +#include"preview/flatNotes/CriticalNote.cpp" +#include"preview/flatNotes/HoldStart.cpp" +#include"preview/flatNotes/CriticalHoldStart.cpp" +#include"preview/flatNotes/ScratchHoldStart.cpp" +#include"preview/flatNotes/CriticalScratchHoldStart.cpp" +#include"preview/FlickNote.cpp" +#include"preview/holdNotes/HoldEighth.cpp" +#include"preview/holdNotes/HoldEnd.cpp" +#include"preview/holdNotes/ScratchHoldEnd.cpp" +#include"preview/holdNotes/Sound.cpp" +#include"preview/SyncLine.cpp" +#include"preview/SplitLine.cpp" #elif watch #include"watch/updateSpawn.cpp" #include"watch/Initialization.cpp" diff --git a/engine/play/Initialization.cpp b/engine/play/Initialization.cpp index 5cb548f..0728138 100644 --- a/engine/play/Initialization.cpp +++ b/engine/play/Initialization.cpp @@ -3,7 +3,6 @@ class Initialization: public Archetype { static constexpr const char* name = "Sirius Initialization"; bool input = false; - vector > data = {}; SonolusApi preprocess() { FUNCBEGIN diff --git a/engine/preview/FlickNote.cpp b/engine/preview/FlickNote.cpp new file mode 100644 index 0000000..a669806 --- /dev/null +++ b/engine/preview/FlickNote.cpp @@ -0,0 +1,27 @@ +class FlickNote : public Archetype { + public: + + static constexpr const char* name = "Sirius Flick Note"; + + defineEntityData(beat); + defineEntityData(lane); + defineEntityData(laneLength); + Variable enLane; + + SonolusApi preprocess() { + FUNCBEGIN + duration = Max(duration.get(), beat); + noteCount = noteCount + 1; + noteId = noteCount.get(); + enLane = lane + laneLength - 1; + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + IF (noteId % noteCountDistance == 0) { drawNoteCount(beat, noteId); } FI; + drawPreviewNormalNote(Sprites.ScratchNote, beat, lane, enLane); + drawPreviewArrow(beat, lane, enLane); + return VOID; + } +}; diff --git a/engine/preview/Initialization.cpp b/engine/preview/Initialization.cpp new file mode 100644 index 0000000..fa2189b --- /dev/null +++ b/engine/preview/Initialization.cpp @@ -0,0 +1,23 @@ +class Initialization: public Archetype { + public: + + static constexpr const char* name = "Sirius Initialization"; + + SonolusApi preprocess() { + FUNCBEGIN + duration = 0; noteCount = 0; + + let menuWidth = 0.15 * ui.menuConfiguration.scale; + let menuHeight = 0.15 * ui.menuConfiguration.scale; + let menuX = screen.r - interfaceGap; + let menuY = screen.t - interfaceGap; + ui.menu.set(menuX, menuY, 1, 1, menuWidth, menuHeight, 0, ui.menuConfiguration.alpha, true); + + let progressWidth = screen.w - interfaceGap * 2; + let progressHeight = 0.15 * ui.progressConfiguration.scale; + let progressX = screen.l + interfaceGap; + let progressY = screen.b + interfaceGap; + ui.progress.set(progressX, progressY, 0, 0, progressWidth, progressHeight, 0, ui.progressConfiguration.alpha, true); + return VOID; + } +}; diff --git a/engine/preview/SplitLine.cpp b/engine/preview/SplitLine.cpp new file mode 100644 index 0000000..41d1f3a --- /dev/null +++ b/engine/preview/SplitLine.cpp @@ -0,0 +1,25 @@ +class SplitLine: public Archetype { + public: + + static constexpr const char* name = "Sirius Split Line"; + + defineEntityData(beat); + defineEntityData(endBeat); + defineEntityData(split); + defineEntityData(color); + + SonolusApi preprocess() { + FUNCBEGIN + duration = Max(duration.get(), beat); + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + getSplitLine(color); + drawPreviewSplitLine(beat - splitLineAnimationStart, beat, 1, split); + drawPreviewSplitLine(beat, endBeat, 0, split); + drawPreviewSplitLine(endBeat, endBeat + splitLineAnimationEnd, 2, split); + return VOID; + } +}; diff --git a/engine/preview/Stage.cpp b/engine/preview/Stage.cpp new file mode 100644 index 0000000..a6fe75f --- /dev/null +++ b/engine/preview/Stage.cpp @@ -0,0 +1,20 @@ +class Stage: public Archetype { + public: + + static constexpr const char* name = "Sirius Stage"; + bool input = false; + + int preprocessOrder = 1; + SonolusApi preprocess() { + FUNCBEGIN + canvas.set(Scroll.LeftToRight, Ceil(duration.get() / stageTimeLength) * stageFullWidth); + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + FOR (i, 0, Ceil(duration / stageTimeLength), 1) { drawStage(i); } DONE + FOR (i, 0, duration + 1, 1) { drawTime(i); } DONE + return VOID; + } +}; diff --git a/engine/preview/SyncLine.cpp b/engine/preview/SyncLine.cpp new file mode 100644 index 0000000..ab917ad --- /dev/null +++ b/engine/preview/SyncLine.cpp @@ -0,0 +1,15 @@ +class SyncLine: public Archetype { + public: + + static constexpr const char* name = "Sirius Sync Line"; + + defineEntityData(beat); + defineEntityData(left); + defineEntityData(right); + + SonolusApi render() { + FUNCBEGIN + drawPreviewSyncLine(beat, left, right); + return VOID; + } +}; diff --git a/engine/preview/flatNotes/CriticalHoldStart.cpp b/engine/preview/flatNotes/CriticalHoldStart.cpp new file mode 100644 index 0000000..a4d7110 --- /dev/null +++ b/engine/preview/flatNotes/CriticalHoldStart.cpp @@ -0,0 +1,6 @@ +class SiriusCriticalHoldStart: public FlatNote { + public: + static constexpr const char* name = "Sirius Critical Hold Start"; + + let getSprite() { return Sprites.CriticalNote; } +}; diff --git a/engine/preview/flatNotes/CriticalNote.cpp b/engine/preview/flatNotes/CriticalNote.cpp new file mode 100644 index 0000000..d7c253d --- /dev/null +++ b/engine/preview/flatNotes/CriticalNote.cpp @@ -0,0 +1,6 @@ +class CriticalNote: public FlatNote { + public: + static constexpr const char* name = "Sirius Critical Note"; + + let getSprite() { return Sprites.CriticalNote; } +}; diff --git a/engine/preview/flatNotes/CriticalScratchHoldStart.cpp b/engine/preview/flatNotes/CriticalScratchHoldStart.cpp new file mode 100644 index 0000000..af1a255 --- /dev/null +++ b/engine/preview/flatNotes/CriticalScratchHoldStart.cpp @@ -0,0 +1,6 @@ +class SiriusCriticalScratchHoldStart: public FlatNote { + public: + static constexpr const char* name = "Sirius Critical Scratch Hold Start"; + + let getSprite() { return Sprites.CriticalNote; } +}; diff --git a/engine/preview/flatNotes/FlatNote.cpp b/engine/preview/flatNotes/FlatNote.cpp new file mode 100644 index 0000000..6512305 --- /dev/null +++ b/engine/preview/flatNotes/FlatNote.cpp @@ -0,0 +1,25 @@ +class FlatNote: public Archetype { + public: + + defineEntityData(beat); + defineEntityData(lane); + defineEntityData(laneLength); + Variable enLane; + virtual let getSprite() { return -1; } + + SonolusApi preprocess() { + FUNCBEGIN + duration = Max(duration.get(), beat); + noteCount = noteCount + 1; + noteId = noteCount.get(); + enLane = lane + laneLength - 1; + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + IF (noteId % noteCountDistance == 0) { drawNoteCount(beat, noteId); } FI; + drawPreviewNormalNote(getSprite(), beat, lane, enLane); + return VOID; + } +}; diff --git a/engine/preview/flatNotes/HoldStart.cpp b/engine/preview/flatNotes/HoldStart.cpp new file mode 100644 index 0000000..e060914 --- /dev/null +++ b/engine/preview/flatNotes/HoldStart.cpp @@ -0,0 +1,6 @@ +class SiriusHoldStart: public FlatNote { + public: + static constexpr const char* name = "Sirius Hold Start"; + + let getSprite() { return Sprites.HoldNote; } +}; diff --git a/engine/preview/flatNotes/NormalNote.cpp b/engine/preview/flatNotes/NormalNote.cpp new file mode 100644 index 0000000..e786598 --- /dev/null +++ b/engine/preview/flatNotes/NormalNote.cpp @@ -0,0 +1,6 @@ +class NormalNote: public FlatNote { + public: + static constexpr const char* name = "Sirius Normal Note"; + + let getSprite() { return Sprites.NormalNote; } +}; diff --git a/engine/preview/flatNotes/ScratchHoldStart.cpp b/engine/preview/flatNotes/ScratchHoldStart.cpp new file mode 100644 index 0000000..a7b24a7 --- /dev/null +++ b/engine/preview/flatNotes/ScratchHoldStart.cpp @@ -0,0 +1,6 @@ +class SiriusScratchHoldStart: public FlatNote { + public: + static constexpr const char* name = "Sirius Scratch Hold Start"; + + let getSprite() { return Sprites.ScratchNote; } +}; diff --git a/engine/preview/holdNotes/HoldEighth.cpp b/engine/preview/holdNotes/HoldEighth.cpp new file mode 100644 index 0000000..4ddcd8e --- /dev/null +++ b/engine/preview/holdNotes/HoldEighth.cpp @@ -0,0 +1,23 @@ +class SiriusHoldEighth: public Archetype { + public: + + static constexpr const char* name = "Sirius Hold Eighth"; + + defineEntityData(beat); + defineEntityData(lane); + defineEntityData(laneLength); + + SonolusApi preprocess() { + FUNCBEGIN + duration = Max(duration.get(), beat); + noteCount = noteCount + 1; + noteId = noteCount.get(); + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + IF (noteId % noteCountDistance == 0) { drawNoteCount(beat, noteId); } FI; + return VOID; + } +}; diff --git a/engine/preview/holdNotes/HoldEnd.cpp b/engine/preview/holdNotes/HoldEnd.cpp new file mode 100644 index 0000000..57f02a8 --- /dev/null +++ b/engine/preview/holdNotes/HoldEnd.cpp @@ -0,0 +1,28 @@ +class SiriusHoldEnd: public Archetype { + public: + + static constexpr const char* name = "Sirius Hold End"; + + defineEntityData(beat); + defineEntityData(stBeat); + defineEntityData(lane); + defineEntityData(laneLength); + Variable enLane; + + SonolusApi preprocess() { + FUNCBEGIN + duration = Max(duration.get(), beat); + noteCount = noteCount + 1; + noteId = noteCount.get(); + enLane = lane + laneLength - 1; + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + IF (noteId % noteCountDistance == 0) { drawNoteCount(beat, noteId); } FI; + drawPreviewNormalNote(Sprites.HoldNote, beat, lane, enLane); + drawPreviewHoldEighth(Sprites.Hold, stBeat, beat, lane, enLane); + return VOID; + } +}; diff --git a/engine/preview/holdNotes/ScratchHoldEnd.cpp b/engine/preview/holdNotes/ScratchHoldEnd.cpp new file mode 100644 index 0000000..86c3551 --- /dev/null +++ b/engine/preview/holdNotes/ScratchHoldEnd.cpp @@ -0,0 +1,38 @@ +class SiriusScratchHoldEnd: public Archetype { + public: + + static constexpr const char* name = "Sirius Scratch Hold End"; + + defineEntityData(beat); + defineEntityData(stBeat); + defineEntityData(lane); + defineEntityData(laneLength); + defineEntityData(scratchLength) + Variable enLane; + Variable scratchLane; + Variable scratchEnLane; + + SonolusApi preprocess() { + FUNCBEGIN + duration = Max(duration.get(), beat); + noteCount = noteCount + 1; + noteId = noteCount.get(); + enLane = lane + laneLength - 1; + scratchLane = If(scratchLength >= 0, lane, enLane + scratchLength + 1); + scratchEnLane = If(scratchLength <= 0, enLane, lane + scratchLength - 1); + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + IF (noteId % noteCountDistance == 0) { drawNoteCount(beat, noteId); } FI; + drawPreviewNormalNote(Sprites.ScratchNote, beat, lane, enLane); + drawPreviewHoldEighth(Sprites.Scratch, stBeat, beat, lane, enLane); + IF (scratchLength > 0) { drawPreviewRightArrow(beat, scratchLane, scratchEnLane); } + ELSE { + IF (scratchLength < 0) { drawPreviewLeftArrow(beat, scratchLane, scratchEnLane); } + ELSE { drawPreviewArrow(beat, scratchLane, scratchEnLane); } FI + } FI + return VOID; + } +}; diff --git a/engine/preview/holdNotes/Sound.cpp b/engine/preview/holdNotes/Sound.cpp new file mode 100644 index 0000000..27b8d76 --- /dev/null +++ b/engine/preview/holdNotes/Sound.cpp @@ -0,0 +1,26 @@ +class SiriusSound: public Archetype { + public: + + static constexpr const char* name = "Sirius Sound"; + + defineEntityData(beat); + defineEntityData(lane); + defineEntityData(laneLength); + defineEntityData(holdType); + Variable enLane; + + SonolusApi preprocess() { + FUNCBEGIN + duration = Max(duration.get(), beat); + noteCount = noteCount + 1; + noteId = noteCount.get(); + return VOID; + } + + SonolusApi render() { + FUNCBEGIN + IF (noteId.get() % noteCountDistance == 0) { drawNoteCount(beat, noteId.get()); } FI + drawPreviewTick(SwitchWithDefault(holdType, {{100, Sprites.TouchTick}, {101, Sprites.TouchTick}, {110, Sprites.TouchScratchTick}, {111, Sprites.TouchScratchTick}}, Sprites.TouchTick), beat, lane, enLane); + return VOID; + } +}; diff --git a/engine/utils.cpp b/engine/utils.cpp index 2c945a9..8d126dc 100644 --- a/engine/utils.cpp +++ b/engine/utils.cpp @@ -79,6 +79,48 @@ Rect getFullHitbox(let l, let r) { }; } +pair getPos(let t) { + let id = Floor(t / stageTimeLength); + let less = t % stageTimeLength; + let x = screen.l + id * stageFullWidth + stageFullWidth / 2.0; + let y = Lerp(-1.0 + noteHeight / 2.0, 1.0 - noteHeight / 2, less / stageTimeLength); + return {x, y}; +} + +SonolusApi printNumber(let x, let y, let value, let format, let decimalPlaces, let color, int center = 0) { + FUNCBEGIN + let pivotX = 0, pivotY = 0.5, ha = playData::HorizontalAlign.Left; + if (center > 0) pivotX = 1, ha = playData::HorizontalAlign.Right; + else if (center == 0) pivotX = 0.5, ha = playData::HorizontalAlign.Center; + Print(value, format, decimalPlaces, x, y, pivotX, pivotY, screen.h / 10, screen.h / 20, 0, color, 1, ha, 0); + return VOID; +} + +SonolusApi drawStage(let id) { + FUNCBEGIN + let l = screen.l + id * stageFullWidth + (stageFullWidth - stageWidth) / 2; + let r = screen.l + (id + 1) * stageFullWidth - (stageFullWidth - stageWidth) / 2; + let t = stageHeight / 2; + let b = -1 * stageHeight / 2; + Draw(Sprites.Stage, l, b, l, t, r, t, r, b, 1, 1); + Draw(Sprites.StageBackground, l, b, l, t, r, t, r, b, 0, 0.3); + return VOID; +} + +SonolusApi drawTime(let t) { + FUNCBEGIN + let x = getPos(t).first, y = getPos(t).second; + printNumber(x - stageWidth / 2.0, y, t, PrintFormat.Time, -1, PrintColor.Neutral, 1); + return VOID; +} + +SonolusApi drawNoteCount(let t, let value) { + FUNCBEGIN + let x = getPos(t).first, y = getPos(t).second; + printNumber(x + stageWidth / 2.0, y, value, PrintFormat.Number, -1, PrintColor.Neutral, -1); + return VOID; +} + SonolusApi drawNormalNote(let sprite, let lane, let enLane, let beat) { FUNCBEGIN var p = ease((times.now - beat) / appearTime + 1); @@ -99,6 +141,16 @@ SonolusApi drawNormalNote(let sprite, let lane, let enLane, let beat) { return VOID; } +SonolusApi drawPreviewNormalNote(let sprite, let time, let st, let en) { + FUNCBEGIN + let x = getPos(time).first, y = getPos(time).second; + let len = stageWidth / 12.0; + let l = x + (st - 7) * len + adjustDistance, r = x + (en - 6) * len - adjustDistance; + let t = y + noteHeight / 2.0, b = y - noteHeight / 2.0; + Draw(sprite, l, b, l, t, r, t, r, b, 4, 1); + return VOID; +} + SonolusApi drawArrow(let lane, let enLane, let beat) { FUNCBEGIN var p = ease((times.now - beat) / appearTime + 1); @@ -133,6 +185,19 @@ SonolusApi drawArrow(let lane, let enLane, let beat) { return VOID; } +SonolusApi drawPreviewArrow(let time, let st, let en) { + FUNCBEGIN + let cx = getPos(time).first, b = getPos(time).second; + let len = stageWidth / 12.0, w = arrowWidth; + let l = cx - (7 - st) * len + adjustDistance, r = cx - (6 - en) * len - adjustDistance; + let t = b + arrowHeight, num = (r - l) / 2 * arrowPercent / arrowWidth; + FOR (i, 1, num, 1) { + Draw(Sprites.ScratchArrow, l + (i - 1) * w / 2, b, l + (i - 1) * w / 2, t, l + (i + 1) * w / 2, t, l + (i + 1) * w / 2, b, 1000, 1); + Draw(Sprites.ScratchArrow, r - (i - 1) * w / 2, b, r - (i - 1) * w / 2, t, r - (i + 1) * w / 2, t, r - (i + 1) * w / 2, b, 1000, 1); + } DONE + return VOID; +} + SonolusApi drawLeftArrow(let lane, let enLane, let beat) { FUNCBEGIN var p = ease((times.now - beat) / appearTime + 1); @@ -158,6 +223,18 @@ SonolusApi drawLeftArrow(let lane, let enLane, let beat) { return VOID; } +SonolusApi drawPreviewLeftArrow(let time, let st, let en) { + FUNCBEGIN + let cx = getPos(time).first, b = getPos(time).second; + let len = stageWidth / 12.0, w = arrowWidth; + let l = cx - (7 - st) * len + adjustDistance, r = cx - (6 - en) * len - adjustDistance; + let t = b + arrowHeight, num = (r - l) * arrowPercent / arrowWidth; + FOR (i, 1, num, 1) { + Draw(Sprites.ScratchArrow, l + (i - 1) * w / 2, b, l + (i - 1) * w / 2, t, l + (i + 1) * w / 2, t, l + (i + 1) * w / 2, b, 1000, 1); + } DONE + return VOID; +} + SonolusApi drawRightArrow(let lane, let enLane, let beat) { FUNCBEGIN var p = ease((times.now - beat) / appearTime + 1); @@ -183,6 +260,18 @@ SonolusApi drawRightArrow(let lane, let enLane, let beat) { return VOID; } +SonolusApi drawPreviewRightArrow(let time, let st, let en) { + FUNCBEGIN + let cx = getPos(time).first, b = getPos(time).second; + let len = stageWidth / 12.0, w = arrowWidth; + let l = cx - (7 - st) * len + adjustDistance, r = cx - (6 - en) * len - adjustDistance; + let t = b + arrowHeight, num = (r - l) * arrowPercent / arrowWidth; + FOR (i, 1, num, 1) { + Draw(Sprites.ScratchArrow, r - (i - 1) * w / 2, b, r - (i - 1) * w / 2, t, r - (i + 1) * w / 2, t, r - (i + 1) * w / 2, b, 1000, 1); + } DONE + return VOID; +} + SonolusApi drawHoldEighth(let sprite, let lane, let enLane, let stBeat, let enBeat, let isHolding) { FUNCBEGIN auto line1 = lines[lane], line2 = lines[enLane]; @@ -207,6 +296,19 @@ SonolusApi drawHoldEighth(let sprite, let lane, let enLane, let stBeat, let enBe return VOID; } +SonolusApi drawPreviewHoldEighth(let sprite, let stt, let ent, let st, let en) { + FUNCBEGIN + let id1 = Floor(stt / stageTimeLength), id2 = Floor(ent / stageTimeLength); + FOR (i, id1, id2 + 1, 1) { + let b = If(stt > i * stageTimeLength, getPos(stt).second, -1 * stageHeight / 2.0), + t = If(ent < (i + 1) * stageTimeLength, getPos(ent).second, stageHeight / 2.0); + let c = getPos(i * stageTimeLength).first, len = stageWidth / 12.0; + let l = c + (st - 7) * len + adjustDistance, r = c + (en - 6) * len - adjustDistance; + Draw(sprite, l, b, l, t, r, t, r, b, 2, 1); + } DONE + return VOID; +} + SonolusApi drawTick(let sprite, let beat, let lane, let enLane) { FUNCBEGIN var p = ease((times.now - beat) / appearTime + 1); @@ -226,6 +328,17 @@ SonolusApi drawTick(let sprite, let beat, let lane, let enLane) { return VOID; } +SonolusApi drawPreviewTick(let sprite, let time, let st, let en) { + FUNCBEGIN + let x = getPos(time).first, cy = getPos(time).second; + let len = stageWidth / 12.0; + let cx = x - (6.5 - (st + en) / 2.0) * len; + let l = cx - tickWidth / 2.0, r = cx + tickWidth / 2.0; + let t = cy + tickHeight / 2.0, b = cy - tickHeight / 2.0; + Draw(sprite, l, b, l, t, r, t, r, b, 4, 1); + return VOID; +} + SonolusApi drawSyncLine(let beat, let lane, let enLane) { FUNCBEGIN var p = ease((times.now - beat) / appearTime + 1); @@ -246,6 +359,16 @@ SonolusApi drawSyncLine(let beat, let lane, let enLane) { return VOID; } +SonolusApi drawPreviewSyncLine(let time, let st, let en) { + FUNCBEGIN + let cx = getPos(time).first, y = getPos(time).second; + let len = stageWidth / 12.0; + let l = cx - (6.5 - st) * len, r = cx - (6.5 - en) * len; + let t = y + syncLineHeight / 2.0, b = y - syncLineHeight / 2.0; + Draw(Sprites.SyncLine, l, b, l, t, r, t, r, b, 3, 1); + return VOID; +} + SonolusApi drawHiddenLine() { FUNCBEGIN let sprite = Sprites.HiddenLine, lane = 1, enLane = 12, beat = times.now + (1 - hidden) * appearTime; @@ -317,11 +440,11 @@ SonolusApi updateHoldEffect(let effectInstanceId, let lane, let enLane) { SonolusApi SpawnSubJudgeText(let sprite) { FUNCBEGIN - IF (currentJudgeStartTime.get() == times.now) { - currentJudge.set(Max(currentJudge.get(), sprite)); + IF (currentJudgeStartTime == times.now) { + currentJudge = Max(currentJudge, sprite); } ELSE { - currentJudge.set(sprite); - currentJudgeStartTime.set(times.now); + currentJudge = sprite; + currentJudgeStartTime = times.now; } FI return VOID; } @@ -343,6 +466,20 @@ SonolusApi drawLine(let id, let st, let en, let a, let sprite) { return VAR; } +SonolusApi drawPreviewLine(let id, let st, let en, let sprite) { + FUNCBEGIN + let id1 = Floor(st / stageTimeLength), id2 = Floor(en / stageTimeLength); + FOR (i, id1, id2 + 1, 1) { + let width = adjustDistance * 2; + let b = If(st > i * stageTimeLength, getPos(st).second, -1 * stageHeight / 2.0), + t = If(en < (i + 1) * stageTimeLength, getPos(en).second, stageHeight / 2.0); + let c = getPos(i * stageTimeLength).first - (6 - id) * stageWidth / 12.0; + let l = c - width, r = c + width; + Draw(sprite, l, b, l, t, r, t, r, b, 1000, 1); + } DONE + return VAR; +} + SonolusApi drawEndLine(let st, let en, let a, let sprite) { FUNCBEGIN let w = lines[12].getWidth(1); @@ -389,6 +526,36 @@ SonolusApi drawSplitLine(let split) { return VOID; } +SonolusApi drawPreviewSplitLine(let st, let en, let extra, let split) { + FUNCBEGIN + drawPreviewLine(0, st, en, splitLineMemory[0] + extra), + drawPreviewLine(12, st, en, splitLineMemory[split] + extra), + Run(Switch(split, { + {1, {}}, + {2, drawPreviewLine(6, st, en, splitLineMemory[1] + extra)}, + {3, { + drawPreviewLine(4, st, en, splitLineMemory[1] + extra), + drawPreviewLine(8, st, en, splitLineMemory[2] + extra) + }}, {4, { + drawPreviewLine(3, st, en, splitLineMemory[1] + extra), + drawPreviewLine(6, st, en, splitLineMemory[2] + extra), + drawPreviewLine(9, st, en, splitLineMemory[3] + extra) + }}, {5, { + drawPreviewLine(3, st, en, splitLineMemory[1] + extra), + drawPreviewLine(5, st, en, splitLineMemory[2] + extra), + drawPreviewLine(7, st, en, splitLineMemory[3] + extra), + drawPreviewLine(9, st, en, splitLineMemory[4] + extra) + }}, {6, { + drawPreviewLine(2, st, en, splitLineMemory[1] + extra), + drawPreviewLine(4, st, en, splitLineMemory[2] + extra), + drawPreviewLine(6, st, en, splitLineMemory[3] + extra), + drawPreviewLine(8, st, en, splitLineMemory[4] + extra), + drawPreviewLine(10, st, en, splitLineMemory[5] + extra) + }} + })); + return VOID; +} + SonolusApi drawDisappearLine(let t, let split) { FUNCBEGIN let p = 1; diff --git a/functions/functions.h b/functions/functions.h index c285451..a388b95 100755 --- a/functions/functions.h +++ b/functions/functions.h @@ -357,8 +357,8 @@ FuncNode Power(vector value) { return FuncNode(RuntimeFunction.Power, value); } -FuncNode Print(FuncNode value, FuncNode format, FuncNode decimalPlaces, FuncNode anchorX, FuncNode anchorY, FuncNode pivotX, FuncNode pivotY, FuncNode width, FuncNode height, FuncNode rotation, FuncNode color, FuncNode alpha, FuncNode horizontalAlign, FuncNode background) { - return FuncNode(RuntimeFunction.Print, {value, format, decimalPlaces, anchorX, anchorY, pivotX, pivotY, width, height, rotation, color, alpha, horizontalAlign, background}); +void Print(FuncNode value, FuncNode format, FuncNode decimalPlaces, FuncNode anchorX, FuncNode anchorY, FuncNode pivotX, FuncNode pivotY, FuncNode width, FuncNode height, FuncNode rotation, FuncNode color, FuncNode alpha, FuncNode horizontalAlign, FuncNode background) { + R(FuncNode(RuntimeFunction.Print, {value, format, decimalPlaces, anchorX, anchorY, pivotX, pivotY, width, height, rotation, color, alpha, horizontalAlign, background})); } FuncNode Radian(FuncNode value) { diff --git a/items/PreviewData.h b/items/PreviewData.h index c972280..88513aa 100644 --- a/items/PreviewData.h +++ b/items/PreviewData.h @@ -17,21 +17,21 @@ namespace previewData { const int RuntimeUIId = 1003; const int RuntimeUIConfigurationId = 1004; - Pointer RuntimeEnvironment; - Pointer RuntimeCanvas; - Pointer RuntimeSkinTransform; - Pointer RuntimeUI; - Pointer RuntimeUIConfiguration; - Pointer PreviewData; - Pointer PreviewOption; - Pointer EngineRom; - Pointer EntityDataArray; - Pointer EntityData; - Pointer EntitySharedMemoryArray; - Pointer EntitySharedMemory; - Pointer EntityInfoArray; - Pointer EntityInfo; - Pointer TemporaryMemory; + BlockPointer RuntimeEnvironment; + BlockPointer RuntimeCanvas; + BlockPointer RuntimeSkinTransform; + BlockPointer RuntimeUI; + BlockPointer RuntimeUIConfiguration; + BlockPointer PreviewData; + BlockPointer PreviewOption; + BlockPointer EngineRom; + BlockArray EntityDataArray(32); + BlockPointer EntityData; + BlockArray EntitySharedMemoryArray(32); + BlockPointer EntitySharedMemory; + BlockArray EntityInfoArray(2); + BlockPointer EntityInfo; + BlockPointer TemporaryMemory; class screen { public: @@ -51,11 +51,11 @@ namespace previewData { FuncNode scroll = RuntimeCanvas.get(0); FuncNode size = RuntimeCanvas.get(1); - FuncNode set(FuncNode scroll, FuncNode size) { - return Execute({ - RuntimeCanvas.set(0, scroll), - RuntimeCanvas.set(1, size), - }); + SonolusApi set(FuncNode scroll, FuncNode size) { + FUNCBEGIN + RuntimeCanvas.set(0, scroll); + RuntimeCanvas.set(1, size); + return VOID; } }canvas; @@ -80,18 +80,18 @@ namespace previewData { FuncNode background = RuntimeUI.get(Add({Multiply({offset, 9}), 8})); - FuncNode set(FuncNode anchorX, FuncNode anchorY, FuncNode pivotX, FuncNode pivotY, FuncNode width, FuncNode height, FuncNode rotation, FuncNode alpha, FuncNode background) { - return Execute({ - RuntimeUI.set(Add({Multiply({offset, 9}), 0}), anchorX), - RuntimeUI.set(Add({Multiply({offset, 9}), 1}), anchorY), - RuntimeUI.set(Add({Multiply({offset, 9}), 2}), pivotX), - RuntimeUI.set(Add({Multiply({offset, 9}), 3}), pivotY), - RuntimeUI.set(Add({Multiply({offset, 9}), 4}), width), - RuntimeUI.set(Add({Multiply({offset, 9}), 5}), height), - RuntimeUI.set(Add({Multiply({offset, 9}), 6}), rotation), - RuntimeUI.set(Add({Multiply({offset, 9}), 7}), alpha), - RuntimeUI.set(Add({Multiply({offset, 9}), 8}), background), - }); + SonolusApi set(FuncNode anchorX, FuncNode anchorY, FuncNode pivotX, FuncNode pivotY, FuncNode width, FuncNode height, FuncNode rotation, FuncNode alpha, FuncNode background) { + FUNCBEGIN + RuntimeUI.set(Add({Multiply({offset, 9}), 0}), anchorX); + RuntimeUI.set(Add({Multiply({offset, 9}), 1}), anchorY); + RuntimeUI.set(Add({Multiply({offset, 9}), 2}), pivotX); + RuntimeUI.set(Add({Multiply({offset, 9}), 3}), pivotY); + RuntimeUI.set(Add({Multiply({offset, 9}), 4}), width); + RuntimeUI.set(Add({Multiply({offset, 9}), 5}), height); + RuntimeUI.set(Add({Multiply({offset, 9}), 6}), rotation); + RuntimeUI.set(Add({Multiply({offset, 9}), 7}), alpha); + RuntimeUI.set(Add({Multiply({offset, 9}), 8}), background); + return VOID; } }; @@ -113,91 +113,98 @@ namespace previewData { configuration progressConfiguration = configuration(1); }ui; - int allocatorSize[10001] = {0}; - - template - class Variable { - public: - - int offset; - Variable(){ - offset = allocatorSize[identifierId]++; - } - - FuncNode get() { - return Get(identifierId, offset); - } - FuncNode add(FuncNode value) { - return Set(identifierId, offset, Add({Get(identifierId, offset), value})); - } - FuncNode subtract(FuncNode value) { - return Set(identifierId, offset, Subtract({Get(identifierId, offset), value})); - } - FuncNode multiply(FuncNode value) { - return Set(identifierId, offset, Multiply({Get(identifierId, offset), value})); - } - FuncNode divide(FuncNode value) { - return Set(identifierId, offset, Divide({Get(identifierId, offset), value})); - } - FuncNode mod(FuncNode value) { - return Set(identifierId, offset, Mod({Get(identifierId, offset), value})); - } - FuncNode set(FuncNode value) { - return Set(identifierId, offset, value); - } - }; - - Variable ForPt[MaxForSize]; - - template - class Array { +// int allocatorSize[10001] = {0}; +// +// template +// class Variable { +// public: +// +// int offset; +// Variable(){ +// offset = allocatorSize[identifierId]++; +// } +// +// FuncNode get() { +// return Get(identifierId, offset); +// } +// FuncNode add(FuncNode value) { +// return Set(identifierId, offset, Add({Get(identifierId, offset), value})); +// } +// FuncNode subtract(FuncNode value) { +// return Set(identifierId, offset, Subtract({Get(identifierId, offset), value})); +// } +// FuncNode multiply(FuncNode value) { +// return Set(identifierId, offset, Multiply({Get(identifierId, offset), value})); +// } +// FuncNode divide(FuncNode value) { +// return Set(identifierId, offset, Divide({Get(identifierId, offset), value})); +// } +// FuncNode mod(FuncNode value) { +// return Set(identifierId, offset, Mod({Get(identifierId, offset), value})); +// } +// FuncNode set(FuncNode value) { +// return Set(identifierId, offset, value); +// } +// }; +// +// Variable ForPt[MaxForSize]; +// +// template +// class Array { +// public: +// +// int offset; +// int capacity; +// FuncNode size = Get(identifierId, 0); +// int sizeOffset = 0; +// +// Array(){} +// Array(int capacity):capacity(capacity){ +// sizeOffset = allocatorSize[identifierId]; +// size = Get(identifierId, sizeOffset); +// offset = allocatorSize[identifierId] + 1; +// allocatorSize[identifierId] += capacity + 1; +// }; +// FuncNode operator [] (FuncNode id) { +// return Get(identifierId, Add({id, offset})); +// } +// FuncNode add(FuncNode value) { +// return Execute({ +// Set(identifierId, Add({size, offset}), value), +// Set(identifierId, sizeOffset, Add({size, 1})), +// }); +// } +// FuncNode has(FuncNode value) { +// FuncNode res = false; +// for (int i = capacity - 1; i >= 0; i--) { +// res = If( +// Equal(Get(identifierId, Add({i, offset})), value), +// true, +// res +// ); +// } return res; +// } +// FuncNode indexOf(FuncNode value) { +// FuncNode res = -1; +// for (int i = capacity - 1; i >= 0; i--) { +// res = If( +// Equal(Get(identifierId, Add({i, offset})), value), +// i, +// res +// ); +// } return res; +// } +// FuncNode clear() { +// vector args = {Set(identifierId, sizeOffset, 0)}; +// for (int i = 0; i < capacity; i++) args.push_back(Set(identifierId, Add({i, offset}), 0)); +// return Execute(args); +// } +// }; + class times { public: - int offset; - int capacity; - FuncNode size = Get(identifierId, 0); - int sizeOffset = 0; - - Array(){} - Array(int capacity):capacity(capacity){ - sizeOffset = allocatorSize[identifierId]; - size = Get(identifierId, sizeOffset); - offset = allocatorSize[identifierId] + 1; - allocatorSize[identifierId] += capacity + 1; - }; - FuncNode operator [] (FuncNode id) { - return Get(identifierId, Add({id, offset})); - } - FuncNode add(FuncNode value) { - return Execute({ - Set(identifierId, Add({size, offset}), value), - Set(identifierId, sizeOffset, Add({size, 1})), - }); - } - FuncNode has(FuncNode value) { - FuncNode res = false; - for (int i = capacity - 1; i >= 0; i--) { - res = If( - Equal(Get(identifierId, Add({i, offset})), value), - true, - res - ); - } return res; - } - FuncNode indexOf(FuncNode value) { - FuncNode res = -1; - for (int i = capacity - 1; i >= 0; i--) { - res = If( - Equal(Get(identifierId, Add({i, offset})), value), - i, - res - ); - } return res; - } - FuncNode clear() { - vector args = {Set(identifierId, sizeOffset, 0)}; - for (int i = 0; i < capacity; i++) args.push_back(Set(identifierId, Add({i, offset}), 0)); - return Execute(args); - } - }; + FuncNode now = 0; + FuncNode delta = 0; + FuncNode scaled = 0; + }times; }; diff --git a/main b/main index 726d76a..b9c140e 100755 Binary files a/main and b/main differ diff --git a/main.cpp b/main.cpp index 825a421..11b3f96 100755 --- a/main.cpp +++ b/main.cpp @@ -121,30 +121,30 @@ int main(int argc, char** argv) { // for (int i = 0; i < configuration.size(); i++) fout << configuration.v[i]; // fout.close(); fout.open((dist + "/EngineTutorialData")); // for (int i = 0; i < data.size(); i++) fout << data.v[i]; -// #elif preview -// buffer data, configuration; -// build< -// // Replace with your archetypes here -// Initialization, -// Stage, -// SiriusNormalNote, -// SiriusCriticalNote, -// SiriusFlickNote, -// SiriusHoldStart, -// SiriusHoldEighth, -// SiriusCriticalHoldStart, -// SiriusScratchHoldStart, -// SiriusCriticalScratchHoldStart, -// SiriusHoldEnd, -// SiriusScratchHoldEnd, -// SiriusSound, -// SiriusSyncLine, -// SplitLine -// >(configuration, data); -// ofstream fout((dist + "/EngineConfiguration")); -// for (int i = 0; i < configuration.size(); i++) fout << configuration.v[i]; -// fout.close(); fout.open((dist + "/EnginePreviewData")); -// for (int i = 0; i < data.size(); i++) fout << data.v[i]; +#elif preview + buffer data, configuration; + build< + // Replace with your archetypes here + Initialization, + Stage, + NormalNote, + CriticalNote, + FlickNote, + SiriusHoldStart, + SiriusHoldEighth, + SiriusCriticalHoldStart, + SiriusScratchHoldStart, + SiriusCriticalScratchHoldStart, + SiriusHoldEnd, + SiriusScratchHoldEnd, + SiriusSound, + SyncLine, + SplitLine + >(configuration, data); + ofstream fout((dist + "/EngineConfiguration")); + for (int i = 0; i < configuration.size(); i++) fout << configuration.v[i]; + fout.close(); fout.open((dist + "/EnginePreviewData")); + for (int i = 0; i < data.size(); i++) fout << data.v[i]; #elif watch buffer data, configuration; build< diff --git a/modules/error.h b/modules/error.h index b92d30a..0e3de39 100755 --- a/modules/error.h +++ b/modules/error.h @@ -1,8 +1,12 @@ -// #include +#if !DISABLE_TRACE +#include +#endif using namespace std; void DumpTraceback() { - // cpptrace::generate_trace().print(); +#if !DISABLE_TRACE + cpptrace::generate_trace().print(); +#endif } void throwWarning(string text) { diff --git a/run.sh b/run.sh index ef3702f..9230092 100644 --- a/run.sh +++ b/run.sh @@ -16,7 +16,7 @@ sqlite3 sonolus.db ".read ./data.sql" # ./sonolus import ../sirius/sirius.srp ./sonolus buildcpp play ../sirius # ./sonolus buildcpp tutorial ../sirius -# ./sonolus buildcpp preview ../sirius +./sonolus buildcpp preview ../sirius ./sonolus buildcpp watch ../sirius # sqlite3 sonolus.db "SELECT * FROM Engine"; diff --git a/sonolus.h b/sonolus.h index 66b1723..0e1aa36 100755 --- a/sonolus.h +++ b/sonolus.h @@ -191,7 +191,8 @@ void buildArchetype() { EnginePreviewDataArchetype newArchetype; cout << "Solving Archetype \"" << archetype.name << "\"..." << endl; newArchetype.name = archetype.name; - compileCallbackHead(preprocess); + if (!T::disableGlobalPreprocess) { compileCallbackHead(preprocess); } + else { compileCallback(preprocess); } compileCallback(render); newArchetype.data = archetype.data; enginePreviewData.archetypes.push_back(newArchetype); @@ -236,6 +237,7 @@ void allocateArchetypeId() { template void build(buffer& configurationBuffer, buffer& dataBuffer) { + Run(1 + 1 == 2); // 防止空函数爆炸 preloadElement = nodesContainer.top(); mergeNodeContainer(); createAllocatorBackup(); Json::Value configuration = engineConfiguration.toJsonObject(); @@ -309,7 +311,7 @@ void build(buffer& configurationBuffer, buffer& dataBuffer) { #include"blocks/Map.h" #include"items/PlayData.h" // #include"items/TutorialData.h" -// #include"items/PreviewData.h" +#include"items/PreviewData.h" #include"items/WatchData.h" #include"items/SkinData.h" #include"items/EffectData.h"