diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 12:34:07 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-23 12:34:07 +0000 |
commit | 94cefdb78044e0f9996e3032de34b690de98b708 (patch) | |
tree | b858a502ed5f12a02e18c2299e045eb0a757a8b7 /unicode/plugins/Team_Duell | |
parent | d1538b5a15a47b54a53e42d1cc7117780ffafd43 (diff) | |
download | usdx-94cefdb78044e0f9996e3032de34b690de98b708.tar.gz usdx-94cefdb78044e0f9996e3032de34b690de98b708.tar.xz usdx-94cefdb78044e0f9996e3032de34b690de98b708.zip |
- revert to 1777
- Ocean.ini and SVN properties are not reverted
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1854 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'unicode/plugins/Team_Duell')
-rw-r--r-- | unicode/plugins/Team_Duell/TeamDuell.dpr | 337 |
1 files changed, 152 insertions, 185 deletions
diff --git a/unicode/plugins/Team_Duell/TeamDuell.dpr b/unicode/plugins/Team_Duell/TeamDuell.dpr index 1371c95d..cb0e6349 100644 --- a/unicode/plugins/Team_Duell/TeamDuell.dpr +++ b/unicode/plugins/Team_Duell/TeamDuell.dpr @@ -5,236 +5,206 @@ library TeamDuell ; {$ENDIF} uses - SysUtils, - ModiSDK in '..\SDK\ModiSDK.pas', - gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; + ModiSDK in '..\SDK\ModiSDK.pas', + StrUtils in '..\SDK\StrUtils.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; var - TeamPlayer: array of array of string; - StartPoints: array of integer; - CurSinger, NextSinger: array[0..2] of integer; - MethodRec: TMethodRec; - SPT, PlayerSelected: array[0..2] of integer; - TimeToNextChange, starttick, endtick, ChangeOnSentence: cardinal; - bps, RTimeToNextChange: double; - firsttime, secondtime: boolean; - -function GetTicks: cardinal; -// 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} + TeamPlayer: array of array of String; + StartPoints: array of integer; + CurSinger, NextSinger: array[0..2] of Integer; + MethodRec: TMethodRec; + SPT, PlayerSelected: array[0..2] of Integer; + TtoNextChange, starttick, endtick, ChangeOnSentence : Cardinal; + bps, RTtoNextChange: Double; + firsttime, secondtime: boolean; + + +//Gave the Plugins Info +procedure PluginInfo (var Info: TPluginInfo); stdcall; begin - Info.Name := 'PLUGIN_TEAMDUELL_NAME'; + Info.Name := 'PLUGIN_TEAMDUELL_NAME'; Info.Creator := 'jekatt'; Info.PluginDesc := 'PLUGIN_TEAMDUELL_DESC'; - Info.Typ := 8; + Info.Typ := 8; Info.NumPlayers := 31; - // Options - Info.LoadSong := true; // Whether or not a song should be loaded - // Only when song is loaded: - Info.ShowScore := true; // Whether or not the score should be shown - Info.ShowNotes := true; // Whether the note lines should be displayed - Info.LoadVideo := true; // Should the video be loaded ? - Info.LoadBack := true; // Should the background be loaded ? - - Info.BGShowFull := false; // Whether the background or the video should be shown full size - Info.BGShowFull_O := true; // Whether the background or the video should be shown full size - - Info.ShowRateBar := true; // Whether the bar that shows how good the player was should be displayed - Info.ShowRateBar_O := false; // Load from ini whether the bar should be displayed - - Info.EnLineBonus := false; // Whether line bonus should be enabled - Info.EnLineBonus_O := true; // Load from ini whether line bonus should be enabled - - // Options even when song is not loaded - Info.ShowBars := false; // Whether the white bars on top and bottom should be drawn - Info.TeamModeOnly := true; // if true the plugin can only be played in team mode - Info.GetSoundData := false; // if true the rdata procedure is called when new sounddata is available - Info.Dummy := false; // Should be set to false... for updating plugin interface + //Options + Info.LoadSong := True; //Whether or not a Song should be Loaded + //Only When Song is Loaded: + Info.ShowScore := True; //Whether or not the Score should be shown + Info.ShowNotes := True; //Whether the Note Lines should be displayed + Info.LoadVideo := True; //Should the Video be loaded ? + Info.LoadBack := True; //Should the Background be loaded ? + + Info.BGShowFull := False; //Whether the Background or the Video should be shown Fullsize + Info.BGShowFull_O := True; //Whether the Background or the Video should be shown Fullsize + + Info.ShowRateBar:= True; //Whether the Bar that shows how good the player was sould be displayed + Info.ShowRateBar_O := false; //Load from Ini whether the Bar should be Displayed + + Info.EnLineBonus := False; //Whether LineBonus Should be enabled + Info.EnLineBonus_O := True; //Load from Ini whether LineBonus Should be enabled + + //Options even when song is Not loaded + Info.ShowBars := False; //Whether the White Bars on Top and Bottom should be Drawn + Info.TeamModeOnly := True; //If True the Plugin can only be Played in Team Mode + Info.GetSoundData := False; //If True the RData Procedure is called when new SoundData is available + Info.Dummy := False; //Should be Set to False... for Updateing Plugin Interface end; -// executed on game start. if true game begins, else failure -function Init (const TeamInfo: TTeamInfo; - var Playerinfo: TPlayerinfo; - const Sentences: TSentences; - const Methods: TMethodRec) - : boolean; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Executed on Game Start //If True Game begins, else Failure +function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const Methods: TMethodRec): boolean; stdcall; var - Index, J: integer; +I,J: Integer; begin -// Get beginning of sentences - for Index := 0 to Sentences.High do - begin - SetLength(Startpoints, Index+1); - Startpoints[Index]:=Sentences.Sentence[Index].Start; + // Get beginning of sentences + for I := 0 to Sentences.High do begin + SetLength(Startpoints, I+1); + Startpoints[I]:=Sentences.Sentence[I].Start; end; - // Get teams and players - for Index := 0 to TeamInfo.NumTeams-1 do - begin - SetLength(TeamPlayer, Index+1); - for J := 0 to TeamInfo.Teaminfo[Index].NumPlayers-1 do + // Get Teams and Players + for I := 0 to TeamInfo.NumTeams-1 do begin - SetLength(TeamPlayer[Index], J+1); - TeamPlayer[Index,J] := Copy(string(TeamInfo.Teaminfo[Index].Playerinfo[J].Name), 1, 8); - if (not(TeamPlayer[Index,J] = (string(TeamInfo.Teaminfo[Index].Playerinfo[J].Name)))) then - TeamPlayer[Index,J] := TeamPlayer[Index,J]+'.'; - SPT[Index]:=J+1; + SetLength(TeamPlayer, I+1); + for J := 0 to TeamInfo.Teaminfo[I].NumPlayers-1 do + begin + SetLength(TeamPlayer[I], J+1); + TeamPlayer[I,J] := Copy(String(TeamInfo.Teaminfo[I].Playerinfo[J].Name),1,8); + If (NOT(TeamPlayer[I,J] = (String(TeamInfo.Teaminfo[I].Playerinfo[J].Name)))) THEN TeamPlayer[I,J] := TeamPlayer[I,J]+'.'; + SPT[I]:=J+1; + end; + CurSinger[I] := TeamInfo.Teaminfo[I].CurPlayer; + repeat + NextSinger[I] := random(SPT[I]); + until NOT(NextSinger[I] = CurSinger[I]) OR (SPT[I] = 1) ; end; - CurSinger[Index] := TeamInfo.Teaminfo[Index].CurPlayer; - repeat - NextSinger[Index] := random(SPT[Index]); - until not(NextSinger[Index] = CurSinger[Index]) or (SPT[Index] = 1); - end; ChangeOnSentence := 8; - starttick := GetTicks; + starttick := SDL_GetTicks(); firsttime := true; secondtime := true; bps := 1; MethodRec := Methods; - Result := true; + Result := True; end; -// Executed every time the screen is drawn; if false the game finishes -function Draw (var Playerinfo: TPlayerinfo; - const CurSentence: cardinal) - : boolean; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Executed everytime the Screen is Drawed //If False The Game finishes +function Draw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; stdcall; var - Index, timeline, x, y: integer; - display: PChar; - TimeString: PChar; - start: boolean; + I,timeline,x,y: Integer; + display: PChar; + start: boolean; begin // TickCount(firstSentence) (not zero!) - if (CurSentence = ChangeOnSentence - 7) and (firsttime) then + If (CurSentence = ChangeOnSentence - 7) AND (firsttime) then begin firsttime := false; - starttick := GetTicks; + starttick := SDL_GetTicks(); end; start := false; - // show first singer for 5 sec - if (CurSentence < 1) and ((starttick + 5000) > GetTicks) then - start := true; + // show first singers for 5sec + if (CurSentence < 1) AND ((starttick + 5000) > SDL_GetTicks()) then begin start := true; end; // TickCount(thirdSentence) - if (CurSentence = 3) and (secondtime) then + If (CurSentence = 3) AND (secondtime) then begin secondtime := false; firsttime := true; - endtick := GetTicks; + endtick := SDL_GetTicks(); bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond end; - // Time to next change - RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((GetTicks - starttick) / 1000); - TimeToNextChange := Trunc(RTimeToNextChange) + 1; + // Time to next Change + RTtoNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((SDL_GetTicks() - starttick) / 1000); + TtoNextChange := Trunc(RTtoNextChange) +1; - // Next singer for team I - for Index := 0 to High(TeamPlayer) do - begin - if (CurSentence = ChangeOnSentence) and not(PlayerSelected[Index] = CurSentence) then - begin - PlayerSelected[Index] := CurSentence; - CurSinger[Index] := NextSinger[Index]; + // Next Singer for Team I + for I := 0 to High(TeamPlayer) do begin + if (CurSentence = ChangeOnSentence) AND NOT(PlayerSelected[I] = CurSentence) then begin + PlayerSelected[I] := CurSentence; + CurSinger[I] := NextSinger[I]; repeat - NextSinger[Index] := random(SPT[Index]); - until not(NextSinger[Index] = CurSinger[Index]) or (SPT[Index] = 1) ; + NextSinger[I] := random(SPT[I]); + until NOT(NextSinger[I] = CurSinger[I]) OR (SPT[I] = 1) ; end; - // display background + // display bg glColor4f (0.8, 0.8, 0.8, 1); - display := PChar(TeamPlayer[Index,CurSinger[Index]]); - if (TimeToNextChange <= 11) or (start = true) then - begin - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glColor4f(0, 0, 0, 1); - glBegin(GL_QUADS); - glVertex2f(PlayerInfo.Playerinfo[Index].PosX, PlayerInfo.Playerinfo[Index].PosY + 8); - glVertex2f(PlayerInfo.Playerinfo[Index].PosX, PlayerInfo.Playerinfo[Index].PosY + 30); - glVertex2f(PlayerInfo.Playerinfo[Index].PosX + 100, PlayerInfo.Playerinfo[Index].PosY + 30); - glVertex2f(PlayerInfo.Playerinfo[Index].PosX + 100, PlayerInfo.Playerinfo[Index].PosY + 8); - glEnd; - display := 'Next Singer'; + display := PChar(TeamPlayer[I,CurSinger[I]]); + if (TtoNextChange <= 11) OR (start = true) Then begin + glEnable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glColor4f (0, 0, 0, 1); + glBegin(GL_QUADS); + glVertex2f(PlayerInfo.Playerinfo[I].PosX, PlayerInfo.Playerinfo[I].PosY+8); + glVertex2f(PlayerInfo.Playerinfo[I].PosX, PlayerInfo.Playerinfo[I].PosY + 30); + glVertex2f(PlayerInfo.Playerinfo[I].PosX + 100, PlayerInfo.Playerinfo[I].PosY + 30); + glVertex2f(PlayerInfo.Playerinfo[I].PosX + 100, PlayerInfo.Playerinfo[I].PosY+8); + glEnd; + display := 'Next Singer'; // timeline - x := 270; - y := 472; - if (TimeToNextChange <= 5) and (RTimeToNextChange > 0) then - begin - timeline := Trunc(RTimeToNextChange*50); - glColor3f(0, 0, 0); - glBegin(GL_QUADS); - glVertex2f(x, y); - glVertex2f(x, y + 18); - glVertex2f(x + 6 + 250, y + 18); - glVertex2f(x + 6 + 250, y); - glEnd; - glColor3f(0.2, 0.2, 0.2); - glBegin(GL_QUADS); - glVertex2f(x + 3, y + 3); - glVertex2f(x + 3, y + 15); - glVertex2f(x + 3 + 250, y + 15); - glVertex2f(x + 3 + 250, y + 3); - glEnd; - glColor3f(0.8, 0.2, 0.2); - glBegin(GL_QUADS); - glColor3f(0.9, 0, 0); glVertex2f(x + 3, y + 3); - glColor3f(0.8, 0.3, 0.3); glVertex2f(x + 3, y + 15); - glColor3f(0.8, 0.3, 0.3); glVertex2f(x + 3 + timeline, y + 15); - glColor3f(0.9, 0, 0); glVertex2f(x + 3 + timeline, y + 3); - glEnd; - end; - glDisable(GL_TEXTURE_2D); + x:= 270; y:= 472; + if (TtoNextChange <= 5) AND (RTtoNextChange > 0) then begin + timeline := Trunc(RTtoNextChange*50); + glColor3f (0, 0, 0); + glBegin(GL_QUADS); + glVertex2f(x, y); + glVertex2f(x, y+18); + glVertex2f(x+6+250, y+18); + glVertex2f(x+6+250, y); + glEnd; + glColor3f (0.2, 0.2, 0.2); + glBegin(GL_QUADS); + glVertex2f(x+3, y+3); + glVertex2f(x+3, y+15); + glVertex2f(x+3+250, y+15); + glVertex2f(x+3+250, y+3); + glEnd; + glColor3f (0.8, 0.2, 0.2); + glBegin(GL_QUADS); + glColor3f (0.9, 0, 0); glVertex2f(x+3, y+3); + glColor3f (0.8, 0.3, 0.3); glVertex2f(x+3, y+15); + glColor3f (0.8, 0.3, 0.3); glVertex2f(x+3+timeline, y+15); + glColor3f (0.9, 0, 0); glVertex2f(x+3+timeline, y+3); + glEnd; + end; + glDisable(GL_TEXTURE_2D); end; // Names, Timer - if (TimeToNextChange <= 9) then - begin display := PChar(TeamPlayer[Index,NextSinger[Index]]); - glColor4f(0.8, 0.1, 0.2, 1); -// KMS aka Mischi: -// try to replace the use of the unit USDXStrUtils -// original: -// MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX+85, PlayerInfo.Playerinfo[Index].PosY+10, CreateStr(PChar(IntToStr(Trunc(TimeToNextChange))))); -// replacement: Is this correct? - TimeString := PChar(IntToStr(Trunc(TimeToNextChange))); - MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX+85, PlayerInfo.Playerinfo[Index].PosY+10, TimeString); - end; - glColor4f(0.8, 0.8, 0.8, 1); - if (CurSentence = 0) then - display := PChar(TeamPlayer[Index,CurSinger[Index]]); - if (TimeToNextChange <= 11) or (start) then - MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX+5, PlayerInfo.Playerinfo[Index].PosY+10, display); + if (TtoNextChange <= 9) Then begin display := PChar(TeamPlayer[I,NextSinger[I]]); + glColor4f (0.8, 0.1, 0.2, 1); + MethodRec.Print (1, 18, PlayerInfo.Playerinfo[I].PosX+85, PlayerInfo.Playerinfo[I].PosY+10, CreateStr(PChar(IntToStr(Trunc(TtoNextChange))))); end; - if (CurSentence = ChangeOnSentence) then - begin - ChangeOnSentence := CurSentence + 7; - firsttime := true; + glColor4f (0.8, 0.8, 0.8, 1); + if (CurSentence = 0) then display := PChar(TeamPlayer[I,CurSinger[I]]); + if (TtoNextChange <= 11) OR (start) Then MethodRec.Print (1, 18, PlayerInfo.Playerinfo[I].PosX+5, PlayerInfo.Playerinfo[I].PosY+10, display); end; - Result := true; + if (CurSentence = ChangeOnSentence) then begin ChangeOnSentence := CurSentence + 7; firsttime := true; end; +Result := True; end; -// is executed on finish, returns the player number of the winner -function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Is Executed on Finish, Returns the Playernum of the Winner +function Finish (var Playerinfo: TPlayerinfo): byte; stdcall; var - Index: integer; - MaxScore: word; + I:Integer; + MaxScore: Word; begin Result := 0; MaxScore := 0; - for Index := 0 to PlayerInfo.NumPlayers-1 do + for I := 0 to PlayerInfo.NumPlayers-1 do begin - PlayerInfo.Playerinfo[Index].Percentage := PlayerInfo.Playerinfo[Index].Score div 9999; - if (PlayerInfo.Playerinfo[Index].Score > MaxScore) then + PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (PlayerInfo.Playerinfo[I].Score > MaxScore) then begin - MaxScore := PlayerInfo.Playerinfo[Index].Score; - case Index of + MaxScore := PlayerInfo.Playerinfo[I].Score; + Case I of 0: Result := 1; 1: Result := 2; 2: Result := 4; @@ -243,29 +213,26 @@ begin 5: Result := 32; end; end - else if (PlayerInfo.Playerinfo[Index].Score = MaxScore) and (PlayerInfo.Playerinfo[Index].Score <> 0) then + else if (PlayerInfo.Playerinfo[I].Score = MaxScore) AND (PlayerInfo.Playerinfo[I].Score <> 0) then begin - case Index of - 0: Result := Result or 1; - 1: Result := Result or 2; - 2: Result := Result or 4; - 3: Result := Result or 8; - 4: Result := Result or 16; - 5: Result := Result or 32; + Case I of + 0: Result := Result OR 1; + 1: Result := Result OR 2; + 2: Result := Result OR 4; + 3: Result := Result OR 8; + 4: Result := Result OR 16; + 5: Result := Result OR 32; end; end; end; - // When nobody has points -> everybody looses + //When nobody has Points -> Everybody loose if (MaxScore = 0) then Result := 0; end; exports - PluginInfo, - Init, - Draw, - Finish; +PluginInfo, Init, Draw, Finish; begin |