aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UMain.pas
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-10-05 18:28:42 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-10-05 18:28:42 +0000
commit65ddad359ed3b9b739215ec89a7645455ae10dce (patch)
tree7fdc703f290b37e68ce0e6a2c56d5bdd2f7ee07b /Game/Code/Classes/UMain.pas
parentdbe444f87b85da27a37f38e80bfd540178b8dde0 (diff)
downloadusdx-65ddad359ed3b9b739215ec89a7645455ae10dce.tar.gz
usdx-65ddad359ed3b9b739215ec89a7645455ae10dce.tar.xz
usdx-65ddad359ed3b9b739215ec89a7645455ae10dce.zip
- added webcam support
- faster program start - faster sorting (mergesort) - sync lyrics to music - some new backgrounds and credits graphics (thx to MezzoX) - own thread for video decoding - finished 6-Player-on-one-screen-mode - changqed player-colors - fixed some bugs... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2637 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UMain.pas')
-rw-r--r--Game/Code/Classes/UMain.pas29
1 files changed, 17 insertions, 12 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 2b947908..c8b398b7 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -114,7 +114,7 @@ function GetTimeFromBeat(Beat: integer): real;
procedure ClearScores(PlayerNum: integer);
implementation
-uses USongs, Math, UCommandLine, UVideo;
+uses USongs, Math, UCommandLine, UVideo, UWebCam;
procedure MainLoop;
var
@@ -123,6 +123,7 @@ begin
SDL_EnableKeyRepeat(125, 125);
While not Done do
Begin
+ PerfLog.CycleStart;
// keyboard events
CheckEvents;
@@ -133,7 +134,7 @@ begin
// delay
CountMidTime;
- Delay := Floor(1000 / 200 - 1000 * TimeMid);
+ Delay := Floor(1000 / 100 - 1000 * TimeMid);
if Delay >= 1 then
SDL_Delay(Delay);
CountSkipTime;
@@ -143,8 +144,10 @@ begin
Reinitialize3D;
Restart := false;
end;
-
+ PerfLog.CycleEnd;
End;
+ wClose;
+ acClose;
FreeOpenGL;
End;
@@ -360,16 +363,13 @@ var
Done: real;
N: integer;
begin
- Czas.Teraz := Czas.Teraz + TimeSkip;
+ //Czas.Teraz := Czas.Teraz + TimeSkip;
+ Czas.Teraz := Music.Position;
Czas.OldBeat := Czas.AktBeat;
Czas.MidBeat := GetMidBeat(Czas.Teraz - (AktSong.Gap{ + 90 I've forgotten for what it is}) / 1000); // new system with variable BPM in function
Czas.AktBeat := Floor(Czas.MidBeat);
-// Czas.OldHalf := Czas.AktHalf;
-// Czas.MidHalf := Czas.MidBeat + 0.5;
-// Czas.AktHalf := Floor(Czas.MidHalf);
-
Czas.OldBeatC := Czas.AktBeatC;
Czas.MidBeatC := GetMidBeat(Czas.Teraz - (AktSong.Gap) / 1000);
Czas.AktBeatC := Floor(Czas.MidBeatC);
@@ -547,6 +547,9 @@ end;
//end;
procedure NewNote(P: integer; Sender: TScreenSing);
+const
+ DEBUG_NOTE_HIT = false;
+
var
CP: integer; // current player
S: integer; // sentence
@@ -597,7 +600,7 @@ begin
S := SDet;
- if (Sound[CP].SzczytJest) and (Mozna) then
+ if (Sound[CP].SzczytJest or DEBUG_NOTE_HIT) and (Mozna) then
begin
// operowanie na ostatniej nucie
for Pet := 0 to Czesci[P].Czesc[S].HighNut do
@@ -619,7 +622,8 @@ begin
//if Ini.Difficulty = 1 then Range := 1;
//if Ini.Difficulty = 2 then Range := 0;
Range := 2 - Ini.Difficulty;
- if abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then
+ if (abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range) or
+ DEBUG_NOTE_HIT then
begin
Sound[CP].Ton := Czesci[P].Czesc[S].Nuta[Pet].Ton;
@@ -771,7 +775,7 @@ begin
S := SDet;
- if (Sound[CP].SzczytJest) and (Mozna) then
+ if (Sound[CP].SzczytJest or DEBUG_NOTE_HIT) and (Mozna) then
begin
// operowanie na ostatniej nucie
for Pet := 0 to Czesci[P].Czesc[S].HighNut do
@@ -793,7 +797,8 @@ begin
//if Ini.Difficulty = 1 then Range := 1;
//if Ini.Difficulty = 2 then Range := 0;
Range := 2 - Ini.Difficulty;
- if abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range then
+ if (abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range) or
+ DEBUG_NOTE_HIT then
begin
Sound[CP].Ton := Czesci[P].Czesc[S].Nuta[Pet].Ton;