Skip to content

Commit

Permalink
Merge pull request #13 from SonolusHaniwa/develop
Browse files Browse the repository at this point in the history
Fixed Mirror Option & Input Manager
  • Loading branch information
LittleYang0531 authored Jan 6, 2024
2 parents 9db6a1f + 98af278 commit 02274ce
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 22 deletions.
8 changes: 4 additions & 4 deletions blocks/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Array {
T operator [] (FuncNode id) {
return get(id);
}
bool outputed = false;
// bool outputed = false;
SonolusApi indexOf(T obj, let en) { // 时间复杂度 O(capacity * classSize)
FUNCBEGIN
// FOR (i, 0, Min(capacity, en), 1) { // 暂时禁用 en 选项
FOR (i, 0, capacity, 1) {
if (!outputed) cout << get(i) << endl << obj << endl, outputed = true;
FOR (i, 0, Min(capacity, en), 1) {
// FOR (i, 0, capacity, 1) { // 暂时禁用 en 选项
// if (!outputed) cout << get(i) << endl << obj << endl, outputed = true;
IF (get(i) == obj) Return(i); FI
} DONE
Return(-1);
Expand Down
10 changes: 6 additions & 4 deletions blocks/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ class Variable {
R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val.get()}));
}

Variable<identifierId> operator = (Variable<identifierId> val) { set(val); return *this; }
// Variable<identifierId> operator = (FuncNode val) { set(val); return *this; }
template<typename T>
Variable<identifierId> operator = (T val) { set(val); return *this; };
// template<int T>
// Variable<identifierId> operator = (Variable<T> val) { set(val); return *this; }
Variable<identifierId> operator = (double val) { set(val); return Variable<identifierId>(offset, true); }
Variable<identifierId> operator = (FuncNode val) { set(val); return Variable<identifierId>(offset, true); }
// template<typename T>
// Variable<identifierId> operator = (T val) { set(val); return *this; };

operator FuncNode() {
return get();
Expand Down
Binary file modified dist/EngineData
Binary file not shown.
7 changes: 2 additions & 5 deletions engine/data/archetypes/FlickNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class FlickNote : public Archetype {
Variable<EntityMemoryId> enLane;
Variable<EntityMemoryId> inputTimeMin;
Variable<EntityMemoryId> inputTimeMax;
Variable<EntityMemoryId> touchTime;
Variable<EntityMemoryId> activate;

SonolusApi spawnOrder() { return 1000 + beat; }
Expand All @@ -22,7 +21,6 @@ class FlickNote : public Archetype {
enLane = lane + laneLength - 1;
inputTimeMin = beat - judgment.bad + RuntimeEnvironment.get(3);
inputTimeMax = beat + judgment.bad + RuntimeEnvironment.get(3);
touchTime = -1;
activate = 0;
return VOID;
// beat.set(Buckets.NormalNote),
Expand All @@ -48,7 +46,6 @@ class FlickNote : public Archetype {
SonolusApi updateSequential() {
FUNCBEGIN
IF (times.now < inputTimeMin) Return(0); FI
IF (activate == 0 && touchTime != -1) activate = 1; FI
IF (times.now > inputTimeMax) {
IF (activate == 1) complete(inputTimeMax);
ELSE complete(-1); FI
Expand All @@ -72,10 +69,10 @@ class FlickNote : public Archetype {
SonolusApi touch() {
FUNCBEGIN
IF (times.now < inputTimeMin) Return(0); FI
IF (touchTime != -1) Return(0); FI
// IF (touchTime != -1) Return(0); FI
let index = getClaimedStart(EntityInfo.get(0));
IF (index == -1) Return(0); FI
touchTime = times.now;
activate = 1;
return VOID;
}

Expand Down
14 changes: 10 additions & 4 deletions engine/data/archetypes/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ClaimManager {
res = touches[i].id; minDis = dis;
CONTINUE;
} FI

IF (claim.hitbox.contain(touches[i].x, touches[i].y) == 1) CONTINUE; FI
IF (origin.hitbox.contain(touches[i].x, touches[i].y) == 0) CONTINUE; FI
res = touches[i].id; minDis = dis;
Expand All @@ -68,6 +68,7 @@ class ClaimManager {
WHILE (true) {
var touchIndex = findBestTouchIndex(currentId);
IF (touchIndex == -1) BREAK; FI
// Debuglog(touchIndex);
disallowEmptiesNow.set(touchIndex, 1);

let claimIndex = claimed.indexOf(touchIndex);
Expand All @@ -80,13 +81,18 @@ class ClaimManager {
BREAK;
} FI

// ClaimInfo replaced = getInfo(cldaimIndex);
// ClaimInfo replaced = getInfo(cldaimIndex)
// Debuglog(claimed.indexOf(touchIndex));
var tmp = currentId;
currentId = claimed.getValById(claimIndex);
// Debuglog(tmp);
// Debuglog(claimed.indexOf(touchIndex));
claimed.set(touchIndex, tmp);
// DebugPause();
// claimed.val.set(claimIndex, tmp);
// Debuglog(touchIndex);
// claimed.set(touchIndex, tmp);
claimed.val.set(claimIndex, tmp);
// Debuglog(claimed.getValById(claimIndex));
// IF (claimed.getValById(claimIndex) != tmp) DebugPause(); FI
// Debuglog(claimed.size);
} DONE
return VOID;
Expand Down
9 changes: 5 additions & 4 deletions engine/data/archetypes/flatNotes/FlatNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FlatNote : public Archetype {
SonolusApi preprocess() {
FUNCBEGIN
IF (LevelOption.get(Options.Mirror)) lane = 14 - lane - laneLength; FI
// cout << lane.offset << endl;
enLane = lane + laneLength - 1;
inputTimeMin = beat - judgment.bad + RuntimeEnvironment.get(3);
inputTimeMax = beat + judgment.bad + RuntimeEnvironment.get(3);
Expand Down Expand Up @@ -55,9 +56,8 @@ class FlatNote : public Archetype {
}
SonolusApi updateSequential() {
FUNCBEGIN
IF (touchTime != -1) complete(touchTime); FI
IF (times.now < inputTimeMin) Return(0); FI
IF (times.now > inputTimeMax) complete(-2); FI
IF (times.now > inputTimeMax) complete(-1); FI
claimStart(EntityInfo.get(0));
// IF (mapId != -1 && inputList_old.getValById(mapId) != -1) complete(); FI
// mapId = inputList.size;
Expand All @@ -76,10 +76,11 @@ class FlatNote : public Archetype {
SonolusApi touch() {
FUNCBEGIN
IF (times.now < inputTimeMin) Return(0); FI
IF (touchTime != -1) Return(0); FI
// IF (touchTime != -1) Return(0); FI
let index = getClaimedStart(EntityInfo.get(0));
IF (index == -1) Return(0); FI
touchTime = times.now;
// Debuglog(index);
complete(times.now);
return VOID;
}

Expand Down
2 changes: 1 addition & 1 deletion engine/data/archetypes/holdNotes/ScratchHoldEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SiriusScratchHoldEnd: public Archetype {
EntityInput.set(3, t - beat);
IF (res2 == 1) Play(Clips.Scratch, minSFXDistance); FI
IF (res2 == 2) Play(Clips.CriticalGood, minSFXDistance); FI
IF (res2 != 0) spawnEffect(Effects.ScratchLinear, Effects.ScratchCircular, lane, enLane); FI
IF (res2 != 0) spawnEffect(Effects.ScratchLinear, Effects.ScratchCircular, scratchLane, scratchEnLane); FI
IF (res == 0) SpawnSubJudgeText(Sprites.JudgeMiss); FI
IF (res == 1) SpawnSubJudgeText(Sprites.JudgePerfectPlus); FI
IF (res == 3) SpawnSubJudgeText(Sprites.JudgeGreat); FI
Expand Down
Binary file modified main
Binary file not shown.

0 comments on commit 02274ce

Please sign in to comment.