private void Update() { menu.Update(); if (state == ApplicationState.Opening) { opening.Update(); } else if (state == ApplicationState.Game) { UserInput.BuildTicCmd(cmds[0]); //demo.ReadCmd(cmds); game.Update(cmds); } renderer.Render(this); }
public UpdateResult Update() { if (!stopwatch.IsRunning) { stopwatch.Start(); } if (!demo.ReadCmd(cmds)) { stopwatch.Stop(); return(UpdateResult.Completed); } else { frameCount++; return(game.Update(cmds)); } }
private UpdateResult Update() { if (!wiping) { menu.Update(); if (nextState != currentState) { if (nextState != ApplicationState.Opening) { opening.Reset(); } if (nextState != ApplicationState.DemoPlayback) { demoPlayback = null; } currentState = nextState; } if (quit) { return(UpdateResult.Completed); } if (needWipe) { needWipe = false; StartWipe(); } } if (!wiping) { switch (currentState) { case ApplicationState.Opening: if (opening.Update() == UpdateResult.NeedWipe) { StartWipe(); } break; case ApplicationState.DemoPlayback: var result = demoPlayback.Update(); if (result == UpdateResult.NeedWipe) { StartWipe(); } else if (result == UpdateResult.Completed) { Quit("FPS: " + demoPlayback.Fps.ToString("0.0")); } break; case ApplicationState.Game: userInput.BuildTicCmd(cmds[options.ConsolePlayer]); if (sendPause) { sendPause = false; cmds[options.ConsolePlayer].Buttons |= (byte)(TicCmdButtons.Special | TicCmdButtons.Pause); } if (game.Update(cmds) == UpdateResult.NeedWipe) { StartWipe(); } break; default: throw new Exception("Invalid application state!"); } } if (wiping) { var result = wipe.Update(); renderer.RenderWipe(this, wipe); if (result == UpdateResult.Completed) { wiping = false; } } else { renderer.Render(this); } options.Sound.Update(); CheckMouseState(); return(UpdateResult.None); }
public UpdateResult Update() { var updateResult = UpdateResult.None; if (nextStage != currentStage) { switch (nextStage) { case 0: StartTitleScreen(); break; case 1: StartDemo("DEMO1"); break; case 2: StartCreditScreen(); break; case 3: StartDemo("DEMO2"); break; case 4: StartTitleScreen(); break; case 5: StartDemo("DEMO3"); break; case 6: StartCreditScreen(); break; case 7: StartDemo("DEMO4"); break; } currentStage = nextStage; updateResult = UpdateResult.NeedWipe; } switch (currentStage) { case 0: count++; if (count == timer) { //* nextStage = 1; } break; case 1: if (!demo.ReadCmd(cmds)) { nextStage = 2; } else { game.Update(cmds); } break; case 2: count++; if (count == timer) { nextStage = 3; } break; case 3: if (!demo.ReadCmd(cmds)) { nextStage = 4; } else { game.Update(cmds); } break; case 4: count++; if (count == timer) { nextStage = 5; } break; case 5: if (!demo.ReadCmd(cmds)) { if (resource.Wad.GetLumpNumber("DEMO4") == -1) { nextStage = 0; } else { nextStage = 6; } } else { game.Update(cmds); } break; case 6: count++; if (count == timer) { nextStage = 7; } break; case 7: if (!demo.ReadCmd(cmds)) { nextStage = 0; } else { game.Update(cmds); } break; } if (state == OpeningSequenceState.Title && count == 1) { if (options.GameMode == GameMode.Commercial) { options.Music.StartMusic(Bgm.DM2TTL, false); } else { options.Music.StartMusic(Bgm.INTRO, false); } } if (reset) { reset = false; return(UpdateResult.NeedWipe); } else { return(updateResult); } }