diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-05-13 18:45:37 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-05-13 18:45:37 +0000 |
commit | 7403bb1fc38a74c25a636666681a42d663d27512 (patch) | |
tree | fbf7774949687da7e1b87b3be8bf0d8cf6a811b3 /Game/Code/Classes/UMain.pas | |
parent | 1e1849ae3ce2d5e78eb1d20681e385ad7b502092 (diff) | |
download | usdx-7403bb1fc38a74c25a636666681a42d663d27512.tar.gz usdx-7403bb1fc38a74c25a636666681a42d663d27512.tar.xz usdx-7403bb1fc38a74c25a636666681a42d663d27512.zip |
- fixed video-background
- fixed buggy SkipTime (using TRelativeTimer now)
- TLineState is a class now. TLineState.CurrentTime is now automatically updated using TRelativeTimer
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1088 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UMain.pas | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 9c867a3c..ea3da9ad 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -157,7 +157,13 @@ begin //------------------------------ //StartUp - Create Classes and Load Files //------------------------------ + + // Initialize SDL + // Without SDL_INIT_TIMER SDL_GetTicks() might return strange values + SDL_Init(SDL_INIT_VIDEO or SDL_INIT_TIMER); + USTime := TTime.Create; + VideoBGTimer := TRelativeTimer.Create; // Commandline Parameter Parser Params := TCMDParams.Create; @@ -174,19 +180,12 @@ begin InitializePaths; Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create; - + // Add Const Values: Language.AddConst('US_VERSION', USDXVersionStr); Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Language', 1); - // SDL - Log.BenchmarkStart(1); - Log.LogStatus('Initialize SDL', 'Initialization'); - SDL_Init(SDL_INIT_VIDEO or SDL_INIT_TIMER); - Log.BenchmarkEnd(1); - Log.LogBenchmark('Initializing SDL', 1); - // SDL_ttf Log.BenchmarkStart(1); Log.LogStatus('Initialize SDL_ttf', 'Initialization'); @@ -223,6 +222,9 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing Sound', 1); + // Lyrics-engine with media reference timer + LineState := TLineState.Create(); + // Theme Log.BenchmarkStart(1); Log.LogStatus('Load Themes', 'Initialization'); @@ -370,6 +372,8 @@ end; procedure MainLoop; var Delay: integer; +const + MAX_FPS = 100; begin Delay := 0; SDL_EnableKeyRepeat(125, 125); @@ -394,7 +398,7 @@ begin // delay CountMidTime; - Delay := Floor(1000 / 100 - 1000 * TimeMid); + Delay := Floor(1000 / MAX_FPS - 1000 * TimeMid); if Delay >= 1 then SDL_Delay(Delay); // dynamic, maximum is 100 fps @@ -655,8 +659,6 @@ var Done: real; N: integer; begin - LineState.CurrentTime := LineState.CurrentTime + TimeSkip; - LineState.OldBeat := LineState.CurrentBeat; LineState.MidBeat := GetMidBeat(LineState.CurrentTime - (CurrentSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function LineState.CurrentBeat := Floor(LineState.MidBeat); |