Skip to content

Commit

Permalink
add function to export, fix negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
cnkeats committed Jan 29, 2022
1 parent 3600654 commit a6ce78b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from "./utils/slpFile";
export * from "./utils/slpFileWriter";
export * from "./utils/slpParser";
export * from "./utils/slpStream";
export * from "./utils/gameTimer";

// Console networking
export * from "./console";
Expand Down
4 changes: 2 additions & 2 deletions src/utils/gameTimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function frameToGameTimer(frame: number, settings: GameStartType): string
const timerType = ((settings.gameInfo?.gameBitfield1 as number) & 0b11) as TimerType;

if (timerType == TimerType.DECREASING) {
let remainingFrames = frame;
let remainingFrames = frame > 0 ? frame : 0;
const startingTimerInFrames = (settings.gameInfo?.gameTimer as number) * 60;

const minutesPassed = Math.floor(remainingFrames / 60 / 60);
Expand All @@ -25,7 +25,7 @@ export function frameToGameTimer(frame: number, settings: GameStartType): string
}

if (timerType == TimerType.INCREASING) {
let remainingFrames = frame;
let remainingFrames = frame > 0 ? frame : 0;

const minutes = Math.floor(remainingFrames / 60 / 60);
remainingFrames -= minutes * 60 * 60;
Expand Down

0 comments on commit a6ce78b

Please sign in to comment.