sonolus-voez-engine 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
package/dist/index.cjs CHANGED
@@ -22,7 +22,7 @@ __exportStar(require("./vc/index.cjs"), exports);
22
22
  var convert_cjs_2 = require("./vs/convert.cjs");
23
23
  Object.defineProperty(exports, "vsToVC", { enumerable: true, get: function () { return convert_cjs_2.vsToVC; } });
24
24
  __exportStar(require("./vs/index.cjs"), exports);
25
- exports.version = '1.1.1';
25
+ exports.version = '1.2.0';
26
26
  exports.engineInfo = {
27
27
  name: 'voez',
28
28
  version: 10,
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ export { vcToLevelData } from './vc/convert.cjs';
3
3
  export * from './vc/index.cjs';
4
4
  export { vsToVC } from './vs/convert.cjs';
5
5
  export * from './vs/index.cjs';
6
- export declare const version = "1.1.1";
6
+ export declare const version = "1.2.0";
7
7
  export declare const engineInfo: {
8
8
  readonly name: "voez";
9
9
  readonly version: 10;
@@ -72,38 +72,53 @@ const vcToLevelData = (vc, offset = 0) => {
72
72
  }
73
73
  for (const track of vc.tracks) {
74
74
  const ref = next();
75
+ const data = {
76
+ x: track.x,
77
+ w: track.w,
78
+ c: track.c,
79
+ startBeat: track.startBeat,
80
+ endBeat: track.endBeat,
81
+ animateStart: +track.animateStart,
82
+ };
83
+ const addCommands = (commands, archetype, dataName) => {
84
+ const entities = commands.map((command) => ({
85
+ ref: next(),
86
+ archetype,
87
+ data: {
88
+ trackRef: ref,
89
+ startBeat: command.startBeat,
90
+ startValue: command.startValue,
91
+ endBeat: command.endBeat,
92
+ endValue: command.endValue,
93
+ ease: ease.indexOf(command.ease),
94
+ },
95
+ }));
96
+ if (entities.length) {
97
+ data[dataName] = entities[0].ref;
98
+ }
99
+ for (const [index, entity] of entities.entries()) {
100
+ if (index === entities.length - 1) {
101
+ add(entity);
102
+ }
103
+ else {
104
+ add({
105
+ ...entity,
106
+ data: {
107
+ ...entity.data,
108
+ nextRef: entities[index + 1].ref,
109
+ },
110
+ });
111
+ }
112
+ }
113
+ };
114
+ addCommands(track.moveCommands, 'TrackMoveCommand', 'moveRef');
115
+ addCommands(track.scaleCommands, 'TrackScaleCommand', 'scaleRef');
116
+ addCommands(track.colorCommands, 'TrackColorCommand', 'colorRef');
75
117
  add({
76
118
  ref,
77
119
  archetype: 'Track',
78
- data: {
79
- x: track.x,
80
- w: track.w,
81
- c: track.c,
82
- startBeat: track.startBeat,
83
- endBeat: track.endBeat,
84
- animateStart: +track.animateStart,
85
- },
86
- });
87
- const addCommand = (archetype, command) => add({
88
- archetype,
89
- data: {
90
- trackRef: ref,
91
- startBeat: command.startBeat,
92
- startValue: command.startValue,
93
- endBeat: command.endBeat,
94
- endValue: command.endValue,
95
- ease: ease.indexOf(command.ease),
96
- },
120
+ data,
97
121
  });
98
- for (const command of track.moveCommands) {
99
- addCommand('TrackMoveCommand', command);
100
- }
101
- for (const command of track.scaleCommands) {
102
- addCommand('TrackScaleCommand', command);
103
- }
104
- for (const command of track.colorCommands) {
105
- addCommand('TrackColorCommand', command);
106
- }
107
122
  for (const note of track.notes) {
108
123
  switch (note.type) {
109
124
  case 'tap':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonolus-voez-engine",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "A recreation of VOEZ engine in Sonolus",
5
5
  "author": "NonSpicyBurrito",
6
6
  "repository": "github:NonSpicyBurrito/sonolus-voez-engine",