Skip to content

Commit

Permalink
Fixed InputManager
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleYang0531 committed Jan 14, 2024
1 parent 106915c commit 19ca337
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion blocks/Archetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,5 @@ class Archetype {

#define defineEntityData(name) Variable<EntityDataId> name = Variable<EntityDataId>(0, true); \
bool unused_##name##_unused = [&](){ \
name.offset = data.size(); \
name.offset = data.size(); allocatorSize[EntityDataId]++; \
data.push_back({ #name, data.size() }); return true; }();
1 change: 1 addition & 0 deletions blocks/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Array {
SonolusApi set(FuncNode index, T obj) {
FUNCBEGIN
auto c = obj.serialize();
// IF (Get(4003, 0) != 1) Debuglog(c[0]); FI
for (int i = 0; i < classSize; i++)
Set(identifierId, offset + index * classSize + i, c[i]);
return VOID;
Expand Down
1 change: 0 additions & 1 deletion blocks/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class Map {
SonolusApi set(T1 key, T2 value) {
FUNCBEGIN
let id = indexOf(key);
// Debuglog(id);
IF (id == -1) add(key, value);
ELSE val.set(id, value); FI
return VOID;
Expand Down
13 changes: 7 additions & 6 deletions blocks/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ class Variable {
offset = allocatorSize[identifierId]++;
R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val}));
}
// Variable(const Variable<identifierId>& val) {
// offset = allocatorSize[identifierId]++;
// cout << identifierId << " " << offset << endl;
// R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val.get()}));
// }
Variable(const Variable<identifierId>& val) {
offset = allocatorSize[identifierId]++;
// cout << "Copy Constructor: " << identifierId << " " << val.offset << endl;
// DumpTraceback();
R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val.get()}));
}
template<int T> Variable(Variable<T> val) {
// cout << T << " " << val.offset << " " << allocatorSize[T] << endl;
// cout << "Constructor: " << identifierId << " " << T << " " << val.offset << endl;
offset = allocatorSize[identifierId]++;
R(FuncNode(RuntimeFunction.Set, {identifierId, offset, val.get()}));
}
Expand Down
7 changes: 6 additions & 1 deletion convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,23 @@ string fromSUS(string text) {
// case 3: tmp2[1] = "0" + tmp2[1]; break;
// }
while (tmp2[1].size() < 4) tmp2[1] = '0' + tmp2[1];
while (tmp3[0].size() < 2) tmp3[0] = '0' + tmp3[0];
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());
sort(exp.begin(), exp.end(), [](string a, string b){
return a.size() == b.size() ? a < b : a.size() < b.size();
}); // upd: 字符串类型的数字不能直接排序,警钟敲烂😓 2023/01/14
for (auto i = 0; i < exp.size(); i++) {
string tmp = exp[i];
// cout << tmp << endl;
auto tmp1 = explode(":", tmp.c_str());
string beat = tmp1[0], type = tmp1[1];
auto tmp2 = explode("'", beat.c_str());
auto tmp3 = explode(".", type.c_str());
int lines = atoi(tmp3[0].c_str()), types = atoi(tmp3[1].c_str());
if (currentSplitLine != 0) { // 分割线终点
// cout << currentSplitLine << " " << currentSplitLineType << endl;
if (currentSplitLine * 10 != lines || currentSplitLineType != types)
throw runtime_error("Overlapped Split Line: " + exp[i]);
currentSplitLine = 0; currentSplitLineType = 0;
Expand Down
Binary file modified dist/EngineData
Binary file not shown.
Binary file modified dist/EngineWatchData
Binary file not shown.
2 changes: 0 additions & 2 deletions engine/play/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ 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 @@ -89,7 +88,6 @@ class ClaimManager {
// Debuglog(claimed.indexOf(touchIndex));
var tmp = currentId;
currentId = claimed.getValById(claimIndex);
// Debuglog(tmp);
// Debuglog(claimed.indexOf(touchIndex));
claimed.set(touchIndex, tmp);
// DebugPause();
Expand Down
3 changes: 3 additions & 0 deletions engine/play/flatNotes/FlatNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class FlatNote : public Archetype {
EntityInput.set(0, res2);
EntityInput.set(1, t - beat);
EntityInput.set(3, t - beat);
// IF (res2 == 0) DebugPause(); FI
IF (res2 == 1) Play(getClips().perfect, minSFXDistance); FI
IF (res2 == 2) Play(getClips().great, minSFXDistance); FI
IF (res2 == 3) Play(getClips().good, minSFXDistance); FI
Expand Down Expand Up @@ -80,6 +81,8 @@ class FlatNote : public Archetype {
let index = getClaimedStart(EntityInfo.get(0));
IF (index == -1) Return(0); FI
// Debuglog(index);
// Debuglog(getHitbox(lane, enLane).l);
// Debuglog(getHitbox(lane, enLane).r);
complete(times.now);
return VOID;
}
Expand Down
Binary file modified main
Binary file not shown.

0 comments on commit 19ca337

Please sign in to comment.