Skip to content

Commit

Permalink
Merge pull request #17 from SonolusHaniwa/develop
Browse files Browse the repository at this point in the history
Release Watch Mode
  • Loading branch information
LittleYang0531 authored Jan 12, 2024
2 parents 0e2e330 + 919e7b2 commit 2370dcb
Show file tree
Hide file tree
Showing 52 changed files with 1,020 additions and 376 deletions.
32 changes: 24 additions & 8 deletions blocks/Archetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using namespace std;
class Archetype {
public:

static const bool disableGlobalPreprocess = false;
static constexpr const char* name = "Default Archetype";
bool hasInput = false;

Expand Down Expand Up @@ -86,42 +87,57 @@ class Archetype {
class Archetype {
public:

string name = "Default Archtype";
static const bool disableGlobalPreprocess = false;
static constexpr const char* name = "Default Archtype";
bool hasInput = false;

int preprocessOrder = 0;
SonolusApi preprocess() {
return { Return(0) };
FUNCBEGIN
Return(0);
return VOID;
}

int spawnTimeOrder = 0;
SonolusApi spawnTime() {
return { Return(0) };
FUNCBEGIN
Return(0);
return VOID;
}

int despawnTimeOrder = 0;
SonolusApi despawnTime() {
return { Return(0) };
FUNCBEGIN
Return(0);
return VOID;
}

int initializeOrder = 0;
SonolusApi initialize() {
return { Return(0) };
FUNCBEGIN
Return(0);
return VOID;
}

int updateSequentialOrder = 0;
SonolusApi updateSequential() {
return { Return(0) };
FUNCBEGIN
Return(0);
return VOID;
}

int updateParallelOrder = 0;
SonolusApi updateParallel() {
return { Return(0) };
FUNCBEGIN
Return(0);
return VOID;
}

int terminateOrder = 0;
SonolusApi terminate() {
return { Return(0) };
FUNCBEGIN
Return(0);
return VOID;
}

vector<pair<string, int> > data;
Expand Down
12 changes: 7 additions & 5 deletions blocks/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ class Variable {
offset = allocatorSize[identifierId]++;
R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val}));
}
Variable(const Variable<identifierId>& val) {
offset = allocatorSize[identifierId]++;
R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val.get()}));
}
// Variable(const Variable<identifierId>& val) {
// offset = allocatorSize[identifierId]++;
// cout << identifierId << " " << offset << endl;
// R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val.get()}));
// }
template<int T> Variable(Variable<T> val) {
offset = allocatorSize[identifierId]++;
// cout << T << " " << val.offset << " " << allocatorSize[T] << endl;
offset = allocatorSize[identifierId]++;
R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val.get()}));
}
Variable(FuncNode val) {
Expand Down
Binary file modified dist/EngineData
Binary file not shown.
Binary file modified dist/EngineWatchData
Binary file not shown.
Binary file modified dist/SkinData
Binary file not shown.
Binary file modified dist/SkinTexture
Binary file not shown.
2 changes: 1 addition & 1 deletion emake
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ emcc emscripten.cpp -o libsirius.js -s MODULARIZE -sALLOW_MEMORY_GROWTH -s EXPOR
-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$stringToNewUTF8','$UTF8ToString']\
-sEXPORTED_RUNTIME_METHODS=['stringToNewUTF8','UTF8ToString']\
-fwasm-exceptions -sASSERTIONS\
-L./lib -ljsoncpp -O3
-L./lib -ljsoncpp -g -O3
32 changes: 26 additions & 6 deletions engine/data/constants.cpp → engine/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,35 @@ double judgeBadRatio = 163.0 / 76.0; // 判定文字 Bad 比例
double judgeMissRatio = 177.0 / 76.0; // 判定文字 Miss 比例
double judgeAutoRatio = 216.0 / 76.0; // 判定文字 Auto 比例
double judgeTextHeight = 0.15; // 判定文字高度
double judgeTextDuration = 0.2; // 判定文字动画时长
double judgeTextDuration = 0.2; // 判定文字动画时长

#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
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);
#endif

class stage {
public:

Variable<EntityMemoryId> w = If(LevelOption.get(Options.LockAspectRatio) == 0 || screen.aspectRatio < targetAspectRatio,
screen.w * LevelOption.get(Options.ExtraWidth),
Variable<EntityMemoryId> w = If(lockAspectRatio == 0 || screen.aspectRatio < targetAspectRatio,
screen.w * extraWidth,
screen.h * targetAspectRatio);
Variable<EntityMemoryId> h = If(LevelOption.get(Options.LockAspectRatio) == 0 || screen.aspectRatio > targetAspectRatio,
Variable<EntityMemoryId> h = If(lockAspectRatio == 0 || screen.aspectRatio > targetAspectRatio,
screen.h,
screen.w / targetAspectRatio);
Variable<EntityMemoryId> l = -1 * w / 2;
Expand All @@ -63,11 +83,11 @@ class judgline {
let rtY = ltY;
}judgline;

let appearTime = (7.4 / LevelOption.get(Options.NoteSpeed));
let appearTime = (7.4 / speed);
let noteSpeed = stage.h / appearTime;

let t = If(
LevelOption.get(Options.LockAspectRatio) && screen.aspectRatio < targetAspectRatio,
lockAspectRatio && screen.aspectRatio < targetAspectRatio,
screen.w / targetAspectRatio * 0.5,
screen.t
);
Expand Down
154 changes: 78 additions & 76 deletions engine/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,96 +4,98 @@ const string Scope = "sirius";

#include"configuration/options.cpp"
#include"configuration/ui.cpp"

#ifdef play
using namespace playData;
#elif tutorial
using namespace tutorialData;
#elif preview
using namespace previewData;
#elif watch
using namespace watchData;
#endif

#include"skins.cpp"
#include"effects.cpp"
#include"particles.cpp"
// #include"data/buckets.cpp"
#include"data/constants.cpp"
#include"data/types.cpp"
#include"data/utils.cpp"
#include"constants.cpp"
#include"types.cpp"
#include"utils.cpp"
#include"getSplitLine.cpp"
#include"data/archetypes/Initialization.cpp"
#include"data/archetypes/InputManager.cpp"
#include"data/archetypes/Stage.cpp"
#include"data/archetypes/flatNotes/FlatNote.cpp"
#include"data/archetypes/flatNotes/NormalNote.cpp"
#include"data/archetypes/flatNotes/CriticalNote.cpp"
#include"data/archetypes/flatNotes/HoldStart.cpp"
#include"data/archetypes/flatNotes/CriticalHoldStart.cpp"
#include"data/archetypes/flatNotes/ScratchHoldStart.cpp"
#include"data/archetypes/flatNotes/CriticalScratchHoldStart.cpp"
#include"data/archetypes/FlickNote.cpp"
#include"data/archetypes/holdNotes/Sound.cpp"
#include"data/archetypes/holdNotes/HoldEighth.cpp"
#include"data/archetypes/holdNotes/HoldEnd.cpp"
#include"data/archetypes/holdNotes/ScratchHoldEnd.cpp"
#include"data/archetypes/SyncLine.cpp"
#include"data/archetypes/SplitLine.cpp"

#ifdef play
#include"play/Initialization.cpp"
#include"play/InputManager.cpp"
#include"play/Stage.cpp"
#include"play/flatNotes/FlatNote.cpp"
#include"play/flatNotes/NormalNote.cpp"
#include"play/flatNotes/CriticalNote.cpp"
#include"play/flatNotes/HoldStart.cpp"
#include"play/flatNotes/CriticalHoldStart.cpp"
#include"play/flatNotes/ScratchHoldStart.cpp"
#include"play/flatNotes/CriticalScratchHoldStart.cpp"
#include"play/FlickNote.cpp"
#include"play/holdNotes/Sound.cpp"
#include"play/holdNotes/HoldEighth.cpp"
#include"play/holdNotes/HoldEnd.cpp"
#include"play/holdNotes/ScratchHoldEnd.cpp"
#include"play/SyncLine.cpp"
#include"play/SplitLine.cpp"
#elif tutorial
using namespace tutorialData;
#include"skins.cpp"
#include"effects.cpp"
#include"particles.cpp"
#include"tutorialData/instructionTexts.cpp"
#include"tutorialData/instructionIcons.cpp"
#include"tutorialData/constants.cpp"
#include"tutorialData/utils.cpp"
#include"tutorial/instructionTexts.cpp"
#include"tutorial/instructionIcons.cpp"
#include"tutorial/constants.cpp"
#include"tutorial/utils.cpp"
#include"getSplitLine.cpp"
#include"tutorialData/components/Note.cpp"
#include"tutorialData/components/Flick.cpp"
#include"tutorialData/components/Hold.cpp"
#include"tutorialData/components/Scratch.cpp"
#include"tutorialData/components/JumpScratch.cpp"
#include"tutorialData/preprocess.cpp"
#include"tutorialData/navigate.cpp"
#include"tutorialData/update.cpp"
#include"tutorial/components/Note.cpp"
#include"tutorial/components/Flick.cpp"
#include"tutorial/components/Hold.cpp"
#include"tutorial/components/Scratch.cpp"
#include"tutorial/components/JumpScratch.cpp"
#include"tutorial/preprocess.cpp"
#include"tutorial/navigate.cpp"
#include"tutorial/update.cpp"
#elif preview
using namespace previewData;
#include"skins.cpp"
#include"previewData/constants.cpp"
#include"previewData/utils.cpp"
#include"preview/constants.cpp"
#include"preview/utils.cpp"
#include"getSplitLine.cpp"
#include"previewData/archetype/Initialization.cpp"
#include"previewData/archetype/Stage.cpp"
#include"previewData/archetype/NormalNote.cpp"
#include"previewData/archetype/CriticalNote.cpp"
#include"previewData/archetype/FlickNote.cpp"
#include"previewData/archetype/HoldStart.cpp"
#include"previewData/archetype/HoldEighth.cpp"
#include"previewData/archetype/CriticalHoldStart.cpp"
#include"previewData/archetype/ScratchHoldStart.cpp"
#include"previewData/archetype/CriticalScratchHoldStart.cpp"
#include"previewData/archetype/HoldEnd.cpp"
#include"previewData/archetype/ScratchHoldEnd.cpp"
#include"previewData/archetype/Sound.cpp"
#include"previewData/archetype/SyncLine.cpp"
#include"previewData/archetype/SplitLine.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"
#elif watch
using namespace watchData;
#include"skins.cpp"
#include"effects.cpp"
#include"particles.cpp"
#include"watchData/updateSpawn.cpp"
#include"watchData/constants.cpp"
#include"watchData/utils.cpp"
#include"getSplitLine.cpp"
#include"watchData/archetype/Initialization.cpp"
#include"watchData/archetype/Stage.cpp"
#include"watchData/archetype/notes/flatNotes/FlatNote.cpp"
#include"watchData/archetype/notes/flatNotes/NormalNote.cpp"
#include"watchData/archetype/notes/flatNotes/CriticalNote.cpp"
#include"watchData/archetype/notes/flatNotes/FlickNote.cpp"
#include"watchData/archetype/notes/flatNotes/HoldStart.cpp"
#include"watchData/archetype/notes/flatNotes/CriticalHoldStart.cpp"
#include"watchData/archetype/notes/flatNotes/ScratchHoldStart.cpp"
#include"watchData/archetype/notes/flatNotes/CriticalScratchHoldStart.cpp"
#include"watchData/archetype/notes/holdTickNotes/HoldTickNote.cpp"
#include"watchData/archetype/notes/holdTickNotes/HoldEnd.cpp"
#include"watchData/archetype/notes/holdTickNotes/ScratchHoldEnd.cpp"
#include"watchData/archetype/notes/holdTickNotes/HoldEighth.cpp"
#include"watchData/archetype/notes/holdTickNotes/Sound.cpp"
#include"watchData/archetype/SyncLine.cpp"
#include"watchData/archetype/SplitLine.cpp"
#include"watch/updateSpawn.cpp"
#include"watch/Initialization.cpp"
#include"watch/Stage.cpp"
#include"watch/UpdateJudgment.cpp"
#include"watch/flatNotes/FlatNote.cpp"
#include"watch/flatNotes/NormalNote.cpp"
#include"watch/flatNotes/CriticalNote.cpp"
#include"watch/flatNotes/HoldStart.cpp"
#include"watch/flatNotes/CriticalHoldStart.cpp"
#include"watch/flatNotes/ScratchHoldStart.cpp"
#include"watch/flatNotes/CriticalScratchHoldStart.cpp"
#include"watch/FlickNote.cpp"
#include"watch/holdNotes/HoldEnd.cpp"
#include"watch/holdNotes/ScratchHoldEnd.cpp"
#include"watch/holdNotes/HoldEighth.cpp"
#include"watch/holdNotes/Sound.cpp"
#include"watch/SyncLine.cpp"
#include"watch/SplitLine.cpp"
#endif
8 changes: 5 additions & 3 deletions engine/getSplitLine.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using namespace std;

let getSplitLine(let id) {
return Switch(id, {
SonolusApi getSplitLine(let id) {
FUNCBEGIN
Run(Switch(id, {
{1, setSplitLine({Sprites.SplitLine_1})},
{2, setSplitLine({Sprites.SplitLine_2})},
{3, setSplitLine({Sprites.SplitLine_3})},
Expand Down Expand Up @@ -97,5 +98,6 @@ let getSplitLine(let id) {
{10560, setSplitLine({Sprites.SplitLine_10560})},
{10570, setSplitLine({Sprites.SplitLine_10570})},
{10580, setSplitLine({Sprites.SplitLine_10580})},
});
}));
return VOID;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FlickNote : public Archetype {

SonolusApi preprocess() {
FUNCBEGIN
IF (LevelOption.get(Options.Mirror)) lane = 14 - lane - laneLength; FI
IF (mirror) lane = 14 - lane - laneLength; FI
enLane = lane + laneLength - 1;
inputTimeMin = beat - judgment.bad + RuntimeEnvironment.get(3);
inputTimeMax = beat + judgment.bad + RuntimeEnvironment.get(3);
Expand Down
Loading

0 comments on commit 2370dcb

Please sign in to comment.