From 34120b83807097ca25af4af5d35ac6023627bee6 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 18 Apr 2009 08:09:49 +0000 Subject: rename StrUtils.pas to USDXStrUtils.pas; should finally be removed anyway. Many text changes in comments git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1675 b956fd51-792f-4845-bead-9b4dfca2ff2c --- plugins/Blind/Blind.dpr | 2 +- plugins/Don't_Get_Worse/Hold_The_Line.dpr | 54 ++++++++++----------- plugins/SDK/StrUtils.pas | 79 ------------------------------- plugins/SDK/USDXStrUtils.pas | 79 +++++++++++++++++++++++++++++++ plugins/Team_Duell/TeamDuell.dpr | 59 +++++++++++------------ 5 files changed, 137 insertions(+), 136 deletions(-) delete mode 100644 plugins/SDK/StrUtils.pas create mode 100644 plugins/SDK/USDXStrUtils.pas diff --git a/plugins/Blind/Blind.dpr b/plugins/Blind/Blind.dpr index 534767f3..82721102 100644 --- a/plugins/Blind/Blind.dpr +++ b/plugins/Blind/Blind.dpr @@ -53,7 +53,7 @@ begin Result := true; end; -// executed everytime the screen is drawed. if false the game finishes +// 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} diff --git a/plugins/Don't_Get_Worse/Hold_The_Line.dpr b/plugins/Don't_Get_Worse/Hold_The_Line.dpr index ca59cbdb..2b819609 100644 --- a/plugins/Don't_Get_Worse/Hold_The_Line.dpr +++ b/plugins/Don't_Get_Worse/Hold_The_Line.dpr @@ -6,7 +6,7 @@ library Hold_The_Line; uses ModiSDK in '..\SDK\ModiSDK.pas', - StrUtils in '..\SDK\StrUtils.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'; @@ -23,7 +23,7 @@ var DismissedSound: cardinal; -// Gave the Plugins Info +// Give the plugin's info procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin Info.Name := 'PLUGIN_HDL_NAME'; @@ -36,30 +36,30 @@ begin 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 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 := false; // if true the Plugin can only be Played in Team Mode - Info.GetSoundData := false; // if true the RData Procedure is called when new Sound Data is available - Info.Dummy := false; // Should be Set to false... for Updating Plugin Interface + 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 := false; // if true the plugin can only be played in team mode + Info.GetSoundData := false; // if true the rdata procedure is called when new sound data is available + Info.Dummy := false; // Should be set to false... for updating plugin interface end; -// Executed on Game Start; if true Game begins, else Failure +// executed on game start. if true game begins, else failure function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; @@ -149,7 +149,7 @@ begin MethodRec.PlaySound (DismissedSound); end; - // Draw Pointer + // Draw pointer if (PointerVisible) then begin glColor4f (0.2, 0.8, 0.1, 1); @@ -175,7 +175,7 @@ begin else begin Inc(C); - // Draw Dismissed + // Draw dismissed Text := CreateStr(PChar('PARTY_DISMISSED')); glColor4f (0.8, 0.8, 0.8, 1); @@ -188,7 +188,7 @@ begin Result := false; end; -// Is Executed on Finish, Returns the Playernum of the Winner +// 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; diff --git a/plugins/SDK/StrUtils.pas b/plugins/SDK/StrUtils.pas deleted file mode 100644 index 069c89c3..00000000 --- a/plugins/SDK/StrUtils.pas +++ /dev/null @@ -1,79 +0,0 @@ -unit StrUtils; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -uses ModiSDK; - -//function StrToAChar(Str: String): AChar; -function CreateStr(Str: PChar): PChar; -procedure FreeStr(Str: PChar); - -implementation - -{$IFDEF FPC} - {$ASMMODE Intel} -{$ENDIF} - -{function StrToAChar(Str: String): AChar; -var - L, I: Integer; -begin - L := Length(Str); - For I := 0 to L-1 do - AChar[I] := Str[I+1]; - - For I := L to 254 do - AChar[I] := #0; -end; } - -function StrCopy(Dest, Source: PChar): PChar; assembler; -asm - PUSH EDI - PUSH ESI - MOV ESI,EAX - MOV EDI,EDX - MOV ECX,0FFFFFFFFH - XOR AL,AL - REPNE SCASB - NOT ECX - MOV EDI,ESI - MOV ESI,EDX - MOV EDX,ECX - MOV EAX,EDI - SHR ECX,2 - REP MOVSD - MOV ECX,EDX - AND ECX,3 - REP MOVSB - POP ESI - POP EDI -end; - -function StrLen(Str: PChar): Cardinal; assembler; -asm - MOV EDX,EDI - MOV EDI,EAX - MOV ECX,0FFFFFFFFH - XOR AL,AL - REPNE SCASB - MOV EAX,0FFFFFFFEH - SUB EAX,ECX - MOV EDI,EDX -end; - -function CreateStr(Str: PChar): PChar; -begin - GetMem(Result, StrLen(Str) + 1); - StrCopy(Result, Str); -end; - -procedure FreeStr(Str: PChar); -begin - FreeMem(Str); -end; - -end. diff --git a/plugins/SDK/USDXStrUtils.pas b/plugins/SDK/USDXStrUtils.pas new file mode 100644 index 00000000..94e5f65f --- /dev/null +++ b/plugins/SDK/USDXStrUtils.pas @@ -0,0 +1,79 @@ +unit USDXStrUtils; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +uses ModiSDK; + +//function StrToAChar(Str: String): AChar; +function CreateStr(Str: PChar): PChar; +procedure FreeStr(Str: PChar); + +implementation + +{$IFDEF FPC} + {$ASMMODE Intel} +{$ENDIF} + +{function StrToAChar(Str: String): AChar; +var + L, I: Integer; +begin + L := Length(Str); + For I := 0 to L-1 do + AChar[I] := Str[I+1]; + + For I := L to 254 do + AChar[I] := #0; +end; } + +function StrCopy(Dest, Source: PChar): PChar; assembler; +asm + PUSH EDI + PUSH ESI + MOV ESI,EAX + MOV EDI,EDX + MOV ECX,0FFFFFFFFH + XOR AL,AL + REPNE SCASB + NOT ECX + MOV EDI,ESI + MOV ESI,EDX + MOV EDX,ECX + MOV EAX,EDI + SHR ECX,2 + REP MOVSD + MOV ECX,EDX + AND ECX,3 + REP MOVSB + POP ESI + POP EDI +end; + +function StrLen(Str: PChar): Cardinal; assembler; +asm + MOV EDX,EDI + MOV EDI,EAX + MOV ECX,0FFFFFFFFH + XOR AL,AL + REPNE SCASB + MOV EAX,0FFFFFFFEH + SUB EAX,ECX + MOV EDI,EDX +end; + +function CreateStr(Str: PChar): PChar; +begin + GetMem(Result, StrLen(Str) + 1); + StrCopy(Result, Str); +end; + +procedure FreeStr(Str: PChar); +begin + FreeMem(Str); +end; + +end. diff --git a/plugins/Team_Duell/TeamDuell.dpr b/plugins/Team_Duell/TeamDuell.dpr index 6b8f4c30..4588e5ff 100644 --- a/plugins/Team_Duell/TeamDuell.dpr +++ b/plugins/Team_Duell/TeamDuell.dpr @@ -4,9 +4,11 @@ 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', - StrUtils in '..\SDK\StrUtils.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', @@ -22,8 +24,7 @@ var bps, RTtoNextChange: double; firsttime, secondtime: boolean; - -// Give the Plugin's Info +// Give the plugin's info procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin Info.Name := 'PLUGIN_TEAMDUELL_NAME'; @@ -35,30 +36,30 @@ begin 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.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.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.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 + 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 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 end; -// Executed on Game Start; if true Game begins, else Failure +// executed on game start. if true game begins, else failure function Init (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; @@ -67,13 +68,13 @@ function Init (const TeamInfo: TTeamInfo; var Index, J: integer; begin - // Get beginning of sentences +// Get beginning of sentences for Index := 0 to Sentences.High do begin SetLength(Startpoints, Index+1); Startpoints[Index]:=Sentences.Sentence[Index].Start; end; - // Get Teams and Players + // Get teams and players for Index := 0 to TeamInfo.NumTeams-1 do begin SetLength(TeamPlayer, Index+1); @@ -99,7 +100,7 @@ begin Result := true; end; -// Executed everytime the Screen is Drawed; if false The Game finishes +// 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} @@ -115,7 +116,7 @@ begin starttick := SDL_GetTicks(); end; start := false; - // show first singers for 5sec + // show first singer for 5 sec if (CurSentence < 1) and ((starttick + 5000) > SDL_GetTicks()) then start := true; @@ -128,11 +129,11 @@ begin bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond end; - // Time to next Change + // Time to next change RTtoNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((SDL_GetTicks() - starttick) / 1000); TtoNextChange := Trunc(RTtoNextChange) +1; - // Next Singer for Team I + // Next singer for team I for Index := 0 to High(TeamPlayer) do begin if (CurSentence = ChangeOnSentence) and not(PlayerSelected[Index] = CurSentence) then @@ -144,7 +145,7 @@ begin until not(NextSinger[Index] = CurSinger[Index]) or (SPT[Index] = 1) ; end; - // display bg + // display background glColor4f (0.8, 0.8, 0.8, 1); display := PChar(TeamPlayer[Index,CurSinger[Index]]); if (TtoNextChange <= 11) or (start = true) then @@ -211,7 +212,7 @@ begin Result := true; end; -// Is Executed on Finish, Returns the Playernum of the Winner +// 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; -- cgit v1.2.3