Skip to content

Commit

Permalink
feat(chart/tick): Less comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
MisaLiu committed Dec 18, 2024
1 parent 0c2b622 commit 2ce9a53
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/chart/tick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { GameChart } from '.';
import { GameChartEvent } from './event';
import { ArrayIndexed } from '@/utils/class';
import { isLineInArea } from '@/utils/math';
import { EGameChartNoteType } from './note';
import { EGameScoreJudgeType } from '@/score/types';

const valueCalculator = (events: ArrayIndexed<GameChartEvent>, currentTime: number, defaultValue = 0) => {
Expand Down Expand Up @@ -135,24 +134,21 @@ export function onChartTick(this: GameChart, currentTime: number, container: Con
isFake,
visibleTime
} = note;
const floorPositionDiff = (floorPosition - judgeline.floorPosition) * (type === 3 && isOfficial ? 1 : speed);
const sprite = note.sprite!;
if (score.isScored && (score.isScoreAnimated || score.score === EGameScoreJudgeType.BAD)) continue;

if (
isFake &&
(
(type !== EGameChartNoteType.HOLD && currentTime >= time) ||
(type === EGameChartNoteType.HOLD && currentTime >= holdEndTime!)
)
) {
const sprite = note.sprite!;
if (isFake && currentTime >= time && (holdEndTime === null || currentTime >= holdEndTime)) {
score.isScored = true;
score.isScoreAnimated = true;
if (sprite.parent) sprite.removeFromParent();
continue;
}
if (score.isScored && (score.isScoreAnimated || score.score === EGameScoreJudgeType.BAD)) continue;
if (currentTime < visibleTime) {
if (sprite.parent) sprite.removeFromParent();
continue;
}

const floorPositionDiff = (floorPosition - judgeline.floorPosition) * (type === 3 && isOfficial ? 1 : speed);
// TODO: Made as an option
if (floorPositionDiff * 0.6 > 2 || (floorPositionDiff < 0 && time > currentTime && judgeline.isCover)) {
if (sprite.parent) sprite.removeFromParent();
Expand Down

0 comments on commit 2ce9a53

Please sign in to comment.