Skip to content

Commit

Permalink
Wind Waker: Demo manager update() now takes deltaTimeFrames instead o…
Browse files Browse the repository at this point in the history
…f computing its own

The global deltaTimeFrames is capped at a max of 5 frames per step. This is useful when debugging cutscenes (especially if you drop that limit to 1) as you can step frame by frame instead of having the demo run in "real time" while the debugger is paused.
  • Loading branch information
themikelester committed Dec 28, 2024
1 parent d8706ac commit d301767
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ZeldaWindWaker/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ class d_s_play extends fopScn {
}

public override execute(globals: dGlobals, deltaTimeFrames: number): void {
this.demo.update();
this.demo.update(deltaTimeFrames);

// From d_menu_window::dMs_placenameMove()
dPn__update(globals);
Expand Down
10 changes: 4 additions & 6 deletions src/ZeldaWindWaker/d_demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,20 +466,18 @@ export class dDemo_manager_c {
this.mode = 0;
}

public update(): boolean {
public update(deltaTimeFrames: number): boolean {
if (!this.curFile) {
return false;
}

const dtFrames = this.globals.sceneContext.viewerInput.deltaTime / 1000.0 * 30;

// noclip modification: If a demo is suspended (waiting for the user to interact with a message), just resume
if (this.control.isSuspended()) { this.control.setSuspend(0); }

if (this.control.forward(dtFrames)) {
this.frame += dtFrames;
if (this.control.forward(deltaTimeFrames)) {
this.frame += deltaTimeFrames;
if (!this.control.isSuspended()) {
this.frameNoMsg += dtFrames;
this.frameNoMsg += deltaTimeFrames;
}
} else {
this.mode = EDemoMode.Ended;
Expand Down

0 comments on commit d301767

Please sign in to comment.