Skip to content

Commit 379d525

Browse files
committed
refactor(chart): Unitize note position x unit
1 parent 02807c0 commit 379d525

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

src/chart/converter/official/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export const ConvertFromOfficial = (_chartRaw: IChartOfficial) => {
182182
oldNote.isAbove,
183183
oldNote.time,
184184
oldNote.speed,
185-
parseDoublePrecist(oldNote.posX, 6),
185+
parseDoublePrecist(oldNote.posX * (9 / 80), 4),
186186
oldNote.isSameTime,
187187
oldNote.floorPosition,
188188
oldNote.holdTime,

src/chart/converter/phiedit/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export const ConvertFromPhiEdit = (_chartRaw: string) => {
258258
),
259259
lineID: parseNumber(commandArr[1], -1),
260260
startBeat: parseNumber(commandArr[2], 0),
261-
positionX: parseNumber(parseFloat(commandArr[3]) * 9 / 1024, 0),
261+
positionX: parseNumber(parseFloat(commandArr[3]) / 1024, 0, 4),
262262
speed: 1,
263263
scaleX: 1,
264264
isAbove: commandArr[4] == '1',
@@ -272,7 +272,7 @@ export const ConvertFromPhiEdit = (_chartRaw: string) => {
272272
lineID: parseNumber(commandArr[1], -1),
273273
startBeat: parseNumber(commandArr[2], 0),
274274
endBeat: parseNumber(commandArr[3], 0),
275-
positionX: parseNumber(parseFloat(commandArr[4]) * 9 / 1024, 0),
275+
positionX: parseNumber(parseFloat(commandArr[4]) / 1024, 0, 4),
276276
speed: 1,
277277
scaleX: 1,
278278
isAbove: commandArr[5] == '1',

src/chart/converter/rephiedit/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export const ConvertFromRePhiEdit = (_chartRaw: TRPEChart) => {
309309
time: realTime,
310310
holdTime: holdTime,
311311
speed: oldNote.speed,
312-
posX: parseDoublePrecist(oldNote.positionX / (675 * (9 / 80)), 6),
312+
posX: parseDoublePrecist(oldNote.positionX / 675, 4),
313313
isAbove: oldNote.above === 1,
314314
isFake: oldNote.isFake === 1,
315315
isSameTime: false,

src/chart/tick.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function onChartTick(this: GameChart, currentTime: number, container: Con
155155
continue;
156156
}
157157

158-
const posX = size.widthPercent * notePosX;
158+
const posX = widthHalf * notePosX;
159159
const posY = floorPositionDiff * size.noteSpeed * (isAbove ? -1 : 1);
160160
const realXSin = posY * judgeline.sinr * -1;
161161
const realYCos = posY * judgeline.cosr;

src/renderer/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export interface IGameRendererSize {
3232
widthRealHalf: number,
3333
/** `widthRealHalf - widthHalf` */
3434
widthOffset: number,
35-
widthPercent: number,
3635
/** Used for culling notes */
3736
widthHalfBorder: number,
3837
/** Used for culling notes */
@@ -66,7 +65,6 @@ export class GameRenderer {
6665
widthReal: 0,
6766
widthRealHalf: 0,
6867
widthOffset: 0,
69-
widthPercent: 0,
7068
widthHalfBorder: 0,
7169
heightHalfBorder: 0,
7270

@@ -159,8 +157,6 @@ export class GameRenderer {
159157
size.widthHalfBorder = size.widthHalf * 1.2;
160158
size.heightHalfBorder = size.heightHalf * 1.2;
161159

162-
size.widthPercent = size.width * (9 / 160);
163-
164160
size.noteScale = size.width / 8080; // TODO: Settings
165161
size.noteWidth = size.width * 0.117775;
166162
size.noteSpeed = size.height * 0.6;

0 commit comments

Comments
 (0)