Skip to content

Commit

Permalink
Assume 10 second countdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
vikpe committed Jun 18, 2024
1 parent 7dc49f3 commit d6cb26d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/pages/games/fte/fteController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export class FteController {
// @ts-ignore
private _module: FteModule;
private _volume = 0.0;
private _demoDuration = 0.0;
private _countdownDuration = 10.0;
private _demoDuration = 610.0;
private _lastVolume = 0.0;
private _maxVolume = 0.2;
private _lastDemoSpeed = 100;
Expand All @@ -46,7 +47,7 @@ export class FteController {
if (FteController._instance === null) {
const fte = new FteController(module);
fte.mute();
fte.setDemoDuration(demoDuration || 600);
fte.setDemoDuration(demoDuration || 610);
FteController._instance = fte;
}

Expand Down Expand Up @@ -106,16 +107,16 @@ export class FteController {
this._demoDuration = value;
}

getMatchStartTime(): number {
return this._demoDuration % 60;
getCountdownDuration(): number {
return this._countdownDuration;
}

getMatchElapsedTime(): number {
return this.getDemoElapsedTime() - this.getMatchStartTime();
return this.getDemoElapsedTime() - this.getCountdownDuration();
}

getMatchDuration(): number {
return this.getDemoDuration() - this.getMatchStartTime();
return this.getDemoDuration() - this.getCountdownDuration();
}

getPlayers(): Player[] {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/games/player/clips/ClipControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ const AdjustControls = () => {
return null;
}

const countdownLength = fte.getMatchStartTime();
const rangeInGameTime = range.map((v) => v - countdownLength);
const rangeInGameTime = range.map((v) => v - fte.getCountdownDuration());

return (
<div className="flex flex-wrap grow items-center md:justify-center space-x-1 gap-y-1">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/games/player/clips/ClipRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ClipRange = () => {

const min = 0;
const max = Math.ceil(fte?.getDemoDuration()) || 610;
const countdownLength = fte?.getMatchStartTime();
const countdownLength = fte?.getCountdownDuration();

return (
<Range
Expand Down
2 changes: 1 addition & 1 deletion src/pages/games/player/controls/DebugFte.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const DebugFte = () => {
const demoProps = {
getDemoTotalTime: fte.getDemoDuration(),
getDemoElapsedTime: fte.getDemoElapsedTime(),
getDemoGameStartTime: fte.getMatchStartTime(),
getDemoGameStartTime: fte.getCountdownDuration(),

getGameTotalTime: fte.getMatchDuration(),
getGameElapsedTime: fte.getMatchElapsedTime(),
Expand Down
4 changes: 2 additions & 2 deletions src/pages/games/player/controls/TimeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function TimeSlider() {
const isHover = useHover(sliderWrapperRef);
const [mouse, sliderRootRef] = useMouse<HTMLDivElement>();

const countdownLength = fte ? fte.getMatchStartTime() : 10;
const maxValue = fte ? fte.getDemoDuration() : 1200;
const countdownLength = fte ? fte.getCountdownDuration() : 10;
const maxValue = fte ? fte.getDemoDuration() : 1210;

useEffect(() => {
if (!isHover || !tooltipRef.current) {
Expand Down

0 comments on commit d6cb26d

Please sign in to comment.