aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/Team_Duell
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-23 21:27:10 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-23 21:27:10 +0000
commitfffa660f35c9fed229abd7032817f4d59b209a44 (patch)
treec12c03cb56a52c1cb49afd07be0c3dc344a61a17 /plugins/Team_Duell
parenta4c4e2357f64eae49ec6768e52bea8753a0ca140 (diff)
downloadusdx-fffa660f35c9fed229abd7032817f4d59b209a44.tar.gz
usdx-fffa660f35c9fed229abd7032817f4d59b209a44.tar.xz
usdx-fffa660f35c9fed229abd7032817f4d59b209a44.zip
clear the SDL stuff (basically only SDL_GetTicks) from the plugins
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1779 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'plugins/Team_Duell')
-rw-r--r--plugins/Team_Duell/TeamDuell.dpr29
1 files changed, 15 insertions, 14 deletions
diff --git a/plugins/Team_Duell/TeamDuell.dpr b/plugins/Team_Duell/TeamDuell.dpr
index 7937a78c..60bed41a 100644
--- a/plugins/Team_Duell/TeamDuell.dpr
+++ b/plugins/Team_Duell/TeamDuell.dpr
@@ -4,15 +4,10 @@ library TeamDuell ;
{$MODE Delphi}
{$ENDIF}
-// compile with fpc -k-U -k_SDL_main TeamDuell.dpr -Fi../../src/lib/JEDI-SDL/SDL/Pas/
-
uses
- ModiSDK in '..\SDK\ModiSDK.pas',
-// USDXStrUtils in '..\SDK\USDXStrUtils.pas',
- sdl in '..\..\src\lib\JEDI-SDL\SDL\Pas\sdl.pas',
- moduleloader in '..\..\src\lib\JEDI-SDL\SDL\Pas\moduleloader.pas',
- gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas',
- sysutils;
+ SysUtils,
+ ModiSDK in '..\SDK\ModiSDK.pas',
+ gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas';
var
TeamPlayer: array of array of string;
@@ -24,6 +19,12 @@ var
bps, RTimeToNextChange: double;
firsttime, secondtime: boolean;
+function GetTicks: integer;
+// returns a time stamp in milliseconds
+begin
+ GetTicks := round(TimeStampToMSecs(DateTimeToTimeStamp(Now)));
+end;
+
// Give the plugin's info
procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
begin
@@ -92,7 +93,7 @@ begin
until not(NextSinger[Index] = CurSinger[Index]) or (SPT[Index] = 1);
end;
ChangeOnSentence := 8;
- starttick := SDL_GetTicks();
+ starttick := GetTicks;
firsttime := true;
secondtime := true;
bps := 1;
@@ -114,11 +115,11 @@ begin
if (CurSentence = ChangeOnSentence - 7) and (firsttime) then
begin
firsttime := false;
- starttick := SDL_GetTicks();
+ starttick := GetTicks;
end;
start := false;
// show first singer for 5 sec
- if (CurSentence < 1) and ((starttick + 5000) > SDL_GetTicks()) then
+ if (CurSentence < 1) and ((starttick + 5000) > GetTicks) then
start := true;
// TickCount(thirdSentence)
@@ -126,12 +127,12 @@ begin
begin
secondtime := false;
firsttime := true;
- endtick := SDL_GetTicks();
+ endtick := GetTicks;
bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond
end;
// Time to next change
- RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((SDL_GetTicks() - starttick) / 1000);
+ RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((GetTicks - starttick) / 1000);
TimeToNextChange := Trunc(RTimeToNextChange) + 1;
// Next singer for team I
@@ -222,7 +223,7 @@ end;
// is executed on finish, returns the player number of the winner
function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
var
- Index: integer;
+ Index: integer;
MaxScore: word;
begin
Result := 0;